@tamagui/avatar
Advanced tools
Comparing version 1.110.5 to 1.111.0
@@ -34,102 +34,5 @@ "use strict"; | ||
module.exports = __toCommonJS(Avatar_exports); | ||
var import_jsx_runtime = require("react/jsx-runtime"), import_core = require("@tamagui/core"), import_create_context = require("@tamagui/create-context"), import_helpers = require("@tamagui/helpers"), import_image = require("@tamagui/image"), import_shapes = require("@tamagui/shapes"), import_stacks = require("@tamagui/stacks"), React = __toESM(require("react")); | ||
function _array_like_to_array(arr, len) { | ||
(len == null || len > arr.length) && (len = arr.length); | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _array_with_holes(arr) { | ||
if (Array.isArray(arr)) return arr; | ||
} | ||
function _define_property(obj, key, value) { | ||
return key in obj ? Object.defineProperty(obj, key, { | ||
value, | ||
enumerable: !0, | ||
configurable: !0, | ||
writable: !0 | ||
}) : obj[key] = value, obj; | ||
} | ||
function _iterable_to_array_limit(arr, i) { | ||
var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"]; | ||
if (_i != null) { | ||
var _arr = [], _n = !0, _d = !1, _s, _e; | ||
try { | ||
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0) | ||
; | ||
} catch (err) { | ||
_d = !0, _e = err; | ||
} finally { | ||
try { | ||
!_n && _i.return != null && _i.return(); | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
} | ||
function _non_iterable_rest() { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
function _object_spread(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source); | ||
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) { | ||
return Object.getOwnPropertyDescriptor(source, sym).enumerable; | ||
}))), ownKeys2.forEach(function(key) { | ||
_define_property(target, key, source[key]); | ||
}); | ||
} | ||
return target; | ||
} | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
enumerableOnly && (symbols = symbols.filter(function(sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
})), keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _object_spread_props(target, source) { | ||
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}), target; | ||
} | ||
function _object_without_properties(source, excluded) { | ||
if (source == null) return {}; | ||
var target = _object_without_properties_loose(source, excluded), key, i; | ||
if (Object.getOwnPropertySymbols) { | ||
var sourceSymbolKeys = Object.getOwnPropertySymbols(source); | ||
for (i = 0; i < sourceSymbolKeys.length; i++) | ||
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); | ||
} | ||
return target; | ||
} | ||
function _object_without_properties_loose(source, excluded) { | ||
if (source == null) return {}; | ||
var target = {}, sourceKeys = Object.keys(source), key, i; | ||
for (i = 0; i < sourceKeys.length; i++) | ||
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]); | ||
return target; | ||
} | ||
function _sliced_to_array(arr, i) { | ||
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest(); | ||
} | ||
function _unsupported_iterable_to_array(o, minLen) { | ||
if (o) { | ||
if (typeof o == "string") return _array_like_to_array(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set") return Array.from(n); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen); | ||
} | ||
} | ||
var AVATAR_NAME = "Avatar", _createContextScope = _sliced_to_array((0, import_create_context.createContextScope)(AVATAR_NAME), 2), createAvatarContext = _createContextScope[0], createAvatarScope = _createContextScope[1], _createAvatarContext = _sliced_to_array(createAvatarContext(AVATAR_NAME), 2), AvatarProvider = _createAvatarContext[0], useAvatarContext = _createAvatarContext[1], IMAGE_NAME = "AvatarImage", AvatarImage = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) { | ||
var _getShapeSize, __scopeAvatar = props.__scopeAvatar, src = props.src, _props_onLoadingStatusChange = props.onLoadingStatusChange, onLoadingStatusChange = _props_onLoadingStatusChange === void 0 ? function() { | ||
} : _props_onLoadingStatusChange, imageProps = _object_without_properties(props, [ | ||
"__scopeAvatar", | ||
"src", | ||
"onLoadingStatusChange" | ||
]), context = useAvatarContext(IMAGE_NAME, __scopeAvatar), _React_useState = _sliced_to_array(React.useState("idle"), 2), status = _React_useState[0], setStatus = _React_useState[1], shapeSize = (0, import_core.getVariableValue)((_getShapeSize = (0, import_shapes.getShapeSize)( | ||
var import_jsx_runtime = require("react/jsx-runtime"), import_core = require("@tamagui/core"), import_create_context = require("@tamagui/create-context"), import_helpers = require("@tamagui/helpers"), import_image = require("@tamagui/image"), import_shapes = require("@tamagui/shapes"), import_stacks = require("@tamagui/stacks"), React = __toESM(require("react")), AVATAR_NAME = "Avatar", [createAvatarContext, createAvatarScope] = (0, import_create_context.createContextScope)(AVATAR_NAME), [AvatarProvider, useAvatarContext] = createAvatarContext(AVATAR_NAME), IMAGE_NAME = "AvatarImage", AvatarImage = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) { | ||
var _getShapeSize, { __scopeAvatar, src, onLoadingStatusChange = function() { | ||
}, ...imageProps } = props, context = useAvatarContext(IMAGE_NAME, __scopeAvatar), [status, setStatus] = React.useState("idle"), shapeSize = (0, import_core.getVariableValue)((_getShapeSize = (0, import_shapes.getShapeSize)( | ||
context.size, | ||
@@ -152,8 +55,9 @@ // @ts-expect-error | ||
zIndex: 1, | ||
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_image.Image, _object_spread_props(_object_spread({ | ||
fullscreen: !0 | ||
}, typeof shapeSize == "number" && !Number.isNaN(shapeSize) && { | ||
width: shapeSize, | ||
height: shapeSize | ||
}, imageProps), { | ||
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_image.Image, { | ||
fullscreen: !0, | ||
...typeof shapeSize == "number" && !Number.isNaN(shapeSize) && { | ||
width: shapeSize, | ||
height: shapeSize | ||
}, | ||
...imageProps, | ||
// @ts-ignore | ||
@@ -172,3 +76,3 @@ ref: forwardedRef, | ||
} | ||
})) | ||
}) | ||
}); | ||
@@ -183,6 +87,3 @@ }); | ||
}), AvatarFallback = AvatarFallbackFrame.extractable(/* @__PURE__ */ React.forwardRef(function(props, forwardedRef) { | ||
var __scopeAvatar = props.__scopeAvatar, delayMs = props.delayMs, fallbackProps = _object_without_properties(props, [ | ||
"__scopeAvatar", | ||
"delayMs" | ||
]), context = useAvatarContext(FALLBACK_NAME, __scopeAvatar), _React_useState = _sliced_to_array(React.useState(delayMs === void 0), 2), canRender = _React_useState[0], setCanRender = _React_useState[1]; | ||
var { __scopeAvatar, delayMs, ...fallbackProps } = props, context = useAvatarContext(FALLBACK_NAME, __scopeAvatar), [canRender, setCanRender] = React.useState(delayMs === void 0); | ||
return React.useEffect(function() { | ||
@@ -199,5 +100,6 @@ if (delayMs !== void 0) { | ||
delayMs | ||
]), canRender && context.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarFallbackFrame, _object_spread_props(_object_spread({}, fallbackProps), { | ||
]), canRender && context.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarFallbackFrame, { | ||
...fallbackProps, | ||
ref: forwardedRef | ||
})) : null; | ||
}) : null; | ||
})); | ||
@@ -210,6 +112,3 @@ AvatarFallback.displayName = FALLBACK_NAME; | ||
}), Avatar = (0, import_helpers.withStaticProperties)(/* @__PURE__ */ React.forwardRef(function(props, forwardedRef) { | ||
var __scopeAvatar = props.__scopeAvatar, _props_size = props.size, size = _props_size === void 0 ? "$true" : _props_size, avatarProps = _object_without_properties(props, [ | ||
"__scopeAvatar", | ||
"size" | ||
]), _React_useState = _sliced_to_array(React.useState("idle"), 2), imageLoadingStatus = _React_useState[0], setImageLoadingStatus = _React_useState[1]; | ||
var { __scopeAvatar, size = "$true", ...avatarProps } = props, [imageLoadingStatus, setImageLoadingStatus] = React.useState("idle"); | ||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarProvider, { | ||
@@ -220,7 +119,7 @@ size, | ||
onImageLoadingStatusChange: setImageLoadingStatus, | ||
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarFrame, _object_spread_props(_object_spread({ | ||
size | ||
}, avatarProps), { | ||
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarFrame, { | ||
size, | ||
...avatarProps, | ||
ref: forwardedRef | ||
})) | ||
}) | ||
}); | ||
@@ -227,0 +126,0 @@ }), { |
@@ -9,101 +9,5 @@ import { jsx as _jsx } from "react/jsx-runtime"; | ||
import * as React from "react"; | ||
function _array_like_to_array(arr, len) { | ||
(len == null || len > arr.length) && (len = arr.length); | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _array_with_holes(arr) { | ||
if (Array.isArray(arr)) return arr; | ||
} | ||
function _define_property(obj, key, value) { | ||
return key in obj ? Object.defineProperty(obj, key, { | ||
value, | ||
enumerable: !0, | ||
configurable: !0, | ||
writable: !0 | ||
}) : obj[key] = value, obj; | ||
} | ||
function _iterable_to_array_limit(arr, i) { | ||
var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"]; | ||
if (_i != null) { | ||
var _arr = [], _n = !0, _d = !1, _s, _e; | ||
try { | ||
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0) | ||
; | ||
} catch (err) { | ||
_d = !0, _e = err; | ||
} finally { | ||
try { | ||
!_n && _i.return != null && _i.return(); | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
} | ||
function _non_iterable_rest() { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
function _object_spread(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source); | ||
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) { | ||
return Object.getOwnPropertyDescriptor(source, sym).enumerable; | ||
}))), ownKeys2.forEach(function(key) { | ||
_define_property(target, key, source[key]); | ||
}); | ||
} | ||
return target; | ||
} | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
enumerableOnly && (symbols = symbols.filter(function(sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
})), keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _object_spread_props(target, source) { | ||
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}), target; | ||
} | ||
function _object_without_properties(source, excluded) { | ||
if (source == null) return {}; | ||
var target = _object_without_properties_loose(source, excluded), key, i; | ||
if (Object.getOwnPropertySymbols) { | ||
var sourceSymbolKeys = Object.getOwnPropertySymbols(source); | ||
for (i = 0; i < sourceSymbolKeys.length; i++) | ||
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); | ||
} | ||
return target; | ||
} | ||
function _object_without_properties_loose(source, excluded) { | ||
if (source == null) return {}; | ||
var target = {}, sourceKeys = Object.keys(source), key, i; | ||
for (i = 0; i < sourceKeys.length; i++) | ||
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]); | ||
return target; | ||
} | ||
function _sliced_to_array(arr, i) { | ||
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest(); | ||
} | ||
function _unsupported_iterable_to_array(o, minLen) { | ||
if (o) { | ||
if (typeof o == "string") return _array_like_to_array(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set") return Array.from(n); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen); | ||
} | ||
} | ||
var AVATAR_NAME = "Avatar", _createContextScope = _sliced_to_array(createContextScope(AVATAR_NAME), 2), createAvatarContext = _createContextScope[0], createAvatarScope = _createContextScope[1], _createAvatarContext = _sliced_to_array(createAvatarContext(AVATAR_NAME), 2), AvatarProvider = _createAvatarContext[0], useAvatarContext = _createAvatarContext[1], IMAGE_NAME = "AvatarImage", AvatarImage = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) { | ||
var _getShapeSize, __scopeAvatar = props.__scopeAvatar, src = props.src, _props_onLoadingStatusChange = props.onLoadingStatusChange, onLoadingStatusChange = _props_onLoadingStatusChange === void 0 ? function() { | ||
} : _props_onLoadingStatusChange, imageProps = _object_without_properties(props, [ | ||
"__scopeAvatar", | ||
"src", | ||
"onLoadingStatusChange" | ||
]), context = useAvatarContext(IMAGE_NAME, __scopeAvatar), _React_useState = _sliced_to_array(React.useState("idle"), 2), status = _React_useState[0], setStatus = _React_useState[1], shapeSize = getVariableValue((_getShapeSize = getShapeSize( | ||
var AVATAR_NAME = "Avatar", [createAvatarContext, createAvatarScope] = createContextScope(AVATAR_NAME), [AvatarProvider, useAvatarContext] = createAvatarContext(AVATAR_NAME), IMAGE_NAME = "AvatarImage", AvatarImage = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) { | ||
var _getShapeSize, { __scopeAvatar, src, onLoadingStatusChange = function() { | ||
}, ...imageProps } = props, context = useAvatarContext(IMAGE_NAME, __scopeAvatar), [status, setStatus] = React.useState("idle"), shapeSize = getVariableValue((_getShapeSize = getShapeSize( | ||
context.size, | ||
@@ -126,8 +30,9 @@ // @ts-expect-error | ||
zIndex: 1, | ||
children: /* @__PURE__ */ _jsx(Image, _object_spread_props(_object_spread({ | ||
fullscreen: !0 | ||
}, typeof shapeSize == "number" && !Number.isNaN(shapeSize) && { | ||
width: shapeSize, | ||
height: shapeSize | ||
}, imageProps), { | ||
children: /* @__PURE__ */ _jsx(Image, { | ||
fullscreen: !0, | ||
...typeof shapeSize == "number" && !Number.isNaN(shapeSize) && { | ||
width: shapeSize, | ||
height: shapeSize | ||
}, | ||
...imageProps, | ||
// @ts-ignore | ||
@@ -146,3 +51,3 @@ ref: forwardedRef, | ||
} | ||
})) | ||
}) | ||
}); | ||
@@ -157,6 +62,3 @@ }); | ||
}), AvatarFallback = AvatarFallbackFrame.extractable(/* @__PURE__ */ React.forwardRef(function(props, forwardedRef) { | ||
var __scopeAvatar = props.__scopeAvatar, delayMs = props.delayMs, fallbackProps = _object_without_properties(props, [ | ||
"__scopeAvatar", | ||
"delayMs" | ||
]), context = useAvatarContext(FALLBACK_NAME, __scopeAvatar), _React_useState = _sliced_to_array(React.useState(delayMs === void 0), 2), canRender = _React_useState[0], setCanRender = _React_useState[1]; | ||
var { __scopeAvatar, delayMs, ...fallbackProps } = props, context = useAvatarContext(FALLBACK_NAME, __scopeAvatar), [canRender, setCanRender] = React.useState(delayMs === void 0); | ||
return React.useEffect(function() { | ||
@@ -173,5 +75,6 @@ if (delayMs !== void 0) { | ||
delayMs | ||
]), canRender && context.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ _jsx(AvatarFallbackFrame, _object_spread_props(_object_spread({}, fallbackProps), { | ||
]), canRender && context.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ _jsx(AvatarFallbackFrame, { | ||
...fallbackProps, | ||
ref: forwardedRef | ||
})) : null; | ||
}) : null; | ||
})); | ||
@@ -184,6 +87,3 @@ AvatarFallback.displayName = FALLBACK_NAME; | ||
}), Avatar = withStaticProperties(/* @__PURE__ */ React.forwardRef(function(props, forwardedRef) { | ||
var __scopeAvatar = props.__scopeAvatar, _props_size = props.size, size = _props_size === void 0 ? "$true" : _props_size, avatarProps = _object_without_properties(props, [ | ||
"__scopeAvatar", | ||
"size" | ||
]), _React_useState = _sliced_to_array(React.useState("idle"), 2), imageLoadingStatus = _React_useState[0], setImageLoadingStatus = _React_useState[1]; | ||
var { __scopeAvatar, size = "$true", ...avatarProps } = props, [imageLoadingStatus, setImageLoadingStatus] = React.useState("idle"); | ||
return /* @__PURE__ */ _jsx(AvatarProvider, { | ||
@@ -194,7 +94,7 @@ size, | ||
onImageLoadingStatusChange: setImageLoadingStatus, | ||
children: /* @__PURE__ */ _jsx(AvatarFrame, _object_spread_props(_object_spread({ | ||
size | ||
}, avatarProps), { | ||
children: /* @__PURE__ */ _jsx(AvatarFrame, { | ||
size, | ||
...avatarProps, | ||
ref: forwardedRef | ||
})) | ||
}) | ||
}); | ||
@@ -201,0 +101,0 @@ }), { |
@@ -9,101 +9,5 @@ import { jsx as _jsx } from "react/jsx-runtime"; | ||
import * as React from "react"; | ||
function _array_like_to_array(arr, len) { | ||
(len == null || len > arr.length) && (len = arr.length); | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _array_with_holes(arr) { | ||
if (Array.isArray(arr)) return arr; | ||
} | ||
function _define_property(obj, key, value) { | ||
return key in obj ? Object.defineProperty(obj, key, { | ||
value, | ||
enumerable: !0, | ||
configurable: !0, | ||
writable: !0 | ||
}) : obj[key] = value, obj; | ||
} | ||
function _iterable_to_array_limit(arr, i) { | ||
var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"]; | ||
if (_i != null) { | ||
var _arr = [], _n = !0, _d = !1, _s, _e; | ||
try { | ||
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0) | ||
; | ||
} catch (err) { | ||
_d = !0, _e = err; | ||
} finally { | ||
try { | ||
!_n && _i.return != null && _i.return(); | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
} | ||
function _non_iterable_rest() { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
function _object_spread(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source); | ||
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) { | ||
return Object.getOwnPropertyDescriptor(source, sym).enumerable; | ||
}))), ownKeys2.forEach(function(key) { | ||
_define_property(target, key, source[key]); | ||
}); | ||
} | ||
return target; | ||
} | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
enumerableOnly && (symbols = symbols.filter(function(sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
})), keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _object_spread_props(target, source) { | ||
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}), target; | ||
} | ||
function _object_without_properties(source, excluded) { | ||
if (source == null) return {}; | ||
var target = _object_without_properties_loose(source, excluded), key, i; | ||
if (Object.getOwnPropertySymbols) { | ||
var sourceSymbolKeys = Object.getOwnPropertySymbols(source); | ||
for (i = 0; i < sourceSymbolKeys.length; i++) | ||
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]); | ||
} | ||
return target; | ||
} | ||
function _object_without_properties_loose(source, excluded) { | ||
if (source == null) return {}; | ||
var target = {}, sourceKeys = Object.keys(source), key, i; | ||
for (i = 0; i < sourceKeys.length; i++) | ||
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]); | ||
return target; | ||
} | ||
function _sliced_to_array(arr, i) { | ||
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest(); | ||
} | ||
function _unsupported_iterable_to_array(o, minLen) { | ||
if (o) { | ||
if (typeof o == "string") return _array_like_to_array(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set") return Array.from(n); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen); | ||
} | ||
} | ||
var AVATAR_NAME = "Avatar", _createContextScope = _sliced_to_array(createContextScope(AVATAR_NAME), 2), createAvatarContext = _createContextScope[0], createAvatarScope = _createContextScope[1], _createAvatarContext = _sliced_to_array(createAvatarContext(AVATAR_NAME), 2), AvatarProvider = _createAvatarContext[0], useAvatarContext = _createAvatarContext[1], IMAGE_NAME = "AvatarImage", AvatarImage = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) { | ||
var _getShapeSize, __scopeAvatar = props.__scopeAvatar, src = props.src, _props_onLoadingStatusChange = props.onLoadingStatusChange, onLoadingStatusChange = _props_onLoadingStatusChange === void 0 ? function() { | ||
} : _props_onLoadingStatusChange, imageProps = _object_without_properties(props, [ | ||
"__scopeAvatar", | ||
"src", | ||
"onLoadingStatusChange" | ||
]), context = useAvatarContext(IMAGE_NAME, __scopeAvatar), _React_useState = _sliced_to_array(React.useState("idle"), 2), status = _React_useState[0], setStatus = _React_useState[1], shapeSize = getVariableValue((_getShapeSize = getShapeSize( | ||
var AVATAR_NAME = "Avatar", [createAvatarContext, createAvatarScope] = createContextScope(AVATAR_NAME), [AvatarProvider, useAvatarContext] = createAvatarContext(AVATAR_NAME), IMAGE_NAME = "AvatarImage", AvatarImage = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) { | ||
var _getShapeSize, { __scopeAvatar, src, onLoadingStatusChange = function() { | ||
}, ...imageProps } = props, context = useAvatarContext(IMAGE_NAME, __scopeAvatar), [status, setStatus] = React.useState("idle"), shapeSize = getVariableValue((_getShapeSize = getShapeSize( | ||
context.size, | ||
@@ -126,8 +30,9 @@ // @ts-expect-error | ||
zIndex: 1, | ||
children: /* @__PURE__ */ _jsx(Image, _object_spread_props(_object_spread({ | ||
fullscreen: !0 | ||
}, typeof shapeSize == "number" && !Number.isNaN(shapeSize) && { | ||
width: shapeSize, | ||
height: shapeSize | ||
}, imageProps), { | ||
children: /* @__PURE__ */ _jsx(Image, { | ||
fullscreen: !0, | ||
...typeof shapeSize == "number" && !Number.isNaN(shapeSize) && { | ||
width: shapeSize, | ||
height: shapeSize | ||
}, | ||
...imageProps, | ||
// @ts-ignore | ||
@@ -146,3 +51,3 @@ ref: forwardedRef, | ||
} | ||
})) | ||
}) | ||
}); | ||
@@ -157,6 +62,3 @@ }); | ||
}), AvatarFallback = AvatarFallbackFrame.extractable(/* @__PURE__ */ React.forwardRef(function(props, forwardedRef) { | ||
var __scopeAvatar = props.__scopeAvatar, delayMs = props.delayMs, fallbackProps = _object_without_properties(props, [ | ||
"__scopeAvatar", | ||
"delayMs" | ||
]), context = useAvatarContext(FALLBACK_NAME, __scopeAvatar), _React_useState = _sliced_to_array(React.useState(delayMs === void 0), 2), canRender = _React_useState[0], setCanRender = _React_useState[1]; | ||
var { __scopeAvatar, delayMs, ...fallbackProps } = props, context = useAvatarContext(FALLBACK_NAME, __scopeAvatar), [canRender, setCanRender] = React.useState(delayMs === void 0); | ||
return React.useEffect(function() { | ||
@@ -173,5 +75,6 @@ if (delayMs !== void 0) { | ||
delayMs | ||
]), canRender && context.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ _jsx(AvatarFallbackFrame, _object_spread_props(_object_spread({}, fallbackProps), { | ||
]), canRender && context.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ _jsx(AvatarFallbackFrame, { | ||
...fallbackProps, | ||
ref: forwardedRef | ||
})) : null; | ||
}) : null; | ||
})); | ||
@@ -184,6 +87,3 @@ AvatarFallback.displayName = FALLBACK_NAME; | ||
}), Avatar = withStaticProperties(/* @__PURE__ */ React.forwardRef(function(props, forwardedRef) { | ||
var __scopeAvatar = props.__scopeAvatar, _props_size = props.size, size = _props_size === void 0 ? "$true" : _props_size, avatarProps = _object_without_properties(props, [ | ||
"__scopeAvatar", | ||
"size" | ||
]), _React_useState = _sliced_to_array(React.useState("idle"), 2), imageLoadingStatus = _React_useState[0], setImageLoadingStatus = _React_useState[1]; | ||
var { __scopeAvatar, size = "$true", ...avatarProps } = props, [imageLoadingStatus, setImageLoadingStatus] = React.useState("idle"); | ||
return /* @__PURE__ */ _jsx(AvatarProvider, { | ||
@@ -194,7 +94,7 @@ size, | ||
onImageLoadingStatusChange: setImageLoadingStatus, | ||
children: /* @__PURE__ */ _jsx(AvatarFrame, _object_spread_props(_object_spread({ | ||
size | ||
}, avatarProps), { | ||
children: /* @__PURE__ */ _jsx(AvatarFrame, { | ||
size, | ||
...avatarProps, | ||
ref: forwardedRef | ||
})) | ||
}) | ||
}); | ||
@@ -201,0 +101,0 @@ }), { |
{ | ||
"name": "@tamagui/avatar", | ||
"version": "1.110.5", | ||
"version": "1.111.0", | ||
"sideEffects": [ | ||
@@ -36,10 +36,10 @@ "*.css" | ||
"dependencies": { | ||
"@tamagui/core": "1.110.5", | ||
"@tamagui/helpers": "1.110.5", | ||
"@tamagui/image": "1.110.5", | ||
"@tamagui/shapes": "1.110.5", | ||
"@tamagui/text": "1.110.5" | ||
"@tamagui/core": "1.111.0", | ||
"@tamagui/helpers": "1.111.0", | ||
"@tamagui/image": "1.111.0", | ||
"@tamagui/shapes": "1.111.0", | ||
"@tamagui/text": "1.111.0" | ||
}, | ||
"devDependencies": { | ||
"@tamagui/build": "1.110.5", | ||
"@tamagui/build": "1.111.0", | ||
"react": "^18.2.0 || ^19.0.0", | ||
@@ -46,0 +46,0 @@ "react-native": "0.74.1" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44
86554
1371
+ Added@tamagui/compose-refs@1.111.0(transitive)
+ Added@tamagui/constants@1.111.0(transitive)
+ Added@tamagui/core@1.111.0(transitive)
+ Added@tamagui/get-font-sized@1.111.0(transitive)
+ Added@tamagui/helpers@1.111.0(transitive)
+ Added@tamagui/helpers-tamagui@1.111.0(transitive)
+ Added@tamagui/image@1.111.0(transitive)
+ Added@tamagui/normalize-css-color@1.111.0(transitive)
+ Added@tamagui/react-native-use-pressable@1.111.0(transitive)
+ Added@tamagui/react-native-use-responder-events@1.111.0(transitive)
+ Added@tamagui/shapes@1.111.0(transitive)
+ Added@tamagui/simple-hash@1.111.0(transitive)
+ Added@tamagui/stacks@1.111.0(transitive)
+ Added@tamagui/text@1.111.0(transitive)
+ Added@tamagui/timer@1.111.0(transitive)
+ Added@tamagui/types@1.111.0(transitive)
+ Added@tamagui/use-did-finish-ssr@1.111.0(transitive)
+ Added@tamagui/use-event@1.111.0(transitive)
+ Added@tamagui/use-force-update@1.111.0(transitive)
+ Added@tamagui/web@1.111.0(transitive)
- Removed@tamagui/compose-refs@1.110.5(transitive)
- Removed@tamagui/constants@1.110.5(transitive)
- Removed@tamagui/core@1.110.5(transitive)
- Removed@tamagui/get-font-sized@1.110.5(transitive)
- Removed@tamagui/helpers@1.110.5(transitive)
- Removed@tamagui/helpers-tamagui@1.110.5(transitive)
- Removed@tamagui/image@1.110.5(transitive)
- Removed@tamagui/normalize-css-color@1.110.5(transitive)
- Removed@tamagui/react-native-use-pressable@1.110.5(transitive)
- Removed@tamagui/react-native-use-responder-events@1.110.5(transitive)
- Removed@tamagui/shapes@1.110.5(transitive)
- Removed@tamagui/simple-hash@1.110.5(transitive)
- Removed@tamagui/stacks@1.110.5(transitive)
- Removed@tamagui/text@1.110.5(transitive)
- Removed@tamagui/timer@1.110.5(transitive)
- Removed@tamagui/types@1.110.5(transitive)
- Removed@tamagui/use-did-finish-ssr@1.110.5(transitive)
- Removed@tamagui/use-event@1.110.5(transitive)
- Removed@tamagui/use-force-update@1.110.5(transitive)
- Removed@tamagui/web@1.110.5(transitive)
Updated@tamagui/core@1.111.0
Updated@tamagui/helpers@1.111.0
Updated@tamagui/image@1.111.0
Updated@tamagui/shapes@1.111.0
Updated@tamagui/text@1.111.0