@yahoo/uds-mobile 1.0.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/CONTRIBUTING.md +1174 -0
- package/README.md +614 -0
- package/cli/uds-mobile.js +10 -0
- package/dist/_virtual/rolldown_runtime.cjs +30 -0
- package/dist/bin/generateTheme.mjs +390 -0
- package/dist/bin/mobile/scripts/utils/configToRNMappings.mjs +74 -0
- package/dist/bin/uds/dist/fixtures.mjs +404 -0
- package/dist/bin/uds/dist/tokens/configs/palette/alwaysPalette.mjs +23 -0
- package/dist/bin/uds/dist/tokens/consts/defaultModes.mjs +6 -0
- package/dist/bin/uds/dist/tokens/consts/fontDeclarationsMap.mjs +652 -0
- package/dist/bin/uds-mobile.mjs +256 -0
- package/dist/components/Avatar.cjs +109 -0
- package/dist/components/Avatar.d.cts +60 -0
- package/dist/components/Avatar.d.cts.map +1 -0
- package/dist/components/Avatar.d.mts +60 -0
- package/dist/components/Avatar.d.mts.map +1 -0
- package/dist/components/Avatar.mjs +109 -0
- package/dist/components/Avatar.mjs.map +1 -0
- package/dist/components/Badge.cjs +68 -0
- package/dist/components/Badge.d.cts +43 -0
- package/dist/components/Badge.d.cts.map +1 -0
- package/dist/components/Badge.d.mts +43 -0
- package/dist/components/Badge.d.mts.map +1 -0
- package/dist/components/Badge.mjs +68 -0
- package/dist/components/Badge.mjs.map +1 -0
- package/dist/components/Box.cjs +114 -0
- package/dist/components/Box.d.cts +87 -0
- package/dist/components/Box.d.cts.map +1 -0
- package/dist/components/Box.d.mts +87 -0
- package/dist/components/Box.d.mts.map +1 -0
- package/dist/components/Box.mjs +114 -0
- package/dist/components/Box.mjs.map +1 -0
- package/dist/components/Button.cjs +187 -0
- package/dist/components/Button.d.cts +56 -0
- package/dist/components/Button.d.cts.map +1 -0
- package/dist/components/Button.d.mts +56 -0
- package/dist/components/Button.d.mts.map +1 -0
- package/dist/components/Button.mjs +186 -0
- package/dist/components/Button.mjs.map +1 -0
- package/dist/components/Checkbox.cjs +156 -0
- package/dist/components/Checkbox.d.cts +48 -0
- package/dist/components/Checkbox.d.cts.map +1 -0
- package/dist/components/Checkbox.d.mts +48 -0
- package/dist/components/Checkbox.d.mts.map +1 -0
- package/dist/components/Checkbox.mjs +155 -0
- package/dist/components/Checkbox.mjs.map +1 -0
- package/dist/components/Chip.cjs +124 -0
- package/dist/components/Chip.d.cts +60 -0
- package/dist/components/Chip.d.cts.map +1 -0
- package/dist/components/Chip.d.mts +60 -0
- package/dist/components/Chip.d.mts.map +1 -0
- package/dist/components/Chip.mjs +124 -0
- package/dist/components/Chip.mjs.map +1 -0
- package/dist/components/HStack.cjs +46 -0
- package/dist/components/HStack.d.cts +41 -0
- package/dist/components/HStack.d.cts.map +1 -0
- package/dist/components/HStack.d.mts +41 -0
- package/dist/components/HStack.d.mts.map +1 -0
- package/dist/components/HStack.mjs +46 -0
- package/dist/components/HStack.mjs.map +1 -0
- package/dist/components/Icon.cjs +150 -0
- package/dist/components/Icon.d.cts +90 -0
- package/dist/components/Icon.d.cts.map +1 -0
- package/dist/components/Icon.d.mts +90 -0
- package/dist/components/Icon.d.mts.map +1 -0
- package/dist/components/Icon.mjs +148 -0
- package/dist/components/Icon.mjs.map +1 -0
- package/dist/components/IconButton.cjs +127 -0
- package/dist/components/IconButton.d.cts +46 -0
- package/dist/components/IconButton.d.cts.map +1 -0
- package/dist/components/IconButton.d.mts +46 -0
- package/dist/components/IconButton.d.mts.map +1 -0
- package/dist/components/IconButton.mjs +127 -0
- package/dist/components/IconButton.mjs.map +1 -0
- package/dist/components/IconSlot.cjs +55 -0
- package/dist/components/IconSlot.d.cts +45 -0
- package/dist/components/IconSlot.d.cts.map +1 -0
- package/dist/components/IconSlot.d.mts +45 -0
- package/dist/components/IconSlot.d.mts.map +1 -0
- package/dist/components/IconSlot.mjs +55 -0
- package/dist/components/IconSlot.mjs.map +1 -0
- package/dist/components/Image.cjs +104 -0
- package/dist/components/Image.d.cts +85 -0
- package/dist/components/Image.d.cts.map +1 -0
- package/dist/components/Image.d.mts +85 -0
- package/dist/components/Image.d.mts.map +1 -0
- package/dist/components/Image.mjs +104 -0
- package/dist/components/Image.mjs.map +1 -0
- package/dist/components/Input.cjs +174 -0
- package/dist/components/Input.d.cts +39 -0
- package/dist/components/Input.d.cts.map +1 -0
- package/dist/components/Input.d.mts +39 -0
- package/dist/components/Input.d.mts.map +1 -0
- package/dist/components/Input.mjs +174 -0
- package/dist/components/Input.mjs.map +1 -0
- package/dist/components/Link.cjs +139 -0
- package/dist/components/Link.d.cts +45 -0
- package/dist/components/Link.d.cts.map +1 -0
- package/dist/components/Link.d.mts +45 -0
- package/dist/components/Link.d.mts.map +1 -0
- package/dist/components/Link.mjs +138 -0
- package/dist/components/Link.mjs.map +1 -0
- package/dist/components/Pressable.cjs +120 -0
- package/dist/components/Pressable.d.cts +90 -0
- package/dist/components/Pressable.d.cts.map +1 -0
- package/dist/components/Pressable.d.mts +90 -0
- package/dist/components/Pressable.d.mts.map +1 -0
- package/dist/components/Pressable.mjs +118 -0
- package/dist/components/Pressable.mjs.map +1 -0
- package/dist/components/Radio.cjs +153 -0
- package/dist/components/Radio.d.cts +46 -0
- package/dist/components/Radio.d.cts.map +1 -0
- package/dist/components/Radio.d.mts +46 -0
- package/dist/components/Radio.d.mts.map +1 -0
- package/dist/components/Radio.mjs +152 -0
- package/dist/components/Radio.mjs.map +1 -0
- package/dist/components/Screen.cjs +89 -0
- package/dist/components/Screen.d.cts +53 -0
- package/dist/components/Screen.d.cts.map +1 -0
- package/dist/components/Screen.d.mts +53 -0
- package/dist/components/Screen.d.mts.map +1 -0
- package/dist/components/Screen.mjs +89 -0
- package/dist/components/Screen.mjs.map +1 -0
- package/dist/components/Switch.cjs +172 -0
- package/dist/components/Switch.d.cts +42 -0
- package/dist/components/Switch.d.cts.map +1 -0
- package/dist/components/Switch.d.mts +42 -0
- package/dist/components/Switch.d.mts.map +1 -0
- package/dist/components/Switch.mjs +171 -0
- package/dist/components/Switch.mjs.map +1 -0
- package/dist/components/Text.cjs +107 -0
- package/dist/components/Text.d.cts +96 -0
- package/dist/components/Text.d.cts.map +1 -0
- package/dist/components/Text.d.mts +96 -0
- package/dist/components/Text.d.mts.map +1 -0
- package/dist/components/Text.mjs +107 -0
- package/dist/components/Text.mjs.map +1 -0
- package/dist/components/VStack.cjs +46 -0
- package/dist/components/VStack.d.cts +41 -0
- package/dist/components/VStack.d.cts.map +1 -0
- package/dist/components/VStack.d.mts +41 -0
- package/dist/components/VStack.d.mts.map +1 -0
- package/dist/components/VStack.mjs +46 -0
- package/dist/components/VStack.mjs.map +1 -0
- package/dist/icons/dist/glyphMap.cjs +5475 -0
- package/dist/icons/dist/glyphMap.d.cts +10 -0
- package/dist/icons/dist/glyphMap.d.cts.map +1 -0
- package/dist/icons/dist/glyphMap.d.mts +10 -0
- package/dist/icons/dist/glyphMap.d.mts.map +1 -0
- package/dist/icons/dist/glyphMap.mjs +5474 -0
- package/dist/icons/dist/glyphMap.mjs.map +1 -0
- package/dist/icons/dist/svgMap.cjs +525 -0
- package/dist/icons/dist/svgMap.d.cts +10 -0
- package/dist/icons/dist/svgMap.d.cts.map +1 -0
- package/dist/icons/dist/svgMap.d.mts +10 -0
- package/dist/icons/dist/svgMap.d.mts.map +1 -0
- package/dist/icons/dist/svgMap.mjs +524 -0
- package/dist/icons/dist/svgMap.mjs.map +1 -0
- package/dist/icons/dist/tokens.cjs +13 -0
- package/dist/icons/dist/tokens.mjs +13 -0
- package/dist/icons/dist/tokens.mjs.map +1 -0
- package/dist/icons/dist/types.d.cts +24 -0
- package/dist/icons/dist/types.d.cts.map +1 -0
- package/dist/icons/dist/types.d.mts +24 -0
- package/dist/icons/dist/types.d.mts.map +1 -0
- package/dist/motion.cjs +56 -0
- package/dist/motion.d.cts +46 -0
- package/dist/motion.d.cts.map +1 -0
- package/dist/motion.d.mts +46 -0
- package/dist/motion.d.mts.map +1 -0
- package/dist/motion.mjs +52 -0
- package/dist/motion.mjs.map +1 -0
- package/dist/types.cjs +1 -0
- package/dist/types.d.cts +13 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +13 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +2 -0
- package/dist/uds/dist/components/Box.d.cts +3 -0
- package/dist/uds/dist/components/Box.d.mts +3 -0
- package/dist/uds/dist/components/Divider/Divider.d.cts +3 -0
- package/dist/uds/dist/components/Divider/Divider.d.mts +3 -0
- package/dist/uds/dist/components/Divider/DividerCore.d.cts +4 -0
- package/dist/uds/dist/components/Divider/DividerCore.d.mts +4 -0
- package/dist/uds/dist/components/Divider/DividerInternal.d.cts +4 -0
- package/dist/uds/dist/components/Divider/DividerInternal.d.mts +4 -0
- package/dist/uds/dist/components/Divider/index.d.cts +2 -0
- package/dist/uds/dist/components/Divider/index.d.mts +2 -0
- package/dist/uds/dist/components/FormLabel.d.cts +3 -0
- package/dist/uds/dist/components/FormLabel.d.mts +4 -0
- package/dist/uds/dist/components/HStack.d.cts +4 -0
- package/dist/uds/dist/components/HStack.d.mts +4 -0
- package/dist/uds/dist/components/Icon.d.cts +3 -0
- package/dist/uds/dist/components/Icon.d.mts +3 -0
- package/dist/uds/dist/components/Image.d.cts +2 -0
- package/dist/uds/dist/components/Image.d.mts +3 -0
- package/dist/uds/dist/components/Link.d.cts +3 -0
- package/dist/uds/dist/components/Link.d.mts +3 -0
- package/dist/uds/dist/components/Text.d.cts +3 -0
- package/dist/uds/dist/components/Text.d.mts +3 -0
- package/dist/uds/dist/components/VStack.d.cts +4 -0
- package/dist/uds/dist/components/VStack.d.mts +4 -0
- package/dist/uds/dist/components/client/Avatar/Avatar.d.cts +2 -0
- package/dist/uds/dist/components/client/Avatar/Avatar.d.mts +3 -0
- package/dist/uds/dist/components/client/Avatar/AvatarIcon.d.cts +2 -0
- package/dist/uds/dist/components/client/Avatar/AvatarIcon.d.mts +3 -0
- package/dist/uds/dist/components/client/Avatar/AvatarImage.d.cts +4 -0
- package/dist/uds/dist/components/client/Avatar/AvatarImage.d.mts +5 -0
- package/dist/uds/dist/components/client/Avatar/AvatarText.d.cts +3 -0
- package/dist/uds/dist/components/client/Avatar/AvatarText.d.mts +4 -0
- package/dist/uds/dist/components/client/Avatar/index.d.cts +5 -0
- package/dist/uds/dist/components/client/Avatar/index.d.mts +5 -0
- package/dist/uds/dist/components/client/Badge.d.cts +3 -0
- package/dist/uds/dist/components/client/Badge.d.mts +3 -0
- package/dist/uds/dist/components/client/Button.d.cts +3 -0
- package/dist/uds/dist/components/client/Button.d.mts +3 -0
- package/dist/uds/dist/components/client/Checkbox.d.cts +3 -0
- package/dist/uds/dist/components/client/Checkbox.d.mts +3 -0
- package/dist/uds/dist/components/client/Chip/Chip.d.cts +4 -0
- package/dist/uds/dist/components/client/Chip/Chip.d.mts +4 -0
- package/dist/uds/dist/components/client/Chip/ChipBase.d.cts +4 -0
- package/dist/uds/dist/components/client/Chip/ChipBase.d.mts +4 -0
- package/dist/uds/dist/components/client/Chip/ChipButton.d.cts +4 -0
- package/dist/uds/dist/components/client/Chip/ChipButton.d.mts +4 -0
- package/dist/uds/dist/components/client/Chip/ChipDismissible.d.cts +4 -0
- package/dist/uds/dist/components/client/Chip/ChipDismissible.d.mts +4 -0
- package/dist/uds/dist/components/client/Chip/ChipLink.d.cts +4 -0
- package/dist/uds/dist/components/client/Chip/ChipLink.d.mts +4 -0
- package/dist/uds/dist/components/client/Chip/ChipToggle.d.cts +4 -0
- package/dist/uds/dist/components/client/Chip/ChipToggle.d.mts +4 -0
- package/dist/uds/dist/components/client/Chip/index.d.cts +6 -0
- package/dist/uds/dist/components/client/Chip/index.d.mts +6 -0
- package/dist/uds/dist/components/client/IconButton.d.cts +3 -0
- package/dist/uds/dist/components/client/IconButton.d.mts +3 -0
- package/dist/uds/dist/components/client/Input/Input.d.cts +4 -0
- package/dist/uds/dist/components/client/Input/Input.d.mts +4 -0
- package/dist/uds/dist/components/client/Input/InputHelpText.d.cts +2 -0
- package/dist/uds/dist/components/client/Input/InputHelpText.d.mts +3 -0
- package/dist/uds/dist/components/client/Input/InputHelpTextInternal.d.cts +5 -0
- package/dist/uds/dist/components/client/Input/InputHelpTextInternal.d.mts +6 -0
- package/dist/uds/dist/components/client/Input/index.d.cts +3 -0
- package/dist/uds/dist/components/client/Input/index.d.mts +3 -0
- package/dist/uds/dist/components/client/Menu/Menu.Content.d.cts +4 -0
- package/dist/uds/dist/components/client/Menu/Menu.Content.d.mts +4 -0
- package/dist/uds/dist/components/client/Menu/Menu.Divider.d.cts +3 -0
- package/dist/uds/dist/components/client/Menu/Menu.Divider.d.mts +3 -0
- package/dist/uds/dist/components/client/Menu/Menu.Item.d.cts +4 -0
- package/dist/uds/dist/components/client/Menu/Menu.Item.d.mts +4 -0
- package/dist/uds/dist/components/client/Menu/Menu.ItemCheckbox.d.cts +4 -0
- package/dist/uds/dist/components/client/Menu/Menu.ItemCheckbox.d.mts +4 -0
- package/dist/uds/dist/components/client/Menu/Menu.Provider.d.cts +2 -0
- package/dist/uds/dist/components/client/Menu/Menu.Provider.d.mts +3 -0
- package/dist/uds/dist/components/client/Menu/Menu.Trigger.d.cts +4 -0
- package/dist/uds/dist/components/client/Menu/Menu.Trigger.d.mts +4 -0
- package/dist/uds/dist/components/client/Menu/Menu.d.cts +2 -0
- package/dist/uds/dist/components/client/Menu/Menu.d.mts +2 -0
- package/dist/uds/dist/components/client/Menu/Menu.index.d.cts +7 -0
- package/dist/uds/dist/components/client/Menu/Menu.index.d.mts +7 -0
- package/dist/uds/dist/components/client/Menu/index.d.cts +9 -0
- package/dist/uds/dist/components/client/Menu/index.d.mts +9 -0
- package/dist/uds/dist/components/client/Pressable.d.cts +3 -0
- package/dist/uds/dist/components/client/Pressable.d.mts +3 -0
- package/dist/uds/dist/components/client/Radio/Radio.d.cts +3 -0
- package/dist/uds/dist/components/client/Radio/Radio.d.mts +3 -0
- package/dist/uds/dist/components/client/Radio/RadioGroupProvider.d.cts +3 -0
- package/dist/uds/dist/components/client/Radio/RadioGroupProvider.d.mts +3 -0
- package/dist/uds/dist/components/client/Radio/index.d.cts +3 -0
- package/dist/uds/dist/components/client/Radio/index.d.mts +3 -0
- package/dist/uds/dist/components/client/SpringMotionConfig.d.cts +3 -0
- package/dist/uds/dist/components/client/SpringMotionConfig.d.mts +3 -0
- package/dist/uds/dist/components/client/Switch.d.cts +3 -0
- package/dist/uds/dist/components/client/Switch.d.mts +3 -0
- package/dist/uds/dist/components/client/index.d.cts +33 -0
- package/dist/uds/dist/components/client/index.d.mts +33 -0
- package/dist/uds/dist/components/index.d.cts +40 -0
- package/dist/uds/dist/components/index.d.mts +40 -0
- package/dist/uds/dist/index.d.cts +46 -0
- package/dist/uds/dist/index.d.mts +46 -0
- package/dist/uds/dist/styles/styler.d.cts +2 -0
- package/dist/uds/dist/styles/styler.d.mts +2 -0
- package/dist/uds/dist/styles/stylerTypes.d.cts +2 -0
- package/dist/uds/dist/styles/stylerTypes.d.mts +2 -0
- package/dist/uds/dist/tokens/automation/configs/avatar.d.cts +2 -0
- package/dist/uds/dist/tokens/automation/configs/avatar.d.mts +2 -0
- package/dist/uds/dist/tokens/automation/properties.d.cts +3 -0
- package/dist/uds/dist/tokens/automation/properties.d.mts +3 -0
- package/dist/uds/dist/tokens/automation/types/ComponentConfig.d.cts +3 -0
- package/dist/uds/dist/tokens/automation/types/ComponentConfig.d.mts +3 -0
- package/dist/uds/dist/tokens/configs/motion.cjs +109 -0
- package/dist/uds/dist/tokens/configs/motion.d.cts +20 -0
- package/dist/uds/dist/tokens/configs/motion.d.cts.map +1 -0
- package/dist/uds/dist/tokens/configs/motion.d.mts +20 -0
- package/dist/uds/dist/tokens/configs/motion.d.mts.map +1 -0
- package/dist/uds/dist/tokens/configs/motion.mjs +108 -0
- package/dist/uds/dist/tokens/configs/motion.mjs.map +1 -0
- package/dist/uds/dist/tokens/configs/palette/alwaysPalette.d.cts +32 -0
- package/dist/uds/dist/tokens/configs/palette/alwaysPalette.d.cts.map +1 -0
- package/dist/uds/dist/tokens/configs/palette/alwaysPalette.d.mts +32 -0
- package/dist/uds/dist/tokens/configs/palette/alwaysPalette.d.mts.map +1 -0
- package/dist/uds/dist/tokens/types.d.cts +426 -0
- package/dist/uds/dist/tokens/types.d.cts.map +1 -0
- package/dist/uds/dist/tokens/types.d.mts +426 -0
- package/dist/uds/dist/tokens/types.d.mts.map +1 -0
- package/dist/uds/dist/types.d.cts +2 -0
- package/dist/uds/dist/types.d.mts +2 -0
- package/fonts/centra-no2-black-italic.otf +0 -0
- package/fonts/centra-no2-black.otf +0 -0
- package/fonts/centra-no2-bold-italic.otf +0 -0
- package/fonts/centra-no2-bold.otf +0 -0
- package/fonts/centra-no2-book-italic.otf +0 -0
- package/fonts/centra-no2-book.otf +0 -0
- package/fonts/centra-no2-extrabold-italic.otf +0 -0
- package/fonts/centra-no2-extrabold.otf +0 -0
- package/fonts/centra-no2-hairline-italic.otf +0 -0
- package/fonts/centra-no2-hairline.otf +0 -0
- package/fonts/centra-no2-light-italic.otf +0 -0
- package/fonts/centra-no2-light.otf +0 -0
- package/fonts/centra-no2-medium-italic.otf +0 -0
- package/fonts/centra-no2-medium.otf +0 -0
- package/fonts/centra-no2-thin-italic.otf +0 -0
- package/fonts/centra-no2-thin.otf +0 -0
- package/fonts/gelica-black-italic.otf +0 -0
- package/fonts/gelica-black.otf +0 -0
- package/fonts/gelica-bold-italic.otf +0 -0
- package/fonts/gelica-bold.otf +0 -0
- package/fonts/gelica-extra-light-italic.otf +0 -0
- package/fonts/gelica-extra-light.otf +0 -0
- package/fonts/gelica-light-italic.otf +0 -0
- package/fonts/gelica-light.otf +0 -0
- package/fonts/gelica-medium-italic.otf +0 -0
- package/fonts/gelica-medium.otf +0 -0
- package/fonts/gelica-regular-italic.otf +0 -0
- package/fonts/gelica-regular.otf +0 -0
- package/fonts/gelica-semi-bold-italic.otf +0 -0
- package/fonts/gelica-semi-bold.otf +0 -0
- package/fonts/index.cjs +270 -0
- package/fonts/index.d.ts +10 -0
- package/fonts/index.mjs +272 -0
- package/fonts/inter-black.ttf +0 -0
- package/fonts/inter-bold.ttf +0 -0
- package/fonts/inter-extra-bold.ttf +0 -0
- package/fonts/inter-extra-light.ttf +0 -0
- package/fonts/inter-light.ttf +0 -0
- package/fonts/inter-medium.ttf +0 -0
- package/fonts/inter-regular.ttf +0 -0
- package/fonts/inter-semi-bold.ttf +0 -0
- package/fonts/inter-thin.ttf +0 -0
- package/fonts/roboto-mono-bold-italic.ttf +0 -0
- package/fonts/roboto-mono-bold.ttf +0 -0
- package/fonts/roboto-mono-light-italic.ttf +0 -0
- package/fonts/roboto-mono-light.ttf +0 -0
- package/fonts/roboto-mono-medium-italic.ttf +0 -0
- package/fonts/roboto-mono-medium.ttf +0 -0
- package/fonts/roboto-mono-regular-italic.ttf +0 -0
- package/fonts/roboto-mono-regular.ttf +0 -0
- package/fonts/roboto-mono-thin-italic.ttf +0 -0
- package/fonts/roboto-mono-thin.ttf +0 -0
- package/fonts/uds-icons.ttf +0 -0
- package/fonts/yahoo-product-sans-bold.otf +0 -0
- package/fonts/yahoo-product-sans-extended-black-italic.ttf +0 -0
- package/fonts/yahoo-product-sans-extended-black.ttf +0 -0
- package/fonts/yahoo-product-sans-extended-bold-italic.ttf +0 -0
- package/fonts/yahoo-product-sans-extended-bold.ttf +0 -0
- package/fonts/yahoo-product-sans-extended-light-italic.ttf +0 -0
- package/fonts/yahoo-product-sans-extended-light.ttf +0 -0
- package/fonts/yahoo-product-sans-extended-medium-italic.ttf +0 -0
- package/fonts/yahoo-product-sans-extended-medium.ttf +0 -0
- package/fonts/yahoo-product-sans-extended-regular-italic.ttf +0 -0
- package/fonts/yahoo-product-sans-extended-regular.ttf +0 -0
- package/fonts/yahoo-product-sans-extended-semibold-italic.ttf +0 -0
- package/fonts/yahoo-product-sans-extended-semibold.ttf +0 -0
- package/fonts/yahoo-product-sans-medium.otf +0 -0
- package/fonts/yahoo-product-sans-regular.otf +0 -0
- package/fonts/yahoo-sans-beta-bold.otf +0 -0
- package/fonts/yahoo-sans-beta-medium.otf +0 -0
- package/fonts/yahoo-sans-beta-regular.otf +0 -0
- package/fonts/yahoo-sans-black.otf +0 -0
- package/fonts/yahoo-sans-bold.otf +0 -0
- package/fonts/yahoo-sans-condensed-black.otf +0 -0
- package/fonts/yahoo-sans-condensed-bold.otf +0 -0
- package/fonts/yahoo-sans-condensed-light.otf +0 -0
- package/fonts/yahoo-sans-condensed-medium.otf +0 -0
- package/fonts/yahoo-sans-condensed-regular.otf +0 -0
- package/fonts/yahoo-sans-condensed-xbold.ttf +0 -0
- package/fonts/yahoo-sans-cr4-bold.ttf +0 -0
- package/fonts/yahoo-sans-cr4-medium.ttf +0 -0
- package/fonts/yahoo-sans-cr4-regular.ttf +0 -0
- package/fonts/yahoo-sans-extrabold.otf +0 -0
- package/fonts/yahoo-sans-extralight.otf +0 -0
- package/fonts/yahoo-sans-italic.otf +0 -0
- package/fonts/yahoo-sans-light.otf +0 -0
- package/fonts/yahoo-sans-medium.otf +0 -0
- package/fonts/yahoo-sans-regular-italic.otf +0 -0
- package/fonts/yahoo-sans-regular.otf +0 -0
- package/fonts/yahoo-sans-semibold.otf +0 -0
- package/fonts/yahoo-serif-display-black.otf +0 -0
- package/fonts/yahoo-serif-display-bold.otf +0 -0
- package/fonts/yahoo-serif-display-extrabold.otf +0 -0
- package/fonts/yahoo-serif-display-light.otf +0 -0
- package/fonts/yahoo-serif-display-regular.otf +0 -0
- package/fonts/yahoo-serif-text-bold-italic.ttf +0 -0
- package/fonts/yahoo-serif-text-bold.otf +0 -0
- package/fonts/yahoo-serif-text-italic.otf +0 -0
- package/fonts/yahoo-serif-text-regular.otf +0 -0
- package/fonts/yas-black-italic.otf +0 -0
- package/fonts/yas-black.otf +0 -0
- package/fonts/yas-bold-italic.otf +0 -0
- package/fonts/yas-bold.otf +0 -0
- package/fonts/yas-condensed-black-italic.otf +0 -0
- package/fonts/yas-condensed-black.otf +0 -0
- package/fonts/yas-condensed-bold-italic.otf +0 -0
- package/fonts/yas-condensed-bold.otf +0 -0
- package/fonts/yas-condensed-light-italic.otf +0 -0
- package/fonts/yas-condensed-light.otf +0 -0
- package/fonts/yas-condensed-medium-italic.otf +0 -0
- package/fonts/yas-condensed-medium.otf +0 -0
- package/fonts/yas-condensed-regular-italic.otf +0 -0
- package/fonts/yas-condensed-regular.otf +0 -0
- package/fonts/yas-condensed-semibold-italic.otf +0 -0
- package/fonts/yas-condensed-semibold.otf +0 -0
- package/fonts/yas-extended-black-italic.otf +0 -0
- package/fonts/yas-extended-black.otf +0 -0
- package/fonts/yas-extended-bold-italic.otf +0 -0
- package/fonts/yas-extended-bold.otf +0 -0
- package/fonts/yas-extended-light-italic.otf +0 -0
- package/fonts/yas-extended-light.otf +0 -0
- package/fonts/yas-extended-medium-italic.otf +0 -0
- package/fonts/yas-extended-medium.otf +0 -0
- package/fonts/yas-extended-regular-italic.otf +0 -0
- package/fonts/yas-extended-regular.otf +0 -0
- package/fonts/yas-extended-semibold-italic.otf +0 -0
- package/fonts/yas-extended-semibold.otf +0 -0
- package/fonts/yas-light-italic.otf +0 -0
- package/fonts/yas-light.otf +0 -0
- package/fonts/yas-medium-italic.otf +0 -0
- package/fonts/yas-medium.otf +0 -0
- package/fonts/yas-regular-italic.otf +0 -0
- package/fonts/yas-regular.otf +0 -0
- package/fonts/yas-semibold-italic.otf +0 -0
- package/fonts/yas-semibold.otf +0 -0
- package/generated/styles.cjs +4510 -0
- package/generated/styles.d.cts +1 -0
- package/generated/styles.d.mts +1 -0
- package/generated/styles.d.ts +2965 -0
- package/generated/styles.mjs +4510 -0
- package/generated/unistyles.d.ts +4320 -0
- package/package.json +308 -0
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
import { pathToFileURL } from "node:url";
|
|
5
|
+
|
|
6
|
+
//#region bin/uds-mobile.ts
|
|
7
|
+
/**
|
|
8
|
+
* @yahoo/uds-mobile CLI
|
|
9
|
+
*
|
|
10
|
+
* Commands:
|
|
11
|
+
* sync - Generate/update theme files from UDS tokens
|
|
12
|
+
*/
|
|
13
|
+
const args = process.argv.slice(2);
|
|
14
|
+
const command = args[0];
|
|
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];
|
|
21
|
+
if (arg.startsWith("--")) {
|
|
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);
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
positional: positional$1,
|
|
29
|
+
options: options$1
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const { positional, options } = parseArgs(args);
|
|
33
|
+
const colors = {
|
|
34
|
+
reset: "\x1B[0m",
|
|
35
|
+
green: "\x1B[32m",
|
|
36
|
+
yellow: "\x1B[33m",
|
|
37
|
+
blue: "\x1B[34m",
|
|
38
|
+
red: "\x1B[31m",
|
|
39
|
+
dim: "\x1B[2m"
|
|
40
|
+
};
|
|
41
|
+
function log(message, color = "reset") {
|
|
42
|
+
console.log(`${colors[color]}${message}${colors.reset}`);
|
|
43
|
+
}
|
|
44
|
+
function logStep(step, description) {
|
|
45
|
+
console.log(`${colors.green}✓${colors.reset} ${step}: ${colors.dim}${description}${colors.reset}`);
|
|
46
|
+
}
|
|
47
|
+
function logWarning(message) {
|
|
48
|
+
console.log(`${colors.yellow}⚠${colors.reset} ${message}`);
|
|
49
|
+
}
|
|
50
|
+
function logError(message) {
|
|
51
|
+
console.log(`${colors.red}✗${colors.reset} ${message}`);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Formats code using Prettier if available.
|
|
55
|
+
*/
|
|
56
|
+
async function formatWithPrettier(content, prettierConfigPath) {
|
|
57
|
+
try {
|
|
58
|
+
const prettier = await import("prettier");
|
|
59
|
+
let prettierConfig = {};
|
|
60
|
+
if (prettierConfigPath) {
|
|
61
|
+
const configPath = resolve(process.cwd(), prettierConfigPath);
|
|
62
|
+
if (existsSync(configPath)) {
|
|
63
|
+
const configContent = readFileSync(configPath, "utf-8");
|
|
64
|
+
prettierConfig = JSON.parse(configContent);
|
|
65
|
+
logStep("Using", `Prettier config: ${prettierConfigPath}`);
|
|
66
|
+
} else logWarning(`Prettier config not found: ${prettierConfigPath}`);
|
|
67
|
+
} else {
|
|
68
|
+
const resolvedConfig = await prettier.resolveConfig(process.cwd());
|
|
69
|
+
if (resolvedConfig) {
|
|
70
|
+
prettierConfig = resolvedConfig;
|
|
71
|
+
logStep("Found", "Prettier config in project");
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return await prettier.format(content, {
|
|
75
|
+
parser: "typescript",
|
|
76
|
+
...prettierConfig
|
|
77
|
+
});
|
|
78
|
+
} catch {
|
|
79
|
+
return content;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Fetches a config from the UDS config API by ID.
|
|
84
|
+
*/
|
|
85
|
+
async function fetchConfigById(configId) {
|
|
86
|
+
log(`Fetching config: ${configId}`, "dim");
|
|
87
|
+
const response = await fetch(`https://config.uds.build/api/config?id=${configId}`);
|
|
88
|
+
if (!response.ok) throw new Error(`Failed to fetch config: ${response.status} ${response.statusText}`);
|
|
89
|
+
const data = await response.json();
|
|
90
|
+
if (!data.config) throw new Error(`No config found for ID: ${configId}`);
|
|
91
|
+
logStep("Fetched", `config from UDS API`);
|
|
92
|
+
return data.config;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Dynamically imports a config file and finds an export ending with "Config".
|
|
96
|
+
* Similar to how generateConfigs.ts works in @yahoo/uds.
|
|
97
|
+
*/
|
|
98
|
+
async function loadConfigFromFile(configPath) {
|
|
99
|
+
const absolutePath = resolve(process.cwd(), configPath);
|
|
100
|
+
if (!existsSync(absolutePath)) throw new Error(`Config file not found: ${configPath}`);
|
|
101
|
+
const moduleUrl = pathToFileURL(absolutePath).href;
|
|
102
|
+
log(`Loading config from: ${configPath}`, "dim");
|
|
103
|
+
const configModule = await import(moduleUrl);
|
|
104
|
+
for (const key in configModule) if (key.endsWith("Config") || key === "default") {
|
|
105
|
+
const config = configModule[key];
|
|
106
|
+
if (config && typeof config === "object") {
|
|
107
|
+
logStep("Found", `config export: ${key}`);
|
|
108
|
+
return config;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
for (const name of [
|
|
112
|
+
"config",
|
|
113
|
+
"tokens",
|
|
114
|
+
"theme",
|
|
115
|
+
"udsConfig"
|
|
116
|
+
]) if (configModule[name] && typeof configModule[name] === "object") {
|
|
117
|
+
logStep("Found", `config export: ${name}`);
|
|
118
|
+
return configModule[name];
|
|
119
|
+
}
|
|
120
|
+
throw new Error(`No config export found in ${configPath}. Expected an export ending with "Config" or a default export.`);
|
|
121
|
+
}
|
|
122
|
+
async function runSync(opts = {}) {
|
|
123
|
+
const cwd = process.cwd();
|
|
124
|
+
const configId = opts.configId;
|
|
125
|
+
const configPath = opts.configPath;
|
|
126
|
+
try {
|
|
127
|
+
let tokensConfig;
|
|
128
|
+
let configSource;
|
|
129
|
+
if (configId) {
|
|
130
|
+
tokensConfig = await fetchConfigById(configId);
|
|
131
|
+
configSource = `UDS API (${configId})`;
|
|
132
|
+
} else if (configPath) {
|
|
133
|
+
tokensConfig = await loadConfigFromFile(configPath);
|
|
134
|
+
configSource = configPath;
|
|
135
|
+
} else {
|
|
136
|
+
const configLocations = [
|
|
137
|
+
"uds.config.ts",
|
|
138
|
+
"uds.config.js",
|
|
139
|
+
"src/uds.config.ts",
|
|
140
|
+
"src/uds.config.js"
|
|
141
|
+
];
|
|
142
|
+
let foundConfigPath = null;
|
|
143
|
+
for (const loc of configLocations) if (existsSync(resolve(cwd, loc))) {
|
|
144
|
+
foundConfigPath = loc;
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
if (foundConfigPath) {
|
|
148
|
+
tokensConfig = await loadConfigFromFile(foundConfigPath);
|
|
149
|
+
configSource = foundConfigPath;
|
|
150
|
+
} else return false;
|
|
151
|
+
}
|
|
152
|
+
const outputDir = opts.outputPath ? resolve(cwd, opts.outputPath).replace(/\/[^/]+$/, "") : resolve(cwd, "src/lib");
|
|
153
|
+
const outputFile = opts.outputPath ? resolve(cwd, opts.outputPath) : resolve(outputDir, "unistyles.uds.ts");
|
|
154
|
+
if (!existsSync(outputDir)) mkdirSync(outputDir, { recursive: true });
|
|
155
|
+
const { generateBreakpoints, generateTheme } = await import("./generateTheme.mjs");
|
|
156
|
+
const config = tokensConfig;
|
|
157
|
+
const lightTheme = generateTheme(config, "light");
|
|
158
|
+
const darkTheme = generateTheme(config, "dark");
|
|
159
|
+
const breakpoints = generateBreakpoints(config);
|
|
160
|
+
let themeContent = `// AUTO-GENERATED FILE. DO NOT EDIT.
|
|
161
|
+
// Generated by @yahoo/uds-mobile CLI
|
|
162
|
+
// Source: ${configSource}
|
|
163
|
+
// Run "npx uds-mobile sync" to regenerate
|
|
164
|
+
|
|
165
|
+
export const themes = {
|
|
166
|
+
light: ${JSON.stringify(lightTheme, null, 2)},
|
|
167
|
+
dark: ${JSON.stringify(darkTheme, null, 2)},
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
export const breakpoints = ${JSON.stringify(breakpoints, null, 2)};
|
|
171
|
+
`;
|
|
172
|
+
themeContent = await formatWithPrettier(themeContent, opts.prettierConfigPath);
|
|
173
|
+
writeFileSync(outputFile, themeContent);
|
|
174
|
+
const relativePath = outputFile.replace(cwd + "/", "");
|
|
175
|
+
if (!opts.silent) logStep("Generated", relativePath);
|
|
176
|
+
return true;
|
|
177
|
+
} catch (error) {
|
|
178
|
+
if (!opts.silent) logError(`Failed to generate theme: ${error}`);
|
|
179
|
+
throw error;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
async function syncCommand() {
|
|
183
|
+
log("\n🎨 Syncing UDS Theme\n", "blue");
|
|
184
|
+
const configId = options.id;
|
|
185
|
+
const configPath = positional[0] || options.config;
|
|
186
|
+
const outputPath = options.output;
|
|
187
|
+
const prettierConfigPath = options.prettier || options.prettierConfig;
|
|
188
|
+
try {
|
|
189
|
+
if (!await runSync({
|
|
190
|
+
configId,
|
|
191
|
+
configPath,
|
|
192
|
+
outputPath,
|
|
193
|
+
prettierConfigPath
|
|
194
|
+
})) {
|
|
195
|
+
logError("No uds.config.ts found in project root.");
|
|
196
|
+
log("\nPlease provide a config using one of these options:", "yellow");
|
|
197
|
+
log(" npx uds-mobile sync --id <config-id> # Fetch config from UDS API");
|
|
198
|
+
log(" npx uds-mobile sync ./path/to/config # Use local config file\n");
|
|
199
|
+
process.exit(1);
|
|
200
|
+
}
|
|
201
|
+
log("\n✨ Theme sync complete!\n", "green");
|
|
202
|
+
log("Restart Metro with: npx expo start --clear\n");
|
|
203
|
+
} catch (error) {
|
|
204
|
+
if (String(error).includes("@yahoo/uds")) {
|
|
205
|
+
log("\nMake sure @yahoo/uds is installed:", "yellow");
|
|
206
|
+
log(" npm install @yahoo/uds\n");
|
|
207
|
+
}
|
|
208
|
+
if (String(error).includes("Config file not found")) {
|
|
209
|
+
log("\nPlease provide a valid config path:", "yellow");
|
|
210
|
+
log(" npx uds-mobile sync ./path/to/config.ts\n");
|
|
211
|
+
}
|
|
212
|
+
if (String(error).includes("Failed to fetch config")) log("\nCheck that the config ID is valid and you have network access.", "yellow");
|
|
213
|
+
process.exit(1);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
function showHelp() {
|
|
217
|
+
log("\n📦 @yahoo/uds-mobile CLI\n", "blue");
|
|
218
|
+
log("Usage: npx uds-mobile <command> [options]\n");
|
|
219
|
+
log("Commands:");
|
|
220
|
+
log(" sync Generate/update theme files from UDS tokens");
|
|
221
|
+
log(" help Show this help message\n");
|
|
222
|
+
log("Options for sync:");
|
|
223
|
+
log(" --id <config-id> Fetch config by ID from UDS API");
|
|
224
|
+
log(" [config] Path to config file (auto-detects uds.config.ts)");
|
|
225
|
+
log(" --config <path> Explicit path to config file");
|
|
226
|
+
log(" --output <path> Output file path (default: src/lib/unistyles.uds.ts)");
|
|
227
|
+
log(" --prettier=<path> Path to Prettier config (auto-detects if not specified)\n");
|
|
228
|
+
log("Examples:");
|
|
229
|
+
log(" npx uds-mobile sync --id abc123 # Fetch config from UDS API");
|
|
230
|
+
log(" npx uds-mobile sync ./uds.config.ts # Use specific config file");
|
|
231
|
+
log(" npx uds-mobile sync --output ./src/theme.ts # Custom output location\n");
|
|
232
|
+
}
|
|
233
|
+
async function main() {
|
|
234
|
+
switch (command) {
|
|
235
|
+
case "sync":
|
|
236
|
+
await syncCommand();
|
|
237
|
+
break;
|
|
238
|
+
case "help":
|
|
239
|
+
case "--help":
|
|
240
|
+
case "-h":
|
|
241
|
+
case void 0:
|
|
242
|
+
showHelp();
|
|
243
|
+
break;
|
|
244
|
+
default:
|
|
245
|
+
logError(`Unknown command: ${command}`);
|
|
246
|
+
showHelp();
|
|
247
|
+
process.exit(1);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
main().catch((error) => {
|
|
251
|
+
logError(`Error: ${error.message}`);
|
|
252
|
+
process.exit(1);
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
//#endregion
|
|
256
|
+
export { };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
3
|
+
const require_components_Box = require('./Box.cjs');
|
|
4
|
+
const require_components_IconSlot = require('./IconSlot.cjs');
|
|
5
|
+
const require_components_Text = require('./Text.cjs');
|
|
6
|
+
let react = require("react");
|
|
7
|
+
let react_native = require("react-native");
|
|
8
|
+
let generated_styles = require("../../generated/styles");
|
|
9
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
+
|
|
11
|
+
//#region src/components/Avatar.tsx
|
|
12
|
+
const abbreviationStrategies = {
|
|
13
|
+
first: (initials) => initials[0] ?? "",
|
|
14
|
+
last: (initials) => initials[initials.length - 1] ?? "",
|
|
15
|
+
firstAndLast: (initials) => initials.length === 1 ? initials[0] ?? "" : `${initials[0]}${initials[initials.length - 1]}`,
|
|
16
|
+
firstTwo: (initials) => initials.slice(0, 2).join(""),
|
|
17
|
+
firstThree: (initials) => initials.slice(0, 3).join(""),
|
|
18
|
+
firstOfEach: (initials) => initials.join("")
|
|
19
|
+
};
|
|
20
|
+
/** Generate initials from a name */
|
|
21
|
+
function generateInitials(name, strategy = "firstAndLast") {
|
|
22
|
+
if (!name) return "";
|
|
23
|
+
if (typeof strategy === "function") return strategy(name);
|
|
24
|
+
const initials = name.trim().split(/\s+/).map((word) => word[0]?.toUpperCase() ?? "");
|
|
25
|
+
return abbreviationStrategies[strategy](initials);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* **Avatar component for user representation**
|
|
29
|
+
*
|
|
30
|
+
* @description
|
|
31
|
+
* Displays a user avatar with image, initials fallback, or icon fallback.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* import { Avatar } from '@yahoo/uds-mobile';
|
|
36
|
+
*
|
|
37
|
+
* // With image
|
|
38
|
+
* <Avatar
|
|
39
|
+
* src="https://example.com/photo.jpg"
|
|
40
|
+
* alt="Jane Doe"
|
|
41
|
+
* />
|
|
42
|
+
*
|
|
43
|
+
* // With initials fallback
|
|
44
|
+
* <Avatar alt="Jane Doe" />
|
|
45
|
+
*
|
|
46
|
+
* // With explicit initials
|
|
47
|
+
* <Avatar fallback="JD" />
|
|
48
|
+
*
|
|
49
|
+
* // With custom icon
|
|
50
|
+
* <Avatar icon="Person" variant="secondary" />
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* @see The {@link https://uds.build/docs/components/avatar Avatar Docs} for more info
|
|
54
|
+
*/
|
|
55
|
+
const Avatar = (0, react.forwardRef)(function Avatar$1({ src, alt, fallback, size = "md", variant = "primary", icon, abbreviationStrategy = "firstAndLast", style, ...props }, ref) {
|
|
56
|
+
const [imageError, setImageError] = (0, react.useState)(false);
|
|
57
|
+
const initials = fallback || generateInitials(alt, abbreviationStrategy);
|
|
58
|
+
const hasImage = src && !imageError;
|
|
59
|
+
const hasText = initials.length > 0;
|
|
60
|
+
const showImage = hasImage;
|
|
61
|
+
const showText = !hasImage && hasText;
|
|
62
|
+
const showIcon = !hasImage && !hasText;
|
|
63
|
+
generated_styles.avatarStyles.useVariants({
|
|
64
|
+
size,
|
|
65
|
+
image: variant,
|
|
66
|
+
text: variant,
|
|
67
|
+
icon: variant
|
|
68
|
+
});
|
|
69
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_Box.Box, {
|
|
70
|
+
ref,
|
|
71
|
+
style: [
|
|
72
|
+
generated_styles.avatarStyles.root,
|
|
73
|
+
{
|
|
74
|
+
alignItems: "center",
|
|
75
|
+
justifyContent: "center",
|
|
76
|
+
overflow: "hidden"
|
|
77
|
+
},
|
|
78
|
+
style
|
|
79
|
+
],
|
|
80
|
+
accessibilityRole: "image",
|
|
81
|
+
accessibilityLabel: alt,
|
|
82
|
+
...props,
|
|
83
|
+
children: [
|
|
84
|
+
showImage && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Image, {
|
|
85
|
+
source: { uri: src },
|
|
86
|
+
style: {
|
|
87
|
+
width: "100%",
|
|
88
|
+
height: "100%"
|
|
89
|
+
},
|
|
90
|
+
onError: () => setImageError(true),
|
|
91
|
+
accessibilityLabel: alt
|
|
92
|
+
}),
|
|
93
|
+
showText && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Text.Text, {
|
|
94
|
+
style: generated_styles.avatarStyles.text,
|
|
95
|
+
numberOfLines: 1,
|
|
96
|
+
children: initials
|
|
97
|
+
}),
|
|
98
|
+
showIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
99
|
+
icon: icon ?? "Person",
|
|
100
|
+
variant: "fill",
|
|
101
|
+
style: generated_styles.avatarStyles.icon
|
|
102
|
+
})
|
|
103
|
+
]
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
Avatar.displayName = "Avatar";
|
|
107
|
+
|
|
108
|
+
//#endregion
|
|
109
|
+
exports.Avatar = Avatar;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
|
|
2
|
+
import { IconSlotType } from "./IconSlot.cjs";
|
|
3
|
+
import * as react11 from "react";
|
|
4
|
+
import { View, ViewProps } from "react-native";
|
|
5
|
+
|
|
6
|
+
//#region src/components/Avatar.d.ts
|
|
7
|
+
/** Avatar size options */
|
|
8
|
+
type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
9
|
+
/** Avatar variant options */
|
|
10
|
+
type AvatarVariant = 'primary' | 'secondary';
|
|
11
|
+
/** Abbreviation strategy for generating initials */
|
|
12
|
+
type AbbreviationStrategy = 'first' | 'last' | 'firstAndLast' | 'firstTwo' | 'firstThree' | 'firstOfEach' | ((name: string) => string);
|
|
13
|
+
interface AvatarProps extends ViewProps {
|
|
14
|
+
/** Image source URL */
|
|
15
|
+
src?: string;
|
|
16
|
+
/** Alt text for the image, also used for generating initials */
|
|
17
|
+
alt?: string;
|
|
18
|
+
/** Explicit initials to display (overrides auto-generated from alt) */
|
|
19
|
+
fallback?: string;
|
|
20
|
+
/** Size of the avatar @default 'md' */
|
|
21
|
+
size?: AvatarSize;
|
|
22
|
+
/** Variant style @default 'primary' */
|
|
23
|
+
variant?: AvatarVariant;
|
|
24
|
+
/** Custom icon to display when no image or text fallback */
|
|
25
|
+
icon?: IconSlotType;
|
|
26
|
+
/** Strategy for generating initials from name @default 'firstAndLast' */
|
|
27
|
+
abbreviationStrategy?: AbbreviationStrategy;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* **Avatar component for user representation**
|
|
31
|
+
*
|
|
32
|
+
* @description
|
|
33
|
+
* Displays a user avatar with image, initials fallback, or icon fallback.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* import { Avatar } from '@yahoo/uds-mobile';
|
|
38
|
+
*
|
|
39
|
+
* // With image
|
|
40
|
+
* <Avatar
|
|
41
|
+
* src="https://example.com/photo.jpg"
|
|
42
|
+
* alt="Jane Doe"
|
|
43
|
+
* />
|
|
44
|
+
*
|
|
45
|
+
* // With initials fallback
|
|
46
|
+
* <Avatar alt="Jane Doe" />
|
|
47
|
+
*
|
|
48
|
+
* // With explicit initials
|
|
49
|
+
* <Avatar fallback="JD" />
|
|
50
|
+
*
|
|
51
|
+
* // With custom icon
|
|
52
|
+
* <Avatar icon="Person" variant="secondary" />
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @see The {@link https://uds.build/docs/components/avatar Avatar Docs} for more info
|
|
56
|
+
*/
|
|
57
|
+
declare const Avatar: react11.ForwardRefExoticComponent<AvatarProps & react11.RefAttributes<View>>;
|
|
58
|
+
//#endregion
|
|
59
|
+
export { Avatar, type AvatarProps };
|
|
60
|
+
//# sourceMappingURL=Avatar.d.cts.map
|
|
@@ -0,0 +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,OAAA,CAAA,0BAAA,cAAA,OAAA,CAAA,cAAA"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
|
|
2
|
+
import { IconSlotType } from "./IconSlot.mjs";
|
|
3
|
+
import * as react0 from "react";
|
|
4
|
+
import { View, ViewProps } from "react-native";
|
|
5
|
+
|
|
6
|
+
//#region src/components/Avatar.d.ts
|
|
7
|
+
/** Avatar size options */
|
|
8
|
+
type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
9
|
+
/** Avatar variant options */
|
|
10
|
+
type AvatarVariant = 'primary' | 'secondary';
|
|
11
|
+
/** Abbreviation strategy for generating initials */
|
|
12
|
+
type AbbreviationStrategy = 'first' | 'last' | 'firstAndLast' | 'firstTwo' | 'firstThree' | 'firstOfEach' | ((name: string) => string);
|
|
13
|
+
interface AvatarProps extends ViewProps {
|
|
14
|
+
/** Image source URL */
|
|
15
|
+
src?: string;
|
|
16
|
+
/** Alt text for the image, also used for generating initials */
|
|
17
|
+
alt?: string;
|
|
18
|
+
/** Explicit initials to display (overrides auto-generated from alt) */
|
|
19
|
+
fallback?: string;
|
|
20
|
+
/** Size of the avatar @default 'md' */
|
|
21
|
+
size?: AvatarSize;
|
|
22
|
+
/** Variant style @default 'primary' */
|
|
23
|
+
variant?: AvatarVariant;
|
|
24
|
+
/** Custom icon to display when no image or text fallback */
|
|
25
|
+
icon?: IconSlotType;
|
|
26
|
+
/** Strategy for generating initials from name @default 'firstAndLast' */
|
|
27
|
+
abbreviationStrategy?: AbbreviationStrategy;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* **Avatar component for user representation**
|
|
31
|
+
*
|
|
32
|
+
* @description
|
|
33
|
+
* Displays a user avatar with image, initials fallback, or icon fallback.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* import { Avatar } from '@yahoo/uds-mobile';
|
|
38
|
+
*
|
|
39
|
+
* // With image
|
|
40
|
+
* <Avatar
|
|
41
|
+
* src="https://example.com/photo.jpg"
|
|
42
|
+
* alt="Jane Doe"
|
|
43
|
+
* />
|
|
44
|
+
*
|
|
45
|
+
* // With initials fallback
|
|
46
|
+
* <Avatar alt="Jane Doe" />
|
|
47
|
+
*
|
|
48
|
+
* // With explicit initials
|
|
49
|
+
* <Avatar fallback="JD" />
|
|
50
|
+
*
|
|
51
|
+
* // With custom icon
|
|
52
|
+
* <Avatar icon="Person" variant="secondary" />
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @see The {@link https://uds.build/docs/components/avatar Avatar Docs} for more info
|
|
56
|
+
*/
|
|
57
|
+
declare const Avatar: react0.ForwardRefExoticComponent<AvatarProps & react0.RefAttributes<View>>;
|
|
58
|
+
//#endregion
|
|
59
|
+
export { Avatar, type AvatarProps };
|
|
60
|
+
//# sourceMappingURL=Avatar.d.mts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
import { Box } from "./Box.mjs";
|
|
3
|
+
import { IconSlot } from "./IconSlot.mjs";
|
|
4
|
+
import { Text as Text$1 } from "./Text.mjs";
|
|
5
|
+
import { forwardRef, useState } from "react";
|
|
6
|
+
import { Image } from "react-native";
|
|
7
|
+
import { avatarStyles } from "../../generated/styles";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
|
|
10
|
+
//#region src/components/Avatar.tsx
|
|
11
|
+
const abbreviationStrategies = {
|
|
12
|
+
first: (initials) => initials[0] ?? "",
|
|
13
|
+
last: (initials) => initials[initials.length - 1] ?? "",
|
|
14
|
+
firstAndLast: (initials) => initials.length === 1 ? initials[0] ?? "" : `${initials[0]}${initials[initials.length - 1]}`,
|
|
15
|
+
firstTwo: (initials) => initials.slice(0, 2).join(""),
|
|
16
|
+
firstThree: (initials) => initials.slice(0, 3).join(""),
|
|
17
|
+
firstOfEach: (initials) => initials.join("")
|
|
18
|
+
};
|
|
19
|
+
/** Generate initials from a name */
|
|
20
|
+
function generateInitials(name, strategy = "firstAndLast") {
|
|
21
|
+
if (!name) return "";
|
|
22
|
+
if (typeof strategy === "function") return strategy(name);
|
|
23
|
+
const initials = name.trim().split(/\s+/).map((word) => word[0]?.toUpperCase() ?? "");
|
|
24
|
+
return abbreviationStrategies[strategy](initials);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* **Avatar component for user representation**
|
|
28
|
+
*
|
|
29
|
+
* @description
|
|
30
|
+
* Displays a user avatar with image, initials fallback, or icon fallback.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* import { Avatar } from '@yahoo/uds-mobile';
|
|
35
|
+
*
|
|
36
|
+
* // With image
|
|
37
|
+
* <Avatar
|
|
38
|
+
* src="https://example.com/photo.jpg"
|
|
39
|
+
* alt="Jane Doe"
|
|
40
|
+
* />
|
|
41
|
+
*
|
|
42
|
+
* // With initials fallback
|
|
43
|
+
* <Avatar alt="Jane Doe" />
|
|
44
|
+
*
|
|
45
|
+
* // With explicit initials
|
|
46
|
+
* <Avatar fallback="JD" />
|
|
47
|
+
*
|
|
48
|
+
* // With custom icon
|
|
49
|
+
* <Avatar icon="Person" variant="secondary" />
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @see The {@link https://uds.build/docs/components/avatar Avatar Docs} for more info
|
|
53
|
+
*/
|
|
54
|
+
const Avatar = forwardRef(function Avatar$1({ src, alt, fallback, size = "md", variant = "primary", icon, abbreviationStrategy = "firstAndLast", style, ...props }, ref) {
|
|
55
|
+
const [imageError, setImageError] = useState(false);
|
|
56
|
+
const initials = fallback || generateInitials(alt, abbreviationStrategy);
|
|
57
|
+
const hasImage = src && !imageError;
|
|
58
|
+
const hasText = initials.length > 0;
|
|
59
|
+
const showImage = hasImage;
|
|
60
|
+
const showText = !hasImage && hasText;
|
|
61
|
+
const showIcon = !hasImage && !hasText;
|
|
62
|
+
avatarStyles.useVariants({
|
|
63
|
+
size,
|
|
64
|
+
image: variant,
|
|
65
|
+
text: variant,
|
|
66
|
+
icon: variant
|
|
67
|
+
});
|
|
68
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
69
|
+
ref,
|
|
70
|
+
style: [
|
|
71
|
+
avatarStyles.root,
|
|
72
|
+
{
|
|
73
|
+
alignItems: "center",
|
|
74
|
+
justifyContent: "center",
|
|
75
|
+
overflow: "hidden"
|
|
76
|
+
},
|
|
77
|
+
style
|
|
78
|
+
],
|
|
79
|
+
accessibilityRole: "image",
|
|
80
|
+
accessibilityLabel: alt,
|
|
81
|
+
...props,
|
|
82
|
+
children: [
|
|
83
|
+
showImage && /* @__PURE__ */ jsx(Image, {
|
|
84
|
+
source: { uri: src },
|
|
85
|
+
style: {
|
|
86
|
+
width: "100%",
|
|
87
|
+
height: "100%"
|
|
88
|
+
},
|
|
89
|
+
onError: () => setImageError(true),
|
|
90
|
+
accessibilityLabel: alt
|
|
91
|
+
}),
|
|
92
|
+
showText && /* @__PURE__ */ jsx(Text$1, {
|
|
93
|
+
style: avatarStyles.text,
|
|
94
|
+
numberOfLines: 1,
|
|
95
|
+
children: initials
|
|
96
|
+
}),
|
|
97
|
+
showIcon && /* @__PURE__ */ jsx(IconSlot, {
|
|
98
|
+
icon: icon ?? "Person",
|
|
99
|
+
variant: "fill",
|
|
100
|
+
style: avatarStyles.icon
|
|
101
|
+
})
|
|
102
|
+
]
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
Avatar.displayName = "Avatar";
|
|
106
|
+
|
|
107
|
+
//#endregion
|
|
108
|
+
export { Avatar };
|
|
109
|
+
//# sourceMappingURL=Avatar.mjs.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
3
|
+
const require_components_IconSlot = require('./IconSlot.cjs');
|
|
4
|
+
const require_components_Text = require('./Text.cjs');
|
|
5
|
+
const require_components_HStack = require('./HStack.cjs');
|
|
6
|
+
let react = require("react");
|
|
7
|
+
let generated_styles = require("../../generated/styles");
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
|
|
10
|
+
//#region src/components/Badge.tsx
|
|
11
|
+
/**
|
|
12
|
+
* **A badge component for status indicators**
|
|
13
|
+
*
|
|
14
|
+
* @description
|
|
15
|
+
* Badges show notifications, counts, or status information on navigation items and icons.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* import { Badge } from '~/components/ui/Badge';
|
|
20
|
+
*
|
|
21
|
+
* <Badge>Label</Badge>
|
|
22
|
+
* <Badge variant="brand" size="sm">New</Badge>
|
|
23
|
+
* <Badge variant="alert" startIcon="Warning">Error</Badge>
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
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 }) {
|
|
27
|
+
generated_styles.badgeStyles.useVariants({
|
|
28
|
+
size,
|
|
29
|
+
variant
|
|
30
|
+
});
|
|
31
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_HStack.HStack, {
|
|
32
|
+
ref,
|
|
33
|
+
alignItems: "center",
|
|
34
|
+
overflow: "hidden",
|
|
35
|
+
alignSelf: "flex-start",
|
|
36
|
+
maxWidth,
|
|
37
|
+
minWidth,
|
|
38
|
+
dangerouslySetBackgroundColor,
|
|
39
|
+
dangerouslySetBorderColor,
|
|
40
|
+
style: (0, react.useMemo)(() => [generated_styles.badgeStyles.root, style], [style, generated_styles.badgeStyles.root]),
|
|
41
|
+
...rest,
|
|
42
|
+
children: [
|
|
43
|
+
startIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
44
|
+
icon: startIcon,
|
|
45
|
+
variant: "fill",
|
|
46
|
+
dangerouslySetColor: dangerouslySetIconColor,
|
|
47
|
+
style: generated_styles.badgeStyles.icon
|
|
48
|
+
}),
|
|
49
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Text.Text, {
|
|
50
|
+
numberOfLines: 1,
|
|
51
|
+
flexShrink: "1",
|
|
52
|
+
dangerouslySetColor,
|
|
53
|
+
style: generated_styles.badgeStyles.text,
|
|
54
|
+
children
|
|
55
|
+
}),
|
|
56
|
+
endIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
57
|
+
icon: endIcon,
|
|
58
|
+
variant: "fill",
|
|
59
|
+
dangerouslySetColor: dangerouslySetIconColor,
|
|
60
|
+
style: generated_styles.badgeStyles.icon
|
|
61
|
+
})
|
|
62
|
+
]
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
Badge.displayName = "Badge";
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
exports.Badge = Badge;
|