@yahoo/uds-mobile 2.23.3 → 2.24.0-beta.10
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 +41 -13
- package/dist/bin/automated-config/dist/generated/generatedConfigs.mjs +92 -46
- package/dist/components/Avatar/AvatarIcon.cjs +8 -2
- package/dist/components/Avatar/AvatarIcon.d.cts.map +1 -1
- package/dist/components/Avatar/AvatarIcon.d.ts.map +1 -1
- package/dist/components/Avatar/AvatarIcon.js +9 -3
- package/dist/components/Avatar/AvatarIcon.js.map +1 -1
- package/dist/components/Avatar/AvatarImage.cjs +9 -2
- package/dist/components/Avatar/AvatarImage.d.cts.map +1 -1
- package/dist/components/Avatar/AvatarImage.d.ts.map +1 -1
- package/dist/components/Avatar/AvatarImage.js +10 -3
- package/dist/components/Avatar/AvatarImage.js.map +1 -1
- package/dist/components/Avatar/AvatarText.cjs +8 -2
- package/dist/components/Avatar/AvatarText.d.cts.map +1 -1
- package/dist/components/Avatar/AvatarText.d.ts.map +1 -1
- package/dist/components/Avatar/AvatarText.js +9 -3
- package/dist/components/Avatar/AvatarText.js.map +1 -1
- package/dist/components/Avatar/types.d.cts +7 -3
- package/dist/components/Avatar/types.d.cts.map +1 -1
- package/dist/components/Avatar/types.d.ts +7 -3
- package/dist/components/Avatar/types.d.ts.map +1 -1
- package/dist/components/Avatar/useAvatarFontScale.cjs +16 -0
- package/dist/components/Avatar/useAvatarFontScale.d.cts +7 -0
- package/dist/components/Avatar/useAvatarFontScale.d.cts.map +1 -0
- package/dist/components/Avatar/useAvatarFontScale.d.ts +7 -0
- package/dist/components/Avatar/useAvatarFontScale.d.ts.map +1 -0
- package/dist/components/Avatar/useAvatarFontScale.js +16 -0
- package/dist/components/Avatar/useAvatarFontScale.js.map +1 -0
- package/dist/components/Avatar/utils.cjs +9 -6
- package/dist/components/Avatar/utils.d.cts +2 -2
- package/dist/components/Avatar/utils.d.cts.map +1 -1
- package/dist/components/Avatar/utils.d.ts +2 -2
- package/dist/components/Avatar/utils.d.ts.map +1 -1
- package/dist/components/Avatar/utils.js +9 -6
- package/dist/components/Avatar/utils.js.map +1 -1
- package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
- package/dist/components/BottomSheet/BottomSheet.js +1 -1
- package/dist/components/Button/buttonTheme.cjs +31 -9
- package/dist/components/Button/buttonTheme.d.cts +24 -5
- package/dist/components/Button/buttonTheme.d.cts.map +1 -1
- package/dist/components/Button/buttonTheme.d.ts +24 -5
- package/dist/components/Button/buttonTheme.d.ts.map +1 -1
- package/dist/components/Button/buttonTheme.js +31 -10
- package/dist/components/Button/buttonTheme.js.map +1 -1
- package/dist/components/Button.cjs +35 -8
- package/dist/components/Button.d.cts +7 -0
- package/dist/components/Button.d.cts.map +1 -1
- package/dist/components/Button.d.ts +7 -0
- package/dist/components/Button.d.ts.map +1 -1
- package/dist/components/Button.js +35 -8
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Checkbox.cjs +42 -9
- package/dist/components/Checkbox.d.cts +7 -0
- package/dist/components/Checkbox.d.cts.map +1 -1
- package/dist/components/Checkbox.d.ts +7 -0
- package/dist/components/Checkbox.d.ts.map +1 -1
- package/dist/components/Checkbox.js +42 -9
- package/dist/components/Checkbox.js.map +1 -1
- package/dist/components/Chip/ChipBase.cjs +31 -14
- package/dist/components/Chip/ChipBase.d.cts.map +1 -1
- package/dist/components/Chip/ChipBase.d.ts.map +1 -1
- package/dist/components/Chip/ChipBase.js +31 -14
- package/dist/components/Chip/ChipBase.js.map +1 -1
- package/dist/components/Chip/ChipDismissible.cjs +3 -1
- package/dist/components/Chip/ChipDismissible.js +3 -1
- package/dist/components/Chip/ChipDismissible.js.map +1 -1
- package/dist/components/Chip/types.d.cts +7 -0
- package/dist/components/Chip/types.d.cts.map +1 -1
- package/dist/components/Chip/types.d.ts +7 -0
- package/dist/components/Chip/types.d.ts.map +1 -1
- package/dist/components/Icon.cjs +24 -5
- package/dist/components/Icon.d.cts +11 -2
- package/dist/components/Icon.d.cts.map +1 -1
- package/dist/components/Icon.d.ts +11 -2
- package/dist/components/Icon.d.ts.map +1 -1
- package/dist/components/Icon.js +24 -5
- package/dist/components/Icon.js.map +1 -1
- package/dist/components/IconButton.cjs +17 -6
- package/dist/components/IconButton.d.cts +6 -0
- package/dist/components/IconButton.d.cts.map +1 -1
- package/dist/components/IconButton.d.ts +6 -0
- package/dist/components/IconButton.d.ts.map +1 -1
- package/dist/components/IconButton.js +18 -7
- package/dist/components/IconButton.js.map +1 -1
- package/dist/components/Input.cjs +56 -18
- package/dist/components/Input.d.cts +5 -0
- package/dist/components/Input.d.cts.map +1 -1
- package/dist/components/Input.d.ts +5 -0
- package/dist/components/Input.d.ts.map +1 -1
- package/dist/components/Input.js +56 -18
- package/dist/components/Input.js.map +1 -1
- package/dist/components/InputHelpText.cjs +7 -1
- package/dist/components/InputHelpText.d.cts +2 -0
- package/dist/components/InputHelpText.d.cts.map +1 -1
- package/dist/components/InputHelpText.d.ts +2 -0
- package/dist/components/InputHelpText.d.ts.map +1 -1
- package/dist/components/InputHelpText.js +7 -1
- package/dist/components/InputHelpText.js.map +1 -1
- package/dist/components/Link.cjs +13 -1
- package/dist/components/Link.d.cts +7 -0
- package/dist/components/Link.d.cts.map +1 -1
- package/dist/components/Link.d.ts +7 -0
- package/dist/components/Link.d.ts.map +1 -1
- package/dist/components/Link.js +13 -1
- package/dist/components/Link.js.map +1 -1
- package/dist/components/Pagination/Pagination.cjs +18 -10
- package/dist/components/Pagination/Pagination.d.cts +2 -0
- package/dist/components/Pagination/Pagination.d.cts.map +1 -1
- package/dist/components/Pagination/Pagination.d.ts +2 -0
- package/dist/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/components/Pagination/Pagination.js +18 -10
- package/dist/components/Pagination/Pagination.js.map +1 -1
- package/dist/components/Pagination/PaginationEllipsis.cjs +8 -2
- package/dist/components/Pagination/PaginationEllipsis.d.cts.map +1 -1
- package/dist/components/Pagination/PaginationEllipsis.d.ts.map +1 -1
- package/dist/components/Pagination/PaginationEllipsis.js +9 -3
- package/dist/components/Pagination/PaginationEllipsis.js.map +1 -1
- package/dist/components/Pagination/PaginationItem.cjs +2 -1
- package/dist/components/Pagination/PaginationItem.js +2 -1
- package/dist/components/Pagination/PaginationItem.js.map +1 -1
- package/dist/components/Pagination/PaginationLink.cjs +2 -1
- package/dist/components/Pagination/PaginationLink.js +2 -1
- package/dist/components/Pagination/PaginationLink.js.map +1 -1
- package/dist/components/Pagination/PaginationNext.cjs +3 -1
- package/dist/components/Pagination/PaginationNext.js +3 -1
- package/dist/components/Pagination/PaginationNext.js.map +1 -1
- package/dist/components/Pagination/PaginationPrev.cjs +3 -1
- package/dist/components/Pagination/PaginationPrev.js +3 -1
- package/dist/components/Pagination/PaginationPrev.js.map +1 -1
- package/dist/components/Pagination/paginationContext.d.cts +2 -0
- package/dist/components/Pagination/paginationContext.d.cts.map +1 -1
- package/dist/components/Pagination/paginationContext.d.ts +2 -0
- package/dist/components/Pagination/paginationContext.d.ts.map +1 -1
- package/dist/components/Pagination/paginationContext.js.map +1 -1
- package/dist/components/Pagination/usePaginationControlStyles.cjs +8 -1
- package/dist/components/Pagination/usePaginationControlStyles.d.cts.map +1 -1
- package/dist/components/Pagination/usePaginationControlStyles.d.ts.map +1 -1
- package/dist/components/Pagination/usePaginationControlStyles.js +9 -2
- package/dist/components/Pagination/usePaginationControlStyles.js.map +1 -1
- package/dist/components/Radio/Radio.cjs +30 -11
- package/dist/components/Radio/Radio.d.cts +7 -0
- package/dist/components/Radio/Radio.d.cts.map +1 -1
- package/dist/components/Radio/Radio.d.ts +7 -0
- package/dist/components/Radio/Radio.d.ts.map +1 -1
- package/dist/components/Radio/Radio.js +30 -11
- package/dist/components/Radio/Radio.js.map +1 -1
- package/dist/components/Select/Select.cjs +29 -6
- package/dist/components/Select/Select.d.cts +2 -0
- package/dist/components/Select/Select.d.cts.map +1 -1
- package/dist/components/Select/Select.d.ts +2 -0
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/Select.js +29 -6
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Select/SelectContent.cjs +31 -23
- package/dist/components/Select/SelectContent.d.cts.map +1 -1
- package/dist/components/Select/SelectContent.d.ts.map +1 -1
- package/dist/components/Select/SelectContent.js +32 -24
- package/dist/components/Select/SelectContent.js.map +1 -1
- package/dist/components/Select/SelectItem.cjs +25 -15
- package/dist/components/Select/SelectItem.d.cts.map +1 -1
- package/dist/components/Select/SelectItem.d.ts.map +1 -1
- package/dist/components/Select/SelectItem.js +25 -15
- package/dist/components/Select/SelectItem.js.map +1 -1
- package/dist/components/Select/SelectTrigger.cjs +27 -13
- package/dist/components/Select/SelectTrigger.d.cts.map +1 -1
- package/dist/components/Select/SelectTrigger.d.ts.map +1 -1
- package/dist/components/Select/SelectTrigger.js +27 -13
- package/dist/components/Select/SelectTrigger.js.map +1 -1
- package/dist/components/Select/types.d.cts +2 -0
- package/dist/components/Select/types.d.cts.map +1 -1
- package/dist/components/Select/types.d.ts +2 -0
- package/dist/components/Select/types.d.ts.map +1 -1
- package/dist/components/Switch.cjs +48 -8
- package/dist/components/Switch.d.cts +7 -0
- package/dist/components/Switch.d.cts.map +1 -1
- package/dist/components/Switch.d.ts +7 -0
- package/dist/components/Switch.d.ts.map +1 -1
- package/dist/components/Switch.js +48 -8
- package/dist/components/Switch.js.map +1 -1
- package/dist/components/Tabs/Tab.cjs +17 -3
- package/dist/components/Tabs/Tab.d.cts.map +1 -1
- package/dist/components/Tabs/Tab.d.ts.map +1 -1
- package/dist/components/Tabs/Tab.js +17 -3
- package/dist/components/Tabs/Tab.js.map +1 -1
- package/dist/components/Tabs/Tabs.cjs +8 -3
- package/dist/components/Tabs/Tabs.d.cts +9 -1
- package/dist/components/Tabs/Tabs.d.cts.map +1 -1
- package/dist/components/Tabs/Tabs.d.ts +9 -1
- package/dist/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/components/Tabs/Tabs.js +8 -3
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/components/Tabs/tabsContexts.d.cts +2 -0
- package/dist/components/Tabs/tabsContexts.d.cts.map +1 -1
- package/dist/components/Tabs/tabsContexts.d.ts +2 -0
- package/dist/components/Tabs/tabsContexts.d.ts.map +1 -1
- package/dist/components/Tabs/tabsContexts.js.map +1 -1
- package/dist/components/Text.cjs +9 -1
- package/dist/components/Text.d.cts +11 -2
- package/dist/components/Text.d.cts.map +1 -1
- package/dist/components/Text.d.ts +11 -2
- package/dist/components/Text.d.ts.map +1 -1
- package/dist/components/Text.js +9 -1
- package/dist/components/Text.js.map +1 -1
- package/dist/components/UDSProvider.cjs +6 -2
- package/dist/components/UDSProvider.d.cts +9 -0
- package/dist/components/UDSProvider.d.cts.map +1 -1
- package/dist/components/UDSProvider.d.ts +9 -0
- package/dist/components/UDSProvider.d.ts.map +1 -1
- package/dist/components/UDSProvider.js +6 -2
- package/dist/components/UDSProvider.js.map +1 -1
- package/dist/components/internal/Overlay/index.cjs +1 -1
- package/dist/components/internal/Overlay/index.js +1 -1
- package/dist/fontScaling/FontScalingContext.cjs +67 -0
- package/dist/fontScaling/FontScalingContext.d.cts +53 -0
- package/dist/fontScaling/FontScalingContext.d.cts.map +1 -0
- package/dist/fontScaling/FontScalingContext.d.ts +53 -0
- package/dist/fontScaling/FontScalingContext.d.ts.map +1 -0
- package/dist/fontScaling/FontScalingContext.js +63 -0
- package/dist/fontScaling/FontScalingContext.js.map +1 -0
- package/dist/fontScaling/androidNonlinearFontScaling.cjs +250 -0
- package/dist/fontScaling/androidNonlinearFontScaling.d.cts +7 -0
- package/dist/fontScaling/androidNonlinearFontScaling.d.cts.map +1 -0
- package/dist/fontScaling/androidNonlinearFontScaling.d.ts +7 -0
- package/dist/fontScaling/androidNonlinearFontScaling.d.ts.map +1 -0
- package/dist/fontScaling/androidNonlinearFontScaling.js +251 -0
- package/dist/fontScaling/androidNonlinearFontScaling.js.map +1 -0
- package/dist/fontScaling/constants.cjs +106 -0
- package/dist/fontScaling/constants.d.cts +60 -0
- package/dist/fontScaling/constants.d.cts.map +1 -0
- package/dist/fontScaling/constants.d.ts +60 -0
- package/dist/fontScaling/constants.d.ts.map +1 -0
- package/dist/fontScaling/constants.js +103 -0
- package/dist/fontScaling/constants.js.map +1 -0
- package/dist/fontScaling/index.cjs +14 -0
- package/dist/fontScaling/index.d.cts +8 -0
- package/dist/fontScaling/index.d.ts +8 -0
- package/dist/fontScaling/index.js +6 -0
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.cjs +37 -0
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.d.cts +35 -0
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.d.cts.map +1 -0
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.d.ts +35 -0
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.d.ts.map +1 -0
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.js +38 -0
- package/dist/fontScaling/resolveMaxFontSizeMultiplier.js.map +1 -0
- package/dist/fontScaling/types.cjs +1 -0
- package/dist/fontScaling/types.d.cts +54 -0
- package/dist/fontScaling/types.d.cts.map +1 -0
- package/dist/fontScaling/types.d.ts +54 -0
- package/dist/fontScaling/types.d.ts.map +1 -0
- package/dist/fontScaling/types.js +1 -0
- package/dist/fontScaling/useFontScale.cjs +58 -0
- package/dist/fontScaling/useFontScale.d.cts +12 -0
- package/dist/fontScaling/useFontScale.d.cts.map +1 -0
- package/dist/fontScaling/useFontScale.d.ts +12 -0
- package/dist/fontScaling/useFontScale.d.ts.map +1 -0
- package/dist/fontScaling/useFontScale.js +57 -0
- package/dist/fontScaling/useFontScale.js.map +1 -0
- package/dist/fontScaling/useMaxFontSizeMultiplier.cjs +24 -0
- package/dist/fontScaling/useMaxFontSizeMultiplier.d.cts +16 -0
- package/dist/fontScaling/useMaxFontSizeMultiplier.d.cts.map +1 -0
- package/dist/fontScaling/useMaxFontSizeMultiplier.d.ts +16 -0
- package/dist/fontScaling/useMaxFontSizeMultiplier.d.ts.map +1 -0
- package/dist/fontScaling/useMaxFontSizeMultiplier.js +24 -0
- package/dist/fontScaling/useMaxFontSizeMultiplier.js.map +1 -0
- package/dist/jest/mocks/react-native.cjs +19 -4
- package/dist/jest/mocks/react-native.d.cts +8 -5
- package/dist/jest/mocks/react-native.d.cts.map +1 -1
- package/dist/jest/mocks/react-native.d.ts +8 -5
- package/dist/jest/mocks/react-native.d.ts.map +1 -1
- package/dist/jest/mocks/react-native.js +18 -5
- package/dist/jest/mocks/react-native.js.map +1 -1
- package/dist/jest/mocks/styles.cjs +28 -1
- package/dist/jest/mocks/styles.d.cts.map +1 -1
- package/dist/jest/mocks/styles.d.ts.map +1 -1
- package/dist/jest/mocks/styles.js +28 -1
- package/dist/jest/mocks/styles.js.map +1 -1
- package/dist/jest/setup.cjs +4 -0
- package/dist/jest/setup.d.cts.map +1 -1
- package/dist/jest/setup.d.ts.map +1 -1
- package/dist/jest/setup.js +4 -0
- package/dist/jest/setup.js.map +1 -1
- package/dist/mobile/generated/fontMetrics.cjs +530 -530
- package/dist/mobile/generated/fontMetrics.js +530 -530
- package/dist/mobile/generated/fontMetrics.js.map +1 -1
- package/dist/portal.cjs +8 -2
- package/dist/portal.d.cts.map +1 -1
- package/dist/portal.d.ts.map +1 -1
- package/dist/portal.js +8 -2
- package/dist/portal.js.map +1 -1
- package/dist/types/dist/index.d.cts.map +1 -1
- package/dist/types/dist/index.d.ts.map +1 -1
- package/fonts/index.cjs +214 -214
- package/fonts/index.mjs +214 -214
- package/fonts/uds-icons.ttf +0 -0
- package/generated/fontMetrics.ts +530 -530
- package/generated/styles.d.ts +5 -28
- package/generated/unistyles.d.ts +0 -27
- package/package.json +11 -1
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
require("../../_virtual/_rolldown/runtime.cjs");
|
|
4
4
|
const require_components_Box = require("../Box.cjs");
|
|
5
|
+
const require_fontScaling_useMaxFontSizeMultiplier = require("../../fontScaling/useMaxFontSizeMultiplier.cjs");
|
|
6
|
+
const require_components_Avatar_useAvatarFontScale = require("./useAvatarFontScale.cjs");
|
|
5
7
|
const require_components_Avatar_utils = require("./utils.cjs");
|
|
6
8
|
const require_components_Avatar_AvatarIcon = require("./AvatarIcon.cjs");
|
|
7
9
|
const require_components_Avatar_AvatarText = require("./AvatarText.cjs");
|
|
@@ -10,21 +12,24 @@ let react_native = require("react-native");
|
|
|
10
12
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
13
|
let generated_styles = require("../../../generated/styles");
|
|
12
14
|
//#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 }) {
|
|
15
|
+
const AvatarImage = (0, react.memo)(function AvatarImage({ size = "md", variant = require_components_Avatar_utils.DEFAULT_AVATAR_VARIANT, src, alt, fallback, icon, abbreviationStrategy, customSize, maxFontSizeMultiplier, style, accessibilityLabel, ref, ...viewProps }) {
|
|
16
|
+
const resolvedMaxFontSizeMultiplier = require_fontScaling_useMaxFontSizeMultiplier.useMaxFontSizeMultiplier("control", maxFontSizeMultiplier);
|
|
14
17
|
const [imageError, setImageError] = (0, react.useState)(false);
|
|
15
18
|
const shouldShowImage = Boolean(src) && !imageError;
|
|
16
19
|
generated_styles.avatarStyles.useVariants({
|
|
17
20
|
size,
|
|
18
21
|
image: variant
|
|
19
22
|
});
|
|
23
|
+
const fontScaleFactor = require_components_Avatar_useAvatarFontScale.useAvatarFontScale(resolvedMaxFontSizeMultiplier);
|
|
20
24
|
const rootStyle = (0, react.useMemo)(() => [
|
|
21
25
|
generated_styles.avatarStyles.root,
|
|
22
26
|
avatarStaticStyles.root,
|
|
23
|
-
require_components_Avatar_utils.
|
|
27
|
+
require_components_Avatar_utils.getAvatarSizeStyle(generated_styles.avatarStyles.root, customSize, fontScaleFactor),
|
|
24
28
|
style
|
|
25
29
|
], [
|
|
26
30
|
generated_styles.avatarStyles.root,
|
|
27
31
|
customSize,
|
|
32
|
+
fontScaleFactor,
|
|
28
33
|
style
|
|
29
34
|
]);
|
|
30
35
|
if (!shouldShowImage) {
|
|
@@ -36,6 +41,7 @@ const AvatarImage = (0, react.memo)(function AvatarImage({ size = "md", variant
|
|
|
36
41
|
initials: fallback,
|
|
37
42
|
abbreviationStrategy,
|
|
38
43
|
customSize,
|
|
44
|
+
maxFontSizeMultiplier: resolvedMaxFontSizeMultiplier,
|
|
39
45
|
accessibilityLabel: accessibilityLabel ?? alt ?? fallback,
|
|
40
46
|
style,
|
|
41
47
|
...viewProps
|
|
@@ -46,6 +52,7 @@ const AvatarImage = (0, react.memo)(function AvatarImage({ size = "md", variant
|
|
|
46
52
|
variant,
|
|
47
53
|
icon,
|
|
48
54
|
customSize,
|
|
55
|
+
maxFontSizeMultiplier: resolvedMaxFontSizeMultiplier,
|
|
49
56
|
accessibilityLabel: accessibilityLabel ?? alt,
|
|
50
57
|
style,
|
|
51
58
|
...viewProps
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarImage.d.cts","names":[],"sources":["../../../src/components/Avatar/AvatarImage.tsx"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"AvatarImage.d.cts","names":[],"sources":["../../../src/components/Avatar/AvatarImage.tsx"],"mappings":";;;;;cAYM,WAAA,EAAW,OAAA,CAAA,oBAAA,CAAA,gBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarImage.d.ts","names":[],"sources":["../../../src/components/Avatar/AvatarImage.tsx"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"AvatarImage.d.ts","names":[],"sources":["../../../src/components/Avatar/AvatarImage.tsx"],"mappings":";;;;;cAYM,WAAA,EAAW,OAAA,CAAA,oBAAA,CAAA,gBAAA"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
2
|
import { Box } from "../Box.js";
|
|
3
|
-
import {
|
|
3
|
+
import { useMaxFontSizeMultiplier } from "../../fontScaling/useMaxFontSizeMultiplier.js";
|
|
4
|
+
import { useAvatarFontScale } from "./useAvatarFontScale.js";
|
|
5
|
+
import { DEFAULT_AVATAR_VARIANT, getAvatarSizeStyle } from "./utils.js";
|
|
4
6
|
import { AvatarIcon } from "./AvatarIcon.js";
|
|
5
7
|
import { AvatarText } from "./AvatarText.js";
|
|
6
8
|
import { memo, useMemo, useState } from "react";
|
|
@@ -8,21 +10,24 @@ import { Image, StyleSheet } from "react-native";
|
|
|
8
10
|
import { jsx } from "react/jsx-runtime";
|
|
9
11
|
import { avatarStyles } from "../../../generated/styles";
|
|
10
12
|
//#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 }) {
|
|
13
|
+
const AvatarImage = memo(function AvatarImage({ size = "md", variant = DEFAULT_AVATAR_VARIANT, src, alt, fallback, icon, abbreviationStrategy, customSize, maxFontSizeMultiplier, style, accessibilityLabel, ref, ...viewProps }) {
|
|
14
|
+
const resolvedMaxFontSizeMultiplier = useMaxFontSizeMultiplier("control", maxFontSizeMultiplier);
|
|
12
15
|
const [imageError, setImageError] = useState(false);
|
|
13
16
|
const shouldShowImage = Boolean(src) && !imageError;
|
|
14
17
|
avatarStyles.useVariants({
|
|
15
18
|
size,
|
|
16
19
|
image: variant
|
|
17
20
|
});
|
|
21
|
+
const fontScaleFactor = useAvatarFontScale(resolvedMaxFontSizeMultiplier);
|
|
18
22
|
const rootStyle = useMemo(() => [
|
|
19
23
|
avatarStyles.root,
|
|
20
24
|
avatarStaticStyles.root,
|
|
21
|
-
|
|
25
|
+
getAvatarSizeStyle(avatarStyles.root, customSize, fontScaleFactor),
|
|
22
26
|
style
|
|
23
27
|
], [
|
|
24
28
|
avatarStyles.root,
|
|
25
29
|
customSize,
|
|
30
|
+
fontScaleFactor,
|
|
26
31
|
style
|
|
27
32
|
]);
|
|
28
33
|
if (!shouldShowImage) {
|
|
@@ -34,6 +39,7 @@ const AvatarImage = memo(function AvatarImage({ size = "md", variant = DEFAULT_A
|
|
|
34
39
|
initials: fallback,
|
|
35
40
|
abbreviationStrategy,
|
|
36
41
|
customSize,
|
|
42
|
+
maxFontSizeMultiplier: resolvedMaxFontSizeMultiplier,
|
|
37
43
|
accessibilityLabel: accessibilityLabel ?? alt ?? fallback,
|
|
38
44
|
style,
|
|
39
45
|
...viewProps
|
|
@@ -44,6 +50,7 @@ const AvatarImage = memo(function AvatarImage({ size = "md", variant = DEFAULT_A
|
|
|
44
50
|
variant,
|
|
45
51
|
icon,
|
|
46
52
|
customSize,
|
|
53
|
+
maxFontSizeMultiplier: resolvedMaxFontSizeMultiplier,
|
|
47
54
|
accessibilityLabel: accessibilityLabel ?? alt,
|
|
48
55
|
style,
|
|
49
56
|
...viewProps
|
|
@@ -1 +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,
|
|
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 { useMaxFontSizeMultiplier } from '../../fontScaling/useMaxFontSizeMultiplier';\nimport { Box } from '../Box';\nimport { AvatarIcon } from './AvatarIcon';\nimport { AvatarText } from './AvatarText';\nimport type { AvatarImageProps } from './types';\nimport { useAvatarFontScale } from './useAvatarFontScale';\nimport { DEFAULT_AVATAR_SIZE, DEFAULT_AVATAR_VARIANT, getAvatarSizeStyle } 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 maxFontSizeMultiplier,\n style,\n accessibilityLabel,\n ref,\n ...viewProps\n}: AvatarImageProps) {\n const resolvedMaxFontSizeMultiplier = useMaxFontSizeMultiplier('control', maxFontSizeMultiplier);\n const [imageError, setImageError] = useState(false);\n const shouldShowImage = Boolean(src) && !imageError;\n\n avatarStyles.useVariants({ size, image: variant });\n const fontScaleFactor = useAvatarFontScale(resolvedMaxFontSizeMultiplier);\n\n const rootStyle = useMemo(\n () => [\n avatarStyles.root,\n avatarStaticStyles.root,\n getAvatarSizeStyle(avatarStyles.root, customSize, fontScaleFactor),\n style,\n ],\n [avatarStyles.root, customSize, fontScaleFactor, 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 maxFontSizeMultiplier={resolvedMaxFontSizeMultiplier}\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 maxFontSizeMultiplier={resolvedMaxFontSizeMultiplier}\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":";;;;;;;;;;;;AAYA,MAAM,cAAc,KAAK,SAAS,YAAY,EAC5C,OAAA,MACA,UAAU,wBACV,KACA,KACA,UACA,MACA,sBACA,YACA,uBACA,OACA,oBACA,KACA,GAAG,aACgB;CACnB,MAAM,gCAAgC,yBAAyB,WAAW,sBAAsB;CAChG,MAAM,CAAC,YAAY,iBAAiB,SAAS,MAAM;CACnD,MAAM,kBAAkB,QAAQ,IAAI,IAAI,CAAC;CAEzC,aAAa,YAAY;EAAE;EAAM,OAAO;EAAS,CAAC;CAClD,MAAM,kBAAkB,mBAAmB,8BAA8B;CAEzE,MAAM,YAAY,cACV;EACJ,aAAa;EACb,mBAAmB;EACnB,mBAAmB,aAAa,MAAM,YAAY,gBAAgB;EAClE;EACD,EACD;EAAC,aAAa;EAAM;EAAY;EAAiB;EAAM,CACxD;CAED,IAAI,CAAC,iBAAiB;EACpB,IAAI,YAAY,KACd,OACE,oBAAC,YAAD;GACO;GACC;GACG;GACT,MAAM;GACN,UAAU;GACY;GACV;GACZ,uBAAuB;GACvB,oBAAoB,sBAAsB,OAAO;GAC1C;GACP,GAAI;GACJ,CAAA;EAIN,OACE,oBAAC,YAAD;GACO;GACC;GACG;GACH;GACM;GACZ,uBAAuB;GACvB,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"}
|
|
@@ -2,26 +2,31 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
require("../../_virtual/_rolldown/runtime.cjs");
|
|
4
4
|
const require_components_Box = require("../Box.cjs");
|
|
5
|
+
const require_fontScaling_useMaxFontSizeMultiplier = require("../../fontScaling/useMaxFontSizeMultiplier.cjs");
|
|
5
6
|
const require_components_Text = require("../Text.cjs");
|
|
7
|
+
const require_components_Avatar_useAvatarFontScale = require("./useAvatarFontScale.cjs");
|
|
6
8
|
const require_components_Avatar_utils = require("./utils.cjs");
|
|
7
9
|
let react = require("react");
|
|
8
10
|
let react_native = require("react-native");
|
|
9
11
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
12
|
let generated_styles = require("../../../generated/styles");
|
|
11
13
|
//#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 }) {
|
|
14
|
+
const AvatarText = (0, react.memo)(function AvatarText({ size = "md", variant = require_components_Avatar_utils.DEFAULT_AVATAR_VARIANT, name, initials, abbreviationStrategy, customSize, maxFontSizeMultiplier, style, accessibilityLabel, ref, ...viewProps }) {
|
|
15
|
+
const resolvedMaxFontSizeMultiplier = require_fontScaling_useMaxFontSizeMultiplier.useMaxFontSizeMultiplier("control", maxFontSizeMultiplier);
|
|
13
16
|
generated_styles.avatarStyles.useVariants({
|
|
14
17
|
size,
|
|
15
18
|
text: variant
|
|
16
19
|
});
|
|
20
|
+
const fontScaleFactor = require_components_Avatar_useAvatarFontScale.useAvatarFontScale(resolvedMaxFontSizeMultiplier);
|
|
17
21
|
const rootStyle = (0, react.useMemo)(() => [
|
|
18
22
|
generated_styles.avatarStyles.root,
|
|
19
23
|
avatarStaticStyles.root,
|
|
20
|
-
require_components_Avatar_utils.
|
|
24
|
+
require_components_Avatar_utils.getAvatarSizeStyle(generated_styles.avatarStyles.root, customSize, fontScaleFactor),
|
|
21
25
|
style
|
|
22
26
|
], [
|
|
23
27
|
generated_styles.avatarStyles.root,
|
|
24
28
|
customSize,
|
|
29
|
+
fontScaleFactor,
|
|
25
30
|
style
|
|
26
31
|
]);
|
|
27
32
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Box.Box, {
|
|
@@ -34,6 +39,7 @@ const AvatarText = (0, react.memo)(function AvatarText({ size = "md", variant =
|
|
|
34
39
|
color: "inherit",
|
|
35
40
|
variant: "inherit",
|
|
36
41
|
numberOfLines: 1,
|
|
42
|
+
maxFontSizeMultiplier: resolvedMaxFontSizeMultiplier,
|
|
37
43
|
style: generated_styles.avatarStyles.text,
|
|
38
44
|
children: initials || require_components_Avatar_utils.generateAvatarAbbreviation(name, abbreviationStrategy)
|
|
39
45
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarText.d.cts","names":[],"sources":["../../../src/components/Avatar/AvatarText.tsx"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"AvatarText.d.cts","names":[],"sources":["../../../src/components/Avatar/AvatarText.tsx"],"mappings":";;;;;cAgBM,UAAA,EAAU,OAAA,CAAA,oBAAA,CAAA,eAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarText.d.ts","names":[],"sources":["../../../src/components/Avatar/AvatarText.tsx"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"AvatarText.d.ts","names":[],"sources":["../../../src/components/Avatar/AvatarText.tsx"],"mappings":";;;;;cAgBM,UAAA,EAAU,OAAA,CAAA,oBAAA,CAAA,eAAA"}
|
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
2
|
import { Box } from "../Box.js";
|
|
3
|
+
import { useMaxFontSizeMultiplier } from "../../fontScaling/useMaxFontSizeMultiplier.js";
|
|
3
4
|
import { Text as Text$1 } from "../Text.js";
|
|
4
|
-
import {
|
|
5
|
+
import { useAvatarFontScale } from "./useAvatarFontScale.js";
|
|
6
|
+
import { DEFAULT_AVATAR_VARIANT, generateAvatarAbbreviation, getAvatarSizeStyle } from "./utils.js";
|
|
5
7
|
import { memo, useMemo } from "react";
|
|
6
8
|
import { StyleSheet } from "react-native";
|
|
7
9
|
import { jsx } from "react/jsx-runtime";
|
|
8
10
|
import { avatarStyles } from "../../../generated/styles";
|
|
9
11
|
//#region src/components/Avatar/AvatarText.tsx
|
|
10
|
-
const AvatarText = memo(function AvatarText({ size = "md", variant = DEFAULT_AVATAR_VARIANT, name, initials, abbreviationStrategy, customSize, style, accessibilityLabel, ref, ...viewProps }) {
|
|
12
|
+
const AvatarText = memo(function AvatarText({ size = "md", variant = DEFAULT_AVATAR_VARIANT, name, initials, abbreviationStrategy, customSize, maxFontSizeMultiplier, style, accessibilityLabel, ref, ...viewProps }) {
|
|
13
|
+
const resolvedMaxFontSizeMultiplier = useMaxFontSizeMultiplier("control", maxFontSizeMultiplier);
|
|
11
14
|
avatarStyles.useVariants({
|
|
12
15
|
size,
|
|
13
16
|
text: variant
|
|
14
17
|
});
|
|
18
|
+
const fontScaleFactor = useAvatarFontScale(resolvedMaxFontSizeMultiplier);
|
|
15
19
|
const rootStyle = useMemo(() => [
|
|
16
20
|
avatarStyles.root,
|
|
17
21
|
avatarStaticStyles.root,
|
|
18
|
-
|
|
22
|
+
getAvatarSizeStyle(avatarStyles.root, customSize, fontScaleFactor),
|
|
19
23
|
style
|
|
20
24
|
], [
|
|
21
25
|
avatarStyles.root,
|
|
22
26
|
customSize,
|
|
27
|
+
fontScaleFactor,
|
|
23
28
|
style
|
|
24
29
|
]);
|
|
25
30
|
return /* @__PURE__ */ jsx(Box, {
|
|
@@ -32,6 +37,7 @@ const AvatarText = memo(function AvatarText({ size = "md", variant = DEFAULT_AVA
|
|
|
32
37
|
color: "inherit",
|
|
33
38
|
variant: "inherit",
|
|
34
39
|
numberOfLines: 1,
|
|
40
|
+
maxFontSizeMultiplier: resolvedMaxFontSizeMultiplier,
|
|
35
41
|
style: avatarStyles.text,
|
|
36
42
|
children: initials || generateAvatarAbbreviation(name, abbreviationStrategy)
|
|
37
43
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarText.js","names":["Text"],"sources":["../../../src/components/Avatar/AvatarText.tsx"],"sourcesContent":["import { memo, useMemo } from 'react';\nimport { StyleSheet } from 'react-native';\n\nimport { avatarStyles } from '../../../generated/styles';\nimport { Box } from '../Box';\nimport { Text } from '../Text';\nimport type { AvatarTextProps } from './types';\nimport {\n DEFAULT_AVATAR_SIZE,\n DEFAULT_AVATAR_VARIANT,\n generateAvatarAbbreviation,\n
|
|
1
|
+
{"version":3,"file":"AvatarText.js","names":["Text"],"sources":["../../../src/components/Avatar/AvatarText.tsx"],"sourcesContent":["import { memo, useMemo } from 'react';\nimport { StyleSheet } from 'react-native';\n\nimport { avatarStyles } from '../../../generated/styles';\nimport { useMaxFontSizeMultiplier } from '../../fontScaling/useMaxFontSizeMultiplier';\nimport { Box } from '../Box';\nimport { Text } from '../Text';\nimport type { AvatarTextProps } from './types';\nimport { useAvatarFontScale } from './useAvatarFontScale';\nimport {\n DEFAULT_AVATAR_SIZE,\n DEFAULT_AVATAR_VARIANT,\n generateAvatarAbbreviation,\n getAvatarSizeStyle,\n} from './utils';\n\nconst AvatarText = memo(function AvatarText({\n size = DEFAULT_AVATAR_SIZE,\n variant = DEFAULT_AVATAR_VARIANT,\n name,\n initials,\n abbreviationStrategy,\n customSize,\n maxFontSizeMultiplier,\n style,\n accessibilityLabel,\n ref,\n ...viewProps\n}: AvatarTextProps) {\n const resolvedMaxFontSizeMultiplier = useMaxFontSizeMultiplier('control', maxFontSizeMultiplier);\n avatarStyles.useVariants({ size, text: variant });\n const fontScaleFactor = useAvatarFontScale(resolvedMaxFontSizeMultiplier);\n\n const rootStyle = useMemo(\n () => [\n avatarStyles.root,\n avatarStaticStyles.root,\n getAvatarSizeStyle(avatarStyles.root, customSize, fontScaleFactor),\n style,\n ],\n [avatarStyles.root, customSize, fontScaleFactor, style],\n );\n\n return (\n <Box\n ref={ref}\n accessibilityRole=\"image\"\n accessibilityLabel={accessibilityLabel ?? name ?? initials}\n {...viewProps}\n style={rootStyle}\n >\n <Text\n color=\"inherit\"\n variant=\"inherit\"\n numberOfLines={1}\n maxFontSizeMultiplier={resolvedMaxFontSizeMultiplier}\n style={avatarStyles.text}\n >\n {initials || generateAvatarAbbreviation(name, abbreviationStrategy)}\n </Text>\n </Box>\n );\n});\n\nAvatarText.displayName = 'AvatarText';\n\nconst avatarStaticStyles = StyleSheet.create({\n root: {\n alignItems: 'center',\n justifyContent: 'center',\n overflow: 'hidden',\n },\n});\n\nexport { AvatarText };\n"],"mappings":";;;;;;;;;;;AAgBA,MAAM,aAAa,KAAK,SAAS,WAAW,EAC1C,OAAA,MACA,UAAU,wBACV,MACA,UACA,sBACA,YACA,uBACA,OACA,oBACA,KACA,GAAG,aACe;CAClB,MAAM,gCAAgC,yBAAyB,WAAW,sBAAsB;CAChG,aAAa,YAAY;EAAE;EAAM,MAAM;EAAS,CAAC;CACjD,MAAM,kBAAkB,mBAAmB,8BAA8B;CAEzE,MAAM,YAAY,cACV;EACJ,aAAa;EACb,mBAAmB;EACnB,mBAAmB,aAAa,MAAM,YAAY,gBAAgB;EAClE;EACD,EACD;EAAC,aAAa;EAAM;EAAY;EAAiB;EAAM,CACxD;CAED,OACE,oBAAC,KAAD;EACO;EACL,mBAAkB;EAClB,oBAAoB,sBAAsB,QAAQ;EAClD,GAAI;EACJ,OAAO;YAEP,oBAACA,QAAD;GACE,OAAM;GACN,SAAQ;GACR,eAAe;GACf,uBAAuB;GACvB,OAAO,aAAa;aAEnB,YAAY,2BAA2B,MAAM,qBAAqB;GAC9D,CAAA;EACH,CAAA;EAER;AAEF,WAAW,cAAc;AAEzB,MAAM,qBAAqB,WAAW,OAAO,EAC3C,MAAM;CACJ,YAAY;CACZ,gBAAgB;CAChB,UAAU;CACX,EACF,CAAC"}
|
|
@@ -5,17 +5,21 @@ import { Ref } from "react";
|
|
|
5
5
|
import { View, ViewProps } from "react-native";
|
|
6
6
|
|
|
7
7
|
//#region src/components/Avatar/types.d.ts
|
|
8
|
-
interface
|
|
8
|
+
interface AvatarFontScalingProps {
|
|
9
|
+
/** Caps avatar content and geometry at the control scale. Set null to remove the cap. @default 2 */
|
|
10
|
+
maxFontSizeMultiplier?: number | null;
|
|
11
|
+
}
|
|
12
|
+
interface AvatarImageProps extends Omit<ViewProps, 'children'>, Omit<UniversalAvatarImageProps, 'className' | 'srcSet'>, AvatarFontScalingProps {
|
|
9
13
|
/** Ref to the underlying View. */
|
|
10
14
|
ref?: Ref<View>;
|
|
11
15
|
/** Custom icon to display if the image fails and no text fallback is available. */
|
|
12
16
|
icon?: IconSlotType;
|
|
13
17
|
}
|
|
14
|
-
interface AvatarTextProps extends Omit<ViewProps, 'children'>, Omit<UniversalAvatarTextProps, 'className'
|
|
18
|
+
interface AvatarTextProps extends Omit<ViewProps, 'children'>, Omit<UniversalAvatarTextProps, 'className'>, AvatarFontScalingProps {
|
|
15
19
|
/** Ref to the underlying View. */
|
|
16
20
|
ref?: Ref<View>;
|
|
17
21
|
}
|
|
18
|
-
interface AvatarIconProps extends Omit<ViewProps, 'children'>, Omit<UniversalAvatarIconProps<IconSlotType>, 'className'
|
|
22
|
+
interface AvatarIconProps extends Omit<ViewProps, 'children'>, Omit<UniversalAvatarIconProps<IconSlotType>, 'className'>, AvatarFontScalingProps {
|
|
19
23
|
/** Ref to the underlying View. */
|
|
20
24
|
ref?: Ref<View>;
|
|
21
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","names":[],"sources":["../../../src/components/Avatar/types.ts"],"mappings":";;;;;;;UAaU,gBAAA,
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../../../src/components/Avatar/types.ts"],"mappings":";;;;;;;UAaU,sBAAA;;EAER,qBAAA;AAAA;AAAA,UAGQ,gBAAA,SAEN,IAAA,CAAK,SAAA,eACL,IAAA,CAAK,yBAAA,2BACL,sBAAA;EAPF;EASA,GAAA,GAAM,GAAA,CAAI,IAAA;EANF;EAQR,IAAA,GAAO,YAAA;AAAA;AAAA,UAGC,eAAA,SAEN,IAAA,CAAK,SAAA,eACL,IAAA,CAAK,wBAAA,gBACL,sBAAA;EAZK;EAcP,GAAA,GAAM,GAAA,CAAI,IAAA;AAAA;AAAA,UAGF,eAAA,SAEN,IAAA,CAAK,SAAA,eACL,IAAA,CAAK,wBAAA,CAAyB,YAAA,iBAC9B,sBAAA;EAtBA;EAwBF,GAAA,GAAM,GAAA,CAAI,IAAA;AAAA;AAAA,UAGF,WAAA,SAAoB,IAAA,CAAK,gBAAA;EAzBT;EA2BxB,GAAA;AAAA"}
|
|
@@ -5,17 +5,21 @@ import { Ref } from "react";
|
|
|
5
5
|
import { View, ViewProps } from "react-native";
|
|
6
6
|
|
|
7
7
|
//#region src/components/Avatar/types.d.ts
|
|
8
|
-
interface
|
|
8
|
+
interface AvatarFontScalingProps {
|
|
9
|
+
/** Caps avatar content and geometry at the control scale. Set null to remove the cap. @default 2 */
|
|
10
|
+
maxFontSizeMultiplier?: number | null;
|
|
11
|
+
}
|
|
12
|
+
interface AvatarImageProps extends Omit<ViewProps, 'children'>, Omit<UniversalAvatarImageProps, 'className' | 'srcSet'>, AvatarFontScalingProps {
|
|
9
13
|
/** Ref to the underlying View. */
|
|
10
14
|
ref?: Ref<View>;
|
|
11
15
|
/** Custom icon to display if the image fails and no text fallback is available. */
|
|
12
16
|
icon?: IconSlotType;
|
|
13
17
|
}
|
|
14
|
-
interface AvatarTextProps extends Omit<ViewProps, 'children'>, Omit<UniversalAvatarTextProps, 'className'
|
|
18
|
+
interface AvatarTextProps extends Omit<ViewProps, 'children'>, Omit<UniversalAvatarTextProps, 'className'>, AvatarFontScalingProps {
|
|
15
19
|
/** Ref to the underlying View. */
|
|
16
20
|
ref?: Ref<View>;
|
|
17
21
|
}
|
|
18
|
-
interface AvatarIconProps extends Omit<ViewProps, 'children'>, Omit<UniversalAvatarIconProps<IconSlotType>, 'className'
|
|
22
|
+
interface AvatarIconProps extends Omit<ViewProps, 'children'>, Omit<UniversalAvatarIconProps<IconSlotType>, 'className'>, AvatarFontScalingProps {
|
|
19
23
|
/** Ref to the underlying View. */
|
|
20
24
|
ref?: Ref<View>;
|
|
21
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/components/Avatar/types.ts"],"mappings":";;;;;;;UAaU,gBAAA,
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/components/Avatar/types.ts"],"mappings":";;;;;;;UAaU,sBAAA;;EAER,qBAAA;AAAA;AAAA,UAGQ,gBAAA,SAEN,IAAA,CAAK,SAAA,eACL,IAAA,CAAK,yBAAA,2BACL,sBAAA;EAPF;EASA,GAAA,GAAM,GAAA,CAAI,IAAA;EANF;EAQR,IAAA,GAAO,YAAA;AAAA;AAAA,UAGC,eAAA,SAEN,IAAA,CAAK,SAAA,eACL,IAAA,CAAK,wBAAA,gBACL,sBAAA;EAZK;EAcP,GAAA,GAAM,GAAA,CAAI,IAAA;AAAA;AAAA,UAGF,eAAA,SAEN,IAAA,CAAK,SAAA,eACL,IAAA,CAAK,wBAAA,CAAyB,YAAA,iBAC9B,sBAAA;EAtBA;EAwBF,GAAA,GAAM,GAAA,CAAI,IAAA;AAAA;AAAA,UAGF,WAAA,SAAoB,IAAA,CAAK,gBAAA;EAzBT;EA2BxB,GAAA;AAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
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_fontScaling_useFontScale = require("../../fontScaling/useFontScale.cjs");
|
|
5
|
+
let generated_styles = require("../../../generated/styles");
|
|
6
|
+
//#region src/components/Avatar/useAvatarFontScale.ts
|
|
7
|
+
/** Keep every avatar content type on one size-aware scale that contains text and icons. */
|
|
8
|
+
function useAvatarFontScale(maxFontSizeMultiplier) {
|
|
9
|
+
const textStyle = generated_styles.avatarStyles.text;
|
|
10
|
+
const iconStyle = generated_styles.avatarStyles.icon;
|
|
11
|
+
const textScaleFactor = require_fontScaling_useFontScale.useComponentFontScale(maxFontSizeMultiplier, (typeof textStyle.lineHeight === "number" ? textStyle.lineHeight : void 0) ?? (typeof textStyle.fontSize === "number" ? textStyle.fontSize : void 0));
|
|
12
|
+
const iconScaleFactor = require_fontScaling_useFontScale.useComponentFontScale(maxFontSizeMultiplier, (typeof iconStyle.fontSize === "number" ? iconStyle.fontSize : void 0) ?? (typeof iconStyle.lineHeight === "number" ? iconStyle.lineHeight : void 0));
|
|
13
|
+
return Math.max(textScaleFactor, iconScaleFactor);
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
exports.useAvatarFontScale = useAvatarFontScale;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/components/Avatar/useAvatarFontScale.d.ts
|
|
3
|
+
/** Keep every avatar content type on one size-aware scale that contains text and icons. */
|
|
4
|
+
declare function useAvatarFontScale(maxFontSizeMultiplier?: number): number;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { useAvatarFontScale };
|
|
7
|
+
//# sourceMappingURL=useAvatarFontScale.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAvatarFontScale.d.cts","names":[],"sources":["../../../src/components/Avatar/useAvatarFontScale.ts"],"mappings":";;;iBAMS,kBAAA,CAAmB,qBAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/components/Avatar/useAvatarFontScale.d.ts
|
|
3
|
+
/** Keep every avatar content type on one size-aware scale that contains text and icons. */
|
|
4
|
+
declare function useAvatarFontScale(maxFontSizeMultiplier?: number): number;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { useAvatarFontScale };
|
|
7
|
+
//# sourceMappingURL=useAvatarFontScale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAvatarFontScale.d.ts","names":[],"sources":["../../../src/components/Avatar/useAvatarFontScale.ts"],"mappings":";;;iBAMS,kBAAA,CAAmB,qBAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
import { useComponentFontScale } from "../../fontScaling/useFontScale.js";
|
|
3
|
+
import { avatarStyles } from "../../../generated/styles";
|
|
4
|
+
//#region src/components/Avatar/useAvatarFontScale.ts
|
|
5
|
+
/** Keep every avatar content type on one size-aware scale that contains text and icons. */
|
|
6
|
+
function useAvatarFontScale(maxFontSizeMultiplier) {
|
|
7
|
+
const textStyle = avatarStyles.text;
|
|
8
|
+
const iconStyle = avatarStyles.icon;
|
|
9
|
+
const textScaleFactor = useComponentFontScale(maxFontSizeMultiplier, (typeof textStyle.lineHeight === "number" ? textStyle.lineHeight : void 0) ?? (typeof textStyle.fontSize === "number" ? textStyle.fontSize : void 0));
|
|
10
|
+
const iconScaleFactor = useComponentFontScale(maxFontSizeMultiplier, (typeof iconStyle.fontSize === "number" ? iconStyle.fontSize : void 0) ?? (typeof iconStyle.lineHeight === "number" ? iconStyle.lineHeight : void 0));
|
|
11
|
+
return Math.max(textScaleFactor, iconScaleFactor);
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { useAvatarFontScale };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=useAvatarFontScale.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAvatarFontScale.js","names":[],"sources":["../../../src/components/Avatar/useAvatarFontScale.ts"],"sourcesContent":["import type { TextStyle } from 'react-native';\n\nimport { avatarStyles } from '../../../generated/styles';\nimport { useComponentFontScale } from '../../fontScaling/useFontScale';\n\n/** Keep every avatar content type on one size-aware scale that contains text and icons. */\nfunction useAvatarFontScale(maxFontSizeMultiplier?: number): number {\n const textStyle = avatarStyles.text as TextStyle;\n const iconStyle = avatarStyles.icon as TextStyle;\n const textScaleFactor = useComponentFontScale(\n maxFontSizeMultiplier,\n (typeof textStyle.lineHeight === 'number' ? textStyle.lineHeight : undefined) ??\n (typeof textStyle.fontSize === 'number' ? textStyle.fontSize : undefined),\n );\n const iconScaleFactor = useComponentFontScale(\n maxFontSizeMultiplier,\n (typeof iconStyle.fontSize === 'number' ? iconStyle.fontSize : undefined) ??\n (typeof iconStyle.lineHeight === 'number' ? iconStyle.lineHeight : undefined),\n );\n\n return Math.max(textScaleFactor, iconScaleFactor);\n}\n\nexport { useAvatarFontScale };\n"],"mappings":";;;;;AAMA,SAAS,mBAAmB,uBAAwC;CAClE,MAAM,YAAY,aAAa;CAC/B,MAAM,YAAY,aAAa;CAC/B,MAAM,kBAAkB,sBACtB,wBACC,OAAO,UAAU,eAAe,WAAW,UAAU,aAAa,KAAA,OAChE,OAAO,UAAU,aAAa,WAAW,UAAU,WAAW,KAAA,GAClE;CACD,MAAM,kBAAkB,sBACtB,wBACC,OAAO,UAAU,aAAa,WAAW,UAAU,WAAW,KAAA,OAC5D,OAAO,UAAU,eAAe,WAAW,UAAU,aAAa,KAAA,GACtE;CAED,OAAO,KAAK,IAAI,iBAAiB,gBAAgB"}
|
|
@@ -21,11 +21,14 @@ function generateAvatarAbbreviation(name, strategy = "firstAndLast") {
|
|
|
21
21
|
const initials = name.trim().split(/\s+/).filter(Boolean).map((word) => word[0]?.toUpperCase() ?? "");
|
|
22
22
|
return abbreviationStrategies[strategy](initials);
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
function getAvatarSizeStyle(rootStyle, customSize, fontScaleFactor) {
|
|
25
|
+
if (customSize === void 0 && fontScaleFactor === 1) return;
|
|
26
|
+
const width = customSize ?? rootStyle.width;
|
|
27
|
+
const height = customSize ?? rootStyle.height;
|
|
28
|
+
return typeof width === "number" && typeof height === "number" ? {
|
|
29
|
+
width: Math.round(width * fontScaleFactor),
|
|
30
|
+
height: Math.round(height * fontScaleFactor)
|
|
31
|
+
} : void 0;
|
|
29
32
|
}
|
|
30
33
|
function getDefaultAvatarIcon(variant) {
|
|
31
34
|
return DEFAULT_AVATAR_ICON[variant];
|
|
@@ -34,5 +37,5 @@ function getDefaultAvatarIcon(variant) {
|
|
|
34
37
|
exports.DEFAULT_AVATAR_SIZE = DEFAULT_AVATAR_SIZE;
|
|
35
38
|
exports.DEFAULT_AVATAR_VARIANT = DEFAULT_AVATAR_VARIANT;
|
|
36
39
|
exports.generateAvatarAbbreviation = generateAvatarAbbreviation;
|
|
37
|
-
exports.
|
|
40
|
+
exports.getAvatarSizeStyle = getAvatarSizeStyle;
|
|
38
41
|
exports.getDefaultAvatarIcon = getDefaultAvatarIcon;
|
|
@@ -7,8 +7,8 @@ import { ViewStyle } from "react-native";
|
|
|
7
7
|
declare const DEFAULT_AVATAR_SIZE: AvatarSize;
|
|
8
8
|
declare const DEFAULT_AVATAR_VARIANT: AvatarVariant;
|
|
9
9
|
declare function generateAvatarAbbreviation(name?: string, strategy?: AvatarAbbreviationStrategy): string;
|
|
10
|
-
declare function
|
|
10
|
+
declare function getAvatarSizeStyle(rootStyle: ViewStyle, customSize: number | undefined, fontScaleFactor: number): ViewStyle | undefined;
|
|
11
11
|
declare function getDefaultAvatarIcon(variant: AvatarVariant): IconSlotType;
|
|
12
12
|
//#endregion
|
|
13
|
-
export { DEFAULT_AVATAR_SIZE, DEFAULT_AVATAR_VARIANT, generateAvatarAbbreviation,
|
|
13
|
+
export { DEFAULT_AVATAR_SIZE, DEFAULT_AVATAR_VARIANT, generateAvatarAbbreviation, getAvatarSizeStyle, getDefaultAvatarIcon };
|
|
14
14
|
//# sourceMappingURL=utils.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.cts","names":[],"sources":["../../../src/components/Avatar/utils.ts"],"mappings":";;;;;;cAKM,mBAAA,EAAqB,UAAA;AAAA,cACrB,sBAAA,EAAwB,aAAA;AAAA,iBAoBrB,0BAAA,CACP,IAAA,WACA,QAAA,GAAU,0BAAA;AAAA,iBAgBH,
|
|
1
|
+
{"version":3,"file":"utils.d.cts","names":[],"sources":["../../../src/components/Avatar/utils.ts"],"mappings":";;;;;;cAKM,mBAAA,EAAqB,UAAA;AAAA,cACrB,sBAAA,EAAwB,aAAA;AAAA,iBAoBrB,0BAAA,CACP,IAAA,WACA,QAAA,GAAU,0BAAA;AAAA,iBAgBH,kBAAA,CACP,SAAA,EAAW,SAAA,EACX,UAAA,sBACA,eAAA,WACC,SAAA;AAAA,iBAgBM,oBAAA,CAAqB,OAAA,EAAS,aAAA,GAAgB,YAAA"}
|
|
@@ -7,8 +7,8 @@ import { ViewStyle } from "react-native";
|
|
|
7
7
|
declare const DEFAULT_AVATAR_SIZE: AvatarSize;
|
|
8
8
|
declare const DEFAULT_AVATAR_VARIANT: AvatarVariant;
|
|
9
9
|
declare function generateAvatarAbbreviation(name?: string, strategy?: AvatarAbbreviationStrategy): string;
|
|
10
|
-
declare function
|
|
10
|
+
declare function getAvatarSizeStyle(rootStyle: ViewStyle, customSize: number | undefined, fontScaleFactor: number): ViewStyle | undefined;
|
|
11
11
|
declare function getDefaultAvatarIcon(variant: AvatarVariant): IconSlotType;
|
|
12
12
|
//#endregion
|
|
13
|
-
export { DEFAULT_AVATAR_SIZE, DEFAULT_AVATAR_VARIANT, generateAvatarAbbreviation,
|
|
13
|
+
export { DEFAULT_AVATAR_SIZE, DEFAULT_AVATAR_VARIANT, generateAvatarAbbreviation, getAvatarSizeStyle, getDefaultAvatarIcon };
|
|
14
14
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","names":[],"sources":["../../../src/components/Avatar/utils.ts"],"mappings":";;;;;;cAKM,mBAAA,EAAqB,UAAA;AAAA,cACrB,sBAAA,EAAwB,aAAA;AAAA,iBAoBrB,0BAAA,CACP,IAAA,WACA,QAAA,GAAU,0BAAA;AAAA,iBAgBH,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","names":[],"sources":["../../../src/components/Avatar/utils.ts"],"mappings":";;;;;;cAKM,mBAAA,EAAqB,UAAA;AAAA,cACrB,sBAAA,EAAwB,aAAA;AAAA,iBAoBrB,0BAAA,CACP,IAAA,WACA,QAAA,GAAU,0BAAA;AAAA,iBAgBH,kBAAA,CACP,SAAA,EAAW,SAAA,EACX,UAAA,sBACA,eAAA,WACC,SAAA;AAAA,iBAgBM,oBAAA,CAAqB,OAAA,EAAS,aAAA,GAAgB,YAAA"}
|
|
@@ -20,16 +20,19 @@ function generateAvatarAbbreviation(name, strategy = "firstAndLast") {
|
|
|
20
20
|
const initials = name.trim().split(/\s+/).filter(Boolean).map((word) => word[0]?.toUpperCase() ?? "");
|
|
21
21
|
return abbreviationStrategies[strategy](initials);
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
function getAvatarSizeStyle(rootStyle, customSize, fontScaleFactor) {
|
|
24
|
+
if (customSize === void 0 && fontScaleFactor === 1) return;
|
|
25
|
+
const width = customSize ?? rootStyle.width;
|
|
26
|
+
const height = customSize ?? rootStyle.height;
|
|
27
|
+
return typeof width === "number" && typeof height === "number" ? {
|
|
28
|
+
width: Math.round(width * fontScaleFactor),
|
|
29
|
+
height: Math.round(height * fontScaleFactor)
|
|
30
|
+
} : void 0;
|
|
28
31
|
}
|
|
29
32
|
function getDefaultAvatarIcon(variant) {
|
|
30
33
|
return DEFAULT_AVATAR_ICON[variant];
|
|
31
34
|
}
|
|
32
35
|
//#endregion
|
|
33
|
-
export { DEFAULT_AVATAR_SIZE, DEFAULT_AVATAR_VARIANT, generateAvatarAbbreviation,
|
|
36
|
+
export { DEFAULT_AVATAR_SIZE, DEFAULT_AVATAR_VARIANT, generateAvatarAbbreviation, getAvatarSizeStyle, getDefaultAvatarIcon };
|
|
34
37
|
|
|
35
38
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":[],"sources":["../../../src/components/Avatar/utils.ts"],"sourcesContent":["import type { AvatarAbbreviationStrategy, AvatarSize, AvatarVariant } from '@yahoo/uds-types';\nimport type { ViewStyle } from 'react-native';\n\nimport type { IconSlotType } from '../IconSlot';\n\nconst DEFAULT_AVATAR_SIZE: AvatarSize = 'md';\nconst DEFAULT_AVATAR_VARIANT: AvatarVariant = 'primary';\n\nconst DEFAULT_AVATAR_ICON: Record<AvatarVariant, IconSlotType> = {\n primary: 'Person',\n secondary: 'Building',\n};\n\nconst abbreviationStrategies: Record<\n Exclude<AvatarAbbreviationStrategy, (name: string) => string>,\n (initials: string[]) => string\n> = {\n first: (initials) => initials[0] ?? '',\n last: (initials) => initials[initials.length - 1] ?? '',\n firstAndLast: (initials) =>\n initials.length === 1 ? (initials[0] ?? '') : `${initials[0]}${initials[initials.length - 1]}`,\n firstTwo: (initials) => initials.slice(0, 2).join(''),\n firstThree: (initials) => initials.slice(0, 3).join(''),\n firstOfEach: (initials) => initials.join(''),\n};\n\nfunction generateAvatarAbbreviation(\n name?: string,\n strategy: AvatarAbbreviationStrategy = 'firstAndLast',\n): string {\n if (!name) {\n return '';\n }\n\n if (typeof strategy === 'function') {\n return strategy(name);\n }\n\n const words = name.trim().split(/\\s+/).filter(Boolean);\n const initials = words.map((word) => word[0]?.toUpperCase() ?? '');\n\n return abbreviationStrategies[strategy](initials);\n}\n\nfunction
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../../src/components/Avatar/utils.ts"],"sourcesContent":["import type { AvatarAbbreviationStrategy, AvatarSize, AvatarVariant } from '@yahoo/uds-types';\nimport type { ViewStyle } from 'react-native';\n\nimport type { IconSlotType } from '../IconSlot';\n\nconst DEFAULT_AVATAR_SIZE: AvatarSize = 'md';\nconst DEFAULT_AVATAR_VARIANT: AvatarVariant = 'primary';\n\nconst DEFAULT_AVATAR_ICON: Record<AvatarVariant, IconSlotType> = {\n primary: 'Person',\n secondary: 'Building',\n};\n\nconst abbreviationStrategies: Record<\n Exclude<AvatarAbbreviationStrategy, (name: string) => string>,\n (initials: string[]) => string\n> = {\n first: (initials) => initials[0] ?? '',\n last: (initials) => initials[initials.length - 1] ?? '',\n firstAndLast: (initials) =>\n initials.length === 1 ? (initials[0] ?? '') : `${initials[0]}${initials[initials.length - 1]}`,\n firstTwo: (initials) => initials.slice(0, 2).join(''),\n firstThree: (initials) => initials.slice(0, 3).join(''),\n firstOfEach: (initials) => initials.join(''),\n};\n\nfunction generateAvatarAbbreviation(\n name?: string,\n strategy: AvatarAbbreviationStrategy = 'firstAndLast',\n): string {\n if (!name) {\n return '';\n }\n\n if (typeof strategy === 'function') {\n return strategy(name);\n }\n\n const words = name.trim().split(/\\s+/).filter(Boolean);\n const initials = words.map((word) => word[0]?.toUpperCase() ?? '');\n\n return abbreviationStrategies[strategy](initials);\n}\n\nfunction getAvatarSizeStyle(\n rootStyle: ViewStyle,\n customSize: number | undefined,\n fontScaleFactor: number,\n): ViewStyle | undefined {\n if (customSize === undefined && fontScaleFactor === 1) {\n return undefined;\n }\n\n const width = customSize ?? rootStyle.width;\n const height = customSize ?? rootStyle.height;\n\n return typeof width === 'number' && typeof height === 'number'\n ? {\n width: Math.round(width * fontScaleFactor),\n height: Math.round(height * fontScaleFactor),\n }\n : undefined;\n}\n\nfunction getDefaultAvatarIcon(variant: AvatarVariant): IconSlotType {\n return DEFAULT_AVATAR_ICON[variant];\n}\n\nexport {\n DEFAULT_AVATAR_SIZE,\n DEFAULT_AVATAR_VARIANT,\n generateAvatarAbbreviation,\n getAvatarSizeStyle,\n getDefaultAvatarIcon,\n};\n"],"mappings":";;AAKA,MAAM,sBAAkC;AACxC,MAAM,yBAAwC;AAE9C,MAAM,sBAA2D;CAC/D,SAAS;CACT,WAAW;CACZ;AAED,MAAM,yBAGF;CACF,QAAQ,aAAa,SAAS,MAAM;CACpC,OAAO,aAAa,SAAS,SAAS,SAAS,MAAM;CACrD,eAAe,aACb,SAAS,WAAW,IAAK,SAAS,MAAM,KAAM,GAAG,SAAS,KAAK,SAAS,SAAS,SAAS;CAC5F,WAAW,aAAa,SAAS,MAAM,GAAG,EAAE,CAAC,KAAK,GAAG;CACrD,aAAa,aAAa,SAAS,MAAM,GAAG,EAAE,CAAC,KAAK,GAAG;CACvD,cAAc,aAAa,SAAS,KAAK,GAAG;CAC7C;AAED,SAAS,2BACP,MACA,WAAuC,gBAC/B;CACR,IAAI,CAAC,MACH,OAAO;CAGT,IAAI,OAAO,aAAa,YACtB,OAAO,SAAS,KAAK;CAIvB,MAAM,WADQ,KAAK,MAAM,CAAC,MAAM,MAAM,CAAC,OAAO,QACxB,CAAC,KAAK,SAAS,KAAK,IAAI,aAAa,IAAI,GAAG;CAElE,OAAO,uBAAuB,UAAU,SAAS;;AAGnD,SAAS,mBACP,WACA,YACA,iBACuB;CACvB,IAAI,eAAe,KAAA,KAAa,oBAAoB,GAClD;CAGF,MAAM,QAAQ,cAAc,UAAU;CACtC,MAAM,SAAS,cAAc,UAAU;CAEvC,OAAO,OAAO,UAAU,YAAY,OAAO,WAAW,WAClD;EACE,OAAO,KAAK,MAAM,QAAQ,gBAAgB;EAC1C,QAAQ,KAAK,MAAM,SAAS,gBAAgB;EAC7C,GACD,KAAA;;AAGN,SAAS,qBAAqB,SAAsC;CAClE,OAAO,oBAAoB"}
|
|
@@ -21,8 +21,8 @@ let generated_styles = require("../../../generated/styles");
|
|
|
21
21
|
let react_native_reanimated = require("react-native-reanimated");
|
|
22
22
|
react_native_reanimated = require_runtime.__toESM(react_native_reanimated);
|
|
23
23
|
let react_native_gesture_handler = require("react-native-gesture-handler");
|
|
24
|
-
let react_native_screens = require("react-native-screens");
|
|
25
24
|
let react_native_safe_area_context = require("react-native-safe-area-context");
|
|
25
|
+
let react_native_screens = require("react-native-screens");
|
|
26
26
|
//#region src/components/BottomSheet/BottomSheet.tsx
|
|
27
27
|
function useScreenCornerRadius() {
|
|
28
28
|
const [, forceUpdate] = (0, react.useState)(0);
|
|
@@ -18,8 +18,8 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
18
18
|
import { bottomSheetStyles } from "../../../generated/styles";
|
|
19
19
|
import Animated, { interpolate, useAnimatedStyle, useSharedValue } from "react-native-reanimated";
|
|
20
20
|
import { GestureDetector, GestureHandlerRootView } from "react-native-gesture-handler";
|
|
21
|
-
import { FullWindowOverlay } from "react-native-screens";
|
|
22
21
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
22
|
+
import { FullWindowOverlay } from "react-native-screens";
|
|
23
23
|
//#region src/components/BottomSheet/BottomSheet.tsx
|
|
24
24
|
function useScreenCornerRadius() {
|
|
25
25
|
const [, forceUpdate] = useState(0);
|
|
@@ -22,6 +22,10 @@ function getLayerStyle(theme, path) {
|
|
|
22
22
|
function getIconSize(iconStyle) {
|
|
23
23
|
return (typeof iconStyle.fontSize === "number" ? iconStyle.fontSize : void 0) ?? (typeof iconStyle.lineHeight === "number" ? iconStyle.lineHeight : void 0) ?? 16;
|
|
24
24
|
}
|
|
25
|
+
/** Base icon size for an IconButton size layer. */
|
|
26
|
+
function getIconButtonIconSize(theme, size) {
|
|
27
|
+
return getIconSize(getLayerStyle(theme, iconButtonSizePath(size, "icon")));
|
|
28
|
+
}
|
|
25
29
|
function getVerticalPadding(rootStyle) {
|
|
26
30
|
return (typeof rootStyle.paddingVertical === "number" ? rootStyle.paddingVertical : void 0) ?? (typeof rootStyle.padding === "number" ? rootStyle.padding : void 0) ?? 0;
|
|
27
31
|
}
|
|
@@ -44,8 +48,16 @@ function getSafeIconCell(fontSize) {
|
|
|
44
48
|
const overflowBelowEm = Math.max(0, -metrics.bbox.minY);
|
|
45
49
|
return Math.ceil(fontSize) + getMetricHeight(overflowAboveEm, metrics.unitsPerEm, fontSize) + getMetricHeight(overflowBelowEm, metrics.unitsPerEm, fontSize);
|
|
46
50
|
}
|
|
47
|
-
/**
|
|
48
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Safe native content metrics while retaining the token-derived target control height.
|
|
53
|
+
*
|
|
54
|
+
* `fontScaleFactor` pre-scales container metrics only. A single number keeps
|
|
55
|
+
* the legacy linear behavior; distinct label/icon factors let Android 14+
|
|
56
|
+
* geometry follow its size-dependent nonlinear font curve. The returned
|
|
57
|
+
* `labelLineHeight`/`iconCellHeight` stay unscaled because native Text applies
|
|
58
|
+
* the same cap.
|
|
59
|
+
*/
|
|
60
|
+
function getButtonControlMetrics(theme, size, fontScaleFactor = 1) {
|
|
49
61
|
const rootStyle = getLayerStyle(theme, buttonSizePath(size, "root"));
|
|
50
62
|
const iconStyle = getLayerStyle(theme, buttonSizePath(size, "icon"));
|
|
51
63
|
const textStyle = getLayerStyle(theme, buttonSizePath(size, "rootText"));
|
|
@@ -53,32 +65,41 @@ function getButtonControlMetrics(theme, size) {
|
|
|
53
65
|
const iconSize = getIconSize(iconStyle);
|
|
54
66
|
const fontSize = typeof textStyle.fontSize === "number" ? textStyle.fontSize : iconSize;
|
|
55
67
|
const tokenLineHeight = typeof textStyle.lineHeight === "number" ? textStyle.lineHeight : fontSize;
|
|
56
|
-
const
|
|
68
|
+
const labelScaleFactor = typeof fontScaleFactor === "number" ? fontScaleFactor : fontScaleFactor.label;
|
|
69
|
+
const iconScaleFactor = typeof fontScaleFactor === "number" ? fontScaleFactor : fontScaleFactor.icon;
|
|
70
|
+
const iconCellScaleFactor = typeof fontScaleFactor === "number" ? fontScaleFactor : fontScaleFactor.iconCell ?? fontScaleFactor.icon;
|
|
71
|
+
const targetContentHeight = Math.max(iconSize * iconScaleFactor, tokenLineHeight * labelScaleFactor);
|
|
57
72
|
const minHeight = Math.ceil(paddingVertical * 2 + targetContentHeight);
|
|
58
73
|
const labelLineHeight = getSafeLabelLineHeight(textStyle, iconSize);
|
|
59
74
|
const iconCellHeight = getSafeIconCell(iconSize);
|
|
75
|
+
const safeContentHeight = Math.max(labelLineHeight * labelScaleFactor, iconCellHeight * iconCellScaleFactor);
|
|
60
76
|
return {
|
|
61
77
|
minHeight,
|
|
62
78
|
labelLineHeight,
|
|
63
79
|
iconCellHeight,
|
|
64
|
-
paddingVertical: Math.max(0, (minHeight -
|
|
80
|
+
paddingVertical: Math.max(0, (minHeight - safeContentHeight) / 2)
|
|
65
81
|
};
|
|
66
82
|
}
|
|
67
|
-
/**
|
|
68
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Safe icon cell within the token-derived control size; explicit token height (match-button-height opt-in) wins as the target.
|
|
85
|
+
*
|
|
86
|
+
* `fontScaleFactor` behaves as in {@link getButtonControlMetrics}; an explicit
|
|
87
|
+
* token height stays fixed, with padding absorbing the scaled content.
|
|
88
|
+
*/
|
|
89
|
+
function getIconButtonControlMetrics(theme, size, fontScaleFactor = 1) {
|
|
69
90
|
const rootStyle = getLayerStyle(theme, iconButtonSizePath(size, "root"));
|
|
70
91
|
const iconStyle = getLayerStyle(theme, iconButtonSizePath(size, "icon"));
|
|
71
|
-
const iconSize =
|
|
92
|
+
const iconSize = getIconButtonIconSize(theme, size);
|
|
72
93
|
const tokenLineHeight = typeof iconStyle.lineHeight === "number" ? iconStyle.lineHeight : iconSize;
|
|
73
94
|
const paddingVertical = getVerticalPadding(rootStyle);
|
|
74
95
|
const explicitHeight = typeof rootStyle.height === "number" ? rootStyle.height : void 0;
|
|
75
96
|
const hasExplicitHeight = SHARED_BUTTON_ICONBUTTON_SIZES.has(size) && explicitHeight !== void 0;
|
|
76
|
-
const minHeight = hasExplicitHeight ? explicitHeight : Math.ceil(paddingVertical * 2 + Math.max(iconSize, tokenLineHeight));
|
|
97
|
+
const minHeight = hasExplicitHeight ? explicitHeight : Math.ceil(paddingVertical * 2 + Math.max(iconSize, tokenLineHeight) * fontScaleFactor);
|
|
77
98
|
const iconCellHeight = getSafeIconCell(iconSize);
|
|
78
99
|
return {
|
|
79
100
|
minHeight,
|
|
80
101
|
iconCellHeight,
|
|
81
|
-
paddingVertical: Math.max(0, (minHeight - Math.max(iconSize, iconCellHeight)) / 2),
|
|
102
|
+
paddingVertical: Math.max(0, (minHeight - Math.max(iconSize, iconCellHeight) * fontScaleFactor) / 2),
|
|
82
103
|
hasExplicitHeight
|
|
83
104
|
};
|
|
84
105
|
}
|
|
@@ -93,4 +114,5 @@ function getButtonTextStyle(textStyle, labelLineHeight) {
|
|
|
93
114
|
exports.getButtonControlMetrics = getButtonControlMetrics;
|
|
94
115
|
exports.getButtonTextStyle = getButtonTextStyle;
|
|
95
116
|
exports.getIconButtonControlMetrics = getIconButtonControlMetrics;
|
|
117
|
+
exports.getIconButtonIconSize = getIconButtonIconSize;
|
|
96
118
|
exports.getSafeIconCell = getSafeIconCell;
|