@tamagui/avatar 1.0.1-beta.47

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,157 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
25
+ var __objRest = (source, exclude) => {
26
+ var target = {};
27
+ for (var prop in source)
28
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
29
+ target[prop] = source[prop];
30
+ if (source != null && __getOwnPropSymbols)
31
+ for (var prop of __getOwnPropSymbols(source)) {
32
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
33
+ target[prop] = source[prop];
34
+ }
35
+ return target;
36
+ };
37
+ var __export = (target, all) => {
38
+ for (var name in all)
39
+ __defProp(target, name, { get: all[name], enumerable: true });
40
+ };
41
+ var __copyProps = (to, from, except, desc) => {
42
+ if (from && typeof from === "object" || typeof from === "function") {
43
+ for (let key of __getOwnPropNames(from))
44
+ if (!__hasOwnProp.call(to, key) && key !== except)
45
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
46
+ }
47
+ return to;
48
+ };
49
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
50
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
51
+ var Avatar_exports = {};
52
+ __export(Avatar_exports, {
53
+ Avatar: () => Avatar,
54
+ AvatarFallback: () => AvatarFallback,
55
+ AvatarFrame: () => AvatarFrame,
56
+ AvatarImage: () => AvatarImage,
57
+ createAvatarScope: () => createAvatarScope
58
+ });
59
+ module.exports = __toCommonJS(Avatar_exports);
60
+ var import_core = require("@tamagui/core");
61
+ var import_create_context = require("@tamagui/create-context");
62
+ var import_image = require("@tamagui/image");
63
+ var import_shapes = require("@tamagui/shapes");
64
+ var import_stacks = require("@tamagui/stacks");
65
+ var React = __toESM(require("react"));
66
+ const AVATAR_NAME = "Avatar";
67
+ const [createAvatarContext, createAvatarScope] = (0, import_create_context.createContextScope)(AVATAR_NAME);
68
+ const [AvatarProvider, useAvatarContext] = createAvatarContext(AVATAR_NAME);
69
+ const IMAGE_NAME = "AvatarImage";
70
+ const AvatarImage = React.forwardRef((props, forwardedRef) => {
71
+ var _b;
72
+ const _a = props, { __scopeAvatar, src, onLoadingStatusChange = /* @__PURE__ */ __name(() => {
73
+ }, "onLoadingStatusChange") } = _a, imageProps = __objRest(_a, ["__scopeAvatar", "src", "onLoadingStatusChange"]);
74
+ const context = useAvatarContext(IMAGE_NAME, __scopeAvatar);
75
+ const [status, setStatus] = React.useState("idle");
76
+ const extras = (0, import_core.getVariantExtras)(props);
77
+ const shapeSize = (0, import_core.getVariableValue)((_b = (0, import_shapes.getShapeSize)(context.size, extras)) == null ? void 0 : _b.width);
78
+ React.useEffect(() => {
79
+ setStatus("idle");
80
+ }, [JSON.stringify(src)]);
81
+ React.useEffect(() => {
82
+ onLoadingStatusChange(status);
83
+ context.onImageLoadingStatusChange(status);
84
+ }, [status]);
85
+ return /* @__PURE__ */ React.createElement(import_stacks.YStack, {
86
+ fullscreen: true,
87
+ zIndex: 1
88
+ }, /* @__PURE__ */ React.createElement(import_image.Image, __spreadProps(__spreadValues({
89
+ fullscreen: true
90
+ }, imageProps), {
91
+ ref: forwardedRef,
92
+ src,
93
+ onLoadStart: () => {
94
+ },
95
+ onError: () => {
96
+ setStatus("error");
97
+ },
98
+ onLoad: () => {
99
+ setStatus("loaded");
100
+ }
101
+ })));
102
+ });
103
+ AvatarImage.displayName = IMAGE_NAME;
104
+ const FALLBACK_NAME = "AvatarFallback";
105
+ const AvatarFallbackFrame = (0, import_core.styled)(import_stacks.YStack, {
106
+ name: FALLBACK_NAME,
107
+ position: "absolute",
108
+ fullscreen: true,
109
+ zIndex: 0
110
+ });
111
+ const AvatarFallback = AvatarFallbackFrame.extractable(React.forwardRef((props, forwardedRef) => {
112
+ const _a = props, { __scopeAvatar, delayMs } = _a, fallbackProps = __objRest(_a, ["__scopeAvatar", "delayMs"]);
113
+ const context = useAvatarContext(FALLBACK_NAME, __scopeAvatar);
114
+ const [canRender, setCanRender] = React.useState(delayMs === void 0);
115
+ React.useEffect(() => {
116
+ if (delayMs !== void 0) {
117
+ const timerId = setTimeout(() => setCanRender(true), delayMs);
118
+ return () => clearTimeout(timerId);
119
+ }
120
+ }, [delayMs]);
121
+ return canRender && context.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ React.createElement(AvatarFallbackFrame, __spreadProps(__spreadValues({}, fallbackProps), {
122
+ ref: forwardedRef
123
+ })) : null;
124
+ }));
125
+ AvatarFallback.displayName = FALLBACK_NAME;
126
+ const AvatarFrame = (0, import_core.styled)(import_shapes.Square, {
127
+ name: AVATAR_NAME,
128
+ position: "relative",
129
+ overflow: "hidden"
130
+ });
131
+ const Avatar = (0, import_core.withStaticProperties)(React.forwardRef((props, forwardedRef) => {
132
+ const _a = props, { __scopeAvatar, size = "$4" } = _a, avatarProps = __objRest(_a, ["__scopeAvatar", "size"]);
133
+ const [imageLoadingStatus, setImageLoadingStatus] = React.useState("idle");
134
+ return /* @__PURE__ */ React.createElement(AvatarProvider, {
135
+ size,
136
+ scope: __scopeAvatar,
137
+ imageLoadingStatus,
138
+ onImageLoadingStatusChange: setImageLoadingStatus
139
+ }, /* @__PURE__ */ React.createElement(AvatarFrame, __spreadProps(__spreadValues({
140
+ size
141
+ }, avatarProps), {
142
+ ref: forwardedRef
143
+ })));
144
+ }), {
145
+ Image: AvatarImage,
146
+ Fallback: AvatarFallback
147
+ });
148
+ Avatar.displayName = AVATAR_NAME;
149
+ // Annotate the CommonJS export names for ESM import in node:
150
+ 0 && (module.exports = {
151
+ Avatar,
152
+ AvatarFallback,
153
+ AvatarFrame,
154
+ AvatarImage,
155
+ createAvatarScope
156
+ });
157
+ //# sourceMappingURL=Avatar.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Avatar.tsx"],
4
+ "sourcesContent": ["// forked from radix https://github.com/radix-ui/primitives/blob/main/packages/react/avatar/src/Avatar.tsx\n\nimport {\n GetProps,\n SizeTokens,\n TamaguiElement,\n getVariableValue,\n getVariantExtras,\n styled,\n withStaticProperties,\n} from '@tamagui/core'\nimport { Scope, createContextScope } from '@tamagui/create-context'\nimport { Image, ImageProps } from '@tamagui/image'\nimport { Square, getShapeSize } from '@tamagui/shapes'\nimport { YStack } from '@tamagui/stacks'\nimport * as React from 'react'\n\nconst AVATAR_NAME = 'Avatar'\n\ntype ScopedProps<P> = P & { __scopeAvatar?: Scope }\nconst [createAvatarContext, createAvatarScope] = createContextScope(AVATAR_NAME)\n\ntype ImageLoadingStatus = 'idle' | 'loading' | 'loaded' | 'error'\n\ntype AvatarContextValue = {\n size: SizeTokens\n imageLoadingStatus: ImageLoadingStatus\n onImageLoadingStatusChange(status: ImageLoadingStatus): void\n}\n\nconst [AvatarProvider, useAvatarContext] = createAvatarContext<AvatarContextValue>(AVATAR_NAME)\n\n/* -------------------------------------------------------------------------------------------------\n * AvatarImage\n * -----------------------------------------------------------------------------------------------*/\n\nconst IMAGE_NAME = 'AvatarImage'\n\ntype AvatarImageProps = Partial<ImageProps> & {\n onLoadingStatusChange?: (status: ImageLoadingStatus) => void\n}\n\nconst AvatarImage = React.forwardRef<TamaguiElement, AvatarImageProps>(\n (props: ScopedProps<AvatarImageProps>, forwardedRef) => {\n const { __scopeAvatar, src, onLoadingStatusChange = () => {}, ...imageProps } = props\n const context = useAvatarContext(IMAGE_NAME, __scopeAvatar)\n const [status, setStatus] = React.useState<ImageLoadingStatus>('idle')\n const extras = getVariantExtras(props)\n const shapeSize = getVariableValue(getShapeSize(context.size, extras)?.width)\n\n React.useEffect(() => {\n setStatus('idle')\n }, [JSON.stringify(src)])\n\n React.useEffect(() => {\n onLoadingStatusChange(status)\n context.onImageLoadingStatusChange(status)\n }, [status])\n\n return (\n <YStack fullscreen zIndex={1}>\n <Image\n fullscreen\n {...imageProps}\n // @ts-ignore\n ref={forwardedRef}\n // @ts-ignore\n src={src}\n onLoadStart={() => {\n // setStatus('loading')\n }}\n onError={() => {\n setStatus('error')\n }}\n onLoad={() => {\n setStatus('loaded')\n }}\n />\n </YStack>\n )\n }\n)\n\nAvatarImage.displayName = IMAGE_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AvatarFallback\n * -----------------------------------------------------------------------------------------------*/\n\nconst FALLBACK_NAME = 'AvatarFallback'\n\nconst AvatarFallbackFrame = styled(YStack, {\n name: FALLBACK_NAME,\n position: 'absolute',\n fullscreen: true,\n zIndex: 0,\n})\n\ntype AvatarFallbackProps = GetProps<typeof AvatarFallbackFrame> & {\n delayMs?: number\n}\n\nconst AvatarFallback = AvatarFallbackFrame.extractable(\n React.forwardRef<TamaguiElement, AvatarFallbackProps>(\n (props: ScopedProps<AvatarFallbackProps>, forwardedRef) => {\n const { __scopeAvatar, delayMs, ...fallbackProps } = props\n const context = useAvatarContext(FALLBACK_NAME, __scopeAvatar)\n const [canRender, setCanRender] = React.useState(delayMs === undefined)\n\n React.useEffect(() => {\n if (delayMs !== undefined) {\n const timerId = setTimeout(() => setCanRender(true), delayMs)\n return () => clearTimeout(timerId)\n }\n }, [delayMs])\n\n return canRender && context.imageLoadingStatus !== 'loaded' ? (\n <AvatarFallbackFrame {...fallbackProps} ref={forwardedRef} />\n ) : null\n }\n )\n)\n\nAvatarFallback.displayName = FALLBACK_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * Avatar\n * -----------------------------------------------------------------------------------------------*/\n\nexport const AvatarFrame = styled(Square, {\n name: AVATAR_NAME,\n position: 'relative',\n overflow: 'hidden',\n})\n\ntype AvatarProps = GetProps<typeof AvatarFrame>\n\nconst Avatar = withStaticProperties(\n React.forwardRef<TamaguiElement, AvatarProps>((props: ScopedProps<AvatarProps>, forwardedRef) => {\n const { __scopeAvatar, size = '$4', ...avatarProps } = props\n const [imageLoadingStatus, setImageLoadingStatus] = React.useState<ImageLoadingStatus>('idle')\n return (\n <AvatarProvider\n size={size}\n scope={__scopeAvatar}\n imageLoadingStatus={imageLoadingStatus}\n onImageLoadingStatusChange={setImageLoadingStatus}\n >\n <AvatarFrame size={size} {...avatarProps} ref={forwardedRef} />\n </AvatarProvider>\n )\n }),\n {\n Image: AvatarImage,\n Fallback: AvatarFallback,\n }\n)\n\nAvatar.displayName = AVATAR_NAME\n\nexport { createAvatarScope, Avatar, AvatarImage, AvatarFallback }\nexport type { AvatarProps, AvatarImageProps, AvatarFallbackProps }\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAQO;AACP,4BAA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nPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var src_exports = {};
16
+ module.exports = __toCommonJS(src_exports);
17
+ __reExport(src_exports, require("./Avatar"), module.exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts"],
4
+ "sourcesContent": ["export * from './Avatar'\n"],
5
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,qBAAd;",
6
+ "names": []
7
+ }
@@ -0,0 +1,105 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import {
4
+ getVariableValue,
5
+ getVariantExtras,
6
+ styled,
7
+ withStaticProperties
8
+ } from "@tamagui/core";
9
+ import { createContextScope } from "@tamagui/create-context";
10
+ import { Image } from "@tamagui/image";
11
+ import { Square, getShapeSize } from "@tamagui/shapes";
12
+ import { YStack } from "@tamagui/stacks";
13
+ import * as React from "react";
14
+ const AVATAR_NAME = "Avatar";
15
+ const [createAvatarContext, createAvatarScope] = createContextScope(AVATAR_NAME);
16
+ const [AvatarProvider, useAvatarContext] = createAvatarContext(AVATAR_NAME);
17
+ const IMAGE_NAME = "AvatarImage";
18
+ const AvatarImage = React.forwardRef((props, forwardedRef) => {
19
+ var _a;
20
+ const { __scopeAvatar, src, onLoadingStatusChange = /* @__PURE__ */ __name(() => {
21
+ }, "onLoadingStatusChange"), ...imageProps } = props;
22
+ const context = useAvatarContext(IMAGE_NAME, __scopeAvatar);
23
+ const [status, setStatus] = React.useState("idle");
24
+ const extras = getVariantExtras(props);
25
+ const shapeSize = getVariableValue((_a = getShapeSize(context.size, extras)) == null ? void 0 : _a.width);
26
+ React.useEffect(() => {
27
+ setStatus("idle");
28
+ }, [JSON.stringify(src)]);
29
+ React.useEffect(() => {
30
+ onLoadingStatusChange(status);
31
+ context.onImageLoadingStatusChange(status);
32
+ }, [status]);
33
+ return /* @__PURE__ */ React.createElement(YStack, {
34
+ fullscreen: true,
35
+ zIndex: 1
36
+ }, /* @__PURE__ */ React.createElement(Image, {
37
+ fullscreen: true,
38
+ ...imageProps,
39
+ ref: forwardedRef,
40
+ src,
41
+ onLoadStart: () => {
42
+ },
43
+ onError: () => {
44
+ setStatus("error");
45
+ },
46
+ onLoad: () => {
47
+ setStatus("loaded");
48
+ }
49
+ }));
50
+ });
51
+ AvatarImage.displayName = IMAGE_NAME;
52
+ const FALLBACK_NAME = "AvatarFallback";
53
+ const AvatarFallbackFrame = styled(YStack, {
54
+ name: FALLBACK_NAME,
55
+ position: "absolute",
56
+ fullscreen: true,
57
+ zIndex: 0
58
+ });
59
+ const AvatarFallback = AvatarFallbackFrame.extractable(React.forwardRef((props, forwardedRef) => {
60
+ const { __scopeAvatar, delayMs, ...fallbackProps } = props;
61
+ const context = useAvatarContext(FALLBACK_NAME, __scopeAvatar);
62
+ const [canRender, setCanRender] = React.useState(delayMs === void 0);
63
+ React.useEffect(() => {
64
+ if (delayMs !== void 0) {
65
+ const timerId = setTimeout(() => setCanRender(true), delayMs);
66
+ return () => clearTimeout(timerId);
67
+ }
68
+ }, [delayMs]);
69
+ return canRender && context.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ React.createElement(AvatarFallbackFrame, {
70
+ ...fallbackProps,
71
+ ref: forwardedRef
72
+ }) : null;
73
+ }));
74
+ AvatarFallback.displayName = FALLBACK_NAME;
75
+ const AvatarFrame = styled(Square, {
76
+ name: AVATAR_NAME,
77
+ position: "relative",
78
+ overflow: "hidden"
79
+ });
80
+ const Avatar = withStaticProperties(React.forwardRef((props, forwardedRef) => {
81
+ const { __scopeAvatar, size = "$4", ...avatarProps } = props;
82
+ const [imageLoadingStatus, setImageLoadingStatus] = React.useState("idle");
83
+ return /* @__PURE__ */ React.createElement(AvatarProvider, {
84
+ size,
85
+ scope: __scopeAvatar,
86
+ imageLoadingStatus,
87
+ onImageLoadingStatusChange: setImageLoadingStatus
88
+ }, /* @__PURE__ */ React.createElement(AvatarFrame, {
89
+ size,
90
+ ...avatarProps,
91
+ ref: forwardedRef
92
+ }));
93
+ }), {
94
+ Image: AvatarImage,
95
+ Fallback: AvatarFallback
96
+ });
97
+ Avatar.displayName = AVATAR_NAME;
98
+ export {
99
+ Avatar,
100
+ AvatarFallback,
101
+ AvatarFrame,
102
+ AvatarImage,
103
+ createAvatarScope
104
+ };
105
+ //# sourceMappingURL=Avatar.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Avatar.tsx"],
4
+ "sourcesContent": ["// forked from radix https://github.com/radix-ui/primitives/blob/main/packages/react/avatar/src/Avatar.tsx\n\nimport {\n GetProps,\n SizeTokens,\n TamaguiElement,\n getVariableValue,\n getVariantExtras,\n styled,\n withStaticProperties,\n} from '@tamagui/core'\nimport { Scope, createContextScope } from '@tamagui/create-context'\nimport { Image, ImageProps } from '@tamagui/image'\nimport { Square, getShapeSize } from '@tamagui/shapes'\nimport { YStack } from '@tamagui/stacks'\nimport * as React from 'react'\n\nconst AVATAR_NAME = 'Avatar'\n\ntype ScopedProps<P> = P & { __scopeAvatar?: Scope }\nconst [createAvatarContext, createAvatarScope] = createContextScope(AVATAR_NAME)\n\ntype ImageLoadingStatus = 'idle' | 'loading' | 'loaded' | 'error'\n\ntype AvatarContextValue = {\n size: SizeTokens\n imageLoadingStatus: ImageLoadingStatus\n onImageLoadingStatusChange(status: ImageLoadingStatus): void\n}\n\nconst [AvatarProvider, useAvatarContext] = createAvatarContext<AvatarContextValue>(AVATAR_NAME)\n\n/* -------------------------------------------------------------------------------------------------\n * AvatarImage\n * -----------------------------------------------------------------------------------------------*/\n\nconst IMAGE_NAME = 'AvatarImage'\n\ntype AvatarImageProps = Partial<ImageProps> & {\n onLoadingStatusChange?: (status: ImageLoadingStatus) => void\n}\n\nconst AvatarImage = React.forwardRef<TamaguiElement, AvatarImageProps>(\n (props: ScopedProps<AvatarImageProps>, forwardedRef) => {\n const { __scopeAvatar, src, onLoadingStatusChange = () => {}, ...imageProps } = props\n const context = useAvatarContext(IMAGE_NAME, __scopeAvatar)\n const [status, setStatus] = React.useState<ImageLoadingStatus>('idle')\n const extras = getVariantExtras(props)\n const shapeSize = getVariableValue(getShapeSize(context.size, extras)?.width)\n\n React.useEffect(() => {\n setStatus('idle')\n }, [JSON.stringify(src)])\n\n React.useEffect(() => {\n onLoadingStatusChange(status)\n context.onImageLoadingStatusChange(status)\n }, [status])\n\n return (\n <YStack fullscreen zIndex={1}>\n <Image\n fullscreen\n {...imageProps}\n // @ts-ignore\n ref={forwardedRef}\n // @ts-ignore\n src={src}\n onLoadStart={() => {\n // setStatus('loading')\n }}\n onError={() => {\n setStatus('error')\n }}\n onLoad={() => {\n setStatus('loaded')\n }}\n />\n </YStack>\n )\n }\n)\n\nAvatarImage.displayName = IMAGE_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * AvatarFallback\n * -----------------------------------------------------------------------------------------------*/\n\nconst FALLBACK_NAME = 'AvatarFallback'\n\nconst AvatarFallbackFrame = styled(YStack, {\n name: FALLBACK_NAME,\n position: 'absolute',\n fullscreen: true,\n zIndex: 0,\n})\n\ntype AvatarFallbackProps = GetProps<typeof AvatarFallbackFrame> & {\n delayMs?: number\n}\n\nconst AvatarFallback = AvatarFallbackFrame.extractable(\n React.forwardRef<TamaguiElement, AvatarFallbackProps>(\n (props: ScopedProps<AvatarFallbackProps>, forwardedRef) => {\n const { __scopeAvatar, delayMs, ...fallbackProps } = props\n const context = useAvatarContext(FALLBACK_NAME, __scopeAvatar)\n const [canRender, setCanRender] = React.useState(delayMs === undefined)\n\n React.useEffect(() => {\n if (delayMs !== undefined) {\n const timerId = setTimeout(() => setCanRender(true), delayMs)\n return () => clearTimeout(timerId)\n }\n }, [delayMs])\n\n return canRender && context.imageLoadingStatus !== 'loaded' ? (\n <AvatarFallbackFrame {...fallbackProps} ref={forwardedRef} />\n ) : null\n }\n )\n)\n\nAvatarFallback.displayName = FALLBACK_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * Avatar\n * -----------------------------------------------------------------------------------------------*/\n\nexport const AvatarFrame = styled(Square, {\n name: AVATAR_NAME,\n position: 'relative',\n overflow: 'hidden',\n})\n\ntype AvatarProps = GetProps<typeof AvatarFrame>\n\nconst Avatar = withStaticProperties(\n React.forwardRef<TamaguiElement, AvatarProps>((props: ScopedProps<AvatarProps>, forwardedRef) => {\n const { __scopeAvatar, size = '$4', ...avatarProps } = props\n const [imageLoadingStatus, setImageLoadingStatus] = React.useState<ImageLoadingStatus>('idle')\n return (\n <AvatarProvider\n size={size}\n scope={__scopeAvatar}\n imageLoadingStatus={imageLoadingStatus}\n onImageLoadingStatusChange={setImageLoadingStatus}\n >\n <AvatarFrame size={size} {...avatarProps} ref={forwardedRef} />\n </AvatarProvider>\n )\n }),\n {\n Image: AvatarImage,\n Fallback: AvatarFallback,\n }\n)\n\nAvatar.displayName = AVATAR_NAME\n\nexport { createAvatarScope, Avatar, AvatarImage, AvatarFallback }\nexport type { AvatarProps, AvatarImageProps, AvatarFallbackProps }\n"],
5
+ "mappings": ";;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA;AACA;AACA;AACA;AACA;AAEA,MAAM,cAAc;AAGpB,MAAM,CAAC,qBAAqB,qBAAqB,mBAAmB,WAAW;AAU/E,MAAM,CAAC,gBAAgB,oBAAoB,oBAAwC,WAAW;AAM9F,MA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E,QAAM,UAAU,MAAM;AACpB,QAAI,YAAY,QAAW;AACzB,YAAM,UAAU,WAAW,MAAM,aAAa,IAAI,GAAG,OAAO;AAC5D,aAAO,MAAM,aAAa,OAAO;AAAA,IACnC;AAAA,EACF,GAAG,CAAC,OAAO,CAAC;AAEZ,SAAO,aAAa,QAAQ,uBAAuB,WACjD,oCAAC;AAAA,IAAqB,GAAG;AAAA,IAAe,KAAK;AAAA,GAAc,IACzD;AACN,CACF,CACF;AAEA,eAAe,cAAc;AAMtB,MAAM,cAAc,OAAO,QAAQ;AAAA,EACxC,MAAM;AAAA,EACN,UAAU;AAAA,EACV,UAAU;AACZ,CAAC;AAID,MAAM,SAAS,qBACb,MAAM,WAAwC,CAAC,OAAiC,iBAAiB;AAC/F,QAAM,EAAE,eAAe,OAAO,SAAS,gBAAgB;AACvD,QAAM,CAAC,oBAAoB,yBAAyB,MAAM,SAA6B,MAAM;AAC7F,SACE,oCAAC;AAAA,IACC;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA,4BAA4B;AAAA,KAE5B,oCAAC;AAAA,IAAY;AAAA,IAAa,GAAG;AAAA,IAAa,KAAK;AAAA,GAAc,CAC/D;AAEJ,CAAC,GACD;AAAA,EACE,OAAO;AAAA,EACP,UAAU;AACZ,CACF;AAEA,OAAO,cAAc;",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./Avatar";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts"],
4
+ "sourcesContent": ["export * from './Avatar'\n"],
5
+ "mappings": "AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,81 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import {
4
+ getVariableValue,
5
+ getVariantExtras,
6
+ styled,
7
+ withStaticProperties
8
+ } from "@tamagui/core";
9
+ import { createContextScope } from "@tamagui/create-context";
10
+ import { Image } from "@tamagui/image";
11
+ import { Square, getShapeSize } from "@tamagui/shapes";
12
+ import { YStack } from "@tamagui/stacks";
13
+ import * as React from "react";
14
+ const AVATAR_NAME = "Avatar";
15
+ const [createAvatarContext, createAvatarScope] = createContextScope(AVATAR_NAME);
16
+ const [AvatarProvider, useAvatarContext] = createAvatarContext(AVATAR_NAME);
17
+ const IMAGE_NAME = "AvatarImage";
18
+ const AvatarImage = React.forwardRef((props, forwardedRef) => {
19
+ var _a;
20
+ const { __scopeAvatar, src, onLoadingStatusChange = /* @__PURE__ */ __name(() => {
21
+ }, "onLoadingStatusChange"), ...imageProps } = props;
22
+ const context = useAvatarContext(IMAGE_NAME, __scopeAvatar);
23
+ const [status, setStatus] = React.useState("idle");
24
+ const extras = getVariantExtras(props);
25
+ const shapeSize = getVariableValue((_a = getShapeSize(context.size, extras)) == null ? void 0 : _a.width);
26
+ React.useEffect(() => {
27
+ setStatus("idle");
28
+ }, [JSON.stringify(src)]);
29
+ React.useEffect(() => {
30
+ onLoadingStatusChange(status);
31
+ context.onImageLoadingStatusChange(status);
32
+ }, [status]);
33
+ return <YStack fullscreen zIndex={1}><Image fullscreen {...imageProps} ref={forwardedRef} src={src} onLoadStart={() => {
34
+ }} onError={() => {
35
+ setStatus("error");
36
+ }} onLoad={() => {
37
+ setStatus("loaded");
38
+ }} /></YStack>;
39
+ });
40
+ AvatarImage.displayName = IMAGE_NAME;
41
+ const FALLBACK_NAME = "AvatarFallback";
42
+ const AvatarFallbackFrame = styled(YStack, {
43
+ name: FALLBACK_NAME,
44
+ position: "absolute",
45
+ fullscreen: true,
46
+ zIndex: 0
47
+ });
48
+ const AvatarFallback = AvatarFallbackFrame.extractable(React.forwardRef((props, forwardedRef) => {
49
+ const { __scopeAvatar, delayMs, ...fallbackProps } = props;
50
+ const context = useAvatarContext(FALLBACK_NAME, __scopeAvatar);
51
+ const [canRender, setCanRender] = React.useState(delayMs === void 0);
52
+ React.useEffect(() => {
53
+ if (delayMs !== void 0) {
54
+ const timerId = setTimeout(() => setCanRender(true), delayMs);
55
+ return () => clearTimeout(timerId);
56
+ }
57
+ }, [delayMs]);
58
+ return canRender && context.imageLoadingStatus !== "loaded" ? <AvatarFallbackFrame {...fallbackProps} ref={forwardedRef} /> : null;
59
+ }));
60
+ AvatarFallback.displayName = FALLBACK_NAME;
61
+ const AvatarFrame = styled(Square, {
62
+ name: AVATAR_NAME,
63
+ position: "relative",
64
+ overflow: "hidden"
65
+ });
66
+ const Avatar = withStaticProperties(React.forwardRef((props, forwardedRef) => {
67
+ const { __scopeAvatar, size = "$4", ...avatarProps } = props;
68
+ const [imageLoadingStatus, setImageLoadingStatus] = React.useState("idle");
69
+ return <AvatarProvider size={size} scope={__scopeAvatar} imageLoadingStatus={imageLoadingStatus} onImageLoadingStatusChange={setImageLoadingStatus}><AvatarFrame size={size} {...avatarProps} ref={forwardedRef} /></AvatarProvider>;
70
+ }), {
71
+ Image: AvatarImage,
72
+ Fallback: AvatarFallback
73
+ });
74
+ Avatar.displayName = AVATAR_NAME;
75
+ export {
76
+ Avatar,
77
+ AvatarFallback,
78
+ AvatarFrame,
79
+ AvatarImage,
80
+ createAvatarScope
81
+ };
@@ -0,0 +1 @@
1
+ export * from "./Avatar";
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@tamagui/avatar",
3
+ "version": "1.0.1-beta.47",
4
+ "sideEffects": true,
5
+ "source": "src/index.ts",
6
+ "types": "./types/index.d.ts",
7
+ "main": "dist/cjs",
8
+ "module": "dist/esm",
9
+ "module:jsx": "dist/jsx",
10
+ "files": [
11
+ "types",
12
+ "dist"
13
+ ],
14
+ "scripts": {
15
+ "build": "tamagui-build",
16
+ "watch": "tamagui-build --watch",
17
+ "clean": "tamagui-build clean",
18
+ "clean:build": "tamagui-build clean:build"
19
+ },
20
+ "dependencies": {
21
+ "@radix-ui/react-use-callback-ref": "^0.1.0",
22
+ "@tamagui/core": "^1.0.1-beta.47",
23
+ "@tamagui/image": "^1.0.1-beta.47",
24
+ "@tamagui/shapes": "^1.0.1-beta.47",
25
+ "@tamagui/text": "^1.0.1-beta.47"
26
+ },
27
+ "peerDependencies": {
28
+ "react": "*",
29
+ "react-dom": "*",
30
+ "react-native": "*"
31
+ },
32
+ "devDependencies": {
33
+ "@tamagui/build": "^1.0.1-beta.47",
34
+ "@types/react-dom": "^18.0.3",
35
+ "@types/react-native": "^0.67.3",
36
+ "react": "*",
37
+ "react-dom": "*",
38
+ "react-native": "*"
39
+ },
40
+ "publishConfig": {
41
+ "access": "public"
42
+ }
43
+ }
@@ -0,0 +1,308 @@
1
+ import { GetProps, SizeTokens, TamaguiElement } from '@tamagui/core';
2
+ import { ImageProps } from '@tamagui/image';
3
+ import * as React from 'react';
4
+ declare const createAvatarScope: import("@tamagui/create-context").CreateScope;
5
+ declare type ImageLoadingStatus = 'idle' | 'loading' | 'loaded' | 'error';
6
+ declare type AvatarImageProps = Partial<ImageProps> & {
7
+ onLoadingStatusChange?: (status: ImageLoadingStatus) => void;
8
+ };
9
+ declare const AvatarImage: React.ForwardRefExoticComponent<Partial<ImageProps> & {
10
+ onLoadingStatusChange?: ((status: ImageLoadingStatus) => void) | undefined;
11
+ } & React.RefAttributes<TamaguiElement>>;
12
+ declare const AvatarFallbackFrame: import("@tamagui/core").TamaguiComponent<(Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
13
+ readonly fullscreen?: boolean | undefined;
14
+ readonly elevation?: SizeTokens | undefined;
15
+ } & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
16
+ readonly fullscreen?: boolean | undefined;
17
+ readonly elevation?: SizeTokens | undefined;
18
+ }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
19
+ readonly fullscreen?: boolean | undefined;
20
+ readonly elevation?: SizeTokens | undefined;
21
+ }>>) | (Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
22
+ readonly fullscreen?: boolean | undefined;
23
+ readonly elevation?: SizeTokens | undefined;
24
+ }, string | number> & {
25
+ [x: string]: undefined;
26
+ } & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
27
+ readonly fullscreen?: boolean | undefined;
28
+ readonly elevation?: SizeTokens | undefined;
29
+ }, string | number> & {
30
+ [x: string]: undefined;
31
+ }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
32
+ readonly fullscreen?: boolean | undefined;
33
+ readonly elevation?: SizeTokens | undefined;
34
+ }, string | number> & {
35
+ [x: string]: undefined;
36
+ }>>), any, import("@tamagui/core").StackPropsBase, {
37
+ readonly fullscreen?: boolean | undefined;
38
+ readonly elevation?: SizeTokens | undefined;
39
+ } & ({} | {
40
+ [x: string]: undefined;
41
+ })>;
42
+ declare type AvatarFallbackProps = GetProps<typeof AvatarFallbackFrame> & {
43
+ delayMs?: number;
44
+ };
45
+ declare const AvatarFallback: React.ForwardRefExoticComponent<((Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
46
+ readonly fullscreen?: boolean | undefined;
47
+ readonly elevation?: SizeTokens | undefined;
48
+ } & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
49
+ readonly fullscreen?: boolean | undefined;
50
+ readonly elevation?: SizeTokens | undefined;
51
+ }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
52
+ readonly fullscreen?: boolean | undefined;
53
+ readonly elevation?: SizeTokens | undefined;
54
+ }>> & {
55
+ delayMs?: number | undefined;
56
+ }) | Pick<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
57
+ readonly fullscreen?: boolean | undefined;
58
+ readonly elevation?: SizeTokens | undefined;
59
+ }, string | number> & {
60
+ [x: string]: undefined;
61
+ } & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
62
+ readonly fullscreen?: boolean | undefined;
63
+ readonly elevation?: SizeTokens | undefined;
64
+ }, string | number> & {
65
+ [x: string]: undefined;
66
+ }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
67
+ readonly fullscreen?: boolean | undefined;
68
+ readonly elevation?: SizeTokens | undefined;
69
+ }, string | number> & {
70
+ [x: string]: undefined;
71
+ }>> & {
72
+ delayMs?: number | undefined;
73
+ }, string | number>) & React.RefAttributes<TamaguiElement>>;
74
+ export declare const AvatarFrame: import("@tamagui/core").TamaguiComponent<(Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
75
+ readonly fullscreen?: boolean | undefined;
76
+ readonly elevation?: SizeTokens | undefined;
77
+ } & {
78
+ fontFamily?: unknown;
79
+ hoverable?: boolean | undefined;
80
+ pressable?: boolean | undefined;
81
+ focusable?: boolean | undefined;
82
+ circular?: boolean | undefined;
83
+ elevate?: boolean | undefined;
84
+ bordered?: number | boolean | undefined;
85
+ size?: SizeTokens | undefined;
86
+ }, "size"> & {
87
+ size?: SizeTokens | undefined;
88
+ } & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
89
+ readonly fullscreen?: boolean | undefined;
90
+ readonly elevation?: SizeTokens | undefined;
91
+ } & {
92
+ fontFamily?: unknown;
93
+ hoverable?: boolean | undefined;
94
+ pressable?: boolean | undefined;
95
+ focusable?: boolean | undefined;
96
+ circular?: boolean | undefined;
97
+ elevate?: boolean | undefined;
98
+ bordered?: number | boolean | undefined;
99
+ size?: SizeTokens | undefined;
100
+ }, "size"> & {
101
+ size?: SizeTokens | undefined;
102
+ }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
103
+ readonly fullscreen?: boolean | undefined;
104
+ readonly elevation?: SizeTokens | undefined;
105
+ } & {
106
+ fontFamily?: unknown;
107
+ hoverable?: boolean | undefined;
108
+ pressable?: boolean | undefined;
109
+ focusable?: boolean | undefined;
110
+ circular?: boolean | undefined;
111
+ elevate?: boolean | undefined;
112
+ bordered?: number | boolean | undefined;
113
+ size?: SizeTokens | undefined;
114
+ }, "size"> & {
115
+ size?: SizeTokens | undefined;
116
+ }>>) | (Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
117
+ readonly fullscreen?: boolean | undefined;
118
+ readonly elevation?: SizeTokens | undefined;
119
+ } & {
120
+ fontFamily?: unknown;
121
+ hoverable?: boolean | undefined;
122
+ pressable?: boolean | undefined;
123
+ focusable?: boolean | undefined;
124
+ circular?: boolean | undefined;
125
+ elevate?: boolean | undefined;
126
+ bordered?: number | boolean | undefined;
127
+ size?: SizeTokens | undefined;
128
+ } & {
129
+ size?: SizeTokens | undefined;
130
+ }, string | number> & {
131
+ [x: string]: undefined;
132
+ } & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
133
+ readonly fullscreen?: boolean | undefined;
134
+ readonly elevation?: SizeTokens | undefined;
135
+ } & {
136
+ fontFamily?: unknown;
137
+ hoverable?: boolean | undefined;
138
+ pressable?: boolean | undefined;
139
+ focusable?: boolean | undefined;
140
+ circular?: boolean | undefined;
141
+ elevate?: boolean | undefined;
142
+ bordered?: number | boolean | undefined;
143
+ size?: SizeTokens | undefined;
144
+ } & {
145
+ size?: SizeTokens | undefined;
146
+ }, string | number> & {
147
+ [x: string]: undefined;
148
+ }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
149
+ readonly fullscreen?: boolean | undefined;
150
+ readonly elevation?: SizeTokens | undefined;
151
+ } & {
152
+ fontFamily?: unknown;
153
+ hoverable?: boolean | undefined;
154
+ pressable?: boolean | undefined;
155
+ focusable?: boolean | undefined;
156
+ circular?: boolean | undefined;
157
+ elevate?: boolean | undefined;
158
+ bordered?: number | boolean | undefined;
159
+ size?: SizeTokens | undefined;
160
+ } & {
161
+ size?: SizeTokens | undefined;
162
+ }, string | number> & {
163
+ [x: string]: undefined;
164
+ }>>), any, import("@tamagui/core").StackPropsBase, {
165
+ readonly fullscreen?: boolean | undefined;
166
+ readonly elevation?: SizeTokens | undefined;
167
+ } & {
168
+ fontFamily?: unknown;
169
+ hoverable?: boolean | undefined;
170
+ pressable?: boolean | undefined;
171
+ focusable?: boolean | undefined;
172
+ circular?: boolean | undefined;
173
+ elevate?: boolean | undefined;
174
+ bordered?: number | boolean | undefined;
175
+ size?: SizeTokens | undefined;
176
+ } & {
177
+ size?: SizeTokens | undefined;
178
+ } & ({} | {
179
+ [x: string]: undefined;
180
+ })>;
181
+ declare type AvatarProps = GetProps<typeof AvatarFrame>;
182
+ declare const Avatar: React.ForwardRefExoticComponent<((Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
183
+ readonly fullscreen?: boolean | undefined;
184
+ readonly elevation?: SizeTokens | undefined;
185
+ } & {
186
+ fontFamily?: unknown;
187
+ hoverable?: boolean | undefined;
188
+ pressable?: boolean | undefined;
189
+ focusable?: boolean | undefined;
190
+ circular?: boolean | undefined;
191
+ elevate?: boolean | undefined;
192
+ bordered?: number | boolean | undefined;
193
+ size?: SizeTokens | undefined;
194
+ }, "size"> & {
195
+ size?: SizeTokens | undefined;
196
+ } & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
197
+ readonly fullscreen?: boolean | undefined;
198
+ readonly elevation?: SizeTokens | undefined;
199
+ } & {
200
+ fontFamily?: unknown;
201
+ hoverable?: boolean | undefined;
202
+ pressable?: boolean | undefined;
203
+ focusable?: boolean | undefined;
204
+ circular?: boolean | undefined;
205
+ elevate?: boolean | undefined;
206
+ bordered?: number | boolean | undefined;
207
+ size?: SizeTokens | undefined;
208
+ }, "size"> & {
209
+ size?: SizeTokens | undefined;
210
+ }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
211
+ readonly fullscreen?: boolean | undefined;
212
+ readonly elevation?: SizeTokens | undefined;
213
+ } & {
214
+ fontFamily?: unknown;
215
+ hoverable?: boolean | undefined;
216
+ pressable?: boolean | undefined;
217
+ focusable?: boolean | undefined;
218
+ circular?: boolean | undefined;
219
+ elevate?: boolean | undefined;
220
+ bordered?: number | boolean | undefined;
221
+ size?: SizeTokens | undefined;
222
+ }, "size"> & {
223
+ size?: SizeTokens | undefined;
224
+ }>>) | Pick<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
225
+ readonly fullscreen?: boolean | undefined;
226
+ readonly elevation?: SizeTokens | undefined;
227
+ } & {
228
+ fontFamily?: unknown;
229
+ hoverable?: boolean | undefined;
230
+ pressable?: boolean | undefined;
231
+ focusable?: boolean | undefined;
232
+ circular?: boolean | undefined;
233
+ elevate?: boolean | undefined;
234
+ bordered?: number | boolean | undefined;
235
+ size?: SizeTokens | undefined;
236
+ } & {
237
+ size?: SizeTokens | undefined;
238
+ }, string | number> & {
239
+ [x: string]: undefined;
240
+ } & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
241
+ readonly fullscreen?: boolean | undefined;
242
+ readonly elevation?: SizeTokens | undefined;
243
+ } & {
244
+ fontFamily?: unknown;
245
+ hoverable?: boolean | undefined;
246
+ pressable?: boolean | undefined;
247
+ focusable?: boolean | undefined;
248
+ circular?: boolean | undefined;
249
+ elevate?: boolean | undefined;
250
+ bordered?: number | boolean | undefined;
251
+ size?: SizeTokens | undefined;
252
+ } & {
253
+ size?: SizeTokens | undefined;
254
+ }, string | number> & {
255
+ [x: string]: undefined;
256
+ }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
257
+ readonly fullscreen?: boolean | undefined;
258
+ readonly elevation?: SizeTokens | undefined;
259
+ } & {
260
+ fontFamily?: unknown;
261
+ hoverable?: boolean | undefined;
262
+ pressable?: boolean | undefined;
263
+ focusable?: boolean | undefined;
264
+ circular?: boolean | undefined;
265
+ elevate?: boolean | undefined;
266
+ bordered?: number | boolean | undefined;
267
+ size?: SizeTokens | undefined;
268
+ } & {
269
+ size?: SizeTokens | undefined;
270
+ }, string | number> & {
271
+ [x: string]: undefined;
272
+ }>>, string | number>) & React.RefAttributes<TamaguiElement>> & {
273
+ Image: React.ForwardRefExoticComponent<Partial<ImageProps> & {
274
+ onLoadingStatusChange?: ((status: ImageLoadingStatus) => void) | undefined;
275
+ } & React.RefAttributes<TamaguiElement>>;
276
+ Fallback: React.ForwardRefExoticComponent<((Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
277
+ readonly fullscreen?: boolean | undefined;
278
+ readonly elevation?: SizeTokens | undefined;
279
+ } & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
280
+ readonly fullscreen?: boolean | undefined;
281
+ readonly elevation?: SizeTokens | undefined;
282
+ }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
283
+ readonly fullscreen?: boolean | undefined;
284
+ readonly elevation?: SizeTokens | undefined;
285
+ }>> & {
286
+ delayMs?: number | undefined;
287
+ }) | Pick<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
288
+ readonly fullscreen?: boolean | undefined;
289
+ readonly elevation?: SizeTokens | undefined;
290
+ }, string | number> & {
291
+ [x: string]: undefined;
292
+ } & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
293
+ readonly fullscreen?: boolean | undefined;
294
+ readonly elevation?: SizeTokens | undefined;
295
+ }, string | number> & {
296
+ [x: string]: undefined;
297
+ }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
298
+ readonly fullscreen?: boolean | undefined;
299
+ readonly elevation?: SizeTokens | undefined;
300
+ }, string | number> & {
301
+ [x: string]: undefined;
302
+ }>> & {
303
+ delayMs?: number | undefined;
304
+ }, string | number>) & React.RefAttributes<TamaguiElement>>;
305
+ };
306
+ export { createAvatarScope, Avatar, AvatarImage, AvatarFallback };
307
+ export type { AvatarProps, AvatarImageProps, AvatarFallbackProps };
308
+ //# sourceMappingURL=Avatar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../src/Avatar.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EACR,UAAU,EACV,cAAc,EAKf,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAS,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAGlD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,QAAA,MAA4B,iBAAiB,+CAAmC,CAAA;AAEhF,aAAK,kBAAkB,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAA;AAgBjE,aAAK,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG;IAC5C,qBAAqB,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAA;CAC7D,CAAA;AAED,QAAA,MAAM,WAAW;sCAHkB,kBAAkB,KAAK,IAAI;wCA0C7D,CAAA;AAUD,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAKvB,CAAA;AAEF,aAAK,mBAAmB,GAAG,QAAQ,CAAC,OAAO,mBAAmB,CAAC,GAAG;IAChE,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;2DAmBnB,CAAA;AAQD,eAAO,MAAM,WAAW;;;;;;;;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