@yahoo/uds-mobile 1.3.0-beta.9 → 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.
Files changed (165) hide show
  1. package/dist/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +1 -1
  2. package/dist/bin/fixtures/dist/index.mjs +25 -1
  3. package/dist/bin/generateTheme.mjs +5 -5
  4. package/dist/bin/uds-mobile.mjs +10 -10
  5. package/dist/components/Avatar.cjs +12 -3
  6. package/dist/components/Avatar.d.cts +11 -3
  7. package/dist/components/Avatar.d.cts.map +1 -1
  8. package/dist/components/Avatar.d.mts +11 -3
  9. package/dist/components/Avatar.d.mts.map +1 -1
  10. package/dist/components/Avatar.mjs +10 -2
  11. package/dist/components/Avatar.mjs.map +1 -1
  12. package/dist/components/Badge.cjs +14 -3
  13. package/dist/components/Badge.d.cts +24 -6
  14. package/dist/components/Badge.d.cts.map +1 -1
  15. package/dist/components/Badge.d.mts +24 -6
  16. package/dist/components/Badge.d.mts.map +1 -1
  17. package/dist/components/Badge.mjs +12 -2
  18. package/dist/components/Badge.mjs.map +1 -1
  19. package/dist/components/Box.cjs +14 -10
  20. package/dist/components/Box.d.cts +15 -10
  21. package/dist/components/Box.d.cts.map +1 -1
  22. package/dist/components/Box.d.mts +15 -10
  23. package/dist/components/Box.d.mts.map +1 -1
  24. package/dist/components/Box.mjs +12 -9
  25. package/dist/components/Box.mjs.map +1 -1
  26. package/dist/components/Button.cjs +14 -4
  27. package/dist/components/Button.d.cts +21 -6
  28. package/dist/components/Button.d.cts.map +1 -1
  29. package/dist/components/Button.d.mts +21 -6
  30. package/dist/components/Button.d.mts.map +1 -1
  31. package/dist/components/Button.mjs +11 -2
  32. package/dist/components/Button.mjs.map +1 -1
  33. package/dist/components/Checkbox.cjs +15 -6
  34. package/dist/components/Checkbox.d.cts +14 -5
  35. package/dist/components/Checkbox.d.cts.map +1 -1
  36. package/dist/components/Checkbox.d.mts +14 -5
  37. package/dist/components/Checkbox.d.mts.map +1 -1
  38. package/dist/components/Checkbox.mjs +12 -4
  39. package/dist/components/Checkbox.mjs.map +1 -1
  40. package/dist/components/Chip.cjs +20 -3
  41. package/dist/components/Chip.d.cts +28 -6
  42. package/dist/components/Chip.d.cts.map +1 -1
  43. package/dist/components/Chip.d.mts +28 -6
  44. package/dist/components/Chip.d.mts.map +1 -1
  45. package/dist/components/Chip.mjs +18 -2
  46. package/dist/components/Chip.mjs.map +1 -1
  47. package/dist/components/HStack.cjs +8 -5
  48. package/dist/components/HStack.d.cts +9 -5
  49. package/dist/components/HStack.d.cts.map +1 -1
  50. package/dist/components/HStack.d.mts +9 -5
  51. package/dist/components/HStack.d.mts.map +1 -1
  52. package/dist/components/HStack.mjs +6 -4
  53. package/dist/components/HStack.mjs.map +1 -1
  54. package/dist/components/Icon.cjs +16 -5
  55. package/dist/components/Icon.d.cts +14 -3
  56. package/dist/components/Icon.d.cts.map +1 -1
  57. package/dist/components/Icon.d.mts +14 -3
  58. package/dist/components/Icon.d.mts.map +1 -1
  59. package/dist/components/Icon.mjs +14 -4
  60. package/dist/components/Icon.mjs.map +1 -1
  61. package/dist/components/IconButton.cjs +23 -4
  62. package/dist/components/IconButton.d.cts +28 -8
  63. package/dist/components/IconButton.d.cts.map +1 -1
  64. package/dist/components/IconButton.d.mts +28 -8
  65. package/dist/components/IconButton.d.mts.map +1 -1
  66. package/dist/components/IconButton.mjs +21 -3
  67. package/dist/components/IconButton.mjs.map +1 -1
  68. package/dist/components/IconSlot.cjs +8 -2
  69. package/dist/components/IconSlot.d.cts +7 -2
  70. package/dist/components/IconSlot.d.cts.map +1 -1
  71. package/dist/components/IconSlot.d.mts +7 -2
  72. package/dist/components/IconSlot.d.mts.map +1 -1
  73. package/dist/components/IconSlot.mjs +6 -1
  74. package/dist/components/IconSlot.mjs.map +1 -1
  75. package/dist/components/Image.cjs +18 -3
  76. package/dist/components/Image.d.cts +18 -3
  77. package/dist/components/Image.d.cts.map +1 -1
  78. package/dist/components/Image.d.mts +18 -3
  79. package/dist/components/Image.d.mts.map +1 -1
  80. package/dist/components/Image.mjs +16 -2
  81. package/dist/components/Image.mjs.map +1 -1
  82. package/dist/components/Input.cjs +19 -6
  83. package/dist/components/Input.d.cts +19 -6
  84. package/dist/components/Input.d.cts.map +1 -1
  85. package/dist/components/Input.d.mts +19 -6
  86. package/dist/components/Input.d.mts.map +1 -1
  87. package/dist/components/Input.mjs +17 -5
  88. package/dist/components/Input.mjs.map +1 -1
  89. package/dist/components/Link.cjs +19 -4
  90. package/dist/components/Link.d.cts +21 -4
  91. package/dist/components/Link.d.cts.map +1 -1
  92. package/dist/components/Link.d.mts +21 -4
  93. package/dist/components/Link.d.mts.map +1 -1
  94. package/dist/components/Link.mjs +16 -2
  95. package/dist/components/Link.mjs.map +1 -1
  96. package/dist/components/Pressable.cjs +17 -5
  97. package/dist/components/Pressable.d.cts +18 -5
  98. package/dist/components/Pressable.d.cts.map +1 -1
  99. package/dist/components/Pressable.d.mts +18 -5
  100. package/dist/components/Pressable.d.mts.map +1 -1
  101. package/dist/components/Pressable.mjs +14 -3
  102. package/dist/components/Pressable.mjs.map +1 -1
  103. package/dist/components/Radio.cjs +15 -6
  104. package/dist/components/Radio.d.cts +14 -5
  105. package/dist/components/Radio.d.cts.map +1 -1
  106. package/dist/components/Radio.d.mts +14 -5
  107. package/dist/components/Radio.d.mts.map +1 -1
  108. package/dist/components/Radio.mjs +12 -4
  109. package/dist/components/Radio.mjs.map +1 -1
  110. package/dist/components/Screen.cjs +9 -3
  111. package/dist/components/Screen.d.cts +15 -3
  112. package/dist/components/Screen.d.cts.map +1 -1
  113. package/dist/components/Screen.d.mts +15 -3
  114. package/dist/components/Screen.d.mts.map +1 -1
  115. package/dist/components/Screen.mjs +7 -2
  116. package/dist/components/Screen.mjs.map +1 -1
  117. package/dist/components/Switch.cjs +20 -4
  118. package/dist/components/Switch.d.cts +18 -3
  119. package/dist/components/Switch.d.cts.map +1 -1
  120. package/dist/components/Switch.d.mts +18 -3
  121. package/dist/components/Switch.d.mts.map +1 -1
  122. package/dist/components/Switch.mjs +17 -2
  123. package/dist/components/Switch.mjs.map +1 -1
  124. package/dist/components/Text.cjs +16 -6
  125. package/dist/components/Text.d.cts +18 -6
  126. package/dist/components/Text.d.cts.map +1 -1
  127. package/dist/components/Text.d.mts +18 -6
  128. package/dist/components/Text.d.mts.map +1 -1
  129. package/dist/components/Text.mjs +14 -5
  130. package/dist/components/Text.mjs.map +1 -1
  131. package/dist/components/VStack.cjs +8 -5
  132. package/dist/components/VStack.d.cts +9 -5
  133. package/dist/components/VStack.d.cts.map +1 -1
  134. package/dist/components/VStack.d.mts +9 -5
  135. package/dist/components/VStack.d.mts.map +1 -1
  136. package/dist/components/VStack.mjs +6 -4
  137. package/dist/components/VStack.mjs.map +1 -1
  138. package/dist/icons/dist/glyphMap.d.cts +0 -1
  139. package/dist/icons/dist/glyphMap.d.cts.map +1 -1
  140. package/dist/icons/dist/glyphMap.d.mts +0 -1
  141. package/dist/icons/dist/glyphMap.d.mts.map +1 -1
  142. package/dist/icons/dist/svgMap.d.cts +0 -1
  143. package/dist/icons/dist/svgMap.d.cts.map +1 -1
  144. package/dist/icons/dist/svgMap.d.mts +0 -1
  145. package/dist/icons/dist/svgMap.d.mts.map +1 -1
  146. package/dist/motion-tokens/dist/index.d.cts +1 -3
  147. package/dist/motion-tokens/dist/index.d.cts.map +1 -1
  148. package/dist/motion-tokens/dist/index.d.mts +1 -3
  149. package/dist/motion-tokens/dist/index.d.mts.map +1 -1
  150. package/dist/motion.cjs +1 -0
  151. package/dist/motion.d.cts +0 -1
  152. package/dist/motion.d.cts.map +1 -1
  153. package/dist/motion.d.mts +0 -1
  154. package/dist/motion.d.mts.map +1 -1
  155. package/dist/types/dist/index.d.cts +1 -3
  156. package/dist/types/dist/index.d.cts.map +1 -1
  157. package/dist/types/dist/index.d.mts +1 -3
  158. package/dist/types/dist/index.d.mts.map +1 -1
  159. package/dist/types.d.cts.map +1 -1
  160. package/dist/types.d.mts.map +1 -1
  161. package/generated/styles.cjs +96 -0
  162. package/generated/styles.d.ts +47 -0
  163. package/generated/styles.mjs +96 -0
  164. package/generated/unistyles.d.ts +79 -0
  165. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
