@jamsrui/avatar 0.0.12 → 0.0.14

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.
Files changed (51) hide show
  1. package/dist/avatar-config.d.mts +6 -6
  2. package/dist/avatar-config.mjs +1 -1
  3. package/dist/avatar-context.mjs +1 -0
  4. package/dist/{primitive/avatar-fallback.d.mts → avatar-fallback.d.mts} +1 -0
  5. package/dist/avatar-fallback.mjs +1 -0
  6. package/dist/avatar-image.mjs +1 -0
  7. package/dist/avatar-indicator.mjs +1 -0
  8. package/dist/{primitive/avatar-root.d.mts → avatar-root.d.mts} +1 -1
  9. package/dist/avatar-root.mjs +1 -0
  10. package/dist/avatar.d.mts +6 -8
  11. package/dist/avatar.mjs +1 -1
  12. package/dist/index.d.mts +28 -8
  13. package/dist/index.mjs +1 -1
  14. package/dist/{primitive/styles.d.mts → styles.d.mts} +15 -0
  15. package/dist/styles.mjs +1 -0
  16. package/dist/use-avatar.d.mts +21 -0
  17. package/dist/use-avatar.mjs +1 -0
  18. package/dist/utils.mjs +1 -0
  19. package/package.json +6 -6
  20. package/dist/chunk-46DDRBZC.mjs +0 -1
  21. package/dist/chunk-5Q2ZPY6B.mjs +0 -1
  22. package/dist/chunk-67MYTGCN.mjs +0 -1
  23. package/dist/chunk-6ZPYWJDS.mjs +0 -1
  24. package/dist/chunk-7ZBPIMY4.mjs +0 -1
  25. package/dist/chunk-GXVNM3CJ.mjs +0 -1
  26. package/dist/chunk-J3FSRIIV.mjs +0 -0
  27. package/dist/chunk-NNHCRYDX.mjs +0 -1
  28. package/dist/chunk-TJU5GERX.mjs +0 -1
  29. package/dist/chunk-UBGMEQ6Q.mjs +0 -1
  30. package/dist/chunk-UN72ATNQ.mjs +0 -1
  31. package/dist/chunk-XCPN2D5N.mjs +0 -1
  32. package/dist/chunk-ZRKDZ3US.mjs +0 -1
  33. package/dist/primitive/avatar-config.d.mts +0 -22
  34. package/dist/primitive/avatar-config.mjs +0 -1
  35. package/dist/primitive/avatar-context.mjs +0 -1
  36. package/dist/primitive/avatar-fallback.mjs +0 -1
  37. package/dist/primitive/avatar-image.mjs +0 -1
  38. package/dist/primitive/avatar-indicator.mjs +0 -1
  39. package/dist/primitive/avatar-root.mjs +0 -1
  40. package/dist/primitive/avatar.d.mts +0 -16
  41. package/dist/primitive/avatar.mjs +0 -1
  42. package/dist/primitive/index.d.mts +0 -13
  43. package/dist/primitive/index.mjs +0 -1
  44. package/dist/primitive/styles.mjs +0 -1
  45. package/dist/primitive/use-avatar.d.mts +0 -27
  46. package/dist/primitive/use-avatar.mjs +0 -1
  47. package/dist/primitive/utils.mjs +0 -1
  48. /package/dist/{primitive/avatar-context.d.mts → avatar-context.d.mts} +0 -0
  49. /package/dist/{primitive/avatar-image.d.mts → avatar-image.d.mts} +0 -0
  50. /package/dist/{primitive/avatar-indicator.d.mts → avatar-indicator.d.mts} +0 -0
  51. /package/dist/{primitive/utils.d.mts → utils.d.mts} +0 -0
@@ -1,13 +1,13 @@
1
- import { Avatar } from './avatar.mjs';
2
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
2
  import { GlobalConfigProps } from '@jamsrui/core';
4
- import './primitive/use-avatar.mjs';
3
+ import { Avatar } from './avatar.mjs';
4
+ import './use-avatar.mjs';
5
5
  import '@jamsrui/utils';
6
- import './primitive/avatar-fallback.mjs';
6
+ import './avatar-fallback.mjs';
7
7
  import 'react';
8
- import './primitive/avatar-image.mjs';
9
- import './primitive/avatar-root.mjs';
10
- import './primitive/styles.mjs';
8
+ import './avatar-image.mjs';
9
+ import './avatar-root.mjs';
10
+ import './styles.mjs';
11
11
 
