@yahoo/uds-mobile 1.3.0-beta.8 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +2 -2
- package/dist/bin/fixtures/dist/index.mjs +25 -1
- package/dist/bin/generateTheme.mjs +5 -5
- package/dist/bin/uds-mobile.mjs +10 -10
- package/dist/components/Avatar.cjs +13 -4
- package/dist/components/Avatar.d.cts +11 -3
- package/dist/components/Avatar.d.cts.map +1 -1
- package/dist/components/Avatar.d.mts +11 -3
- package/dist/components/Avatar.d.mts.map +1 -1
- package/dist/components/Avatar.mjs +11 -3
- package/dist/components/Avatar.mjs.map +1 -1
- package/dist/components/Badge.cjs +15 -4
- package/dist/components/Badge.d.cts +24 -6
- package/dist/components/Badge.d.cts.map +1 -1
- package/dist/components/Badge.d.mts +24 -6
- package/dist/components/Badge.d.mts.map +1 -1
- package/dist/components/Badge.mjs +13 -3
- package/dist/components/Badge.mjs.map +1 -1
- package/dist/components/Box.cjs +15 -11
- package/dist/components/Box.d.cts +15 -10
- package/dist/components/Box.d.cts.map +1 -1
- package/dist/components/Box.d.mts +15 -10
- package/dist/components/Box.d.mts.map +1 -1
- package/dist/components/Box.mjs +13 -10
- package/dist/components/Box.mjs.map +1 -1
- package/dist/components/Button.cjs +15 -5
- package/dist/components/Button.d.cts +21 -6
- package/dist/components/Button.d.cts.map +1 -1
- package/dist/components/Button.d.mts +21 -6
- package/dist/components/Button.d.mts.map +1 -1
- package/dist/components/Button.mjs +12 -3
- package/dist/components/Button.mjs.map +1 -1
- package/dist/components/Checkbox.cjs +16 -7
- package/dist/components/Checkbox.d.cts +14 -5
- package/dist/components/Checkbox.d.cts.map +1 -1
- package/dist/components/Checkbox.d.mts +14 -5
- package/dist/components/Checkbox.d.mts.map +1 -1
- package/dist/components/Checkbox.mjs +13 -5
- package/dist/components/Checkbox.mjs.map +1 -1
- package/dist/components/Chip.cjs +21 -4
- package/dist/components/Chip.d.cts +28 -6
- package/dist/components/Chip.d.cts.map +1 -1
- package/dist/components/Chip.d.mts +28 -6
- package/dist/components/Chip.d.mts.map +1 -1
- package/dist/components/Chip.mjs +19 -3
- package/dist/components/Chip.mjs.map +1 -1
- package/dist/components/HStack.cjs +9 -6
- package/dist/components/HStack.d.cts +9 -5
- package/dist/components/HStack.d.cts.map +1 -1
- package/dist/components/HStack.d.mts +9 -5
- package/dist/components/HStack.d.mts.map +1 -1
- package/dist/components/HStack.mjs +7 -5
- package/dist/components/HStack.mjs.map +1 -1
- package/dist/components/Icon.cjs +17 -6
- package/dist/components/Icon.d.cts +14 -3
- package/dist/components/Icon.d.cts.map +1 -1
- package/dist/components/Icon.d.mts +14 -3
- package/dist/components/Icon.d.mts.map +1 -1
- package/dist/components/Icon.mjs +15 -5
- package/dist/components/Icon.mjs.map +1 -1
- package/dist/components/IconButton.cjs +24 -5
- package/dist/components/IconButton.d.cts +28 -8
- package/dist/components/IconButton.d.cts.map +1 -1
- package/dist/components/IconButton.d.mts +28 -8
- package/dist/components/IconButton.d.mts.map +1 -1
- package/dist/components/IconButton.mjs +22 -4
- package/dist/components/IconButton.mjs.map +1 -1
- package/dist/components/IconSlot.cjs +9 -3
- package/dist/components/IconSlot.d.cts +7 -2
- package/dist/components/IconSlot.d.cts.map +1 -1
- package/dist/components/IconSlot.d.mts +7 -2
- package/dist/components/IconSlot.d.mts.map +1 -1
- package/dist/components/IconSlot.mjs +7 -2
- package/dist/components/IconSlot.mjs.map +1 -1
- package/dist/components/Image.cjs +19 -4
- package/dist/components/Image.d.cts +18 -3
- package/dist/components/Image.d.cts.map +1 -1
- package/dist/components/Image.d.mts +18 -3
- package/dist/components/Image.d.mts.map +1 -1
- package/dist/components/Image.mjs +17 -3
- package/dist/components/Image.mjs.map +1 -1
- package/dist/components/Input.cjs +20 -7
- package/dist/components/Input.d.cts +19 -6
- package/dist/components/Input.d.cts.map +1 -1
- package/dist/components/Input.d.mts +19 -6
- package/dist/components/Input.d.mts.map +1 -1
- package/dist/components/Input.mjs +18 -6
- package/dist/components/Input.mjs.map +1 -1
- package/dist/components/Link.cjs +20 -5
- package/dist/components/Link.d.cts +21 -4
- package/dist/components/Link.d.cts.map +1 -1
- package/dist/components/Link.d.mts +21 -4
- package/dist/components/Link.d.mts.map +1 -1
- package/dist/components/Link.mjs +17 -3
- package/dist/components/Link.mjs.map +1 -1
- package/dist/components/Pressable.cjs +18 -6
- package/dist/components/Pressable.d.cts +18 -5
- package/dist/components/Pressable.d.cts.map +1 -1
- package/dist/components/Pressable.d.mts +18 -5
- package/dist/components/Pressable.d.mts.map +1 -1
- package/dist/components/Pressable.mjs +15 -4
- package/dist/components/Pressable.mjs.map +1 -1
- package/dist/components/Radio.cjs +16 -7
- package/dist/components/Radio.d.cts +14 -5
- package/dist/components/Radio.d.cts.map +1 -1
- package/dist/components/Radio.d.mts +14 -5
- package/dist/components/Radio.d.mts.map +1 -1
- package/dist/components/Radio.mjs +13 -5
- package/dist/components/Radio.mjs.map +1 -1
- package/dist/components/Screen.cjs +10 -4
- package/dist/components/Screen.d.cts +15 -3
- package/dist/components/Screen.d.cts.map +1 -1
- package/dist/components/Screen.d.mts +15 -3
- package/dist/components/Screen.d.mts.map +1 -1
- package/dist/components/Screen.mjs +8 -3
- package/dist/components/Screen.mjs.map +1 -1
- package/dist/components/Switch.cjs +21 -5
- package/dist/components/Switch.d.cts +18 -3
- package/dist/components/Switch.d.cts.map +1 -1
- package/dist/components/Switch.d.mts +18 -3
- package/dist/components/Switch.d.mts.map +1 -1
- package/dist/components/Switch.mjs +18 -3
- package/dist/components/Switch.mjs.map +1 -1
- package/dist/components/Text.cjs +17 -7
- package/dist/components/Text.d.cts +18 -6
- package/dist/components/Text.d.cts.map +1 -1
- package/dist/components/Text.d.mts +18 -6
- package/dist/components/Text.d.mts.map +1 -1
- package/dist/components/Text.mjs +15 -6
- package/dist/components/Text.mjs.map +1 -1
- package/dist/components/VStack.cjs +9 -6
- package/dist/components/VStack.d.cts +9 -5
- package/dist/components/VStack.d.cts.map +1 -1
- package/dist/components/VStack.d.mts +9 -5
- package/dist/components/VStack.d.mts.map +1 -1
- package/dist/components/VStack.mjs +7 -5
- package/dist/components/VStack.mjs.map +1 -1
- package/dist/icons/dist/glyphMap.cjs +2 -2
- package/dist/icons/dist/glyphMap.d.cts +0 -2
- package/dist/icons/dist/glyphMap.d.cts.map +1 -1
- package/dist/icons/dist/glyphMap.d.mts +0 -2
- package/dist/icons/dist/glyphMap.d.mts.map +1 -1
- package/dist/icons/dist/glyphMap.mjs +2 -2
- package/dist/icons/dist/glyphMap.mjs.map +1 -1
- package/dist/icons/dist/svgMap.cjs +2 -2
- package/dist/icons/dist/svgMap.d.cts +0 -2
- package/dist/icons/dist/svgMap.d.cts.map +1 -1
- package/dist/icons/dist/svgMap.d.mts +0 -2
- package/dist/icons/dist/svgMap.d.mts.map +1 -1
- package/dist/icons/dist/svgMap.mjs +2 -2
- package/dist/icons/dist/svgMap.mjs.map +1 -1
- package/dist/icons/dist/tokens.cjs +2 -2
- package/dist/icons/dist/tokens.mjs +2 -2
- package/dist/icons/dist/tokens.mjs.map +1 -1
- package/dist/motion-tokens/dist/index.cjs +1 -1
- package/dist/motion-tokens/dist/index.d.cts +1 -3
- package/dist/motion-tokens/dist/index.d.cts.map +1 -1
- package/dist/motion-tokens/dist/index.d.mts +1 -3
- package/dist/motion-tokens/dist/index.d.mts.map +1 -1
- package/dist/motion-tokens/dist/index.mjs +1 -1
- package/dist/motion.cjs +2 -1
- package/dist/motion.d.cts +0 -1
- package/dist/motion.d.cts.map +1 -1
- package/dist/motion.d.mts +0 -1
- package/dist/motion.d.mts.map +1 -1
- package/dist/motion.mjs +1 -1
- package/dist/types/dist/index.d.cts +1 -3
- package/dist/types/dist/index.d.cts.map +1 -1
- package/dist/types/dist/index.d.mts +1 -3
- package/dist/types/dist/index.d.mts.map +1 -1
- package/dist/types.cjs +1 -1
- package/dist/types.d.cts +0 -3
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +0 -3
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs +1 -1
- package/fonts/index.cjs +205 -205
- package/fonts/index.mjs +205 -205
- package/generated/styles.cjs +119 -23
- package/generated/styles.d.ts +48 -1
- package/generated/styles.mjs +119 -23
- package/generated/unistyles.d.ts +97 -18
- package/package.json +1 -41
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! © 2026 Yahoo, Inc. UDS Mobile
|
|
2
|
-
//#region
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -182,12 +182,36 @@ var lineColors = [
|
|
|
182
182
|
...alwaysPaletteAliases,
|
|
183
183
|
...elevationAliases
|
|
184
184
|
];
|
|
185
|
+
var borderRadiiSort = {
|
|
186
|
+
none: 0,
|
|
187
|
+
xs: 1,
|
|
188
|
+
sm: 2,
|
|
189
|
+
md: 3,
|
|
190
|
+
lg: 4,
|
|
191
|
+
xl: 5,
|
|
192
|
+
full: 6
|
|
193
|
+
};
|
|
194
|
+
var borderRadii = [
|
|
195
|
+
"sm",
|
|
196
|
+
"md",
|
|
197
|
+
"lg",
|
|
198
|
+
"xl",
|
|
199
|
+
"none",
|
|
200
|
+
"xs",
|
|
201
|
+
"full"
|
|
202
|
+
].sort((a, b) => borderRadiiSort[a] - borderRadiiSort[b]);
|
|
203
|
+
var borderWidthSort = {
|
|
204
|
+
none: 0,
|
|
205
|
+
thin: 1,
|
|
206
|
+
medium: 2,
|
|
207
|
+
thick: 3
|
|
208
|
+
};
|
|
185
209
|
var borderWidths = [
|
|
186
210
|
"medium",
|
|
187
211
|
"none",
|
|
188
212
|
"thin",
|
|
189
213
|
"thick"
|
|
190
|
-
];
|
|
214
|
+
].sort((a, b) => borderWidthSort[a] - borderWidthSort[b]);
|
|
191
215
|
var borderWidthsWithElevation = [...borderWidths, ...elevationAliases.map((alias) => `width-${alias}`)];
|
|
192
216
|
var iconSizeSort = {
|
|
193
217
|
xs: 0,
|
|
@@ -283,12 +283,12 @@ function generateComponents(config, colorMode) {
|
|
|
283
283
|
const shadowValues = [];
|
|
284
284
|
for (const [propName, states] of Object.entries(properties)) {
|
|
285
285
|
if (propName === "textVariant") {
|
|
286
|
-
const stateValue
|
|
287
|
-
if (stateValue
|
|
288
|
-
const variantName = stateValue
|
|
286
|
+
const stateValue = states[state];
|
|
287
|
+
if (stateValue && stateValue.type === "textVariants") {
|
|
288
|
+
const variantName = stateValue.value;
|
|
289
289
|
const typographyStyles = resolveTypographyStyles(variantName, typography, config);
|
|
290
|
-
const targetObj
|
|
291
|
-
Object.assign(targetObj
|
|
290
|
+
const targetObj = isRootLayer ? textStyleObj : viewStyleObj;
|
|
291
|
+
Object.assign(targetObj, typographyStyles);
|
|
292
292
|
}
|
|
293
293
|
continue;
|
|
294
294
|
}
|
package/dist/bin/uds-mobile.mjs
CHANGED
|
@@ -13,20 +13,20 @@ import { pathToFileURL } from "node:url";
|
|
|
13
13
|
const args = process.argv.slice(2);
|
|
14
14
|
const command = args[0];
|
|
15
15
|
function parseArgs(argv) {
|
|
16
|
-
const positional
|
|
17
|
-
const options
|
|
18
|
-
const args
|
|
19
|
-
for (let i = 0; i < args
|
|
20
|
-
const arg = args
|
|
16
|
+
const positional = [];
|
|
17
|
+
const options = {};
|
|
18
|
+
const args = argv.slice(1);
|
|
19
|
+
for (let i = 0; i < args.length; i++) {
|
|
20
|
+
const arg = args[i];
|
|
21
21
|
if (arg.startsWith("--")) {
|
|
22
22
|
const key = arg.slice(2);
|
|
23
|
-
const next = args
|
|
24
|
-
options
|
|
25
|
-
} else positional
|
|
23
|
+
const next = args[i + 1];
|
|
24
|
+
options[key] = next && !next.startsWith("-") ? (i++, next) : "true";
|
|
25
|
+
} else positional.push(arg);
|
|
26
26
|
}
|
|
27
27
|
return {
|
|
28
|
-
positional
|
|
29
|
-
options
|
|
28
|
+
positional,
|
|
29
|
+
options
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
const { positional, options } = parseArgs(args);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
/*! © 2026 Yahoo, Inc. UDS Mobile
|
|
2
|
-
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
4
|
const require_components_Box = require('./Box.cjs');
|
|
4
5
|
const require_components_IconSlot = require('./IconSlot.cjs');
|
|
5
6
|
const require_components_Text = require('./Text.cjs');
|
|
@@ -30,6 +31,9 @@ function generateInitials(name, strategy = "firstAndLast") {
|
|
|
30
31
|
* @description
|
|
31
32
|
* Displays a user avatar with image, initials fallback, or icon fallback.
|
|
32
33
|
*
|
|
34
|
+
* @category Display
|
|
35
|
+
* @platform mobile
|
|
36
|
+
*
|
|
33
37
|
* @example
|
|
34
38
|
* ```tsx
|
|
35
39
|
* import { Avatar } from '@yahoo/uds-mobile';
|
|
@@ -50,9 +54,14 @@ function generateInitials(name, strategy = "firstAndLast") {
|
|
|
50
54
|
* <Avatar icon="Person" variant="secondary" />
|
|
51
55
|
* ```
|
|
52
56
|
*
|
|
53
|
-
* @
|
|
57
|
+
* @accessibility
|
|
58
|
+
* - Sets `accessibilityRole="image"` automatically
|
|
59
|
+
* - Uses `alt` prop as accessibility label
|
|
60
|
+
* - Always provide meaningful `alt` text for user identification
|
|
61
|
+
*
|
|
62
|
+
* @see {@link Image} for general image display
|
|
54
63
|
*/
|
|
55
|
-
const Avatar = (0, react.forwardRef)(function Avatar
|
|
64
|
+
const Avatar = (0, react.forwardRef)(function Avatar({ src, alt, fallback, size = "md", variant = "primary", icon, abbreviationStrategy = "firstAndLast", style, ...props }, ref) {
|
|
56
65
|
const [imageError, setImageError] = (0, react.useState)(false);
|
|
57
66
|
const initials = fallback || generateInitials(alt, abbreviationStrategy);
|
|
58
67
|
const hasImage = src && !imageError;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { IconSlotType } from "./IconSlot.cjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react from "react";
|
|
4
4
|
import { View, ViewProps } from "react-native";
|
|
5
5
|
|
|
6
6
|
//#region src/components/Avatar.d.ts
|
|
@@ -32,6 +32,9 @@ interface AvatarProps extends ViewProps {
|
|
|
32
32
|
* @description
|
|
33
33
|
* Displays a user avatar with image, initials fallback, or icon fallback.
|
|
34
34
|
*
|
|
35
|
+
* @category Display
|
|
36
|
+
* @platform mobile
|
|
37
|
+
*
|
|
35
38
|
* @example
|
|
36
39
|
* ```tsx
|
|
37
40
|
* import { Avatar } from '@yahoo/uds-mobile';
|
|
@@ -52,9 +55,14 @@ interface AvatarProps extends ViewProps {
|
|
|
52
55
|
* <Avatar icon="Person" variant="secondary" />
|
|
53
56
|
* ```
|
|
54
57
|
*
|
|
55
|
-
* @
|
|
58
|
+
* @accessibility
|
|
59
|
+
* - Sets `accessibilityRole="image"` automatically
|
|
60
|
+
* - Uses `alt` prop as accessibility label
|
|
61
|
+
* - Always provide meaningful `alt` text for user identification
|
|
62
|
+
*
|
|
63
|
+
* @see {@link Image} for general image display
|
|
56
64
|
*/
|
|
57
|
-
declare const Avatar:
|
|
65
|
+
declare const Avatar: react.ForwardRefExoticComponent<AvatarProps & react.RefAttributes<View>>;
|
|
58
66
|
//#endregion
|
|
59
67
|
export { Avatar, type AvatarProps };
|
|
60
68
|
//# sourceMappingURL=Avatar.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.d.cts","names":[],"sources":["../../src/components/Avatar.tsx"],"
|
|
1
|
+
{"version":3,"file":"Avatar.d.cts","names":[],"sources":["../../src/components/Avatar.tsx"],"mappings":";;;;;;;KAWK,UAAA;;KAGA,aAAA;;KAGA,oBAAA,qFAOC,IAAA;AAAA,UAEI,WAAA,SAAoB,SAAA;EAff;EAiBb,GAAA;EAdgB;EAgBhB,GAAA;EAhBgB;EAkBhB,QAAA;EAfG;EAiBH,IAAA,GAAO,UAAA;;EAEP,OAAA,GAAU,aAAA;EAZM;EAchB,IAAA,GAAO,YAAA;EAZa;EAcpB,oBAAA,GAAuB,oBAAA;AAAA;;;;;;;;;;;;;;;;;;;;;AAAoB;;;;;;;;;;;;;;;;cAoEvC,MAAA,EAAM,KAAA,CAAA,yBAAA,CAAA,WAAA,GAAA,KAAA,CAAA,aAAA,CAAA,IAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { IconSlotType } from "./IconSlot.mjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react from "react";
|
|
4
4
|
import { View, ViewProps } from "react-native";
|
|
5
5
|
|
|
6
6
|
//#region src/components/Avatar.d.ts
|
|
@@ -32,6 +32,9 @@ interface AvatarProps extends ViewProps {
|
|
|
32
32
|
* @description
|
|
33
33
|
* Displays a user avatar with image, initials fallback, or icon fallback.
|
|
34
34
|
*
|
|
35
|
+
* @category Display
|
|
36
|
+
* @platform mobile
|
|
37
|
+
*
|
|
35
38
|
* @example
|
|
36
39
|
* ```tsx
|
|
37
40
|
* import { Avatar } from '@yahoo/uds-mobile';
|
|
@@ -52,9 +55,14 @@ interface AvatarProps extends ViewProps {
|
|
|
52
55
|
* <Avatar icon="Person" variant="secondary" />
|
|
53
56
|
* ```
|
|
54
57
|
*
|
|
55
|
-
* @
|
|
58
|
+
* @accessibility
|
|
59
|
+
* - Sets `accessibilityRole="image"` automatically
|
|
60
|
+
* - Uses `alt` prop as accessibility label
|
|
61
|
+
* - Always provide meaningful `alt` text for user identification
|
|
62
|
+
*
|
|
63
|
+
* @see {@link Image} for general image display
|
|
56
64
|
*/
|
|
57
|
-
declare const Avatar:
|
|
65
|
+
declare const Avatar: react.ForwardRefExoticComponent<AvatarProps & react.RefAttributes<View>>;
|
|
58
66
|
//#endregion
|
|
59
67
|
export { Avatar, type AvatarProps };
|
|
60
68
|
//# sourceMappingURL=Avatar.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.d.mts","names":[],"sources":["../../src/components/Avatar.tsx"],"
|
|
1
|
+
{"version":3,"file":"Avatar.d.mts","names":[],"sources":["../../src/components/Avatar.tsx"],"mappings":";;;;;;;KAWK,UAAA;;KAGA,aAAA;;KAGA,oBAAA,qFAOC,IAAA;AAAA,UAEI,WAAA,SAAoB,SAAA;EAff;EAiBb,GAAA;EAdgB;EAgBhB,GAAA;EAhBgB;EAkBhB,QAAA;EAfG;EAiBH,IAAA,GAAO,UAAA;;EAEP,OAAA,GAAU,aAAA;EAZM;EAchB,IAAA,GAAO,YAAA;EAZa;EAcpB,oBAAA,GAAuB,oBAAA;AAAA;;;;;;;;;;;;;;;;;;;;;AAAoB;;;;;;;;;;;;;;;;cAoEvC,MAAA,EAAM,KAAA,CAAA,yBAAA,CAAA,WAAA,GAAA,KAAA,CAAA,aAAA,CAAA,IAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! © 2026 Yahoo, Inc. UDS Mobile
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
2
|
import { Box } from "./Box.mjs";
|
|
3
3
|
import { IconSlot } from "./IconSlot.mjs";
|
|
4
4
|
import { Text as Text$1 } from "./Text.mjs";
|
|
@@ -29,6 +29,9 @@ function generateInitials(name, strategy = "firstAndLast") {
|
|
|
29
29
|
* @description
|
|
30
30
|
* Displays a user avatar with image, initials fallback, or icon fallback.
|
|
31
31
|
*
|
|
32
|
+
* @category Display
|
|
33
|
+
* @platform mobile
|
|
34
|
+
*
|
|
32
35
|
* @example
|
|
33
36
|
* ```tsx
|
|
34
37
|
* import { Avatar } from '@yahoo/uds-mobile';
|
|
@@ -49,9 +52,14 @@ function generateInitials(name, strategy = "firstAndLast") {
|
|
|
49
52
|
* <Avatar icon="Person" variant="secondary" />
|
|
50
53
|
* ```
|
|
51
54
|
*
|
|
52
|
-
* @
|
|
55
|
+
* @accessibility
|
|
56
|
+
* - Sets `accessibilityRole="image"` automatically
|
|
57
|
+
* - Uses `alt` prop as accessibility label
|
|
58
|
+
* - Always provide meaningful `alt` text for user identification
|
|
59
|
+
*
|
|
60
|
+
* @see {@link Image} for general image display
|
|
53
61
|
*/
|
|
54
|
-
const Avatar = forwardRef(function Avatar
|
|
62
|
+
const Avatar = forwardRef(function Avatar({ src, alt, fallback, size = "md", variant = "primary", icon, abbreviationStrategy = "firstAndLast", style, ...props }, ref) {
|
|
55
63
|
const [imageError, setImageError] = useState(false);
|
|
56
64
|
const initials = fallback || generateInitials(alt, abbreviationStrategy);
|
|
57
65
|
const hasImage = src && !imageError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.mjs","names":["
|
|
1
|
+
{"version":3,"file":"Avatar.mjs","names":["RNImage","Text"],"sources":["../../src/components/Avatar.tsx"],"sourcesContent":["import { forwardRef, useState } from 'react';\nimport type { View, ViewProps } from 'react-native';\nimport { Image as RNImage } from 'react-native';\n\nimport { avatarStyles } from '../../generated/styles';\nimport { Box } from './Box';\nimport type { IconSlotType } from './IconSlot';\nimport { IconSlot } from './IconSlot';\nimport { Text } from './Text';\n\n/** Avatar size options */\ntype AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\n/** Avatar variant options */\ntype AvatarVariant = 'primary' | 'secondary';\n\n/** Abbreviation strategy for generating initials */\ntype AbbreviationStrategy =\n | 'first'\n | 'last'\n | 'firstAndLast'\n | 'firstTwo'\n | 'firstThree'\n | 'firstOfEach'\n | ((name: string) => string);\n\ninterface AvatarProps extends ViewProps {\n /** Image source URL */\n src?: string;\n /** Alt text for the image, also used for generating initials */\n alt?: string;\n /** Explicit initials to display (overrides auto-generated from alt) */\n fallback?: string;\n /** Size of the avatar @default 'md' */\n size?: AvatarSize;\n /** Variant style @default 'primary' */\n variant?: AvatarVariant;\n /** Custom icon to display when no image or text fallback */\n icon?: IconSlotType;\n /** Strategy for generating initials from name @default 'firstAndLast' */\n abbreviationStrategy?: AbbreviationStrategy;\n}\n\nconst abbreviationStrategies: Record<\n Exclude<AbbreviationStrategy, (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\n/** Generate initials from a name */\nfunction generateInitials(name?: string, strategy: AbbreviationStrategy = 'firstAndLast'): 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+/);\n const initials = words.map((word) => word[0]?.toUpperCase() ?? '');\n\n return abbreviationStrategies[strategy](initials);\n}\n\n/**\n * **Avatar component for user representation**\n *\n * @description\n * Displays a user avatar with image, initials fallback, or icon fallback.\n *\n * @category Display\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Avatar } from '@yahoo/uds-mobile';\n *\n * // With image\n * <Avatar\n * src=\"https://example.com/photo.jpg\"\n * alt=\"Jane Doe\"\n * />\n *\n * // With initials fallback\n * <Avatar alt=\"Jane Doe\" />\n *\n * // With explicit initials\n * <Avatar fallback=\"JD\" />\n *\n * // With custom icon\n * <Avatar icon=\"Person\" variant=\"secondary\" />\n * ```\n *\n * @accessibility\n * - Sets `accessibilityRole=\"image\"` automatically\n * - Uses `alt` prop as accessibility label\n * - Always provide meaningful `alt` text for user identification\n *\n * @see {@link Image} for general image display\n */\nconst Avatar = forwardRef<View, AvatarProps>(function Avatar(\n {\n src,\n alt,\n fallback,\n size = 'md',\n variant = 'primary',\n icon,\n abbreviationStrategy = 'firstAndLast',\n style,\n ...props\n },\n ref,\n) {\n const [imageError, setImageError] = useState(false);\n\n const initials = fallback || generateInitials(alt, abbreviationStrategy);\n\n const hasImage = src && !imageError;\n const hasText = initials.length > 0;\n const showImage = hasImage;\n const showText = !hasImage && hasText;\n const showIcon = !hasImage && !hasText;\n\n avatarStyles.useVariants({\n size,\n image: variant,\n text: variant,\n icon: variant,\n });\n\n return (\n <Box\n ref={ref}\n style={[\n avatarStyles.root,\n { alignItems: 'center', justifyContent: 'center', overflow: 'hidden' },\n style,\n ]}\n accessibilityRole=\"image\"\n accessibilityLabel={alt}\n {...props}\n >\n {showImage && (\n <RNImage\n source={{ uri: src }}\n style={{ width: '100%', height: '100%' }}\n onError={() => setImageError(true)}\n accessibilityLabel={alt}\n />\n )}\n\n {showText && (\n <Text style={avatarStyles.text} numberOfLines={1}>\n {initials}\n </Text>\n )}\n\n {showIcon && <IconSlot icon={icon ?? 'Person'} variant=\"fill\" style={avatarStyles.icon} />}\n </Box>\n );\n});\n\nAvatar.displayName = 'Avatar';\n\nexport { Avatar, type AvatarProps };\n"],"mappings":";;;;;;;;;;AA2CA,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;;AAGD,SAAS,iBAAiB,MAAe,WAAiC,gBAAwB;AAChG,KAAI,CAAC,KACH,QAAO;AAGT,KAAI,OAAO,aAAa,WACtB,QAAO,SAAS,KAAK;CAIvB,MAAM,WADQ,KAAK,MAAM,CAAC,MAAM,MAAM,CACf,KAAK,SAAS,KAAK,IAAI,aAAa,IAAI,GAAG;AAElE,QAAO,uBAAuB,UAAU,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCnD,MAAM,SAAS,WAA8B,SAAS,OACpD,EACE,KACA,KACA,UACA,OAAO,MACP,UAAU,WACV,MACA,uBAAuB,gBACvB,OACA,GAAG,SAEL,KACA;CACA,MAAM,CAAC,YAAY,iBAAiB,SAAS,MAAM;CAEnD,MAAM,WAAW,YAAY,iBAAiB,KAAK,qBAAqB;CAExE,MAAM,WAAW,OAAO,CAAC;CACzB,MAAM,UAAU,SAAS,SAAS;CAClC,MAAM,YAAY;CAClB,MAAM,WAAW,CAAC,YAAY;CAC9B,MAAM,WAAW,CAAC,YAAY,CAAC;AAE/B,cAAa,YAAY;EACvB;EACA,OAAO;EACP,MAAM;EACN,MAAM;EACP,CAAC;AAEF,QACE,qBAAC;EACM;EACL,OAAO;GACL,aAAa;GACb;IAAE,YAAY;IAAU,gBAAgB;IAAU,UAAU;IAAU;GACtE;GACD;EACD,mBAAkB;EAClB,oBAAoB;EACpB,GAAI;;GAEH,aACC,oBAACA;IACC,QAAQ,EAAE,KAAK,KAAK;IACpB,OAAO;KAAE,OAAO;KAAQ,QAAQ;KAAQ;IACxC,eAAe,cAAc,KAAK;IAClC,oBAAoB;KACpB;GAGH,YACC,oBAACC;IAAK,OAAO,aAAa;IAAM,eAAe;cAC5C;KACI;GAGR,YAAY,oBAAC;IAAS,MAAM,QAAQ;IAAU,SAAQ;IAAO,OAAO,aAAa;KAAQ;;GACtF;EAER;AAEF,OAAO,cAAc"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
/*! © 2026 Yahoo, Inc. UDS Mobile
|
|
2
|
-
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
4
|
const require_components_IconSlot = require('./IconSlot.cjs');
|
|
4
5
|
const require_components_Text = require('./Text.cjs');
|
|
5
6
|
const require_components_HStack = require('./HStack.cjs');
|
|
@@ -14,16 +15,26 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
14
15
|
* @description
|
|
15
16
|
* Badges show notifications, counts, or status information on navigation items and icons.
|
|
16
17
|
*
|
|
18
|
+
* @category Display
|
|
19
|
+
* @platform mobile
|
|
20
|
+
*
|
|
17
21
|
* @example
|
|
18
22
|
* ```tsx
|
|
19
|
-
* import { Badge } from '
|
|
23
|
+
* import { Badge } from '@yahoo/uds-mobile';
|
|
20
24
|
*
|
|
21
25
|
* <Badge>Label</Badge>
|
|
22
26
|
* <Badge variant="brand" size="sm">New</Badge>
|
|
23
27
|
* <Badge variant="alert" startIcon="Warning">Error</Badge>
|
|
24
28
|
* ```
|
|
29
|
+
*
|
|
30
|
+
* @accessibility
|
|
31
|
+
* - Badge content is read by screen readers
|
|
32
|
+
* - Use descriptive text for status indicators
|
|
33
|
+
* - Consider `accessibilityLabel` for icon-only badges
|
|
34
|
+
*
|
|
35
|
+
* @see {@link Chip} for interactive tag-like elements
|
|
25
36
|
*/
|
|
26
|
-
const Badge = (0, react.memo)(function Badge
|
|
37
|
+
const Badge = (0, react.memo)(function Badge({ variant = "primary", size = "md", minWidth, maxWidth = 200, startIcon, endIcon, dangerouslySetBackgroundColor, dangerouslySetColor, dangerouslySetIconColor, dangerouslySetBorderColor, children, style, ref, ...rest }) {
|
|
27
38
|
generated_styles.badgeStyles.useVariants({
|
|
28
39
|
size,
|
|
29
40
|
variant
|
|
@@ -1,25 +1,33 @@
|
|
|
1
1
|
|
|
2
2
|
import { BadgeSize, BadgeVariant } from "../types/dist/index.cjs";
|
|
3
3
|
import { IconSlotType } from "./IconSlot.cjs";
|
|
4
|
-
import * as
|
|
4
|
+
import * as react from "react";
|
|
5
5
|
import { Ref } from "react";
|
|
6
6
|
import { View, ViewProps } from "react-native";
|
|
7
7
|
|
|
8
8
|
//#region src/components/Badge.d.ts
|
|
9
9
|
interface BadgeProps extends ViewProps {
|
|
10
|
-
/** @default 'primary' */
|
|
10
|
+
/** The visual style variant of the badge. @default 'primary' */
|
|
11
11
|
variant?: BadgeVariant;
|
|
12
|
-
/** @default 'md' */
|
|
12
|
+
/** The size of the badge. @default 'md' */
|
|
13
13
|
size?: BadgeSize;
|
|
14
|
+
/** Minimum width of the badge in pixels. */
|
|
14
15
|
minWidth?: number;
|
|
15
|
-
/** @default 200 */
|
|
16
|
+
/** Maximum width of the badge in pixels. @default 200 */
|
|
16
17
|
maxWidth?: number;
|
|
18
|
+
/** Icon to display at the start of the badge. */
|
|
17
19
|
startIcon?: IconSlotType;
|
|
20
|
+
/** Icon to display at the end of the badge. */
|
|
18
21
|
endIcon?: IconSlotType;
|
|
22
|
+
/** Override the background color. Use sparingly. */
|
|
19
23
|
dangerouslySetBackgroundColor?: string;
|
|
24
|
+
/** Override the text color. Use sparingly. */
|
|
20
25
|
dangerouslySetColor?: string;
|
|
26
|
+
/** Override the border color. Use sparingly. */
|
|
21
27
|
dangerouslySetBorderColor?: string;
|
|
28
|
+
/** Override the icon color. Use sparingly. */
|
|
22
29
|
dangerouslySetIconColor?: string;
|
|
30
|
+
/** Ref to the underlying View component. */
|
|
23
31
|
ref?: Ref<View>;
|
|
24
32
|
}
|
|
25
33
|
/**
|
|
@@ -28,16 +36,26 @@ interface BadgeProps extends ViewProps {
|
|
|
28
36
|
* @description
|
|
29
37
|
* Badges show notifications, counts, or status information on navigation items and icons.
|
|
30
38
|
*
|
|
39
|
+
* @category Display
|
|
40
|
+
* @platform mobile
|
|
41
|
+
*
|
|
31
42
|
* @example
|
|
32
43
|
* ```tsx
|
|
33
|
-
* import { Badge } from '
|
|
44
|
+
* import { Badge } from '@yahoo/uds-mobile';
|
|
34
45
|
*
|
|
35
46
|
* <Badge>Label</Badge>
|
|
36
47
|
* <Badge variant="brand" size="sm">New</Badge>
|
|
37
48
|
* <Badge variant="alert" startIcon="Warning">Error</Badge>
|
|
38
49
|
* ```
|
|
50
|
+
*
|
|
51
|
+
* @accessibility
|
|
52
|
+
* - Badge content is read by screen readers
|
|
53
|
+
* - Use descriptive text for status indicators
|
|
54
|
+
* - Consider `accessibilityLabel` for icon-only badges
|
|
55
|
+
*
|
|
56
|
+
* @see {@link Chip} for interactive tag-like elements
|
|
39
57
|
*/
|
|
40
|
-
declare const Badge:
|
|
58
|
+
declare const Badge: react.NamedExoticComponent<BadgeProps>;
|
|
41
59
|
//#endregion
|
|
42
60
|
export { Badge, type BadgeProps };
|
|
43
61
|
//# sourceMappingURL=Badge.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.d.cts","names":[],"sources":["../../src/components/Badge.tsx"],"
|
|
1
|
+
{"version":3,"file":"Badge.d.cts","names":[],"sources":["../../src/components/Badge.tsx"],"mappings":";;;;;;;;UAWU,UAAA,SAAmB,SAAA;;EAE3B,OAAA,GAAU,YAAA;EAFF;EAIR,IAAA,GAAO,SAAA;;EAEP,QAAA;EAFO;EAIP,QAAA;EAIU;EAFV,SAAA,GAAY,YAAA;EAYN;EAVN,OAAA,GAAU,YAAA;EAZ0B;EAcpC,6BAAA;EAd2B;EAgB3B,mBAAA;EAdU;EAgBV,yBAAA;EAdO;EAgBP,uBAAA;EAZA;EAcA,GAAA,GAAM,GAAA,CAAI,IAAA;AAAA;;;;;;;;;;;;AAAI;;;;;;;;;;;;;;cA4BV,KAAA,EAAK,KAAA,CAAA,oBAAA,CAAA,UAAA"}
|
|
@@ -1,25 +1,33 @@
|
|
|
1
1
|
|
|
2
2
|
import { BadgeSize, BadgeVariant } from "../types/dist/index.mjs";
|
|
3
3
|
import { IconSlotType } from "./IconSlot.mjs";
|
|
4
|
-
import * as
|
|
4
|
+
import * as react from "react";
|
|
5
5
|
import { Ref } from "react";
|
|
6
6
|
import { View, ViewProps } from "react-native";
|
|
7
7
|
|
|
8
8
|
//#region src/components/Badge.d.ts
|
|
9
9
|
interface BadgeProps extends ViewProps {
|
|
10
|
-
/** @default 'primary' */
|
|
10
|
+
/** The visual style variant of the badge. @default 'primary' */
|
|
11
11
|
variant?: BadgeVariant;
|
|
12
|
-
/** @default 'md' */
|
|
12
|
+
/** The size of the badge. @default 'md' */
|
|
13
13
|
size?: BadgeSize;
|
|
14
|
+
/** Minimum width of the badge in pixels. */
|
|
14
15
|
minWidth?: number;
|
|
15
|
-
/** @default 200 */
|
|
16
|
+
/** Maximum width of the badge in pixels. @default 200 */
|
|
16
17
|
maxWidth?: number;
|
|
18
|
+
/** Icon to display at the start of the badge. */
|
|
17
19
|
startIcon?: IconSlotType;
|
|
20
|
+
/** Icon to display at the end of the badge. */
|
|
18
21
|
endIcon?: IconSlotType;
|
|
22
|
+
/** Override the background color. Use sparingly. */
|
|
19
23
|
dangerouslySetBackgroundColor?: string;
|
|
24
|
+
/** Override the text color. Use sparingly. */
|
|
20
25
|
dangerouslySetColor?: string;
|
|
26
|
+
/** Override the border color. Use sparingly. */
|
|
21
27
|
dangerouslySetBorderColor?: string;
|
|
28
|
+
/** Override the icon color. Use sparingly. */
|
|
22
29
|
dangerouslySetIconColor?: string;
|
|
30
|
+
/** Ref to the underlying View component. */
|
|
23
31
|
ref?: Ref<View>;
|
|
24
32
|
}
|
|
25
33
|
/**
|
|
@@ -28,16 +36,26 @@ interface BadgeProps extends ViewProps {
|
|
|
28
36
|
* @description
|
|
29
37
|
* Badges show notifications, counts, or status information on navigation items and icons.
|
|
30
38
|
*
|
|
39
|
+
* @category Display
|
|
40
|
+
* @platform mobile
|
|
41
|
+
*
|
|
31
42
|
* @example
|
|
32
43
|
* ```tsx
|
|
33
|
-
* import { Badge } from '
|
|
44
|
+
* import { Badge } from '@yahoo/uds-mobile';
|
|
34
45
|
*
|
|
35
46
|
* <Badge>Label</Badge>
|
|
36
47
|
* <Badge variant="brand" size="sm">New</Badge>
|
|
37
48
|
* <Badge variant="alert" startIcon="Warning">Error</Badge>
|
|
38
49
|
* ```
|
|
50
|
+
*
|
|
51
|
+
* @accessibility
|
|
52
|
+
* - Badge content is read by screen readers
|
|
53
|
+
* - Use descriptive text for status indicators
|
|
54
|
+
* - Consider `accessibilityLabel` for icon-only badges
|
|
55
|
+
*
|
|
56
|
+
* @see {@link Chip} for interactive tag-like elements
|
|
39
57
|
*/
|
|
40
|
-
declare const Badge:
|
|
58
|
+
declare const Badge: react.NamedExoticComponent<BadgeProps>;
|
|
41
59
|
//#endregion
|
|
42
60
|
export { Badge, type BadgeProps };
|
|
43
61
|
//# sourceMappingURL=Badge.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.d.mts","names":[],"sources":["../../src/components/Badge.tsx"],"
|
|
1
|
+
{"version":3,"file":"Badge.d.mts","names":[],"sources":["../../src/components/Badge.tsx"],"mappings":";;;;;;;;UAWU,UAAA,SAAmB,SAAA;;EAE3B,OAAA,GAAU,YAAA;EAFF;EAIR,IAAA,GAAO,SAAA;;EAEP,QAAA;EAFO;EAIP,QAAA;EAIU;EAFV,SAAA,GAAY,YAAA;EAYN;EAVN,OAAA,GAAU,YAAA;EAZ0B;EAcpC,6BAAA;EAd2B;EAgB3B,mBAAA;EAdU;EAgBV,yBAAA;EAdO;EAgBP,uBAAA;EAZA;EAcA,GAAA,GAAM,GAAA,CAAI,IAAA;AAAA;;;;;;;;;;;;AAAI;;;;;;;;;;;;;;cA4BV,KAAA,EAAK,KAAA,CAAA,oBAAA,CAAA,UAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! © 2026 Yahoo, Inc. UDS Mobile
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
2
|
import { IconSlot } from "./IconSlot.mjs";
|
|
3
3
|
import { Text } from "./Text.mjs";
|
|
4
4
|
import { HStack } from "./HStack.mjs";
|
|
@@ -13,16 +13,26 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
* @description
|
|
14
14
|
* Badges show notifications, counts, or status information on navigation items and icons.
|
|
15
15
|
*
|
|
16
|
+
* @category Display
|
|
17
|
+
* @platform mobile
|
|
18
|
+
*
|
|
16
19
|
* @example
|
|
17
20
|
* ```tsx
|
|
18
|
-
* import { Badge } from '
|
|
21
|
+
* import { Badge } from '@yahoo/uds-mobile';
|
|
19
22
|
*
|
|
20
23
|
* <Badge>Label</Badge>
|
|
21
24
|
* <Badge variant="brand" size="sm">New</Badge>
|
|
22
25
|
* <Badge variant="alert" startIcon="Warning">Error</Badge>
|
|
23
26
|
* ```
|
|
27
|
+
*
|
|
28
|
+
* @accessibility
|
|
29
|
+
* - Badge content is read by screen readers
|
|
30
|
+
* - Use descriptive text for status indicators
|
|
31
|
+
* - Consider `accessibilityLabel` for icon-only badges
|
|
32
|
+
*
|
|
33
|
+
* @see {@link Chip} for interactive tag-like elements
|
|
24
34
|
*/
|
|
25
|
-
const Badge = memo(function Badge
|
|
35
|
+
const Badge = memo(function Badge({ variant = "primary", size = "md", minWidth, maxWidth = 200, startIcon, endIcon, dangerouslySetBackgroundColor, dangerouslySetColor, dangerouslySetIconColor, dangerouslySetBorderColor, children, style, ref, ...rest }) {
|
|
26
36
|
badgeStyles.useVariants({
|
|
27
37
|
size,
|
|
28
38
|
variant
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.mjs","names":[
|
|
1
|
+
{"version":3,"file":"Badge.mjs","names":[],"sources":["../../src/components/Badge.tsx"],"sourcesContent":["import type { BadgeSize, BadgeVariant } from '@yahoo/uds-types';\nimport type { Ref } from 'react';\nimport { memo, useMemo } from 'react';\nimport type { View, ViewProps } from 'react-native';\n\nimport { badgeStyles } from '../../generated/styles';\nimport { HStack } from './HStack';\nimport type { IconSlotType } from './IconSlot';\nimport { IconSlot } from './IconSlot';\nimport { Text } from './Text';\n\ninterface BadgeProps extends ViewProps {\n /** The visual style variant of the badge. @default 'primary' */\n variant?: BadgeVariant;\n /** The size of the badge. @default 'md' */\n size?: BadgeSize;\n /** Minimum width of the badge in pixels. */\n minWidth?: number;\n /** Maximum width of the badge in pixels. @default 200 */\n maxWidth?: number;\n /** Icon to display at the start of the badge. */\n startIcon?: IconSlotType;\n /** Icon to display at the end of the badge. */\n endIcon?: IconSlotType;\n /** Override the background color. Use sparingly. */\n dangerouslySetBackgroundColor?: string;\n /** Override the text color. Use sparingly. */\n dangerouslySetColor?: string;\n /** Override the border color. Use sparingly. */\n dangerouslySetBorderColor?: string;\n /** Override the icon color. Use sparingly. */\n dangerouslySetIconColor?: string;\n /** Ref to the underlying View component. */\n ref?: Ref<View>;\n}\n\n/**\n * **A badge component for status indicators**\n *\n * @description\n * Badges show notifications, counts, or status information on navigation items and icons.\n *\n * @category Display\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Badge } from '@yahoo/uds-mobile';\n *\n * <Badge>Label</Badge>\n * <Badge variant=\"brand\" size=\"sm\">New</Badge>\n * <Badge variant=\"alert\" startIcon=\"Warning\">Error</Badge>\n * ```\n *\n * @accessibility\n * - Badge content is read by screen readers\n * - Use descriptive text for status indicators\n * - Consider `accessibilityLabel` for icon-only badges\n *\n * @see {@link Chip} for interactive tag-like elements\n */\nconst Badge = memo(function Badge({\n variant = 'primary',\n size = 'md',\n minWidth,\n maxWidth = 200,\n startIcon,\n endIcon,\n dangerouslySetBackgroundColor,\n dangerouslySetColor,\n dangerouslySetIconColor,\n dangerouslySetBorderColor,\n children,\n style,\n ref,\n ...rest\n}: BadgeProps) {\n badgeStyles.useVariants({ size, variant });\n const rootStyles = useMemo(() => [badgeStyles.root, style], [style, badgeStyles.root]);\n\n return (\n <HStack\n ref={ref}\n alignItems=\"center\"\n overflow=\"hidden\"\n alignSelf=\"flex-start\"\n maxWidth={maxWidth}\n minWidth={minWidth}\n dangerouslySetBackgroundColor={dangerouslySetBackgroundColor}\n dangerouslySetBorderColor={dangerouslySetBorderColor}\n // Cannot memoize - styles contain theme-reactive values\n style={rootStyles}\n {...rest}\n >\n {startIcon && (\n <IconSlot\n icon={startIcon}\n variant=\"fill\"\n dangerouslySetColor={dangerouslySetIconColor}\n style={badgeStyles.icon}\n />\n )}\n <Text\n numberOfLines={1}\n flexShrink=\"1\"\n dangerouslySetColor={dangerouslySetColor}\n style={badgeStyles.text}\n >\n {children}\n </Text>\n {endIcon && (\n <IconSlot\n icon={endIcon}\n variant=\"fill\"\n dangerouslySetColor={dangerouslySetIconColor}\n style={badgeStyles.icon}\n />\n )}\n </HStack>\n );\n});\n\nBadge.displayName = 'Badge';\n\nexport { Badge, type BadgeProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,MAAM,QAAQ,KAAK,SAAS,MAAM,EAChC,UAAU,WACV,OAAO,MACP,UACA,WAAW,KACX,WACA,SACA,+BACA,qBACA,yBACA,2BACA,UACA,OACA,KACA,GAAG,QACU;AACb,aAAY,YAAY;EAAE;EAAM;EAAS,CAAC;AAG1C,QACE,qBAAC;EACM;EACL,YAAW;EACX,UAAS;EACT,WAAU;EACA;EACA;EACqB;EACJ;EAE3B,OAbe,cAAc,CAAC,YAAY,MAAM,MAAM,EAAE,CAAC,OAAO,YAAY,KAAK,CAAC;EAclF,GAAI;;GAEH,aACC,oBAAC;IACC,MAAM;IACN,SAAQ;IACR,qBAAqB;IACrB,OAAO,YAAY;KACnB;GAEJ,oBAAC;IACC,eAAe;IACf,YAAW;IACU;IACrB,OAAO,YAAY;IAElB;KACI;GACN,WACC,oBAAC;IACC,MAAM;IACN,SAAQ;IACR,qBAAqB;IACrB,OAAO,YAAY;KACnB;;GAEG;EAEX;AAEF,MAAM,cAAc"}
|
package/dist/components/Box.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
/*! © 2026 Yahoo, Inc. UDS Mobile
|
|
2
|
-
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
4
|
let react = require("react");
|
|
4
5
|
let react_native = require("react-native");
|
|
5
6
|
let generated_styles = require("../../generated/styles");
|
|
@@ -10,13 +11,16 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
10
11
|
* **📦 A layout component that can be used to compose other components**
|
|
11
12
|
*
|
|
12
13
|
* @description
|
|
13
|
-
* The most simple component we ship - a
|
|
14
|
+
* The most simple component we ship - a View. But with all the power of the UDS design system.
|
|
14
15
|
* By default, `Box` is a flexbox container. When working with vertical or horizontal layouts,
|
|
15
|
-
* consider using
|
|
16
|
+
* consider using VStack or HStack respectively.
|
|
17
|
+
*
|
|
18
|
+
* @category Layout
|
|
19
|
+
* @platform mobile
|
|
16
20
|
*
|
|
17
21
|
* @example
|
|
18
22
|
* ```tsx
|
|
19
|
-
* import { Box } from '@yahoo/uds-mobile
|
|
23
|
+
* import { Box } from '@yahoo/uds-mobile';
|
|
20
24
|
*
|
|
21
25
|
* <Box backgroundColor="primary" spacing="6">
|
|
22
26
|
* Any kind of content can go here!
|
|
@@ -24,14 +28,14 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
24
28
|
* ```
|
|
25
29
|
*
|
|
26
30
|
* @usage
|
|
27
|
-
* -
|
|
28
|
-
* -
|
|
29
|
-
*
|
|
30
|
-
* @see The {@link https://uds.build/docs/components/box Box Docs} for more info
|
|
31
|
+
* - Use as a container to apply padding, shapes, or other styling
|
|
32
|
+
* - Use for creating card components
|
|
33
|
+
* - Use HStack/VStack for directional layouts
|
|
31
34
|
*
|
|
32
|
-
* @
|
|
35
|
+
* @see {@link HStack} for horizontal layouts
|
|
36
|
+
* @see {@link VStack} for vertical layouts
|
|
33
37
|
*/
|
|
34
|
-
const Box = (0, react.memo)(function Box
|
|
38
|
+
const Box = (0, react.memo)(function Box({ backgroundColor, dangerouslySetBackgroundColor, borderRadius, borderTopStartRadius, borderTopEndRadius, borderBottomStartRadius, borderBottomEndRadius, borderColor, dangerouslySetBorderColor, borderStartColor, borderEndColor, borderTopColor, borderBottomColor, borderWidth, borderVerticalWidth, borderHorizontalWidth, borderStartWidth, borderEndWidth, borderTopWidth, borderBottomWidth, alignContent, alignItems, alignSelf, flex, flexDirection, flexGrow, flexShrink, flexWrap, justifyContent, display = "flex", overflow, spacing, spacingHorizontal, spacingVertical, spacingBottom, spacingEnd, spacingStart, spacingTop, offset, offsetVertical, offsetHorizontal, offsetBottom, offsetEnd, offsetStart, offsetTop, columnGap, rowGap, width, height, minWidth, maxWidth, minHeight, maxHeight, style, ref, ...props }) {
|
|
35
39
|
const variants = {
|
|
36
40
|
backgroundColor,
|
|
37
41
|
borderRadius,
|