@yahoo/uds 3.134.1 → 3.135.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/automated-config/dist/properties.d.cts +1 -1
- package/dist/automated-config/dist/properties.d.ts +1 -1
- package/dist/automated-config/dist/utils/buildConfigSchema.d.cts +1 -1
- package/dist/automated-config/dist/utils/buildConfigSchema.d.ts +1 -1
- package/dist/cli/runner.cjs +40 -0
- package/dist/cli/runner.js +40 -0
- package/dist/components/{client/Avatar → Avatar}/Avatar.cjs +21 -6
- package/dist/components/{client/Avatar → Avatar}/Avatar.d.cts +3 -3
- package/dist/components/{client/Avatar → Avatar}/Avatar.d.ts +3 -4
- package/dist/components/{client/Avatar → Avatar}/Avatar.js +20 -5
- package/dist/components/{client/Avatar → Avatar}/AvatarIcon.cjs +11 -12
- package/dist/components/{client/Avatar → Avatar}/AvatarIcon.d.cts +4 -3
- package/dist/components/{client/Avatar → Avatar}/AvatarIcon.d.ts +4 -4
- package/dist/components/{client/Avatar → Avatar}/AvatarIcon.js +6 -7
- package/dist/components/Avatar/AvatarImage.types.cjs +1 -0
- package/dist/components/Avatar/AvatarImage.types.d.cts +18 -0
- package/dist/components/Avatar/AvatarImage.types.d.ts +18 -0
- package/dist/components/Avatar/AvatarImage.types.js +1 -0
- package/dist/components/Avatar/AvatarImageNoFallback.cjs +51 -0
- package/dist/components/Avatar/AvatarImageNoFallback.d.cts +18 -0
- package/dist/components/Avatar/AvatarImageNoFallback.d.ts +18 -0
- package/dist/components/Avatar/AvatarImageNoFallback.js +49 -0
- package/dist/components/{client/Avatar → Avatar}/AvatarText.cjs +11 -11
- package/dist/components/{client/Avatar → Avatar}/AvatarText.d.cts +4 -3
- package/dist/components/{client/Avatar → Avatar}/AvatarText.d.ts +4 -4
- package/dist/components/{client/Avatar → Avatar}/AvatarText.js +5 -5
- package/dist/components/Avatar/index.cjs +10 -0
- package/dist/components/Avatar/index.d.cts +6 -0
- package/dist/components/Avatar/index.d.ts +6 -0
- package/dist/components/Avatar/index.js +6 -0
- package/dist/components/{client/Avatar → Avatar}/utils.cjs +3 -4
- package/dist/components/{client/Avatar → Avatar}/utils.d.cts +3 -3
- package/dist/components/{client/Avatar → Avatar}/utils.d.ts +3 -4
- package/dist/components/{client/Avatar → Avatar}/utils.js +2 -3
- package/dist/components/Banner/Banner.cjs +2 -2
- package/dist/components/Banner/Banner.d.cts +1 -1
- package/dist/components/Banner/Banner.d.ts +1 -1
- package/dist/components/Banner/Banner.js +2 -2
- package/dist/components/Banner/utils.d.cts +1 -1
- package/dist/components/Banner/utils.d.ts +1 -1
- package/dist/components/Box.d.cts +1 -1
- package/dist/components/Box.d.ts +1 -1
- package/dist/components/Divider/DividerCore.cjs +1 -1
- package/dist/components/Divider/DividerCore.d.cts +2 -2
- package/dist/components/Divider/DividerCore.d.ts +2 -2
- package/dist/components/Divider/DividerCore.js +1 -1
- package/dist/components/Divider/DividerInternal.d.cts +1 -1
- package/dist/components/Divider/DividerInternal.d.ts +1 -1
- package/dist/components/FormLabel.d.cts +1 -1
- package/dist/components/FormLabel.d.ts +1 -1
- package/dist/components/HStack.d.cts +1 -1
- package/dist/components/HStack.d.ts +1 -1
- package/dist/components/Icon.cjs +15 -6
- package/dist/components/Icon.d.cts +0 -1
- package/dist/components/Icon.d.ts +0 -1
- package/dist/components/Icon.js +16 -7
- package/dist/components/IconSlot.cjs +25 -6
- package/dist/components/IconSlot.d.cts +3 -2
- package/dist/components/IconSlot.d.ts +3 -2
- package/dist/components/IconSlot.js +26 -6
- package/dist/components/Image.d.cts +1 -1
- package/dist/components/Image.d.ts +1 -1
- package/dist/components/Link.d.cts +1 -1
- package/dist/components/Link.d.ts +1 -1
- package/dist/components/Text.d.cts +1 -1
- package/dist/components/Text.d.ts +1 -1
- package/dist/components/VStack.d.cts +1 -1
- package/dist/components/VStack.d.ts +1 -1
- package/dist/components/client/Avatar/AvatarImage.cjs +37 -58
- package/dist/components/client/Avatar/AvatarImage.d.cts +2 -15
- package/dist/components/client/Avatar/AvatarImage.d.ts +2 -15
- package/dist/components/client/Avatar/AvatarImage.js +36 -57
- package/dist/components/client/Avatar/index.cjs +0 -6
- package/dist/components/client/Avatar/index.d.cts +3 -5
- package/dist/components/client/Avatar/index.d.ts +3 -5
- package/dist/components/client/Avatar/index.js +1 -4
- package/dist/components/client/Badge.d.cts +1 -1
- package/dist/components/client/Badge.d.ts +1 -1
- package/dist/components/client/BottomSheet/BottomSheet.d.cts +1 -1
- package/dist/components/client/BottomSheet/BottomSheet.d.ts +1 -1
- package/dist/components/client/BottomSheet/BottomSheetContent.d.cts +1 -1
- package/dist/components/client/BottomSheet/BottomSheetContent.d.ts +1 -1
- package/dist/components/client/BottomSheet/BottomSheetHandle.d.cts +1 -1
- package/dist/components/client/BottomSheet/BottomSheetHandle.d.ts +1 -1
- package/dist/components/client/BottomSheet/BottomSheetHeader.cjs +1 -1
- package/dist/components/client/BottomSheet/BottomSheetHeader.d.cts +1 -1
- package/dist/components/client/BottomSheet/BottomSheetHeader.d.ts +1 -1
- package/dist/components/client/BottomSheet/BottomSheetHeader.js +1 -1
- package/dist/components/client/BottomSheet/useBottomSheetSnapModel.d.cts +1 -1
- package/dist/components/client/BottomSheet/useBottomSheetSnapModel.d.ts +1 -1
- package/dist/components/client/BottomSheet/utils.d.cts +1 -1
- package/dist/components/client/BottomSheet/utils.d.ts +1 -1
- package/dist/components/client/Button.cjs +1 -1
- package/dist/components/client/Button.d.cts +1 -1
- package/dist/components/client/Button.d.ts +1 -1
- package/dist/components/client/Button.js +1 -1
- package/dist/components/client/Checkbox.cjs +2 -2
- package/dist/components/client/Checkbox.d.cts +1 -1
- package/dist/components/client/Checkbox.d.ts +1 -1
- package/dist/components/client/Checkbox.js +2 -2
- package/dist/components/client/Chip/ChipBase.d.cts +1 -1
- package/dist/components/client/Chip/ChipBase.d.ts +1 -1
- package/dist/components/client/Chip/ChipButton.d.cts +1 -1
- package/dist/components/client/Chip/ChipButton.d.ts +1 -1
- package/dist/components/client/Chip/ChipDismissible.cjs +2 -2
- package/dist/components/client/Chip/ChipDismissible.d.cts +1 -1
- package/dist/components/client/Chip/ChipDismissible.d.ts +1 -1
- package/dist/components/client/Chip/ChipDismissible.js +2 -2
- package/dist/components/client/Chip/ChipLink.d.cts +1 -1
- package/dist/components/client/Chip/ChipLink.d.ts +1 -1
- package/dist/components/client/Chip/ChipToggle.d.cts +1 -1
- package/dist/components/client/Chip/ChipToggle.d.ts +1 -1
- package/dist/components/client/IconButton.cjs +7 -2
- package/dist/components/client/IconButton.js +7 -2
- package/dist/components/client/Input/Input.cjs +1 -1
- package/dist/components/client/Input/Input.d.cts +1 -1
- package/dist/components/client/Input/Input.d.ts +1 -1
- package/dist/components/client/Input/Input.js +1 -1
- package/dist/components/client/Input/InputHelpTextInternal.d.cts +1 -1
- package/dist/components/client/Input/InputHelpTextInternal.d.ts +1 -1
- package/dist/components/client/Menu/Menu.Content.d.cts +1 -1
- package/dist/components/client/Menu/Menu.Content.d.ts +1 -1
- package/dist/components/client/Menu/Menu.Item.d.cts +1 -1
- package/dist/components/client/Menu/Menu.Item.d.ts +1 -1
- package/dist/components/client/Menu/Menu.ItemBase.cjs +1 -1
- package/dist/components/client/Menu/Menu.ItemBase.d.cts +1 -1
- package/dist/components/client/Menu/Menu.ItemBase.d.ts +1 -1
- package/dist/components/client/Menu/Menu.ItemBase.js +1 -1
- package/dist/components/client/Menu/Menu.ItemCheckbox.cjs +1 -1
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.cts +2 -2
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.ts +2 -2
- package/dist/components/client/Menu/Menu.ItemCheckbox.js +1 -1
- package/dist/components/client/Modal/Modal.cjs +3 -3
- package/dist/components/client/Modal/Modal.d.cts +1 -1
- package/dist/components/client/Modal/Modal.d.ts +1 -1
- package/dist/components/client/Modal/Modal.js +3 -3
- package/dist/components/client/Modal/ModalActions.d.cts +1 -1
- package/dist/components/client/Modal/ModalActions.d.ts +1 -1
- package/dist/components/client/Modal/ModalContent.d.cts +1 -1
- package/dist/components/client/Modal/ModalContent.d.ts +1 -1
- package/dist/components/client/Modal/ModalContext.d.cts +1 -1
- package/dist/components/client/Modal/ModalContext.d.ts +1 -1
- package/dist/components/client/Modal/ModalDescription.d.cts +1 -1
- package/dist/components/client/Modal/ModalDescription.d.ts +1 -1
- package/dist/components/client/Modal/ModalTitle.d.cts +1 -1
- package/dist/components/client/Modal/ModalTitle.d.ts +1 -1
- package/dist/components/client/Modal/UDSModalConfigProvider.d.cts +1 -1
- package/dist/components/client/Modal/UDSModalConfigProvider.d.ts +1 -1
- package/dist/components/client/Popover/Popover.d.cts +1 -1
- package/dist/components/client/Popover/Popover.d.ts +1 -1
- package/dist/components/client/Popover/PopoverContent.cjs +3 -3
- package/dist/components/client/Popover/PopoverContent.d.cts +1 -1
- package/dist/components/client/Popover/PopoverContent.d.ts +1 -1
- package/dist/components/client/Popover/PopoverContent.js +3 -3
- package/dist/components/client/Popover/PopoverTrigger.d.cts +1 -1
- package/dist/components/client/Popover/PopoverTrigger.d.ts +1 -1
- package/dist/components/client/Popover/UDSPopoverConfigProvider.d.cts +2 -2
- package/dist/components/client/Popover/UDSPopoverConfigProvider.d.ts +2 -2
- package/dist/components/client/Popover/index.d.cts +1 -1
- package/dist/components/client/Popover/index.d.ts +1 -1
- package/dist/components/client/Pressable.d.cts +1 -1
- package/dist/components/client/Pressable.d.ts +1 -1
- package/dist/components/client/Radio/Radio.d.cts +1 -1
- package/dist/components/client/Radio/Radio.d.ts +1 -1
- package/dist/components/client/Radio/RadioGroupProvider.d.cts +1 -1
- package/dist/components/client/Radio/RadioGroupProvider.d.ts +1 -1
- package/dist/components/client/SpringMotionConfig.d.cts +1 -1
- package/dist/components/client/SpringMotionConfig.d.ts +1 -1
- package/dist/components/client/Switch.cjs +1 -1
- package/dist/components/client/Switch.d.cts +1 -1
- package/dist/components/client/Switch.d.ts +1 -1
- package/dist/components/client/Switch.js +1 -1
- package/dist/components/client/Tabs/Tab.d.cts +1 -1
- package/dist/components/client/Tabs/Tab.d.ts +1 -1
- package/dist/components/client/Tabs/TabList.d.cts +1 -1
- package/dist/components/client/Tabs/TabList.d.ts +1 -1
- package/dist/components/client/Tabs/TabPanel.d.cts +1 -1
- package/dist/components/client/Tabs/TabPanel.d.ts +1 -1
- package/dist/components/client/Tabs/Tabs.d.cts +1 -1
- package/dist/components/client/Tabs/Tabs.d.ts +1 -1
- package/dist/components/client/Tabs/tabsContext.d.cts +1 -1
- package/dist/components/client/Tabs/tabsContext.d.ts +1 -1
- package/dist/components/client/Toast/Toast.cjs +1 -1
- package/dist/components/client/Toast/Toast.d.cts +1 -1
- package/dist/components/client/Toast/Toast.d.ts +1 -1
- package/dist/components/client/Toast/Toast.js +1 -1
- package/dist/components/client/Toast/ToastContainer.d.cts +1 -1
- package/dist/components/client/Toast/ToastContainer.d.ts +1 -1
- package/dist/components/client/Toast/UDSToastConfigProvider.d.cts +1 -1
- package/dist/components/client/Toast/UDSToastConfigProvider.d.ts +1 -1
- package/dist/components/client/Toast/createToast.d.cts +1 -1
- package/dist/components/client/Toast/createToast.d.ts +1 -1
- package/dist/components/client/Tooltip/Tooltip.d.cts +1 -1
- package/dist/components/client/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/client/Tooltip/TooltipContent.cjs +1 -1
- package/dist/components/client/Tooltip/TooltipContent.d.cts +2 -2
- package/dist/components/client/Tooltip/TooltipContent.d.ts +2 -2
- package/dist/components/client/Tooltip/TooltipContent.js +1 -1
- package/dist/components/client/Tooltip/TooltipTrigger.d.cts +1 -1
- package/dist/components/client/Tooltip/TooltipTrigger.d.ts +1 -1
- package/dist/components/client/Tooltip/UDSTooltipConfigProvider.d.cts +1 -1
- package/dist/components/client/Tooltip/UDSTooltipConfigProvider.d.ts +1 -1
- package/dist/components/client/Tooltip/index.d.cts +1 -1
- package/dist/components/client/Tooltip/index.d.ts +1 -1
- package/dist/components/client/buttonConstants.d.cts +1 -1
- package/dist/components/client/buttonConstants.d.ts +1 -1
- package/dist/components/client/index.cjs +1 -7
- package/dist/components/client/index.d.cts +4 -6
- package/dist/components/client/index.d.ts +4 -6
- package/dist/components/client/index.js +2 -5
- package/dist/components/client/providers/UDSBreakpointsConfigProvider.d.cts +1 -1
- package/dist/components/client/providers/UDSBreakpointsConfigProvider.d.ts +1 -1
- package/dist/components/experimental/Table.cjs +1 -1
- package/dist/components/experimental/Table.d.cts +2 -2
- package/dist/components/experimental/Table.d.ts +2 -2
- package/dist/components/experimental/Table.js +1 -1
- package/dist/components/experimental/client/Accordion.cjs +1 -1
- package/dist/components/experimental/client/Accordion.js +1 -1
- package/dist/components/experimental/client/SegmentedControl.cjs +1 -1
- package/dist/components/experimental/client/SegmentedControl.js +1 -1
- package/dist/components/experimental/client/SwitchV2.cjs +1 -1
- package/dist/components/experimental/client/SwitchV2.d.cts +1 -1
- package/dist/components/experimental/client/SwitchV2.d.ts +1 -1
- package/dist/components/experimental/client/SwitchV2.js +1 -1
- package/dist/components/index.cjs +16 -13
- package/dist/components/index.d.cts +9 -7
- package/dist/components/index.d.ts +9 -7
- package/dist/components/index.js +10 -8
- package/dist/config/dist/index.d.cts +1 -1
- package/dist/config/dist/index.d.ts +1 -1
- package/dist/css-tokens/dist/index.d.cts +1 -1
- package/dist/css-tokens/dist/index.d.ts +1 -1
- package/dist/fixtures/dist/index.d.cts +1 -1
- package/dist/fixtures/dist/index.d.ts +1 -1
- package/dist/fixtures/index.d.cts +1 -1
- package/dist/fixtures/index.d.ts +1 -1
- package/dist/fonts/dist/index.d.cts +1 -1
- package/dist/fonts/dist/index.d.ts +1 -1
- package/dist/index.cjs +12 -10
- package/dist/index.d.cts +10 -8
- package/dist/index.d.ts +10 -8
- package/dist/index.js +9 -8
- package/dist/modes/dist/index.d.cts +1 -1
- package/dist/modes/dist/index.d.ts +1 -1
- package/dist/motion-tokens/dist/index.d.cts +1 -1
- package/dist/motion-tokens/dist/index.d.ts +1 -1
- package/dist/providers/ColorModeProvider.d.cts +1 -1
- package/dist/providers/ColorModeProvider.d.ts +1 -1
- package/dist/providers/ScaleModeProvider.d.cts +1 -1
- package/dist/providers/ScaleModeProvider.d.ts +1 -1
- package/dist/providers/ThemeProvider.d.cts +1 -1
- package/dist/providers/ThemeProvider.d.ts +1 -1
- package/dist/runtime/bottomSheetConfig.d.cts +1 -1
- package/dist/runtime/bottomSheetConfig.d.ts +1 -1
- package/dist/runtime/breakpointsConfig.d.cts +1 -1
- package/dist/runtime/breakpointsConfig.d.ts +1 -1
- package/dist/runtime/modalConfig.d.cts +1 -1
- package/dist/runtime/modalConfig.d.ts +1 -1
- package/dist/runtime/popoverConfig.d.cts +1 -1
- package/dist/runtime/popoverConfig.d.ts +1 -1
- package/dist/runtime/toastConfig.d.cts +1 -1
- package/dist/runtime/toastConfig.d.ts +1 -1
- package/dist/runtime/tooltipConfig.d.cts +1 -1
- package/dist/runtime/tooltipConfig.d.ts +1 -1
- package/dist/styles/styler.d.cts +21 -21
- package/dist/styles/styler.d.ts +21 -21
- package/dist/styles/stylerTypes.d.cts +1 -1
- package/dist/styles/stylerTypes.d.ts +1 -1
- package/dist/tailwind/dist/commands/generatePurgeCSSData.cjs +6 -2
- package/dist/tailwind/dist/commands/generatePurgeCSSData.d.cts.map +1 -1
- package/dist/tailwind/dist/commands/generatePurgeCSSData.d.ts.map +1 -1
- package/dist/tailwind/dist/commands/generatePurgeCSSData.js +5 -2
- package/dist/tailwind/dist/commands/generatePurgeCSSData.js.map +1 -1
- package/dist/tailwind/dist/tailwind/utils/getShadowStyles.d.cts +4 -4
- package/dist/tailwind/dist/tailwind/utils/getShadowStyles.d.ts +4 -4
- package/dist/tailwind/dist/types/dist/index.d.cts.map +1 -1
- package/dist/tailwind/dist/types/dist/index.d.ts.map +1 -1
- package/dist/tokens/configs/borderRadius.d.cts +1 -1
- package/dist/tokens/configs/borderRadius.d.ts +1 -1
- package/dist/tokens/configs/borderWidth.d.cts +1 -1
- package/dist/tokens/configs/borderWidth.d.ts +1 -1
- package/dist/tokens/configs/font.d.cts +1 -1
- package/dist/tokens/configs/font.d.ts +1 -1
- package/dist/tokens/configs/scaleMode.d.cts +1 -1
- package/dist/tokens/configs/scaleMode.d.ts +1 -1
- package/dist/tokens/configs/shadow.d.cts +1 -1
- package/dist/tokens/configs/shadow.d.ts +1 -1
- package/dist/tokens/configs/sizes.d.cts +1 -1
- package/dist/tokens/configs/sizes.d.ts +1 -1
- package/dist/tokens/configs/typography.d.cts +1 -1
- package/dist/tokens/configs/typography.d.ts +1 -1
- package/dist/tokens/index.d.cts +2 -2
- package/dist/tokens/index.d.ts +2 -2
- package/dist/tokens/parseButtonVariants.d.cts +1 -1
- package/dist/tokens/parseButtonVariants.d.ts +1 -1
- package/dist/tokens/types.d.cts +7 -7
- package/dist/tokens/types.d.ts +7 -7
- package/dist/tokens/utils/spectrum.d.cts +1 -1
- package/dist/tokens/utils/spectrum.d.ts +1 -1
- package/dist/types/{dist → src}/index.d.cts +35 -23
- package/dist/types/{dist → src}/index.d.ts +35 -23
- package/dist/uds/generated/componentData.cjs +1718 -1698
- package/dist/uds/generated/componentData.js +1715 -1701
- package/dist/uds/generated/tailwindPurge.cjs +128 -104
- package/dist/uds/generated/tailwindPurge.js +128 -104
- package/dist/utils/isElevationAlias.d.cts +1 -1
- package/dist/utils/isElevationAlias.d.ts +1 -1
- package/generated/componentData.json +2235 -2227
- package/generated/tailwindPurge.ts +3 -3
- package/package.json +1 -1
- package/dist/icons/dist/types.d.cts +0 -30
- package/dist/icons/dist/types.d.ts +0 -30
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
import { UniversalAvatarTextProps } from "
|
|
3
|
-
import { TextProps } from "
|
|
2
|
+
import { UniversalAvatarTextProps } from "../../types/src/index.cjs";
|
|
3
|
+
import { TextProps } from "../Text.cjs";
|
|
4
4
|
import * as _$react from "react";
|
|
5
5
|
|
|
6
|
-
//#region src/components/
|
|
6
|
+
//#region src/components/Avatar/AvatarText.d.ts
|
|
7
7
|
type DataAttributes = {
|
|
8
8
|
[name: `data-${string}`]: string;
|
|
9
9
|
};
|
|
@@ -20,6 +20,7 @@ interface AvatarTextProps extends UniversalAvatarTextProps {
|
|
|
20
20
|
*
|
|
21
21
|
* @param props - Props for text variant.
|
|
22
22
|
* @returns The AvatarText element.
|
|
23
|
+
* @componentType Server component
|
|
23
24
|
*/
|
|
24
25
|
declare const AvatarText: _$react.ForwardRefExoticComponent<AvatarTextProps & _$react.RefAttributes<HTMLDivElement>>;
|
|
25
26
|
//#endregion
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import { TextProps } from "../../Text.js";
|
|
2
|
+
import { UniversalAvatarTextProps } from "../../types/src/index.js";
|
|
3
|
+
import { TextProps } from "../Text.js";
|
|
5
4
|
import * as _$react from "react";
|
|
6
5
|
|
|
7
|
-
//#region src/components/
|
|
6
|
+
//#region src/components/Avatar/AvatarText.d.ts
|
|
8
7
|
type DataAttributes = {
|
|
9
8
|
[name: `data-${string}`]: string;
|
|
10
9
|
};
|
|
@@ -21,6 +20,7 @@ interface AvatarTextProps extends UniversalAvatarTextProps {
|
|
|
21
20
|
*
|
|
22
21
|
* @param props - Props for text variant.
|
|
23
22
|
* @returns The AvatarText element.
|
|
23
|
+
* @componentType Server component
|
|
24
24
|
*/
|
|
25
25
|
declare const AvatarText: _$react.ForwardRefExoticComponent<AvatarTextProps & _$react.RefAttributes<HTMLDivElement>>;
|
|
26
26
|
//#endregion
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import { Text } from "../../Text.js";
|
|
5
|
-
import { Box } from "../../Box.js";
|
|
2
|
+
import { cx } from "../../styles/styler.js";
|
|
3
|
+
import { Box } from "../Box.js";
|
|
6
4
|
import { DEFAULT_AVATAR_VARIANT, buildAvatarRootClasses, buildInlineSizeStyles, generateAvatarAbbreviation } from "./utils.js";
|
|
5
|
+
import { Text } from "../Text.js";
|
|
7
6
|
import { forwardRef, useMemo } from "react";
|
|
8
7
|
import { jsx } from "react/jsx-runtime";
|
|
9
|
-
//#region src/components/
|
|
8
|
+
//#region src/components/Avatar/AvatarText.tsx
|
|
10
9
|
/**
|
|
11
10
|
* **AvatarText Component**
|
|
12
11
|
*
|
|
@@ -14,6 +13,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
14
13
|
*
|
|
15
14
|
* @param props - Props for text variant.
|
|
16
15
|
* @returns The AvatarText element.
|
|
16
|
+
* @componentType Server component
|
|
17
17
|
*/
|
|
18
18
|
const AvatarText = forwardRef(({ size = "md", variant = DEFAULT_AVATAR_VARIANT, name, initials, customSize, abbreviationStrategy, className, slotProps, ...props }, ref) => {
|
|
19
19
|
const classNames = useMemo(() => ({
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require_components_Avatar_AvatarIcon = require("./AvatarIcon.cjs");
|
|
4
|
+
const require_components_Avatar_AvatarImageNoFallback = require("./AvatarImageNoFallback.cjs");
|
|
5
|
+
const require_components_Avatar_AvatarText = require("./AvatarText.cjs");
|
|
6
|
+
const require_components_Avatar_Avatar = require("./Avatar.cjs");
|
|
7
|
+
exports.Avatar = require_components_Avatar_Avatar.Avatar;
|
|
8
|
+
exports.AvatarIcon = require_components_Avatar_AvatarIcon.AvatarIcon;
|
|
9
|
+
exports.AvatarImageNoFallback = require_components_Avatar_AvatarImageNoFallback.AvatarImageNoFallback;
|
|
10
|
+
exports.AvatarText = require_components_Avatar_AvatarText.AvatarText;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
|
|
2
|
+
import { AvatarIcon, AvatarIconProps } from "./AvatarIcon.cjs";
|
|
3
|
+
import { AvatarText, AvatarTextProps } from "./AvatarText.cjs";
|
|
4
|
+
import { Avatar, AvatarProps } from "./Avatar.cjs";
|
|
5
|
+
import { AvatarImageNoFallback, AvatarImageNoFallbackProps } from "./AvatarImageNoFallback.cjs";
|
|
6
|
+
export { Avatar, AvatarIcon, type AvatarIconProps, AvatarImageNoFallback, type AvatarImageNoFallbackProps, type AvatarProps, AvatarText, type AvatarTextProps };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
|
|
2
|
+
import { AvatarIcon, AvatarIconProps } from "./AvatarIcon.js";
|
|
3
|
+
import { AvatarText, AvatarTextProps } from "./AvatarText.js";
|
|
4
|
+
import { Avatar, AvatarProps } from "./Avatar.js";
|
|
5
|
+
import { AvatarImageNoFallback, AvatarImageNoFallbackProps } from "./AvatarImageNoFallback.js";
|
|
6
|
+
export { Avatar, AvatarIcon, type AvatarIconProps, AvatarImageNoFallback, type AvatarImageNoFallbackProps, type AvatarProps, AvatarText, type AvatarTextProps };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
import { AvatarIcon } from "./AvatarIcon.js";
|
|
3
|
+
import { AvatarImageNoFallback } from "./AvatarImageNoFallback.js";
|
|
4
|
+
import { AvatarText } from "./AvatarText.js";
|
|
5
|
+
import { Avatar } from "./Avatar.js";
|
|
6
|
+
export { Avatar, AvatarIcon, AvatarImageNoFallback, AvatarText };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
-
"use client";
|
|
3
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const require_runtime = require("
|
|
5
|
-
const require_styles_styler = require("
|
|
3
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
4
|
+
const require_styles_styler = require("../../styles/styler.cjs");
|
|
6
5
|
let lodash_isFunction_js = require("lodash/isFunction.js");
|
|
7
6
|
lodash_isFunction_js = require_runtime.__toESM(lodash_isFunction_js, 1);
|
|
8
|
-
//#region src/components/
|
|
7
|
+
//#region src/components/Avatar/utils.ts
|
|
9
8
|
/** Strategies for generating text abbreviation */
|
|
10
9
|
const abbrevStrategies = {
|
|
11
10
|
first: (initials) => initials[0] ?? "",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
import { AvatarAbbreviationStrategy, AvatarSize, AvatarVariant, UniversalAvatarProps } from "
|
|
3
|
-
import { getStyles } from "
|
|
2
|
+
import { AvatarAbbreviationStrategy, AvatarSize, AvatarVariant, UniversalAvatarProps } from "../../types/src/index.cjs";
|
|
3
|
+
import { getStyles } from "../../styles/styler.cjs";
|
|
4
4
|
|
|
5
|
-
//#region src/components/
|
|
5
|
+
//#region src/components/Avatar/utils.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* Generates an abbreviation from a name using a specified strategy.
|
|
8
8
|
*
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import { getStyles } from "../../../styles/styler.js";
|
|
2
|
+
import { AvatarAbbreviationStrategy, AvatarSize, AvatarVariant, UniversalAvatarProps } from "../../types/src/index.js";
|
|
3
|
+
import { getStyles } from "../../styles/styler.js";
|
|
5
4
|
|
|
6
|
-
//#region src/components/
|
|
5
|
+
//#region src/components/Avatar/utils.d.ts
|
|
7
6
|
/**
|
|
8
7
|
* Generates an abbreviation from a name using a specified strategy.
|
|
9
8
|
*
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
-
|
|
3
|
-
import { cx, getStyles } from "../../../styles/styler.js";
|
|
2
|
+
import { cx, getStyles } from "../../styles/styler.js";
|
|
4
3
|
import { isFunction } from "lodash-es";
|
|
5
|
-
//#region src/components/
|
|
4
|
+
//#region src/components/Avatar/utils.ts
|
|
6
5
|
/** Strategies for generating text abbreviation */
|
|
7
6
|
const abbrevStrategies = {
|
|
8
7
|
first: (initials) => initials[0] ?? "",
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
require("../../_virtual/_rolldown/runtime.cjs");
|
|
4
4
|
const require_styles_styler = require("../../styles/styler.cjs");
|
|
5
|
-
const require_components_client_Pressable = require("../client/Pressable.cjs");
|
|
6
5
|
const require_components_IconSlot = require("../IconSlot.cjs");
|
|
7
6
|
const require_components_Text = require("../Text.cjs");
|
|
7
|
+
const require_components_client_Pressable = require("../client/Pressable.cjs");
|
|
8
8
|
const require_components_Banner_utils = require("./utils.cjs");
|
|
9
|
-
let _yahoo_uds_icons = require("@yahoo/uds-icons");
|
|
10
9
|
let react = require("react");
|
|
10
|
+
let _yahoo_uds_icons = require("@yahoo/uds-icons");
|
|
11
11
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
12
12
|
//#region src/components/Banner/Banner.tsx
|
|
13
13
|
const BASE_CLASS = "uds-banner";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
import { cx, getStyles } from "../../styles/styler.js";
|
|
3
|
-
import { Pressable } from "../client/Pressable.js";
|
|
4
3
|
import { IconSlot } from "../IconSlot.js";
|
|
5
4
|
import { Text } from "../Text.js";
|
|
5
|
+
import { Pressable } from "../client/Pressable.js";
|
|
6
6
|
import { BANNER_TO_BUTTON_VARIANT, hasDisplayName, separateChildren } from "./utils.js";
|
|
7
|
-
import { Cross } from "@yahoo/uds-icons";
|
|
8
7
|
import { cloneElement, forwardRef, isValidElement } from "react";
|
|
8
|
+
import { Cross } from "@yahoo/uds-icons";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
//#region src/components/Banner/Banner.tsx
|
|
11
11
|
const BASE_CLASS = "uds-banner";
|
package/dist/components/Box.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
require("../../_virtual/_rolldown/runtime.cjs");
|
|
4
4
|
const require_styles_styler = require("../../styles/styler.cjs");
|
|
5
|
-
const require_components_Text = require("../Text.cjs");
|
|
6
5
|
const require_components_Box = require("../Box.cjs");
|
|
6
|
+
const require_components_Text = require("../Text.cjs");
|
|
7
7
|
const require_components_HStack = require("../HStack.cjs");
|
|
8
8
|
const require_components_VStack = require("../VStack.cjs");
|
|
9
9
|
let react = require("react");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
import { UniversalDividerProps, UniversalStackProps } from "../../types/
|
|
3
|
-
import { BoxProps } from "../Box.cjs";
|
|
2
|
+
import { UniversalDividerProps, UniversalStackProps } from "../../types/src/index.cjs";
|
|
4
3
|
import { Text } from "../Text.cjs";
|
|
4
|
+
import { BoxProps } from "../Box.cjs";
|
|
5
5
|
import * as _$react from "react";
|
|
6
6
|
import { ComponentProps, HTMLAttributes } from "react";
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
import { UniversalDividerProps, UniversalStackProps } from "../../types/
|
|
3
|
-
import { BoxProps } from "../Box.js";
|
|
2
|
+
import { UniversalDividerProps, UniversalStackProps } from "../../types/src/index.js";
|
|
4
3
|
import { Text } from "../Text.js";
|
|
4
|
+
import { BoxProps } from "../Box.js";
|
|
5
5
|
import * as _$react from "react";
|
|
6
6
|
import { ComponentProps, HTMLAttributes } from "react";
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
import { cx } from "../../styles/styler.js";
|
|
3
|
-
import { Text } from "../Text.js";
|
|
4
3
|
import { Box } from "../Box.js";
|
|
4
|
+
import { Text } from "../Text.js";
|
|
5
5
|
import { HStack } from "../HStack.js";
|
|
6
6
|
import { VStack } from "../VStack.js";
|
|
7
7
|
import { forwardRef, useMemo } from "react";
|
package/dist/components/Icon.cjs
CHANGED
|
@@ -5,6 +5,7 @@ const require_styles_styler = require("../styles/styler.cjs");
|
|
|
5
5
|
const require_tokens_configs_sizes = require("../tokens/configs/sizes.cjs");
|
|
6
6
|
let react = require("react");
|
|
7
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
let _yahoo_uds_icons_utils = require("@yahoo/uds-icons/utils");
|
|
8
9
|
//#region src/components/Icon.tsx
|
|
9
10
|
/**
|
|
10
11
|
* **🎨 A component for displaying icons**
|
|
@@ -35,8 +36,10 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
35
36
|
*
|
|
36
37
|
* @related [IconButton](https://uds.build/docs/components/icon-button)
|
|
37
38
|
*/
|
|
38
|
-
const Icon = (0, react.forwardRef)(function BaseIcon({ name:
|
|
39
|
-
const
|
|
39
|
+
const Icon = (0, react.forwardRef)(function BaseIcon({ name: iconName, size = "md", variant = "outline", color = "primary", className, ...props }, ref) {
|
|
40
|
+
const iconDefinition = (0, _yahoo_uds_icons_utils.isIconDefinition)(iconName) ? iconName : void 0;
|
|
41
|
+
const iconComponent = typeof iconName === "function" ? iconName : void 0;
|
|
42
|
+
const availableVariants = iconDefinition ? (0, _yahoo_uds_icons_utils.getIconVariants)(iconDefinition) : [];
|
|
40
43
|
const effectiveVariant = availableVariants.includes(variant) ? variant : availableVariants[0] ?? "fill";
|
|
41
44
|
const isMulticolor = effectiveVariant === "multicolor";
|
|
42
45
|
const styles = require_styles_styler.getStyles({
|
|
@@ -45,6 +48,14 @@ const Icon = (0, react.forwardRef)(function BaseIcon({ name: SVGIcon, size = "md
|
|
|
45
48
|
className: require_styles_styler.cx(className, !isMulticolor && "[&_path]:fill-current")
|
|
46
49
|
});
|
|
47
50
|
const sizePx = require_tokens_configs_sizes.normalIconSizes[size];
|
|
51
|
+
const renderedMarkup = iconDefinition ? (0, _yahoo_uds_icons_utils.getIconMarkup)(iconDefinition, size, effectiveVariant) : null;
|
|
52
|
+
const renderedIcon = renderedMarkup ? null : (0, react.isValidElement)(iconName) ? (0, react.cloneElement)(iconName, {
|
|
53
|
+
size,
|
|
54
|
+
variant: effectiveVariant
|
|
55
|
+
}) : iconComponent ? iconComponent({
|
|
56
|
+
size,
|
|
57
|
+
variant: effectiveVariant
|
|
58
|
+
}) : null;
|
|
48
59
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
49
60
|
ref,
|
|
50
61
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -54,11 +65,9 @@ const Icon = (0, react.forwardRef)(function BaseIcon({ name: SVGIcon, size = "md
|
|
|
54
65
|
"aria-hidden": "true",
|
|
55
66
|
focusable: "false",
|
|
56
67
|
className: styles,
|
|
68
|
+
dangerouslySetInnerHTML: renderedMarkup ? { __html: renderedMarkup } : void 0,
|
|
57
69
|
...props,
|
|
58
|
-
children:
|
|
59
|
-
size,
|
|
60
|
-
variant: effectiveVariant
|
|
61
|
-
})
|
|
70
|
+
children: renderedIcon
|
|
62
71
|
});
|
|
63
72
|
});
|
|
64
73
|
Icon.displayName = "Icon";
|
package/dist/components/Icon.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
import { cx, getStyles } from "../styles/styler.js";
|
|
3
3
|
import { normalIconSizes } from "../tokens/configs/sizes.js";
|
|
4
|
-
import { forwardRef } from "react";
|
|
4
|
+
import { cloneElement, forwardRef, isValidElement } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { getIconMarkup, getIconVariants, isIconDefinition } from "@yahoo/uds-icons/utils";
|
|
6
7
|
//#region src/components/Icon.tsx
|
|
7
8
|
/**
|
|
8
9
|
* **🎨 A component for displaying icons**
|
|
@@ -33,8 +34,10 @@ import { jsx } from "react/jsx-runtime";
|
|
|
33
34
|
*
|
|
34
35
|
* @related [IconButton](https://uds.build/docs/components/icon-button)
|
|
35
36
|
*/
|
|
36
|
-
const Icon = forwardRef(function BaseIcon({ name:
|
|
37
|
-
const
|
|
37
|
+
const Icon = forwardRef(function BaseIcon({ name: iconName, size = "md", variant = "outline", color = "primary", className, ...props }, ref) {
|
|
38
|
+
const iconDefinition = isIconDefinition(iconName) ? iconName : void 0;
|
|
39
|
+
const iconComponent = typeof iconName === "function" ? iconName : void 0;
|
|
40
|
+
const availableVariants = iconDefinition ? getIconVariants(iconDefinition) : [];
|
|
38
41
|
const effectiveVariant = availableVariants.includes(variant) ? variant : availableVariants[0] ?? "fill";
|
|
39
42
|
const isMulticolor = effectiveVariant === "multicolor";
|
|
40
43
|
const styles = getStyles({
|
|
@@ -43,6 +46,14 @@ const Icon = forwardRef(function BaseIcon({ name: SVGIcon, size = "md", variant
|
|
|
43
46
|
className: cx(className, !isMulticolor && "[&_path]:fill-current")
|
|
44
47
|
});
|
|
45
48
|
const sizePx = normalIconSizes[size];
|
|
49
|
+
const renderedMarkup = iconDefinition ? getIconMarkup(iconDefinition, size, effectiveVariant) : null;
|
|
50
|
+
const renderedIcon = renderedMarkup ? null : isValidElement(iconName) ? cloneElement(iconName, {
|
|
51
|
+
size,
|
|
52
|
+
variant: effectiveVariant
|
|
53
|
+
}) : iconComponent ? iconComponent({
|
|
54
|
+
size,
|
|
55
|
+
variant: effectiveVariant
|
|
56
|
+
}) : null;
|
|
46
57
|
return /* @__PURE__ */ jsx("svg", {
|
|
47
58
|
ref,
|
|
48
59
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -52,11 +63,9 @@ const Icon = forwardRef(function BaseIcon({ name: SVGIcon, size = "md", variant
|
|
|
52
63
|
"aria-hidden": "true",
|
|
53
64
|
focusable: "false",
|
|
54
65
|
className: styles,
|
|
66
|
+
dangerouslySetInnerHTML: renderedMarkup ? { __html: renderedMarkup } : void 0,
|
|
55
67
|
...props,
|
|
56
|
-
children:
|
|
57
|
-
size,
|
|
58
|
-
variant: effectiveVariant
|
|
59
|
-
})
|
|
68
|
+
children: renderedIcon
|
|
60
69
|
});
|
|
61
70
|
});
|
|
62
71
|
Icon.displayName = "Icon";
|
|
@@ -6,9 +6,11 @@ const require_components_Icon = require("./Icon.cjs");
|
|
|
6
6
|
let react = require("react");
|
|
7
7
|
react = require_runtime.__toESM(react);
|
|
8
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
-
let
|
|
10
|
-
lodash_isFunction_js = require_runtime.__toESM(lodash_isFunction_js);
|
|
9
|
+
let _yahoo_uds_icons_utils = require("@yahoo/uds-icons/utils");
|
|
11
10
|
//#region src/components/IconSlot.tsx
|
|
11
|
+
function isIconRenderOutput(icon) {
|
|
12
|
+
return (0, react.isValidElement)(icon) && (icon.type === react.default.Fragment || typeof icon.type === "string");
|
|
13
|
+
}
|
|
12
14
|
/**
|
|
13
15
|
* A helper container to render a SvgIcon, Icon component, or ReactNode.
|
|
14
16
|
*
|
|
@@ -29,21 +31,38 @@ const IconSlot = (0, react.memo)(function IconSlot({ icon, iconProps, className:
|
|
|
29
31
|
if (!icon) return null;
|
|
30
32
|
const { className: iconPropsClassName, ...props } = iconProps || {};
|
|
31
33
|
const mergedClassName = require_styles_styler.cx(slotClassName, iconPropsClassName);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
name: svgIcon,
|
|
34
|
+
if ((0, _yahoo_uds_icons_utils.isIconDefinition)(icon)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Icon.Icon, {
|
|
35
|
+
name: icon,
|
|
35
36
|
...props,
|
|
36
37
|
...rest,
|
|
37
38
|
className: mergedClassName
|
|
38
39
|
});
|
|
39
|
-
if (
|
|
40
|
+
if (typeof icon === "function") {
|
|
40
41
|
const iconEl = icon(iconProps || {});
|
|
42
|
+
if ((0, _yahoo_uds_icons_utils.isIconDefinition)(iconEl)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Icon.Icon, {
|
|
43
|
+
name: iconEl,
|
|
44
|
+
...props,
|
|
45
|
+
...rest,
|
|
46
|
+
className: mergedClassName
|
|
47
|
+
});
|
|
48
|
+
if (isIconRenderOutput(iconEl)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Icon.Icon, {
|
|
49
|
+
name: icon,
|
|
50
|
+
...props,
|
|
51
|
+
...rest,
|
|
52
|
+
className: mergedClassName
|
|
53
|
+
});
|
|
41
54
|
const elProps = iconEl?.props;
|
|
42
55
|
return (0, react.isValidElement)(iconEl) && (0, react.cloneElement)(iconEl, {
|
|
43
56
|
...rest,
|
|
44
57
|
className: require_styles_styler.cx(mergedClassName, elProps?.className)
|
|
45
58
|
});
|
|
46
59
|
}
|
|
60
|
+
if (isIconRenderOutput(icon)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Icon.Icon, {
|
|
61
|
+
name: ((svgIconProps) => (0, react.cloneElement)(icon, svgIconProps)),
|
|
62
|
+
...props,
|
|
63
|
+
...rest,
|
|
64
|
+
className: mergedClassName
|
|
65
|
+
});
|
|
47
66
|
const elProps = icon.props;
|
|
48
67
|
return (0, react.isValidElement)(icon) && (0, react.cloneElement)(icon, {
|
|
49
68
|
...props,
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
import { UniversalIconSlot } from "../types/
|
|
2
|
+
import { UniversalIconSlot } from "../types/src/index.cjs";
|
|
3
3
|
import { IconPropsWithSVGProps } from "../tokens/types.cjs";
|
|
4
4
|
import React from "react";
|
|
5
|
+
import { IconDefinition } from "@yahoo/uds-icons/types";
|
|
5
6
|
|
|
6
7
|
//#region src/components/IconSlot.d.ts
|
|
7
8
|
interface IconSlotProps {
|
|
8
9
|
/** The icon to render. Can be a UDS icon, an Icon component, ReactNode, or a function that a ReactNode. */
|
|
9
|
-
icon?: UniversalIconSlot
|
|
10
|
+
icon?: UniversalIconSlot<IconDefinition>;
|
|
10
11
|
/** Props to spread onto the icon. */
|
|
11
12
|
iconProps?: Omit<IconPropsWithSVGProps, 'name'>;
|
|
12
13
|
className?: string;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
import { UniversalIconSlot } from "../types/
|
|
2
|
+
import { UniversalIconSlot } from "../types/src/index.js";
|
|
3
3
|
import { IconPropsWithSVGProps } from "../tokens/types.js";
|
|
4
4
|
import React from "react";
|
|
5
|
+
import { IconDefinition } from "@yahoo/uds-icons/types";
|
|
5
6
|
|
|
6
7
|
//#region src/components/IconSlot.d.ts
|
|
7
8
|
interface IconSlotProps {
|
|
8
9
|
/** The icon to render. Can be a UDS icon, an Icon component, ReactNode, or a function that a ReactNode. */
|
|
9
|
-
icon?: UniversalIconSlot
|
|
10
|
+
icon?: UniversalIconSlot<IconDefinition>;
|
|
10
11
|
/** Props to spread onto the icon. */
|
|
11
12
|
iconProps?: Omit<IconPropsWithSVGProps, 'name'>;
|
|
12
13
|
className?: string;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
import { cx } from "../styles/styler.js";
|
|
3
3
|
import { Icon } from "./Icon.js";
|
|
4
|
-
import { cloneElement, isValidElement, memo } from "react";
|
|
4
|
+
import React, { cloneElement, isValidElement, memo } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
import {
|
|
6
|
+
import { isIconDefinition } from "@yahoo/uds-icons/utils";
|
|
7
7
|
//#region src/components/IconSlot.tsx
|
|
8
|
+
function isIconRenderOutput(icon) {
|
|
9
|
+
return isValidElement(icon) && (icon.type === React.Fragment || typeof icon.type === "string");
|
|
10
|
+
}
|
|
8
11
|
/**
|
|
9
12
|
* A helper container to render a SvgIcon, Icon component, or ReactNode.
|
|
10
13
|
*
|
|
@@ -25,21 +28,38 @@ const IconSlot = memo(function IconSlot({ icon, iconProps, className: slotClassN
|
|
|
25
28
|
if (!icon) return null;
|
|
26
29
|
const { className: iconPropsClassName, ...props } = iconProps || {};
|
|
27
30
|
const mergedClassName = cx(slotClassName, iconPropsClassName);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
name: svgIcon,
|
|
31
|
+
if (isIconDefinition(icon)) return /* @__PURE__ */ jsx(Icon, {
|
|
32
|
+
name: icon,
|
|
31
33
|
...props,
|
|
32
34
|
...rest,
|
|
33
35
|
className: mergedClassName
|
|
34
36
|
});
|
|
35
|
-
if (
|
|
37
|
+
if (typeof icon === "function") {
|
|
36
38
|
const iconEl = icon(iconProps || {});
|
|
39
|
+
if (isIconDefinition(iconEl)) return /* @__PURE__ */ jsx(Icon, {
|
|
40
|
+
name: iconEl,
|
|
41
|
+
...props,
|
|
42
|
+
...rest,
|
|
43
|
+
className: mergedClassName
|
|
44
|
+
});
|
|
45
|
+
if (isIconRenderOutput(iconEl)) return /* @__PURE__ */ jsx(Icon, {
|
|
46
|
+
name: icon,
|
|
47
|
+
...props,
|
|
48
|
+
...rest,
|
|
49
|
+
className: mergedClassName
|
|
50
|
+
});
|
|
37
51
|
const elProps = iconEl?.props;
|
|
38
52
|
return isValidElement(iconEl) && cloneElement(iconEl, {
|
|
39
53
|
...rest,
|
|
40
54
|
className: cx(mergedClassName, elProps?.className)
|
|
41
55
|
});
|
|
42
56
|
}
|
|
57
|
+
if (isIconRenderOutput(icon)) return /* @__PURE__ */ jsx(Icon, {
|
|
58
|
+
name: ((svgIconProps) => cloneElement(icon, svgIconProps)),
|
|
59
|
+
...props,
|
|
60
|
+
...rest,
|
|
61
|
+
className: mergedClassName
|
|
62
|
+
});
|
|
43
63
|
const elProps = icon.props;
|
|
44
64
|
return isValidElement(icon) && cloneElement(icon, {
|
|
45
65
|
...props,
|