@yahoo/uds 3.159.2 → 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 (145) 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/client/Button/Button.cjs +213 -0
  4. package/dist/components/client/Button/Button.d.cts +50 -0
  5. package/dist/components/client/Button/Button.d.ts +51 -0
  6. package/dist/components/client/Button/Button.js +208 -0
  7. package/dist/components/client/Button/ButtonBase.cjs +120 -0
  8. package/dist/components/client/Button/ButtonBase.d.cts +52 -0
  9. package/dist/components/client/Button/ButtonBase.d.ts +53 -0
  10. package/dist/components/client/Button/ButtonBase.js +116 -0
  11. package/dist/components/client/{buttonConstants.cjs → Button/buttonConstants.cjs} +1 -1
  12. package/dist/components/client/Button/buttonConstants.d.cts +7 -0
  13. package/dist/components/client/Button/buttonConstants.d.ts +8 -0
  14. package/dist/components/client/{buttonConstants.js → Button/buttonConstants.js} +1 -1
  15. package/dist/components/client/Button/index.cjs +10 -0
  16. package/dist/components/client/Button/index.d.cts +4 -0
  17. package/dist/components/client/Button/index.d.ts +5 -0
  18. package/dist/components/client/Button/index.js +5 -0
  19. package/dist/components/client/IconButton/IconButton.cjs +104 -0
  20. package/dist/components/client/IconButton/IconButton.d.cts +17 -0
  21. package/dist/components/client/IconButton/IconButton.d.ts +18 -0
  22. package/dist/components/client/IconButton/IconButton.js +102 -0
  23. package/dist/components/client/IconButton/IconButtonBase.cjs +68 -0
  24. package/dist/components/client/IconButton/IconButtonBase.d.cts +45 -0
  25. package/dist/components/client/IconButton/IconButtonBase.d.ts +46 -0
  26. package/dist/components/client/IconButton/IconButtonBase.js +65 -0
  27. package/dist/components/client/IconButton/index.cjs +8 -0
  28. package/dist/components/client/IconButton/index.d.cts +4 -0
  29. package/dist/components/client/IconButton/index.d.ts +5 -0
  30. package/dist/components/client/IconButton/index.js +5 -0
  31. package/dist/components/client/SpringMotionConfig.cjs +10 -13
  32. package/dist/components/client/SpringMotionConfig.js +10 -13
  33. package/dist/components/client/Switch/Switch.cjs +119 -0
  34. package/dist/components/client/{Switch.d.cts → Switch/Switch.d.cts} +4 -16
  35. package/dist/components/client/{Switch.d.ts → Switch/Switch.d.ts} +4 -16
  36. package/dist/components/client/Switch/Switch.js +115 -0
  37. package/dist/components/client/Switch/SwitchBase.cjs +129 -0
  38. package/dist/components/client/Switch/SwitchBase.d.cts +29 -0
  39. package/dist/components/client/Switch/SwitchBase.d.ts +30 -0
  40. package/dist/components/client/Switch/SwitchBase.js +126 -0
  41. package/dist/components/client/Switch/index.cjs +5 -0
  42. package/dist/components/client/Switch/index.d.cts +3 -0
  43. package/dist/components/client/Switch/index.d.ts +4 -0
  44. package/dist/components/client/Switch/index.js +4 -0
  45. package/dist/components/client/Switch/switchStyles.cjs +17 -0
  46. package/dist/components/client/Switch/switchStyles.d.cts +9 -0
  47. package/dist/components/client/Switch/switchStyles.d.ts +10 -0
  48. package/dist/components/client/Switch/switchStyles.js +16 -0
  49. package/dist/components/client/Switch/types.cjs +2 -0
  50. package/dist/components/client/Switch/types.d.cts +33 -0
  51. package/dist/components/client/Switch/types.d.ts +34 -0
  52. package/dist/components/client/Switch/types.js +2 -0
  53. package/dist/components/client/Toast/Toast.cjs +2 -2
  54. package/dist/components/client/Toast/Toast.d.cts +1 -1
  55. package/dist/components/client/Toast/Toast.d.ts +1 -1
  56. package/dist/components/client/Toast/Toast.js +1 -1
  57. package/dist/components/client/index.cjs +6 -6
  58. package/dist/components/client/index.d.cts +3 -3
  59. package/dist/components/client/index.d.ts +3 -3
  60. package/dist/components/client/index.js +3 -3
  61. package/dist/components/experimental/client/index.cjs +0 -6
  62. package/dist/components/experimental/client/index.d.cts +1 -3
  63. package/dist/components/experimental/client/index.d.ts +1 -3
  64. package/dist/components/experimental/client/index.js +1 -3
  65. package/dist/components/experimental/index.cjs +0 -5
  66. package/dist/components/experimental/index.d.cts +1 -3
  67. package/dist/components/experimental/index.d.ts +1 -3
  68. package/dist/components/experimental/index.js +1 -3
  69. package/dist/components/index.cjs +6 -6
  70. package/dist/components/index.d.cts +3 -3
  71. package/dist/components/index.d.ts +3 -3
  72. package/dist/components/index.js +3 -3
  73. package/dist/css-animation/Button/Button.cjs +85 -0
  74. package/dist/css-animation/Button/Button.d.cts +13 -0
  75. package/dist/css-animation/Button/Button.d.ts +14 -0
  76. package/dist/css-animation/Button/Button.js +82 -0
  77. package/dist/css-animation/Button/index.cjs +5 -0
  78. package/dist/css-animation/Button/index.d.cts +4 -0
  79. package/dist/css-animation/Button/index.d.ts +5 -0
  80. package/dist/css-animation/Button/index.js +4 -0
  81. package/dist/css-animation/IconButton/IconButton.cjs +55 -0
  82. package/dist/css-animation/IconButton/IconButton.d.cts +13 -0
  83. package/dist/css-animation/IconButton/IconButton.d.ts +14 -0
  84. package/dist/css-animation/IconButton/IconButton.js +53 -0
  85. package/dist/css-animation/IconButton/index.cjs +5 -0
  86. package/dist/css-animation/IconButton/index.d.cts +4 -0
  87. package/dist/css-animation/IconButton/index.d.ts +5 -0
  88. package/dist/css-animation/IconButton/index.js +4 -0
  89. package/dist/css-animation/Switch/Switch.cjs +44 -0
  90. package/dist/css-animation/Switch/Switch.d.cts +22 -0
  91. package/dist/css-animation/Switch/Switch.d.ts +23 -0
  92. package/dist/css-animation/Switch/Switch.js +41 -0
  93. package/dist/css-animation/Switch/SwitchStaticHandle.cjs +56 -0
  94. package/dist/css-animation/Switch/SwitchStaticHandle.d.cts +31 -0
  95. package/dist/css-animation/Switch/SwitchStaticHandle.d.ts +32 -0
  96. package/dist/css-animation/Switch/SwitchStaticHandle.js +54 -0
  97. package/dist/css-animation/Switch/index.cjs +5 -0
  98. package/dist/css-animation/Switch/index.d.cts +3 -0
  99. package/dist/css-animation/Switch/index.d.ts +4 -0
  100. package/dist/css-animation/Switch/index.js +4 -0
  101. package/dist/css-animation/index.cjs +9 -0
  102. package/dist/css-animation/index.d.cts +7 -0
  103. package/dist/css-animation/index.d.ts +8 -0
  104. package/dist/css-animation/index.js +6 -0
  105. package/dist/hooks/usePrefersReducedMotion.cjs +24 -0
  106. package/dist/hooks/usePrefersReducedMotion.d.cts +5 -0
  107. package/dist/hooks/usePrefersReducedMotion.d.ts +5 -0
  108. package/dist/hooks/usePrefersReducedMotion.js +22 -0
  109. package/dist/index.cjs +7 -7
  110. package/dist/index.d.cts +3 -3
  111. package/dist/index.d.ts +3 -3
  112. package/dist/index.js +4 -4
  113. package/dist/styles/styler.d.cts +4 -4
  114. package/dist/styles/styler.d.ts +4 -4
  115. package/dist/tailwind-internal/dist/utils/getShadowStyles.d.cts +2 -2
  116. package/dist/tailwind-internal/dist/utils/getShadowStyles.d.ts +2 -2
  117. package/dist/uds/generated/componentData.cjs +308 -317
  118. package/dist/uds/generated/componentData.js +308 -317
  119. package/dist/uds/generated/tailwindPurge.cjs +8 -21
  120. package/dist/uds/generated/tailwindPurge.js +8 -21
  121. package/dist/uds/package.cjs +12 -2
  122. package/dist/uds/package.js +12 -2
  123. package/generated/componentData.json +458 -489
  124. package/generated/tailwindPurge.ts +3 -3
  125. package/package.json +13 -3
  126. package/dist/components/client/Button.cjs +0 -326
  127. package/dist/components/client/Button.d.cts +0 -86
  128. package/dist/components/client/Button.d.ts +0 -87
  129. package/dist/components/client/Button.js +0 -321
  130. package/dist/components/client/IconButton.cjs +0 -161
  131. package/dist/components/client/IconButton.d.cts +0 -46
  132. package/dist/components/client/IconButton.d.ts +0 -47
  133. package/dist/components/client/IconButton.js +0 -159
  134. package/dist/components/client/Switch.cjs +0 -225
  135. package/dist/components/client/Switch.js +0 -222
  136. package/dist/components/client/buttonConstants.d.cts +0 -7
  137. package/dist/components/client/buttonConstants.d.ts +0 -8
  138. package/dist/components/experimental/client/AvoidMotionLibraryProvider.cjs +0 -14
  139. package/dist/components/experimental/client/AvoidMotionLibraryProvider.d.cts +0 -8
  140. package/dist/components/experimental/client/AvoidMotionLibraryProvider.d.ts +0 -9
  141. package/dist/components/experimental/client/AvoidMotionLibraryProvider.js +0 -11
  142. package/dist/components/experimental/client/SwitchV2.cjs +0 -190
  143. package/dist/components/experimental/client/SwitchV2.d.cts +0 -46
  144. package/dist/components/experimental/client/SwitchV2.d.ts +0 -47
  145. package/dist/components/experimental/client/SwitchV2.js +0 -185
