@yahoo/uds 3.159.1 → 3.160.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/dist/automated-config/dist/properties.cjs +1 -1
  2. package/dist/automated-config/dist/properties.js +1 -1
  3. package/dist/components/Text.cjs +4 -2
  4. package/dist/components/Text.js +4 -2
  5. package/dist/components/client/Button/Button.cjs +213 -0
  6. package/dist/components/client/Button/Button.d.cts +50 -0
  7. package/dist/components/client/Button/Button.d.ts +51 -0
  8. package/dist/components/client/Button/Button.js +208 -0
  9. package/dist/components/client/Button/ButtonBase.cjs +120 -0
  10. package/dist/components/client/Button/ButtonBase.d.cts +52 -0
  11. package/dist/components/client/Button/ButtonBase.d.ts +53 -0
  12. package/dist/components/client/Button/ButtonBase.js +116 -0
  13. package/dist/components/client/{buttonConstants.cjs → Button/buttonConstants.cjs} +1 -1
  14. package/dist/components/client/Button/buttonConstants.d.cts +7 -0
  15. package/dist/components/client/Button/buttonConstants.d.ts +8 -0
  16. package/dist/components/client/{buttonConstants.js → Button/buttonConstants.js} +1 -1
  17. package/dist/components/client/Button/index.cjs +10 -0
  18. package/dist/components/client/Button/index.d.cts +4 -0
  19. package/dist/components/client/Button/index.d.ts +5 -0
  20. package/dist/components/client/Button/index.js +5 -0
  21. package/dist/components/client/IconButton/IconButton.cjs +104 -0
  22. package/dist/components/client/IconButton/IconButton.d.cts +17 -0
  23. package/dist/components/client/IconButton/IconButton.d.ts +18 -0
  24. package/dist/components/client/IconButton/IconButton.js +102 -0
  25. package/dist/components/client/IconButton/IconButtonBase.cjs +68 -0
  26. package/dist/components/client/IconButton/IconButtonBase.d.cts +45 -0
  27. package/dist/components/client/IconButton/IconButtonBase.d.ts +46 -0
  28. package/dist/components/client/IconButton/IconButtonBase.js +65 -0
  29. package/dist/components/client/IconButton/index.cjs +8 -0
  30. package/dist/components/client/IconButton/index.d.cts +4 -0
  31. package/dist/components/client/IconButton/index.d.ts +5 -0
  32. package/dist/components/client/IconButton/index.js +5 -0
  33. package/dist/components/client/Pressable.cjs +3 -1
  34. package/dist/components/client/Pressable.js +3 -1
  35. package/dist/components/client/SpringMotionConfig.cjs +10 -13
  36. package/dist/components/client/SpringMotionConfig.js +10 -13
  37. package/dist/components/client/Switch/Switch.cjs +119 -0
  38. package/dist/components/client/{Switch.d.cts → Switch/Switch.d.cts} +4 -16
  39. package/dist/components/client/{Switch.d.ts → Switch/Switch.d.ts} +4 -16
  40. package/dist/components/client/Switch/Switch.js +115 -0
  41. package/dist/components/client/Switch/SwitchBase.cjs +129 -0
  42. package/dist/components/client/Switch/SwitchBase.d.cts +29 -0
  43. package/dist/components/client/Switch/SwitchBase.d.ts +30 -0
  44. package/dist/components/client/Switch/SwitchBase.js +126 -0
  45. package/dist/components/client/Switch/index.cjs +5 -0
  46. package/dist/components/client/Switch/index.d.cts +3 -0
  47. package/dist/components/client/Switch/index.d.ts +4 -0
  48. package/dist/components/client/Switch/index.js +4 -0
  49. package/dist/components/client/Switch/switchStyles.cjs +17 -0
  50. package/dist/components/client/Switch/switchStyles.d.cts +9 -0
  51. package/dist/components/client/Switch/switchStyles.d.ts +10 -0
  52. package/dist/components/client/Switch/switchStyles.js +16 -0
  53. package/dist/components/client/Switch/types.cjs +2 -0
  54. package/dist/components/client/Switch/types.d.cts +33 -0
  55. package/dist/components/client/Switch/types.d.ts +34 -0
  56. package/dist/components/client/Switch/types.js +2 -0
  57. package/dist/components/client/Toast/Toast.cjs +2 -2
  58. package/dist/components/client/Toast/Toast.d.cts +1 -1
  59. package/dist/components/client/Toast/Toast.d.ts +1 -1
  60. package/dist/components/client/Toast/Toast.js +1 -1
  61. package/dist/components/client/index.cjs +6 -6
  62. package/dist/components/client/index.d.cts +3 -3
  63. package/dist/components/client/index.d.ts +3 -3
  64. package/dist/components/client/index.js +3 -3
  65. package/dist/components/experimental/client/index.cjs +0 -6
  66. package/dist/components/experimental/client/index.d.cts +1 -3
  67. package/dist/components/experimental/client/index.d.ts +1 -3
  68. package/dist/components/experimental/client/index.js +1 -3
  69. package/dist/components/experimental/index.cjs +0 -5
  70. package/dist/components/experimental/index.d.cts +1 -3
  71. package/dist/components/experimental/index.d.ts +1 -3
  72. package/dist/components/experimental/index.js +1 -3
  73. package/dist/components/index.cjs +6 -6
  74. package/dist/components/index.d.cts +3 -3
  75. package/dist/components/index.d.ts +3 -3
  76. package/dist/components/index.js +3 -3
  77. package/dist/css-animation/Button/Button.cjs +85 -0
  78. package/dist/css-animation/Button/Button.d.cts +13 -0
  79. package/dist/css-animation/Button/Button.d.ts +14 -0
  80. package/dist/css-animation/Button/Button.js +82 -0
  81. package/dist/css-animation/Button/index.cjs +5 -0
  82. package/dist/css-animation/Button/index.d.cts +4 -0
  83. package/dist/css-animation/Button/index.d.ts +5 -0
  84. package/dist/css-animation/Button/index.js +4 -0
  85. package/dist/css-animation/IconButton/IconButton.cjs +55 -0
  86. package/dist/css-animation/IconButton/IconButton.d.cts +13 -0
  87. package/dist/css-animation/IconButton/IconButton.d.ts +14 -0
  88. package/dist/css-animation/IconButton/IconButton.js +53 -0
  89. package/dist/css-animation/IconButton/index.cjs +5 -0
  90. package/dist/css-animation/IconButton/index.d.cts +4 -0
  91. package/dist/css-animation/IconButton/index.d.ts +5 -0
  92. package/dist/css-animation/IconButton/index.js +4 -0
  93. package/dist/css-animation/Switch/Switch.cjs +44 -0
  94. package/dist/css-animation/Switch/Switch.d.cts +22 -0
  95. package/dist/css-animation/Switch/Switch.d.ts +23 -0
  96. package/dist/css-animation/Switch/Switch.js +41 -0
  97. package/dist/css-animation/Switch/SwitchStaticHandle.cjs +56 -0
  98. package/dist/css-animation/Switch/SwitchStaticHandle.d.cts +31 -0
  99. package/dist/css-animation/Switch/SwitchStaticHandle.d.ts +32 -0
  100. package/dist/css-animation/Switch/SwitchStaticHandle.js +54 -0
  101. package/dist/css-animation/Switch/index.cjs +5 -0
  102. package/dist/css-animation/Switch/index.d.cts +3 -0
  103. package/dist/css-animation/Switch/index.d.ts +4 -0
  104. package/dist/css-animation/Switch/index.js +4 -0
  105. package/dist/css-animation/index.cjs +9 -0
  106. package/dist/css-animation/index.d.cts +7 -0
  107. package/dist/css-animation/index.d.ts +8 -0
  108. package/dist/css-animation/index.js +6 -0
  109. package/dist/hooks/usePrefersReducedMotion.cjs +24 -0
  110. package/dist/hooks/usePrefersReducedMotion.d.cts +5 -0
  111. package/dist/hooks/usePrefersReducedMotion.d.ts +5 -0
  112. package/dist/hooks/usePrefersReducedMotion.js +22 -0
  113. package/dist/index.cjs +7 -7
  114. package/dist/index.d.cts +3 -3
  115. package/dist/index.d.ts +3 -3
  116. package/dist/index.js +4 -4
  117. package/dist/styles/styler.d.cts +4 -4
  118. package/dist/styles/styler.d.ts +4 -4
  119. package/dist/tailwind-internal/dist/utils/getShadowStyles.d.cts +2 -2
  120. package/dist/tailwind-internal/dist/utils/getShadowStyles.d.ts +2 -2
  121. package/dist/uds/generated/componentData.cjs +372 -381
  122. package/dist/uds/generated/componentData.js +372 -381
  123. package/dist/uds/generated/tailwindPurge.cjs +8 -21
  124. package/dist/uds/generated/tailwindPurge.js +8 -21
  125. package/dist/uds/package.cjs +12 -2
  126. package/dist/uds/package.js +12 -2
  127. package/generated/componentData.json +572 -603
  128. package/generated/tailwindPurge.ts +3 -3
  129. package/package.json +13 -3
  130. package/dist/components/client/Button.cjs +0 -326
  131. package/dist/components/client/Button.d.cts +0 -86
  132. package/dist/components/client/Button.d.ts +0 -87
  133. package/dist/components/client/Button.js +0 -321
  134. package/dist/components/client/IconButton.cjs +0 -161
  135. package/dist/components/client/IconButton.d.cts +0 -46
  136. package/dist/components/client/IconButton.d.ts +0 -47
  137. package/dist/components/client/IconButton.js +0 -159
  138. package/dist/components/client/Switch.cjs +0 -225
  139. package/dist/components/client/Switch.js +0 -222
  140. package/dist/components/client/buttonConstants.d.cts +0 -7
  141. package/dist/components/client/buttonConstants.d.ts +0 -8
  142. package/dist/components/experimental/client/AvoidMotionLibraryProvider.cjs +0 -14
  143. package/dist/components/experimental/client/AvoidMotionLibraryProvider.d.cts +0 -8
  144. package/dist/components/experimental/client/AvoidMotionLibraryProvider.d.ts +0 -9
  145. package/dist/components/experimental/client/AvoidMotionLibraryProvider.js +0 -11
  146. package/dist/components/experimental/client/SwitchV2.cjs +0 -190
  147. package/dist/components/experimental/client/SwitchV2.d.cts +0 -46
  148. package/dist/components/experimental/client/SwitchV2.d.ts +0 -47
  149. package/dist/components/experimental/client/SwitchV2.js +0 -185