12
12
  declare const useAvatarConfig: () => AvatarConfig.Props;
13
13
  declare const AvatarConfig: (props: Omit<Partial<AvatarConfig.Props>, "children"> & {
@@ -1 +1 @@
1
- import{a,b}from"./chunk-GXVNM3CJ.mjs";export{a as AvatarConfig,b as useAvatarConfig};
1
+ "use client";import{createConfigContext as a}from"@jamsrui/utils";const[r,t]=a({displayName:"AvatarConfig"});export{r as AvatarConfig,t as useAvatarConfig};
@@ -0,0 +1 @@
1
+ "use client";import{createContext as e,use as r}from"react";const a=e(null),n=()=>{const t=r(a);if(!t)throw new Error("useAvatarContext must be used within a AvatarContext");return t};export{a as AvatarContext,n as useAvatarContext};
@@ -4,6 +4,7 @@ import { UIProps } from '@jamsrui/utils';
4
4
  declare const AvatarFallback: (props: AvatarFallback.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | null;
5
5
  declare namespace AvatarFallback {
6
6
  interface Props extends UIProps<"div"> {
7
+ delayMs?: number;
7
8
  }
8
9
  }
9
10
 
@@ -0,0 +1 @@
1
+ "use client";import{jsx as b}from"react/jsx-runtime";import{useRenderElement as m}from"@jamsrui/hooks";import{AvatarIcon as u}from"@jamsrui/icons";import{useAvatarContext as i}from"./avatar-context.mjs";import{useEffect as d,useState as f}from"react";const A=e=>{const{delayMs:t=0,children:r=b(u,{}),...o}=e,{getFallbackProps:a,status:s}=i(),[l,n]=f(t===0);d(()=>{const p=setTimeout(()=>{n(!0)},t);return()=>clearTimeout(p)},[t]);const c=m("div",{props:[a(o),{children:r}]});return s==="loaded"||!l?null:c};export{A as AvatarFallback};
@@ -0,0 +1 @@
1
+ "use client";import{useRenderElement as s}from"@jamsrui/hooks";import{useAvatarContext as a}from"./avatar-context.mjs";const p=r=>{const{getImgProps:e,status:t}=a(),o=s("img",{props:[e(r)]});return t==="error"?null:o};export{p as AvatarImage};
@@ -0,0 +1 @@
1
+ "use client";import{useRenderElement as t}from"@jamsrui/hooks";import{useAvatarContext as o}from"./avatar-context.mjs";const p=r=>{const{getIndicatorProps:e}=o();return t("div",{props:[e(r)]})};export{p as AvatarIndicator};
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { UIProps } from '@jamsrui/utils';
3
3
 
4
- declare const AvatarRoot: (props: AvatarRoot.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
4
+ declare const AvatarRoot: (_props: AvatarRoot.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
5
5
  declare namespace AvatarRoot {
6
6
  interface Props extends UIProps<"div"> {
7
7
  }
@@ -0,0 +1 @@
1
+ "use client";import{useRenderElement as r}from"@jamsrui/hooks";import{useAvatarContext as t}from"./avatar-context.mjs";const a=o=>{const{getRootProps:e}=t();return r("div",{props:[e()]})};export{a as AvatarRoot};
package/dist/avatar.d.mts CHANGED
@@ -1,17 +1,15 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { useAvatar } from './primitive/use-avatar.mjs';
3
- import { SlotsToReactNode } from '@jamsrui/utils';
4
- import { AvatarSlots } from './primitive/styles.mjs';
5
- import './primitive/avatar-fallback.mjs';
2
+ import { useAvatar } from './use-avatar.mjs';
3
+ import '@jamsrui/utils';
4
+ import './avatar-fallback.mjs';
6
5
  import 'react';
7
- import './primitive/avatar-image.mjs';
8
- import './primitive/avatar-root.mjs';
6
+ import './avatar-image.mjs';
7
+ import './avatar-root.mjs';
8
+ import './styles.mjs';
9
9
 
10
10
  declare const Avatar: (props: Avatar.Props) => react_jsx_runtime.JSX.Element;
11
11
  declare namespace Avatar {
12
12
  interface Props extends useAvatar.Props {
13
- slots?: SlotsToReactNode<AvatarSlots>;
14
- indicator?: React.ReactNode;
15
13
  }
16
14
  }
17
15
 
package/dist/avatar.mjs CHANGED
@@ -1 +1 @@
1
- import{a}from"./chunk-7ZBPIMY4.mjs";import"./chunk-J3FSRIIV.mjs";import"./chunk-6ZPYWJDS.mjs";import"./chunk-ZRKDZ3US.mjs";import"./chunk-5Q2ZPY6B.mjs";import"./chunk-TJU5GERX.mjs";import"./chunk-UN72ATNQ.mjs";import"./chunk-GXVNM3CJ.mjs";import"./chunk-XCPN2D5N.mjs";import"./chunk-NNHCRYDX.mjs";import"./chunk-46DDRBZC.mjs";import"./chunk-67MYTGCN.mjs";import"./chunk-UBGMEQ6Q.mjs";export{a as Avatar};
1
+ "use client";import{jsx as r}from"react/jsx-runtime";import{mergeConfigProps as s}from"@jamsrui/utils";import{useAvatarConfig as m}from"./avatar-config.mjs";import{AvatarContext as p}from"./avatar-context.mjs";import{AvatarRoot as v}from"./avatar-root.mjs";import{useAvatar as c}from"./use-avatar.mjs";const u=t=>{const{children:a}=t,o=m(),e=s(o,o,t),n=c(e);return r(p,{value:n,children:r(v,{children:a})})};export{u as Avatar};
package/dist/index.d.mts CHANGED
@@ -1,11 +1,31 @@
1
- export { Avatar } from './avatar.mjs';
1
+ import * as react from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { Avatar as Avatar$1 } from './avatar.mjs';
4
+ import { AvatarFallback } from './avatar-fallback.mjs';
5
+ import { AvatarImage } from './avatar-image.mjs';
6
+ import { AvatarIndicator } from './avatar-indicator.mjs';
2
7
  export { AvatarConfig, useAvatarConfig } from './avatar-config.mjs';
3
- import 'react/jsx-runtime';
4
- import './primitive/use-avatar.mjs';
8
+ import './use-avatar.mjs';
5
9
  import '@jamsrui/utils';
6
- import './primitive/avatar-fallback.mjs';
7
- import 'react';
8
- import './primitive/avatar-image.mjs';
9
- import './primitive/avatar-root.mjs';
10
- import './primitive/styles.mjs';
10
+ import './avatar-root.mjs';
11
+ import './styles.mjs';
11
12
  import '@jamsrui/core';
13
+
14
+ declare const Avatar: ((props: Avatar$1.Props) => react_jsx_runtime.JSX.Element) & {
15
+ Root: (props: Avatar$1.Props) => react_jsx_runtime.JSX.Element;
16
+ Image: (props: AvatarImage.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | null;
17
+ Fallback: (props: AvatarFallback.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | null;
18
+ Indicator: (props: AvatarIndicator.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
19
+ };
20
+ declare namespace Avatar {
21
+ interface Props extends Avatar$1.Props {
22
+ }
23
+ interface Image extends AvatarImage.Props {
24
+ }
25
+ interface Fallback extends AvatarFallback.Props {
26
+ }
27
+ interface Indicator extends AvatarIndicator.Props {
28
+ }
29
+ }
30
+
31
+ export { Avatar };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- "use client";import{a as o}from"./chunk-7ZBPIMY4.mjs";import"./chunk-J3FSRIIV.mjs";import"./chunk-6ZPYWJDS.mjs";import"./chunk-ZRKDZ3US.mjs";import"./chunk-5Q2ZPY6B.mjs";import"./chunk-TJU5GERX.mjs";import"./chunk-UN72ATNQ.mjs";import{a as r,b as a}from"./chunk-GXVNM3CJ.mjs";import"./chunk-XCPN2D5N.mjs";import"./chunk-NNHCRYDX.mjs";import"./chunk-46DDRBZC.mjs";import"./chunk-67MYTGCN.mjs";import"./chunk-UBGMEQ6Q.mjs";export{o as Avatar,r as AvatarConfig,a as useAvatarConfig};
1
+ import{Avatar as a}from"./avatar.mjs";import{AvatarFallback as r}from"./avatar-fallback.mjs";import{AvatarImage as t}from"./avatar-image.mjs";import{AvatarIndicator as o}from"./avatar-indicator.mjs";import{AvatarConfig as v,useAvatarConfig as A}from"./avatar-config.mjs";const i=Object.assign(a,{Root:a,Image:t,Fallback:r,Indicator:o});export{i as Avatar,v as AvatarConfig,A as useAvatarConfig};
@@ -5,18 +5,23 @@ declare const avatarVariants: _jamsrui_utils.TVReturnType<{
5
5
  size: {
6
6
  xs: {
7
7
  root: string;
8
+ fallback: string;
8
9
  };
9
10
  sm: {
10
11
  root: string;
12
+ fallback: string;
11
13
  };
12
14
  md: {
13
15
  root: string;
16
+ fallback: string;
14
17
  };
15
18
  lg: {
16
19
  root: string;
20
+ fallback: string;
17
21
  };
18
22
  xl: {
19
23
  root: string;
24
+ fallback: string;
20
25
  };
21
26
  };
22
27
  color: {
@@ -66,18 +71,23 @@ declare const avatarVariants: _jamsrui_utils.TVReturnType<{
66
71
  size: {
67
72
  xs: {
68
73
  root: string;
74
+ fallback: string;
69
75
  };
70
76
  sm: {
71
77
  root: string;
78
+ fallback: string;
72
79
  };
73
80
  md: {
74
81
  root: string;
82
+ fallback: string;
75
83
  };
76
84
  lg: {
77
85
  root: string;
86
+ fallback: string;
78
87
  };
79
88
  xl: {
80
89
  root: string;
90
+ fallback: string;
81
91
  };
82
92
  };
83
93
  color: {
@@ -127,18 +137,23 @@ declare const avatarVariants: _jamsrui_utils.TVReturnType<{
127
137
  size: {
128
138
  xs: {
129
139
  root: string;
140
+ fallback: string;
130
141
  };
131
142
  sm: {
132
143
  root: string;
144
+ fallback: string;
133
145
  };
134
146
  md: {
135
147
  root: string;
148
+ fallback: string;
136
149
  };
137
150
  lg: {
138
151
  root: string;
152
+ fallback: string;
139
153
  };
140
154
  xl: {
141
155
  root: string;
156
+ fallback: string;
142
157
  };
143
158
  };
144
159
  color: {
@@ -0,0 +1 @@
1
+ import{radiusVariant as r,tv as t}from"@jamsrui/utils";const a=t({slots:{root:"relative cursor-default group shrink-0 rounded-full bg-surface object-cover [&>img]:size-full [&>img]:object-cover",img:"select-none group-data-[status=idle]:hidden group-data-[status=loading]:hidden rounded-inherit",fallback:"absolute inset-0 flex items-center justify-center font-medium",indicator:"absolute -bottom-2 -right-1 size-6 flex justify-center items-center"},variants:{size:{xs:{root:"size-6",fallback:"text-xs"},sm:{root:"size-8",fallback:"text-sm"},md:{root:"size-10",fallback:"text-base"},lg:{root:"size-12",fallback:"text-lg"},xl:{root:"size-16",fallback:"text-xl"}},color:{default:{root:"bg-default text-default-foreground ring-default"},primary:{root:"bg-primary text-primary-foreground ring-primary"},secondary:{root:"bg-secondary text-secondary-foreground ring-secondary"},success:{root:"bg-success text-success-foreground ring-success"},warning:{root:"bg-warning text-warning-foreground ring-warning"},danger:{root:"bg-danger text-danger-foreground ring-danger"}},isBordered:{true:{root:"ring-2"},false:{root:"border-transparent"}},radius:r("root")},defaultVariants:{bordered:!1,size:"md",color:"default",radius:"full"}});export{a as avatarVariants};
@@ -0,0 +1,21 @@
1
+ import { PropGetter } from '@jamsrui/utils';
2
+ import { AvatarFallback } from './avatar-fallback.mjs';
3
+ import { AvatarImage } from './avatar-image.mjs';
4
+ import { AvatarRoot } from './avatar-root.mjs';
5
+ import { AvatarVariants } from './styles.mjs';
6
+ import 'react';
7
+
8
+ type ImageLoadingStatus = "idle" | "loading" | "loaded" | "error";
9
+ declare const useAvatar: (props: useAvatar.Props) => {
10
+ getRootProps: () => AvatarRoot.Props;
11
+ getImgProps: PropGetter<AvatarImage.Props>;
12
+ getFallbackProps: PropGetter<AvatarFallback.Props>;
13
+ getIndicatorProps: PropGetter<AvatarFallback.Props>;
14
+ status: ImageLoadingStatus;
15
+ };
16
+ declare namespace useAvatar {
17
+ interface Props extends AvatarVariants, AvatarRoot.Props {
18
+ }
19
+ }
20
+
21
+ export { useAvatar };
@@ -0,0 +1 @@
1
+ "use client";import{useCallback as o,useLayoutEffect as N,useMemo as y,useRef as b,useState as k}from"react";import{dataAttrDev as r,mapPropsVariants as I}from"@jamsrui/utils";import{avatarVariants as g}from"./styles.mjs";const E=l=>{const[P,m]=I(l,g.variantKeys),{...c}=P,[s,e]=k("idle"),A=m.color??"default",n=b(null),t=g({...m,color:A}),i=o(()=>{e("error")},[e]),p=o(()=>{e("loaded")},[e]),d=o(()=>({...c,"data-slot":r("root"),"data-component":r("avatar"),"data-status":r(s),className:t.root({className:l.className})}),[c,l.className,s,t]);N(()=>{const a=n.current;a?.complete?a.naturalWidth===0?e("error"):e("loaded"):e("loading")},[]);const u=o(a=>({...a,ref:n,"data-slot":r("img"),onError:i,onLoad:p,className:t.img({className:a.className})}),[i,p,t]),v=o(a=>({...a,"data-slot":r("fallback"),className:t.fallback({className:a.className})}),[t]),f=o(a=>({...a,"data-slot":r("indicator"),className:t.indicator({className:a.className})}),[t]);return y(()=>({getRootProps:d,getImgProps:u,getFallbackProps:v,getIndicatorProps:f,status:s}),[v,u,f,d,s])};export{E as useAvatar};
package/dist/utils.mjs ADDED
@@ -0,0 +1 @@
1
+ const t=r=>r.charAt(0).toUpperCase(),e=r=>["A","N","H","L","Q"].includes(r)?"primary":["F","G","T","I","J"].includes(r)?"secondary":["K","D","Y","B","O"].includes(r)?"success":["P","E","R","S","U"].includes(r)?"warning":["V","W","X","M","Z"].includes(r)?"danger":"default";export{e as getColorByName,t as getFirstChar};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jamsrui/avatar",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./dist/index.d.ts",
@@ -15,11 +15,11 @@
15
15
  "react": ">=19"
16
16
  },
17
17
  "dependencies": {
18
- "@jamsrui/hooks": "^0.0.12",
19
- "@jamsrui/icons": "^0.0.10",
20
- "@jamsrui/core": "^0.0.10",
21
- "@jamsrui/slot": "^0.0.11",
22
- "@jamsrui/utils": "^0.0.12"
18
+ "@jamsrui/core": "^0.0.12",
19
+ "@jamsrui/slot": "^0.0.13",
20
+ "@jamsrui/hooks": "^0.0.14",
21
+ "@jamsrui/icons": "^0.0.12",
22
+ "@jamsrui/utils": "^0.0.14"
23
23
  },
24
24
  "description": "A modern and beautiful Next.js UI components library.",
25
25
  "keywords": [
@@ -1 +0,0 @@
1
- import{b as e}from"./chunk-UBGMEQ6Q.mjs";import{useRenderElement as m}from"@jamsrui/hooks";var n=r=>{let{getImgProps:t,hasImage:o}=e(),a=m("img",{props:[t(r)]});return o?a:null};export{n as a};
@@ -1 +0,0 @@
1
- import{a as g}from"./chunk-TJU5GERX.mjs";import{a as f}from"./chunk-UN72ATNQ.mjs";import{useCallback as o,useEffect as x,useMemo as C,useState as R}from"react";import{cn as c,dataAttrDev as e,mapPropsVariants as V}from"@jamsrui/utils";var B=E=>{let[F,v]=V(E,g.variantKeys),{classNames:t,children:d,alt:s="",fallback:l,onError:P,name:N,src:n,...m}=F,u=typeof d=="string"&&f(d)||s.length>0&&f(s)||"",G=v.color??"default",r=g({...v,color:G}),[i,p]=R(n),A=i?.length??!1;x(()=>{p(n)},[n]);let b=o(a=>{P?.(a);let h=typeof l=="function"?l({alt:s,name:N}):l;p(h||void 0)},[s,l,N,P]),k=o(a=>({...a,"data-slot":e("root"),"data-component":e("avatar"),className:r.root({className:c(t?.root,a.className)})}),[t?.root,r]),y=o(()=>({draggable:"false",...m,"data-slot":e("img"),onError:b,src:i,alt:s,className:r.img({className:c(t?.img,m.className)})}),[s,t?.img,b,m,i,r]),I=o(a=>({...a,"data-slot":e("fallback"),className:r.fallback({className:c(t?.fallback,a.className)})}),[t?.fallback,r]),S=o(a=>({...a,"data-slot":e("indicator"),className:r.indicator({className:c(t?.indicator,a.className)})}),[t?.indicator,r]);return C(()=>({getRootProps:k,getImgProps:y,getFallbackProps:I,getIndicatorProps:S,fallBackString:u,hasImage:A}),[u,I,y,S,k,A])};export{B as a};
@@ -1 +0,0 @@
1
- import{b as r}from"./chunk-UBGMEQ6Q.mjs";import{useRenderElement as o}from"@jamsrui/hooks";var s=t=>{let{getIndicatorProps:e}=r();return o("div",{props:[e(t)]})};export{s as a};
@@ -1 +0,0 @@
1
- import{a as p}from"./chunk-ZRKDZ3US.mjs";import{a as v}from"./chunk-5Q2ZPY6B.mjs";import{b as a}from"./chunk-XCPN2D5N.mjs";import{a as m}from"./chunk-NNHCRYDX.mjs";import{a as n}from"./chunk-46DDRBZC.mjs";import{a as e}from"./chunk-UBGMEQ6Q.mjs";import{mergeConfigProps as f}from"@jamsrui/utils";import{jsx as r,jsxs as i}from"react/jsx-runtime";var b=t=>{let{children:s}=t,o=a(),A=f(o,o,t),c=v(A);return r(e,{value:c,children:i(p,{children:[r(n,{}),r(m,{children:s})]})})};export{b as a};
@@ -1 +0,0 @@
1
- import{a as n}from"./chunk-ZRKDZ3US.mjs";import{a as v}from"./chunk-5Q2ZPY6B.mjs";import{b as s}from"./chunk-GXVNM3CJ.mjs";import{a as i}from"./chunk-NNHCRYDX.mjs";import{a as c}from"./chunk-46DDRBZC.mjs";import{a as m}from"./chunk-67MYTGCN.mjs";import{a as l}from"./chunk-UBGMEQ6Q.mjs";import{Slot as a}from"@jamsrui/slot";import{mergeConfigProps as g}from"@jamsrui/utils";import{jsx as t,jsxs as u}from"react/jsx-runtime";var b=r=>{let p=s(),A=g(p,r,r),{children:d,slots:o,indicator:e,...f}=A,S=v(f);return t(l,{value:S,children:t(a,{slot:o?.root,children:u(n,{children:[t(a,{slot:o?.img,children:t(c,{})}),t(a,{slot:o?.fallback,children:t(i,{children:d})}),!!e&&t(a,{slot:o?.indicator,children:t(m,{children:e})})]})})})};export{b as a};
@@ -1 +0,0 @@
1
- import{createConfigContext as a}from"@jamsrui/utils";var[r,t]=a({displayName:"AvatarConfig"});export{r as a,t as b};
File without changes
@@ -1 +0,0 @@
1
- import{b as r}from"./chunk-UBGMEQ6Q.mjs";import{useRenderElement as p}from"@jamsrui/hooks";import{AvatarIcon as s}from"@jamsrui/icons";import{jsx as c}from"react/jsx-runtime";var v=a=>{let{getFallbackProps:t,fallBackString:e,hasImage:o}=r(),l=e||c(s,{}),n=p("div",{props:[t(a),{children:l}]});return o?null:n};export{v as a};
@@ -1 +0,0 @@
1
- import{radiusVariant as r,tv as e}from"@jamsrui/utils";var o=e({slots:{root:"relative shrink-0 rounded-full bg-surface object-cover text-md font-medium [&>img]:size-full [&>img]:object-cover",img:"select-none rounded-inherit",fallback:"absolute inset-0 flex items-center justify-center",indicator:"absolute -bottom-2 -right-1 size-6 flex justify-center items-center"},variants:{size:{xs:{root:"size-6"},sm:{root:"size-8"},md:{root:"size-10"},lg:{root:"size-12"},xl:{root:"size-16"}},color:{default:{root:"bg-default text-default-foreground ring-default"},primary:{root:"bg-primary text-primary-foreground ring-primary"},secondary:{root:"bg-secondary text-secondary-foreground ring-secondary"},success:{root:"bg-success text-success-foreground ring-success"},warning:{root:"bg-warning text-warning-foreground ring-warning"},danger:{root:"bg-danger text-danger-foreground ring-danger"}},isBordered:{true:{root:"ring-2"},false:{root:"border-transparent"}},radius:r("root")},defaultVariants:{bordered:!1,size:"md",color:"default",radius:"full"}});export{o as a};
@@ -1 +0,0 @@
1
- import{createContext as e,use as r}from"react";var a=e(null),n=()=>{let t=r(a);if(!t)throw new Error("useAvatarContext must be used within a AvatarContext");return t};export{a,n as b};
@@ -1 +0,0 @@
1
- var t=r=>r.charAt(0).toUpperCase(),e=r=>["A","N","H","L","Q"].includes(r)?"primary":["F","G","T","I","J"].includes(r)?"secondary":["K","D","Y","B","O"].includes(r)?"success":["P","E","R","S","U"].includes(r)?"warning":["V","W","X","M","Z"].includes(r)?"danger":"default";export{t as a,e as b};
@@ -1 +0,0 @@
1
- import{createConfigContext as a}from"@jamsrui/utils";var[r,t]=a({displayName:"AvatarConfig"});export{r as a,t as b};
@@ -1 +0,0 @@
1
- import{b as r}from"./chunk-UBGMEQ6Q.mjs";import{useRenderElement as o}from"@jamsrui/hooks";var a=t=>{let{getRootProps:e}=r();return o("div",{props:[e(t)]})};export{a};
@@ -1,22 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { GlobalConfigProps } from '@jamsrui/core';
3
- import { Avatar } from './avatar.mjs';
4
- import './use-avatar.mjs';
5
- import '@jamsrui/utils';
6
- import './avatar-fallback.mjs';
7
- import 'react';
8
- import './avatar-image.mjs';
9
- import './avatar-root.mjs';
10
- import './styles.mjs';
11
-
12
- declare const useAvatarConfig: () => AvatarConfig.Props;
13
- declare const AvatarConfig: (props: Omit<Partial<AvatarConfig.Props>, "children"> & {
14
- merge?: boolean;
15
- children: React.ReactNode;
16
- }) => react_jsx_runtime.JSX.Element;
17
- declare namespace AvatarConfig {
18
- interface Props extends Avatar.Props, GlobalConfigProps<Avatar.Props> {
19
- }
20
- }
21
-
22
- export { AvatarConfig, useAvatarConfig };
@@ -1 +0,0 @@
1
- import{a,b}from"../chunk-XCPN2D5N.mjs";export{a as AvatarConfig,b as useAvatarConfig};
@@ -1 +0,0 @@
1
- import{a,b}from"../chunk-UBGMEQ6Q.mjs";export{a as AvatarContext,b as useAvatarContext};
@@ -1 +0,0 @@
1
- import{a}from"../chunk-NNHCRYDX.mjs";import"../chunk-UBGMEQ6Q.mjs";export{a as AvatarFallback};
@@ -1 +0,0 @@
1
- import{a}from"../chunk-46DDRBZC.mjs";import"../chunk-UBGMEQ6Q.mjs";export{a as AvatarImage};
@@ -1 +0,0 @@
1
- import{a}from"../chunk-67MYTGCN.mjs";import"../chunk-UBGMEQ6Q.mjs";export{a as AvatarIndicator};
@@ -1 +0,0 @@
1
- import{a}from"../chunk-ZRKDZ3US.mjs";import"../chunk-UBGMEQ6Q.mjs";export{a as AvatarRoot};
@@ -1,16 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { useAvatar } from './use-avatar.mjs';
3
- import '@jamsrui/utils';
4
- import './avatar-fallback.mjs';
5
- import 'react';
6
- import './avatar-image.mjs';
7
- import './avatar-root.mjs';
8
- import './styles.mjs';
9
-
10
- declare const Avatar: (props: Avatar.Props) => react_jsx_runtime.JSX.Element;
11
- declare namespace Avatar {
12
- interface Props extends useAvatar.Props {
13
- }
14
- }
15
-
16
- export { Avatar };
@@ -1 +0,0 @@
1
- import{a}from"../chunk-6ZPYWJDS.mjs";import"../chunk-ZRKDZ3US.mjs";import"../chunk-5Q2ZPY6B.mjs";import"../chunk-TJU5GERX.mjs";import"../chunk-UN72ATNQ.mjs";import"../chunk-XCPN2D5N.mjs";import"../chunk-NNHCRYDX.mjs";import"../chunk-46DDRBZC.mjs";import"../chunk-UBGMEQ6Q.mjs";export{a as Avatar};
@@ -1,13 +0,0 @@
1
- export { Avatar } from './avatar.mjs';
2
- export { AvatarConfig, useAvatarConfig } from './avatar-config.mjs';
3
- export { AvatarContext, useAvatarContext } from './avatar-context.mjs';
4
- export { AvatarFallback } from './avatar-fallback.mjs';
5
- export { AvatarImage } from './avatar-image.mjs';
6
- export { AvatarIndicator } from './avatar-indicator.mjs';
7
- export { AvatarRoot } from './avatar-root.mjs';
8
- export { useAvatar } from './use-avatar.mjs';
9
- import 'react/jsx-runtime';
10
- import '@jamsrui/core';
11
- import 'react';
12
- import '@jamsrui/utils';
13
- import './styles.mjs';
@@ -1 +0,0 @@
1
- "use client";import"../chunk-J3FSRIIV.mjs";import{a as i}from"../chunk-6ZPYWJDS.mjs";import{a as g}from"../chunk-ZRKDZ3US.mjs";import{a as h}from"../chunk-5Q2ZPY6B.mjs";import"../chunk-TJU5GERX.mjs";import"../chunk-UN72ATNQ.mjs";import{a,b}from"../chunk-XCPN2D5N.mjs";import{a as e}from"../chunk-NNHCRYDX.mjs";import{a as f}from"../chunk-46DDRBZC.mjs";import{a as j}from"../chunk-67MYTGCN.mjs";import{a as c,b as d}from"../chunk-UBGMEQ6Q.mjs";export{i as Avatar,a as AvatarConfig,c as AvatarContext,e as AvatarFallback,f as AvatarImage,j as AvatarIndicator,g as AvatarRoot,h as useAvatar,b as useAvatarConfig,d as useAvatarContext};
@@ -1 +0,0 @@
1
- import{a}from"../chunk-TJU5GERX.mjs";export{a as avatarVariants};
@@ -1,27 +0,0 @@
1
- import { PropGetter, UIProps, SlotsToClassNames } from '@jamsrui/utils';
2
- import { AvatarFallback } from './avatar-fallback.mjs';
3
- import { AvatarImage } from './avatar-image.mjs';
4
- import { AvatarRoot } from './avatar-root.mjs';
5
- import { AvatarVariants, AvatarSlots } from './styles.mjs';
6
- import 'react';
7
-
8
- declare const useAvatar: (props: useAvatar.Props) => {
9
- getRootProps: PropGetter<AvatarRoot.Props>;
10
- getImgProps: PropGetter<AvatarImage.Props>;
11
- getFallbackProps: PropGetter<AvatarFallback.Props>;
12
- getIndicatorProps: PropGetter<AvatarFallback.Props>;
13
- fallBackString: string;
14
- hasImage: number | boolean;
15
- };
16
- declare namespace useAvatar {
17
- interface Props extends AvatarVariants, UIProps<"img"> {
18
- fallback?: string | ((_: {
19
- alt: string;
20
- name?: string;
21
- }) => string);
22
- classNames?: SlotsToClassNames<AvatarSlots>;
23
- name?: string;
24
- }
25
- }
26
-
27
- export { useAvatar };
@@ -1 +0,0 @@
1
- import{a}from"../chunk-5Q2ZPY6B.mjs";import"../chunk-TJU5GERX.mjs";import"../chunk-UN72ATNQ.mjs";export{a as useAvatar};
@@ -1 +0,0 @@
1
- import{a,b}from"../chunk-UN72ATNQ.mjs";export{b as getColorByName,a as getFirstChar};
File without changes