@@ -1,9 +1,9 @@
1
1
  /*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
2
2
  const require_index = require("../../css-tokens/dist/index.cjs");
3
+ const require_index$1 = require("../../motion-tokens/dist/index.cjs");
3
4
  const require_assertUnreachable = require("../../utils/dist/assertUnreachable.cjs");
4
5
  const require_mapTextVariantFixtureToValue = require("./mapTextVariantFixtureToValue.cjs");
5
6
  const require_mapColorFixtureToValue = require("./utils/mapColorFixtureToValue.cjs");
6
- const require_index$1 = require("../../motion-tokens/dist/index.cjs");
7
7
  //#region ../automated-config/dist/properties.js
8
8
  /*! © 2026 Yahoo, Inc. UDS Default Config v0.0.0-development */
9
9
  const isInputWrapperCtx = (context) => {
@@ -1,9 +1,9 @@
1
1
  /*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
2
2
  import { BACKGROUND_BLUR_COLOR_PREFIX, BACKGROUND_BLUR_FALLBACK_COLOR_PREFIX, BORDER_RADIUS_PREFIX, BUTTON_SCALE_EFFECT, DROP_SHADOW_PREFIX, getShadowLayerValue, textVariantsSafe } from "../../css-tokens/dist/index.js";
3
+ import { SCALE_EFFECTS } from "../../motion-tokens/dist/index.js";
3
4
  import { assertUnreachable } from "../../utils/dist/assertUnreachable.js";
4
5
  import { mapTextVariantFixtureToValue } from "./mapTextVariantFixtureToValue.js";
5
6
  import { mapColorFixtureToValue } from "./utils/mapColorFixtureToValue.js";
6
- import { SCALE_EFFECTS } from "../../motion-tokens/dist/index.js";
7
7
  //#region ../automated-config/dist/properties.js
8
8
  /*! © 2026 Yahoo, Inc. UDS Default Config v0.0.0-development */
9
9
  const isInputWrapperCtx = (context) => {
@@ -0,0 +1,213 @@
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_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_IconSlot = require("../../IconSlot.cjs");
9
+ const require_components_client_SpringMotionConfig = require("../SpringMotionConfig.cjs");
10
+ const require_components_client_Button_ButtonBase = require("./ButtonBase.cjs");
11
+ require("./buttonConstants.cjs");
12
+ let _yahoo_uds_icons = require("@yahoo/uds-icons");
13
+ let react = require("react");
14
+ react = require_runtime.__toESM(react);
15
+ let react_jsx_runtime = require("react/jsx-runtime");
16
+ let motion_react = require("motion/react");
17
+ //#region src/components/client/Button/Button.tsx
18
+ const iconContainerMotionVariants = {
19
+ hide: {
20
+ display: "none",
21
+ width: "0px",
22
+ opacity: 0
23
+ },
24
+ loading: {
25
+ display: "flex",
26
+ width: "auto",
27
+ opacity: 1
28
+ },
29
+ icon: {
30
+ display: "flex",
31
+ width: "auto",
32
+ opacity: 1
33
+ }
34
+ };
35
+ const SCALE_DOWN = .7;
36
+ const hiddenState = {
37
+ scale: SCALE_DOWN,
38
+ opacity: 0
39
+ };
40
+ const visibleState = {
41
+ scale: [
42
+ SCALE_DOWN,
43
+ SCALE_DOWN,
44
+ 1
45
+ ],
46
+ opacity: [
47
+ 0,
48
+ 0,
49
+ 1
50
+ ],
51
+ transition: { times: [
52
+ 0,
53
+ .5,
54
+ 1
55
+ ] }
56
+ };
57
+ const iconMotionVariants = {
58
+ hide: hiddenState,
59
+ icon: visibleState,
60
+ loading: hiddenState
61
+ };
62
+ const loadingMotionVariants = {
63
+ hide: hiddenState,
64
+ icon: hiddenState,
65
+ loading: visibleState
66
+ };
67
+ /**
68
+ * **🖲️ A button element that can be used to trigger an action**
69
+ *
70
+ * @componentType Client component
71
+ */
72
+ const Button = (0, react.forwardRef)(function Button(props, forwardedRef) {
73
+ const prefersReducedMotion = (0, motion_react.useReducedMotion)();
74
+ const disableMotion = !!props.disableEffects || !!props.disabled;
75
+ const layoutVariant = prefersReducedMotion ? "smooth" : "subtle";
76
+ const endVariant = props.endIcon ? "icon" : "hide";
77
+ const gapVariant = props.loading || props.startIcon || props.endIcon ? "withIcon" : "withoutIcon";
78
+ const startVariant = props.loading ? "loading" : props.startIcon ? "icon" : "hide";
79
+ const Slot = (0, react.useMemo)(() => require_utils_createSlot.createSlot(), []);
80
+ const MotionSlot = (0, react.useMemo)(() => motion_react.m.create(Slot), [Slot]);
81
+ const buttonVariants = (0, react.useMemo)(() => ({
82
+ rest: { scale: disableMotion ? 1 : `var(${require_index.BUTTON_SCALE_EFFECT_REST})` },
83
+ hover: { scale: disableMotion ? 1 : `var(${require_index.BUTTON_SCALE_EFFECT_HOVER})` },
84
+ pressed: { scale: disableMotion ? 1 : `var(${require_index.BUTTON_SCALE_EFFECT_PRESSED})` },
85
+ withIcon: { columnGap: `var(${require_index.BUTTON_GAP_VAR})` },
86
+ withoutIcon: { columnGap: "0px" }
87
+ }), [disableMotion]);
88
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Button_ButtonBase.ButtonBase, {
89
+ ...props,
90
+ ref: forwardedRef,
91
+ renderStartContent: ({ iconVariant, loading, startIcon, iconContainerClassName, loadingIconClassName, iconClassName, startIconClassName, startIconSlotProps }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.span, {
92
+ className: iconContainerClassName,
93
+ initial: false,
94
+ variants: iconContainerMotionVariants,
95
+ animate: startVariant,
96
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(motion_react.AnimatePresence, {
97
+ initial: false,
98
+ mode: "popLayout",
99
+ children: [loading && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.span, {
100
+ variants: loadingMotionVariants,
101
+ initial: "hide",
102
+ animate: "loading",
103
+ exit: "hide",
104
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Icon.Icon, {
105
+ className: loadingIconClassName,
106
+ size: "sm",
107
+ name: _yahoo_uds_icons.Progress,
108
+ variant: iconVariant,
109
+ color: "current"
110
+ })
111
+ }, "loading"), startIcon && !loading && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.span, {
112
+ variants: iconMotionVariants,
113
+ initial: "hide",
114
+ animate: "icon",
115
+ exit: "hide",
116
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
117
+ className: [iconClassName, startIconClassName].filter(Boolean).join(" "),
118
+ icon: startIcon,
119
+ iconProps: {
120
+ size: "sm",
121
+ variant: iconVariant,
122
+ color: "current"
123
+ },
124
+ ...startIconSlotProps
125
+ })
126
+ })]
127
+ })
128
+ }),
129
+ renderEndContent: ({ endIcon, iconVariant, iconContainerClassName, iconClassName, endIconClassName, endIconSlotProps }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.span, {
130
+ className: iconContainerClassName,
131
+ initial: false,
132
+ variants: iconContainerMotionVariants,
133
+ animate: endVariant,
134
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.AnimatePresence, {
135
+ initial: false,
136
+ mode: "popLayout",
137
+ children: endIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.span, {
138
+ variants: iconMotionVariants,
139
+ initial: "hide",
140
+ animate: "icon",
141
+ exit: "hide",
142
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
143
+ className: [iconClassName, endIconClassName].filter(Boolean).join(" "),
144
+ icon: endIcon,
145
+ iconProps: {
146
+ size: "sm",
147
+ variant: iconVariant,
148
+ color: "current"
149
+ },
150
+ ...endIconSlotProps
151
+ })
152
+ })
153
+ })
154
+ }),
155
+ renderRoot: ({ asChild, children, buttonRef, type, rootClassName, rest, contentClassName, contentSlotProps, startContent, endContent }) => {
156
+ if (asChild && (0, react.isValidElement)(children)) {
157
+ const childProps = children.props;
158
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_SpringMotionConfig.SpringMotionConfig, {
159
+ layoutSpeed: "3",
160
+ layoutVariant,
161
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MotionSlot, {
162
+ type,
163
+ className: rootClassName,
164
+ initial: ["rest", gapVariant],
165
+ animate: [
166
+ "hide",
167
+ "rest",
168
+ gapVariant
169
+ ],
170
+ variants: buttonVariants,
171
+ whileHover: "hover",
172
+ whileTap: "pressed",
173
+ ...rest,
174
+ children: require_components_client_Button_ButtonBase.renderButtonChildren(children, childProps, startContent, contentClassName, contentSlotProps, endContent)
175
+ })
176
+ });
177
+ }
178
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_SpringMotionConfig.SpringMotionConfig, {
179
+ layoutSpeed: "3",
180
+ layoutVariant,
181
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(motion_react.m.button, {
182
+ ref: buttonRef,
183
+ type,
184
+ className: rootClassName,
185
+ initial: ["rest", gapVariant],
186
+ animate: [
187
+ "hide",
188
+ "rest",
189
+ gapVariant
190
+ ],
191
+ variants: buttonVariants,
192
+ whileHover: "hover",
193
+ whileTap: "pressed",
194
+ ...rest,
195
+ children: [
196
+ startContent,
197
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
198
+ className: contentClassName,
199
+ ...contentSlotProps,
200
+ children
201
+ }),
202
+ endContent
203
+ ]
204
+ })
205
+ });
206
+ }
207
+ });
208
+ });
209
+ Button.displayName = "Button";
210
+ //#endregion
211
+ exports.Button = Button;
212
+ exports.iconMotionVariants = iconMotionVariants;
213
+ exports.loadingMotionVariants = loadingMotionVariants;
@@ -0,0 +1,50 @@
1
+
2
+ import { ButtonProps as ButtonProps$1 } from "./ButtonBase.cjs";
3
+ import React, { ForwardRefExoticComponent } from "react";
4
+ import { HTMLMotionProps } from "motion/react";
5
+
6
+ //#region src/components/client/Button/Button.d.ts
7
+ declare const iconMotionVariants: {
8
+ hide: {
9
+ scale: number;
10
+ opacity: number;
11
+ };
12
+ icon: {
13
+ scale: number[];
14
+ opacity: number[];
15
+ transition: {
16
+ times: number[];
17
+ };
18
+ };
19
+ loading: {
20
+ scale: number;
21
+ opacity: number;
22
+ };
23
+ };
24
+ declare const loadingMotionVariants: {
25
+ hide: {
26
+ scale: number;
27
+ opacity: number;
28
+ };
29
+ icon: {
30
+ scale: number;
31
+ opacity: number;
32
+ };
33
+ loading: {
34
+ scale: number[];
35
+ opacity: number[];
36
+ transition: {
37
+ times: number[];
38
+ };
39
+ };
40
+ };
41
+ type HtmlButtonProps = Omit<HTMLMotionProps<'button'>, 'color' | 'name'> & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'color'>;
42
+ type ButtonProps = ButtonProps$1 & HtmlButtonProps;
43
+ /**
44
+ * **🖲️ A button element that can be used to trigger an action**
45
+ *
46
+ * @componentType Client component
47
+ */
48
+ declare const Button: ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
49
+ //#endregion
50
+ export { Button, type ButtonProps, iconMotionVariants, loadingMotionVariants };
@@ -0,0 +1,51 @@
1
+
2
+ "use client";
3
+ import { ButtonProps as ButtonProps$1 } from "./ButtonBase.js";
4
+ import React, { ForwardRefExoticComponent } from "react";
5
+ import { HTMLMotionProps } from "motion/react";
6
+
7
+ //#region src/components/client/Button/Button.d.ts
8
+ declare const iconMotionVariants: {
9
+ hide: {
10
+ scale: number;
11
+ opacity: number;
12
+ };
13
+ icon: {
14
+ scale: number[];
15
+ opacity: number[];
16
+ transition: {
17
+ times: number[];
18
+ };
19
+ };
20
+ loading: {
21
+ scale: number;
22
+ opacity: number;
23
+ };
24
+ };
25
+ declare const loadingMotionVariants: {
26
+ hide: {
27
+ scale: number;
28
+ opacity: number;
29
+ };
30
+ icon: {
31
+ scale: number;
32
+ opacity: number;
33
+ };
34
+ loading: {
35
+ scale: number[];
36
+ opacity: number[];
37
+ transition: {
38
+ times: number[];
39
+ };
40
+ };
41
+ };
42
+ type HtmlButtonProps = Omit<HTMLMotionProps<'button'>, 'color' | 'name'> & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'color'>;
43
+ type ButtonProps = ButtonProps$1 & HtmlButtonProps;
44
+ /**
45
+ * **🖲️ A button element that can be used to trigger an action**
46
+ *
47
+ * @componentType Client component
48
+ */
49
+ declare const Button: ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
50
+ //#endregion
51
+ export { Button, type ButtonProps, iconMotionVariants, loadingMotionVariants };
@@ -0,0 +1,208 @@
1
+ /*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
2
+ "use client";
3
+ import { BUTTON_GAP_VAR, 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 { IconSlot } from "../../IconSlot.js";
7
+ import { SpringMotionConfig } from "../SpringMotionConfig.js";
8
+ import { ButtonBase, renderButtonChildren } from "./ButtonBase.js";
9
+ import "./buttonConstants.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/Button/Button.tsx
15
+ const iconContainerMotionVariants = {
16
+ hide: {
17
+ display: "none",
18
+ width: "0px",
19
+ opacity: 0
20
+ },
21
+ loading: {
22
+ display: "flex",
23
+ width: "auto",
24
+ opacity: 1
25
+ },
26
+ icon: {
27
+ display: "flex",
28
+ width: "auto",
29
+ opacity: 1
30
+ }
31
+ };
32
+ const SCALE_DOWN = .7;
33
+ const hiddenState = {
34
+ scale: SCALE_DOWN,
35
+ opacity: 0
36
+ };
37
+ const visibleState = {
38
+ scale: [
39
+ SCALE_DOWN,
40
+ SCALE_DOWN,
41
+ 1
42
+ ],
43
+ opacity: [
44
+ 0,
45
+ 0,
46
+ 1
47
+ ],
48
+ transition: { times: [
49
+ 0,
50
+ .5,
51
+ 1
52
+ ] }
53
+ };
54
+ const iconMotionVariants = {
55
+ hide: hiddenState,
56
+ icon: visibleState,
57
+ loading: hiddenState
58
+ };
59
+ const loadingMotionVariants = {
60
+ hide: hiddenState,
61
+ icon: hiddenState,
62
+ loading: visibleState
63
+ };
64
+ /**
65
+ * **🖲️ A button element that can be used to trigger an action**
66
+ *
67
+ * @componentType Client component
68
+ */
69
+ const Button = forwardRef(function Button(props, forwardedRef) {
70
+ const prefersReducedMotion = useReducedMotion();
71
+ const disableMotion = !!props.disableEffects || !!props.disabled;
72
+ const layoutVariant = prefersReducedMotion ? "smooth" : "subtle";
73
+ const endVariant = props.endIcon ? "icon" : "hide";
74
+ const gapVariant = props.loading || props.startIcon || props.endIcon ? "withIcon" : "withoutIcon";
75
+ const startVariant = props.loading ? "loading" : props.startIcon ? "icon" : "hide";
76
+ const Slot = useMemo(() => createSlot(), []);
77
+ const MotionSlot = useMemo(() => m.create(Slot), [Slot]);
78
+ const buttonVariants = useMemo(() => ({
79
+ rest: { scale: disableMotion ? 1 : `var(${BUTTON_SCALE_EFFECT_REST})` },
80
+ hover: { scale: disableMotion ? 1 : `var(${BUTTON_SCALE_EFFECT_HOVER})` },
81
+ pressed: { scale: disableMotion ? 1 : `var(${BUTTON_SCALE_EFFECT_PRESSED})` },
82
+ withIcon: { columnGap: `var(${BUTTON_GAP_VAR})` },
83
+ withoutIcon: { columnGap: "0px" }
84
+ }), [disableMotion]);
85
+ return /* @__PURE__ */ jsx(ButtonBase, {
86
+ ...props,
87
+ ref: forwardedRef,
88
+ renderStartContent: ({ iconVariant, loading, startIcon, iconContainerClassName, loadingIconClassName, iconClassName, startIconClassName, startIconSlotProps }) => /* @__PURE__ */ jsx(m.span, {
89
+ className: iconContainerClassName,
90
+ initial: false,
91
+ variants: iconContainerMotionVariants,
92
+ animate: startVariant,
93
+ children: /* @__PURE__ */ jsxs(AnimatePresence, {
94
+ initial: false,
95
+ mode: "popLayout",
96
+ children: [loading && /* @__PURE__ */ jsx(m.span, {
97
+ variants: loadingMotionVariants,
98
+ initial: "hide",
99
+ animate: "loading",
100
+ exit: "hide",
101
+ children: /* @__PURE__ */ jsx(Icon, {
102
+ className: loadingIconClassName,
103
+ size: "sm",
104
+ name: Progress,
105
+ variant: iconVariant,
106
+ color: "current"
107
+ })
108
+ }, "loading"), startIcon && !loading && /* @__PURE__ */ jsx(m.span, {
109
+ variants: iconMotionVariants,
110
+ initial: "hide",
111
+ animate: "icon",
112
+ exit: "hide",
113
+ children: /* @__PURE__ */ jsx(IconSlot, {
114
+ className: [iconClassName, startIconClassName].filter(Boolean).join(" "),
115
+ icon: startIcon,
116
+ iconProps: {
117
+ size: "sm",
118
+ variant: iconVariant,
119
+ color: "current"
120
+ },
121
+ ...startIconSlotProps
122
+ })
123
+ })]
124
+ })
125
+ }),
126
+ renderEndContent: ({ endIcon, iconVariant, iconContainerClassName, iconClassName, endIconClassName, endIconSlotProps }) => /* @__PURE__ */ jsx(m.span, {
127
+ className: iconContainerClassName,
128
+ initial: false,
129
+ variants: iconContainerMotionVariants,
130
+ animate: endVariant,
131
+ children: /* @__PURE__ */ jsx(AnimatePresence, {
132
+ initial: false,
133
+ mode: "popLayout",
134
+ children: endIcon && /* @__PURE__ */ jsx(m.span, {
135
+ variants: iconMotionVariants,
136
+ initial: "hide",
137
+ animate: "icon",
138
+ exit: "hide",
139
+ children: /* @__PURE__ */ jsx(IconSlot, {
140
+ className: [iconClassName, endIconClassName].filter(Boolean).join(" "),
141
+ icon: endIcon,
142
+ iconProps: {
143
+ size: "sm",
144
+ variant: iconVariant,
145
+ color: "current"
146
+ },
147
+ ...endIconSlotProps
148
+ })
149
+ })
150
+ })
151
+ }),
152
+ renderRoot: ({ asChild, children, buttonRef, type, rootClassName, rest, contentClassName, contentSlotProps, startContent, endContent }) => {
153
+ if (asChild && isValidElement(children)) {
154
+ const childProps = children.props;
155
+ return /* @__PURE__ */ jsx(SpringMotionConfig, {
156
+ layoutSpeed: "3",
157
+ layoutVariant,
158
+ children: /* @__PURE__ */ jsx(MotionSlot, {
159
+ type,
160
+ className: rootClassName,
161
+ initial: ["rest", gapVariant],
162
+ animate: [
163
+ "hide",
164
+ "rest",
165
+ gapVariant
166
+ ],
167
+ variants: buttonVariants,
168
+ whileHover: "hover",
169
+ whileTap: "pressed",
170
+ ...rest,
171
+ children: renderButtonChildren(children, childProps, startContent, contentClassName, contentSlotProps, endContent)
172
+ })
173
+ });
174
+ }
175
+ return /* @__PURE__ */ jsx(SpringMotionConfig, {
176
+ layoutSpeed: "3",
177
+ layoutVariant,
178
+ children: /* @__PURE__ */ jsxs(m.button, {
179
+ ref: buttonRef,
180
+ type,
181
+ className: rootClassName,
182
+ initial: ["rest", gapVariant],
183
+ animate: [
184
+ "hide",
185
+ "rest",
186
+ gapVariant
187
+ ],
188
+ variants: buttonVariants,
189
+ whileHover: "hover",
190
+ whileTap: "pressed",
191
+ ...rest,
192
+ children: [
193
+ startContent,
194
+ /* @__PURE__ */ jsx("span", {
195
+ className: contentClassName,
196
+ ...contentSlotProps,
197
+ children
198
+ }),
199
+ endContent
200
+ ]
201
+ })
202
+ });
203
+ }
204
+ });
205
+ });
206
+ Button.displayName = "Button";
207
+ //#endregion
208
+ export { Button, iconMotionVariants, loadingMotionVariants };
@@ -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;