@@ -0,0 +1,120 @@
1
+ /*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
2
+ "use client";
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
+ const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
5
+ const require_styles_styler = require("../../../styles/styler.cjs");
6
+ const require_utils_createSlot = require("../../../utils/createSlot.cjs");
7
+ const require_generateDefaultClassName = require("../../../automated-config/dist/utils/generateDefaultClassName.cjs");
8
+ let react = require("react");
9
+ react = require_runtime.__toESM(react);
10
+ let react_jsx_runtime = require("react/jsx-runtime");
11
+ //#region src/components/client/Button/ButtonBase.tsx
12
+ const defaultVariantRootClass = require_generateDefaultClassName.generateDefaultClassName("button", "variant", "root");
13
+ const defaultVariantIconClass = require_generateDefaultClassName.generateDefaultClassName("button", "variant", "icon");
14
+ const defaultSizeRootClass = require_generateDefaultClassName.generateDefaultClassName("button", "size", "root");
15
+ const defaultSizeIconClass = require_generateDefaultClassName.generateDefaultClassName("button", "size", "icon");
16
+ const ButtonBase = (0, react.forwardRef)(function ButtonBase({ size, variant, startIcon, endIcon, iconVariant, loading, disableEffects, children, asChild = false, slotProps, type = "button", className, width, renderStartContent, renderEndContent, renderRoot, ...rest }, forwardedRef) {
17
+ const { className: startIconClassName, ...startIconSlotProps } = slotProps?.startIcon ?? {};
18
+ const { className: endIconClassName, ...endIconSlotProps } = slotProps?.endIcon ?? {};
19
+ const { className: contentClassName, ...contentSlotProps } = slotProps?.content ?? {};
20
+ const gapVariant = loading || startIcon || endIcon ? "withIcon" : "withoutIcon";
21
+ const Slot = (0, react.useMemo)(() => require_utils_createSlot.createSlot(), []);
22
+ const rootSizeClass = (0, react.useMemo)(() => size ? require_styles_styler.getStyles({ buttonSizeRoot: size }) : defaultSizeRootClass, [size]);
23
+ const rootVariantClass = (0, react.useMemo)(() => variant ? require_styles_styler.getStyles({ buttonVariantRoot: variant }) : defaultVariantRootClass, [variant]);
24
+ const iconSizeClass = (0, react.useMemo)(() => size ? require_styles_styler.getStyles({ buttonSizeIcon: size }) : defaultSizeIconClass, [size]);
25
+ const iconVariantClass = (0, react.useMemo)(() => variant ? require_styles_styler.getStyles({ buttonVariantIcon: variant }) : defaultVariantIconClass, [variant]);
26
+ const styles = (0, react.useMemo)(() => ({
27
+ root: require_styles_styler.getStyles({
28
+ width,
29
+ className: require_styles_styler.cx([
30
+ "uds-ring",
31
+ "uds-hit-target",
32
+ "inline-flex max-w-full overflow-hidden justify-center items-center whitespace-nowrap select-none",
33
+ "[transform-origin:center]",
34
+ "[backface-visibility:hidden]",
35
+ "[transition-property:color,background-color,border-color,box-shadow,text-decoration-color,fill,stroke]",
36
+ "[transition-timing-function:cubic-bezier(0,0,0.2,1)]",
37
+ "[transition-duration:220ms]",
38
+ rootSizeClass,
39
+ rootVariantClass,
40
+ rest?.disabled && "cursor-not-allowed",
41
+ loading && "uds-button-loading",
42
+ disableEffects && "uds-button-without-effects",
43
+ gapVariant === "withIcon" && "uds-button-with-gap",
44
+ className
45
+ ])
46
+ }),
47
+ iconContainer: require_styles_styler.cx(["flex shrink-0 overflow-clip uds-button-icon-container"]),
48
+ icon: require_styles_styler.getStyles({ className: require_styles_styler.cx([iconSizeClass, iconVariantClass]) }),
49
+ loadingIcon: require_styles_styler.getStyles({ className: require_styles_styler.cx([
50
+ "animate-spin",
51
+ iconSizeClass,
52
+ iconVariantClass
53
+ ]) }),
54
+ content: require_styles_styler.cx(["min-w-0 truncate"])
55
+ }), [
56
+ className,
57
+ disableEffects,
58
+ gapVariant,
59
+ iconSizeClass,
60
+ iconVariantClass,
61
+ loading,
62
+ rest?.disabled,
63
+ rootSizeClass,
64
+ rootVariantClass,
65
+ width
66
+ ]);
67
+ const iconRenderArgs = (0, react.useMemo)(() => ({
68
+ iconVariant,
69
+ loading,
70
+ startIcon,
71
+ endIcon,
72
+ iconClassName: styles.icon,
73
+ loadingIconClassName: styles.loadingIcon,
74
+ iconContainerClassName: styles.iconContainer,
75
+ startIconClassName,
76
+ endIconClassName,
77
+ startIconSlotProps,
78
+ endIconSlotProps
79
+ }), [
80
+ endIcon,
81
+ endIconClassName,
82
+ endIconSlotProps,
83
+ iconVariant,
84
+ loading,
85
+ startIcon,
86
+ startIconClassName,
87
+ startIconSlotProps,
88
+ styles.icon,
89
+ styles.iconContainer,
90
+ styles.loadingIcon
91
+ ]);
92
+ return renderRoot({
93
+ asChild,
94
+ Slot,
95
+ children,
96
+ buttonRef: forwardedRef,
97
+ type,
98
+ rootClassName: styles.root,
99
+ rest,
100
+ contentClassName: require_styles_styler.cx(styles.content, contentClassName),
101
+ contentSlotProps,
102
+ startContent: renderStartContent(iconRenderArgs),
103
+ endContent: renderEndContent(iconRenderArgs)
104
+ });
105
+ });
106
+ ButtonBase.displayName = "ButtonBase";
107
+ function renderButtonChildren(children, childProps, startContent, contentClassName, contentSlotProps, endContent) {
108
+ return (0, react.cloneElement)(children, childProps, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
109
+ startContent,
110
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
111
+ className: contentClassName,
112
+ ...contentSlotProps,
113
+ children: children.props.children
114
+ }),
115
+ endContent
116
+ ] }));
117
+ }
118
+ //#endregion
119
+ exports.ButtonBase = ButtonBase;
120
+ exports.renderButtonChildren = renderButtonChildren;
@@ -0,0 +1,52 @@
1
+
2
+ import { UniversalButtonProps } from "../../../types/dist/index.cjs";
3
+ import { IconPropsWithSVGProps } from "../../../tokens/types.cjs";
4
+ import React, { ForwardRefExoticComponent } from "react";
5
+
6
+ //#region src/components/client/Button/ButtonBase.d.ts
7
+ type HtmlButtonProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'color' | 'name'>;
8
+ type DataAttributes = {
9
+ [name: `data-${string}`]: string;
10
+ };
11
+ interface ButtonProps extends HtmlButtonProps, UniversalButtonProps {
12
+ slotProps?: {
13
+ startIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
14
+ endIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
15
+ content?: Partial<React.HTMLAttributes<HTMLSpanElement> & DataAttributes>;
16
+ };
17
+ }
18
+ type ButtonIconRenderArgs = {
19
+ iconVariant: ButtonProps['iconVariant'];
20
+ loading?: boolean;
21
+ startIcon?: ButtonProps['startIcon'];
22
+ endIcon?: ButtonProps['endIcon'];
23
+ iconClassName: string;
24
+ loadingIconClassName: string;
25
+ iconContainerClassName: string;
26
+ startIconClassName?: string;
27
+ endIconClassName?: string;
28
+ startIconSlotProps: Partial<IconPropsWithSVGProps & DataAttributes>;
29
+ endIconSlotProps: Partial<IconPropsWithSVGProps & DataAttributes>;
30
+ };
31
+ type ButtonRootRenderArgs = {
32
+ asChild: boolean;
33
+ Slot: ForwardRefExoticComponent<HtmlButtonProps>;
34
+ children: React.ReactNode;
35
+ buttonRef: React.ForwardedRef<HTMLButtonElement>;
36
+ type: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
37
+ rootClassName: string;
38
+ rest: Omit<ButtonProps, 'children' | 'slotProps' | 'asChild' | 'type' | 'className'>;
39
+ contentClassName: string;
40
+ contentSlotProps: Partial<React.HTMLAttributes<HTMLSpanElement> & DataAttributes>;
41
+ startContent: React.ReactNode;
42
+ endContent: React.ReactNode;
43
+ };
44
+ interface ButtonBaseProps extends ButtonProps {
45
+ renderStartContent: (args: ButtonIconRenderArgs) => React.ReactNode;
46
+ renderEndContent: (args: ButtonIconRenderArgs) => React.ReactNode;
47
+ renderRoot: (args: ButtonRootRenderArgs) => React.ReactNode;
48
+ }
49
+ declare const ButtonBase: ForwardRefExoticComponent<ButtonBaseProps & React.RefAttributes<HTMLButtonElement>>;
50
+ declare function renderButtonChildren(children: React.ReactNode, childProps: Record<string, unknown>, startContent: React.ReactNode, contentClassName: string, contentSlotProps: Partial<React.HTMLAttributes<HTMLSpanElement> & DataAttributes>, endContent: React.ReactNode): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
51
+ //#endregion
52
+ export { ButtonBase, type ButtonProps, type ButtonRootRenderArgs, renderButtonChildren };
@@ -0,0 +1,53 @@
1
+
2
+ "use client";
3
+ import { UniversalButtonProps } from "../../../types/dist/index.js";
4
+ import { IconPropsWithSVGProps } from "../../../tokens/types.js";
5
+ import React, { ForwardRefExoticComponent } from "react";
6
+
7
+ //#region src/components/client/Button/ButtonBase.d.ts
8
+ type HtmlButtonProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'color' | 'name'>;
9
+ type DataAttributes = {
10
+ [name: `data-${string}`]: string;
11
+ };
12
+ interface ButtonProps extends HtmlButtonProps, UniversalButtonProps {
13
+ slotProps?: {
14
+ startIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
15
+ endIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
16
+ content?: Partial<React.HTMLAttributes<HTMLSpanElement> & DataAttributes>;
17
+ };
18
+ }
19
+ type ButtonIconRenderArgs = {
20
+ iconVariant: ButtonProps['iconVariant'];
21
+ loading?: boolean;
22
+ startIcon?: ButtonProps['startIcon'];
23
+ endIcon?: ButtonProps['endIcon'];
24
+ iconClassName: string;
25
+ loadingIconClassName: string;
26
+ iconContainerClassName: string;
27
+ startIconClassName?: string;
28
+ endIconClassName?: string;
29
+ startIconSlotProps: Partial<IconPropsWithSVGProps & DataAttributes>;
30
+ endIconSlotProps: Partial<IconPropsWithSVGProps & DataAttributes>;
31
+ };
32
+ type ButtonRootRenderArgs = {
33
+ asChild: boolean;
34
+ Slot: ForwardRefExoticComponent<HtmlButtonProps>;
35
+ children: React.ReactNode;
36
+ buttonRef: React.ForwardedRef<HTMLButtonElement>;
37
+ type: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
38
+ rootClassName: string;
39
+ rest: Omit<ButtonProps, 'children' | 'slotProps' | 'asChild' | 'type' | 'className'>;
40
+ contentClassName: string;
41
+ contentSlotProps: Partial<React.HTMLAttributes<HTMLSpanElement> & DataAttributes>;
42
+ startContent: React.ReactNode;
43
+ endContent: React.ReactNode;
44
+ };
45
+ interface ButtonBaseProps extends ButtonProps {
46
+ renderStartContent: (args: ButtonIconRenderArgs) => React.ReactNode;
47
+ renderEndContent: (args: ButtonIconRenderArgs) => React.ReactNode;
48
+ renderRoot: (args: ButtonRootRenderArgs) => React.ReactNode;
49
+ }
50
+ declare const ButtonBase: ForwardRefExoticComponent<ButtonBaseProps & React.RefAttributes<HTMLButtonElement>>;
51
+ declare function renderButtonChildren(children: React.ReactNode, childProps: Record<string, unknown>, startContent: React.ReactNode, contentClassName: string, contentSlotProps: Partial<React.HTMLAttributes<HTMLSpanElement> & DataAttributes>, endContent: React.ReactNode): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
52
+ //#endregion
53
+ export { ButtonBase, type ButtonProps, type ButtonRootRenderArgs, renderButtonChildren };
@@ -0,0 +1,116 @@
1
+ /*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
2
+ "use client";
3
+ import { cx, getStyles } from "../../../styles/styler.js";
4
+ import { createSlot } from "../../../utils/createSlot.js";
5
+ import { generateDefaultClassName } from "../../../automated-config/dist/utils/generateDefaultClassName.js";
6
+ import { cloneElement, forwardRef, useMemo } from "react";
7
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
+ //#region src/components/client/Button/ButtonBase.tsx
9
+ const defaultVariantRootClass = generateDefaultClassName("button", "variant", "root");
10
+ const defaultVariantIconClass = generateDefaultClassName("button", "variant", "icon");
11
+ const defaultSizeRootClass = generateDefaultClassName("button", "size", "root");
12
+ const defaultSizeIconClass = generateDefaultClassName("button", "size", "icon");
13
+ const ButtonBase = forwardRef(function ButtonBase({ size, variant, startIcon, endIcon, iconVariant, loading, disableEffects, children, asChild = false, slotProps, type = "button", className, width, renderStartContent, renderEndContent, renderRoot, ...rest }, forwardedRef) {
14
+ const { className: startIconClassName, ...startIconSlotProps } = slotProps?.startIcon ?? {};
15
+ const { className: endIconClassName, ...endIconSlotProps } = slotProps?.endIcon ?? {};
16
+ const { className: contentClassName, ...contentSlotProps } = slotProps?.content ?? {};
17
+ const gapVariant = loading || startIcon || endIcon ? "withIcon" : "withoutIcon";
18
+ const Slot = useMemo(() => createSlot(), []);
19
+ const rootSizeClass = useMemo(() => size ? getStyles({ buttonSizeRoot: size }) : defaultSizeRootClass, [size]);
20
+ const rootVariantClass = useMemo(() => variant ? getStyles({ buttonVariantRoot: variant }) : defaultVariantRootClass, [variant]);
21
+ const iconSizeClass = useMemo(() => size ? getStyles({ buttonSizeIcon: size }) : defaultSizeIconClass, [size]);
22
+ const iconVariantClass = useMemo(() => variant ? getStyles({ buttonVariantIcon: variant }) : defaultVariantIconClass, [variant]);
23
+ const styles = useMemo(() => ({
24
+ root: getStyles({
25
+ width,
26
+ className: cx([
27
+ "uds-ring",
28
+ "uds-hit-target",
29
+ "inline-flex max-w-full overflow-hidden justify-center items-center whitespace-nowrap select-none",
30
+ "[transform-origin:center]",
31
+ "[backface-visibility:hidden]",
32
+ "[transition-property:color,background-color,border-color,box-shadow,text-decoration-color,fill,stroke]",
33
+ "[transition-timing-function:cubic-bezier(0,0,0.2,1)]",
34
+ "[transition-duration:220ms]",
35
+ rootSizeClass,
36
+ rootVariantClass,
37
+ rest?.disabled && "cursor-not-allowed",
38
+ loading && "uds-button-loading",
39
+ disableEffects && "uds-button-without-effects",
40
+ gapVariant === "withIcon" && "uds-button-with-gap",
41
+ className
42
+ ])
43
+ }),
44
+ iconContainer: cx(["flex shrink-0 overflow-clip uds-button-icon-container"]),
45
+ icon: getStyles({ className: cx([iconSizeClass, iconVariantClass]) }),
46
+ loadingIcon: getStyles({ className: cx([
47
+ "animate-spin",
48
+ iconSizeClass,
49
+ iconVariantClass
50
+ ]) }),
51
+ content: cx(["min-w-0 truncate"])
52
+ }), [
53
+ className,
54
+ disableEffects,
55
+ gapVariant,
56
+ iconSizeClass,
57
+ iconVariantClass,
58
+ loading,
59
+ rest?.disabled,
60
+ rootSizeClass,
61
+ rootVariantClass,
62
+ width
63
+ ]);
64
+ const iconRenderArgs = useMemo(() => ({
65
+ iconVariant,
66
+ loading,
67
+ startIcon,
68
+ endIcon,
69
+ iconClassName: styles.icon,
70
+ loadingIconClassName: styles.loadingIcon,
71
+ iconContainerClassName: styles.iconContainer,
72
+ startIconClassName,
73
+ endIconClassName,
74
+ startIconSlotProps,
75
+ endIconSlotProps
76
+ }), [
77
+ endIcon,
78
+ endIconClassName,
79
+ endIconSlotProps,
80
+ iconVariant,
81
+ loading,
82
+ startIcon,
83
+ startIconClassName,
84
+ startIconSlotProps,
85
+ styles.icon,
86
+ styles.iconContainer,
87
+ styles.loadingIcon
88
+ ]);
89
+ return renderRoot({
90
+ asChild,
91
+ Slot,
92
+ children,
93
+ buttonRef: forwardedRef,
94
+ type,
95
+ rootClassName: styles.root,
96
+ rest,
97
+ contentClassName: cx(styles.content, contentClassName),
98
+ contentSlotProps,
99
+ startContent: renderStartContent(iconRenderArgs),
100
+ endContent: renderEndContent(iconRenderArgs)
101
+ });
102
+ });
103
+ ButtonBase.displayName = "ButtonBase";
104
+ function renderButtonChildren(children, childProps, startContent, contentClassName, contentSlotProps, endContent) {
105
+ return cloneElement(children, childProps, /* @__PURE__ */ jsxs(Fragment$1, { children: [
106
+ startContent,
107
+ /* @__PURE__ */ jsx("span", {
108
+ className: contentClassName,
109
+ ...contentSlotProps,
110
+ children: children.props.children
111
+ }),
112
+ endContent
113
+ ] }));
114
+ }
115
+ //#endregion
116
+ export { ButtonBase, renderButtonChildren };
@@ -1,7 +1,7 @@
1
1
  /*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
2
2
  "use client";
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- //#region src/components/client/buttonConstants.ts
4
+ //#region src/components/client/Button/buttonConstants.ts
5
5
  /** The icon size used for icons in Button and IconButton components */