2
- //#region rolldown:runtime
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$1 = states[state];
287
- if (stateValue$1 && stateValue$1.type === "textVariants") {
288
- const variantName = stateValue$1.value;
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$1 = isRootLayer ? textStyleObj : viewStyleObj;
291
- Object.assign(targetObj$1, typographyStyles);
290
+ const targetObj = isRootLayer ? textStyleObj : viewStyleObj;
291
+ Object.assign(targetObj, typographyStyles);
292
292
  }
293
293
  continue;
294
294
  }
@@ -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$1 = [];
17
- const options$1 = {};
18
- const args$1 = argv.slice(1);
19
- for (let i = 0; i < args$1.length; i++) {
20
- const arg = args$1[i];
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$1[i + 1];
24
- options$1[key] = next && !next.startsWith("-") ? (i++, next) : "true";
25
- } else positional$1.push(arg);
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: positional$1,
29
- options: options$1
28
+ positional,
29
+ options
30
30
  };
31
31
  }
32
32
  const { positional, options } = parseArgs(args);
@@ -1,5 +1,6 @@
1
1
  /*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
2
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
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
- * @see The {@link https://uds.build/docs/components/avatar Avatar Docs} for more info
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$1({ src, alt, fallback, size = "md", variant = "primary", icon, abbreviationStrategy = "firstAndLast", style, ...props }, ref) {
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 react0 from "react";
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
- * @see The {@link https://uds.build/docs/components/avatar Avatar Docs} for more info
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: react0.ForwardRefExoticComponent<AvatarProps & react0.RefAttributes<View>>;
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"],"sourcesContent":[],"mappings":";;;;;;;KAWK,UAAA;;AAL0C,KAQ1C,aAAA,GAHU,SAAA,GAAA,WAAA;AAAA;AAGG,KAGb,oBAAA,GAAoB,OAAA,GAAA,MAAA,GAAA,cAAA,GAAA,UAAA,GAAA,YAAA,GAAA,aAAA,GAAA,CAAA,CAAA,IAAA,EAAA,MAAA,EAAA,GAAA,MAAA,CAAA;AAAA,UASf,WAAA,SAAoB,SAAR,CAAA;EAQb;EAEG,GAAA,CAAA,EAAA,MAAA;EAEH;EAEgB,GAAA,CAAA,EAAA,MAAA;EAdK;EAAS,QAAA,CAAA,EAAA,MAAA;EA0EjC;EAAM,IAAA,CAAA,EAlEH,UAkEG;EAAA;EAAA,OAAA,CAAA,EAhEA,aAgEA;EAAA;EAAA,IAAA,CAAA,EA9DH,YA8DG;;yBA5Da;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA4DnB,QAAM,MAAA,CAAA,0BAAA,cAAA,MAAA,CAAA,cAAA"}
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 react6 from "react";
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
- * @see The {@link https://uds.build/docs/components/avatar Avatar Docs} for more info
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: react6.ForwardRefExoticComponent<AvatarProps & react6.RefAttributes<View>>;
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"],"sourcesContent":[],"mappings":";;;;;;;KAWK,UAAA;;AAL0C,KAQ1C,aAAA,GAHU,SAAA,GAAA,WAAA;AAAA;AAGG,KAGb,oBAAA,GAAoB,OAAA,GAAA,MAAA,GAAA,cAAA,GAAA,UAAA,GAAA,YAAA,GAAA,aAAA,GAAA,CAAA,CAAA,IAAA,EAAA,MAAA,EAAA,GAAA,MAAA,CAAA;AAAA,UASf,WAAA,SAAoB,SAAR,CAAA;EAQb;EAEG,GAAA,CAAA,EAAA,MAAA;EAEH;EAEgB,GAAA,CAAA,EAAA,MAAA;EAdK;EAAS,QAAA,CAAA,EAAA,MAAA;EA0EjC;EAAM,IAAA,CAAA,EAlEH,UAkEG;EAAA;EAAA,OAAA,CAAA,EAhEA,aAgEA;EAAA;EAAA,IAAA,CAAA,EA9DH,YA8DG;;yBA5Da;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA4DnB,QAAM,MAAA,CAAA,0BAAA,cAAA,MAAA,CAAA,cAAA"}
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"}
@@ -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
- * @see The {@link https://uds.build/docs/components/avatar Avatar Docs} for more info
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$1({ src, alt, fallback, size = "md", variant = "primary", icon, abbreviationStrategy = "firstAndLast", style, ...props }, ref) {
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":["abbreviationStrategies: Record<\n Exclude<AbbreviationStrategy, (name: string) => string>,\n (initials: string[]) => string\n>","Avatar","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 * @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 * @see The {@link https://uds.build/docs/components/avatar Avatar Docs} for more info\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,MAAMA,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BnD,MAAM,SAAS,WAA8B,SAASC,SACpD,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,oBAACC;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
+ {"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
1
  /*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
2
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
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 '~/components/ui/Badge';
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$1({ variant = "primary", size = "md", minWidth, maxWidth = 200, startIcon, endIcon, dangerouslySetBackgroundColor, dangerouslySetColor, dangerouslySetIconColor, dangerouslySetBorderColor, children, style, ref, ...rest }) {
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 react1 from "react";
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 '~/components/ui/Badge';
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: react1.NamedExoticComponent<BadgeProps>;
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"],"sourcesContent":[],"mappings":";;;;;;;;UAWU,UAAA,SAAmB;;YAEjB;EAFF;EAEE,IAAA,CAAA,EAEH,SAFG;EAEH,QAAA,CAAA,EAAA,MAAA;EAIK;EACF,QAAA,CAAA,EAAA,MAAA;EAKA,SAAA,CAAA,EANE,YAMF;EAAJ,OAAA,CAAA,EALI,YAKJ;EAdqB,6BAAA,CAAA,EAAA,MAAA;EAAS,mBAAA,CAAA,EAAA,MAAA;EAgChC,yBAAK,CAAA,EAAA,MAAA;;QAlBH,IAAI;;;;;;;;;;;;;;;;;cAkBN,OAAK,MAAA,CAAA,qBAAA"}
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 react17 from "react";
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 '~/components/ui/Badge';
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: react17.NamedExoticComponent<BadgeProps>;
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"],"sourcesContent":[],"mappings":";;;;;;;;UAWU,UAAA,SAAmB;;YAEjB;EAFF;EAEE,IAAA,CAAA,EAEH,SAFG;EAEH,QAAA,CAAA,EAAA,MAAA;EAIK;EACF,QAAA,CAAA,EAAA,MAAA;EAKA,SAAA,CAAA,EANE,YAMF;EAAJ,OAAA,CAAA,EALI,YAKJ;EAdqB,6BAAA,CAAA,EAAA,MAAA;EAAS,mBAAA,CAAA,EAAA,MAAA;EAgChC,yBAAK,CAAA,EAAA,MAAA;;QAlBH,IAAI;;;;;;;;;;;;;;;;;cAkBN,OAAK,OAAA,CAAA,qBAAA"}
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"}
@@ -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 '~/components/ui/Badge';
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$1({ variant = "primary", size = "md", minWidth, maxWidth = 200, startIcon, endIcon, dangerouslySetBackgroundColor, dangerouslySetColor, dangerouslySetIconColor, dangerouslySetBorderColor, children, style, ref, ...rest }) {
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":["Badge"],"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 /** @default 'primary' */\n variant?: BadgeVariant;\n /** @default 'md' */\n size?: BadgeSize;\n minWidth?: number;\n /** @default 200 */\n maxWidth?: number;\n startIcon?: IconSlotType;\n endIcon?: IconSlotType;\n dangerouslySetBackgroundColor?: string;\n dangerouslySetColor?: string;\n dangerouslySetBorderColor?: string;\n dangerouslySetIconColor?: string;\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 * @example\n * ```tsx\n * import { Badge } from '~/components/ui/Badge';\n *\n * <Badge>Label</Badge>\n * <Badge variant=\"brand\" size=\"sm\">New</Badge>\n * <Badge variant=\"alert\" startIcon=\"Warning\">Error</Badge>\n * ```\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":";;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAM,QAAQ,KAAK,SAASA,QAAM,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"}
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"}
@@ -1,5 +1,6 @@
1
1
  /*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
2
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
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 div. But with all the power of the UDS design system.
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 [VStack](./v-stack) or [HStack](./h-stack) respectively.
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/Box';
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
- * - If you need to div-like container to apply padding, shapes, or other styling.
28
- * - If you're creating card components.
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
- * @related [HStack](https://uds.build/docs/components/h-stack), [VStack](https://uds.build/docs/components/v-stack)
35
+ * @see {@link HStack} for horizontal layouts
36
+ * @see {@link VStack} for vertical layouts
33
37
  */
