@yahoo/uds 3.159.2 → 3.161.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 (165) 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/BottomSheet/BottomSheet.cjs +2 -2
  4. package/dist/components/client/BottomSheet/BottomSheet.js +2 -2
  5. package/dist/components/client/Button/Button.cjs +214 -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 +209 -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/Checkbox.cjs +2 -1
  22. package/dist/components/client/Checkbox.js +3 -2
  23. package/dist/components/client/Chip/ChipBase.cjs +2 -2
  24. package/dist/components/client/Chip/ChipBase.js +2 -2
  25. package/dist/components/client/IconButton/IconButton.cjs +105 -0
  26. package/dist/components/client/IconButton/IconButton.d.cts +17 -0
  27. package/dist/components/client/IconButton/IconButton.d.ts +18 -0
  28. package/dist/components/client/IconButton/IconButton.js +103 -0
  29. package/dist/components/client/IconButton/IconButtonBase.cjs +68 -0
  30. package/dist/components/client/IconButton/IconButtonBase.d.cts +45 -0
  31. package/dist/components/client/IconButton/IconButtonBase.d.ts +46 -0
  32. package/dist/components/client/IconButton/IconButtonBase.js +65 -0
  33. package/dist/components/client/IconButton/index.cjs +8 -0
  34. package/dist/components/client/IconButton/index.d.cts +4 -0
  35. package/dist/components/client/IconButton/index.d.ts +5 -0
  36. package/dist/components/client/IconButton/index.js +5 -0
  37. package/dist/components/client/Input/Input.cjs +2 -2
  38. package/dist/components/client/Input/Input.js +2 -2
  39. package/dist/components/client/Modal/ManagedModal.cjs +2 -2
  40. package/dist/components/client/Modal/ManagedModal.js +2 -2
  41. package/dist/components/client/Modal/Modal.cjs +2 -2
  42. package/dist/components/client/Modal/Modal.js +2 -2
  43. package/dist/components/client/Popover/Popover.cjs +2 -2
  44. package/dist/components/client/Popover/Popover.js +2 -2
  45. package/dist/components/client/Radio/Radio.cjs +2 -1
  46. package/dist/components/client/Radio/Radio.js +3 -2
  47. package/dist/components/client/SpringMotionConfig.cjs +10 -13
  48. package/dist/components/client/SpringMotionConfig.js +10 -13
  49. package/dist/components/client/Switch/Switch.cjs +119 -0
  50. package/dist/components/client/{Switch.d.cts → Switch/Switch.d.cts} +4 -16
  51. package/dist/components/client/{Switch.d.ts → Switch/Switch.d.ts} +4 -16
  52. package/dist/components/client/Switch/Switch.js +115 -0
  53. package/dist/components/client/Switch/SwitchBase.cjs +129 -0
  54. package/dist/components/client/Switch/SwitchBase.d.cts +29 -0
  55. package/dist/components/client/Switch/SwitchBase.d.ts +30 -0
  56. package/dist/components/client/Switch/SwitchBase.js +126 -0
  57. package/dist/components/client/Switch/index.cjs +5 -0
  58. package/dist/components/client/Switch/index.d.cts +3 -0
  59. package/dist/components/client/Switch/index.d.ts +4 -0
  60. package/dist/components/client/Switch/index.js +4 -0
  61. package/dist/components/client/Switch/switchStyles.cjs +17 -0
  62. package/dist/components/client/Switch/switchStyles.d.cts +9 -0
  63. package/dist/components/client/Switch/switchStyles.d.ts +10 -0
  64. package/dist/components/client/Switch/switchStyles.js +16 -0
  65. package/dist/components/client/Switch/types.cjs +2 -0
  66. package/dist/components/client/Switch/types.d.cts +33 -0
  67. package/dist/components/client/Switch/types.d.ts +34 -0
  68. package/dist/components/client/Switch/types.js +2 -0
  69. package/dist/components/client/Tabs/TabList.cjs +2 -2
  70. package/dist/components/client/Tabs/TabList.js +2 -2
  71. package/dist/components/client/Toast/Toast.cjs +4 -4
  72. package/dist/components/client/Toast/Toast.d.cts +1 -1
  73. package/dist/components/client/Toast/Toast.d.ts +1 -1
  74. package/dist/components/client/Toast/Toast.js +3 -3
  75. package/dist/components/client/Toast/UDSToastConfigProvider.d.cts +1 -1
  76. package/dist/components/client/Toast/UDSToastConfigProvider.d.ts +1 -1
  77. package/dist/components/client/index.cjs +6 -6
  78. package/dist/components/client/index.d.cts +3 -3
  79. package/dist/components/client/index.d.ts +3 -3
  80. package/dist/components/client/index.js +3 -3
  81. package/dist/components/experimental/client/index.cjs +0 -6
  82. package/dist/components/experimental/client/index.d.cts +1 -3
  83. package/dist/components/experimental/client/index.d.ts +1 -3
  84. package/dist/components/experimental/client/index.js +1 -3
  85. package/dist/components/experimental/index.cjs +0 -5
  86. package/dist/components/experimental/index.d.cts +1 -3
  87. package/dist/components/experimental/index.d.ts +1 -3
  88. package/dist/components/experimental/index.js +1 -3
  89. package/dist/components/index.cjs +6 -6
  90. package/dist/components/index.d.cts +3 -3
  91. package/dist/components/index.d.ts +3 -3
  92. package/dist/components/index.js +3 -3
  93. package/dist/css-animation/Button/Button.cjs +85 -0
  94. package/dist/css-animation/Button/Button.d.cts +13 -0
  95. package/dist/css-animation/Button/Button.d.ts +14 -0
  96. package/dist/css-animation/Button/Button.js +82 -0
  97. package/dist/css-animation/Button/index.cjs +5 -0
  98. package/dist/css-animation/Button/index.d.cts +4 -0
  99. package/dist/css-animation/Button/index.d.ts +5 -0
  100. package/dist/css-animation/Button/index.js +4 -0
  101. package/dist/css-animation/IconButton/IconButton.cjs +55 -0
  102. package/dist/css-animation/IconButton/IconButton.d.cts +13 -0
  103. package/dist/css-animation/IconButton/IconButton.d.ts +14 -0
  104. package/dist/css-animation/IconButton/IconButton.js +53 -0
  105. package/dist/css-animation/IconButton/index.cjs +5 -0
  106. package/dist/css-animation/IconButton/index.d.cts +4 -0
  107. package/dist/css-animation/IconButton/index.d.ts +5 -0
  108. package/dist/css-animation/IconButton/index.js +4 -0
  109. package/dist/css-animation/Switch/Switch.cjs +44 -0
  110. package/dist/css-animation/Switch/Switch.d.cts +22 -0
  111. package/dist/css-animation/Switch/Switch.d.ts +23 -0
  112. package/dist/css-animation/Switch/Switch.js +41 -0
  113. package/dist/css-animation/Switch/SwitchStaticHandle.cjs +56 -0
  114. package/dist/css-animation/Switch/SwitchStaticHandle.d.cts +31 -0
  115. package/dist/css-animation/Switch/SwitchStaticHandle.d.ts +32 -0
  116. package/dist/css-animation/Switch/SwitchStaticHandle.js +54 -0
  117. package/dist/css-animation/Switch/index.cjs +5 -0
  118. package/dist/css-animation/Switch/index.d.cts +3 -0
  119. package/dist/css-animation/Switch/index.d.ts +4 -0
  120. package/dist/css-animation/Switch/index.js +4 -0
  121. package/dist/css-animation/index.cjs +9 -0
  122. package/dist/css-animation/index.d.cts +7 -0
  123. package/dist/css-animation/index.d.ts +8 -0
  124. package/dist/css-animation/index.js +6 -0
  125. package/dist/hooks/usePrefersReducedMotion.cjs +36 -0
  126. package/dist/hooks/usePrefersReducedMotion.d.cts +5 -0
  127. package/dist/hooks/usePrefersReducedMotion.d.ts +5 -0
  128. package/dist/hooks/usePrefersReducedMotion.js +34 -0
  129. package/dist/index.cjs +7 -7
  130. package/dist/index.d.cts +3 -3
  131. package/dist/index.d.ts +3 -3
  132. package/dist/index.js +4 -4
  133. package/dist/styles/styler.d.cts +24 -24
  134. package/dist/styles/styler.d.ts +24 -24
  135. package/dist/tailwind-internal/dist/utils/getShadowStyles.d.cts +2 -2
  136. package/dist/tailwind-internal/dist/utils/getShadowStyles.d.ts +2 -2
  137. package/dist/uds/generated/componentData.cjs +372 -381
  138. package/dist/uds/generated/componentData.js +372 -381
  139. package/dist/uds/generated/tailwindPurge.cjs +8 -21
  140. package/dist/uds/generated/tailwindPurge.js +8 -21
  141. package/dist/uds/package.cjs +12 -2
  142. package/dist/uds/package.js +12 -2
  143. package/generated/componentData.json +572 -603
  144. package/generated/tailwindPurge.ts +3 -3
  145. package/package.json +13 -3
  146. package/dist/components/client/Button.cjs +0 -326
  147. package/dist/components/client/Button.d.cts +0 -86
  148. package/dist/components/client/Button.d.ts +0 -87
  149. package/dist/components/client/Button.js +0 -321
  150. package/dist/components/client/IconButton.cjs +0 -161
  151. package/dist/components/client/IconButton.d.cts +0 -46
  152. package/dist/components/client/IconButton.d.ts +0 -47
  153. package/dist/components/client/IconButton.js +0 -159
  154. package/dist/components/client/Switch.cjs +0 -225
  155. package/dist/components/client/Switch.js +0 -222
  156. package/dist/components/client/buttonConstants.d.cts +0 -7
  157. package/dist/components/client/buttonConstants.d.ts +0 -8
  158. package/dist/components/experimental/client/AvoidMotionLibraryProvider.cjs +0 -14
  159. package/dist/components/experimental/client/AvoidMotionLibraryProvider.d.cts +0 -8
  160. package/dist/components/experimental/client/AvoidMotionLibraryProvider.d.ts +0 -9
  161. package/dist/components/experimental/client/AvoidMotionLibraryProvider.js +0 -11
  162. package/dist/components/experimental/client/SwitchV2.cjs +0 -190
  163. package/dist/components/experimental/client/SwitchV2.d.cts +0 -46
  164. package/dist/components/experimental/client/SwitchV2.d.ts +0 -47
  165. 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) => {
@@ -5,6 +5,7 @@ require("../../../_virtual/_rolldown/runtime.cjs");
5
5
  const require_styles_styler = require("../../../styles/styler.cjs");
6
6
  const require_components_Box = require("../../Box.cjs");
7
7
  const require_components_Scrim = require("../../Scrim.cjs");
8
+ const require_hooks_usePrefersReducedMotion = require("../../../hooks/usePrefersReducedMotion.cjs");
8
9
  const require_utils_exposeAriakitScrollbarWidth = require("../../../utils/exposeAriakitScrollbarWidth.cjs");
9
10
  const require_components_client_BottomSheet_BottomSheetHandle = require("./BottomSheetHandle.cjs");
10
11
  const require_components_client_BottomSheet_BottomSheetInternalContext = require("./BottomSheetInternalContext.cjs");
@@ -19,7 +20,6 @@ const require_components_client_BottomSheet_useVirtualKeyboard = require("./useV
19
20
  let react = require("react");
20
21
  let react_jsx_runtime = require("react/jsx-runtime");
21
22
  let _ariakit_react = require("@ariakit/react");
22
- let motion_react = require("motion/react");
23
23
  //#region src/components/client/BottomSheet/BottomSheet.tsx
24
24
  /**
25
25
  * Drag-to-dismiss distance threshold as a ratio of the lowest snap point's
@@ -43,7 +43,7 @@ function BottomSheet({ children, className: sheetClassName, controller: controll
43
43
  const isOpen = dialogStore.useState().open;
44
44
  const keyboardHeightPx = require_components_client_BottomSheet_useVirtualKeyboard.useVirtualKeyboard(isOpen);
45
45
  const viewportHeightPx = require_components_client_BottomSheet_useViewportHeight.useViewportHeight();
46
- const prefersReducedMotion = (0, motion_react.useReducedMotion)() ?? false;
46
+ const prefersReducedMotion = require_hooks_usePrefersReducedMotion.usePrefersReducedMotion();
47
47
  const reducedMotion = forceReduceMotion || prefersReducedMotion;
48
48
  const isDraggingRef = (0, react.useRef)(false);
49
49
  const forceZeroMarginsRef = (0, react.useRef)(false);
@@ -3,6 +3,7 @@
3
3
  import { cx, getStyles } from "../../../styles/styler.js";
4
4
  import { Box } from "../../Box.js";
5
5
  import { Scrim } from "../../Scrim.js";
6
+ import { usePrefersReducedMotion } from "../../../hooks/usePrefersReducedMotion.js";
6
7
  import { exposeAriakitScrollbarWidth } from "../../../utils/exposeAriakitScrollbarWidth.js";
7
8
  import { BottomSheetHandle } from "./BottomSheetHandle.js";
8
9
  import { BottomSheetInternalContext } from "./BottomSheetInternalContext.js";
@@ -17,7 +18,6 @@ import { useVirtualKeyboard } from "./useVirtualKeyboard.js";
17
18
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef } from "react";
18
19
  import { jsx, jsxs } from "react/jsx-runtime";
19
20
  import { Dialog, useDialogContext } from "@ariakit/react";
20
- import { useReducedMotion } from "motion/react";
21
21
  //#region src/components/client/BottomSheet/BottomSheet.tsx
22
22
  /**
23
23
  * Drag-to-dismiss distance threshold as a ratio of the lowest snap point's
@@ -41,7 +41,7 @@ function BottomSheet({ children, className: sheetClassName, controller: controll
41
41
  const isOpen = dialogStore.useState().open;
42
42
  const keyboardHeightPx = useVirtualKeyboard(isOpen);
43
43
  const viewportHeightPx = useViewportHeight();
44
- const prefersReducedMotion = useReducedMotion() ?? false;
44
+ const prefersReducedMotion = usePrefersReducedMotion();
45
45
  const reducedMotion = forceReduceMotion || prefersReducedMotion;
46
46
  const isDraggingRef = useRef(false);
47
47
  const forceZeroMarginsRef = useRef(false);
@@ -0,0 +1,214 @@
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_hooks_usePrefersReducedMotion = require("../../../hooks/usePrefersReducedMotion.cjs");
10
+ const require_components_client_SpringMotionConfig = require("../SpringMotionConfig.cjs");
11
+ const require_components_client_Button_ButtonBase = require("./ButtonBase.cjs");
12
+ require("./buttonConstants.cjs");
13
+ let _yahoo_uds_icons = require("@yahoo/uds-icons");
14
+ let react = require("react");
15
+ react = require_runtime.__toESM(react);
16
+ let react_jsx_runtime = require("react/jsx-runtime");
17
+ let motion_react = require("motion/react");
18
+ //#region src/components/client/Button/Button.tsx
19
+ const iconContainerMotionVariants = {
20
+ hide: {
21
+ display: "none",
22
+ width: "0px",
23
+ opacity: 0
24
+ },
25
+ loading: {
26
+ display: "flex",
27
+ width: "auto",
28
+ opacity: 1
29
+ },
30
+ icon: {
31
+ display: "flex",
32
+ width: "auto",
33
+ opacity: 1
34
+ }
35
+ };
36
+ const SCALE_DOWN = .7;
37
+ const hiddenState = {
38
+ scale: SCALE_DOWN,
39
+ opacity: 0
40
+ };
41
+ const visibleState = {
42
+ scale: [
43
+ SCALE_DOWN,
44
+ SCALE_DOWN,
45
+ 1
46
+ ],
47
+ opacity: [
48
+ 0,
49
+ 0,
50
+ 1
51
+ ],
52
+ transition: { times: [
53
+ 0,
54
+ .5,
55
+ 1
56
+ ] }
57
+ };
58
+ const iconMotionVariants = {
59
+ hide: hiddenState,
60
+ icon: visibleState,
61
+ loading: hiddenState
62
+ };
63
+ const loadingMotionVariants = {
64
+ hide: hiddenState,
65
+ icon: hiddenState,
66
+ loading: visibleState
67
+ };
68
+ /**
69
+ * **🖲️ A button element that can be used to trigger an action**
70
+ *
71
+ * @componentType Client component
72
+ */
73
+ const Button = (0, react.forwardRef)(function Button(props, forwardedRef) {
74
+ const prefersReducedMotion = require_hooks_usePrefersReducedMotion.usePrefersReducedMotion();
75
+ const disableMotion = !!props.disableEffects || !!props.disabled;
76
+ const layoutVariant = prefersReducedMotion ? "smooth" : "subtle";
77
+ const endVariant = props.endIcon ? "icon" : "hide";
78
+ const gapVariant = props.loading || props.startIcon || props.endIcon ? "withIcon" : "withoutIcon";
79
+ const startVariant = props.loading ? "loading" : props.startIcon ? "icon" : "hide";
80
+ const Slot = (0, react.useMemo)(() => require_utils_createSlot.createSlot(), []);
81
+ const MotionSlot = (0, react.useMemo)(() => motion_react.m.create(Slot), [Slot]);
82
+ const buttonVariants = (0, react.useMemo)(() => ({
83
+ rest: { scale: disableMotion ? 1 : `var(${require_index.BUTTON_SCALE_EFFECT_REST})` },
84
+ hover: { scale: disableMotion ? 1 : `var(${require_index.BUTTON_SCALE_EFFECT_HOVER})` },
85
+ pressed: { scale: disableMotion ? 1 : `var(${require_index.BUTTON_SCALE_EFFECT_PRESSED})` },
86
+ withIcon: { columnGap: `var(${require_index.BUTTON_GAP_VAR})` },
87
+ withoutIcon: { columnGap: "0px" }
88
+ }), [disableMotion]);
89
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Button_ButtonBase.ButtonBase, {
90
+ ...props,
91
+ ref: forwardedRef,
92
+ renderStartContent: ({ iconVariant, loading, startIcon, iconContainerClassName, loadingIconClassName, iconClassName, startIconClassName, startIconSlotProps }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.span, {
93
+ className: iconContainerClassName,
94
+ initial: false,
95
+ variants: iconContainerMotionVariants,
96
+ animate: startVariant,
97
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(motion_react.AnimatePresence, {
98
+ initial: false,
99
+ mode: "popLayout",
100
+ children: [loading && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.span, {
101
+ variants: loadingMotionVariants,
102
+ initial: "hide",
103
+ animate: "loading",
104
+ exit: "hide",
105
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Icon.Icon, {
106
+ className: loadingIconClassName,
107
+ size: "sm",
108
+ name: _yahoo_uds_icons.Progress,
109
+ variant: iconVariant,
110
+ color: "current"
111
+ })
112
+ }, "loading"), startIcon && !loading && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.span, {
113
+ variants: iconMotionVariants,
114
+ initial: "hide",
115
+ animate: "icon",
116
+ exit: "hide",
117
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
118
+ className: [iconClassName, startIconClassName].filter(Boolean).join(" "),
119
+ icon: startIcon,
120
+ iconProps: {
121
+ size: "sm",
122
+ variant: iconVariant,
123
+ color: "current"
124
+ },
125
+ ...startIconSlotProps
126
+ })
127
+ })]
128
+ })
129
+ }),
130
+ renderEndContent: ({ endIcon, iconVariant, iconContainerClassName, iconClassName, endIconClassName, endIconSlotProps }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.span, {
131
+ className: iconContainerClassName,
132
+ initial: false,
133
+ variants: iconContainerMotionVariants,
134
+ animate: endVariant,
135
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.AnimatePresence, {
136
+ initial: false,
137
+ mode: "popLayout",
138
+ children: endIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.span, {
139
+ variants: iconMotionVariants,
140
+ initial: "hide",
141
+ animate: "icon",
142
+ exit: "hide",
143
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
144
+ className: [iconClassName, endIconClassName].filter(Boolean).join(" "),
145
+ icon: endIcon,
146
+ iconProps: {
147
+ size: "sm",
148
+ variant: iconVariant,
149
+ color: "current"
150
+ },
151
+ ...endIconSlotProps
152
+ })
153
+ })
154
+ })
155
+ }),
156
+ renderRoot: ({ asChild, children, buttonRef, type, rootClassName, rest, contentClassName, contentSlotProps, startContent, endContent }) => {
157
+ if (asChild && (0, react.isValidElement)(children)) {
158
+ const childProps = children.props;
159
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_SpringMotionConfig.SpringMotionConfig, {
160
+ layoutSpeed: "3",
161
+ layoutVariant,
162
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MotionSlot, {
163
+ type,
164
+ className: rootClassName,
165
+ initial: ["rest", gapVariant],
166
+ animate: [
167
+ "hide",
168
+ "rest",
169
+ gapVariant
170
+ ],
171
+ variants: buttonVariants,
172
+ whileHover: "hover",
173
+ whileTap: "pressed",
174
+ ...rest,
175
+ children: require_components_client_Button_ButtonBase.renderButtonChildren(children, childProps, startContent, contentClassName, contentSlotProps, endContent)
176
+ })
177
+ });
178
+ }
179
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_SpringMotionConfig.SpringMotionConfig, {
180
+ layoutSpeed: "3",
181
+ layoutVariant,
182
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(motion_react.m.button, {
183
+ ref: buttonRef,
184
+ type,
185
+ className: rootClassName,
186
+ initial: ["rest", gapVariant],
187
+ animate: [
188
+ "hide",
189
+ "rest",
190
+ gapVariant
191
+ ],
192
+ variants: buttonVariants,
193
+ whileHover: "hover",
194
+ whileTap: "pressed",
195
+ ...rest,
196
+ children: [
197
+ startContent,
198
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
199
+ className: contentClassName,
200
+ ...contentSlotProps,
201
+ children
202
+ }),
203
+ endContent
204
+ ]
205
+ })
206
+ });
207
+ }
208
+ });
209
+ });
210
+ Button.displayName = "Button";
211
+ //#endregion
212
+ exports.Button = Button;
213
+ exports.iconMotionVariants = iconMotionVariants;
214
+ 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,209 @@
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 { usePrefersReducedMotion } from "../../../hooks/usePrefersReducedMotion.js";
8
+ import { SpringMotionConfig } from "../SpringMotionConfig.js";
9
+ import { ButtonBase, renderButtonChildren } from "./ButtonBase.js";
10
+ import "./buttonConstants.js";
11
+ import { Progress } from "@yahoo/uds-icons";
12
+ import { forwardRef, isValidElement, useMemo } from "react";
13
+ import { jsx, jsxs } from "react/jsx-runtime";
14
+ import { AnimatePresence, m } from "motion/react";
15
+ //#region src/components/client/Button/Button.tsx
16
+ const iconContainerMotionVariants = {
17
+ hide: {
18
+ display: "none",
19
+ width: "0px",
20
+ opacity: 0
21
+ },
22
+ loading: {
23
+ display: "flex",
24
+ width: "auto",
25
+ opacity: 1
26
+ },
27
+ icon: {
28
+ display: "flex",
29
+ width: "auto",
30
+ opacity: 1
31
+ }
32
+ };
33
+ const SCALE_DOWN = .7;
34
+ const hiddenState = {
35
+ scale: SCALE_DOWN,
36
+ opacity: 0
37
+ };
38
+ const visibleState = {
39
+ scale: [
40
+ SCALE_DOWN,
41
+ SCALE_DOWN,
42
+ 1
43
+ ],
44
+ opacity: [
45
+ 0,
46
+ 0,
47
+ 1
48
+ ],
49
+ transition: { times: [
50
+ 0,
51
+ .5,
52
+ 1
53
+ ] }
54
+ };
55
+ const iconMotionVariants = {
56
+ hide: hiddenState,
57
+ icon: visibleState,
58
+ loading: hiddenState
59
+ };
60
+ const loadingMotionVariants = {
61
+ hide: hiddenState,
62
+ icon: hiddenState,
63
+ loading: visibleState
64
+ };
65
+ /**
66
+ * **🖲️ A button element that can be used to trigger an action**
67
+ *
68
+ * @componentType Client component
69
+ */
70
+ const Button = forwardRef(function Button(props, forwardedRef) {
71
+ const prefersReducedMotion = usePrefersReducedMotion();
72
+ const disableMotion = !!props.disableEffects || !!props.disabled;
73
+ const layoutVariant = prefersReducedMotion ? "smooth" : "subtle";
74
+ const endVariant = props.endIcon ? "icon" : "hide";
75
+ const gapVariant = props.loading || props.startIcon || props.endIcon ? "withIcon" : "withoutIcon";
76
+ const startVariant = props.loading ? "loading" : props.startIcon ? "icon" : "hide";
77
+ const Slot = useMemo(() => createSlot(), []);
78
+ const MotionSlot = useMemo(() => m.create(Slot), [Slot]);
79
+ const buttonVariants = useMemo(() => ({
80
+ rest: { scale: disableMotion ? 1 : `var(${BUTTON_SCALE_EFFECT_REST})` },
81
+ hover: { scale: disableMotion ? 1 : `var(${BUTTON_SCALE_EFFECT_HOVER})` },
82
+ pressed: { scale: disableMotion ? 1 : `var(${BUTTON_SCALE_EFFECT_PRESSED})` },
83
+ withIcon: { columnGap: `var(${BUTTON_GAP_VAR})` },
84
+ withoutIcon: { columnGap: "0px" }
85
+ }), [disableMotion]);
86
+ return /* @__PURE__ */ jsx(ButtonBase, {
87
+ ...props,
88
+ ref: forwardedRef,
89
+ renderStartContent: ({ iconVariant, loading, startIcon, iconContainerClassName, loadingIconClassName, iconClassName, startIconClassName, startIconSlotProps }) => /* @__PURE__ */ jsx(m.span, {
90
+ className: iconContainerClassName,
91
+ initial: false,
92
+ variants: iconContainerMotionVariants,
93
+ animate: startVariant,
94
+ children: /* @__PURE__ */ jsxs(AnimatePresence, {
95
+ initial: false,
96
+ mode: "popLayout",
97
+ children: [loading && /* @__PURE__ */ jsx(m.span, {
98
+ variants: loadingMotionVariants,
99
+ initial: "hide",
100
+ animate: "loading",
101
+ exit: "hide",
102
+ children: /* @__PURE__ */ jsx(Icon, {
103
+ className: loadingIconClassName,
104
+ size: "sm",
105
+ name: Progress,
106
+ variant: iconVariant,
107
+ color: "current"
108
+ })
109
+ }, "loading"), startIcon && !loading && /* @__PURE__ */ jsx(m.span, {
110
+ variants: iconMotionVariants,
111
+ initial: "hide",
112
+ animate: "icon",
113
+ exit: "hide",
114
+ children: /* @__PURE__ */ jsx(IconSlot, {
115
+ className: [iconClassName, startIconClassName].filter(Boolean).join(" "),
116
+ icon: startIcon,
117
+ iconProps: {
118
+ size: "sm",
119
+ variant: iconVariant,
120
+ color: "current"
121
+ },
122
+ ...startIconSlotProps
123
+ })
124
+ })]
125
+ })
126
+ }),
127
+ renderEndContent: ({ endIcon, iconVariant, iconContainerClassName, iconClassName, endIconClassName, endIconSlotProps }) => /* @__PURE__ */ jsx(m.span, {
128
+ className: iconContainerClassName,
129
+ initial: false,
130
+ variants: iconContainerMotionVariants,
131
+ animate: endVariant,
132
+ children: /* @__PURE__ */ jsx(AnimatePresence, {
133
+ initial: false,
134
+ mode: "popLayout",
135
+ children: endIcon && /* @__PURE__ */ jsx(m.span, {
136
+ variants: iconMotionVariants,
137
+ initial: "hide",
138
+ animate: "icon",
139
+ exit: "hide",
140
+ children: /* @__PURE__ */ jsx(IconSlot, {
141
+ className: [iconClassName, endIconClassName].filter(Boolean).join(" "),
142
+ icon: endIcon,
143
+ iconProps: {
144
+ size: "sm",
145
+ variant: iconVariant,
146
+ color: "current"
147
+ },
148
+ ...endIconSlotProps
149
+ })
150
+ })
151
+ })
152
+ }),
153
+ renderRoot: ({ asChild, children, buttonRef, type, rootClassName, rest, contentClassName, contentSlotProps, startContent, endContent }) => {
154
+ if (asChild && isValidElement(children)) {
155
+ const childProps = children.props;
156
+ return /* @__PURE__ */ jsx(SpringMotionConfig, {
157
+ layoutSpeed: "3",
158
+ layoutVariant,
159
+ children: /* @__PURE__ */ jsx(MotionSlot, {
160
+ type,
161
+ className: rootClassName,
162
+ initial: ["rest", gapVariant],
163
+ animate: [
164
+ "hide",
165
+ "rest",
166
+ gapVariant
167
+ ],
168
+ variants: buttonVariants,
169
+ whileHover: "hover",
170
+ whileTap: "pressed",
171
+ ...rest,
172
+ children: renderButtonChildren(children, childProps, startContent, contentClassName, contentSlotProps, endContent)
173
+ })
174
+ });
175
+ }
176
+ return /* @__PURE__ */ jsx(SpringMotionConfig, {
177
+ layoutSpeed: "3",
178
+ layoutVariant,
179
+ children: /* @__PURE__ */ jsxs(m.button, {
180
+ ref: buttonRef,
181
+ type,
182
+ className: rootClassName,
183
+ initial: ["rest", gapVariant],
184
+ animate: [
185
+ "hide",
186
+ "rest",
187
+ gapVariant
188
+ ],
189
+ variants: buttonVariants,
190
+ whileHover: "hover",
191
+ whileTap: "pressed",
192
+ ...rest,
193
+ children: [
194
+ startContent,
195
+ /* @__PURE__ */ jsx("span", {
196
+ className: contentClassName,
197
+ ...contentSlotProps,
198
+ children
199
+ }),
200
+ endContent
201
+ ]
202
+ })
203
+ });
204
+ }
205
+ });
206
+ });
207
+ Button.displayName = "Button";
208
+ //#endregion
209
+ export { Button, iconMotionVariants, loadingMotionVariants };