6
6
  const buttonIconSvgSize = "sm";
7
7
  //#endregion
@@ -0,0 +1,7 @@
1
+
2
+ import { ButtonSize } from "../../../types/dist/index.cjs";
3
+ //#region src/components/client/Button/buttonConstants.d.ts
4
+ /** The icon size used for icons in Button and IconButton components */
5
+ declare const buttonIconSvgSize: ButtonSize;
6
+ //#endregion
7
+ export { buttonIconSvgSize };
@@ -0,0 +1,8 @@
1
+
2
+ "use client";
3
+ import { ButtonSize } from "../../../types/dist/index.js";
4
+ //#region src/components/client/Button/buttonConstants.d.ts
5
+ /** The icon size used for icons in Button and IconButton components */
6
+ declare const buttonIconSvgSize: ButtonSize;
7
+ //#endregion
8
+ export { buttonIconSvgSize };
@@ -1,6 +1,6 @@
1
1
  /*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
2
2
  "use client";
3
- //#region src/components/client/buttonConstants.ts
3
+ //#region src/components/client/Button/buttonConstants.ts
4
4
  /** The icon size used for icons in Button and IconButton components */
5
5
  const buttonIconSvgSize = "sm";
6
6
  //#endregion
@@ -0,0 +1,10 @@
1
+ /*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
2
+ "use client";
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
+ const require_components_client_Button_ButtonBase = require("./ButtonBase.cjs");
5
+ const require_components_client_Button_Button = require("./Button.cjs");
6
+ exports.Button = require_components_client_Button_Button.Button;
7
+ exports.ButtonBase = require_components_client_Button_ButtonBase.ButtonBase;
8
+ exports.iconMotionVariants = require_components_client_Button_Button.iconMotionVariants;
9
+ exports.loadingMotionVariants = require_components_client_Button_Button.loadingMotionVariants;
10
+ exports.renderButtonChildren = require_components_client_Button_ButtonBase.renderButtonChildren;
@@ -0,0 +1,4 @@
1
+
2
+ import { ButtonBase, ButtonRootRenderArgs, renderButtonChildren } from "./ButtonBase.cjs";
3
+ import { Button, ButtonProps, iconMotionVariants, loadingMotionVariants } from "./Button.cjs";
4
+ export { Button, ButtonBase, type ButtonProps, type ButtonRootRenderArgs, iconMotionVariants, loadingMotionVariants, renderButtonChildren };
@@ -0,0 +1,5 @@
1
+
2
+ "use client";
3
+ import { ButtonBase, ButtonRootRenderArgs, renderButtonChildren } from "./ButtonBase.js";
4
+ import { Button, ButtonProps, iconMotionVariants, loadingMotionVariants } from "./Button.js";
5
+ export { Button, ButtonBase, type ButtonProps, type ButtonRootRenderArgs, iconMotionVariants, loadingMotionVariants, renderButtonChildren };
@@ -0,0 +1,5 @@
1
+ /*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
2
+ "use client";
3
+ import { ButtonBase, renderButtonChildren } from "./ButtonBase.js";
4
+ import { Button, iconMotionVariants, loadingMotionVariants } from "./Button.js";
5
+ export { Button, ButtonBase, iconMotionVariants, loadingMotionVariants, renderButtonChildren };
@@ -0,0 +1,104 @@
1
+ /*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
2
+ "use client";
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
+ require("../../../_virtual/_rolldown/runtime.cjs");
5
+ const require_index = require("../../../css-tokens/dist/index.cjs");
6
+ const require_utils_createSlot = require("../../../utils/createSlot.cjs");
7
+ const require_components_Icon = require("../../Icon.cjs");
8
+ const require_components_client_SpringMotionConfig = require("../SpringMotionConfig.cjs");
9
+ require("../Button/buttonConstants.cjs");
10
+ const require_components_client_Button_Button = require("../Button/Button.cjs");
11
+ const require_components_client_IconButton_IconButtonBase = require("./IconButtonBase.cjs");
12
+ let _yahoo_uds_icons = require("@yahoo/uds-icons");
13
+ let react = require("react");
14
+ let react_jsx_runtime = require("react/jsx-runtime");
15
+ let motion_react = require("motion/react");
16
+ //#region src/components/client/IconButton/IconButton.tsx
17
+ /**
18
+ * **⚙️️ An icon button element that can be used to trigger an action**
19
+ *
20
+ * @componentType Client component
21
+ */
22
+ const IconButton = (0, react.forwardRef)(function IconButton(props, forwardedRef) {
23
+ const prefersReducedMotion = (0, motion_react.useReducedMotion)();
24
+ const disableMotion = !!props.disableEffects || !!props.disabled;
25
+ const layoutVariant = (0, react.useMemo)(() => prefersReducedMotion ? "smooth" : "subtle", [prefersReducedMotion]);
26
+ const Slot = (0, react.useMemo)(() => require_utils_createSlot.createSlot(), []);
27
+ const MotionSlot = (0, react.useMemo)(() => motion_react.m.create(Slot), [Slot]);
28
+ const buttonVariants = (0, react.useMemo)(() => ({
29
+ rest: { scale: disableMotion ? 1 : `var(${require_index.BUTTON_SCALE_EFFECT_REST})` },
30
+ hover: { scale: disableMotion ? 1 : `var(${require_index.BUTTON_SCALE_EFFECT_HOVER})` },
31
+ pressed: { scale: disableMotion ? 1 : `var(${require_index.BUTTON_SCALE_EFFECT_PRESSED})` }
32
+ }), [disableMotion]);
33
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_IconButton_IconButtonBase.IconButtonBase, {
34
+ ...props,
35
+ ref: forwardedRef,
36
+ renderIconContent: ({ asChild, loading, name, iconVariant, children, iconClassName, loadingIconClassName, iconSlotClassName, iconSlotProps }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(motion_react.AnimatePresence, {
37
+ initial: false,
38
+ mode: "popLayout",
39
+ children: [loading && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.span, {
40
+ variants: require_components_client_Button_Button.loadingMotionVariants,
41
+ initial: "loading",
42
+ animate: "loading",
43
+ exit: "hide",
44
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Icon.Icon, {
45
+ size: "sm",
46
+ name: _yahoo_uds_icons.Progress,
47
+ variant: iconVariant,
48
+ color: "current",
49
+ className: loadingIconClassName
50
+ })
51
+ }, "loading"), name && !loading && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.span, {
52
+ variants: require_components_client_Button_Button.iconMotionVariants,
53
+ initial: "icon",
54
+ animate: "icon",
55
+ exit: "hide",
56
+ children: !asChild && children || /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Icon.Icon, {
57
+ size: "sm",
58
+ name,
59
+ variant: iconVariant,
60
+ color: "current",
61
+ className: [iconClassName, iconSlotClassName].filter(Boolean).join(" "),
62
+ ...iconSlotProps
63
+ })
64
+ }, name.name)]
65
+ }),
66
+ renderRoot: ({ asChild, children, buttonRef, type, htmlName, rootClassName, rest, iconContent }) => {
67
+ if (asChild && (0, react.isValidElement)(children)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_SpringMotionConfig.SpringMotionConfig, {
68
+ layoutSpeed: "3",
69
+ layoutVariant,
70
+ reducedMotion: props.disableEffects ? "always" : "user",
71
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MotionSlot, {
72
+ type,
73
+ className: rootClassName,
74
+ initial: "icon",
75
+ variants: buttonVariants,
76
+ whileHover: "hover",
77
+ whileTap: "pressed",
78
+ ...rest,
79
+ children: require_components_client_IconButton_IconButtonBase.renderIconButtonAsChild(children, iconContent)
80
+ })
81
+ });
82
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_SpringMotionConfig.SpringMotionConfig, {
83
+ layoutSpeed: "3",
84
+ layoutVariant,
85
+ reducedMotion: props.disableEffects ? "always" : "user",
86
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.button, {
87
+ ref: buttonRef,
88
+ type,
89
+ className: rootClassName,
90
+ name: htmlName,
91
+ initial: "icon",
92
+ variants: buttonVariants,
93
+ whileHover: "hover",
94
+ whileTap: "pressed",
95
+ ...rest,
96
+ children: iconContent
97
+ })
98
+ });
99
+ }
100
+ });
101
+ });
102
+ IconButton.displayName = "IconButton";
103
+ //#endregion
104
+ exports.IconButton = IconButton;
@@ -0,0 +1,17 @@
1
+
2
+ import { IconButtonProps as IconButtonProps$1 } from "./IconButtonBase.cjs";
3
+ import * as _$react from "react";
4
+ import { ForwardRefExoticComponent } from "react";
5
+ import { HTMLMotionProps } from "motion/react";
6
+
7
+ //#region src/components/client/IconButton/IconButton.d.ts
8
+ type HtmlButtonProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'color' | 'name'> & Omit<HTMLMotionProps<'button'>, 'name'>;
9
+ type IconButtonProps = IconButtonProps$1 & HtmlButtonProps;
10
+ /**
11
+ * **⚙️️ An icon button element that can be used to trigger an action**
12
+ *
13
+ * @componentType Client component
14
+ */
15
+ declare const IconButton: ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & _$react.RefAttributes<HTMLButtonElement>>;
16
+ //#endregion
17
+ export { IconButton, type IconButtonProps };
@@ -0,0 +1,18 @@
1
+
2
+ "use client";
3
+ import { IconButtonProps as IconButtonProps$1 } from "./IconButtonBase.js";
4
+ import * as _$react from "react";
5
+ import { ForwardRefExoticComponent } from "react";
6
+ import { HTMLMotionProps } from "motion/react";
7
+
8
+ //#region src/components/client/IconButton/IconButton.d.ts
9
+ type HtmlButtonProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'color' | 'name'> & Omit<HTMLMotionProps<'button'>, 'name'>;
10
+ type IconButtonProps = IconButtonProps$1 & HtmlButtonProps;
11
+ /**
12
+ * **⚙️️ An icon button element that can be used to trigger an action**
13
+ *
14
+ * @componentType Client component
15
+ */
16
+ declare const IconButton: ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & _$react.RefAttributes<HTMLButtonElement>>;
17
+ //#endregion
18
+ export { IconButton, type IconButtonProps };
@@ -0,0 +1,102 @@
1
+ /*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
2
+ "use client";
3
+ import { BUTTON_SCALE_EFFECT_HOVER, BUTTON_SCALE_EFFECT_PRESSED, BUTTON_SCALE_EFFECT_REST } from "../../../css-tokens/dist/index.js";
4
+ import { createSlot } from "../../../utils/createSlot.js";
5
+ import { Icon } from "../../Icon.js";
6
+ import { SpringMotionConfig } from "../SpringMotionConfig.js";
7
+ import "../Button/buttonConstants.js";
8
+ import { iconMotionVariants, loadingMotionVariants } from "../Button/Button.js";
9
+ import { IconButtonBase, renderIconButtonAsChild } from "./IconButtonBase.js";
10
+ import { Progress } from "@yahoo/uds-icons";
11
+ import { forwardRef, isValidElement, useMemo } from "react";
12
+ import { jsx, jsxs } from "react/jsx-runtime";
13
+ import { AnimatePresence, m, useReducedMotion } from "motion/react";
14
+ //#region src/components/client/IconButton/IconButton.tsx
15
+ /**
16
+ * **⚙️️ An icon button element that can be used to trigger an action**
17
+ *
18
+ * @componentType Client component
19
+ */
20
+ const IconButton = forwardRef(function IconButton(props, forwardedRef) {
21
+ const prefersReducedMotion = useReducedMotion();
22
+ const disableMotion = !!props.disableEffects || !!props.disabled;
23
+ const layoutVariant = useMemo(() => prefersReducedMotion ? "smooth" : "subtle", [prefersReducedMotion]);
24
+ const Slot = useMemo(() => createSlot(), []);
25
+ const MotionSlot = useMemo(() => m.create(Slot), [Slot]);
26
+ const buttonVariants = useMemo(() => ({
27
+ rest: { scale: disableMotion ? 1 : `var(${BUTTON_SCALE_EFFECT_REST})` },
28
+ hover: { scale: disableMotion ? 1 : `var(${BUTTON_SCALE_EFFECT_HOVER})` },
29
+ pressed: { scale: disableMotion ? 1 : `var(${BUTTON_SCALE_EFFECT_PRESSED})` }
30
+ }), [disableMotion]);
31
+ return /* @__PURE__ */ jsx(IconButtonBase, {
32
+ ...props,
33
+ ref: forwardedRef,
34
+ renderIconContent: ({ asChild, loading, name, iconVariant, children, iconClassName, loadingIconClassName, iconSlotClassName, iconSlotProps }) => /* @__PURE__ */ jsxs(AnimatePresence, {
35
+ initial: false,
36
+ mode: "popLayout",
37
+ children: [loading && /* @__PURE__ */ jsx(m.span, {
38
+ variants: loadingMotionVariants,
39
+ initial: "loading",
40
+ animate: "loading",
41
+ exit: "hide",
42
+ children: /* @__PURE__ */ jsx(Icon, {
43
+ size: "sm",
44
+ name: Progress,
45
+ variant: iconVariant,
46
+ color: "current",
47
+ className: loadingIconClassName
48
+ })
49
+ }, "loading"), name && !loading && /* @__PURE__ */ jsx(m.span, {
50
+ variants: iconMotionVariants,
51
+ initial: "icon",
52
+ animate: "icon",
53
+ exit: "hide",
54
+ children: !asChild && children || /* @__PURE__ */ jsx(Icon, {
55
+ size: "sm",
56
+ name,
57
+ variant: iconVariant,
58
+ color: "current",
59
+ className: [iconClassName, iconSlotClassName].filter(Boolean).join(" "),
60
+ ...iconSlotProps
61
+ })
62
+ }, name.name)]
63
+ }),
64
+ renderRoot: ({ asChild, children, buttonRef, type, htmlName, rootClassName, rest, iconContent }) => {
65
+ if (asChild && isValidElement(children)) return /* @__PURE__ */ jsx(SpringMotionConfig, {
66
+ layoutSpeed: "3",
67
+ layoutVariant,
68
+ reducedMotion: props.disableEffects ? "always" : "user",
69
+ children: /* @__PURE__ */ jsx(MotionSlot, {
70
+ type,
71
+ className: rootClassName,
72
+ initial: "icon",
73
+ variants: buttonVariants,
74
+ whileHover: "hover",
75
+ whileTap: "pressed",
76
+ ...rest,
77
+ children: renderIconButtonAsChild(children, iconContent)
78
+ })
79
+ });
80
+ return /* @__PURE__ */ jsx(SpringMotionConfig, {
81
+ layoutSpeed: "3",
82
+ layoutVariant,
83
+ reducedMotion: props.disableEffects ? "always" : "user",
84
+ children: /* @__PURE__ */ jsx(m.button, {
85
+ ref: buttonRef,
86
+ type,
87
+ className: rootClassName,
88
+ name: htmlName,
89
+ initial: "icon",
90
+ variants: buttonVariants,
91
+ whileHover: "hover",
92
+ whileTap: "pressed",
93
+ ...rest,
94
+ children: iconContent
95
+ })
96
+ });
97
+ }
98
+ });
99
+ });
100
+ IconButton.displayName = "IconButton";
101
+ //#endregion
102
+ export { IconButton };