@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
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
import { Box } from "../Box.js";
|
|
3
|
+
import { Text as Text$1 } from "../Text.js";
|
|
4
|
+
import { DEFAULT_AVATAR_VARIANT, generateAvatarAbbreviation, getAvatarCustomSizeStyle } 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/AvatarText.tsx
|
|
10
|
+
const AvatarText = memo(function AvatarText({ size = "md", variant = DEFAULT_AVATAR_VARIANT, name, initials, abbreviationStrategy, customSize, style, accessibilityLabel, ref, ...viewProps }) {
|
|
11
|
+
avatarStyles.useVariants({
|
|
12
|
+
size,
|
|
13
|
+
text: 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 ?? name ?? initials,
|
|
29
|
+
...viewProps,
|
|
30
|
+
style: rootStyle,
|
|
31
|
+
children: /* @__PURE__ */ jsx(Text$1, {
|
|
32
|
+
color: "inherit",
|
|
33
|
+
variant: "inherit",
|
|
34
|
+
numberOfLines: 1,
|
|
35
|
+
style: avatarStyles.text,
|
|
36
|
+
children: initials || generateAvatarAbbreviation(name, abbreviationStrategy)
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
AvatarText.displayName = "AvatarText";
|
|
41
|
+
const avatarStaticStyles = StyleSheet.create({ root: {
|
|
42
|
+
alignItems: "center",
|
|
43
|
+
justifyContent: "center",
|
|
44
|
+
overflow: "hidden"
|
|
45
|
+
} });
|
|
46
|
+
//#endregion
|
|
47
|
+
export { AvatarText };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=AvatarText.js.map
|
|
@@ -0,0 +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 getAvatarCustomSizeStyle,\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 style,\n accessibilityLabel,\n ref,\n ...viewProps\n}: AvatarTextProps) {\n avatarStyles.useVariants({ size, text: 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 ?? name ?? initials}\n {...viewProps}\n style={rootStyle}\n >\n <Text color=\"inherit\" variant=\"inherit\" numberOfLines={1} style={avatarStyles.text}>\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":";;;;;;;;;AAcA,MAAM,aAAa,KAAK,SAAS,WAAW,EAC1C,OAAA,MACA,UAAU,wBACV,MACA,UACA,sBACA,YACA,OACA,oBACA,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,QAAQ;EAClD,GAAI;EACJ,OAAO;YAEP,oBAACA,QAAD;GAAM,OAAM;GAAU,SAAQ;GAAU,eAAe;GAAG,OAAO,aAAa;aAC3E,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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require_components_Avatar_AvatarIcon = require("./AvatarIcon.cjs");
|
|
4
|
+
const require_components_Avatar_AvatarText = require("./AvatarText.cjs");
|
|
5
|
+
const require_components_Avatar_AvatarImage = require("./AvatarImage.cjs");
|
|
6
|
+
const require_components_Avatar_Avatar = require("./Avatar.cjs");
|
|
7
|
+
exports.Avatar = require_components_Avatar_Avatar.Avatar;
|
|
8
|
+
exports.AvatarIcon = require_components_Avatar_AvatarIcon.AvatarIcon;
|
|
9
|
+
exports.AvatarImage = require_components_Avatar_AvatarImage.AvatarImage;
|
|
10
|
+
exports.AvatarText = require_components_Avatar_AvatarText.AvatarText;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
|
|
2
|
+
import { AvatarIconProps, AvatarImageProps, AvatarProps, AvatarTextProps } from "./types.cjs";
|
|
3
|
+
import { Avatar } from "./Avatar.cjs";
|
|
4
|
+
import { AvatarIcon } from "./AvatarIcon.cjs";
|
|
5
|
+
import { AvatarImage } from "./AvatarImage.cjs";
|
|
6
|
+
import { AvatarText } from "./AvatarText.cjs";
|
|
7
|
+
export { Avatar, AvatarIcon, type AvatarIconProps, AvatarImage, type AvatarImageProps, type AvatarProps, AvatarText, type AvatarTextProps };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
|
|
2
|
+
import { AvatarIconProps, AvatarImageProps, AvatarProps, AvatarTextProps } from "./types.js";
|
|
3
|
+
import { Avatar } from "./Avatar.js";
|
|
4
|
+
import { AvatarIcon } from "./AvatarIcon.js";
|
|
5
|
+
import { AvatarImage } from "./AvatarImage.js";
|
|
6
|
+
import { AvatarText } from "./AvatarText.js";
|
|
7
|
+
export { Avatar, AvatarIcon, type AvatarIconProps, AvatarImage, type AvatarImageProps, type AvatarProps, AvatarText, type AvatarTextProps };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
import { AvatarIcon } from "./AvatarIcon.js";
|
|
3
|
+
import { AvatarText } from "./AvatarText.js";
|
|
4
|
+
import { AvatarImage } from "./AvatarImage.js";
|
|
5
|
+
import { Avatar } from "./Avatar.js";
|
|
6
|
+
export { Avatar, AvatarIcon, AvatarImage, AvatarText };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
import { AvatarAbbreviationStrategy, AvatarSize, AvatarVariant, UniversalAvatarIconProps, UniversalAvatarImageProps, UniversalAvatarTextProps } from "../../types/dist/index.cjs";
|
|
3
|
+
import { IconSlotType } from "../IconSlot.cjs";
|
|
4
|
+
import { Ref } from "react";
|
|
5
|
+
import { View, ViewProps } from "react-native";
|
|
6
|
+
|
|
7
|
+
//#region src/components/Avatar/types.d.ts
|
|
8
|
+
interface AvatarImageProps extends Omit<ViewProps, 'children'>, Omit<UniversalAvatarImageProps, 'className' | 'srcSet'> {
|
|
9
|
+
/** Ref to the underlying View. */
|
|
10
|
+
ref?: Ref<View>;
|
|
11
|
+
/** Custom icon to display if the image fails and no text fallback is available. */
|
|
12
|
+
icon?: IconSlotType;
|
|
13
|
+
}
|
|
14
|
+
interface AvatarTextProps extends Omit<ViewProps, 'children'>, Omit<UniversalAvatarTextProps, 'className'> {
|
|
15
|
+
/** Ref to the underlying View. */
|
|
16
|
+
ref?: Ref<View>;
|
|
17
|
+
}
|
|
18
|
+
interface AvatarIconProps extends Omit<ViewProps, 'children'>, Omit<UniversalAvatarIconProps<IconSlotType>, 'className'> {
|
|
19
|
+
/** Ref to the underlying View. */
|
|
20
|
+
ref?: Ref<View>;
|
|
21
|
+
}
|
|
22
|
+
interface AvatarProps extends Omit<AvatarImageProps, 'src'> {
|
|
23
|
+
/** Image source URL. When omitted, Avatar falls back to text, then icon. */
|
|
24
|
+
src?: string;
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { type AvatarAbbreviationStrategy, type AvatarIconProps, type AvatarImageProps, type AvatarProps, type AvatarSize, type AvatarTextProps, type AvatarVariant };
|
|
28
|
+
//# sourceMappingURL=types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../../../src/components/Avatar/types.ts"],"mappings":";;;;;;;UAaU,gBAAA,SACA,IAAA,CAAK,SAAA,eAAwB,IAAA,CAAK,yBAAA;;EAE1C,GAAA,GAAM,GAAA,CAAI,IAAA;EAFV;EAIA,IAAA,GAAO,YAAA;AAAA;AAAA,UAGC,eAAA,SACA,IAAA,CAAK,SAAA,eAAwB,IAAA,CAAK,wBAAA;EANhC;EAQV,GAAA,GAAM,GAAA,CAAI,IAAA;AAAA;AAAA,UAGF,eAAA,SACA,IAAA,CAAK,SAAA,eAAwB,IAAA,CAAK,wBAAA,CAAyB,YAAA;EAd9B;EAgBrC,GAAA,GAAM,GAAA,CAAI,IAAA;AAAA;AAAA,UAGF,WAAA,SAAoB,IAAA,CAAK,gBAAA;EAnBpB;EAqBb,GAAA;AAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
import { AvatarAbbreviationStrategy, AvatarSize, AvatarVariant, UniversalAvatarIconProps, UniversalAvatarImageProps, UniversalAvatarTextProps } from "../../types/dist/index.js";
|
|
3
|
+
import { IconSlotType } from "../IconSlot.js";
|
|
4
|
+
import { Ref } from "react";
|
|
5
|
+
import { View, ViewProps } from "react-native";
|
|
6
|
+
|
|
7
|
+
//#region src/components/Avatar/types.d.ts
|
|
8
|
+
interface AvatarImageProps extends Omit<ViewProps, 'children'>, Omit<UniversalAvatarImageProps, 'className' | 'srcSet'> {
|
|
9
|
+
/** Ref to the underlying View. */
|
|
10
|
+
ref?: Ref<View>;
|
|
11
|
+
/** Custom icon to display if the image fails and no text fallback is available. */
|
|
12
|
+
icon?: IconSlotType;
|
|
13
|
+
}
|
|
14
|
+
interface AvatarTextProps extends Omit<ViewProps, 'children'>, Omit<UniversalAvatarTextProps, 'className'> {
|
|
15
|
+
/** Ref to the underlying View. */
|
|
16
|
+
ref?: Ref<View>;
|
|
17
|
+
}
|
|
18
|
+
interface AvatarIconProps extends Omit<ViewProps, 'children'>, Omit<UniversalAvatarIconProps<IconSlotType>, 'className'> {
|
|
19
|
+
/** Ref to the underlying View. */
|
|
20
|
+
ref?: Ref<View>;
|
|
21
|
+
}
|
|
22
|
+
interface AvatarProps extends Omit<AvatarImageProps, 'src'> {
|
|
23
|
+
/** Image source URL. When omitted, Avatar falls back to text, then icon. */
|
|
24
|
+
src?: string;
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { type AvatarAbbreviationStrategy, type AvatarIconProps, type AvatarImageProps, type AvatarProps, type AvatarSize, type AvatarTextProps, type AvatarVariant };
|
|
28
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/components/Avatar/types.ts"],"mappings":";;;;;;;UAaU,gBAAA,SACA,IAAA,CAAK,SAAA,eAAwB,IAAA,CAAK,yBAAA;;EAE1C,GAAA,GAAM,GAAA,CAAI,IAAA;EAFV;EAIA,IAAA,GAAO,YAAA;AAAA;AAAA,UAGC,eAAA,SACA,IAAA,CAAK,SAAA,eAAwB,IAAA,CAAK,wBAAA;EANhC;EAQV,GAAA,GAAM,GAAA,CAAI,IAAA;AAAA;AAAA,UAGF,eAAA,SACA,IAAA,CAAK,SAAA,eAAwB,IAAA,CAAK,wBAAA,CAAyB,YAAA;EAd9B;EAgBrC,GAAA,GAAM,GAAA,CAAI,IAAA;AAAA;AAAA,UAGF,WAAA,SAAoB,IAAA,CAAK,gBAAA;EAnBpB;EAqBb,GAAA;AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
//#region src/components/Avatar/utils.ts
|
|
4
|
+
const DEFAULT_AVATAR_SIZE = "md";
|
|
5
|
+
const DEFAULT_AVATAR_VARIANT = "primary";
|
|
6
|
+
const DEFAULT_AVATAR_ICON = {
|
|
7
|
+
primary: "Person",
|
|
8
|
+
secondary: "Building"
|
|
9
|
+
};
|
|
10
|
+
const abbreviationStrategies = {
|
|
11
|
+
first: (initials) => initials[0] ?? "",
|
|
12
|
+
last: (initials) => initials[initials.length - 1] ?? "",
|
|
13
|
+
firstAndLast: (initials) => initials.length === 1 ? initials[0] ?? "" : `${initials[0]}${initials[initials.length - 1]}`,
|
|
14
|
+
firstTwo: (initials) => initials.slice(0, 2).join(""),
|
|
15
|
+
firstThree: (initials) => initials.slice(0, 3).join(""),
|
|
16
|
+
firstOfEach: (initials) => initials.join("")
|
|
17
|
+
};
|
|
18
|
+
function generateAvatarAbbreviation(name, strategy = "firstAndLast") {
|
|
19
|
+
if (!name) return "";
|
|
20
|
+
if (typeof strategy === "function") return strategy(name);
|
|
21
|
+
const initials = name.trim().split(/\s+/).filter(Boolean).map((word) => word[0]?.toUpperCase() ?? "");
|
|
22
|
+
return abbreviationStrategies[strategy](initials);
|
|
23
|
+
}
|
|
24
|
+
function getAvatarCustomSizeStyle(customSize) {
|
|
25
|
+
return customSize === void 0 ? void 0 : {
|
|
26
|
+
width: customSize,
|
|
27
|
+
height: customSize
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function getDefaultAvatarIcon(variant) {
|
|
31
|
+
return DEFAULT_AVATAR_ICON[variant];
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
exports.DEFAULT_AVATAR_SIZE = DEFAULT_AVATAR_SIZE;
|
|
35
|
+
exports.DEFAULT_AVATAR_VARIANT = DEFAULT_AVATAR_VARIANT;
|
|
36
|
+
exports.generateAvatarAbbreviation = generateAvatarAbbreviation;
|
|
37
|
+
exports.getAvatarCustomSizeStyle = getAvatarCustomSizeStyle;
|
|
38
|
+
exports.getDefaultAvatarIcon = getDefaultAvatarIcon;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
import { AvatarAbbreviationStrategy, AvatarSize, AvatarVariant } from "../../types/dist/index.cjs";
|
|
3
|
+
import { IconSlotType } from "../IconSlot.cjs";
|
|
4
|
+
import { ViewStyle } from "react-native";
|
|
5
|
+
|
|
6
|
+
//#region src/components/Avatar/utils.d.ts
|
|
7
|
+
declare const DEFAULT_AVATAR_SIZE: AvatarSize;
|
|
8
|
+
declare const DEFAULT_AVATAR_VARIANT: AvatarVariant;
|
|
9
|
+
declare function generateAvatarAbbreviation(name?: string, strategy?: AvatarAbbreviationStrategy): string;
|
|
10
|
+
declare function getAvatarCustomSizeStyle(customSize?: number): ViewStyle | undefined;
|
|
11
|
+
declare function getDefaultAvatarIcon(variant: AvatarVariant): IconSlotType;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { DEFAULT_AVATAR_SIZE, DEFAULT_AVATAR_VARIANT, generateAvatarAbbreviation, getAvatarCustomSizeStyle, getDefaultAvatarIcon };
|
|
14
|
+
//# sourceMappingURL=utils.d.cts.map
|
|
@@ -0,0 +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,wBAAA,CAAyB,UAAA,YAAsB,SAAA;AAAA,iBAI/C,oBAAA,CAAqB,OAAA,EAAS,aAAA,GAAgB,YAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
import { AvatarAbbreviationStrategy, AvatarSize, AvatarVariant } from "../../types/dist/index.js";
|
|
3
|
+
import { IconSlotType } from "../IconSlot.js";
|
|
4
|
+
import { ViewStyle } from "react-native";
|
|
5
|
+
|
|
6
|
+
//#region src/components/Avatar/utils.d.ts
|
|
7
|
+
declare const DEFAULT_AVATAR_SIZE: AvatarSize;
|
|
8
|
+
declare const DEFAULT_AVATAR_VARIANT: AvatarVariant;
|
|
9
|
+
declare function generateAvatarAbbreviation(name?: string, strategy?: AvatarAbbreviationStrategy): string;
|
|
10
|
+
declare function getAvatarCustomSizeStyle(customSize?: number): ViewStyle | undefined;
|
|
11
|
+
declare function getDefaultAvatarIcon(variant: AvatarVariant): IconSlotType;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { DEFAULT_AVATAR_SIZE, DEFAULT_AVATAR_VARIANT, generateAvatarAbbreviation, getAvatarCustomSizeStyle, getDefaultAvatarIcon };
|
|
14
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +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,wBAAA,CAAyB,UAAA,YAAsB,SAAA;AAAA,iBAI/C,oBAAA,CAAqB,OAAA,EAAS,aAAA,GAAgB,YAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
//#region src/components/Avatar/utils.ts
|
|
3
|
+
const DEFAULT_AVATAR_SIZE = "md";
|
|
4
|
+
const DEFAULT_AVATAR_VARIANT = "primary";
|
|
5
|
+
const DEFAULT_AVATAR_ICON = {
|
|
6
|
+
primary: "Person",
|
|
7
|
+
secondary: "Building"
|
|
8
|
+
};
|
|
9
|
+
const abbreviationStrategies = {
|
|
10
|
+
first: (initials) => initials[0] ?? "",
|
|
11
|
+
last: (initials) => initials[initials.length - 1] ?? "",
|
|
12
|
+
firstAndLast: (initials) => initials.length === 1 ? initials[0] ?? "" : `${initials[0]}${initials[initials.length - 1]}`,
|
|
13
|
+
firstTwo: (initials) => initials.slice(0, 2).join(""),
|
|
14
|
+
firstThree: (initials) => initials.slice(0, 3).join(""),
|
|
15
|
+
firstOfEach: (initials) => initials.join("")
|
|
16
|
+
};
|
|
17
|
+
function generateAvatarAbbreviation(name, strategy = "firstAndLast") {
|
|
18
|
+
if (!name) return "";
|
|
19
|
+
if (typeof strategy === "function") return strategy(name);
|
|
20
|
+
const initials = name.trim().split(/\s+/).filter(Boolean).map((word) => word[0]?.toUpperCase() ?? "");
|
|
21
|
+
return abbreviationStrategies[strategy](initials);
|
|
22
|
+
}
|
|
23
|
+
function getAvatarCustomSizeStyle(customSize) {
|
|
24
|
+
return customSize === void 0 ? void 0 : {
|
|
25
|
+
width: customSize,
|
|
26
|
+
height: customSize
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function getDefaultAvatarIcon(variant) {
|
|
30
|
+
return DEFAULT_AVATAR_ICON[variant];
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { DEFAULT_AVATAR_SIZE, DEFAULT_AVATAR_VARIANT, generateAvatarAbbreviation, getAvatarCustomSizeStyle, getDefaultAvatarIcon };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +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 getAvatarCustomSizeStyle(customSize?: number): ViewStyle | undefined {\n return customSize === undefined ? undefined : { width: customSize, height: customSize };\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 getAvatarCustomSizeStyle,\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,yBAAyB,YAA4C;CAC5E,OAAO,eAAe,KAAA,IAAY,KAAA,IAAY;EAAE,OAAO;EAAY,QAAQ;EAAY;;AAGzF,SAAS,qBAAqB,SAAsC;CAClE,OAAO,oBAAoB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
require("../_virtual/_rolldown/runtime.cjs");
|
|
4
|
+
const require_components_HStack = require("./HStack.cjs");
|
|
4
5
|
const require_components_IconSlot = require("./IconSlot.cjs");
|
|
5
6
|
const require_components_Text = require("./Text.cjs");
|
|
6
|
-
const require_components_HStack = require("./HStack.cjs");
|
|
7
7
|
let react = require("react");
|
|
8
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
9
|
let generated_styles = require("../../generated/styles");
|
package/dist/components/Badge.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
import { HStack } from "./HStack.js";
|
|
2
3
|
import { IconSlot } from "./IconSlot.js";
|
|
3
4
|
import { Text } from "./Text.js";
|
|
4
|
-
import { HStack } from "./HStack.js";
|
|
5
5
|
import { memo, useMemo } from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { badgeStyles } from "../../generated/styles";
|
|
@@ -0,0 +1,54 @@
|
|
|
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_Chip_ChipBase = require("./ChipBase.cjs");
|
|
5
|
+
const require_components_Chip_ChipButton = require("./ChipButton.cjs");
|
|
6
|
+
const require_components_Chip_ChipDismissible = require("./ChipDismissible.cjs");
|
|
7
|
+
const require_components_Chip_ChipToggle = require("./ChipToggle.cjs");
|
|
8
|
+
let react = require("react");
|
|
9
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
+
//#region src/components/Chip/Chip.tsx
|
|
11
|
+
/**
|
|
12
|
+
* **A chip component for selections, filters, or actions**
|
|
13
|
+
*
|
|
14
|
+
* @description
|
|
15
|
+
* Compatibility wrapper that preserves the original mobile API. For explicit
|
|
16
|
+
* intent, prefer `ChipButton`, `ChipDismissible`, or `ChipToggle`.
|
|
17
|
+
*
|
|
18
|
+
* @category Interactive
|
|
19
|
+
* @platform mobile
|
|
20
|
+
*/
|
|
21
|
+
const Chip = (0, react.memo)(function Chip({ onPress, onToggle, isToggled = false, onDismiss, dismissButtonAriaLabel, dismissIcon, endIcon, disabled = false, ...props }) {
|
|
22
|
+
const handleToggle = (0, react.useCallback)((nextToggled) => {
|
|
23
|
+
if (!disabled) onToggle?.(nextToggled);
|
|
24
|
+
}, [disabled, onToggle]);
|
|
25
|
+
if (onDismiss) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Chip_ChipDismissible.ChipDismissible, {
|
|
26
|
+
onDismiss,
|
|
27
|
+
dismissButtonAriaLabel,
|
|
28
|
+
dismissIcon: dismissIcon ?? endIcon,
|
|
29
|
+
disabled,
|
|
30
|
+
...props
|
|
31
|
+
});
|
|
32
|
+
if (onToggle) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Chip_ChipToggle.ChipToggle, {
|
|
33
|
+
isToggled,
|
|
34
|
+
onToggle: handleToggle,
|
|
35
|
+
endIcon,
|
|
36
|
+
disabled,
|
|
37
|
+
...props
|
|
38
|
+
});
|
|
39
|
+
if (onPress) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Chip_ChipButton.ChipButton, {
|
|
40
|
+
onPress: disabled ? void 0 : onPress,
|
|
41
|
+
endIcon,
|
|
42
|
+
disabled,
|
|
43
|
+
...props
|
|
44
|
+
});
|
|
45
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Chip_ChipBase.ChipBase, {
|
|
46
|
+
kind: "link",
|
|
47
|
+
endIcon,
|
|
48
|
+
disabled,
|
|
49
|
+
...props
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
Chip.displayName = "Chip";
|
|
53
|
+
//#endregion
|
|
54
|
+
exports.Chip = Chip;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
import { ChipProps } from "./types.cjs";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Chip/Chip.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* **A chip component for selections, filters, or actions**
|
|
8
|
+
*
|
|
9
|
+
* @description
|
|
10
|
+
* Compatibility wrapper that preserves the original mobile API. For explicit
|
|
11
|
+
* intent, prefer `ChipButton`, `ChipDismissible`, or `ChipToggle`.
|
|
12
|
+
*
|
|
13
|
+
* @category Interactive
|
|
14
|
+
* @platform mobile
|
|
15
|
+
*/
|
|
16
|
+
declare const Chip: _$react.NamedExoticComponent<ChipProps>;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Chip };
|
|
19
|
+
//# sourceMappingURL=Chip.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chip.d.cts","names":[],"sources":["../../../src/components/Chip/Chip.tsx"],"mappings":";;;;;;;;AAMyC;;;;;;;cAYnC,IAAA,EAAI,OAAA,CAAA,oBAAA,CAAA,SAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
import { ChipProps } from "./types.js";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Chip/Chip.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* **A chip component for selections, filters, or actions**
|
|
8
|
+
*
|
|
9
|
+
* @description
|
|
10
|
+
* Compatibility wrapper that preserves the original mobile API. For explicit
|
|
11
|
+
* intent, prefer `ChipButton`, `ChipDismissible`, or `ChipToggle`.
|
|
12
|
+
*
|
|
13
|
+
* @category Interactive
|
|
14
|
+
* @platform mobile
|
|
15
|
+
*/
|
|
16
|
+
declare const Chip: _$react.NamedExoticComponent<ChipProps>;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Chip };
|
|
19
|
+
//# sourceMappingURL=Chip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chip.d.ts","names":[],"sources":["../../../src/components/Chip/Chip.tsx"],"mappings":";;;;;;;;AAMyC;;;;;;;cAYnC,IAAA,EAAI,OAAA,CAAA,oBAAA,CAAA,SAAA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
import { ChipBase } from "./ChipBase.js";
|
|
3
|
+
import { ChipButton } from "./ChipButton.js";
|
|
4
|
+
import { ChipDismissible } from "./ChipDismissible.js";
|
|
5
|
+
import { ChipToggle } from "./ChipToggle.js";
|
|
6
|
+
import { memo, useCallback } from "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/Chip/Chip.tsx
|
|
9
|
+
/**
|
|
10
|
+
* **A chip component for selections, filters, or actions**
|
|
11
|
+
*
|
|
12
|
+
* @description
|
|
13
|
+
* Compatibility wrapper that preserves the original mobile API. For explicit
|
|
14
|
+
* intent, prefer `ChipButton`, `ChipDismissible`, or `ChipToggle`.
|
|
15
|
+
*
|
|
16
|
+
* @category Interactive
|
|
17
|
+
* @platform mobile
|
|
18
|
+
*/
|
|
19
|
+
const Chip = memo(function Chip({ onPress, onToggle, isToggled = false, onDismiss, dismissButtonAriaLabel, dismissIcon, endIcon, disabled = false, ...props }) {
|
|
20
|
+
const handleToggle = useCallback((nextToggled) => {
|
|
21
|
+
if (!disabled) onToggle?.(nextToggled);
|
|
22
|
+
}, [disabled, onToggle]);
|
|
23
|
+
if (onDismiss) return /* @__PURE__ */ jsx(ChipDismissible, {
|
|
24
|
+
onDismiss,
|
|
25
|
+
dismissButtonAriaLabel,
|
|
26
|
+
dismissIcon: dismissIcon ?? endIcon,
|
|
27
|
+
disabled,
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
if (onToggle) return /* @__PURE__ */ jsx(ChipToggle, {
|
|
31
|
+
isToggled,
|
|
32
|
+
onToggle: handleToggle,
|
|
33
|
+
endIcon,
|
|
34
|
+
disabled,
|
|
35
|
+
...props
|
|
36
|
+
});
|
|
37
|
+
if (onPress) return /* @__PURE__ */ jsx(ChipButton, {
|
|
38
|
+
onPress: disabled ? void 0 : onPress,
|
|
39
|
+
endIcon,
|
|
40
|
+
disabled,
|
|
41
|
+
...props
|
|
42
|
+
});
|
|
43
|
+
return /* @__PURE__ */ jsx(ChipBase, {
|
|
44
|
+
kind: "link",
|
|
45
|
+
endIcon,
|
|
46
|
+
disabled,
|
|
47
|
+
...props
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
Chip.displayName = "Chip";
|
|
51
|
+
//#endregion
|
|
52
|
+
export { Chip };
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=Chip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chip.js","names":[],"sources":["../../../src/components/Chip/Chip.tsx"],"sourcesContent":["import { memo, useCallback } from 'react';\n\nimport { ChipBase } from './ChipBase';\nimport { ChipButton } from './ChipButton';\nimport { ChipDismissible } from './ChipDismissible';\nimport { ChipToggle } from './ChipToggle';\nimport type { ChipProps } from './types';\n\n/**\n * **A chip component for selections, filters, or actions**\n *\n * @description\n * Compatibility wrapper that preserves the original mobile API. For explicit\n * intent, prefer `ChipButton`, `ChipDismissible`, or `ChipToggle`.\n *\n * @category Interactive\n * @platform mobile\n */\nconst Chip = memo(function Chip({\n onPress,\n onToggle,\n isToggled = false,\n onDismiss,\n dismissButtonAriaLabel,\n dismissIcon,\n endIcon,\n disabled = false,\n ...props\n}: ChipProps) {\n const handleToggle = useCallback(\n (nextToggled: boolean) => {\n if (!disabled) {\n onToggle?.(nextToggled);\n }\n },\n [disabled, onToggle],\n );\n\n if (onDismiss) {\n return (\n <ChipDismissible\n onDismiss={onDismiss}\n dismissButtonAriaLabel={dismissButtonAriaLabel}\n dismissIcon={dismissIcon ?? endIcon}\n disabled={disabled}\n {...props}\n />\n );\n }\n\n if (onToggle) {\n return (\n <ChipToggle\n isToggled={isToggled}\n onToggle={handleToggle}\n endIcon={endIcon}\n disabled={disabled}\n {...props}\n />\n );\n }\n\n if (onPress) {\n return (\n <ChipButton\n onPress={disabled ? undefined : onPress}\n endIcon={endIcon}\n disabled={disabled}\n {...props}\n />\n );\n }\n\n return <ChipBase kind=\"link\" endIcon={endIcon} disabled={disabled} {...props} />;\n});\n\nChip.displayName = 'Chip';\n\nexport { Chip };\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,MAAM,OAAO,KAAK,SAAS,KAAK,EAC9B,SACA,UACA,YAAY,OACZ,WACA,wBACA,aACA,SACA,WAAW,OACX,GAAG,SACS;CACZ,MAAM,eAAe,aAClB,gBAAyB;EACxB,IAAI,CAAC,UACH,WAAW,YAAY;IAG3B,CAAC,UAAU,SAAS,CACrB;CAED,IAAI,WACF,OACE,oBAAC,iBAAD;EACa;EACa;EACxB,aAAa,eAAe;EAClB;EACV,GAAI;EACJ,CAAA;CAIN,IAAI,UACF,OACE,oBAAC,YAAD;EACa;EACX,UAAU;EACD;EACC;EACV,GAAI;EACJ,CAAA;CAIN,IAAI,SACF,OACE,oBAAC,YAAD;EACE,SAAS,WAAW,KAAA,IAAY;EACvB;EACC;EACV,GAAI;EACJ,CAAA;CAIN,OAAO,oBAAC,UAAD;EAAU,MAAK;EAAgB;EAAmB;EAAU,GAAI;EAAS,CAAA;EAChF;AAEF,KAAK,cAAc"}
|
|
@@ -0,0 +1,119 @@
|
|
|
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_IconSlot = require("../IconSlot.cjs");
|
|
5
|
+
const require_components_Text = require("../Text.cjs");
|
|
6
|
+
const require_components_Chip_chipTheme = require("./chipTheme.cjs");
|
|
7
|
+
let react = require("react");
|
|
8
|
+
let react_native = require("react-native");
|
|
9
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
+
let react_native_unistyles = require("react-native-unistyles");
|
|
11
|
+
//#region src/components/Chip/ChipBase.tsx
|
|
12
|
+
const DEFAULT_CHIP_SIZE = "md";
|
|
13
|
+
const DEFAULT_CHIP_VARIANT = "primary";
|
|
14
|
+
const DEFAULT_MAX_WIDTH = 200;
|
|
15
|
+
const DEFAULT_TOGGLE_STATE = "off";
|
|
16
|
+
const ChipBase = (0, react.memo)(function ChipBase({ kind, toggleState = DEFAULT_TOGGLE_STATE, variant = DEFAULT_CHIP_VARIANT, size = "md", minWidth, maxWidth = 200, startIcon, endIcon, endContent, disabled = false, pressable = false, onPress, accessibilityRole, accessibilityState, children, style, ref, ...viewProps }) {
|
|
17
|
+
const { theme } = (0, react_native_unistyles.useUnistyles)();
|
|
18
|
+
const [pressed, setPressed] = (0, react.useState)(false);
|
|
19
|
+
const interactionState = pressed ? "pressed" : "rest";
|
|
20
|
+
const rootStyle = (0, react.useMemo)(() => [
|
|
21
|
+
chipStaticStyles.root,
|
|
22
|
+
require_components_Chip_chipTheme.getMergedChipLayerStyle(theme, kind, variant, size, toggleState, "root", interactionState),
|
|
23
|
+
minWidth === void 0 ? void 0 : { minWidth },
|
|
24
|
+
maxWidth === void 0 ? void 0 : { maxWidth },
|
|
25
|
+
disabled ? chipStaticStyles.disabled : void 0,
|
|
26
|
+
style
|
|
27
|
+
], [
|
|
28
|
+
disabled,
|
|
29
|
+
interactionState,
|
|
30
|
+
kind,
|
|
31
|
+
maxWidth,
|
|
32
|
+
minWidth,
|
|
33
|
+
size,
|
|
34
|
+
style,
|
|
35
|
+
theme,
|
|
36
|
+
toggleState,
|
|
37
|
+
variant
|
|
38
|
+
]);
|
|
39
|
+
const textStyle = (0, react.useMemo)(() => [chipStaticStyles.text, require_components_Chip_chipTheme.getMergedChipLayerStyle(theme, kind, variant, size, toggleState, "rootText", interactionState)], [
|
|
40
|
+
interactionState,
|
|
41
|
+
kind,
|
|
42
|
+
size,
|
|
43
|
+
theme,
|
|
44
|
+
toggleState,
|
|
45
|
+
variant
|
|
46
|
+
]);
|
|
47
|
+
const iconStyle = (0, react.useMemo)(() => require_components_Chip_chipTheme.getMergedChipLayerStyle(theme, kind, variant, size, toggleState, "icon", interactionState), [
|
|
48
|
+
interactionState,
|
|
49
|
+
kind,
|
|
50
|
+
size,
|
|
51
|
+
theme,
|
|
52
|
+
toggleState,
|
|
53
|
+
variant
|
|
54
|
+
]);
|
|
55
|
+
const content = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
56
|
+
startIcon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
57
|
+
icon: startIcon,
|
|
58
|
+
variant: "fill",
|
|
59
|
+
style: iconStyle
|
|
60
|
+
}) : null,
|
|
61
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Text.Text, {
|
|
62
|
+
color: "inherit",
|
|
63
|
+
variant: "inherit",
|
|
64
|
+
numberOfLines: 1,
|
|
65
|
+
style: textStyle,
|
|
66
|
+
children
|
|
67
|
+
}),
|
|
68
|
+
endContent ?? (endIcon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
69
|
+
icon: endIcon,
|
|
70
|
+
variant: "fill",
|
|
71
|
+
style: iconStyle
|
|
72
|
+
}) : null)
|
|
73
|
+
] });
|
|
74
|
+
if (pressable) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Pressable, {
|
|
75
|
+
ref,
|
|
76
|
+
accessibilityRole,
|
|
77
|
+
accessibilityState: {
|
|
78
|
+
disabled,
|
|
79
|
+
...accessibilityState
|
|
80
|
+
},
|
|
81
|
+
disabled,
|
|
82
|
+
onPress: disabled ? void 0 : onPress,
|
|
83
|
+
onPressIn: () => setPressed(true),
|
|
84
|
+
onPressOut: () => setPressed(false),
|
|
85
|
+
...viewProps,
|
|
86
|
+
style: rootStyle,
|
|
87
|
+
children: content
|
|
88
|
+
});
|
|
89
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
90
|
+
ref,
|
|
91
|
+
accessibilityRole,
|
|
92
|
+
accessibilityState: {
|
|
93
|
+
disabled,
|
|
94
|
+
...accessibilityState
|
|
95
|
+
},
|
|
96
|
+
...viewProps,
|
|
97
|
+
style: rootStyle,
|
|
98
|
+
children: content
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
ChipBase.displayName = "ChipBase";
|
|
102
|
+
const chipStaticStyles = react_native.StyleSheet.create({
|
|
103
|
+
disabled: { opacity: .5 },
|
|
104
|
+
root: {
|
|
105
|
+
alignItems: "center",
|
|
106
|
+
alignSelf: "flex-start",
|
|
107
|
+
flexDirection: "row",
|
|
108
|
+
overflow: "hidden"
|
|
109
|
+
},
|
|
110
|
+
text: {
|
|
111
|
+
flexShrink: 1,
|
|
112
|
+
textAlign: "center"
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
//#endregion
|
|
116
|
+
exports.ChipBase = ChipBase;
|
|
117
|
+
exports.DEFAULT_CHIP_SIZE = DEFAULT_CHIP_SIZE;
|
|
118
|
+
exports.DEFAULT_CHIP_VARIANT = DEFAULT_CHIP_VARIANT;
|
|
119
|
+
exports.DEFAULT_MAX_WIDTH = DEFAULT_MAX_WIDTH;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
import { ChipSize, ChipVariant } from "../../types/dist/index.cjs";
|
|
3
|
+
import { ChipBaseProps } from "./types.cjs";
|
|
4
|
+
import * as _$react from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/components/Chip/ChipBase.d.ts
|
|
7
|
+
declare const DEFAULT_CHIP_SIZE: ChipSize;
|
|
8
|
+
declare const DEFAULT_CHIP_VARIANT: ChipVariant;
|
|
9
|
+
declare const DEFAULT_MAX_WIDTH = 200;
|
|
10
|
+
declare const ChipBase: _$react.NamedExoticComponent<ChipBaseProps>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { ChipBase, DEFAULT_CHIP_SIZE, DEFAULT_CHIP_VARIANT, DEFAULT_MAX_WIDTH };
|
|
13
|
+
//# sourceMappingURL=ChipBase.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChipBase.d.cts","names":[],"sources":["../../../src/components/Chip/ChipBase.tsx"],"mappings":";;;;;;cAWM,iBAAA,EAAmB,QAAA;AAAA,cACnB,oBAAA,EAAsB,WAAA;AAAA,cACtB,iBAAA;AAAA,cAGA,QAAA,EAAQ,OAAA,CAAA,oBAAA,CAAA,aAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
import { ChipSize, ChipVariant } from "../../types/dist/index.js";
|
|
3
|
+
import { ChipBaseProps } from "./types.js";
|
|
4
|
+
import * as _$react from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/components/Chip/ChipBase.d.ts
|
|
7
|
+
declare const DEFAULT_CHIP_SIZE: ChipSize;
|
|
8
|
+
declare const DEFAULT_CHIP_VARIANT: ChipVariant;
|
|
9
|
+
declare const DEFAULT_MAX_WIDTH = 200;
|
|
10
|
+
declare const ChipBase: _$react.NamedExoticComponent<ChipBaseProps>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { ChipBase, DEFAULT_CHIP_SIZE, DEFAULT_CHIP_VARIANT, DEFAULT_MAX_WIDTH };
|
|
13
|
+
//# sourceMappingURL=ChipBase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChipBase.d.ts","names":[],"sources":["../../../src/components/Chip/ChipBase.tsx"],"mappings":";;;;;;cAWM,iBAAA,EAAmB,QAAA;AAAA,cACnB,oBAAA,EAAsB,WAAA;AAAA,cACtB,iBAAA;AAAA,cAGA,QAAA,EAAQ,OAAA,CAAA,oBAAA,CAAA,aAAA"}
|