34
- const Box = (0, react.memo)(function Box$1({ 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 }) {
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,
@@ -1,13 +1,15 @@
1
1
 
2
2
  import { SizeProps } from "../types.cjs";
3
- import * as react2 from "react";
3
+ import * as react from "react";
4
4
  import { Ref } from "react";
5
5
  import { View, ViewProps } from "react-native";
6
6
  import { StyleProps } from "../../generated/styles";
7
7
 
8
8
  //#region src/components/Box.d.ts
9
9
  interface BoxProps extends ViewProps, SizeProps {
10
+ /** Ref to the underlying View */
10
11
  ref?: Ref<View>;
12
+ /** Background color from the theme palette */
11
13
  backgroundColor?: StyleProps['backgroundColor'];
12
14
  borderRadius?: StyleProps['borderRadius'];
13
15
  borderTopStartRadius?: StyleProps['borderTopStartRadius'];
@@ -60,13 +62,16 @@ interface BoxProps extends ViewProps, SizeProps {
60
62
  * **📦 A layout component that can be used to compose other components**
61
63
  *
62
64
  * @description
63
- * The most simple component we ship - a div. But with all the power of the UDS design system.
65
+ * The most simple component we ship - a View. But with all the power of the UDS design system.
64
66
  * By default, `Box` is a flexbox container. When working with vertical or horizontal layouts,
65
- * consider using [VStack](./v-stack) or [HStack](./h-stack) respectively.
67
+ * consider using VStack or HStack respectively.
68
+ *
69
+ * @category Layout
70
+ * @platform mobile
66
71
  *
67
72
  * @example
68
73
  * ```tsx
69
- * import { Box } from '@yahoo/uds-mobile/Box';
74
+ * import { Box } from '@yahoo/uds-mobile';
70
75
  *
71
76
  * <Box backgroundColor="primary" spacing="6">
72
77
  * Any kind of content can go here!
@@ -74,14 +79,14 @@ interface BoxProps extends ViewProps, SizeProps {
74
79
  * ```
75
80
  *
76
81
  * @usage
77
- * - If you need to div-like container to apply padding, shapes, or other styling.
78
- * - If you're creating card components.
79
- *
80
- * @see The {@link https://uds.build/docs/components/box Box Docs} for more info
82
+ * - Use as a container to apply padding, shapes, or other styling
83
+ * - Use for creating card components
84
+ * - Use HStack/VStack for directional layouts
81
85
  *
82
- * @related [HStack](https://uds.build/docs/components/h-stack), [VStack](https://uds.build/docs/components/v-stack)
86
+ * @see {@link HStack} for horizontal layouts
87
+ * @see {@link VStack} for vertical layouts
83
88
  */
84
- declare const Box: react2.NamedExoticComponent<BoxProps>;
89
+ declare const Box: react.NamedExoticComponent<BoxProps>;
85
90
  //#endregion
86
91
  export { Box, type BoxProps };
87
92
  //# sourceMappingURL=Box.d.cts.map