@yahoo/uds 3.135.0-beta.1 → 3.136.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/automated-config/dist/properties.d.cts +1 -1
- package/dist/automated-config/dist/properties.d.ts +1 -1
- package/dist/automated-config/dist/utils/buildConfigSchema.d.cts +1 -1
- package/dist/automated-config/dist/utils/buildConfigSchema.d.ts +1 -1
- package/dist/cli/runner.cjs +0 -40
- package/dist/cli/runner.js +0 -40
- package/dist/components/Banner/Banner.cjs +2 -2
- package/dist/components/Banner/Banner.d.cts +1 -1
- package/dist/components/Banner/Banner.d.ts +1 -1
- package/dist/components/Banner/Banner.js +2 -2
- package/dist/components/Banner/utils.d.cts +1 -1
- package/dist/components/Banner/utils.d.ts +1 -1
- package/dist/components/Box.d.cts +1 -1
- package/dist/components/Box.d.ts +1 -1
- package/dist/components/Divider/DividerCore.cjs +1 -1
- package/dist/components/Divider/DividerCore.d.cts +2 -2
- package/dist/components/Divider/DividerCore.d.ts +2 -2
- package/dist/components/Divider/DividerCore.js +1 -1
- package/dist/components/Divider/DividerInternal.d.cts +1 -1
- package/dist/components/Divider/DividerInternal.d.ts +1 -1
- package/dist/components/FormLabel.d.cts +1 -1
- package/dist/components/FormLabel.d.ts +1 -1
- package/dist/components/HStack.d.cts +1 -1
- package/dist/components/HStack.d.ts +1 -1
- package/dist/components/Icon.cjs +6 -15
- package/dist/components/Icon.d.cts +1 -0
- package/dist/components/Icon.d.ts +1 -0
- package/dist/components/Icon.js +7 -16
- package/dist/components/IconSlot.cjs +6 -25
- package/dist/components/IconSlot.d.cts +2 -3
- package/dist/components/IconSlot.d.ts +2 -3
- package/dist/components/IconSlot.js +6 -26
- package/dist/components/Image.d.cts +1 -1
- package/dist/components/Image.d.ts +1 -1
- package/dist/components/Link.d.cts +1 -1
- package/dist/components/Link.d.ts +1 -1
- package/dist/components/Text.d.cts +1 -1
- package/dist/components/Text.d.ts +1 -1
- package/dist/components/VStack.d.cts +1 -1
- package/dist/components/VStack.d.ts +1 -1
- package/dist/components/{Avatar → client/Avatar}/Avatar.cjs +6 -21
- package/dist/components/{Avatar → client/Avatar}/Avatar.d.cts +3 -3
- package/dist/components/{Avatar → client/Avatar}/Avatar.d.ts +4 -3
- package/dist/components/{Avatar → client/Avatar}/Avatar.js +5 -20
- package/dist/components/{Avatar → client/Avatar}/AvatarIcon.cjs +12 -11
- package/dist/components/{Avatar → client/Avatar}/AvatarIcon.d.cts +3 -4
- package/dist/components/{Avatar → client/Avatar}/AvatarIcon.d.ts +4 -4
- package/dist/components/{Avatar → client/Avatar}/AvatarIcon.js +7 -6
- package/dist/components/client/Avatar/AvatarImage.cjs +58 -37
- package/dist/components/client/Avatar/AvatarImage.d.cts +15 -2
- package/dist/components/client/Avatar/AvatarImage.d.ts +15 -2
- package/dist/components/client/Avatar/AvatarImage.js +57 -36
- package/dist/components/{Avatar → client/Avatar}/AvatarText.cjs +11 -11
- package/dist/components/{Avatar → client/Avatar}/AvatarText.d.cts +3 -4
- package/dist/components/{Avatar → client/Avatar}/AvatarText.d.ts +4 -4
- package/dist/components/{Avatar → client/Avatar}/AvatarText.js +5 -5
- package/dist/components/client/Avatar/index.cjs +6 -0
- package/dist/components/client/Avatar/index.d.cts +5 -3
- package/dist/components/client/Avatar/index.d.ts +5 -3
- package/dist/components/client/Avatar/index.js +4 -1
- package/dist/components/{Avatar → client/Avatar}/utils.cjs +4 -3
- package/dist/components/{Avatar → client/Avatar}/utils.d.cts +3 -3
- package/dist/components/{Avatar → client/Avatar}/utils.d.ts +4 -3
- package/dist/components/{Avatar → client/Avatar}/utils.js +3 -2
- package/dist/components/client/Badge.d.cts +1 -1
- package/dist/components/client/Badge.d.ts +1 -1
- package/dist/components/client/BottomSheet/BottomSheet.d.cts +1 -1
- package/dist/components/client/BottomSheet/BottomSheet.d.ts +1 -1
- package/dist/components/client/BottomSheet/BottomSheetContent.d.cts +1 -1
- package/dist/components/client/BottomSheet/BottomSheetContent.d.ts +1 -1
- package/dist/components/client/BottomSheet/BottomSheetHandle.d.cts +1 -1
- package/dist/components/client/BottomSheet/BottomSheetHandle.d.ts +1 -1
- package/dist/components/client/BottomSheet/BottomSheetHeader.cjs +1 -1
- package/dist/components/client/BottomSheet/BottomSheetHeader.d.cts +1 -1
- package/dist/components/client/BottomSheet/BottomSheetHeader.d.ts +1 -1
- package/dist/components/client/BottomSheet/BottomSheetHeader.js +1 -1
- package/dist/components/client/BottomSheet/useBottomSheetSnapModel.d.cts +1 -1
- package/dist/components/client/BottomSheet/useBottomSheetSnapModel.d.ts +1 -1
- package/dist/components/client/BottomSheet/utils.d.cts +1 -1
- package/dist/components/client/BottomSheet/utils.d.ts +1 -1
- package/dist/components/client/Button.cjs +1 -1
- package/dist/components/client/Button.d.cts +1 -1
- package/dist/components/client/Button.d.ts +1 -1
- package/dist/components/client/Button.js +1 -1
- package/dist/components/client/Checkbox.cjs +2 -2
- package/dist/components/client/Checkbox.d.cts +1 -1
- package/dist/components/client/Checkbox.d.ts +1 -1
- package/dist/components/client/Checkbox.js +2 -2
- package/dist/components/client/Chip/ChipBase.d.cts +1 -1
- package/dist/components/client/Chip/ChipBase.d.ts +1 -1
- package/dist/components/client/Chip/ChipButton.d.cts +1 -1
- package/dist/components/client/Chip/ChipButton.d.ts +1 -1
- package/dist/components/client/Chip/ChipDismissible.cjs +2 -2
- package/dist/components/client/Chip/ChipDismissible.d.cts +1 -1
- package/dist/components/client/Chip/ChipDismissible.d.ts +1 -1
- package/dist/components/client/Chip/ChipDismissible.js +2 -2
- package/dist/components/client/Chip/ChipLink.d.cts +1 -1
- package/dist/components/client/Chip/ChipLink.d.ts +1 -1
- package/dist/components/client/Chip/ChipToggle.d.cts +1 -1
- package/dist/components/client/Chip/ChipToggle.d.ts +1 -1
- package/dist/components/client/IconButton.cjs +2 -7
- package/dist/components/client/IconButton.js +2 -7
- package/dist/components/client/Input/Input.cjs +1 -1
- package/dist/components/client/Input/Input.d.cts +1 -1
- package/dist/components/client/Input/Input.d.ts +1 -1
- package/dist/components/client/Input/Input.js +1 -1
- package/dist/components/client/Input/InputHelpTextInternal.d.cts +1 -1
- package/dist/components/client/Input/InputHelpTextInternal.d.ts +1 -1
- package/dist/components/client/Menu/Menu.Content.d.cts +1 -1
- package/dist/components/client/Menu/Menu.Content.d.ts +1 -1
- package/dist/components/client/Menu/Menu.Item.d.cts +1 -1
- package/dist/components/client/Menu/Menu.Item.d.ts +1 -1
- package/dist/components/client/Menu/Menu.ItemBase.cjs +1 -1
- package/dist/components/client/Menu/Menu.ItemBase.d.cts +1 -1
- package/dist/components/client/Menu/Menu.ItemBase.d.ts +1 -1
- package/dist/components/client/Menu/Menu.ItemBase.js +1 -1
- package/dist/components/client/Menu/Menu.ItemCheckbox.cjs +1 -1
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.cts +2 -2
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.ts +2 -2
- package/dist/components/client/Menu/Menu.ItemCheckbox.js +1 -1
- package/dist/components/client/Modal/Modal.cjs +3 -3
- package/dist/components/client/Modal/Modal.d.cts +1 -1
- package/dist/components/client/Modal/Modal.d.ts +1 -1
- package/dist/components/client/Modal/Modal.js +3 -3
- package/dist/components/client/Modal/ModalActions.d.cts +1 -1
- package/dist/components/client/Modal/ModalActions.d.ts +1 -1
- package/dist/components/client/Modal/ModalContent.d.cts +1 -1
- package/dist/components/client/Modal/ModalContent.d.ts +1 -1
- package/dist/components/client/Modal/ModalContext.d.cts +1 -1
- package/dist/components/client/Modal/ModalContext.d.ts +1 -1
- package/dist/components/client/Modal/ModalDescription.d.cts +1 -1
- package/dist/components/client/Modal/ModalDescription.d.ts +1 -1
- package/dist/components/client/Modal/ModalTitle.d.cts +1 -1
- package/dist/components/client/Modal/ModalTitle.d.ts +1 -1
- package/dist/components/client/Modal/UDSModalConfigProvider.d.cts +1 -1
- package/dist/components/client/Modal/UDSModalConfigProvider.d.ts +1 -1
- package/dist/components/client/Popover/Popover.d.cts +1 -1
- package/dist/components/client/Popover/Popover.d.ts +1 -1
- package/dist/components/client/Popover/PopoverContent.cjs +3 -3
- package/dist/components/client/Popover/PopoverContent.d.cts +1 -1
- package/dist/components/client/Popover/PopoverContent.d.ts +1 -1
- package/dist/components/client/Popover/PopoverContent.js +3 -3
- package/dist/components/client/Popover/PopoverTrigger.d.cts +1 -1
- package/dist/components/client/Popover/PopoverTrigger.d.ts +1 -1
- package/dist/components/client/Popover/UDSPopoverConfigProvider.d.cts +2 -2
- package/dist/components/client/Popover/UDSPopoverConfigProvider.d.ts +2 -2
- package/dist/components/client/Popover/index.d.cts +1 -1
- package/dist/components/client/Popover/index.d.ts +1 -1
- package/dist/components/client/Pressable.d.cts +1 -1
- package/dist/components/client/Pressable.d.ts +1 -1
- package/dist/components/client/Radio/Radio.d.cts +1 -1
- package/dist/components/client/Radio/Radio.d.ts +1 -1
- package/dist/components/client/Radio/RadioGroupProvider.d.cts +1 -1
- package/dist/components/client/Radio/RadioGroupProvider.d.ts +1 -1
- package/dist/components/client/SpringMotionConfig.d.cts +1 -1
- package/dist/components/client/SpringMotionConfig.d.ts +1 -1
- package/dist/components/client/Switch.cjs +1 -1
- package/dist/components/client/Switch.d.cts +1 -1
- package/dist/components/client/Switch.d.ts +1 -1
- package/dist/components/client/Switch.js +1 -1
- package/dist/components/client/Tabs/Tab.d.cts +1 -1
- package/dist/components/client/Tabs/Tab.d.ts +1 -1
- package/dist/components/client/Tabs/TabList.d.cts +1 -1
- package/dist/components/client/Tabs/TabList.d.ts +1 -1
- package/dist/components/client/Tabs/TabPanel.d.cts +1 -1
- package/dist/components/client/Tabs/TabPanel.d.ts +1 -1
- package/dist/components/client/Tabs/Tabs.d.cts +1 -1
- package/dist/components/client/Tabs/Tabs.d.ts +1 -1
- package/dist/components/client/Tabs/tabsContext.d.cts +1 -1
- package/dist/components/client/Tabs/tabsContext.d.ts +1 -1
- package/dist/components/client/Toast/Toast.cjs +1 -1
- package/dist/components/client/Toast/Toast.d.cts +1 -1
- package/dist/components/client/Toast/Toast.d.ts +1 -1
- package/dist/components/client/Toast/Toast.js +1 -1
- package/dist/components/client/Toast/ToastContainer.d.cts +1 -1
- package/dist/components/client/Toast/ToastContainer.d.ts +1 -1
- package/dist/components/client/Toast/UDSToastConfigProvider.d.cts +2 -2
- package/dist/components/client/Toast/UDSToastConfigProvider.d.ts +2 -2
- package/dist/components/client/Toast/createToast.d.cts +1 -1
- package/dist/components/client/Toast/createToast.d.ts +1 -1
- package/dist/components/client/Tooltip/Tooltip.d.cts +1 -1
- package/dist/components/client/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/client/Tooltip/TooltipContent.cjs +1 -1
- package/dist/components/client/Tooltip/TooltipContent.d.cts +2 -2
- package/dist/components/client/Tooltip/TooltipContent.d.ts +2 -2
- package/dist/components/client/Tooltip/TooltipContent.js +1 -1
- package/dist/components/client/Tooltip/TooltipTrigger.d.cts +1 -1
- package/dist/components/client/Tooltip/TooltipTrigger.d.ts +1 -1
- package/dist/components/client/Tooltip/UDSTooltipConfigProvider.d.cts +1 -1
- package/dist/components/client/Tooltip/UDSTooltipConfigProvider.d.ts +1 -1
- package/dist/components/client/Tooltip/index.d.cts +1 -1
- package/dist/components/client/Tooltip/index.d.ts +1 -1
- package/dist/components/client/buttonConstants.d.cts +1 -1
- package/dist/components/client/buttonConstants.d.ts +1 -1
- package/dist/components/client/index.cjs +7 -1
- package/dist/components/client/index.d.cts +6 -4
- package/dist/components/client/index.d.ts +6 -4
- package/dist/components/client/index.js +5 -2
- package/dist/components/client/providers/UDSBreakpointsConfigProvider.d.cts +1 -1
- package/dist/components/client/providers/UDSBreakpointsConfigProvider.d.ts +1 -1
- package/dist/components/experimental/Table.cjs +1 -1
- package/dist/components/experimental/Table.d.cts +2 -2
- package/dist/components/experimental/Table.d.ts +2 -2
- package/dist/components/experimental/Table.js +1 -1
- package/dist/components/experimental/client/Accordion.cjs +1 -1
- package/dist/components/experimental/client/Accordion.js +1 -1
- package/dist/components/experimental/client/SegmentedControl.cjs +1 -1
- package/dist/components/experimental/client/SegmentedControl.js +1 -1
- package/dist/components/experimental/client/SwitchV2.cjs +1 -1
- package/dist/components/experimental/client/SwitchV2.d.cts +1 -1
- package/dist/components/experimental/client/SwitchV2.d.ts +1 -1
- package/dist/components/experimental/client/SwitchV2.js +1 -1
- package/dist/components/index.cjs +13 -16
- package/dist/components/index.d.cts +7 -9
- package/dist/components/index.d.ts +7 -9
- package/dist/components/index.js +8 -10
- package/dist/config/dist/index.d.cts +1 -1
- package/dist/config/dist/index.d.ts +1 -1
- package/dist/css-tokens/dist/index.d.cts +1 -1
- package/dist/css-tokens/dist/index.d.ts +1 -1
- package/dist/fixtures/dist/index.d.cts +1 -1
- package/dist/fixtures/dist/index.d.ts +1 -1
- package/dist/fixtures/index.d.cts +1 -1
- package/dist/fixtures/index.d.ts +1 -1
- package/dist/fonts/dist/index.d.cts +1 -1
- package/dist/fonts/dist/index.d.ts +1 -1
- package/dist/icons/dist/types.d.cts +30 -0
- package/dist/icons/dist/types.d.ts +30 -0
- package/dist/index.cjs +10 -12
- package/dist/index.d.cts +9 -11
- package/dist/index.d.ts +9 -11
- package/dist/index.js +8 -9
- package/dist/modes/dist/index.d.cts +1 -1
- package/dist/modes/dist/index.d.ts +1 -1
- package/dist/motion-tokens/dist/index.d.cts +1 -1
- package/dist/motion-tokens/dist/index.d.ts +1 -1
- package/dist/providers/ColorModeProvider.d.cts +1 -1
- package/dist/providers/ColorModeProvider.d.ts +1 -1
- package/dist/providers/ScaleModeProvider.d.cts +1 -1
- package/dist/providers/ScaleModeProvider.d.ts +1 -1
- package/dist/providers/ThemeProvider.d.cts +1 -1
- package/dist/providers/ThemeProvider.d.ts +1 -1
- package/dist/runtime/bottomSheetConfig.d.cts +1 -1
- package/dist/runtime/bottomSheetConfig.d.ts +1 -1
- package/dist/runtime/breakpointsConfig.d.cts +1 -1
- package/dist/runtime/breakpointsConfig.d.ts +1 -1
- package/dist/runtime/modalConfig.d.cts +1 -1
- package/dist/runtime/modalConfig.d.ts +1 -1
- package/dist/runtime/popoverConfig.d.cts +1 -1
- package/dist/runtime/popoverConfig.d.ts +1 -1
- package/dist/runtime/toastConfig.d.cts +1 -1
- package/dist/runtime/toastConfig.d.ts +1 -1
- package/dist/runtime/tooltipConfig.d.cts +1 -1
- package/dist/runtime/tooltipConfig.d.ts +1 -1
- package/dist/styles/styler.d.cts +5 -5
- package/dist/styles/styler.d.ts +5 -5
- package/dist/styles/stylerTypes.d.cts +1 -1
- package/dist/styles/stylerTypes.d.ts +1 -1
- package/dist/tailwind/dist/commands/generatePurgeCSSData.cjs +2 -6
- package/dist/tailwind/dist/commands/generatePurgeCSSData.d.cts.map +1 -1
- package/dist/tailwind/dist/commands/generatePurgeCSSData.d.ts.map +1 -1
- package/dist/tailwind/dist/commands/generatePurgeCSSData.js +2 -5
- package/dist/tailwind/dist/commands/generatePurgeCSSData.js.map +1 -1
- package/dist/tailwind/dist/css/theme.d.cts +1 -1
- package/dist/tailwind/dist/css/theme.d.ts +1 -1
- package/dist/tailwind/dist/index.d.cts +2 -2
- package/dist/tailwind/dist/index.d.ts +2 -2
- package/dist/tailwind/dist/tailwind/utils/getShadowStyles.d.cts +4 -4
- package/dist/tailwind/dist/tailwind/utils/getShadowStyles.d.ts +4 -4
- package/dist/tailwind/dist/types/dist/index.d.cts.map +1 -1
- package/dist/tailwind/dist/types/dist/index.d.ts.map +1 -1
- package/dist/tokens/configs/borderRadius.d.cts +1 -1
- package/dist/tokens/configs/borderRadius.d.ts +1 -1
- package/dist/tokens/configs/borderWidth.d.cts +1 -1
- package/dist/tokens/configs/borderWidth.d.ts +1 -1
- package/dist/tokens/configs/font.d.cts +1 -1
- package/dist/tokens/configs/font.d.ts +1 -1
- package/dist/tokens/configs/scaleMode.d.cts +1 -1
- package/dist/tokens/configs/scaleMode.d.ts +1 -1
- package/dist/tokens/configs/shadow.d.cts +1 -1
- package/dist/tokens/configs/shadow.d.ts +1 -1
- package/dist/tokens/configs/sizes.d.cts +1 -1
- package/dist/tokens/configs/sizes.d.ts +1 -1
- package/dist/tokens/configs/typography.d.cts +1 -1
- package/dist/tokens/configs/typography.d.ts +1 -1
- package/dist/tokens/index.d.cts +2 -2
- package/dist/tokens/index.d.ts +2 -2
- package/dist/tokens/parseButtonVariants.d.cts +1 -1
- package/dist/tokens/parseButtonVariants.d.ts +1 -1
- package/dist/tokens/types.d.cts +7 -7
- package/dist/tokens/types.d.ts +7 -7
- package/dist/tokens/utils/spectrum.d.cts +1 -1
- package/dist/tokens/utils/spectrum.d.ts +1 -1
- package/dist/types/{src → dist}/index.d.cts +23 -35
- package/dist/types/{src → dist}/index.d.ts +23 -35
- package/dist/uds/generated/componentData.cjs +1641 -1661
- package/dist/uds/generated/componentData.js +1687 -1701
- package/dist/uds/generated/tailwindPurge.cjs +104 -128
- package/dist/uds/generated/tailwindPurge.js +104 -128
- package/dist/utils/isElevationAlias.d.cts +1 -1
- package/dist/utils/isElevationAlias.d.ts +1 -1
- package/generated/componentData.json +2136 -2144
- package/generated/tailwindPurge.ts +3 -3
- package/package.json +1 -1
- package/dist/components/Avatar/AvatarImage.types.cjs +0 -1
- package/dist/components/Avatar/AvatarImage.types.d.cts +0 -18
- package/dist/components/Avatar/AvatarImage.types.d.ts +0 -18
- package/dist/components/Avatar/AvatarImage.types.js +0 -1
- package/dist/components/Avatar/AvatarImageNoFallback.cjs +0 -51
- package/dist/components/Avatar/AvatarImageNoFallback.d.cts +0 -18
- package/dist/components/Avatar/AvatarImageNoFallback.d.ts +0 -18
- package/dist/components/Avatar/AvatarImageNoFallback.js +0 -49
- package/dist/components/Avatar/index.cjs +0 -10
- package/dist/components/Avatar/index.d.cts +0 -6
- package/dist/components/Avatar/index.d.ts +0 -6
- package/dist/components/Avatar/index.js +0 -6
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
2
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
require("
|
|
4
|
-
const
|
|
5
|
-
const require_components_Avatar_AvatarText = require("./AvatarText.cjs");
|
|
6
|
-
const require_components_client_Avatar_AvatarImage = require("../client/Avatar/AvatarImage.cjs");
|
|
4
|
+
require("../../../_virtual/_rolldown/runtime.cjs");
|
|
5
|
+
const require_components_client_Avatar_AvatarImage = require("./AvatarImage.cjs");
|
|
7
6
|
let react = require("react");
|
|
8
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
-
//#region src/components/Avatar/Avatar.tsx
|
|
8
|
+
//#region src/components/client/Avatar/Avatar.tsx
|
|
10
9
|
/**
|
|
11
10
|
* **👤 Avatar Component**
|
|
12
11
|
*
|
|
@@ -14,7 +13,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
14
13
|
* @usage The Avatar component should be used whenever you need to visually represent a user's identity in your application. This includes places like profile headers, user lists, chat messages, and comment sections. It's ideal for providing a consistent visual cue for users, whether by displaying a profile image, generating initials from a name, or falling back to a default icon when no image is available.
|
|
15
14
|
* @param props - Combined Avatar props.
|
|
16
15
|
* @returns The Avatar element.
|
|
17
|
-
* @componentType
|
|
16
|
+
* @componentType Client component
|
|
18
17
|
* @example ```tsx
|
|
19
18
|
* import { Avatar } from '@yahoo/uds';
|
|
20
19
|
*
|
|
@@ -27,24 +26,10 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
27
26
|
*
|
|
28
27
|
*/
|
|
29
28
|
const Avatar = (0, react.forwardRef)((props, ref) => {
|
|
30
|
-
|
|
31
|
-
if (src || srcSet) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Avatar_AvatarImage.AvatarImage, {
|
|
29
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Avatar_AvatarImage.AvatarImage, {
|
|
32
30
|
ref,
|
|
33
31
|
...props
|
|
34
32
|
});
|
|
35
|
-
if (fallback || alt) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Avatar_AvatarText.AvatarText, {
|
|
36
|
-
ref,
|
|
37
|
-
name: alt,
|
|
38
|
-
initials: fallback,
|
|
39
|
-
abbreviationStrategy,
|
|
40
|
-
slotProps: { text: slotProps?.text },
|
|
41
|
-
...restProps
|
|
42
|
-
});
|
|
43
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Avatar_AvatarIcon.AvatarIcon, {
|
|
44
|
-
ref,
|
|
45
|
-
slotProps: { icon: slotProps?.icon },
|
|
46
|
-
...restProps
|
|
47
|
-
});
|
|
48
33
|
});
|
|
49
34
|
Avatar.displayName = "Avatar";
|
|
50
35
|
//#endregion
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
import { AvatarImageProps } from "./AvatarImage.
|
|
2
|
+
import { AvatarImageProps } from "./AvatarImage.cjs";
|
|
3
3
|
import * as _$react from "react";
|
|
4
4
|
|
|
5
|
-
//#region src/components/Avatar/Avatar.d.ts
|
|
5
|
+
//#region src/components/client/Avatar/Avatar.d.ts
|
|
6
6
|
type AvatarProps = AvatarImageProps;
|
|
7
7
|
/**
|
|
8
8
|
* **👤 Avatar Component**
|
|
@@ -11,7 +11,7 @@ type AvatarProps = AvatarImageProps;
|
|
|
11
11
|
* @usage The Avatar component should be used whenever you need to visually represent a user's identity in your application. This includes places like profile headers, user lists, chat messages, and comment sections. It's ideal for providing a consistent visual cue for users, whether by displaying a profile image, generating initials from a name, or falling back to a default icon when no image is available.
|
|
12
12
|
* @param props - Combined Avatar props.
|
|
13
13
|
* @returns The Avatar element.
|
|
14
|
-
* @componentType
|
|
14
|
+
* @componentType Client component
|
|
15
15
|
* @example ```tsx
|
|
16
16
|
* import { Avatar } from '@yahoo/uds';
|
|
17
17
|
*
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
2
|
+
"use client";
|
|
3
|
+
import { AvatarImageProps } from "./AvatarImage.js";
|
|
3
4
|
import * as _$react from "react";
|
|
4
5
|
|
|
5
|
-
//#region src/components/Avatar/Avatar.d.ts
|
|
6
|
+
//#region src/components/client/Avatar/Avatar.d.ts
|
|
6
7
|
type AvatarProps = AvatarImageProps;
|
|
7
8
|
/**
|
|
8
9
|
* **👤 Avatar Component**
|
|
@@ -11,7 +12,7 @@ type AvatarProps = AvatarImageProps;
|
|
|
11
12
|
* @usage The Avatar component should be used whenever you need to visually represent a user's identity in your application. This includes places like profile headers, user lists, chat messages, and comment sections. It's ideal for providing a consistent visual cue for users, whether by displaying a profile image, generating initials from a name, or falling back to a default icon when no image is available.
|
|
12
13
|
* @param props - Combined Avatar props.
|
|
13
14
|
* @returns The Avatar element.
|
|
14
|
-
* @componentType
|
|
15
|
+
* @componentType Client component
|
|
15
16
|
* @example ```tsx
|
|
16
17
|
* import { Avatar } from '@yahoo/uds';
|
|
17
18
|
*
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import { AvatarImage } from "../client/Avatar/AvatarImage.js";
|
|
2
|
+
"use client";
|
|
3
|
+
import { AvatarImage } from "./AvatarImage.js";
|
|
5
4
|
import { forwardRef } from "react";
|
|
6
5
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
//#region src/components/Avatar/Avatar.tsx
|
|
6
|
+
//#region src/components/client/Avatar/Avatar.tsx
|
|
8
7
|
/**
|
|
9
8
|
* **👤 Avatar Component**
|
|
10
9
|
*
|
|
@@ -12,7 +11,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
12
11
|
* @usage The Avatar component should be used whenever you need to visually represent a user's identity in your application. This includes places like profile headers, user lists, chat messages, and comment sections. It's ideal for providing a consistent visual cue for users, whether by displaying a profile image, generating initials from a name, or falling back to a default icon when no image is available.
|
|
13
12
|
* @param props - Combined Avatar props.
|
|
14
13
|
* @returns The Avatar element.
|
|
15
|
-
* @componentType
|
|
14
|
+
* @componentType Client component
|
|
16
15
|
* @example ```tsx
|
|
17
16
|
* import { Avatar } from '@yahoo/uds';
|
|
18
17
|
*
|
|
@@ -25,24 +24,10 @@ import { jsx } from "react/jsx-runtime";
|
|
|
25
24
|
*
|
|
26
25
|
*/
|
|
27
26
|
const Avatar = forwardRef((props, ref) => {
|
|
28
|
-
|
|
29
|
-
if (src || srcSet) return /* @__PURE__ */ jsx(AvatarImage, {
|
|
27
|
+
return /* @__PURE__ */ jsx(AvatarImage, {
|
|
30
28
|
ref,
|
|
31
29
|
...props
|
|
32
30
|
});
|
|
33
|
-
if (fallback || alt) return /* @__PURE__ */ jsx(AvatarText, {
|
|
34
|
-
ref,
|
|
35
|
-
name: alt,
|
|
36
|
-
initials: fallback,
|
|
37
|
-
abbreviationStrategy,
|
|
38
|
-
slotProps: { text: slotProps?.text },
|
|
39
|
-
...restProps
|
|
40
|
-
});
|
|
41
|
-
return /* @__PURE__ */ jsx(AvatarIcon, {
|
|
42
|
-
ref,
|
|
43
|
-
slotProps: { icon: slotProps?.icon },
|
|
44
|
-
...restProps
|
|
45
|
-
});
|
|
46
31
|
});
|
|
47
32
|
Avatar.displayName = "Avatar";
|
|
48
33
|
//#endregion
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
2
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
require("
|
|
4
|
-
const require_styles_styler = require("
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
let react = require("react");
|
|
4
|
+
require("../../../_virtual/_rolldown/runtime.cjs");
|
|
5
|
+
const require_styles_styler = require("../../../styles/styler.cjs");
|
|
6
|
+
const require_components_IconSlot = require("../../IconSlot.cjs");
|
|
7
|
+
const require_components_Box = require("../../Box.cjs");
|
|
8
|
+
const require_components_client_Avatar_utils = require("./utils.cjs");
|
|
9
9
|
let _yahoo_uds_icons = require("@yahoo/uds-icons");
|
|
10
|
+
let react = require("react");
|
|
10
11
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
-
//#region src/components/Avatar/AvatarIcon.tsx
|
|
12
|
+
//#region src/components/client/Avatar/AvatarIcon.tsx
|
|
13
|
+
/** Maps avatar variant to icon */
|
|
12
14
|
const mapVariantToIcon = {
|
|
13
15
|
primary: _yahoo_uds_icons.Person,
|
|
14
16
|
secondary: _yahoo_uds_icons.Building
|
|
@@ -20,11 +22,10 @@ const mapVariantToIcon = {
|
|
|
20
22
|
*
|
|
21
23
|
* @param props - Props for icon variant.
|
|
22
24
|
* @returns The AvatarIcon element.
|
|
23
|
-
* @componentType Server component
|
|
24
25
|
*/
|
|
25
|
-
const AvatarIcon = (0, react.forwardRef)(({ size = "md", variant =
|
|
26
|
+
const AvatarIcon = (0, react.forwardRef)(({ size = "md", variant = require_components_client_Avatar_utils.DEFAULT_AVATAR_VARIANT, customSize, icon, slotProps, className, ...props }, ref) => {
|
|
26
27
|
const classNames = (0, react.useMemo)(() => ({
|
|
27
|
-
root:
|
|
28
|
+
root: require_components_client_Avatar_utils.buildAvatarRootClasses(size, {
|
|
28
29
|
avatarIconVariantRoot: variant,
|
|
29
30
|
overflow: "hidden",
|
|
30
31
|
className: require_styles_styler.cx("overflow-hidden", className)
|
|
@@ -36,7 +37,7 @@ const AvatarIcon = (0, react.forwardRef)(({ size = "md", variant = require_compo
|
|
|
36
37
|
size,
|
|
37
38
|
variant
|
|
38
39
|
]);
|
|
39
|
-
const inlineStyles = (0, react.useMemo)(() =>
|
|
40
|
+
const inlineStyles = (0, react.useMemo)(() => require_components_client_Avatar_utils.buildInlineSizeStyles(customSize), [customSize]);
|
|
40
41
|
const iconSvg = icon ?? mapVariantToIcon[variant ?? "primary"];
|
|
41
42
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Box.Box, {
|
|
42
43
|
ref,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
import { UniversalAvatarIconProps } from "
|
|
3
|
-
import { IconPropsWithSVGProps } from "
|
|
2
|
+
import { UniversalAvatarIconProps } from "../../../types/dist/index.cjs";
|
|
3
|
+
import { IconPropsWithSVGProps } from "../../../tokens/types.cjs";
|
|
4
4
|
import * as _$react from "react";
|
|
5
5
|
|
|
6
|
-
//#region src/components/Avatar/AvatarIcon.d.ts
|
|
6
|
+
//#region src/components/client/Avatar/AvatarIcon.d.ts
|
|
7
7
|
type DataAttributes = {
|
|
8
8
|
[name: `data-${string}`]: string;
|
|
9
9
|
};
|
|
@@ -20,7 +20,6 @@ interface AvatarIconProps extends UniversalAvatarIconProps {
|
|
|
20
20
|
*
|
|
21
21
|
* @param props - Props for icon variant.
|
|
22
22
|
* @returns The AvatarIcon element.
|
|
23
|
-
* @componentType Server component
|
|
24
23
|
*/
|
|
25
24
|
declare const AvatarIcon: _$react.ForwardRefExoticComponent<AvatarIconProps & _$react.RefAttributes<HTMLDivElement>>;
|
|
26
25
|
//#endregion
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
import {
|
|
2
|
+
"use client";
|
|
3
|
+
import { UniversalAvatarIconProps } from "../../../types/dist/index.js";
|
|
4
|
+
import { IconPropsWithSVGProps } from "../../../tokens/types.js";
|
|
4
5
|
import * as _$react from "react";
|
|
5
6
|
|
|
6
|
-
//#region src/components/Avatar/AvatarIcon.d.ts
|
|
7
|
+
//#region src/components/client/Avatar/AvatarIcon.d.ts
|
|
7
8
|
type DataAttributes = {
|
|
8
9
|
[name: `data-${string}`]: string;
|
|
9
10
|
};
|
|
@@ -20,7 +21,6 @@ interface AvatarIconProps extends UniversalAvatarIconProps {
|
|
|
20
21
|
*
|
|
21
22
|
* @param props - Props for icon variant.
|
|
22
23
|
* @returns The AvatarIcon element.
|
|
23
|
-
* @componentType Server component
|
|
24
24
|
*/
|
|
25
25
|
declare const AvatarIcon: _$react.ForwardRefExoticComponent<AvatarIconProps & _$react.RefAttributes<HTMLDivElement>>;
|
|
26
26
|
//#endregion
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import { IconSlot } from "
|
|
2
|
+
"use client";
|
|
3
|
+
import { cx, getStyles } from "../../../styles/styler.js";
|
|
4
|
+
import { IconSlot } from "../../IconSlot.js";
|
|
5
|
+
import { Box } from "../../Box.js";
|
|
5
6
|
import { DEFAULT_AVATAR_VARIANT, buildAvatarRootClasses, buildInlineSizeStyles } from "./utils.js";
|
|
6
|
-
import { forwardRef, useMemo } from "react";
|
|
7
7
|
import { Building, Person } from "@yahoo/uds-icons";
|
|
8
|
+
import { forwardRef, useMemo } from "react";
|
|
8
9
|
import { jsx } from "react/jsx-runtime";
|
|
9
|
-
//#region src/components/Avatar/AvatarIcon.tsx
|
|
10
|
+
//#region src/components/client/Avatar/AvatarIcon.tsx
|
|
11
|
+
/** Maps avatar variant to icon */
|
|
10
12
|
const mapVariantToIcon = {
|
|
11
13
|
primary: Person,
|
|
12
14
|
secondary: Building
|
|
@@ -18,7 +20,6 @@ const mapVariantToIcon = {
|
|
|
18
20
|
*
|
|
19
21
|
* @param props - Props for icon variant.
|
|
20
22
|
* @returns The AvatarIcon element.
|
|
21
|
-
* @componentType Server component
|
|
22
23
|
*/
|
|
23
24
|
const AvatarIcon = forwardRef(({ size = "md", variant = DEFAULT_AVATAR_VARIANT, customSize, icon, slotProps, className, ...props }, ref) => {
|
|
24
25
|
const classNames = useMemo(() => ({
|
|
@@ -2,68 +2,89 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
require("../../../_virtual/_rolldown/runtime.cjs");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
5
|
+
const require_styles_styler = require("../../../styles/styler.cjs");
|
|
6
|
+
const require_components_Box = require("../../Box.cjs");
|
|
7
|
+
const require_components_Image = require("../../Image.cjs");
|
|
8
|
+
const require_components_client_Avatar_utils = require("./utils.cjs");
|
|
9
|
+
const require_components_client_Avatar_AvatarIcon = require("./AvatarIcon.cjs");
|
|
10
|
+
const require_components_client_Avatar_AvatarText = require("./AvatarText.cjs");
|
|
8
11
|
let react = require("react");
|
|
9
12
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
13
|
//#region src/components/client/Avatar/AvatarImage.tsx
|
|
11
14
|
/**
|
|
12
15
|
* **AvatarImage Component**
|
|
13
16
|
*
|
|
14
|
-
* Renders an Avatar with an image.
|
|
17
|
+
* Renders an Avatar with an image. If the image fails to load, it falls back first to
|
|
18
|
+
* a text representation (if a name or initials are provided) and then to an icon.
|
|
15
19
|
*
|
|
16
20
|
* @param props - Props for image variant.
|
|
17
21
|
* @returns The AvatarImage element.
|
|
18
22
|
*/
|
|
19
|
-
const AvatarImage = (0, react.forwardRef)((props, ref) => {
|
|
20
|
-
const
|
|
21
|
-
const hasImageSource = Boolean(src || srcSet);
|
|
22
|
-
const imageSourceKey = `${src ?? ""}::${srcSet ?? ""}`;
|
|
23
|
-
const [resolvedImageState, setResolvedImageState] = (0, react.useState)(null);
|
|
23
|
+
const AvatarImage = (0, react.forwardRef)(({ size = "md", variant = require_components_client_Avatar_utils.DEFAULT_AVATAR_VARIANT, src, srcSet, customSize, alt, abbreviationStrategy, fallback, className, imageProps, slotProps, ...props }, ref) => {
|
|
24
|
+
const [loadingState, setLoadingState] = (0, react.useState)("loading");
|
|
24
25
|
(0, react.useEffect)(() => {
|
|
25
|
-
if (!hasImageSource) return;
|
|
26
26
|
let mounted = true;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
if (src) img.src = src;
|
|
41
|
-
if (srcSet) img.srcset = srcSet;
|
|
27
|
+
if (src || srcSet) {
|
|
28
|
+
const img = new Image();
|
|
29
|
+
img.onload = () => {
|
|
30
|
+
if (mounted) setLoadingState("loaded");
|
|
31
|
+
};
|
|
32
|
+
img.onerror = () => {
|
|
33
|
+
if (mounted) setLoadingState("error");
|
|
34
|
+
};
|
|
35
|
+
if (src) img.src = src;
|
|
36
|
+
if (srcSet) img.srcset = srcSet;
|
|
37
|
+
} else setLoadingState("error");
|
|
42
38
|
return () => {
|
|
43
39
|
mounted = false;
|
|
44
40
|
};
|
|
45
|
-
}, [
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
}, [src, srcSet]);
|
|
42
|
+
const classNames = (0, react.useMemo)(() => ({
|
|
43
|
+
root: require_components_client_Avatar_utils.buildAvatarRootClasses(size, {
|
|
44
|
+
avatarImageVariantRoot: variant,
|
|
45
|
+
className: require_styles_styler.cx("overflow-hidden", className)
|
|
46
|
+
}),
|
|
47
|
+
contents: require_styles_styler.cx("w-full", "h-full", "shrink-0", "text-center", "inline-flex", "justify-center", "items-center", "object-cover")
|
|
48
|
+
}), [
|
|
49
|
+
className,
|
|
50
|
+
size,
|
|
51
|
+
variant
|
|
50
52
|
]);
|
|
51
|
-
|
|
53
|
+
const inlineStyles = (0, react.useMemo)(() => require_components_client_Avatar_utils.buildInlineSizeStyles(customSize), [customSize]);
|
|
54
|
+
if (loadingState === "loaded") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Box.Box, {
|
|
52
55
|
ref,
|
|
53
|
-
|
|
56
|
+
className: classNames.root,
|
|
57
|
+
style: inlineStyles.root,
|
|
58
|
+
...props,
|
|
59
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Image.Image, {
|
|
60
|
+
src,
|
|
61
|
+
srcSet,
|
|
62
|
+
alt,
|
|
63
|
+
className: classNames.contents,
|
|
64
|
+
style: inlineStyles.contents,
|
|
65
|
+
...imageProps,
|
|
66
|
+
...slotProps?.image
|
|
67
|
+
})
|
|
54
68
|
});
|
|
55
|
-
|
|
69
|
+
const sharedProps = {
|
|
70
|
+
...props,
|
|
71
|
+
className,
|
|
72
|
+
size,
|
|
73
|
+
customSize,
|
|
74
|
+
variant
|
|
75
|
+
};
|
|
76
|
+
if (fallback || alt) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Avatar_AvatarText.AvatarText, {
|
|
56
77
|
ref,
|
|
57
78
|
name: alt,
|
|
58
79
|
initials: fallback,
|
|
59
80
|
abbreviationStrategy,
|
|
60
81
|
slotProps: { text: slotProps?.text },
|
|
61
|
-
...
|
|
82
|
+
...sharedProps
|
|
62
83
|
});
|
|
63
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
84
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Avatar_AvatarIcon.AvatarIcon, {
|
|
64
85
|
ref,
|
|
65
|
-
|
|
66
|
-
|
|
86
|
+
...sharedProps,
|
|
87
|
+
slotProps: { icon: slotProps?.icon }
|
|
67
88
|
});
|
|
68
89
|
});
|
|
69
90
|
AvatarImage.displayName = "AvatarImage";
|
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { ImagePropsWithImgProps } from "../../../types/dist/index.cjs";
|
|
3
|
+
import { UniversalAvatarImageProps } from "../../../tokens/types.cjs";
|
|
4
|
+
import { AvatarIconProps } from "./AvatarIcon.cjs";
|
|
5
|
+
import { AvatarTextProps } from "./AvatarText.cjs";
|
|
3
6
|
import * as _$react from "react";
|
|
4
7
|
|
|
5
8
|
//#region src/components/client/Avatar/AvatarImage.d.ts
|
|
9
|
+
type DataAttributes = {
|
|
10
|
+
[name: `data-${string}`]: string;
|
|
11
|
+
};
|
|
12
|
+
interface AvatarImageProps extends UniversalAvatarImageProps {
|
|
13
|
+
/** Props to be passed into various slots within the component. */
|
|
14
|
+
slotProps?: {
|
|
15
|
+
image?: Partial<Omit<ImagePropsWithImgProps, 'src' | 'srcSet' | 'alt' | 'className' | 'height' | 'width'> & DataAttributes>;
|
|
16
|
+
} & AvatarIconProps['slotProps'] & AvatarTextProps['slotProps'];
|
|
17
|
+
}
|
|
6
18
|
/**
|
|
7
19
|
* **AvatarImage Component**
|
|
8
20
|
*
|
|
9
|
-
* Renders an Avatar with an image.
|
|
21
|
+
* Renders an Avatar with an image. If the image fails to load, it falls back first to
|
|
22
|
+
* a text representation (if a name or initials are provided) and then to an icon.
|
|
10
23
|
*
|
|
11
24
|
* @param props - Props for image variant.
|
|
12
25
|
* @returns The AvatarImage element.
|
|
@@ -1,13 +1,26 @@
|
|
|
1
1
|
|
|
2
2
|
"use client";
|
|
3
|
-
import {
|
|
3
|
+
import { ImagePropsWithImgProps } from "../../../types/dist/index.js";
|
|
4
|
+
import { UniversalAvatarImageProps } from "../../../tokens/types.js";
|
|
5
|
+
import { AvatarIconProps } from "./AvatarIcon.js";
|
|
6
|
+
import { AvatarTextProps } from "./AvatarText.js";
|
|
4
7
|
import * as _$react from "react";
|
|
5
8
|
|
|
6
9
|
//#region src/components/client/Avatar/AvatarImage.d.ts
|
|
10
|
+
type DataAttributes = {
|
|
11
|
+
[name: `data-${string}`]: string;
|
|
12
|
+
};
|
|
13
|
+
interface AvatarImageProps extends UniversalAvatarImageProps {
|
|
14
|
+
/** Props to be passed into various slots within the component. */
|
|
15
|
+
slotProps?: {
|
|
16
|
+
image?: Partial<Omit<ImagePropsWithImgProps, 'src' | 'srcSet' | 'alt' | 'className' | 'height' | 'width'> & DataAttributes>;
|
|
17
|
+
} & AvatarIconProps['slotProps'] & AvatarTextProps['slotProps'];
|
|
18
|
+
}
|
|
7
19
|
/**
|
|
8
20
|
* **AvatarImage Component**
|
|
9
21
|
*
|
|
10
|
-
* Renders an Avatar with an image.
|
|
22
|
+
* Renders an Avatar with an image. If the image fails to load, it falls back first to
|
|
23
|
+
* a text representation (if a name or initials are provided) and then to an icon.
|
|
11
24
|
*
|
|
12
25
|
* @param props - Props for image variant.
|
|
13
26
|
* @returns The AvatarImage element.
|
|
@@ -1,67 +1,88 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
"use client";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { cx } from "../../../styles/styler.js";
|
|
4
|
+
import { Box } from "../../Box.js";
|
|
5
|
+
import { Image as Image$1 } from "../../Image.js";
|
|
6
|
+
import { DEFAULT_AVATAR_VARIANT, buildAvatarRootClasses, buildInlineSizeStyles } from "./utils.js";
|
|
7
|
+
import { AvatarIcon } from "./AvatarIcon.js";
|
|
8
|
+
import { AvatarText } from "./AvatarText.js";
|
|
9
|
+
import { forwardRef, useEffect, useMemo, useState } from "react";
|
|
7
10
|
import { jsx } from "react/jsx-runtime";
|
|
8
11
|
//#region src/components/client/Avatar/AvatarImage.tsx
|
|
9
12
|
/**
|
|
10
13
|
* **AvatarImage Component**
|
|
11
14
|
*
|
|
12
|
-
* Renders an Avatar with an image.
|
|
15
|
+
* Renders an Avatar with an image. If the image fails to load, it falls back first to
|
|
16
|
+
* a text representation (if a name or initials are provided) and then to an icon.
|
|
13
17
|
*
|
|
14
18
|
* @param props - Props for image variant.
|
|
15
19
|
* @returns The AvatarImage element.
|
|
16
20
|
*/
|
|
17
|
-
const AvatarImage = forwardRef((props, ref) => {
|
|
18
|
-
const
|
|
19
|
-
const hasImageSource = Boolean(src || srcSet);
|
|
20
|
-
const imageSourceKey = `${src ?? ""}::${srcSet ?? ""}`;
|
|
21
|
-
const [resolvedImageState, setResolvedImageState] = useState(null);
|
|
21
|
+
const AvatarImage = forwardRef(({ size = "md", variant = DEFAULT_AVATAR_VARIANT, src, srcSet, customSize, alt, abbreviationStrategy, fallback, className, imageProps, slotProps, ...props }, ref) => {
|
|
22
|
+
const [loadingState, setLoadingState] = useState("loading");
|
|
22
23
|
useEffect(() => {
|
|
23
|
-
if (!hasImageSource) return;
|
|
24
24
|
let mounted = true;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
if (src) img.src = src;
|
|
39
|
-
if (srcSet) img.srcset = srcSet;
|
|
25
|
+
if (src || srcSet) {
|
|
26
|
+
const img = new Image();
|
|
27
|
+
img.onload = () => {
|
|
28
|
+
if (mounted) setLoadingState("loaded");
|
|
29
|
+
};
|
|
30
|
+
img.onerror = () => {
|
|
31
|
+
if (mounted) setLoadingState("error");
|
|
32
|
+
};
|
|
33
|
+
if (src) img.src = src;
|
|
34
|
+
if (srcSet) img.srcset = srcSet;
|
|
35
|
+
} else setLoadingState("error");
|
|
40
36
|
return () => {
|
|
41
37
|
mounted = false;
|
|
42
38
|
};
|
|
43
|
-
}, [
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
}, [src, srcSet]);
|
|
40
|
+
const classNames = useMemo(() => ({
|
|
41
|
+
root: buildAvatarRootClasses(size, {
|
|
42
|
+
avatarImageVariantRoot: variant,
|
|
43
|
+
className: cx("overflow-hidden", className)
|
|
44
|
+
}),
|
|
45
|
+
contents: cx("w-full", "h-full", "shrink-0", "text-center", "inline-flex", "justify-center", "items-center", "object-cover")
|
|
46
|
+
}), [
|
|
47
|
+
className,
|
|
48
|
+
size,
|
|
49
|
+
variant
|
|
48
50
|
]);
|
|
49
|
-
|
|
51
|
+
const inlineStyles = useMemo(() => buildInlineSizeStyles(customSize), [customSize]);
|
|
52
|
+
if (loadingState === "loaded") return /* @__PURE__ */ jsx(Box, {
|
|
50
53
|
ref,
|
|
51
|
-
|
|
54
|
+
className: classNames.root,
|
|
55
|
+
style: inlineStyles.root,
|
|
56
|
+
...props,
|
|
57
|
+
children: /* @__PURE__ */ jsx(Image$1, {
|
|
58
|
+
src,
|
|
59
|
+
srcSet,
|
|
60
|
+
alt,
|
|
61
|
+
className: classNames.contents,
|
|
62
|
+
style: inlineStyles.contents,
|
|
63
|
+
...imageProps,
|
|
64
|
+
...slotProps?.image
|
|
65
|
+
})
|
|
52
66
|
});
|
|
67
|
+
const sharedProps = {
|
|
68
|
+
...props,
|
|
69
|
+
className,
|
|
70
|
+
size,
|
|
71
|
+
customSize,
|
|
72
|
+
variant
|
|
73
|
+
};
|
|
53
74
|
if (fallback || alt) return /* @__PURE__ */ jsx(AvatarText, {
|
|
54
75
|
ref,
|
|
55
76
|
name: alt,
|
|
56
77
|
initials: fallback,
|
|
57
78
|
abbreviationStrategy,
|
|
58
79
|
slotProps: { text: slotProps?.text },
|
|
59
|
-
...
|
|
80
|
+
...sharedProps
|
|
60
81
|
});
|
|
61
82
|
return /* @__PURE__ */ jsx(AvatarIcon, {
|
|
62
83
|
ref,
|
|
63
|
-
|
|
64
|
-
|
|
84
|
+
...sharedProps,
|
|
85
|
+
slotProps: { icon: slotProps?.icon }
|
|
65
86
|
});
|
|
66
87
|
});
|
|
67
88
|
AvatarImage.displayName = "AvatarImage";
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
2
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
require("
|
|
4
|
-
const require_styles_styler = require("
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
4
|
+
require("../../../_virtual/_rolldown/runtime.cjs");
|
|
5
|
+
const require_styles_styler = require("../../../styles/styler.cjs");
|
|
6
|
+
const require_components_Text = require("../../Text.cjs");
|
|
7
|
+
const require_components_Box = require("../../Box.cjs");
|
|
8
|
+
const require_components_client_Avatar_utils = require("./utils.cjs");
|
|
8
9
|
let react = require("react");
|
|
9
10
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
-
//#region src/components/Avatar/AvatarText.tsx
|
|
11
|
+
//#region src/components/client/Avatar/AvatarText.tsx
|
|
11
12
|
/**
|
|
12
13
|
* **AvatarText Component**
|
|
13
14
|
*
|
|
@@ -15,11 +16,10 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
15
16
|
*
|
|
16
17
|
* @param props - Props for text variant.
|
|
17
18
|
* @returns The AvatarText element.
|
|
18
|
-
* @componentType Server component
|
|
19
19
|
*/
|
|
20
|
-
const AvatarText = (0, react.forwardRef)(({ size = "md", variant =
|
|
20
|
+
const AvatarText = (0, react.forwardRef)(({ size = "md", variant = require_components_client_Avatar_utils.DEFAULT_AVATAR_VARIANT, name, initials, customSize, abbreviationStrategy, className, slotProps, ...props }, ref) => {
|
|
21
21
|
const classNames = (0, react.useMemo)(() => ({
|
|
22
|
-
root:
|
|
22
|
+
root: require_components_client_Avatar_utils.buildAvatarRootClasses(size, {
|
|
23
23
|
avatarTextVariantRoot: variant,
|
|
24
24
|
className: require_styles_styler.cx("overflow-hidden", "truncate", className)
|
|
25
25
|
}),
|
|
@@ -29,7 +29,7 @@ const AvatarText = (0, react.forwardRef)(({ size = "md", variant = require_compo
|
|
|
29
29
|
size,
|
|
30
30
|
variant
|
|
31
31
|
]);
|
|
32
|
-
const inlineStyles = (0, react.useMemo)(() =>
|
|
32
|
+
const inlineStyles = (0, react.useMemo)(() => require_components_client_Avatar_utils.buildInlineSizeStyles(customSize), [customSize]);
|
|
33
33
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Box.Box, {
|
|
34
34
|
ref,
|
|
35
35
|
className: classNames.root,
|
|
@@ -41,7 +41,7 @@ const AvatarText = (0, react.forwardRef)(({ size = "md", variant = require_compo
|
|
|
41
41
|
className: classNames.text,
|
|
42
42
|
style: inlineStyles.contents,
|
|
43
43
|
...slotProps?.text,
|
|
44
|
-
children: initials ||
|
|
44
|
+
children: initials || require_components_client_Avatar_utils.generateAvatarAbbreviation(name, abbreviationStrategy)
|
|
45
45
|
})
|
|
46
46
|
});
|
|
47
47
|
});
|