@yahoo/uds 3.59.0-beta.1 → 3.59.0-beta.2
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/cli/bin/uds-darwin-arm64-baseline +0 -0
- package/cli/bin/uds-darwin-x64 +0 -0
- package/cli/bin/uds-linux-arm64 +0 -0
- package/cli/bin/uds-linux-x64-baseline +0 -0
- package/dist/components/Box.d.ts +2 -2
- package/dist/components/Box.d.ts.map +1 -1
- package/dist/components/Divider/Divider.d.cts +2 -2
- package/dist/components/Divider/Divider.d.ts +2 -2
- package/dist/components/Divider/DividerCore.d.cts +2 -2
- package/dist/components/Divider/DividerCore.d.ts +2 -2
- package/dist/components/Divider/DividerInternal.d.cts +2 -2
- package/dist/components/Divider/DividerInternal.d.ts +2 -2
- package/dist/components/FormLabel.d.ts +2 -2
- package/dist/components/HStack.d.ts +2 -2
- package/dist/components/Icon.d.ts +2 -2
- package/dist/components/Link.d.ts +2 -2
- package/dist/components/Text.d.cts +5 -5
- package/dist/components/Text.d.cts.map +1 -1
- package/dist/components/Text.d.ts +8 -8
- package/dist/components/Text.d.ts.map +1 -1
- package/dist/components/VStack.d.ts +2 -2
- package/dist/components/VStack.d.ts.map +1 -1
- package/dist/components/client/AnimateHeightChange.d.cts +2 -2
- package/dist/components/client/AnimateHeightChange.d.ts +2 -2
- package/dist/components/client/Avatar/Avatar.d.cts +2 -2
- package/dist/components/client/Avatar/Avatar.d.cts.map +1 -1
- package/dist/components/client/Avatar/Avatar.d.ts +2 -2
- package/dist/components/client/Avatar/AvatarIcon.d.cts +2 -2
- package/dist/components/client/Avatar/AvatarIcon.d.cts.map +1 -1
- package/dist/components/client/Avatar/AvatarIcon.d.ts +2 -2
- package/dist/components/client/Avatar/AvatarImage.d.cts +2 -2
- package/dist/components/client/Avatar/AvatarImage.d.ts +2 -2
- package/dist/components/client/Avatar/AvatarText.d.cts +2 -2
- package/dist/components/client/Avatar/AvatarText.d.ts +2 -2
- package/dist/components/client/IconButton.d.cts +2 -2
- package/dist/components/client/IconButton.d.ts +2 -2
- package/dist/components/client/IconButton.d.ts.map +1 -1
- package/dist/components/client/Input/Input.d.cts +2 -2
- package/dist/components/client/Input/Input.d.ts +2 -2
- package/dist/components/client/Input/InputHelpText.d.cts +2 -2
- package/dist/components/client/Input/InputHelpText.d.cts.map +1 -1
- package/dist/components/client/Input/InputHelpText.d.ts +2 -2
- package/dist/components/client/Input/InputHelpTextInternal.d.cts +4 -4
- package/dist/components/client/Input/InputHelpTextInternal.d.cts.map +1 -1
- package/dist/components/client/Input/InputHelpTextInternal.d.ts +4 -4
- package/dist/components/client/Menu/Menu.Content.d.cts +2 -2
- package/dist/components/client/Menu/Menu.Content.d.ts +2 -2
- package/dist/components/client/Menu/Menu.Divider.d.cts +2 -2
- package/dist/components/client/Menu/Menu.Divider.d.ts +2 -2
- package/dist/components/client/Menu/Menu.Item.d.cts +2 -2
- package/dist/components/client/Menu/Menu.ItemBase.d.cts +2 -2
- package/dist/components/client/Menu/Menu.ItemBase.d.ts +2 -2
- 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.Provider.d.cts +2 -2
- package/dist/components/client/Menu/Menu.Provider.d.ts +2 -2
- package/dist/components/client/Menu/Menu.Trigger.d.cts +2 -2
- package/dist/components/client/Menu/Menu.Trigger.d.ts +2 -2
- package/dist/components/client/Pressable.d.cts +2 -2
- package/dist/components/client/Pressable.d.ts +2 -2
- package/dist/components/client/Pressable.d.ts.map +1 -1
- package/dist/components/client/Radio/RadioGroupStore.d.ts +2 -2
- package/dist/components/client/SpringMotionConfig.d.cts +3 -3
- package/dist/components/client/SpringMotionConfig.d.ts +3 -3
- package/dist/components/client/SpringMotionConfig.d.ts.map +1 -1
- package/dist/components/experimental/Spinner.d.cts +2 -2
- package/dist/components/experimental/Spinner.d.cts.map +1 -1
- package/dist/components/experimental/Spinner.d.ts +2 -2
- package/dist/components/experimental/Table.d.cts +2 -2
- package/dist/components/experimental/Table.d.ts +2 -2
- package/dist/components/experimental/client/Accordion.d.cts +2 -2
- package/dist/components/experimental/client/Accordion.d.cts.map +1 -1
- package/dist/components/experimental/client/Accordion.d.ts +2 -2
- package/dist/components/experimental/client/AvoidMotionLibraryProvider.d.cts +2 -2
- package/dist/components/experimental/client/AvoidMotionLibraryProvider.d.ts +2 -2
- package/dist/components/experimental/client/Modal.d.cts +3 -3
- package/dist/components/experimental/client/Modal.d.cts.map +1 -1
- package/dist/components/experimental/client/Modal.d.ts +3 -3
- package/dist/components/experimental/client/Popover.d.cts +3 -3
- package/dist/components/experimental/client/Popover.d.cts.map +1 -1
- package/dist/components/experimental/client/Popover.d.ts +3 -3
- package/dist/components/experimental/client/Tabs.d.cts +3 -3
- package/dist/components/experimental/client/Tabs.d.ts +6 -6
- package/dist/components/experimental/client/Toast.d.cts +2 -2
- package/dist/components/experimental/client/Toast.d.ts +2 -2
- package/dist/providers/ColorModeProvider.d.cts +4 -4
- package/dist/providers/ColorModeProvider.d.cts.map +1 -1
- package/dist/providers/ColorModeProvider.d.ts +4 -4
- package/dist/providers/ColorModeProvider.d.ts.map +1 -1
- package/dist/providers/ScaleModeProvider.d.cts +4 -4
- package/dist/providers/ScaleModeProvider.d.cts.map +1 -1
- package/dist/providers/ScaleModeProvider.d.ts +4 -4
- package/dist/providers/ScaleModeProvider.d.ts.map +1 -1
- package/dist/providers/ThemeProvider.d.cts +2 -2
- package/dist/providers/ThemeProvider.d.cts.map +1 -1
- package/dist/providers/ThemeProvider.d.ts +2 -2
- package/dist/styles/styler.d.cts +33 -33
- package/dist/styles/styler.d.ts +33 -33
- package/dist/styles/stylerTypes.d.ts.map +1 -1
- package/dist/tailwind/tailwind.config.d.ts +3 -3
- package/dist/tailwind/tailwindPlugin.d.ts +3 -3
- package/dist/tailwind/utils/getMotionStyles.d.cts +1 -1
- package/dist/tailwind/utils/getMotionStyles.d.ts +1 -1
- package/dist/tokens/automation/utils/getConfigVariantProperties.d.cts +2 -2
- package/dist/tokens/automation/utils/getConfigVariantProperties.d.cts.map +1 -1
- package/dist/tokens/automation/utils/getConfigVariantProperties.d.ts +2 -2
- package/dist/tokens/automation/utils/getConfigVariantProperties.d.ts.map +1 -1
- package/dist/tokens/types.d.cts.map +1 -1
- package/dist/tokens/types.d.ts.map +1 -1
- package/dist/utils/intersperse.d.cts +2 -2
- package/dist/utils/intersperse.d.ts +2 -2
- package/package.json +1 -3
- package/cli/FlattenButtonVariant.mock.tsx +0 -17
- package/src/components/Box.tsx +0 -181
- package/src/components/Divider/Divider.tsx +0 -44
- package/src/components/Divider/DividerCore.tsx +0 -101
- package/src/components/Divider/DividerInternal.tsx +0 -56
- package/src/components/Divider/index.ts +0 -1
- package/src/components/FormLabel.tsx +0 -66
- package/src/components/HStack.tsx +0 -53
- package/src/components/Icon.tsx +0 -82
- package/src/components/IconSlot.tsx +0 -82
- package/src/components/Image.tsx +0 -162
- package/src/components/Link.tsx +0 -134
- package/src/components/Text.tsx +0 -272
- package/src/components/VStack.tsx +0 -53
- package/src/components/client/AnimateHeightChange.tsx +0 -50
- package/src/components/client/Avatar/Avatar.tsx +0 -31
- package/src/components/client/Avatar/AvatarIcon.tsx +0 -103
- package/src/components/client/Avatar/AvatarImage.tsx +0 -147
- package/src/components/client/Avatar/AvatarText.tsx +0 -88
- package/src/components/client/Avatar/index.ts +0 -4
- package/src/components/client/Avatar/utils.ts +0 -105
- package/src/components/client/Badge.tsx +0 -133
- package/src/components/client/Button.tsx +0 -312
- package/src/components/client/Checkbox.tsx +0 -377
- package/src/components/client/Chip/Chip.tsx +0 -81
- package/src/components/client/Chip/ChipBase.tsx +0 -151
- package/src/components/client/Chip/ChipButton.tsx +0 -54
- package/src/components/client/Chip/ChipDismissible.tsx +0 -90
- package/src/components/client/Chip/ChipLink.tsx +0 -60
- package/src/components/client/Chip/ChipToggle.tsx +0 -79
- package/src/components/client/Chip/index.ts +0 -5
- package/src/components/client/IconButton.tsx +0 -198
- package/src/components/client/Input/Input.tsx +0 -323
- package/src/components/client/Input/InputHelpText.tsx +0 -52
- package/src/components/client/Input/InputHelpTextInternal.tsx +0 -81
- package/src/components/client/Input/index.ts +0 -2
- package/src/components/client/Menu/Menu.Content.tsx +0 -391
- package/src/components/client/Menu/Menu.Divider.tsx +0 -102
- package/src/components/client/Menu/Menu.Item.tsx +0 -114
- package/src/components/client/Menu/Menu.ItemBase.tsx +0 -265
- package/src/components/client/Menu/Menu.ItemCheckbox.tsx +0 -197
- package/src/components/client/Menu/Menu.Provider.tsx +0 -154
- package/src/components/client/Menu/Menu.Trigger.tsx +0 -119
- package/src/components/client/Menu/Menu.index.tsx +0 -9
- package/src/components/client/Menu/Menu.tsx +0 -2
- package/src/components/client/Menu/index.ts +0 -7
- package/src/components/client/Menu/utils/transformAriakitPlacement.ts +0 -66
- package/src/components/client/Pressable.tsx +0 -194
- package/src/components/client/Radio/Radio.tsx +0 -351
- package/src/components/client/Radio/RadioGroupProvider.tsx +0 -122
- package/src/components/client/Radio/RadioGroupStore.tsx +0 -56
- package/src/components/client/Radio/index.ts +0 -2
- package/src/components/client/Radio/useRadioGroup.ts +0 -149
- package/src/components/client/SpringMotionConfig.tsx +0 -151
- package/src/components/client/Switch.tsx +0 -377
- package/src/components/client/index.ts +0 -30
- package/src/components/client/motionFeatures/domAnimation.ts +0 -2
- package/src/components/client/motionFeatures/domMax.ts +0 -2
- package/src/components/experimental/Spinner.tsx +0 -30
- package/src/components/experimental/Table.mocks.tsx +0 -38
- package/src/components/experimental/Table.tsx +0 -239
- package/src/components/experimental/client/Accordion.tsx +0 -77
- package/src/components/experimental/client/AvoidMotionLibraryProvider.tsx +0 -10
- package/src/components/experimental/client/Modal.tsx +0 -68
- package/src/components/experimental/client/Popover.tsx +0 -63
- package/src/components/experimental/client/SwitchV2.tsx +0 -343
- package/src/components/experimental/client/Tabs.tsx +0 -106
- package/src/components/experimental/client/Toast.tsx +0 -186
- package/src/components/experimental/client/index.ts +0 -15
- package/src/components/experimental/index.ts +0 -48
- package/src/components/index.ts +0 -41
- package/src/defaultTokensConfig.ts +0 -31
- package/src/fixtures/index.ts +0 -638
- package/src/fixtures/macros/typesToConstants.ts +0 -42
- package/src/fixtures/utils/getScaleModeRamp.ts +0 -48
- package/src/fixtures/utils/getTailwindAsUdsColors.ts +0 -115
- package/src/flags.ts +0 -45
- package/src/hooks/useForkRef.ts +0 -34
- package/src/hooks/useNestedBorderRadius.ts +0 -138
- package/src/hooks/useRtl.ts +0 -64
- package/src/index.ts +0 -4
- package/src/providers/ColorModeProvider.tsx +0 -21
- package/src/providers/ScaleModeProvider.tsx +0 -29
- package/src/providers/ThemeProvider.tsx +0 -26
- package/src/styles/styler.ts +0 -194
- package/src/styles/stylerTypes.ts +0 -81
- package/src/styles/toast.css +0 -0
- package/src/styles/variants.ts +0 -1351
- package/src/tailwind/base/addColorModeVars.ts +0 -23
- package/src/tailwind/base/addColorModeVarsV2.ts +0 -57
- package/src/tailwind/base/addFontFaceDeclarations.ts +0 -13
- package/src/tailwind/base/addFontVars.ts +0 -9
- package/src/tailwind/base/addMotionVars.ts +0 -9
- package/src/tailwind/base/addScaleModeVars.ts +0 -33
- package/src/tailwind/base/types.ts +0 -8
- package/src/tailwind/components/getButtonStyles.ts +0 -240
- package/src/tailwind/components/getFocusRingStyles.ts +0 -32
- package/src/tailwind/components/getGroupedTextStyles.ts +0 -29
- package/src/tailwind/components/getHitTargetStyles.ts +0 -23
- package/src/tailwind/components/getIconButtonStyles.ts +0 -49
- package/src/tailwind/components/getIconStyles.ts +0 -13
- package/src/tailwind/components/getInputStyles.ts +0 -20
- package/src/tailwind/components/getResponsiveTextStyles.ts +0 -161
- package/src/tailwind/components/types.ts +0 -14
- package/src/tailwind/components/utils.ts +0 -73
- package/src/tailwind/defaultTailwindThemeAsUdsConfig.ts +0 -78
- package/src/tailwind/postcss.config.ts +0 -6
- package/src/tailwind/purger/index.ts +0 -1
- package/src/tailwind/tailwind.config.ts +0 -50
- package/src/tailwind/tailwind.d.ts +0 -5
- package/src/tailwind/tailwindPlugin.ts +0 -724
- package/src/tailwind/theme/getFontFamilyTheme.ts +0 -28
- package/src/tailwind/tsMorph.ts +0 -1
- package/src/tailwind/uds.css +0 -3
- package/src/tailwind/utils/addFontsPlugin.ts +0 -17
- package/src/tailwind/utils/getColorModeStyles.ts +0 -21
- package/src/tailwind/utils/getFontFaceDeclarations.ts +0 -12
- package/src/tailwind/utils/getFontStyles.ts +0 -38
- package/src/tailwind/utils/getMotionStyles.ts +0 -35
- package/src/tailwind/utils/getScaleModeStyles.ts +0 -23
- package/src/tailwind/utils/getShadowPresetValues.ts +0 -133
- package/src/tailwind/utils/getShadowStyles.ts +0 -26
- package/src/tailwind/utils/getShadowVars.ts +0 -40
- package/src/tailwind/utils/index.ts +0 -9
- package/src/tokens/automation/configs/avatar.ts +0 -297
- package/src/tokens/automation/configs/badge.ts +0 -306
- package/src/tokens/automation/configs/checkbox.ts +0 -226
- package/src/tokens/automation/configs/chip.ts +0 -521
- package/src/tokens/automation/configs/divider.ts +0 -112
- package/src/tokens/automation/configs/index.ts +0 -10
- package/src/tokens/automation/configs/input.ts +0 -496
- package/src/tokens/automation/configs/link.ts +0 -183
- package/src/tokens/automation/configs/menu.ts +0 -344
- package/src/tokens/automation/configs/radio.ts +0 -225
- package/src/tokens/automation/configs/switch.ts +0 -323
- package/src/tokens/automation/index.ts +0 -5
- package/src/tokens/automation/mapTextVariantFixtureToValue.ts +0 -8
- package/src/tokens/automation/properties.ts +0 -433
- package/src/tokens/automation/types/ComponentConfig.ts +0 -116
- package/src/tokens/automation/types/ComponentDB.ts +0 -1
- package/src/tokens/automation/types/ComponentStyles.ts +0 -47
- package/src/tokens/automation/types/index.ts +0 -2
- package/src/tokens/automation/utils/cartesianProduct.ts +0 -13
- package/src/tokens/automation/utils/coalesceConfigVariant.ts +0 -49
- package/src/tokens/automation/utils/defaults.ts +0 -29
- package/src/tokens/automation/utils/generateKeyFromFlatConfigPath.ts +0 -15
- package/src/tokens/automation/utils/generateSchemaKey.ts +0 -29
- package/src/tokens/automation/utils/getConfigComponentVariant.ts +0 -28
- package/src/tokens/automation/utils/getConfigVariantComponentStatesMatrix.ts +0 -40
- package/src/tokens/automation/utils/getConfigVariantProperties.ts +0 -32
- package/src/tokens/automation/utils/getConfigVariantPseudoStates.ts +0 -70
- package/src/tokens/automation/utils/getConfigVariants.ts +0 -73
- package/src/tokens/automation/utils/index.ts +0 -939
- package/src/tokens/automation/utils/mapColorFixtureToValue.ts +0 -34
- package/src/tokens/automation/utils/subcomponents.ts +0 -13
- package/src/tokens/automation/utils/variableData.ts +0 -79
- package/src/tokens/automation/utils/variantConfigGuards.ts +0 -17
- package/src/tokens/configs/borderRadius.ts +0 -23
- package/src/tokens/configs/borderWidth.ts +0 -17
- package/src/tokens/configs/button.ts +0 -888
- package/src/tokens/configs/colorMode.ts +0 -14
- package/src/tokens/configs/font.ts +0 -9
- package/src/tokens/configs/iconButton.ts +0 -28
- package/src/tokens/configs/motion.ts +0 -135
- package/src/tokens/configs/palette.ts +0 -124
- package/src/tokens/configs/scaleMode.ts +0 -28
- package/src/tokens/configs/shadow.ts +0 -286
- package/src/tokens/configs/sizes.ts +0 -23
- package/src/tokens/configs/spectrum.ts +0 -729
- package/src/tokens/configs/typography.ts +0 -417
- package/src/tokens/configs/yosConfig.ts +0 -7651
- package/src/tokens/consts/buttonMotionTokens.ts +0 -99
- package/src/tokens/consts/cssTokens.ts +0 -110
- package/src/tokens/consts/defaultModes.ts +0 -15
- package/src/tokens/consts/fontDeclarationsMap.ts +0 -509
- package/src/tokens/index.ts +0 -15
- package/src/tokens/parseButtonVariants.ts +0 -59
- package/src/tokens/parseTokens.ts +0 -122
- package/src/tokens/types.ts +0 -1882
- package/src/tokens/utils/entries.ts +0 -14
- package/src/tokens/utils/fromEntries.ts +0 -11
- package/src/tokens/utils/mapValues.ts +0 -15
- package/src/types.ts +0 -2
- package/src/utils/assertUnreachable.ts +0 -6
- package/src/utils/composeRefs.ts +0 -23
- package/src/utils/createSlot.tsx +0 -131
- package/src/utils/entries.ts +0 -6
- package/src/utils/falsyToString.ts +0 -3
- package/src/utils/getMotionVar.ts +0 -18
- package/src/utils/intersperse.ts +0 -45
- package/src/utils/mapValues.ts +0 -15
- package/src/utils/mergeSlotProps.ts +0 -70
package/src/components/Image.tsx
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import type { ImagePropsWithImgProps as ImageProps } from '@yahoo/uds/tokens';
|
|
2
|
-
|
|
3
|
-
import { getStyles } from '../styles/styler';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* **📸 A component for displaying images**
|
|
7
|
-
*
|
|
8
|
-
* @description
|
|
9
|
-
* Wrapper for the image element. In the future, may provide additional
|
|
10
|
-
* functionality for handling fallbacks, dark mode, lazy loading, shimmers.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```tsx
|
|
14
|
-
* import { Image } from '@yahoo/uds';
|
|
15
|
-
*
|
|
16
|
-
* <Image src="/images/profile.png" width={580} height={334} />;
|
|
17
|
-
* ```
|
|
18
|
-
*
|
|
19
|
-
* @usage
|
|
20
|
-
* - Use the `Image` component to display images.
|
|
21
|
-
* - Use `width` and `height` props to set the size of the image.
|
|
22
|
-
* - Image extends the HTMLImageElement, as well as the uds `Box` component and supports all of their props.
|
|
23
|
-
*
|
|
24
|
-
* @see The {@link https://uds.build/docs/components/image Image Docs} for more info
|
|
25
|
-
*
|
|
26
|
-
* @related [Box](https://uds.build/docs/components/box)
|
|
27
|
-
*/
|
|
28
|
-
function Image({
|
|
29
|
-
width: imageWidth,
|
|
30
|
-
height: imageHeight,
|
|
31
|
-
src,
|
|
32
|
-
alt,
|
|
33
|
-
contentFit,
|
|
34
|
-
// background
|
|
35
|
-
backgroundColor,
|
|
36
|
-
// border
|
|
37
|
-
borderRadius,
|
|
38
|
-
borderTopStartRadius,
|
|
39
|
-
borderTopEndRadius,
|
|
40
|
-
borderBottomStartRadius,
|
|
41
|
-
borderBottomEndRadius,
|
|
42
|
-
borderColor,
|
|
43
|
-
borderStartColor,
|
|
44
|
-
borderEndColor,
|
|
45
|
-
borderTopColor,
|
|
46
|
-
borderBottomColor,
|
|
47
|
-
borderWidth,
|
|
48
|
-
borderVerticalWidth,
|
|
49
|
-
borderHorizontalWidth,
|
|
50
|
-
borderStartWidth,
|
|
51
|
-
borderEndWidth,
|
|
52
|
-
borderTopWidth,
|
|
53
|
-
borderBottomWidth,
|
|
54
|
-
// flex
|
|
55
|
-
alignContent,
|
|
56
|
-
alignItems,
|
|
57
|
-
alignSelf,
|
|
58
|
-
flex,
|
|
59
|
-
flexDirection,
|
|
60
|
-
flexGrow,
|
|
61
|
-
flexShrink,
|
|
62
|
-
flexWrap,
|
|
63
|
-
justifyContent,
|
|
64
|
-
flexBasis,
|
|
65
|
-
// layout
|
|
66
|
-
display,
|
|
67
|
-
overflow,
|
|
68
|
-
overflowX,
|
|
69
|
-
overflowY,
|
|
70
|
-
position,
|
|
71
|
-
// spacing
|
|
72
|
-
spacing,
|
|
73
|
-
spacingHorizontal,
|
|
74
|
-
spacingVertical,
|
|
75
|
-
spacingBottom,
|
|
76
|
-
spacingEnd,
|
|
77
|
-
spacingStart,
|
|
78
|
-
spacingTop,
|
|
79
|
-
offset,
|
|
80
|
-
offsetVertical,
|
|
81
|
-
offsetHorizontal,
|
|
82
|
-
offsetBottom,
|
|
83
|
-
offsetEnd,
|
|
84
|
-
offsetStart,
|
|
85
|
-
offsetTop,
|
|
86
|
-
columnGap,
|
|
87
|
-
rowGap,
|
|
88
|
-
// rest
|
|
89
|
-
...props
|
|
90
|
-
}: ImageProps) {
|
|
91
|
-
const imageStyles = getStyles({
|
|
92
|
-
contentFit,
|
|
93
|
-
backgroundColor,
|
|
94
|
-
// border
|
|
95
|
-
borderRadius,
|
|
96
|
-
borderTopStartRadius,
|
|
97
|
-
borderTopEndRadius,
|
|
98
|
-
borderBottomStartRadius,
|
|
99
|
-
borderBottomEndRadius,
|
|
100
|
-
borderColor,
|
|
101
|
-
borderStartColor,
|
|
102
|
-
borderEndColor,
|
|
103
|
-
borderTopColor,
|
|
104
|
-
borderBottomColor,
|
|
105
|
-
borderWidth,
|
|
106
|
-
borderVerticalWidth,
|
|
107
|
-
borderHorizontalWidth,
|
|
108
|
-
borderStartWidth,
|
|
109
|
-
borderEndWidth,
|
|
110
|
-
borderTopWidth,
|
|
111
|
-
borderBottomWidth,
|
|
112
|
-
// flex
|
|
113
|
-
alignContent,
|
|
114
|
-
alignItems,
|
|
115
|
-
alignSelf,
|
|
116
|
-
flex,
|
|
117
|
-
flexDirection,
|
|
118
|
-
flexGrow,
|
|
119
|
-
flexShrink,
|
|
120
|
-
flexWrap,
|
|
121
|
-
justifyContent,
|
|
122
|
-
flexBasis,
|
|
123
|
-
// layout
|
|
124
|
-
display,
|
|
125
|
-
|
|
126
|
-
overflow,
|
|
127
|
-
overflowX,
|
|
128
|
-
overflowY,
|
|
129
|
-
position,
|
|
130
|
-
// spacing
|
|
131
|
-
spacing,
|
|
132
|
-
spacingHorizontal,
|
|
133
|
-
spacingVertical,
|
|
134
|
-
spacingBottom,
|
|
135
|
-
spacingEnd,
|
|
136
|
-
spacingStart,
|
|
137
|
-
spacingTop,
|
|
138
|
-
offset,
|
|
139
|
-
offsetVertical,
|
|
140
|
-
offsetHorizontal,
|
|
141
|
-
offsetBottom,
|
|
142
|
-
offsetEnd,
|
|
143
|
-
offsetStart,
|
|
144
|
-
offsetTop,
|
|
145
|
-
columnGap,
|
|
146
|
-
rowGap,
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
return (
|
|
150
|
-
<img
|
|
151
|
-
src={src}
|
|
152
|
-
alt={alt}
|
|
153
|
-
className={imageStyles}
|
|
154
|
-
style={{ width: imageWidth, height: imageHeight }}
|
|
155
|
-
{...props}
|
|
156
|
-
/>
|
|
157
|
-
);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
Image.displayName = 'Image';
|
|
161
|
-
|
|
162
|
-
export { Image, type ImageProps };
|
package/src/components/Link.tsx
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import type { UniversalLinkProps } from '@yahoo/uds/tokens';
|
|
2
|
-
import { forwardRef, useMemo } from 'react';
|
|
3
|
-
|
|
4
|
-
import { cx, getStyles } from '../styles/styler';
|
|
5
|
-
import type { IconSlotProps } from './IconSlot';
|
|
6
|
-
import { IconSlot } from './IconSlot';
|
|
7
|
-
|
|
8
|
-
type HTMLAnchorProps = React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
9
|
-
|
|
10
|
-
interface LinkProps extends HTMLAnchorProps, UniversalLinkProps {
|
|
11
|
-
/** The link's destination. */
|
|
12
|
-
href?: string;
|
|
13
|
-
/** Anchor rel property. @default "noopener" **/
|
|
14
|
-
rel?: string;
|
|
15
|
-
/** If true, forces an underline to always be shown for a11y purposes. @default false */
|
|
16
|
-
alwaysUnderline?: boolean;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* A Link provides navigation or actionable functionality by linking users to
|
|
21
|
-
* another location within an application, an external resource, or triggering
|
|
22
|
-
* specific in-page interactions (i.e. scroll-to-section).
|
|
23
|
-
*
|
|
24
|
-
* @componentType Client component
|
|
25
|
-
*
|
|
26
|
-
* @description
|
|
27
|
-
* A link component provides navigation or actionable functionality by linking users to another location within an application, an external resource, or triggering specific in-page interactions (i.e. scroll-to-section). This is different than a “button” link which is a button component without a border or fill.
|
|
28
|
-
*
|
|
29
|
-
* @see
|
|
30
|
-
* Check out the {@link https://uds.build/docs/components/link Link Docs} for more info
|
|
31
|
-
*
|
|
32
|
-
* @usage
|
|
33
|
-
* - Provide a way for users to navigate to another location.
|
|
34
|
-
* - Provide a trigger for in-page interactions.
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```tsx
|
|
38
|
-
* 'use client';
|
|
39
|
-
* import { Link } from '@yahoo/uds';
|
|
40
|
-
* import { Share, Link as LinkIcon } from '@yahoo/uds-icons';
|
|
41
|
-
*
|
|
42
|
-
* <Link href="#">My Link</Link>
|
|
43
|
-
* <Link href="#" startIcon={Share} />
|
|
44
|
-
* <Link href="https://yahoo.com" target="_blank" endIcon={LinkIcon} />
|
|
45
|
-
*```
|
|
46
|
-
**/
|
|
47
|
-
const Link = forwardRef<HTMLAnchorElement, LinkProps>(function Input(
|
|
48
|
-
{
|
|
49
|
-
variant = 'primary',
|
|
50
|
-
textVariant,
|
|
51
|
-
startIcon,
|
|
52
|
-
endIcon,
|
|
53
|
-
alwaysUnderline = false,
|
|
54
|
-
children,
|
|
55
|
-
className,
|
|
56
|
-
...anchorProps
|
|
57
|
-
}: LinkProps,
|
|
58
|
-
ref,
|
|
59
|
-
) {
|
|
60
|
-
// This is a feature unrelated to configurator. DO NOT REMOVE.
|
|
61
|
-
const shouldSizeRelativeToContainingText = !textVariant;
|
|
62
|
-
|
|
63
|
-
const rootClasses = useMemo(() => {
|
|
64
|
-
// TODO: These should be getting generated by the textStyle variant
|
|
65
|
-
const textStyles =
|
|
66
|
-
!shouldSizeRelativeToContainingText &&
|
|
67
|
-
getStyles({
|
|
68
|
-
linkTextStyleRoot: textVariant,
|
|
69
|
-
fontSize: textVariant,
|
|
70
|
-
fontFamily: textVariant,
|
|
71
|
-
fontWeight: textVariant,
|
|
72
|
-
lineHeight: textVariant,
|
|
73
|
-
textTransform: textVariant,
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
return getStyles({
|
|
77
|
-
linkVariantRoot: variant,
|
|
78
|
-
display: 'inline-flex',
|
|
79
|
-
alignItems: 'center',
|
|
80
|
-
className: cx(
|
|
81
|
-
textStyles,
|
|
82
|
-
// Focus ring
|
|
83
|
-
'uds-ring',
|
|
84
|
-
alwaysUnderline && 'underline',
|
|
85
|
-
className,
|
|
86
|
-
),
|
|
87
|
-
});
|
|
88
|
-
}, [alwaysUnderline, shouldSizeRelativeToContainingText, textVariant, variant, className]);
|
|
89
|
-
|
|
90
|
-
const iconStartStyles = getStyles({
|
|
91
|
-
linkVariantIconStart: variant,
|
|
92
|
-
linkTextStyleIcon: textVariant,
|
|
93
|
-
className: cx(shouldSizeRelativeToContainingText && 'w-[0.7em] h-[0.7em]'),
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
const iconEndStyles = getStyles({
|
|
97
|
-
linkVariantIconEnd: variant,
|
|
98
|
-
linkTextStyleIcon: textVariant,
|
|
99
|
-
className: cx(shouldSizeRelativeToContainingText && 'w-[0.7em] h-[0.7em]'),
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
const iconProps: IconSlotProps['iconProps'] = {
|
|
103
|
-
variant: 'outline',
|
|
104
|
-
color: 'current',
|
|
105
|
-
} as const;
|
|
106
|
-
|
|
107
|
-
return (
|
|
108
|
-
<a ref={ref} className={rootClasses} {...anchorProps}>
|
|
109
|
-
{startIcon && (
|
|
110
|
-
<IconSlot
|
|
111
|
-
className={iconStartStyles}
|
|
112
|
-
icon={startIcon}
|
|
113
|
-
iconProps={iconProps}
|
|
114
|
-
data-testid="start-icon"
|
|
115
|
-
/>
|
|
116
|
-
)}
|
|
117
|
-
|
|
118
|
-
{children}
|
|
119
|
-
|
|
120
|
-
{endIcon && (
|
|
121
|
-
<IconSlot
|
|
122
|
-
className={iconEndStyles}
|
|
123
|
-
icon={endIcon}
|
|
124
|
-
iconProps={iconProps}
|
|
125
|
-
data-testid="end-icon"
|
|
126
|
-
/>
|
|
127
|
-
)}
|
|
128
|
-
</a>
|
|
129
|
-
);
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
Link.displayName = 'Link';
|
|
133
|
-
|
|
134
|
-
export { Link, type LinkProps };
|
package/src/components/Text.tsx
DELETED
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
import type { UniversalTextProps } from '@yahoo/uds/tokens';
|
|
2
|
-
import type { Ref } from 'react';
|
|
3
|
-
import { forwardRef } from 'react';
|
|
4
|
-
|
|
5
|
-
import { getStyles } from '../styles/styler';
|
|
6
|
-
import { createSlot } from '../utils/createSlot';
|
|
7
|
-
|
|
8
|
-
const Slot = createSlot<React.ComponentType<HtmlParagraphProps>>();
|
|
9
|
-
|
|
10
|
-
type HtmlParagraphProps = Omit<React.HTMLAttributes<HTMLParagraphElement>, 'color'>;
|
|
11
|
-
type TextElementTagName =
|
|
12
|
-
| 'h1'
|
|
13
|
-
| 'h2'
|
|
14
|
-
| 'h3'
|
|
15
|
-
| 'h4'
|
|
16
|
-
| 'h5'
|
|
17
|
-
| 'p'
|
|
18
|
-
| 'strong'
|
|
19
|
-
| 'span'
|
|
20
|
-
| 'label'
|
|
21
|
-
| 'li'
|
|
22
|
-
| 'sup';
|
|
23
|
-
|
|
24
|
-
type ColorWithInherit = Exclude<UniversalTextProps['color'], undefined> | 'inherit';
|
|
25
|
-
type VariantWithInherit = Exclude<UniversalTextProps['variant'], undefined> | 'inherit';
|
|
26
|
-
|
|
27
|
-
type TextProps<TagName extends TextElementTagName = TextElementTagName> = {
|
|
28
|
-
/** Ref passed to the inner container. */
|
|
29
|
-
ref?: Ref<HTMLElement>;
|
|
30
|
-
/** Changes the HTML tag used to render text. Uses the most appropriate semantic tag based on the text style variant. */
|
|
31
|
-
as?: TagName;
|
|
32
|
-
|
|
33
|
-
// Add inherit option for configured component composition.
|
|
34
|
-
variant?: VariantWithInherit;
|
|
35
|
-
color?: ColorWithInherit;
|
|
36
|
-
} & JSX.IntrinsicElements[TagName] &
|
|
37
|
-
Omit<UniversalTextProps, 'variant' | 'color'>;
|
|
38
|
-
|
|
39
|
-
const asMap: Record<VariantWithInherit, TextElementTagName> = {
|
|
40
|
-
display1: 'h1',
|
|
41
|
-
display2: 'h1',
|
|
42
|
-
display3: 'h1',
|
|
43
|
-
title1: 'h1',
|
|
44
|
-
title2: 'h2',
|
|
45
|
-
title3: 'h3',
|
|
46
|
-
title4: 'h4',
|
|
47
|
-
headline1: 'h5',
|
|
48
|
-
body1: 'p',
|
|
49
|
-
label1: 'p',
|
|
50
|
-
label2: 'p',
|
|
51
|
-
label3: 'p',
|
|
52
|
-
label4: 'p',
|
|
53
|
-
caption1: 'p',
|
|
54
|
-
caption2: 'p',
|
|
55
|
-
legal1: 'p',
|
|
56
|
-
'display1/emphasized': 'h1',
|
|
57
|
-
'display2/emphasized': 'h1',
|
|
58
|
-
'display3/emphasized': 'h1',
|
|
59
|
-
'title1/emphasized': 'h1',
|
|
60
|
-
'title2/emphasized': 'h2',
|
|
61
|
-
'title3/emphasized': 'h3',
|
|
62
|
-
'title4/emphasized': 'h4',
|
|
63
|
-
'headline1/emphasized': 'h5',
|
|
64
|
-
'body1/emphasized': 'p',
|
|
65
|
-
'label1/emphasized': 'p',
|
|
66
|
-
'label2/emphasized': 'p',
|
|
67
|
-
'label3/emphasized': 'p',
|
|
68
|
-
'label4/emphasized': 'p',
|
|
69
|
-
'caption1/emphasized': 'p',
|
|
70
|
-
'caption2/emphasized': 'p',
|
|
71
|
-
'legal1/emphasized': 'p',
|
|
72
|
-
ui1: 'span',
|
|
73
|
-
ui2: 'span',
|
|
74
|
-
ui3: 'span',
|
|
75
|
-
ui4: 'span',
|
|
76
|
-
ui5: 'span',
|
|
77
|
-
ui6: 'span',
|
|
78
|
-
'ui1/emphasized': 'span',
|
|
79
|
-
'ui2/emphasized': 'span',
|
|
80
|
-
'ui3/emphasized': 'span',
|
|
81
|
-
'ui4/emphasized': 'span',
|
|
82
|
-
'ui5/emphasized': 'span',
|
|
83
|
-
'ui6/emphasized': 'span',
|
|
84
|
-
inherit: 'p',
|
|
85
|
-
} as const;
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* **💬 A text element that can be used to display text**
|
|
89
|
-
*
|
|
90
|
-
* @description
|
|
91
|
-
* By default, the `Text` component uses text primary color and selects the
|
|
92
|
-
* correct font, weight, and leading. It also choices appropriate semantic
|
|
93
|
-
* HTML element based on the `variant` prop. For example, `body1` will use a
|
|
94
|
-
* `<p>` tag, `title1` uses an `<h1>`, etc. This behavior can be overridden
|
|
95
|
-
* with the `as` prop.
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* @example
|
|
99
|
-
* ```tsx
|
|
100
|
-
* import { Text } from '@yahoo/uds';
|
|
101
|
-
*
|
|
102
|
-
* <Text variant="body1" color="primary">
|
|
103
|
-
* Text goes here
|
|
104
|
-
* </Text>
|
|
105
|
-
* ```
|
|
106
|
-
*
|
|
107
|
-
* @usage
|
|
108
|
-
* - Use `Text` to display text in your app.
|
|
109
|
-
* - Use `variant` to change the size and weight of the text.
|
|
110
|
-
* - Use `color` to change the color of the text.
|
|
111
|
-
* - Use `as` to change the HTML tag used to render the text.
|
|
112
|
-
*
|
|
113
|
-
* @see The {@link https://uds.build/docs/components/text Text Docs} for more info
|
|
114
|
-
*/
|
|
115
|
-
const Text = forwardRef(function Text(
|
|
116
|
-
{
|
|
117
|
-
className,
|
|
118
|
-
asChild,
|
|
119
|
-
// text props
|
|
120
|
-
color = 'primary',
|
|
121
|
-
variant = 'body1',
|
|
122
|
-
as = asMap[variant],
|
|
123
|
-
fontFamily,
|
|
124
|
-
fontSize,
|
|
125
|
-
fontWeight,
|
|
126
|
-
lineHeight,
|
|
127
|
-
textTransform,
|
|
128
|
-
textAlign,
|
|
129
|
-
// background
|
|
130
|
-
backgroundColor,
|
|
131
|
-
// border
|
|
132
|
-
borderRadius,
|
|
133
|
-
borderTopStartRadius,
|
|
134
|
-
borderTopEndRadius,
|
|
135
|
-
borderBottomStartRadius,
|
|
136
|
-
borderBottomEndRadius,
|
|
137
|
-
borderColor,
|
|
138
|
-
borderStartColor,
|
|
139
|
-
borderEndColor,
|
|
140
|
-
borderTopColor,
|
|
141
|
-
borderBottomColor,
|
|
142
|
-
borderWidth,
|
|
143
|
-
borderVerticalWidth,
|
|
144
|
-
borderHorizontalWidth,
|
|
145
|
-
borderStartWidth,
|
|
146
|
-
borderEndWidth,
|
|
147
|
-
borderTopWidth,
|
|
148
|
-
borderBottomWidth,
|
|
149
|
-
// flex
|
|
150
|
-
alignContent,
|
|
151
|
-
alignItems,
|
|
152
|
-
alignSelf,
|
|
153
|
-
flex,
|
|
154
|
-
flexDirection,
|
|
155
|
-
flexGrow,
|
|
156
|
-
flexShrink,
|
|
157
|
-
flexWrap,
|
|
158
|
-
justifyContent,
|
|
159
|
-
flexBasis,
|
|
160
|
-
// layout
|
|
161
|
-
display,
|
|
162
|
-
overflow,
|
|
163
|
-
overflowX,
|
|
164
|
-
overflowY,
|
|
165
|
-
position,
|
|
166
|
-
// spacing
|
|
167
|
-
spacing,
|
|
168
|
-
spacingHorizontal,
|
|
169
|
-
spacingVertical,
|
|
170
|
-
spacingBottom,
|
|
171
|
-
spacingEnd,
|
|
172
|
-
spacingStart,
|
|
173
|
-
spacingTop,
|
|
174
|
-
offset,
|
|
175
|
-
offsetVertical,
|
|
176
|
-
offsetHorizontal,
|
|
177
|
-
offsetBottom,
|
|
178
|
-
offsetEnd,
|
|
179
|
-
offsetStart,
|
|
180
|
-
offsetTop,
|
|
181
|
-
columnGap,
|
|
182
|
-
rowGap,
|
|
183
|
-
// rest
|
|
184
|
-
...props
|
|
185
|
-
}: TextProps,
|
|
186
|
-
ref: React.ForwardedRef<HTMLElement>,
|
|
187
|
-
) {
|
|
188
|
-
const textStyles: Parameters<typeof getStyles>[0] = {
|
|
189
|
-
...(color && color !== 'inherit' ? { color } : {}),
|
|
190
|
-
...(variant && variant !== 'inherit'
|
|
191
|
-
? {
|
|
192
|
-
fontFamily: fontFamily ?? variant,
|
|
193
|
-
fontSize: fontSize ?? variant,
|
|
194
|
-
fontWeight: fontWeight ?? variant,
|
|
195
|
-
lineHeight: lineHeight ?? variant,
|
|
196
|
-
textTransform: textTransform ?? variant,
|
|
197
|
-
}
|
|
198
|
-
: {}),
|
|
199
|
-
textAlign,
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
const classNames = getStyles({
|
|
203
|
-
className,
|
|
204
|
-
// text styles
|
|
205
|
-
...textStyles,
|
|
206
|
-
// background
|
|
207
|
-
backgroundColor,
|
|
208
|
-
// border
|
|
209
|
-
borderRadius,
|
|
210
|
-
borderTopStartRadius,
|
|
211
|
-
borderTopEndRadius,
|
|
212
|
-
borderBottomStartRadius,
|
|
213
|
-
borderBottomEndRadius,
|
|
214
|
-
borderColor,
|
|
215
|
-
borderStartColor,
|
|
216
|
-
borderEndColor,
|
|
217
|
-
borderTopColor,
|
|
218
|
-
borderBottomColor,
|
|
219
|
-
borderWidth,
|
|
220
|
-
borderVerticalWidth,
|
|
221
|
-
borderHorizontalWidth,
|
|
222
|
-
borderStartWidth,
|
|
223
|
-
borderEndWidth,
|
|
224
|
-
borderTopWidth,
|
|
225
|
-
borderBottomWidth,
|
|
226
|
-
// flex
|
|
227
|
-
alignContent,
|
|
228
|
-
alignItems,
|
|
229
|
-
alignSelf,
|
|
230
|
-
flex,
|
|
231
|
-
flexDirection,
|
|
232
|
-
flexGrow,
|
|
233
|
-
flexShrink,
|
|
234
|
-
flexWrap,
|
|
235
|
-
justifyContent,
|
|
236
|
-
flexBasis,
|
|
237
|
-
// layout
|
|
238
|
-
display,
|
|
239
|
-
overflow,
|
|
240
|
-
overflowX,
|
|
241
|
-
overflowY,
|
|
242
|
-
position,
|
|
243
|
-
// spacing
|
|
244
|
-
spacing,
|
|
245
|
-
spacingHorizontal,
|
|
246
|
-
spacingVertical,
|
|
247
|
-
spacingBottom,
|
|
248
|
-
spacingEnd,
|
|
249
|
-
spacingStart,
|
|
250
|
-
spacingTop,
|
|
251
|
-
offset,
|
|
252
|
-
offsetVertical,
|
|
253
|
-
offsetHorizontal,
|
|
254
|
-
offsetBottom,
|
|
255
|
-
offsetEnd,
|
|
256
|
-
offsetStart,
|
|
257
|
-
offsetTop,
|
|
258
|
-
columnGap,
|
|
259
|
-
rowGap,
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
const Comp = asChild ? Slot : as;
|
|
263
|
-
|
|
264
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
265
|
-
// @ts-ignore this is fine
|
|
266
|
-
return <Comp className={classNames} ref={ref} {...props} />;
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
// Need to re-set this because of the forwardRef wrapper
|
|
270
|
-
Text.displayName = 'Text';
|
|
271
|
-
|
|
272
|
-
export { Text, type TextProps };
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { UniversalStackProps } from '@yahoo/uds/tokens';
|
|
2
|
-
import { forwardRef } from 'react';
|
|
3
|
-
|
|
4
|
-
import { intersperseReactChildren } from '../utils/intersperse';
|
|
5
|
-
import type { DivProps } from './Box';
|
|
6
|
-
import { Box } from './Box';
|
|
7
|
-
|
|
8
|
-
type VStackProps = UniversalStackProps & DivProps;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* **🥞 A layout component that arranges its children in rows using flexbox**
|
|
12
|
-
*
|
|
13
|
-
* @description
|
|
14
|
-
* VStack is a layout component that arranges its children in rows using [flexbox](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Flexbox)
|
|
15
|
-
* and can be used to compose larger layouts. VStack is similar to [Box](./box) but provides additional features like a `gap` property to
|
|
16
|
-
* add spacing between children.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```tsx
|
|
20
|
-
* import { VStack, Text } from '@yahoo/uds';
|
|
21
|
-
*
|
|
22
|
-
* <VStack gap="6">
|
|
23
|
-
* <Text variant="body1" color="primary">First</Text>
|
|
24
|
-
* <Text variant="body1" color="primary">Second</Text>
|
|
25
|
-
* <Text variant="body1" color="primary">Third</Text>
|
|
26
|
-
* </VStack>
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @usage
|
|
30
|
-
* - Create a column of items, optionally with gaps between.
|
|
31
|
-
* - Create rows that are sized to their content (height only). By default each child will fill the width of the VStack.
|
|
32
|
-
* - Create rows that fill the available space within the parent container.
|
|
33
|
-
* - Create rows of proportionate size to each other (also known as a ratio-based layout).
|
|
34
|
-
*
|
|
35
|
-
* @see The {@link https://uds.build/docs/components/v-stack VStack Docs} for more info
|
|
36
|
-
*
|
|
37
|
-
* @related [Box](https://uds.build/docs/components/box), [HStack](https://uds.build/docs/components/h-stack)
|
|
38
|
-
**/
|
|
39
|
-
const VStack = forwardRef<HTMLDivElement, VStackProps>(function VStack(
|
|
40
|
-
{ gap, children, separator, ...props }: VStackProps,
|
|
41
|
-
ref,
|
|
42
|
-
) {
|
|
43
|
-
return (
|
|
44
|
-
<Box ref={ref} flexDirection="column" columnGap={gap} rowGap={gap} {...props}>
|
|
45
|
-
{separator ? intersperseReactChildren(children, separator) : children}
|
|
46
|
-
</Box>
|
|
47
|
-
);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
// Need to re-set this because of the forwardRef wrapper
|
|
51
|
-
VStack.displayName = 'VStack';
|
|
52
|
-
|
|
53
|
-
export { VStack, type VStackProps };
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { MotionConfigProps } from 'motion/react';
|
|
2
|
-
import { m } from 'motion/react';
|
|
3
|
-
import type { PropsWithChildren } from 'react';
|
|
4
|
-
import { useEffect, useRef, useState } from 'react';
|
|
5
|
-
|
|
6
|
-
import type { SpringMotionConfigProps } from './SpringMotionConfig';
|
|
7
|
-
import { SpringMotionConfig } from './SpringMotionConfig';
|
|
8
|
-
|
|
9
|
-
interface AnimateHeightChangeProps extends PropsWithChildren {
|
|
10
|
-
reduceMotion?: MotionConfigProps['reducedMotion'];
|
|
11
|
-
layoutVariant?: SpringMotionConfigProps['layoutVariant'];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const AnimateHeightChange = ({
|
|
15
|
-
children,
|
|
16
|
-
reduceMotion,
|
|
17
|
-
layoutVariant,
|
|
18
|
-
}: AnimateHeightChangeProps) => {
|
|
19
|
-
const ref = useRef<HTMLDivElement | null>(null);
|
|
20
|
-
const [height, setHeight] = useState<number | 'auto'>('auto');
|
|
21
|
-
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
if (ref.current) {
|
|
24
|
-
const observer = new ResizeObserver((entries) => {
|
|
25
|
-
setHeight(entries[0].contentRect.height);
|
|
26
|
-
});
|
|
27
|
-
observer.observe(ref.current);
|
|
28
|
-
|
|
29
|
-
return () => {
|
|
30
|
-
observer.disconnect();
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
}, []);
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<SpringMotionConfig reducedMotion={reduceMotion} layoutSpeed="4" layoutVariant={layoutVariant}>
|
|
37
|
-
<m.div
|
|
38
|
-
className="overflow-hidden"
|
|
39
|
-
style={{ height, opacity: 0 }}
|
|
40
|
-
animate={{ height, opacity: 1 }}
|
|
41
|
-
>
|
|
42
|
-
<div ref={ref}>{children}</div>
|
|
43
|
-
</m.div>
|
|
44
|
-
</SpringMotionConfig>
|
|
45
|
-
);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
AnimateHeightChange.displayName = 'AnimateHeightChange';
|
|
49
|
-
|
|
50
|
-
export { AnimateHeightChange, type AnimateHeightChangeProps };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { AvatarImageProps } from './AvatarImage';
|
|
2
|
-
import { AvatarImage } from './AvatarImage';
|
|
3
|
-
|
|
4
|
-
type AvatarProps = AvatarImageProps;
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* **👤 Avatar Component**
|
|
8
|
-
*
|
|
9
|
-
* @description The avatar component visually represents a person or an organization within an interface. It helps users quickly identify individuals or entities through images, icons, or text. Commonly used in user profiles, comments, and activity feeds, avatars create a recognizable and consistent visual identity across the system. With standardized sizes, variants, and configurable options, the component ensures flexibility while maintaining design cohesion and accessibility.
|
|
10
|
-
* @usage The Avatar component should be used whenever you need to visually represent a user's identity in your application. This includes places like profile headers, user lists, chat messages, and comment sections. It's ideal for providing a consistent visual cue for users, whether by displaying a profile image, generating initials from a name, or falling back to a default icon when no image is available.
|
|
11
|
-
* @param props - Combined Avatar props.
|
|
12
|
-
* @returns The Avatar element.
|
|
13
|
-
* @componentType Client component
|
|
14
|
-
* @example ```tsx
|
|
15
|
-
* import { Avatar } from '@yahoo/uds';
|
|
16
|
-
*
|
|
17
|
-
* <Avatar
|
|
18
|
-
* src="https://images.unsplash.com/photo-1438761681033-6461ffad8d80?w=400"
|
|
19
|
-
* alt="Jane Doe"
|
|
20
|
-
* fallback="J"
|
|
21
|
-
* />
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
*/
|
|
25
|
-
const Avatar = (props: AvatarProps) => {
|
|
26
|
-
return <AvatarImage {...props} />;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
Avatar.displayName = 'Avatar';
|
|
30
|
-
|
|
31
|
-
export { Avatar, type AvatarProps };
|