@yamada-ui/avatar
Advanced tools
Comparing version 0.0.0-dev-20230625235915 to 0.0.0-dev-20230701130255
import * as _yamada_ui_core from '@yamada-ui/core'; | ||
import { HTMLUIProps } from '@yamada-ui/core'; | ||
type Placement = 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end'; | ||
type AvatarBadgeOptions = { | ||
placement?: Placement; | ||
/** | ||
* The placement of the badge. | ||
* | ||
* @default 'bottom-end' | ||
*/ | ||
placement?: 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end'; | ||
}; | ||
@@ -8,0 +12,0 @@ type AvatarBadgeProps = HTMLUIProps<'div'> & AvatarBadgeOptions; |
@@ -70,3 +70,6 @@ "use strict"; | ||
var defaultFormat = (name) => { | ||
const [firstName, lastName] = name.split(" "); | ||
var _a; | ||
const names = name.split(" "); | ||
const firstName = (_a = names[0]) != null ? _a : ""; | ||
const lastName = names.length > 1 ? names[names.length - 1] : ""; | ||
return firstName && lastName ? `${firstName.charAt(0)}${lastName.charAt(0)}` : firstName.charAt(0); | ||
@@ -160,5 +163,6 @@ }; | ||
ignoreFallback, | ||
crossOrigin, | ||
referrerPolicy | ||
}) => { | ||
const status = (0, import_image.useImage)({ src, onError, ignoreFallback }); | ||
const status = (0, import_image.useImage)({ src, onError, crossOrigin, ignoreFallback }); | ||
const isLoaded = status === "loaded"; | ||
@@ -165,0 +169,0 @@ const isFallback = !src || !isLoaded; |
@@ -5,2 +5,5 @@ import * as _yamada_ui_core from '@yamada-ui/core'; | ||
type AvatarGroupOptions = { | ||
/** | ||
* The maximum number of visible avatars. | ||
*/ | ||
max?: number; | ||
@@ -7,0 +10,0 @@ }; |
@@ -145,5 +145,6 @@ "use strict"; | ||
ignoreFallback, | ||
crossOrigin, | ||
referrerPolicy | ||
}) => { | ||
const status = (0, import_image.useImage)({ src, onError, ignoreFallback }); | ||
const status = (0, import_image.useImage)({ src, onError, crossOrigin, ignoreFallback }); | ||
const isLoaded = status === "loaded"; | ||
@@ -178,3 +179,6 @@ const isFallback = !src || !isLoaded; | ||
var defaultFormat = (name) => { | ||
const [firstName, lastName] = name.split(" "); | ||
var _a; | ||
const names = name.split(" "); | ||
const firstName = (_a = names[0]) != null ? _a : ""; | ||
const lastName = names.length > 1 ? names[names.length - 1] : ""; | ||
return firstName && lastName ? `${firstName.charAt(0)}${lastName.charAt(0)}` : firstName.charAt(0); | ||
@@ -181,0 +185,0 @@ }; |
@@ -11,10 +11,42 @@ import * as _yamada_ui_core from '@yamada-ui/core'; | ||
type AvatarOptions = { | ||
/** | ||
* The name of the person in the avatar. | ||
* | ||
* - if `src` has loaded, the name will be used as the `alt` attribute of the `img` | ||
* - If `src` is not loaded, the name will be used to create the initials | ||
*/ | ||
name?: string; | ||
/** | ||
* The image url of the avatar. | ||
*/ | ||
src?: ImageProps['src']; | ||
/** | ||
* List of sources to use for different screen resolutions. | ||
*/ | ||
srcSet?: ImageProps['srcSet']; | ||
/** | ||
* Defines loading strategy. | ||
*/ | ||
loading?: ImageProps['loading']; | ||
/** | ||
* If `true`, opt out of the avatar's `fallback` logic and renders the `img` at all times. | ||
* | ||
* @default false | ||
*/ | ||
ignoreFallback?: ImageProps['ignoreFallback']; | ||
/** | ||
* The avatar icon to use. | ||
*/ | ||
icon?: ReactElement; | ||
/** | ||
* Function called when image failed to load. | ||
*/ | ||
onError?: () => void; | ||
/** | ||
* Function to get the initials to display. | ||
*/ | ||
format?: (name: string) => string; | ||
/** | ||
* Defining which referrer is sent when fetching the resource. | ||
*/ | ||
referrerPolicy?: HTMLAttributeReferrerPolicy; | ||
@@ -21,0 +53,0 @@ }; |
@@ -68,3 +68,6 @@ "use strict"; | ||
var defaultFormat = (name) => { | ||
const [firstName, lastName] = name.split(" "); | ||
var _a; | ||
const names = name.split(" "); | ||
const firstName = (_a = names[0]) != null ? _a : ""; | ||
const lastName = names.length > 1 ? names[names.length - 1] : ""; | ||
return firstName && lastName ? `${firstName.charAt(0)}${lastName.charAt(0)}` : firstName.charAt(0); | ||
@@ -158,5 +161,6 @@ }; | ||
ignoreFallback, | ||
crossOrigin, | ||
referrerPolicy | ||
}) => { | ||
const status = (0, import_image.useImage)({ src, onError, ignoreFallback }); | ||
const status = (0, import_image.useImage)({ src, onError, crossOrigin, ignoreFallback }); | ||
const isLoaded = status === "loaded"; | ||
@@ -163,0 +167,0 @@ const isFallback = !src || !isLoaded; |
@@ -1,2 +0,2 @@ | ||
export { Avatar, AvatarProps, AvatarProvider, useAvatarContext } from './avatar.js'; | ||
export { Avatar, AvatarProps } from './avatar.js'; | ||
export { AvatarGroup, AvatarGroupProps } from './avatar-group.js'; | ||
@@ -3,0 +3,0 @@ export { AvatarBadge, AvatarBadgeProps } from './avatar-badge.js'; |
@@ -25,5 +25,3 @@ "use strict"; | ||
AvatarBadge: () => AvatarBadge, | ||
AvatarGroup: () => AvatarGroup, | ||
AvatarProvider: () => AvatarProvider, | ||
useAvatarContext: () => useAvatarContext | ||
AvatarGroup: () => AvatarGroup | ||
}); | ||
@@ -73,3 +71,6 @@ module.exports = __toCommonJS(src_exports); | ||
var defaultFormat = (name) => { | ||
const [firstName, lastName] = name.split(" "); | ||
var _a; | ||
const names = name.split(" "); | ||
const firstName = (_a = names[0]) != null ? _a : ""; | ||
const lastName = names.length > 1 ? names[names.length - 1] : ""; | ||
return firstName && lastName ? `${firstName.charAt(0)}${lastName.charAt(0)}` : firstName.charAt(0); | ||
@@ -163,5 +164,6 @@ }; | ||
ignoreFallback, | ||
crossOrigin, | ||
referrerPolicy | ||
}) => { | ||
const status = (0, import_image.useImage)({ src, onError, ignoreFallback }); | ||
const status = (0, import_image.useImage)({ src, onError, crossOrigin, ignoreFallback }); | ||
const isLoaded = status === "loaded"; | ||
@@ -323,5 +325,3 @@ const isFallback = !src || !isLoaded; | ||
AvatarBadge, | ||
AvatarGroup, | ||
AvatarProvider, | ||
useAvatarContext | ||
AvatarGroup | ||
}); |
{ | ||
"name": "@yamada-ui/avatar", | ||
"version": "0.0.0-dev-20230625235915", | ||
"version": "0.0.0-dev-20230701130255", | ||
"description": "Yamada UI avatar component", | ||
@@ -38,6 +38,6 @@ "keywords": [ | ||
"dependencies": { | ||
"@yamada-ui/core": "0.0.0-dev-20230625235915", | ||
"@yamada-ui/core": "0.0.0-dev-20230701130255", | ||
"@yamada-ui/utils": "0.1.1", | ||
"@yamada-ui/image": "0.0.0-dev-20230625235915", | ||
"@yamada-ui/icon": "0.0.0-dev-20230625235915" | ||
"@yamada-ui/image": "0.0.0-dev-20230701130255", | ||
"@yamada-ui/icon": "0.0.0-dev-20230701130255" | ||
}, | ||
@@ -76,4 +76,4 @@ "devDependencies": { | ||
"typecheck": "tsc --noEmit", | ||
"gen:types": "tsx ../../../scripts/generate-types" | ||
"gen:docs": "tsx ../../../scripts/generate-docs" | ||
} | ||
} |
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
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
49070
25
1552
+ Added@yamada-ui/core@0.0.0-dev-20230701130255(transitive)
+ Added@yamada-ui/icon@0.0.0-dev-20230701130255(transitive)
+ Added@yamada-ui/image@0.0.0-dev-20230701130255(transitive)
+ Added@yamada-ui/portal@0.0.0-dev-20230701130255(transitive)
+ Added@yamada-ui/use-token@0.0.0-dev-20230701130255(transitive)
- Removed@yamada-ui/core@0.0.0-dev-20230625235915(transitive)
- Removed@yamada-ui/icon@0.0.0-dev-20230625235915(transitive)
- Removed@yamada-ui/image@0.0.0-dev-20230625235915(transitive)
- Removed@yamada-ui/portal@0.1.2(transitive)
- Removed@yamada-ui/use-token@0.0.0-dev-20230625235915(transitive)