@yahoo/uds 2.2.1 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cli/PropsToClass.mock.tsx +14 -0
- package/cli/bin/uds-darwin-arm64-baseline +0 -0
- package/cli/bin/uds-linux-arm64 +0 -0
- package/cli/bin/uds-linux-x64-baseline +0 -0
- package/dist/Text-CwmyqrBk.d.cts +243 -0
- package/dist/Text-CwmyqrBk.d.ts +243 -0
- package/dist/client/index.cjs +2 -2
- package/dist/client/index.d.cts +46 -6
- package/dist/client/index.d.ts +46 -6
- package/dist/client/index.js +3 -3
- package/dist/experimental/client/index.cjs +3 -0
- package/dist/experimental/client/index.d.cts +146 -0
- package/dist/experimental/client/index.d.ts +146 -0
- package/dist/experimental/client/index.js +3 -0
- package/dist/experimental/index.cjs +2 -2
- package/dist/experimental/index.d.cts +5 -387
- package/dist/experimental/index.d.ts +5 -387
- package/dist/experimental/index.js +1 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +4 -42
- package/dist/index.d.ts +4 -42
- package/dist/index.js +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/tailwind/plugin.cjs +2 -2
- package/dist/tailwind/plugin.d.cts +1 -1
- package/dist/tailwind/plugin.d.ts +1 -1
- package/dist/tailwind/plugin.js +2 -2
- package/dist/tailwind/purger.cjs +1 -1
- package/dist/tailwind/purger.js +1 -1
- package/dist/tailwind/utils.d.cts +1 -1
- package/dist/tailwind/utils.d.ts +1 -1
- package/dist/tokens/index.d.cts +2 -2
- package/dist/tokens/index.d.ts +2 -2
- package/dist/tokens/parseTokens.d.cts +1 -1
- package/dist/tokens/parseTokens.d.ts +1 -1
- package/dist/{types-Pyccco5Q.d.cts → types-DsMvZpWN.d.cts} +1 -1
- package/dist/{types-Pyccco5Q.d.ts → types-DsMvZpWN.d.ts} +1 -1
- package/package.json +11 -1
@@ -0,0 +1,14 @@
|
|
1
|
+
import { Button, cx, HStack, Text } from '@yahoo/uds';
|
2
|
+
const textClassName = cx('text-primary');
|
3
|
+
const otherProps = { height: 'fit' };
|
4
|
+
|
5
|
+
export const PageA = () => {
|
6
|
+
return (
|
7
|
+
<HStack className="w-full max-h-screen">
|
8
|
+
<Button className="min-w-full">Click me</Button>
|
9
|
+
{/* 🙏 TODO: Add w-10/12 to your className attribute */}
|
10
|
+
<Text className={textClassName}>Some text</Text>
|
11
|
+
<Text {...otherProps}>Some text</Text>
|
12
|
+
</HStack>
|
13
|
+
);
|
14
|
+
}
|
Binary file
|
package/cli/bin/uds-linux-arm64
CHANGED
Binary file
|
Binary file
|
@@ -0,0 +1,243 @@
|
|
1
|
+
import { PropsWithChildren, Ref } from 'react';
|
2
|
+
import { SvgIcon, IconSize, IconVariant } from '@yahoo/uds-icons/types';
|
3
|
+
|
4
|
+
declare const alwaysPalette: {
|
5
|
+
white: string;
|
6
|
+
black: string;
|
7
|
+
transparent: string;
|
8
|
+
current: string;
|
9
|
+
};
|
10
|
+
|
11
|
+
type CorePaletteAlias = 'brand' | 'accent' | 'alert' | 'positive' | 'warning';
|
12
|
+
type BackgroundPaletteAlias = 'primary' | 'secondary';
|
13
|
+
type ForegroundPaletteAlias = 'primary' | 'secondary' | 'tertiary' | 'muted' | 'on-color';
|
14
|
+
type LinePaletteAlias = 'primary' | 'secondary' | 'tertiary' | 'muted';
|
15
|
+
type AlwaysPalette = typeof alwaysPalette;
|
16
|
+
type AlwaysPaletteAlias = keyof AlwaysPalette;
|
17
|
+
type ForegroundColor = CorePaletteAlias | ForegroundPaletteAlias | AlwaysPaletteAlias;
|
18
|
+
type LineColor = CorePaletteAlias | LinePaletteAlias | AlwaysPaletteAlias;
|
19
|
+
type BackgroundColor = CorePaletteAlias | BackgroundPaletteAlias | AlwaysPaletteAlias;
|
20
|
+
type TextVariant = 'display1' | 'display2' | 'display3' | 'title1' | 'title2' | 'title3' | 'title4' | 'headline1' | 'body1' | 'label1' | 'label2' | 'caption1' | 'caption2' | 'legal1';
|
21
|
+
type FontAlias = 'sans' | 'sans-alt' | 'serif' | 'serif-alt' | 'mono';
|
22
|
+
type FontWeightDescriptive = 'thin' | 'extralight' | 'light' | 'regular' | 'medium' | 'semibold' | 'bold' | 'extrabold' | 'black';
|
23
|
+
type TextTransform = 'none' | 'uppercase' | 'lowercase' | 'capitalize';
|
24
|
+
type TShirtSize = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
25
|
+
type TShirtSizeCommon = Extract<TShirtSize, 'sm' | 'md' | 'lg'>;
|
26
|
+
type AvatarSize = TShirtSizeCommon;
|
27
|
+
type SpacingAlias = '0' | 'px' | '0.5' | '1' | '1.5' | '2' | '2.5' | '3' | '3.5' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12' | '14' | '16' | '20' | '24' | '28' | '32' | '36' | '40' | '44' | '48' | '52' | '56' | '60' | '64' | '72' | '80' | '96';
|
28
|
+
type BorderRadius = TShirtSize;
|
29
|
+
type BorderWidth = 'none' | 'thin' | 'medium' | 'thick';
|
30
|
+
type Flex = '1' | 'auto' | 'initial' | 'none';
|
31
|
+
type FlexGrow = '0' | '1' | '2' | '3';
|
32
|
+
type FlexShrink = '0' | '1';
|
33
|
+
type FlexAlignContent = 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'space-between' | 'space-around';
|
34
|
+
type FlexAlignItems = 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline';
|
35
|
+
type FlexAlignSelf = 'auto' | 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline';
|
36
|
+
type FlexDirection = 'row' | 'column' | 'row-reverse' | 'column-reverse';
|
37
|
+
type FlexWrap = 'wrap' | 'nowrap' | 'wrap-reverse';
|
38
|
+
type FlexJustifyContent = 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly';
|
39
|
+
type FlexBasis = 'min-content';
|
40
|
+
type Display = 'block' | 'inline-block' | 'inline' | 'flex' | 'inline-flex' | 'table' | 'inline-table' | 'table-caption' | 'table-cell' | 'table-column' | 'table-column-group' | 'table-footer-group' | 'table-header-group' | 'table-row-group' | 'table-row' | 'flow-root' | 'grid' | 'contents';
|
41
|
+
type Overflow = 'auto' | 'hidden' | 'clip' | 'visible' | 'scroll';
|
42
|
+
type Position = 'static' | 'fixed' | 'absolute' | 'relative' | 'sticky';
|
43
|
+
type ImageStyleProps = {
|
44
|
+
/**
|
45
|
+
* Determines how the image should be resized to fit its container.
|
46
|
+
*/
|
47
|
+
contentFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
48
|
+
};
|
49
|
+
interface BorderStyleProps {
|
50
|
+
/** Add a border radius to all corners of the box. */
|
51
|
+
borderRadius?: BorderRadius;
|
52
|
+
/** Add a border radius to top left corner of the box. */
|
53
|
+
borderTopStartRadius?: BorderRadius;
|
54
|
+
/** Add a border radius to top right corner of the box. */
|
55
|
+
borderTopEndRadius?: BorderRadius;
|
56
|
+
/** Add a border radius to bottom left corner of the box. */
|
57
|
+
borderBottomStartRadius?: BorderRadius;
|
58
|
+
/** Add a border radius to bottom right corner of the box. */
|
59
|
+
borderBottomEndRadius?: BorderRadius;
|
60
|
+
/** Adds a custom border color from the palette */
|
61
|
+
borderColor?: LineColor;
|
62
|
+
/** Start border color */
|
63
|
+
borderStartColor?: LineColor;
|
64
|
+
/** End border color */
|
65
|
+
borderEndColor?: LineColor;
|
66
|
+
/** Top border color */
|
67
|
+
borderTopColor?: LineColor;
|
68
|
+
/** Bottom border color */
|
69
|
+
borderBottomColor?: LineColor;
|
70
|
+
/** Shorthand property to the width of an element's border. */
|
71
|
+
borderWidth?: BorderWidth;
|
72
|
+
/** Sets the width of the top and bottom border of an element. */
|
73
|
+
borderVerticalWidth?: BorderWidth;
|
74
|
+
/** Sets the width of the start (left) and end (right) border of an element. */
|
75
|
+
borderHorizontalWidth?: BorderWidth;
|
76
|
+
/** Sets the width of the start (left) border of an element. */
|
77
|
+
borderStartWidth?: BorderWidth;
|
78
|
+
/** Sets the width of the end (right) border of an element. */
|
79
|
+
borderEndWidth?: BorderWidth;
|
80
|
+
/** Sets the width of the top border of an element. */
|
81
|
+
borderTopWidth?: BorderWidth;
|
82
|
+
/** Sets the width of the bottom border of an element. */
|
83
|
+
borderBottomWidth?: BorderWidth;
|
84
|
+
}
|
85
|
+
interface LayoutStyleProps {
|
86
|
+
/** Sets whether an element is treated as a block or inline box and the layout used for its children, such as flow layout, grid or flex. */
|
87
|
+
display?: Display;
|
88
|
+
/** Shorthand property which sets the desired behavior when content does not fit in the parent element box (overflows) in the horizontal and/or vertical direction. */
|
89
|
+
overflow?: Overflow;
|
90
|
+
/** Sets what shows when content overflows a block-level element's left and right edges. This may be nothing, a scroll bar, or the overflow content. This property may also be set by using the overflow shorthand property. */
|
91
|
+
overflowX?: Overflow;
|
92
|
+
/** sets what shows when content overflows a block-level element's top and bottom edges. This may be nothing, a scroll bar, or the overflow content. This property may also be set by using the overflow shorthand property. */
|
93
|
+
overflowY?: Overflow;
|
94
|
+
/** Sets how an element is positioned in a document. The top, right, bottom, and left properties determine the final location of positioned elements. */
|
95
|
+
position?: Position;
|
96
|
+
}
|
97
|
+
interface SpacingStyleProps {
|
98
|
+
/** Apply inner spacing on all sides. */
|
99
|
+
spacing?: SpacingAlias;
|
100
|
+
/** Apply inner spacing on the leading and trailing sides. */
|
101
|
+
spacingHorizontal?: SpacingAlias;
|
102
|
+
/** Apply inner spacing on the top and bottom sides. */
|
103
|
+
spacingVertical?: SpacingAlias;
|
104
|
+
/** Apply inner spacing on the bottom side. */
|
105
|
+
spacingBottom?: SpacingAlias;
|
106
|
+
/** Apply inner spacing on the trailing side. */
|
107
|
+
spacingEnd?: SpacingAlias;
|
108
|
+
/** Apply inner spacing on the leading side. */
|
109
|
+
spacingStart?: SpacingAlias;
|
110
|
+
/** Apply inner spacing on the top side. */
|
111
|
+
spacingTop?: SpacingAlias;
|
112
|
+
/** Apply negative outer spacing on all sides. */
|
113
|
+
offset?: SpacingAlias;
|
114
|
+
/** Apply negative outer spacing on the top and bottom sides. */
|
115
|
+
offsetVertical?: SpacingAlias;
|
116
|
+
/** Apply negative outer spacing on the leading and trailing sides. */
|
117
|
+
offsetHorizontal?: SpacingAlias;
|
118
|
+
/** Apply negative outer spacing on the bottom side. */
|
119
|
+
offsetBottom?: SpacingAlias;
|
120
|
+
/** Apply negative outer spacing on the trailing side. */
|
121
|
+
offsetEnd?: SpacingAlias;
|
122
|
+
/** Apply negative outer spacing on the leading side. */
|
123
|
+
offsetStart?: SpacingAlias;
|
124
|
+
/** Apply negative outer spacing on the top side. */
|
125
|
+
offsetTop?: SpacingAlias;
|
126
|
+
/** Control the horizontal gutters between grid and flexbox items. */
|
127
|
+
columnGap?: SpacingAlias;
|
128
|
+
/** Control the vertical gutters between grid and flexbox items. */
|
129
|
+
rowGap?: SpacingAlias;
|
130
|
+
}
|
131
|
+
interface FlexStyleProps {
|
132
|
+
/** Sets the distribution of space between and around content items along a flexbox's cross-axis or a grid's block axis. */
|
133
|
+
alignContent?: FlexAlignContent;
|
134
|
+
/** Sets the align-self value on all direct children as a group. In Flexbox, it controls the alignment of items on the Cross Axis. In Grid Layout, it controls the alignment of items on the Block Axis within their grid area. */
|
135
|
+
alignItems?: FlexAlignItems;
|
136
|
+
/** Overrides a grid or flex item's align-items value. In Grid, it aligns the item inside the grid area. In Flexbox, it aligns the item on the cross axis. */
|
137
|
+
alignSelf?: FlexAlignSelf;
|
138
|
+
/** Sets how a flex item will grow or shrink to fit the space available in its flex container. */
|
139
|
+
flex?: Flex;
|
140
|
+
/** Sets how flex items are placed in the flex container defining the main axis and the direction (normal or reversed). */
|
141
|
+
flexDirection?: FlexDirection;
|
142
|
+
/** Sets the flex grow factor, which specifies how much of the flex container's remaining space should be assigned to the flex item's main size. */
|
143
|
+
flexGrow?: FlexGrow;
|
144
|
+
/** Sets the flex shrink factor of a flex item. If the size of all flex items is larger than the flex container, items shrink to fit according to flex-shrink. */
|
145
|
+
flexShrink?: FlexShrink;
|
146
|
+
/** Sets whether flex items are forced onto one line or can wrap onto multiple lines. If wrapping is allowed, it sets the direction that lines are stacked. */
|
147
|
+
flexWrap?: FlexWrap;
|
148
|
+
/** Defines how the browser distributes space between and around content items along the main-axis of a flex container, and the inline axis of a grid container. */
|
149
|
+
justifyContent?: FlexJustifyContent;
|
150
|
+
/** Sets the initial main size of a flex item. It sets the size of the content box unless otherwise set with box-sizing. https://developer.mozilla.org/en-US/docs/Web/CSS/flex-basis */
|
151
|
+
flexBasis?: FlexBasis;
|
152
|
+
}
|
153
|
+
interface TextStyleProps {
|
154
|
+
/** Color of a Text or Icon element */
|
155
|
+
color?: ForegroundColor;
|
156
|
+
/** Color of placeholder text */
|
157
|
+
placeholderColor?: ForegroundColor;
|
158
|
+
/** Font family for the text */
|
159
|
+
fontFamily?: TextVariant | FontAlias;
|
160
|
+
/** Font size of the text */
|
161
|
+
fontSize?: TextVariant;
|
162
|
+
/** Font weight of the text */
|
163
|
+
fontWeight?: TextVariant | FontWeightDescriptive;
|
164
|
+
/** Line height of the text */
|
165
|
+
lineHeight?: TextVariant;
|
166
|
+
/** Text alignment of the text */
|
167
|
+
textAlign?: 'center' | 'justify' | 'start' | 'end';
|
168
|
+
/** Sets the text transform for the text */
|
169
|
+
textTransform?: TextVariant | TextTransform;
|
170
|
+
}
|
171
|
+
interface BackgroundStyleProps {
|
172
|
+
/** Sets the background color. */
|
173
|
+
backgroundColor?: BackgroundColor;
|
174
|
+
}
|
175
|
+
interface UniversalBoxProps extends PropsWithChildren, BackgroundStyleProps, BorderStyleProps, FlexStyleProps, LayoutStyleProps, SpacingStyleProps {
|
176
|
+
/**
|
177
|
+
* When asChild is set to true, the component's child will be cloned and passed
|
178
|
+
* the props and behavior required to make it functional.
|
179
|
+
*/
|
180
|
+
asChild?: boolean;
|
181
|
+
}
|
182
|
+
interface UniversalStackProps extends Omit<UniversalBoxProps, 'flexDirection'> {
|
183
|
+
gap?: SpacingAlias;
|
184
|
+
}
|
185
|
+
interface UniversalTextProps extends PropsWithChildren, TextStyleProps, UniversalBoxProps {
|
186
|
+
/** Style of text. */
|
187
|
+
variant?: TextVariant;
|
188
|
+
/** Color of the text. */
|
189
|
+
color?: ForegroundColor;
|
190
|
+
}
|
191
|
+
interface UniversalIconProps {
|
192
|
+
/** Icon to render from the icons package. */
|
193
|
+
name: SvgIcon;
|
194
|
+
/** Size of the icon. */
|
195
|
+
size?: IconSize;
|
196
|
+
/** Variant for icon. Either fill or outline. */
|
197
|
+
variant?: IconVariant;
|
198
|
+
/** Color of the icon. */
|
199
|
+
color?: ForegroundColor;
|
200
|
+
}
|
201
|
+
interface UniversalImageProps extends Omit<UniversalBoxProps, 'width' | 'height'>, ImageStyleProps {
|
202
|
+
/** The source URL of the image. */
|
203
|
+
src: string;
|
204
|
+
/** Provides fallback (alternate) text to display when the image specified by the Image element is not loaded. */
|
205
|
+
alt?: string;
|
206
|
+
/** Width of the image in px. */
|
207
|
+
width?: number;
|
208
|
+
/** Height of the image in pixel. */
|
209
|
+
height?: number;
|
210
|
+
}
|
211
|
+
interface UniversalAvatarProps extends UniversalImageProps {
|
212
|
+
/** The size of the Avatar. */
|
213
|
+
size?: AvatarSize;
|
214
|
+
/** The shape of the Avatar. */
|
215
|
+
shape?: BorderRadius;
|
216
|
+
}
|
217
|
+
interface UniversalTextInputProps {
|
218
|
+
disabled?: boolean;
|
219
|
+
required?: boolean;
|
220
|
+
backgroundColor?: BackgroundColor;
|
221
|
+
borderColor?: LineColor;
|
222
|
+
borderWidth?: BorderWidth;
|
223
|
+
borderRadius?: BorderRadius;
|
224
|
+
color?: ForegroundColor;
|
225
|
+
fontSize?: TextVariant;
|
226
|
+
placeholderColor?: ForegroundColor;
|
227
|
+
spacingVertical?: SpacingAlias;
|
228
|
+
spacingHorizontal?: SpacingAlias;
|
229
|
+
}
|
230
|
+
|
231
|
+
type DivProps = React.HTMLAttributes<HTMLDivElement>;
|
232
|
+
interface BoxProps extends UniversalBoxProps, DivProps {
|
233
|
+
}
|
234
|
+
|
235
|
+
type TextElementTagName = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'p' | 'strong' | 'span' | 'label' | 'li';
|
236
|
+
type TextProps<TagName extends TextElementTagName = TextElementTagName> = {
|
237
|
+
/** Ref passed to the inner container. */
|
238
|
+
ref?: Ref<HTMLElement>;
|
239
|
+
/** Changes the HTML tag used to render text. Uses the most appropriate semantic tag based on the text style variant. */
|
240
|
+
as?: TagName;
|
241
|
+
} & JSX.IntrinsicElements[TagName] & UniversalTextProps;
|
242
|
+
|
243
|
+
export type { BoxProps as B, DivProps as D, Overflow as O, TextProps as T, UniversalAvatarProps as U, UniversalTextProps as a, UniversalIconProps as b, UniversalStackProps as c, UniversalTextInputProps as d };
|
@@ -0,0 +1,243 @@
|
|
1
|
+
import { PropsWithChildren, Ref } from 'react';
|
2
|
+
import { SvgIcon, IconSize, IconVariant } from '@yahoo/uds-icons/types';
|
3
|
+
|
4
|
+
declare const alwaysPalette: {
|
5
|
+
white: string;
|
6
|
+
black: string;
|
7
|
+
transparent: string;
|
8
|
+
current: string;
|
9
|
+
};
|
10
|
+
|
11
|
+
type CorePaletteAlias = 'brand' | 'accent' | 'alert' | 'positive' | 'warning';
|
12
|
+
type BackgroundPaletteAlias = 'primary' | 'secondary';
|
13
|
+
type ForegroundPaletteAlias = 'primary' | 'secondary' | 'tertiary' | 'muted' | 'on-color';
|
14
|
+
type LinePaletteAlias = 'primary' | 'secondary' | 'tertiary' | 'muted';
|
15
|
+
type AlwaysPalette = typeof alwaysPalette;
|
16
|
+
type AlwaysPaletteAlias = keyof AlwaysPalette;
|
17
|
+
type ForegroundColor = CorePaletteAlias | ForegroundPaletteAlias | AlwaysPaletteAlias;
|
18
|
+
type LineColor = CorePaletteAlias | LinePaletteAlias | AlwaysPaletteAlias;
|
19
|
+
type BackgroundColor = CorePaletteAlias | BackgroundPaletteAlias | AlwaysPaletteAlias;
|
20
|
+
type TextVariant = 'display1' | 'display2' | 'display3' | 'title1' | 'title2' | 'title3' | 'title4' | 'headline1' | 'body1' | 'label1' | 'label2' | 'caption1' | 'caption2' | 'legal1';
|
21
|
+
type FontAlias = 'sans' | 'sans-alt' | 'serif' | 'serif-alt' | 'mono';
|
22
|
+
type FontWeightDescriptive = 'thin' | 'extralight' | 'light' | 'regular' | 'medium' | 'semibold' | 'bold' | 'extrabold' | 'black';
|
23
|
+
type TextTransform = 'none' | 'uppercase' | 'lowercase' | 'capitalize';
|
24
|
+
type TShirtSize = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
25
|
+
type TShirtSizeCommon = Extract<TShirtSize, 'sm' | 'md' | 'lg'>;
|
26
|
+
type AvatarSize = TShirtSizeCommon;
|
27
|
+
type SpacingAlias = '0' | 'px' | '0.5' | '1' | '1.5' | '2' | '2.5' | '3' | '3.5' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12' | '14' | '16' | '20' | '24' | '28' | '32' | '36' | '40' | '44' | '48' | '52' | '56' | '60' | '64' | '72' | '80' | '96';
|
28
|
+
type BorderRadius = TShirtSize;
|
29
|
+
type BorderWidth = 'none' | 'thin' | 'medium' | 'thick';
|
30
|
+
type Flex = '1' | 'auto' | 'initial' | 'none';
|
31
|
+
type FlexGrow = '0' | '1' | '2' | '3';
|
32
|
+
type FlexShrink = '0' | '1';
|
33
|
+
type FlexAlignContent = 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'space-between' | 'space-around';
|
34
|
+
type FlexAlignItems = 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline';
|
35
|
+
type FlexAlignSelf = 'auto' | 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline';
|
36
|
+
type FlexDirection = 'row' | 'column' | 'row-reverse' | 'column-reverse';
|
37
|
+
type FlexWrap = 'wrap' | 'nowrap' | 'wrap-reverse';
|
38
|
+
type FlexJustifyContent = 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly';
|
39
|
+
type FlexBasis = 'min-content';
|
40
|
+
type Display = 'block' | 'inline-block' | 'inline' | 'flex' | 'inline-flex' | 'table' | 'inline-table' | 'table-caption' | 'table-cell' | 'table-column' | 'table-column-group' | 'table-footer-group' | 'table-header-group' | 'table-row-group' | 'table-row' | 'flow-root' | 'grid' | 'contents';
|
41
|
+
type Overflow = 'auto' | 'hidden' | 'clip' | 'visible' | 'scroll';
|
42
|
+
type Position = 'static' | 'fixed' | 'absolute' | 'relative' | 'sticky';
|
43
|
+
type ImageStyleProps = {
|
44
|
+
/**
|
45
|
+
* Determines how the image should be resized to fit its container.
|
46
|
+
*/
|
47
|
+
contentFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
48
|
+
};
|
49
|
+
interface BorderStyleProps {
|
50
|
+
/** Add a border radius to all corners of the box. */
|
51
|
+
borderRadius?: BorderRadius;
|
52
|
+
/** Add a border radius to top left corner of the box. */
|
53
|
+
borderTopStartRadius?: BorderRadius;
|
54
|
+
/** Add a border radius to top right corner of the box. */
|
55
|
+
borderTopEndRadius?: BorderRadius;
|
56
|
+
/** Add a border radius to bottom left corner of the box. */
|
57
|
+
borderBottomStartRadius?: BorderRadius;
|
58
|
+
/** Add a border radius to bottom right corner of the box. */
|
59
|
+
borderBottomEndRadius?: BorderRadius;
|
60
|
+
/** Adds a custom border color from the palette */
|
61
|
+
borderColor?: LineColor;
|
62
|
+
/** Start border color */
|
63
|
+
borderStartColor?: LineColor;
|
64
|
+
/** End border color */
|
65
|
+
borderEndColor?: LineColor;
|
66
|
+
/** Top border color */
|
67
|
+
borderTopColor?: LineColor;
|
68
|
+
/** Bottom border color */
|
69
|
+
borderBottomColor?: LineColor;
|
70
|
+
/** Shorthand property to the width of an element's border. */
|
71
|
+
borderWidth?: BorderWidth;
|
72
|
+
/** Sets the width of the top and bottom border of an element. */
|
73
|
+
borderVerticalWidth?: BorderWidth;
|
74
|
+
/** Sets the width of the start (left) and end (right) border of an element. */
|
75
|
+
borderHorizontalWidth?: BorderWidth;
|
76
|
+
/** Sets the width of the start (left) border of an element. */
|
77
|
+
borderStartWidth?: BorderWidth;
|
78
|
+
/** Sets the width of the end (right) border of an element. */
|
79
|
+
borderEndWidth?: BorderWidth;
|
80
|
+
/** Sets the width of the top border of an element. */
|
81
|
+
borderTopWidth?: BorderWidth;
|
82
|
+
/** Sets the width of the bottom border of an element. */
|
83
|
+
borderBottomWidth?: BorderWidth;
|
84
|
+
}
|
85
|
+
interface LayoutStyleProps {
|
86
|
+
/** Sets whether an element is treated as a block or inline box and the layout used for its children, such as flow layout, grid or flex. */
|
87
|
+
display?: Display;
|
88
|
+
/** Shorthand property which sets the desired behavior when content does not fit in the parent element box (overflows) in the horizontal and/or vertical direction. */
|
89
|
+
overflow?: Overflow;
|
90
|
+
/** Sets what shows when content overflows a block-level element's left and right edges. This may be nothing, a scroll bar, or the overflow content. This property may also be set by using the overflow shorthand property. */
|
91
|
+
overflowX?: Overflow;
|
92
|
+
/** sets what shows when content overflows a block-level element's top and bottom edges. This may be nothing, a scroll bar, or the overflow content. This property may also be set by using the overflow shorthand property. */
|
93
|
+
overflowY?: Overflow;
|
94
|
+
/** Sets how an element is positioned in a document. The top, right, bottom, and left properties determine the final location of positioned elements. */
|
95
|
+
position?: Position;
|
96
|
+
}
|
97
|
+
interface SpacingStyleProps {
|
98
|
+
/** Apply inner spacing on all sides. */
|
99
|
+
spacing?: SpacingAlias;
|
100
|
+
/** Apply inner spacing on the leading and trailing sides. */
|
101
|
+
spacingHorizontal?: SpacingAlias;
|
102
|
+
/** Apply inner spacing on the top and bottom sides. */
|
103
|
+
spacingVertical?: SpacingAlias;
|
104
|
+
/** Apply inner spacing on the bottom side. */
|
105
|
+
spacingBottom?: SpacingAlias;
|
106
|
+
/** Apply inner spacing on the trailing side. */
|
107
|
+
spacingEnd?: SpacingAlias;
|
108
|
+
/** Apply inner spacing on the leading side. */
|
109
|
+
spacingStart?: SpacingAlias;
|
110
|
+
/** Apply inner spacing on the top side. */
|
111
|
+
spacingTop?: SpacingAlias;
|
112
|
+
/** Apply negative outer spacing on all sides. */
|
113
|
+
offset?: SpacingAlias;
|
114
|
+
/** Apply negative outer spacing on the top and bottom sides. */
|
115
|
+
offsetVertical?: SpacingAlias;
|
116
|
+
/** Apply negative outer spacing on the leading and trailing sides. */
|
117
|
+
offsetHorizontal?: SpacingAlias;
|
118
|
+
/** Apply negative outer spacing on the bottom side. */
|
119
|
+
offsetBottom?: SpacingAlias;
|
120
|
+
/** Apply negative outer spacing on the trailing side. */
|
121
|
+
offsetEnd?: SpacingAlias;
|
122
|
+
/** Apply negative outer spacing on the leading side. */
|
123
|
+
offsetStart?: SpacingAlias;
|
124
|
+
/** Apply negative outer spacing on the top side. */
|
125
|
+
offsetTop?: SpacingAlias;
|
126
|
+
/** Control the horizontal gutters between grid and flexbox items. */
|
127
|
+
columnGap?: SpacingAlias;
|
128
|
+
/** Control the vertical gutters between grid and flexbox items. */
|
129
|
+
rowGap?: SpacingAlias;
|
130
|
+
}
|
131
|
+
interface FlexStyleProps {
|
132
|
+
/** Sets the distribution of space between and around content items along a flexbox's cross-axis or a grid's block axis. */
|
133
|
+
alignContent?: FlexAlignContent;
|
134
|
+
/** Sets the align-self value on all direct children as a group. In Flexbox, it controls the alignment of items on the Cross Axis. In Grid Layout, it controls the alignment of items on the Block Axis within their grid area. */
|
135
|
+
alignItems?: FlexAlignItems;
|
136
|
+
/** Overrides a grid or flex item's align-items value. In Grid, it aligns the item inside the grid area. In Flexbox, it aligns the item on the cross axis. */
|
137
|
+
alignSelf?: FlexAlignSelf;
|
138
|
+
/** Sets how a flex item will grow or shrink to fit the space available in its flex container. */
|
139
|
+
flex?: Flex;
|
140
|
+
/** Sets how flex items are placed in the flex container defining the main axis and the direction (normal or reversed). */
|
141
|
+
flexDirection?: FlexDirection;
|
142
|
+
/** Sets the flex grow factor, which specifies how much of the flex container's remaining space should be assigned to the flex item's main size. */
|
143
|
+
flexGrow?: FlexGrow;
|
144
|
+
/** Sets the flex shrink factor of a flex item. If the size of all flex items is larger than the flex container, items shrink to fit according to flex-shrink. */
|
145
|
+
flexShrink?: FlexShrink;
|
146
|
+
/** Sets whether flex items are forced onto one line or can wrap onto multiple lines. If wrapping is allowed, it sets the direction that lines are stacked. */
|
147
|
+
flexWrap?: FlexWrap;
|
148
|
+
/** Defines how the browser distributes space between and around content items along the main-axis of a flex container, and the inline axis of a grid container. */
|
149
|
+
justifyContent?: FlexJustifyContent;
|
150
|
+
/** Sets the initial main size of a flex item. It sets the size of the content box unless otherwise set with box-sizing. https://developer.mozilla.org/en-US/docs/Web/CSS/flex-basis */
|
151
|
+
flexBasis?: FlexBasis;
|
152
|
+
}
|
153
|
+
interface TextStyleProps {
|
154
|
+
/** Color of a Text or Icon element */
|
155
|
+
color?: ForegroundColor;
|
156
|
+
/** Color of placeholder text */
|
157
|
+
placeholderColor?: ForegroundColor;
|
158
|
+
/** Font family for the text */
|
159
|
+
fontFamily?: TextVariant | FontAlias;
|
160
|
+
/** Font size of the text */
|
161
|
+
fontSize?: TextVariant;
|
162
|
+
/** Font weight of the text */
|
163
|
+
fontWeight?: TextVariant | FontWeightDescriptive;
|
164
|
+
/** Line height of the text */
|
165
|
+
lineHeight?: TextVariant;
|
166
|
+
/** Text alignment of the text */
|
167
|
+
textAlign?: 'center' | 'justify' | 'start' | 'end';
|
168
|
+
/** Sets the text transform for the text */
|
169
|
+
textTransform?: TextVariant | TextTransform;
|
170
|
+
}
|
171
|
+
interface BackgroundStyleProps {
|
172
|
+
/** Sets the background color. */
|
173
|
+
backgroundColor?: BackgroundColor;
|
174
|
+
}
|
175
|
+
interface UniversalBoxProps extends PropsWithChildren, BackgroundStyleProps, BorderStyleProps, FlexStyleProps, LayoutStyleProps, SpacingStyleProps {
|
176
|
+
/**
|
177
|
+
* When asChild is set to true, the component's child will be cloned and passed
|
178
|
+
* the props and behavior required to make it functional.
|
179
|
+
*/
|
180
|
+
asChild?: boolean;
|
181
|
+
}
|
182
|
+
interface UniversalStackProps extends Omit<UniversalBoxProps, 'flexDirection'> {
|
183
|
+
gap?: SpacingAlias;
|
184
|
+
}
|
185
|
+
interface UniversalTextProps extends PropsWithChildren, TextStyleProps, UniversalBoxProps {
|
186
|
+
/** Style of text. */
|
187
|
+
variant?: TextVariant;
|
188
|
+
/** Color of the text. */
|
189
|
+
color?: ForegroundColor;
|
190
|
+
}
|
191
|
+
interface UniversalIconProps {
|
192
|
+
/** Icon to render from the icons package. */
|
193
|
+
name: SvgIcon;
|
194
|
+
/** Size of the icon. */
|
195
|
+
size?: IconSize;
|
196
|
+
/** Variant for icon. Either fill or outline. */
|
197
|
+
variant?: IconVariant;
|
198
|
+
/** Color of the icon. */
|
199
|
+
color?: ForegroundColor;
|
200
|
+
}
|
201
|
+
interface UniversalImageProps extends Omit<UniversalBoxProps, 'width' | 'height'>, ImageStyleProps {
|
202
|
+
/** The source URL of the image. */
|
203
|
+
src: string;
|
204
|
+
/** Provides fallback (alternate) text to display when the image specified by the Image element is not loaded. */
|
205
|
+
alt?: string;
|
206
|
+
/** Width of the image in px. */
|
207
|
+
width?: number;
|
208
|
+
/** Height of the image in pixel. */
|
209
|
+
height?: number;
|
210
|
+
}
|
211
|
+
interface UniversalAvatarProps extends UniversalImageProps {
|
212
|
+
/** The size of the Avatar. */
|
213
|
+
size?: AvatarSize;
|
214
|
+
/** The shape of the Avatar. */
|
215
|
+
shape?: BorderRadius;
|
216
|
+
}
|
217
|
+
interface UniversalTextInputProps {
|
218
|
+
disabled?: boolean;
|
219
|
+
required?: boolean;
|
220
|
+
backgroundColor?: BackgroundColor;
|
221
|
+
borderColor?: LineColor;
|
222
|
+
borderWidth?: BorderWidth;
|
223
|
+
borderRadius?: BorderRadius;
|
224
|
+
color?: ForegroundColor;
|
225
|
+
fontSize?: TextVariant;
|
226
|
+
placeholderColor?: ForegroundColor;
|
227
|
+
spacingVertical?: SpacingAlias;
|
228
|
+
spacingHorizontal?: SpacingAlias;
|
229
|
+
}
|
230
|
+
|
231
|
+
type DivProps = React.HTMLAttributes<HTMLDivElement>;
|
232
|
+
interface BoxProps extends UniversalBoxProps, DivProps {
|
233
|
+
}
|
234
|
+
|
235
|
+
type TextElementTagName = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'p' | 'strong' | 'span' | 'label' | 'li';
|
236
|
+
type TextProps<TagName extends TextElementTagName = TextElementTagName> = {
|
237
|
+
/** Ref passed to the inner container. */
|
238
|
+
ref?: Ref<HTMLElement>;
|
239
|
+
/** Changes the HTML tag used to render text. Uses the most appropriate semantic tag based on the text style variant. */
|
240
|
+
as?: TagName;
|
241
|
+
} & JSX.IntrinsicElements[TagName] & UniversalTextProps;
|
242
|
+
|
243
|
+
export type { BoxProps as B, DivProps as D, Overflow as O, TextProps as T, UniversalAvatarProps as U, UniversalTextProps as a, UniversalIconProps as b, UniversalStackProps as c, UniversalTextInputProps as d };
|
package/dist/client/index.cjs
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
"use client";
|
2
|
-
"use strict";var e=require("../chunk-JGIKFUBH.cjs"),t=require("../chunk-YUHY3FXT.cjs"),
|
3
|
-
/*! © 2025 Yahoo, Inc. UDS v0.0.0-development */exports.Button=
|
2
|
+
"use strict";var e=require("../chunk-JGIKFUBH.cjs"),t=require("../chunk-YUHY3FXT.cjs"),o=require("../chunk-DMMTEAJW.cjs"),n=require("../chunk-5WBROFT5.cjs"),r=require("@yahoo/uds/fixtures"),i=require("react/jsx-runtime"),a=require("framer-motion"),s=require("react"),c={scale:.7,opacity:0},l={scale:[.7,.7,1],opacity:[0,0,1],transition:{times:[0,.5,1]}},d={icon:l,hide:c,loading:c},u={loading:l,hide:c,icon:c},m=`var(${n.BUTTON_CSS_VAR_MAP.columnGap})`,p=`var(${n.BUTTON_CSS_VAR_MAP.iconSize})`,h={rest:{scale:`var(${n.BUTTON_CSS_VAR_MAP.effects.scale.rest})`},hover:{scale:`var(${n.BUTTON_CSS_VAR_MAP.effects.scale.hover})`},pressed:{scale:`var(${n.BUTTON_CSS_VAR_MAP.effects.scale.pressed})`},withoutIcon:{columnGap:"0px"},withIcon:{columnGap:m}},f={hide:{width:"0px",opacity:0,display:"none"},loading:{width:p,display:"flex",opacity:1},icon:{width:p,display:"flex",opacity:1}},g=({size:e,variant:t})=>{if("outline"===t)switch(e){case"sm":return i.jsx(i.Fragment,{children:i.jsx("path",{fill:"currentColor",d:"M7.9 2.7a5.2 5.2 0 1 0 5.2 5.2h1.6a6.8 6.8 0 1 1-6.8-6.8.8.8 0 1 1 0 1.6"})});case"md":return i.jsx(i.Fragment,{children:i.jsx("path",{fill:"currentColor",d:"M12 4a8 8 0 1 0 8 8h2c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2a1 1 0 1 1 0 2"})});case"lg":return i.jsx(i.Fragment,{children:i.jsx("path",{fill:"currentColor",d:"M16.15 4.3C9.605 4.3 4.3 9.605 4.3 16.15S9.605 28 16.15 28 28 22.695 28 16.15h2.3c0 7.815-6.335 14.15-14.15 14.15S2 23.965 2 16.15 8.335 2 16.15 2a1.15 1.15 0 0 1 0 2.3"})})}if("fill"===t)switch(e){case"sm":return i.jsx(i.Fragment,{children:i.jsx("path",{fill:"currentColor",d:"M8 2.9A5.1 5.1 0 1 0 13.1 8h1.8A6.9 6.9 0 1 1 8 1.1a.9.9 0 1 1 0 1.8"})});case"md":return i.jsx(i.Fragment,{children:i.jsx("path",{fill:"currentColor",d:"M12.15 4.3A7.85 7.85 0 1 0 20 12.15h2.3c0 5.606-4.544 10.15-10.15 10.15S2 17.756 2 12.15 6.544 2 12.15 2a1.15 1.15 0 0 1 0 2.3"})});case"lg":return i.jsx(i.Fragment,{children:i.jsx("path",{fill:"currentColor",d:"M16.35 4.7C9.916 4.7 4.7 9.916 4.7 16.35S9.916 28 16.35 28 28 22.784 28 16.35h2.7c0 7.925-6.425 14.35-14.35 14.35S2 24.275 2 16.35 8.425 2 16.35 2a1.35 1.35 0 1 1 0 2.7"})})}return i.jsx(i.Fragment,{})},b=()=>import("../motionFeatures-P3FQL2KP.cjs").then((({domAnimation:e})=>e));/*! © 2025 Yahoo, Inc. UDS v0.0.0-development */function x({reducedMotion:e="user",children:n,layoutVariant:r="subtle",layoutSpeed:c="3",colorVariant:l="smooth",colorSpeed:d="3"}){const u=o.motion[r][c],m=o.motion[l][d],[p,h]=s.useState(u),[f,g]=s.useState(m),x={variant:l,speed:d},S=t.getMotionVar({...x,control:"stiffness"}),v=t.getMotionVar({...x,control:"damping"}),j={variant:r,speed:c},C=t.getMotionVar({...j,control:"stiffness"}),y=t.getMotionVar({...j,control:"damping"});s.useEffect((()=>{const e=getComputedStyle(document.documentElement),t={damping:Number(e.getPropertyValue(y)),stiffness:Number(e.getPropertyValue(C))},o={damping:Number(e.getPropertyValue(v)),stiffness:Number(e.getPropertyValue(S))};h(t),g(o)}),[v,S,y,C]);const w=s.useMemo((()=>({type:"spring",mass:1,...p,layout:p,opacity:f,color:f,borderColor:f,backgroundColor:f})),[f,p]);return i.jsx(a.LazyMotion,{features:b,strict:!0,children:i.jsx(a.MotionConfig,{transition:w,reducedMotion:e,children:n})})}var S=e.createSlot(),v=a.m.create(S),j=s.forwardRef((function({palette:t,variant:o,size:n,startIcon:c,endIcon:l,iconVariant:m,loading:p,disableEffects:b,children:S,asChild:j,className:C,...y},w){const M=s.useRef(null);s.useImperativeHandle(w,(()=>M.current));const I=l?"icon":"hide",V=(({startIcon:e,endIcon:t,loading:o})=>e||t||o?"withIcon":"withoutIcon")({startIcon:c,endIcon:l,loading:p}),N=(({loading:e,startIcon:t})=>e?"loading":t?"icon":"hide")({loading:p,startIcon:c}),T={button:e.getStyles({buttonSize:n,buttonVariant:o,buttonPalette:t,className:e.cx("uds-button","uds-ring","uds-hit-target",p&&"uds-button-loading",b&&"uds-button-without-effects","withIcon"===V&&"uds-button-with-gap",C)}),content:"uds-button-content truncate",iconContainer:"uds-button-icon-container flex overflow-clip",loading:"uds-button-icon start-content animate-spin",start:"uds-button-icon start-content",end:"uds-button-icon end-content"},B=a.useReducedMotion()?"smooth":"subtle",z=s.useMemo((()=>i.jsx(a.m.span,{className:T.iconContainer,initial:!1,variants:f,animate:N,children:i.jsxs(a.AnimatePresence,{initial:!1,mode:"popLayout",children:[p&&i.jsx(a.m.span,{variants:u,initial:"hide",animate:"loading",exit:"hide",children:i.jsx(e.Icon,{size:r.buttonIconSvgSize,name:g,variant:m,color:"current",className:T.loading})},"loading"),c&&!p&&i.jsx(a.m.span,{variants:d,initial:"hide",animate:"icon",exit:"hide",children:i.jsx(e.Icon,{size:r.buttonIconSvgSize,name:c,variant:m,color:"current",className:T.start})},c.name)]})})),[T.iconContainer,T.loading,T.start,N,p,m,c]),R=s.useMemo((()=>i.jsx(a.m.span,{className:T.iconContainer,initial:!1,variants:f,animate:I,children:i.jsx(a.AnimatePresence,{initial:!1,mode:"popLayout",children:l&&i.jsx(a.m.span,{variants:d,initial:"hide",animate:"icon",exit:"hide",children:i.jsx(e.Icon,{size:r.buttonIconSvgSize,name:l,variant:m,color:"current",className:T.start})},l.name)})})),[T.iconContainer,T.start,l,I,m]),E=s.useMemo((()=>b?{...h,rest:{},hover:{},pressed:{}}:h),[b]);return j&&s.isValidElement(S)?i.jsx(x,{layoutSpeed:"3",layoutVariant:B,children:i.jsx(v,{className:T.button,initial:["hide",V],animate:V,variants:E,whileHover:"hover",whileTap:"pressed",...y,children:s.cloneElement(S,S.props,i.jsxs(i.Fragment,{children:[z,i.jsx("span",{className:T.content,children:S.props.children}),R]}))})}):i.jsx(x,{layoutSpeed:"3",layoutVariant:B,children:i.jsxs(a.m.button,{ref:M,className:T.button,initial:["hide",V],animate:V,variants:E,whileHover:"hover",whileTap:"pressed",...y,children:[z,i.jsx("span",{className:T.content,children:S}),R]})})})),C=s.forwardRef((function({palette:t,variant:o,size:n,iconVariant:c,loading:l,disableEffects:m,name:p,className:f,children:b,...S},v){const j=s.useRef(null);s.useImperativeHandle(v,(()=>j.current));const C=s.useMemo((()=>({button:e.getStyles({buttonVariant:o,buttonPalette:t,iconButtonSize:n,className:e.cx("uds-icon-button","uds-button","uds-ring","uds-hit-target",l&&"uds-button-loading",m&&"uds-button-without-effects",f)}),loading:"uds-button-icon start-content animate-spin",icon:"uds-button-icon start-content"})),[t,o,f,m,n,l]),y=a.useReducedMotion(),w=s.useMemo((()=>y?"smooth":"subtle"),[y]),M=s.useMemo((()=>{const{rest:e,hover:t,pressed:o}=h;return m?{rest:{},hover:{},pressed:{}}:{rest:e,hover:t,pressed:o}}),[m]);return i.jsx(x,{layoutSpeed:"3",layoutVariant:w,reducedMotion:m?"always":"user",children:i.jsx(a.m.button,{ref:j,className:C.button,initial:"icon",variants:M,whileHover:"hover",whileTap:"pressed",...S,children:i.jsxs(a.AnimatePresence,{initial:!1,mode:"popLayout",children:[l&&i.jsx(a.m.span,{variants:u,initial:"loading",animate:"loading",exit:"hide",children:i.jsx(e.Icon,{size:r.buttonIconSvgSize,name:g,variant:c,color:"current",className:C.loading})},"loading"),p&&!l&&i.jsx(a.m.span,{variants:d,initial:"icon",animate:"icon",exit:"hide",children:b||i.jsx(e.Icon,{size:r.buttonIconSvgSize,name:p,variant:c,color:"current",className:C.icon})},p.name)]})})})})),y=e.createSlot(),w=s.forwardRef((function({className:t,asChild:o,onPress:n,onClick:r=n,backgroundColor:a,borderRadius:s,borderTopStartRadius:c,borderTopEndRadius:l,borderBottomStartRadius:d,borderBottomEndRadius:u,borderColor:m,borderStartColor:p,borderEndColor:h,borderTopColor:f,borderBottomColor:g,borderWidth:b,borderVerticalWidth:x,borderHorizontalWidth:S,borderStartWidth:v,borderEndWidth:j,borderTopWidth:C,borderBottomWidth:w,alignContent:M,alignItems:I,alignSelf:V,flex:N,flexDirection:T,flexGrow:B,flexShrink:z,flexWrap:R,justifyContent:E,flexBasis:A,display:P,overflow:W,overflowX:_,overflowY:F,position:H,spacing:k,spacingHorizontal:G,spacingVertical:q,spacingBottom:U,spacingEnd:O,spacingStart:L,spacingTop:$,offset:Y,offsetVertical:D,offsetHorizontal:X,offsetBottom:J,offsetEnd:K,offsetStart:Q,offsetTop:Z,columnGap:ee,rowGap:te,...oe},ne){const re=e.getStyles({backgroundColor:a,borderRadius:s,borderTopStartRadius:c,borderTopEndRadius:l,borderBottomStartRadius:d,borderBottomEndRadius:u,borderColor:m,borderStartColor:p,borderEndColor:h,borderTopColor:f,borderBottomColor:g,borderWidth:b,borderVerticalWidth:x,borderHorizontalWidth:S,borderStartWidth:v,borderEndWidth:j,borderTopWidth:C,borderBottomWidth:w,alignContent:M,alignItems:I,alignSelf:V,flex:N,flexDirection:T,flexGrow:B,flexShrink:z,flexWrap:R,justifyContent:E,flexBasis:A,display:P,overflow:W,overflowX:_,overflowY:F,position:H,spacing:k,spacingHorizontal:G,spacingVertical:q,spacingBottom:U,spacingEnd:O,spacingStart:L,spacingTop:$,offset:Y,offsetVertical:D,offsetHorizontal:X,offsetBottom:J,offsetEnd:K,offsetStart:Q,offsetTop:Z,columnGap:ee,rowGap:te,className:t}),ie=o?y:"button";return i.jsx(ie,{className:re,ref:ne,onClick:r,...oe})}));
|
3
|
+
/*! © 2025 Yahoo, Inc. UDS v0.0.0-development */exports.Button=j,exports.IconButton=C,exports.Pressable=w,exports.SpringMotionConfig=x;
|
package/dist/client/index.d.cts
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
import { e as UniversalButtonProps, f as UniversalIconButtonProps, M as MotionVariant,
|
1
|
+
import { e as UniversalButtonProps, f as UniversalIconButtonProps, g as UniversalPressableProps, M as MotionVariant, h as MotionVariantSpeed } from '../types-DsMvZpWN.cjs';
|
2
2
|
import { HTMLMotionProps, MotionConfigProps } from 'framer-motion';
|
3
3
|
import * as react from 'react';
|
4
4
|
import react__default from 'react';
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
6
6
|
import '@yahoo/uds-icons/types';
|
7
7
|
|
8
|
-
type HtmlButtonProps$
|
9
|
-
interface ButtonProps extends HtmlButtonProps$
|
8
|
+
type HtmlButtonProps$2 = Omit<HTMLMotionProps<'button'>, 'color' | 'name'> & Omit<react__default.ButtonHTMLAttributes<HTMLButtonElement>, 'color'>;
|
9
|
+
interface ButtonProps extends HtmlButtonProps$2, UniversalButtonProps {
|
10
10
|
}
|
11
11
|
/**
|
12
12
|
* **🖲️ A button element that can be used to trigger an action**
|
@@ -42,8 +42,8 @@ interface ButtonProps extends HtmlButtonProps$1, UniversalButtonProps {
|
|
42
42
|
**/
|
43
43
|
declare const Button: react__default.ForwardRefExoticComponent<ButtonProps & react__default.RefAttributes<HTMLButtonElement>>;
|
44
44
|
|
45
|
-
type HtmlButtonProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'color' | 'name'> & Omit<HTMLMotionProps<'button'>, 'name'>;
|
46
|
-
interface IconButtonProps extends HtmlButtonProps, UniversalIconButtonProps {
|
45
|
+
type HtmlButtonProps$1 = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'color' | 'name'> & Omit<HTMLMotionProps<'button'>, 'name'>;
|
46
|
+
interface IconButtonProps extends HtmlButtonProps$1, UniversalIconButtonProps {
|
47
47
|
}
|
48
48
|
/**
|
49
49
|
* **⚙️️ An icon button element that can be used to trigger an action**
|
@@ -77,6 +77,46 @@ interface IconButtonProps extends HtmlButtonProps, UniversalIconButtonProps {
|
|
77
77
|
**/
|
78
78
|
declare const IconButton: react.ForwardRefExoticComponent<IconButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
79
79
|
|
80
|
+
type HtmlButtonProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'color' | 'name'>;
|
81
|
+
interface PressableProps extends UniversalPressableProps, HtmlButtonProps {
|
82
|
+
}
|
83
|
+
/**
|
84
|
+
* **🖲️ A primitive component for creating button interactions with accessibility support**
|
85
|
+
*
|
86
|
+
* @type Client component
|
87
|
+
*
|
88
|
+
* @description
|
89
|
+
* The Pressable component is a primitive component that can be used
|
90
|
+
* to create button interactions with accessibility support. It can be used
|
91
|
+
* to trigger an action, such as submitting a form, navigating to a new page,
|
92
|
+
* or adding interactivity to a section or card.
|
93
|
+
*
|
94
|
+
* @example
|
95
|
+
* ```tsx
|
96
|
+
* import { Pressable } from '@yahoo/uds';
|
97
|
+
*
|
98
|
+
* <Pressable
|
99
|
+
* backgroundColor="secondary"
|
100
|
+
* borderWidth="thin"
|
101
|
+
* borderColor="primary"
|
102
|
+
* borderRadius="lg"
|
103
|
+
* onPress={() => console.log('Pressed!')}
|
104
|
+
* >
|
105
|
+
* <Text variant="body1" color="primary" spacingHorizontal="7" spacingVertical="5">Click me...</Text>
|
106
|
+
* </Pressable>
|
107
|
+
* ```
|
108
|
+
*
|
109
|
+
* @usage
|
110
|
+
* - If you need to add interactivity to a section or card.
|
111
|
+
* - If you need a highly customized version of [Button](./button)
|
112
|
+
*
|
113
|
+
* @see The {@link https://uds.build/docs/components/pressable Pressable Docs} for more info
|
114
|
+
*
|
115
|
+
* @related [Button](https://uds.build/docs/components/button), [IconButton](https://uds.build/docs/components/icon-button)
|
116
|
+
*
|
117
|
+
*/
|
118
|
+
declare const Pressable: react.ForwardRefExoticComponent<PressableProps & react.RefAttributes<HTMLButtonElement>>;
|
119
|
+
|
80
120
|
interface SpringMotionConfigProps extends Pick<MotionConfigProps, 'children' | 'reducedMotion'> {
|
81
121
|
layoutVariant?: MotionVariant;
|
82
122
|
layoutSpeed?: MotionVariantSpeed;
|
@@ -94,4 +134,4 @@ interface SpringMotionConfigProps extends Pick<MotionConfigProps, 'children' | '
|
|
94
134
|
*/
|
95
135
|
declare function SpringMotionConfig({ reducedMotion, children, layoutVariant, layoutSpeed, colorVariant, colorSpeed, }: SpringMotionConfigProps): react_jsx_runtime.JSX.Element;
|
96
136
|
|
97
|
-
export { Button, type ButtonProps, IconButton, type IconButtonProps, SpringMotionConfig, type SpringMotionConfigProps };
|
137
|
+
export { Button, type ButtonProps, IconButton, type IconButtonProps, Pressable, type PressableProps, SpringMotionConfig, type SpringMotionConfigProps };
|