@yahoo/uds-mobile 2.14.0 → 2.16.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/README.md +27 -24
- package/dist/components/Avatar/Avatar.cjs +45 -0
- package/dist/components/Avatar/Avatar.d.cts +19 -0
- package/dist/components/Avatar/Avatar.d.cts.map +1 -0
- package/dist/components/Avatar/Avatar.d.ts +19 -0
- package/dist/components/Avatar/Avatar.d.ts.map +1 -0
- package/dist/components/Avatar/Avatar.js +45 -0
- package/dist/components/Avatar/Avatar.js.map +1 -0
- package/dist/components/Avatar/AvatarIcon.cjs +47 -0
- package/dist/components/Avatar/AvatarIcon.d.cts +9 -0
- package/dist/components/Avatar/AvatarIcon.d.cts.map +1 -0
- package/dist/components/Avatar/AvatarIcon.d.ts +9 -0
- package/dist/components/Avatar/AvatarIcon.d.ts.map +1 -0
- package/dist/components/Avatar/AvatarIcon.js +47 -0
- package/dist/components/Avatar/AvatarIcon.js.map +1 -0
- package/dist/components/Avatar/AvatarImage.cjs +81 -0
- package/dist/components/Avatar/AvatarImage.d.cts +9 -0
- package/dist/components/Avatar/AvatarImage.d.cts.map +1 -0
- package/dist/components/Avatar/AvatarImage.d.ts +9 -0
- package/dist/components/Avatar/AvatarImage.d.ts.map +1 -0
- package/dist/components/Avatar/AvatarImage.js +81 -0
- package/dist/components/Avatar/AvatarImage.js.map +1 -0
- package/dist/components/Avatar/AvatarText.cjs +49 -0
- package/dist/components/Avatar/AvatarText.d.cts +9 -0
- package/dist/components/Avatar/AvatarText.d.cts.map +1 -0
- package/dist/components/Avatar/AvatarText.d.ts +9 -0
- package/dist/components/Avatar/AvatarText.d.ts.map +1 -0
- package/dist/components/Avatar/AvatarText.js +49 -0
- package/dist/components/Avatar/AvatarText.js.map +1 -0
- package/dist/components/Avatar/index.cjs +10 -0
- package/dist/components/Avatar/index.d.cts +7 -0
- package/dist/components/Avatar/index.d.ts +7 -0
- package/dist/components/Avatar/index.js +6 -0
- package/dist/components/Avatar/types.cjs +1 -0
- package/dist/components/Avatar/types.d.cts +28 -0
- package/dist/components/Avatar/types.d.cts.map +1 -0
- package/dist/components/Avatar/types.d.ts +28 -0
- package/dist/components/Avatar/types.d.ts.map +1 -0
- package/dist/components/Avatar/types.js +1 -0
- package/dist/components/Avatar/utils.cjs +38 -0
- package/dist/components/Avatar/utils.d.cts +14 -0
- package/dist/components/Avatar/utils.d.cts.map +1 -0
- package/dist/components/Avatar/utils.d.ts +14 -0
- package/dist/components/Avatar/utils.d.ts.map +1 -0
- package/dist/components/Avatar/utils.js +35 -0
- package/dist/components/Avatar/utils.js.map +1 -0
- package/dist/components/Badge.cjs +1 -1
- package/dist/components/Badge.js +1 -1
- package/dist/components/Chip/Chip.cjs +54 -0
- package/dist/components/Chip/Chip.d.cts +19 -0
- package/dist/components/Chip/Chip.d.cts.map +1 -0
- package/dist/components/Chip/Chip.d.ts +19 -0
- package/dist/components/Chip/Chip.d.ts.map +1 -0
- package/dist/components/Chip/Chip.js +54 -0
- package/dist/components/Chip/Chip.js.map +1 -0
- package/dist/components/Chip/ChipBase.cjs +119 -0
- package/dist/components/Chip/ChipBase.d.cts +13 -0
- package/dist/components/Chip/ChipBase.d.cts.map +1 -0
- package/dist/components/Chip/ChipBase.d.ts +13 -0
- package/dist/components/Chip/ChipBase.d.ts.map +1 -0
- package/dist/components/Chip/ChipBase.js +116 -0
- package/dist/components/Chip/ChipBase.js.map +1 -0
- package/dist/components/Chip/ChipButton.cjs +18 -0
- package/dist/components/Chip/ChipButton.d.cts +9 -0
- package/dist/components/Chip/ChipButton.d.cts.map +1 -0
- package/dist/components/Chip/ChipButton.d.ts +9 -0
- package/dist/components/Chip/ChipButton.d.ts.map +1 -0
- package/dist/components/Chip/ChipButton.js +18 -0
- package/dist/components/Chip/ChipButton.js.map +1 -0
- package/dist/components/Chip/ChipDismissible.cjs +49 -0
- package/dist/components/Chip/ChipDismissible.d.cts +9 -0
- package/dist/components/Chip/ChipDismissible.d.cts.map +1 -0
- package/dist/components/Chip/ChipDismissible.d.ts +9 -0
- package/dist/components/Chip/ChipDismissible.d.ts.map +1 -0
- package/dist/components/Chip/ChipDismissible.js +49 -0
- package/dist/components/Chip/ChipDismissible.js.map +1 -0
- package/dist/components/Chip/ChipToggle.cjs +32 -0
- package/dist/components/Chip/ChipToggle.d.cts +9 -0
- package/dist/components/Chip/ChipToggle.d.cts.map +1 -0
- package/dist/components/Chip/ChipToggle.d.ts +9 -0
- package/dist/components/Chip/ChipToggle.d.ts.map +1 -0
- package/dist/components/Chip/ChipToggle.js +32 -0
- package/dist/components/Chip/ChipToggle.js.map +1 -0
- package/dist/components/Chip/chipTheme.cjs +23 -0
- package/dist/components/Chip/chipTheme.d.cts +14 -0
- package/dist/components/Chip/chipTheme.d.cts.map +1 -0
- package/dist/components/Chip/chipTheme.d.ts +14 -0
- package/dist/components/Chip/chipTheme.d.ts.map +1 -0
- package/dist/components/Chip/chipTheme.js +24 -0
- package/dist/components/Chip/chipTheme.js.map +1 -0
- package/dist/components/Chip/index.cjs +10 -0
- package/dist/components/Chip/index.d.cts +7 -0
- package/dist/components/Chip/index.d.ts +7 -0
- package/dist/components/Chip/index.js +6 -0
- package/dist/components/Chip/types.cjs +1 -0
- package/dist/components/Chip/types.d.cts +76 -0
- package/dist/components/Chip/types.d.cts.map +1 -0
- package/dist/components/Chip/types.d.ts +76 -0
- package/dist/components/Chip/types.d.ts.map +1 -0
- package/dist/components/Chip/types.js +1 -0
- package/dist/components/Input.cjs +17 -14
- package/dist/components/Input.d.cts.map +1 -1
- package/dist/components/Input.d.ts.map +1 -1
- package/dist/components/Input.js +17 -14
- package/dist/components/Input.js.map +1 -1
- package/dist/components/InputHelpText.cjs +52 -0
- package/dist/components/InputHelpText.d.cts +37 -0
- package/dist/components/InputHelpText.d.cts.map +1 -0
- package/dist/components/InputHelpText.d.ts +37 -0
- package/dist/components/InputHelpText.d.ts.map +1 -0
- package/dist/components/InputHelpText.js +52 -0
- package/dist/components/InputHelpText.js.map +1 -0
- package/dist/components/internal/Overlay/OverlayPortal.cjs +20 -0
- package/dist/components/internal/Overlay/OverlayPortal.d.cts +17 -0
- package/dist/components/internal/Overlay/OverlayPortal.d.cts.map +1 -0
- package/dist/components/internal/Overlay/OverlayPortal.d.ts +17 -0
- package/dist/components/internal/Overlay/OverlayPortal.d.ts.map +1 -0
- package/dist/components/internal/Overlay/OverlayPortal.js +20 -0
- package/dist/components/internal/Overlay/OverlayPortal.js.map +1 -0
- package/dist/components/internal/Overlay/index.cjs +6 -0
- package/dist/components/internal/Overlay/index.d.cts +5 -0
- package/dist/components/internal/Overlay/index.d.ts +5 -0
- package/dist/components/internal/Overlay/index.js +4 -0
- package/dist/components/internal/Overlay/types.cjs +1 -0
- package/dist/components/internal/Overlay/types.d.cts +21 -0
- package/dist/components/internal/Overlay/types.d.cts.map +1 -0
- package/dist/components/internal/Overlay/types.d.ts +21 -0
- package/dist/components/internal/Overlay/types.d.ts.map +1 -0
- package/dist/components/internal/Overlay/types.js +1 -0
- package/dist/components/internal/Overlay/useControllableState.cjs +34 -0
- package/dist/components/internal/Overlay/useControllableState.d.cts +18 -0
- package/dist/components/internal/Overlay/useControllableState.d.cts.map +1 -0
- package/dist/components/internal/Overlay/useControllableState.d.ts +18 -0
- package/dist/components/internal/Overlay/useControllableState.d.ts.map +1 -0
- package/dist/components/internal/Overlay/useControllableState.js +34 -0
- package/dist/components/internal/Overlay/useControllableState.js.map +1 -0
- package/dist/portal.cjs +1 -0
- package/dist/portal.d.cts +6 -1
- package/dist/portal.d.cts.map +1 -1
- package/dist/portal.d.ts +6 -1
- package/dist/portal.d.ts.map +1 -1
- package/dist/portal.js +1 -1
- package/dist/portal.js.map +1 -1
- package/dist/types/dist/index.d.cts +36 -1
- package/dist/types/dist/index.d.cts.map +1 -1
- package/dist/types/dist/index.d.ts +36 -1
- package/dist/types/dist/index.d.ts.map +1 -1
- package/fonts/index.cjs +219 -219
- package/fonts/index.mjs +219 -219
- package/generated/styles.cjs +114 -0
- package/generated/styles.d.ts +29 -0
- package/generated/styles.mjs +114 -0
- package/generated/unistyles.d.ts +110 -0
- package/package.json +19 -9
- package/dist/components/Avatar.cjs +0 -116
- package/dist/components/Avatar.d.cts +0 -68
- package/dist/components/Avatar.d.cts.map +0 -1
- package/dist/components/Avatar.d.ts +0 -68
- package/dist/components/Avatar.d.ts.map +0 -1
- package/dist/components/Avatar.js +0 -116
- package/dist/components/Avatar.js.map +0 -1
- package/dist/components/Chip.cjs +0 -139
- package/dist/components/Chip.d.cts +0 -82
- package/dist/components/Chip.d.cts.map +0 -1
- package/dist/components/Chip.d.ts +0 -82
- package/dist/components/Chip.d.ts.map +0 -1
- package/dist/components/Chip.js +0 -139
- package/dist/components/Chip.js.map +0 -1
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
`@yahoo/uds-mobile` brings UDS to React Native. It provides:
|
|
19
19
|
|
|
20
|
-
- **Pre-built Components**: Avatar, Badge, Button, Checkbox, Chip, Divider, Icon, IconButton, Image, Input, Link, Radio, RadioGroup, Switch, Tabs, Text, and layout primitives (Box, VStack, HStack, Screen)
|
|
20
|
+
- **Pre-built Components**: Avatar, Badge, Button, Checkbox, Chip, Divider, Icon, IconButton, Image, Input, InputHelpText, Link, Radio, RadioGroup, Switch, Tabs, Text, and layout primitives (Box, VStack, HStack, Screen)
|
|
21
21
|
- **Theming**: Full light/dark mode support with automatic system preference detection
|
|
22
22
|
- **Design Token Integration**: Colors, typography, spacing, and motion configs synced from UDS tokens
|
|
23
23
|
- **Animations**: Smooth, physics-based animations using Reanimated with motion parity to web
|
|
@@ -319,29 +319,30 @@ const styles = StyleSheet.create((theme) => ({
|
|
|
319
319
|
|
|
320
320
|
### Available Components
|
|
321
321
|
|
|
322
|
-
| Component
|
|
323
|
-
|
|
|
324
|
-
| `Avatar`
|
|
325
|
-
| `Badge`
|
|
326
|
-
| `Box`
|
|
327
|
-
| `Button`
|
|
328
|
-
| `Checkbox`
|
|
329
|
-
| `Chip`
|
|
330
|
-
| `Divider`
|
|
331
|
-
| `HStack`
|
|
332
|
-
| `Icon`
|
|
333
|
-
| `IconButton`
|
|
334
|
-
| `IconSlot`
|
|
335
|
-
| `Image`
|
|
336
|
-
| `Input`
|
|
337
|
-
| `
|
|
338
|
-
| `
|
|
339
|
-
| `
|
|
340
|
-
| `
|
|
341
|
-
| `
|
|
342
|
-
| `
|
|
343
|
-
| `
|
|
344
|
-
| `
|
|
322
|
+
| Component | Description |
|
|
323
|
+
| --------------- | ----------------------------------------------- |
|
|
324
|
+
| `Avatar` | User avatars with image, initials, or icon |
|
|
325
|
+
| `Badge` | Status indicators and labels |
|
|
326
|
+
| `Box` | Flexible container with layout props |
|
|
327
|
+
| `Button` | Interactive button with variants and animations |
|
|
328
|
+
| `Checkbox` | Selectable checkbox with label |
|
|
329
|
+
| `Chip` | Compact elements for filters and selections |
|
|
330
|
+
| `Divider` | Visual separator for grouping content |
|
|
331
|
+
| `HStack` | Horizontal flex container |
|
|
332
|
+
| `Icon` | Icon rendering (font or SVG) |
|
|
333
|
+
| `IconButton` | Icon-only button |
|
|
334
|
+
| `IconSlot` | Flexible icon slot for component composition |
|
|
335
|
+
| `Image` | Image component with loading states |
|
|
336
|
+
| `Input` | Text input with label and helper text |
|
|
337
|
+
| `InputHelpText` | Helper text for custom input layouts |
|
|
338
|
+
| `Link` | Inline text links with icons |
|
|
339
|
+
| `Pressable` | Base pressable component |
|
|
340
|
+
| `Radio` | Radio button with label |
|
|
341
|
+
| `RadioGroup` | Coordinates Radio selection in a group |
|
|
342
|
+
| `Screen` | Screen container with safe area handling |
|
|
343
|
+
| `Switch` | Toggle switch with animations |
|
|
344
|
+
| `Text` | Typography component with variants |
|
|
345
|
+
| `VStack` | Vertical flex container |
|
|
345
346
|
|
|
346
347
|
### Usage Examples
|
|
347
348
|
|
|
@@ -668,6 +669,7 @@ import type { IconProps, IconName } from '@yahoo/uds-mobile/Icon';
|
|
|
668
669
|
import type { IconButtonProps } from '@yahoo/uds-mobile/IconButton';
|
|
669
670
|
import type { ImageProps } from '@yahoo/uds-mobile/Image';
|
|
670
671
|
import type { InputProps } from '@yahoo/uds-mobile/Input';
|
|
672
|
+
import type { InputHelpTextProps } from '@yahoo/uds-mobile/InputHelpText';
|
|
671
673
|
import type { LinkProps } from '@yahoo/uds-mobile/Link';
|
|
672
674
|
import type { RadioProps } from '@yahoo/uds-mobile/Radio';
|
|
673
675
|
import type { SwitchProps } from '@yahoo/uds-mobile/Switch';
|
|
@@ -696,6 +698,7 @@ import { IconButton } from '@yahoo/uds-mobile/IconButton';
|
|
|
696
698
|
import { IconSlot } from '@yahoo/uds-mobile/IconSlot';
|
|
697
699
|
import { Image } from '@yahoo/uds-mobile/Image';
|
|
698
700
|
import { Input } from '@yahoo/uds-mobile/Input';
|
|
701
|
+
import { InputHelpText } from '@yahoo/uds-mobile/InputHelpText';
|
|
699
702
|
import { Link } from '@yahoo/uds-mobile/Link';
|
|
700
703
|
import { Pressable } from '@yahoo/uds-mobile/Pressable';
|
|
701
704
|
import { Radio } from '@yahoo/uds-mobile/Radio';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
require("../../_virtual/_rolldown/runtime.cjs");
|
|
4
|
+
const require_components_Avatar_utils = require("./utils.cjs");
|
|
5
|
+
const require_components_Avatar_AvatarIcon = require("./AvatarIcon.cjs");
|
|
6
|
+
const require_components_Avatar_AvatarText = require("./AvatarText.cjs");
|
|
7
|
+
const require_components_Avatar_AvatarImage = require("./AvatarImage.cjs");
|
|
8
|
+
let react = require("react");
|
|
9
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
+
//#region src/components/Avatar/Avatar.tsx
|
|
11
|
+
/**
|
|
12
|
+
* **Avatar component for user representation**
|
|
13
|
+
*
|
|
14
|
+
* @description
|
|
15
|
+
* Compatibility wrapper that preserves the original mobile API. For explicit
|
|
16
|
+
* composition, prefer `AvatarImage`, `AvatarText`, or `AvatarIcon`.
|
|
17
|
+
*
|
|
18
|
+
* @category Display
|
|
19
|
+
* @platform mobile
|
|
20
|
+
*/
|
|
21
|
+
const Avatar = (0, react.memo)(function Avatar({ src, alt, fallback, abbreviationStrategy, icon, ...avatarProps }) {
|
|
22
|
+
const initials = fallback || require_components_Avatar_utils.generateAvatarAbbreviation(alt, abbreviationStrategy);
|
|
23
|
+
if (src) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Avatar_AvatarImage.AvatarImage, {
|
|
24
|
+
src,
|
|
25
|
+
alt,
|
|
26
|
+
fallback,
|
|
27
|
+
icon,
|
|
28
|
+
abbreviationStrategy,
|
|
29
|
+
...avatarProps
|
|
30
|
+
});
|
|
31
|
+
if (initials) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Avatar_AvatarText.AvatarText, {
|
|
32
|
+
name: alt,
|
|
33
|
+
initials: fallback,
|
|
34
|
+
abbreviationStrategy,
|
|
35
|
+
...avatarProps
|
|
36
|
+
});
|
|
37
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Avatar_AvatarIcon.AvatarIcon, {
|
|
38
|
+
alt,
|
|
39
|
+
icon,
|
|
40
|
+
...avatarProps
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
Avatar.displayName = "Avatar";
|
|
44
|
+
//#endregion
|
|
45
|
+
exports.Avatar = Avatar;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
import { AvatarProps } from "./types.cjs";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Avatar/Avatar.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* **Avatar component for user representation**
|
|
8
|
+
*
|
|
9
|
+
* @description
|
|
10
|
+
* Compatibility wrapper that preserves the original mobile API. For explicit
|
|
11
|
+
* composition, prefer `AvatarImage`, `AvatarText`, or `AvatarIcon`.
|
|
12
|
+
*
|
|
13
|
+
* @category Display
|
|
14
|
+
* @platform mobile
|
|
15
|
+
*/
|
|
16
|
+
declare const Avatar: _$react.NamedExoticComponent<AvatarProps>;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Avatar };
|
|
19
|
+
//# sourceMappingURL=Avatar.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Avatar.d.cts","names":[],"sources":["../../../src/components/Avatar/Avatar.tsx"],"mappings":";;;;;;;;AAK2C;;;;;;;cAarC,MAAA,EAAM,OAAA,CAAA,oBAAA,CAAA,WAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
import { AvatarProps } from "./types.js";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Avatar/Avatar.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* **Avatar component for user representation**
|
|
8
|
+
*
|
|
9
|
+
* @description
|
|
10
|
+
* Compatibility wrapper that preserves the original mobile API. For explicit
|
|
11
|
+
* composition, prefer `AvatarImage`, `AvatarText`, or `AvatarIcon`.
|
|
12
|
+
*
|
|
13
|
+
* @category Display
|
|
14
|
+
* @platform mobile
|
|
15
|
+
*/
|
|
16
|
+
declare const Avatar: _$react.NamedExoticComponent<AvatarProps>;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Avatar };
|
|
19
|
+
//# sourceMappingURL=Avatar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Avatar.d.ts","names":[],"sources":["../../../src/components/Avatar/Avatar.tsx"],"mappings":";;;;;;;;AAK2C;;;;;;;cAarC,MAAA,EAAM,OAAA,CAAA,oBAAA,CAAA,WAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
import { generateAvatarAbbreviation } from "./utils.js";
|
|
3
|
+
import { AvatarIcon } from "./AvatarIcon.js";
|
|
4
|
+
import { AvatarText } from "./AvatarText.js";
|
|
5
|
+
import { AvatarImage } from "./AvatarImage.js";
|
|
6
|
+
import { memo } from "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/Avatar/Avatar.tsx
|
|
9
|
+
/**
|
|
10
|
+
* **Avatar component for user representation**
|
|
11
|
+
*
|
|
12
|
+
* @description
|
|
13
|
+
* Compatibility wrapper that preserves the original mobile API. For explicit
|
|
14
|
+
* composition, prefer `AvatarImage`, `AvatarText`, or `AvatarIcon`.
|
|
15
|
+
*
|
|
16
|
+
* @category Display
|
|
17
|
+
* @platform mobile
|
|
18
|
+
*/
|
|
19
|
+
const Avatar = memo(function Avatar({ src, alt, fallback, abbreviationStrategy, icon, ...avatarProps }) {
|
|
20
|
+
const initials = fallback || generateAvatarAbbreviation(alt, abbreviationStrategy);
|
|
21
|
+
if (src) return /* @__PURE__ */ jsx(AvatarImage, {
|
|
22
|
+
src,
|
|
23
|
+
alt,
|
|
24
|
+
fallback,
|
|
25
|
+
icon,
|
|
26
|
+
abbreviationStrategy,
|
|
27
|
+
...avatarProps
|
|
28
|
+
});
|
|
29
|
+
if (initials) return /* @__PURE__ */ jsx(AvatarText, {
|
|
30
|
+
name: alt,
|
|
31
|
+
initials: fallback,
|
|
32
|
+
abbreviationStrategy,
|
|
33
|
+
...avatarProps
|
|
34
|
+
});
|
|
35
|
+
return /* @__PURE__ */ jsx(AvatarIcon, {
|
|
36
|
+
alt,
|
|
37
|
+
icon,
|
|
38
|
+
...avatarProps
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
Avatar.displayName = "Avatar";
|
|
42
|
+
//#endregion
|
|
43
|
+
export { Avatar };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=Avatar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Avatar.js","names":[],"sources":["../../../src/components/Avatar/Avatar.tsx"],"sourcesContent":["import { memo } from 'react';\n\nimport { AvatarIcon } from './AvatarIcon';\nimport { AvatarImage } from './AvatarImage';\nimport { AvatarText } from './AvatarText';\nimport type { AvatarProps } from './types';\nimport { generateAvatarAbbreviation } from './utils';\n\n/**\n * **Avatar component for user representation**\n *\n * @description\n * Compatibility wrapper that preserves the original mobile API. For explicit\n * composition, prefer `AvatarImage`, `AvatarText`, or `AvatarIcon`.\n *\n * @category Display\n * @platform mobile\n */\nconst Avatar = memo(function Avatar({\n src,\n alt,\n fallback,\n abbreviationStrategy,\n icon,\n ...avatarProps\n}: AvatarProps) {\n const initials = fallback || generateAvatarAbbreviation(alt, abbreviationStrategy);\n\n if (src) {\n return (\n <AvatarImage\n src={src}\n alt={alt}\n fallback={fallback}\n icon={icon}\n abbreviationStrategy={abbreviationStrategy}\n {...avatarProps}\n />\n );\n }\n\n if (initials) {\n return (\n <AvatarText\n name={alt}\n initials={fallback}\n abbreviationStrategy={abbreviationStrategy}\n {...avatarProps}\n />\n );\n }\n\n return <AvatarIcon alt={alt} icon={icon} {...avatarProps} />;\n});\n\nAvatar.displayName = 'Avatar';\n\nexport { Avatar };\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,MAAM,SAAS,KAAK,SAAS,OAAO,EAClC,KACA,KACA,UACA,sBACA,MACA,GAAG,eACW;CACd,MAAM,WAAW,YAAY,2BAA2B,KAAK,qBAAqB;CAElF,IAAI,KACF,OACE,oBAAC,aAAD;EACO;EACA;EACK;EACJ;EACgB;EACtB,GAAI;EACJ,CAAA;CAIN,IAAI,UACF,OACE,oBAAC,YAAD;EACE,MAAM;EACN,UAAU;EACY;EACtB,GAAI;EACJ,CAAA;CAIN,OAAO,oBAAC,YAAD;EAAiB;EAAW;EAAM,GAAI;EAAe,CAAA;EAC5D;AAEF,OAAO,cAAc"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
require("../../_virtual/_rolldown/runtime.cjs");
|
|
4
|
+
const require_components_Box = require("../Box.cjs");
|
|
5
|
+
const require_components_IconSlot = require("../IconSlot.cjs");
|
|
6
|
+
const require_components_Avatar_utils = require("./utils.cjs");
|
|
7
|
+
let react = require("react");
|
|
8
|
+
let react_native = require("react-native");
|
|
9
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
+
let generated_styles = require("../../../generated/styles");
|
|
11
|
+
//#region src/components/Avatar/AvatarIcon.tsx
|
|
12
|
+
const AvatarIcon = (0, react.memo)(function AvatarIcon({ size = "md", variant = require_components_Avatar_utils.DEFAULT_AVATAR_VARIANT, icon, customSize, style, accessibilityLabel, alt, ref, ...viewProps }) {
|
|
13
|
+
generated_styles.avatarStyles.useVariants({
|
|
14
|
+
size,
|
|
15
|
+
icon: variant
|
|
16
|
+
});
|
|
17
|
+
const rootStyle = (0, react.useMemo)(() => [
|
|
18
|
+
generated_styles.avatarStyles.root,
|
|
19
|
+
avatarStaticStyles.root,
|
|
20
|
+
require_components_Avatar_utils.getAvatarCustomSizeStyle(customSize),
|
|
21
|
+
style
|
|
22
|
+
], [
|
|
23
|
+
generated_styles.avatarStyles.root,
|
|
24
|
+
customSize,
|
|
25
|
+
style
|
|
26
|
+
]);
|
|
27
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Box.Box, {
|
|
28
|
+
ref,
|
|
29
|
+
accessibilityRole: "image",
|
|
30
|
+
accessibilityLabel: accessibilityLabel ?? alt,
|
|
31
|
+
...viewProps,
|
|
32
|
+
style: rootStyle,
|
|
33
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
34
|
+
icon: icon ?? require_components_Avatar_utils.getDefaultAvatarIcon(variant),
|
|
35
|
+
variant: "fill",
|
|
36
|
+
style: generated_styles.avatarStyles.icon
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
AvatarIcon.displayName = "AvatarIcon";
|
|
41
|
+
const avatarStaticStyles = react_native.StyleSheet.create({ root: {
|
|
42
|
+
alignItems: "center",
|
|
43
|
+
justifyContent: "center",
|
|
44
|
+
overflow: "hidden"
|
|
45
|
+
} });
|
|
46
|
+
//#endregion
|
|
47
|
+
exports.AvatarIcon = AvatarIcon;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
import { AvatarIconProps } from "./types.cjs";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Avatar/AvatarIcon.d.ts
|
|
6
|
+
declare const AvatarIcon: _$react.NamedExoticComponent<AvatarIconProps>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { AvatarIcon };
|
|
9
|
+
//# sourceMappingURL=AvatarIcon.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AvatarIcon.d.cts","names":[],"sources":["../../../src/components/Avatar/AvatarIcon.tsx"],"mappings":";;;;;cAcM,UAAA,EAAU,OAAA,CAAA,oBAAA,CAAA,eAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
import { AvatarIconProps } from "./types.js";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Avatar/AvatarIcon.d.ts
|
|
6
|
+
declare const AvatarIcon: _$react.NamedExoticComponent<AvatarIconProps>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { AvatarIcon };
|
|
9
|
+
//# sourceMappingURL=AvatarIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AvatarIcon.d.ts","names":[],"sources":["../../../src/components/Avatar/AvatarIcon.tsx"],"mappings":";;;;;cAcM,UAAA,EAAU,OAAA,CAAA,oBAAA,CAAA,eAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
import { Box } from "../Box.js";
|
|
3
|
+
import { IconSlot } from "../IconSlot.js";
|
|
4
|
+
import { DEFAULT_AVATAR_VARIANT, getAvatarCustomSizeStyle, getDefaultAvatarIcon } from "./utils.js";
|
|
5
|
+
import { memo, useMemo } from "react";
|
|
6
|
+
import { StyleSheet } from "react-native";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
import { avatarStyles } from "../../../generated/styles";
|
|
9
|
+
//#region src/components/Avatar/AvatarIcon.tsx
|
|
10
|
+
const AvatarIcon = memo(function AvatarIcon({ size = "md", variant = DEFAULT_AVATAR_VARIANT, icon, customSize, style, accessibilityLabel, alt, ref, ...viewProps }) {
|
|
11
|
+
avatarStyles.useVariants({
|
|
12
|
+
size,
|
|
13
|
+
icon: variant
|
|
14
|
+
});
|
|
15
|
+
const rootStyle = useMemo(() => [
|
|
16
|
+
avatarStyles.root,
|
|
17
|
+
avatarStaticStyles.root,
|
|
18
|
+
getAvatarCustomSizeStyle(customSize),
|
|
19
|
+
style
|
|
20
|
+
], [
|
|
21
|
+
avatarStyles.root,
|
|
22
|
+
customSize,
|
|
23
|
+
style
|
|
24
|
+
]);
|
|
25
|
+
return /* @__PURE__ */ jsx(Box, {
|
|
26
|
+
ref,
|
|
27
|
+
accessibilityRole: "image",
|
|
28
|
+
accessibilityLabel: accessibilityLabel ?? alt,
|
|
29
|
+
...viewProps,
|
|
30
|
+
style: rootStyle,
|
|
31
|
+
children: /* @__PURE__ */ jsx(IconSlot, {
|
|
32
|
+
icon: icon ?? getDefaultAvatarIcon(variant),
|
|
33
|
+
variant: "fill",
|
|
34
|
+
style: avatarStyles.icon
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
AvatarIcon.displayName = "AvatarIcon";
|
|
39
|
+
const avatarStaticStyles = StyleSheet.create({ root: {
|
|
40
|
+
alignItems: "center",
|
|
41
|
+
justifyContent: "center",
|
|
42
|
+
overflow: "hidden"
|
|
43
|
+
} });
|
|
44
|
+
//#endregion
|
|
45
|
+
export { AvatarIcon };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=AvatarIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AvatarIcon.js","names":[],"sources":["../../../src/components/Avatar/AvatarIcon.tsx"],"sourcesContent":["import { memo, useMemo } from 'react';\nimport { StyleSheet } from 'react-native';\n\nimport { avatarStyles } from '../../../generated/styles';\nimport { Box } from '../Box';\nimport { IconSlot } from '../IconSlot';\nimport type { AvatarIconProps } from './types';\nimport {\n DEFAULT_AVATAR_SIZE,\n DEFAULT_AVATAR_VARIANT,\n getAvatarCustomSizeStyle,\n getDefaultAvatarIcon,\n} from './utils';\n\nconst AvatarIcon = memo(function AvatarIcon({\n size = DEFAULT_AVATAR_SIZE,\n variant = DEFAULT_AVATAR_VARIANT,\n icon,\n customSize,\n style,\n accessibilityLabel,\n alt,\n ref,\n ...viewProps\n}: AvatarIconProps) {\n avatarStyles.useVariants({ size, icon: variant });\n\n const rootStyle = useMemo(\n () => [avatarStyles.root, avatarStaticStyles.root, getAvatarCustomSizeStyle(customSize), style],\n [avatarStyles.root, customSize, style],\n );\n\n return (\n <Box\n ref={ref}\n accessibilityRole=\"image\"\n accessibilityLabel={accessibilityLabel ?? alt}\n {...viewProps}\n style={rootStyle}\n >\n <IconSlot\n icon={icon ?? getDefaultAvatarIcon(variant)}\n variant=\"fill\"\n style={avatarStyles.icon}\n />\n </Box>\n );\n});\n\nAvatarIcon.displayName = 'AvatarIcon';\n\nconst avatarStaticStyles = StyleSheet.create({\n root: {\n alignItems: 'center',\n justifyContent: 'center',\n overflow: 'hidden',\n },\n});\n\nexport { AvatarIcon };\n"],"mappings":";;;;;;;;;AAcA,MAAM,aAAa,KAAK,SAAS,WAAW,EAC1C,OAAA,MACA,UAAU,wBACV,MACA,YACA,OACA,oBACA,KACA,KACA,GAAG,aACe;CAClB,aAAa,YAAY;EAAE;EAAM,MAAM;EAAS,CAAC;CAEjD,MAAM,YAAY,cACV;EAAC,aAAa;EAAM,mBAAmB;EAAM,yBAAyB,WAAW;EAAE;EAAM,EAC/F;EAAC,aAAa;EAAM;EAAY;EAAM,CACvC;CAED,OACE,oBAAC,KAAD;EACO;EACL,mBAAkB;EAClB,oBAAoB,sBAAsB;EAC1C,GAAI;EACJ,OAAO;YAEP,oBAAC,UAAD;GACE,MAAM,QAAQ,qBAAqB,QAAQ;GAC3C,SAAQ;GACR,OAAO,aAAa;GACpB,CAAA;EACE,CAAA;EAER;AAEF,WAAW,cAAc;AAEzB,MAAM,qBAAqB,WAAW,OAAO,EAC3C,MAAM;CACJ,YAAY;CACZ,gBAAgB;CAChB,UAAU;CACX,EACF,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
require("../../_virtual/_rolldown/runtime.cjs");
|
|
4
|
+
const require_components_Box = require("../Box.cjs");
|
|
5
|
+
const require_components_Avatar_utils = require("./utils.cjs");
|
|
6
|
+
const require_components_Avatar_AvatarIcon = require("./AvatarIcon.cjs");
|
|
7
|
+
const require_components_Avatar_AvatarText = require("./AvatarText.cjs");
|
|
8
|
+
let react = require("react");
|
|
9
|
+
let react_native = require("react-native");
|
|
10
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
+
let generated_styles = require("../../../generated/styles");
|
|
12
|
+
//#region src/components/Avatar/AvatarImage.tsx
|
|
13
|
+
const AvatarImage = (0, react.memo)(function AvatarImage({ size = "md", variant = require_components_Avatar_utils.DEFAULT_AVATAR_VARIANT, src, alt, fallback, icon, abbreviationStrategy, customSize, style, accessibilityLabel, ref, ...viewProps }) {
|
|
14
|
+
const [imageError, setImageError] = (0, react.useState)(false);
|
|
15
|
+
const shouldShowImage = Boolean(src) && !imageError;
|
|
16
|
+
generated_styles.avatarStyles.useVariants({
|
|
17
|
+
size,
|
|
18
|
+
image: variant
|
|
19
|
+
});
|
|
20
|
+
const rootStyle = (0, react.useMemo)(() => [
|
|
21
|
+
generated_styles.avatarStyles.root,
|
|
22
|
+
avatarStaticStyles.root,
|
|
23
|
+
require_components_Avatar_utils.getAvatarCustomSizeStyle(customSize),
|
|
24
|
+
style
|
|
25
|
+
], [
|
|
26
|
+
generated_styles.avatarStyles.root,
|
|
27
|
+
customSize,
|
|
28
|
+
style
|
|
29
|
+
]);
|
|
30
|
+
if (!shouldShowImage) {
|
|
31
|
+
if (fallback || alt) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Avatar_AvatarText.AvatarText, {
|
|
32
|
+
ref,
|
|
33
|
+
size,
|
|
34
|
+
variant,
|
|
35
|
+
name: alt,
|
|
36
|
+
initials: fallback,
|
|
37
|
+
abbreviationStrategy,
|
|
38
|
+
customSize,
|
|
39
|
+
accessibilityLabel: accessibilityLabel ?? alt ?? fallback,
|
|
40
|
+
style,
|
|
41
|
+
...viewProps
|
|
42
|
+
});
|
|
43
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Avatar_AvatarIcon.AvatarIcon, {
|
|
44
|
+
ref,
|
|
45
|
+
size,
|
|
46
|
+
variant,
|
|
47
|
+
icon,
|
|
48
|
+
customSize,
|
|
49
|
+
accessibilityLabel: accessibilityLabel ?? alt,
|
|
50
|
+
style,
|
|
51
|
+
...viewProps
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Box.Box, {
|
|
55
|
+
ref,
|
|
56
|
+
accessibilityRole: "image",
|
|
57
|
+
accessibilityLabel: accessibilityLabel ?? alt,
|
|
58
|
+
...viewProps,
|
|
59
|
+
style: rootStyle,
|
|
60
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Image, {
|
|
61
|
+
source: { uri: src },
|
|
62
|
+
accessibilityLabel: alt,
|
|
63
|
+
onError: () => setImageError(true),
|
|
64
|
+
style: avatarStaticStyles.image
|
|
65
|
+
})
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
AvatarImage.displayName = "AvatarImage";
|
|
69
|
+
const avatarStaticStyles = react_native.StyleSheet.create({
|
|
70
|
+
root: {
|
|
71
|
+
alignItems: "center",
|
|
72
|
+
justifyContent: "center",
|
|
73
|
+
overflow: "hidden"
|
|
74
|
+
},
|
|
75
|
+
image: {
|
|
76
|
+
height: "100%",
|
|
77
|
+
width: "100%"
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
//#endregion
|
|
81
|
+
exports.AvatarImage = AvatarImage;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
import { AvatarImageProps } from "./types.cjs";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Avatar/AvatarImage.d.ts
|
|
6
|
+
declare const AvatarImage: _$react.NamedExoticComponent<AvatarImageProps>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { AvatarImage };
|
|
9
|
+
//# sourceMappingURL=AvatarImage.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AvatarImage.d.cts","names":[],"sources":["../../../src/components/Avatar/AvatarImage.tsx"],"mappings":";;;;;cAUM,WAAA,EAAW,OAAA,CAAA,oBAAA,CAAA,gBAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
import { AvatarImageProps } from "./types.js";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Avatar/AvatarImage.d.ts
|
|
6
|
+
declare const AvatarImage: _$react.NamedExoticComponent<AvatarImageProps>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { AvatarImage };
|
|
9
|
+
//# sourceMappingURL=AvatarImage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AvatarImage.d.ts","names":[],"sources":["../../../src/components/Avatar/AvatarImage.tsx"],"mappings":";;;;;cAUM,WAAA,EAAW,OAAA,CAAA,oBAAA,CAAA,gBAAA"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
import { Box } from "../Box.js";
|
|
3
|
+
import { DEFAULT_AVATAR_VARIANT, getAvatarCustomSizeStyle } from "./utils.js";
|
|
4
|
+
import { AvatarIcon } from "./AvatarIcon.js";
|
|
5
|
+
import { AvatarText } from "./AvatarText.js";
|
|
6
|
+
import { memo, useMemo, useState } from "react";
|
|
7
|
+
import { Image, StyleSheet } from "react-native";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
import { avatarStyles } from "../../../generated/styles";
|
|
10
|
+
//#region src/components/Avatar/AvatarImage.tsx
|
|
11
|
+
const AvatarImage = memo(function AvatarImage({ size = "md", variant = DEFAULT_AVATAR_VARIANT, src, alt, fallback, icon, abbreviationStrategy, customSize, style, accessibilityLabel, ref, ...viewProps }) {
|
|
12
|
+
const [imageError, setImageError] = useState(false);
|
|
13
|
+
const shouldShowImage = Boolean(src) && !imageError;
|
|
14
|
+
avatarStyles.useVariants({
|
|
15
|
+
size,
|
|
16
|
+
image: variant
|
|
17
|
+
});
|
|
18
|
+
const rootStyle = useMemo(() => [
|
|
19
|
+
avatarStyles.root,
|
|
20
|
+
avatarStaticStyles.root,
|
|
21
|
+
getAvatarCustomSizeStyle(customSize),
|
|
22
|
+
style
|
|
23
|
+
], [
|
|
24
|
+
avatarStyles.root,
|
|
25
|
+
customSize,
|
|
26
|
+
style
|
|
27
|
+
]);
|
|
28
|
+
if (!shouldShowImage) {
|
|
29
|
+
if (fallback || alt) return /* @__PURE__ */ jsx(AvatarText, {
|
|
30
|
+
ref,
|
|
31
|
+
size,
|
|
32
|
+
variant,
|
|
33
|
+
name: alt,
|
|
34
|
+
initials: fallback,
|
|
35
|
+
abbreviationStrategy,
|
|
36
|
+
customSize,
|
|
37
|
+
accessibilityLabel: accessibilityLabel ?? alt ?? fallback,
|
|
38
|
+
style,
|
|
39
|
+
...viewProps
|
|
40
|
+
});
|
|
41
|
+
return /* @__PURE__ */ jsx(AvatarIcon, {
|
|
42
|
+
ref,
|
|
43
|
+
size,
|
|
44
|
+
variant,
|
|
45
|
+
icon,
|
|
46
|
+
customSize,
|
|
47
|
+
accessibilityLabel: accessibilityLabel ?? alt,
|
|
48
|
+
style,
|
|
49
|
+
...viewProps
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return /* @__PURE__ */ jsx(Box, {
|
|
53
|
+
ref,
|
|
54
|
+
accessibilityRole: "image",
|
|
55
|
+
accessibilityLabel: accessibilityLabel ?? alt,
|
|
56
|
+
...viewProps,
|
|
57
|
+
style: rootStyle,
|
|
58
|
+
children: /* @__PURE__ */ jsx(Image, {
|
|
59
|
+
source: { uri: src },
|
|
60
|
+
accessibilityLabel: alt,
|
|
61
|
+
onError: () => setImageError(true),
|
|
62
|
+
style: avatarStaticStyles.image
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
AvatarImage.displayName = "AvatarImage";
|
|
67
|
+
const avatarStaticStyles = StyleSheet.create({
|
|
68
|
+
root: {
|
|
69
|
+
alignItems: "center",
|
|
70
|
+
justifyContent: "center",
|
|
71
|
+
overflow: "hidden"
|
|
72
|
+
},
|
|
73
|
+
image: {
|
|
74
|
+
height: "100%",
|
|
75
|
+
width: "100%"
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
//#endregion
|
|
79
|
+
export { AvatarImage };
|
|
80
|
+
|
|
81
|
+
//# sourceMappingURL=AvatarImage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AvatarImage.js","names":["RNImage"],"sources":["../../../src/components/Avatar/AvatarImage.tsx"],"sourcesContent":["import { memo, useMemo, useState } from 'react';\nimport { Image as RNImage, StyleSheet } from 'react-native';\n\nimport { avatarStyles } from '../../../generated/styles';\nimport { Box } from '../Box';\nimport { AvatarIcon } from './AvatarIcon';\nimport { AvatarText } from './AvatarText';\nimport type { AvatarImageProps } from './types';\nimport { DEFAULT_AVATAR_SIZE, DEFAULT_AVATAR_VARIANT, getAvatarCustomSizeStyle } from './utils';\n\nconst AvatarImage = memo(function AvatarImage({\n size = DEFAULT_AVATAR_SIZE,\n variant = DEFAULT_AVATAR_VARIANT,\n src,\n alt,\n fallback,\n icon,\n abbreviationStrategy,\n customSize,\n style,\n accessibilityLabel,\n ref,\n ...viewProps\n}: AvatarImageProps) {\n const [imageError, setImageError] = useState(false);\n const shouldShowImage = Boolean(src) && !imageError;\n\n avatarStyles.useVariants({ size, image: variant });\n\n const rootStyle = useMemo(\n () => [avatarStyles.root, avatarStaticStyles.root, getAvatarCustomSizeStyle(customSize), style],\n [avatarStyles.root, customSize, style],\n );\n\n if (!shouldShowImage) {\n if (fallback || alt) {\n return (\n <AvatarText\n ref={ref}\n size={size}\n variant={variant}\n name={alt}\n initials={fallback}\n abbreviationStrategy={abbreviationStrategy}\n customSize={customSize}\n accessibilityLabel={accessibilityLabel ?? alt ?? fallback}\n style={style}\n {...viewProps}\n />\n );\n }\n\n return (\n <AvatarIcon\n ref={ref}\n size={size}\n variant={variant}\n icon={icon}\n customSize={customSize}\n accessibilityLabel={accessibilityLabel ?? alt}\n style={style}\n {...viewProps}\n />\n );\n }\n\n return (\n <Box\n ref={ref}\n accessibilityRole=\"image\"\n accessibilityLabel={accessibilityLabel ?? alt}\n {...viewProps}\n style={rootStyle}\n >\n <RNImage\n source={{ uri: src }}\n accessibilityLabel={alt}\n onError={() => setImageError(true)}\n style={avatarStaticStyles.image}\n />\n </Box>\n );\n});\n\nAvatarImage.displayName = 'AvatarImage';\n\nconst avatarStaticStyles = StyleSheet.create({\n root: {\n alignItems: 'center',\n justifyContent: 'center',\n overflow: 'hidden',\n },\n image: {\n height: '100%',\n width: '100%',\n },\n});\n\nexport { AvatarImage };\n"],"mappings":";;;;;;;;;;AAUA,MAAM,cAAc,KAAK,SAAS,YAAY,EAC5C,OAAA,MACA,UAAU,wBACV,KACA,KACA,UACA,MACA,sBACA,YACA,OACA,oBACA,KACA,GAAG,aACgB;CACnB,MAAM,CAAC,YAAY,iBAAiB,SAAS,MAAM;CACnD,MAAM,kBAAkB,QAAQ,IAAI,IAAI,CAAC;CAEzC,aAAa,YAAY;EAAE;EAAM,OAAO;EAAS,CAAC;CAElD,MAAM,YAAY,cACV;EAAC,aAAa;EAAM,mBAAmB;EAAM,yBAAyB,WAAW;EAAE;EAAM,EAC/F;EAAC,aAAa;EAAM;EAAY;EAAM,CACvC;CAED,IAAI,CAAC,iBAAiB;EACpB,IAAI,YAAY,KACd,OACE,oBAAC,YAAD;GACO;GACC;GACG;GACT,MAAM;GACN,UAAU;GACY;GACV;GACZ,oBAAoB,sBAAsB,OAAO;GAC1C;GACP,GAAI;GACJ,CAAA;EAIN,OACE,oBAAC,YAAD;GACO;GACC;GACG;GACH;GACM;GACZ,oBAAoB,sBAAsB;GACnC;GACP,GAAI;GACJ,CAAA;;CAIN,OACE,oBAAC,KAAD;EACO;EACL,mBAAkB;EAClB,oBAAoB,sBAAsB;EAC1C,GAAI;EACJ,OAAO;YAEP,oBAACA,OAAD;GACE,QAAQ,EAAE,KAAK,KAAK;GACpB,oBAAoB;GACpB,eAAe,cAAc,KAAK;GAClC,OAAO,mBAAmB;GAC1B,CAAA;EACE,CAAA;EAER;AAEF,YAAY,cAAc;AAE1B,MAAM,qBAAqB,WAAW,OAAO;CAC3C,MAAM;EACJ,YAAY;EACZ,gBAAgB;EAChB,UAAU;EACX;CACD,OAAO;EACL,QAAQ;EACR,OAAO;EACR;CACF,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
require("../../_virtual/_rolldown/runtime.cjs");
|
|
4
|
+
const require_components_Box = require("../Box.cjs");
|
|
5
|
+
const require_components_Text = require("../Text.cjs");
|
|
6
|
+
const require_components_Avatar_utils = require("./utils.cjs");
|
|
7
|
+
let react = require("react");
|
|
8
|
+
let react_native = require("react-native");
|
|
9
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
+
let generated_styles = require("../../../generated/styles");
|
|
11
|
+
//#region src/components/Avatar/AvatarText.tsx
|
|
12
|
+
const AvatarText = (0, react.memo)(function AvatarText({ size = "md", variant = require_components_Avatar_utils.DEFAULT_AVATAR_VARIANT, name, initials, abbreviationStrategy, customSize, style, accessibilityLabel, ref, ...viewProps }) {
|
|
13
|
+
generated_styles.avatarStyles.useVariants({
|
|
14
|
+
size,
|
|
15
|
+
text: variant
|
|
16
|
+
});
|
|
17
|
+
const rootStyle = (0, react.useMemo)(() => [
|
|
18
|
+
generated_styles.avatarStyles.root,
|
|
19
|
+
avatarStaticStyles.root,
|
|
20
|
+
require_components_Avatar_utils.getAvatarCustomSizeStyle(customSize),
|
|
21
|
+
style
|
|
22
|
+
], [
|
|
23
|
+
generated_styles.avatarStyles.root,
|
|
24
|
+
customSize,
|
|
25
|
+
style
|
|
26
|
+
]);
|
|
27
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Box.Box, {
|
|
28
|
+
ref,
|
|
29
|
+
accessibilityRole: "image",
|
|
30
|
+
accessibilityLabel: accessibilityLabel ?? name ?? initials,
|
|
31
|
+
...viewProps,
|
|
32
|
+
style: rootStyle,
|
|
33
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Text.Text, {
|
|
34
|
+
color: "inherit",
|
|
35
|
+
variant: "inherit",
|
|
36
|
+
numberOfLines: 1,
|
|
37
|
+
style: generated_styles.avatarStyles.text,
|
|
38
|
+
children: initials || require_components_Avatar_utils.generateAvatarAbbreviation(name, abbreviationStrategy)
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
AvatarText.displayName = "AvatarText";
|
|
43
|
+
const avatarStaticStyles = react_native.StyleSheet.create({ root: {
|
|
44
|
+
alignItems: "center",
|
|
45
|
+
justifyContent: "center",
|
|
46
|
+
overflow: "hidden"
|
|
47
|
+
} });
|
|
48
|
+
//#endregion
|
|
49
|
+
exports.AvatarText = AvatarText;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
import { AvatarTextProps } from "./types.cjs";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Avatar/AvatarText.d.ts
|
|
6
|
+
declare const AvatarText: _$react.NamedExoticComponent<AvatarTextProps>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { AvatarText };
|
|
9
|
+
//# sourceMappingURL=AvatarText.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AvatarText.d.cts","names":[],"sources":["../../../src/components/Avatar/AvatarText.tsx"],"mappings":";;;;;cAcM,UAAA,EAAU,OAAA,CAAA,oBAAA,CAAA,eAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
import { AvatarTextProps } from "./types.js";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Avatar/AvatarText.d.ts
|
|
6
|
+
declare const AvatarText: _$react.NamedExoticComponent<AvatarTextProps>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { AvatarText };
|
|
9
|
+
//# sourceMappingURL=AvatarText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AvatarText.d.ts","names":[],"sources":["../../../src/components/Avatar/AvatarText.tsx"],"mappings":";;;;;cAcM,UAAA,EAAU,OAAA,CAAA,oBAAA,CAAA,eAAA"}
|