@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.
- package/dist/automated-config/dist/properties.cjs +1 -1
- package/dist/automated-config/dist/properties.js +1 -1
- package/dist/components/client/BottomSheet/BottomSheet.cjs +2 -2
- package/dist/components/client/BottomSheet/BottomSheet.js +2 -2
- package/dist/components/client/Button/Button.cjs +214 -0
- package/dist/components/client/Button/Button.d.cts +50 -0
- package/dist/components/client/Button/Button.d.ts +51 -0
- package/dist/components/client/Button/Button.js +209 -0
- package/dist/components/client/Button/ButtonBase.cjs +120 -0
- package/dist/components/client/Button/ButtonBase.d.cts +52 -0
- package/dist/components/client/Button/ButtonBase.d.ts +53 -0
- package/dist/components/client/Button/ButtonBase.js +116 -0
- package/dist/components/client/{buttonConstants.cjs → Button/buttonConstants.cjs} +1 -1
- package/dist/components/client/Button/buttonConstants.d.cts +7 -0
- package/dist/components/client/Button/buttonConstants.d.ts +8 -0
- package/dist/components/client/{buttonConstants.js → Button/buttonConstants.js} +1 -1
- package/dist/components/client/Button/index.cjs +10 -0
- package/dist/components/client/Button/index.d.cts +4 -0
- package/dist/components/client/Button/index.d.ts +5 -0
- package/dist/components/client/Button/index.js +5 -0
- package/dist/components/client/Checkbox.cjs +2 -1
- package/dist/components/client/Checkbox.js +3 -2
- package/dist/components/client/Chip/ChipBase.cjs +2 -2
- package/dist/components/client/Chip/ChipBase.js +2 -2
- package/dist/components/client/IconButton/IconButton.cjs +105 -0
- package/dist/components/client/IconButton/IconButton.d.cts +17 -0
- package/dist/components/client/IconButton/IconButton.d.ts +18 -0
- package/dist/components/client/IconButton/IconButton.js +103 -0
- package/dist/components/client/IconButton/IconButtonBase.cjs +68 -0
- package/dist/components/client/IconButton/IconButtonBase.d.cts +45 -0
- package/dist/components/client/IconButton/IconButtonBase.d.ts +46 -0
- package/dist/components/client/IconButton/IconButtonBase.js +65 -0
- package/dist/components/client/IconButton/index.cjs +8 -0
- package/dist/components/client/IconButton/index.d.cts +4 -0
- package/dist/components/client/IconButton/index.d.ts +5 -0
- package/dist/components/client/IconButton/index.js +5 -0
- package/dist/components/client/Input/Input.cjs +2 -2
- package/dist/components/client/Input/Input.js +2 -2
- package/dist/components/client/Modal/ManagedModal.cjs +2 -2
- package/dist/components/client/Modal/ManagedModal.js +2 -2
- package/dist/components/client/Modal/Modal.cjs +2 -2
- package/dist/components/client/Modal/Modal.js +2 -2
- package/dist/components/client/Popover/Popover.cjs +2 -2
- package/dist/components/client/Popover/Popover.js +2 -2
- package/dist/components/client/Radio/Radio.cjs +2 -1
- package/dist/components/client/Radio/Radio.js +3 -2
- package/dist/components/client/SpringMotionConfig.cjs +10 -13
- package/dist/components/client/SpringMotionConfig.js +10 -13
- package/dist/components/client/Switch/Switch.cjs +119 -0
- package/dist/components/client/{Switch.d.cts → Switch/Switch.d.cts} +4 -16
- package/dist/components/client/{Switch.d.ts → Switch/Switch.d.ts} +4 -16
- package/dist/components/client/Switch/Switch.js +115 -0
- package/dist/components/client/Switch/SwitchBase.cjs +129 -0
- package/dist/components/client/Switch/SwitchBase.d.cts +29 -0
- package/dist/components/client/Switch/SwitchBase.d.ts +30 -0
- package/dist/components/client/Switch/SwitchBase.js +126 -0
- package/dist/components/client/Switch/index.cjs +5 -0
- package/dist/components/client/Switch/index.d.cts +3 -0
- package/dist/components/client/Switch/index.d.ts +4 -0
- package/dist/components/client/Switch/index.js +4 -0
- package/dist/components/client/Switch/switchStyles.cjs +17 -0
- package/dist/components/client/Switch/switchStyles.d.cts +9 -0
- package/dist/components/client/Switch/switchStyles.d.ts +10 -0
- package/dist/components/client/Switch/switchStyles.js +16 -0
- package/dist/components/client/Switch/types.cjs +2 -0
- package/dist/components/client/Switch/types.d.cts +33 -0
- package/dist/components/client/Switch/types.d.ts +34 -0
- package/dist/components/client/Switch/types.js +2 -0
- package/dist/components/client/Tabs/TabList.cjs +2 -2
- package/dist/components/client/Tabs/TabList.js +2 -2
- package/dist/components/client/Toast/Toast.cjs +4 -4
- package/dist/components/client/Toast/Toast.d.cts +1 -1
- package/dist/components/client/Toast/Toast.d.ts +1 -1
- package/dist/components/client/Toast/Toast.js +3 -3
- package/dist/components/client/Toast/UDSToastConfigProvider.d.cts +1 -1
- package/dist/components/client/Toast/UDSToastConfigProvider.d.ts +1 -1
- package/dist/components/client/index.cjs +6 -6
- package/dist/components/client/index.d.cts +3 -3
- package/dist/components/client/index.d.ts +3 -3
- package/dist/components/client/index.js +3 -3
- package/dist/components/experimental/client/index.cjs +0 -6
- package/dist/components/experimental/client/index.d.cts +1 -3
- package/dist/components/experimental/client/index.d.ts +1 -3
- package/dist/components/experimental/client/index.js +1 -3
- package/dist/components/experimental/index.cjs +0 -5
- package/dist/components/experimental/index.d.cts +1 -3
- package/dist/components/experimental/index.d.ts +1 -3
- package/dist/components/experimental/index.js +1 -3
- package/dist/components/index.cjs +6 -6
- package/dist/components/index.d.cts +3 -3
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.js +3 -3
- package/dist/css-animation/Button/Button.cjs +85 -0
- package/dist/css-animation/Button/Button.d.cts +13 -0
- package/dist/css-animation/Button/Button.d.ts +14 -0
- package/dist/css-animation/Button/Button.js +82 -0
- package/dist/css-animation/Button/index.cjs +5 -0
- package/dist/css-animation/Button/index.d.cts +4 -0
- package/dist/css-animation/Button/index.d.ts +5 -0
- package/dist/css-animation/Button/index.js +4 -0
- package/dist/css-animation/IconButton/IconButton.cjs +55 -0
- package/dist/css-animation/IconButton/IconButton.d.cts +13 -0
- package/dist/css-animation/IconButton/IconButton.d.ts +14 -0
- package/dist/css-animation/IconButton/IconButton.js +53 -0
- package/dist/css-animation/IconButton/index.cjs +5 -0
- package/dist/css-animation/IconButton/index.d.cts +4 -0
- package/dist/css-animation/IconButton/index.d.ts +5 -0
- package/dist/css-animation/IconButton/index.js +4 -0
- package/dist/css-animation/Switch/Switch.cjs +44 -0
- package/dist/css-animation/Switch/Switch.d.cts +22 -0
- package/dist/css-animation/Switch/Switch.d.ts +23 -0
- package/dist/css-animation/Switch/Switch.js +41 -0
- package/dist/css-animation/Switch/SwitchStaticHandle.cjs +56 -0
- package/dist/css-animation/Switch/SwitchStaticHandle.d.cts +31 -0
- package/dist/css-animation/Switch/SwitchStaticHandle.d.ts +32 -0
- package/dist/css-animation/Switch/SwitchStaticHandle.js +54 -0
- package/dist/css-animation/Switch/index.cjs +5 -0
- package/dist/css-animation/Switch/index.d.cts +3 -0
- package/dist/css-animation/Switch/index.d.ts +4 -0
- package/dist/css-animation/Switch/index.js +4 -0
- package/dist/css-animation/index.cjs +9 -0
- package/dist/css-animation/index.d.cts +7 -0
- package/dist/css-animation/index.d.ts +8 -0
- package/dist/css-animation/index.js +6 -0
- package/dist/hooks/usePrefersReducedMotion.cjs +36 -0
- package/dist/hooks/usePrefersReducedMotion.d.cts +5 -0
- package/dist/hooks/usePrefersReducedMotion.d.ts +5 -0
- package/dist/hooks/usePrefersReducedMotion.js +34 -0
- package/dist/index.cjs +7 -7
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -4
- package/dist/styles/styler.d.cts +24 -24
- package/dist/styles/styler.d.ts +24 -24
- package/dist/tailwind-internal/dist/utils/getShadowStyles.d.cts +2 -2
- package/dist/tailwind-internal/dist/utils/getShadowStyles.d.ts +2 -2
- package/dist/uds/generated/componentData.cjs +372 -381
- package/dist/uds/generated/componentData.js +372 -381
- package/dist/uds/generated/tailwindPurge.cjs +8 -21
- package/dist/uds/generated/tailwindPurge.js +8 -21
- package/dist/uds/package.cjs +12 -2
- package/dist/uds/package.js +12 -2
- package/generated/componentData.json +572 -603
- package/generated/tailwindPurge.ts +3 -3
- package/package.json +13 -3
- package/dist/components/client/Button.cjs +0 -326
- package/dist/components/client/Button.d.cts +0 -86
- package/dist/components/client/Button.d.ts +0 -87
- package/dist/components/client/Button.js +0 -321
- package/dist/components/client/IconButton.cjs +0 -161
- package/dist/components/client/IconButton.d.cts +0 -46
- package/dist/components/client/IconButton.d.ts +0 -47
- package/dist/components/client/IconButton.js +0 -159
- package/dist/components/client/Switch.cjs +0 -225
- package/dist/components/client/Switch.js +0 -222
- package/dist/components/client/buttonConstants.d.cts +0 -7
- package/dist/components/client/buttonConstants.d.ts +0 -8
- package/dist/components/experimental/client/AvoidMotionLibraryProvider.cjs +0 -14
- package/dist/components/experimental/client/AvoidMotionLibraryProvider.d.cts +0 -8
- package/dist/components/experimental/client/AvoidMotionLibraryProvider.d.ts +0 -9
- package/dist/components/experimental/client/AvoidMotionLibraryProvider.js +0 -11
- package/dist/components/experimental/client/SwitchV2.cjs +0 -190
- package/dist/components/experimental/client/SwitchV2.d.cts +0 -46
- package/dist/components/experimental/client/SwitchV2.d.ts +0 -47
- package/dist/components/experimental/client/SwitchV2.js +0 -185
|
@@ -0,0 +1,103 @@
|
|
|
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 { usePrefersReducedMotion } from "../../../hooks/usePrefersReducedMotion.js";
|
|
7
|
+
import { SpringMotionConfig } from "../SpringMotionConfig.js";
|
|
8
|
+
import "../Button/buttonConstants.js";
|
|
9
|
+
import { iconMotionVariants, loadingMotionVariants } from "../Button/Button.js";
|
|
10
|
+
import { IconButtonBase, renderIconButtonAsChild } from "./IconButtonBase.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/IconButton/IconButton.tsx
|
|
16
|
+
/**
|
|
17
|
+
* **⚙️️ An icon button element that can be used to trigger an action**
|
|
18
|
+
*
|
|
19
|
+
* @componentType Client component
|
|
20
|
+
*/
|
|
21
|
+
const IconButton = forwardRef(function IconButton(props, forwardedRef) {
|
|
22
|
+
const prefersReducedMotion = usePrefersReducedMotion();
|
|
23
|
+
const disableMotion = !!props.disableEffects || !!props.disabled;
|
|
24
|
+
const layoutVariant = useMemo(() => prefersReducedMotion ? "smooth" : "subtle", [prefersReducedMotion]);
|
|
25
|
+
const Slot = useMemo(() => createSlot(), []);
|
|
26
|
+
const MotionSlot = useMemo(() => m.create(Slot), [Slot]);
|
|
27
|
+
const buttonVariants = useMemo(() => ({
|
|
28
|
+
rest: { scale: disableMotion ? 1 : `var(${BUTTON_SCALE_EFFECT_REST})` },
|
|
29
|
+
hover: { scale: disableMotion ? 1 : `var(${BUTTON_SCALE_EFFECT_HOVER})` },
|
|
30
|
+
pressed: { scale: disableMotion ? 1 : `var(${BUTTON_SCALE_EFFECT_PRESSED})` }
|
|
31
|
+
}), [disableMotion]);
|
|
32
|
+
return /* @__PURE__ */ jsx(IconButtonBase, {
|
|
33
|
+
...props,
|
|
34
|
+
ref: forwardedRef,
|
|
35
|
+
renderIconContent: ({ asChild, loading, name, iconVariant, children, iconClassName, loadingIconClassName, iconSlotClassName, iconSlotProps }) => /* @__PURE__ */ jsxs(AnimatePresence, {
|
|
36
|
+
initial: false,
|
|
37
|
+
mode: "popLayout",
|
|
38
|
+
children: [loading && /* @__PURE__ */ jsx(m.span, {
|
|
39
|
+
variants: loadingMotionVariants,
|
|
40
|
+
initial: "loading",
|
|
41
|
+
animate: "loading",
|
|
42
|
+
exit: "hide",
|
|
43
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
44
|
+
size: "sm",
|
|
45
|
+
name: Progress,
|
|
46
|
+
variant: iconVariant,
|
|
47
|
+
color: "current",
|
|
48
|
+
className: loadingIconClassName
|
|
49
|
+
})
|
|
50
|
+
}, "loading"), name && !loading && /* @__PURE__ */ jsx(m.span, {
|
|
51
|
+
variants: iconMotionVariants,
|
|
52
|
+
initial: "icon",
|
|
53
|
+
animate: "icon",
|
|
54
|
+
exit: "hide",
|
|
55
|
+
children: !asChild && children || /* @__PURE__ */ jsx(Icon, {
|
|
56
|
+
size: "sm",
|
|
57
|
+
name,
|
|
58
|
+
variant: iconVariant,
|
|
59
|
+
color: "current",
|
|
60
|
+
className: [iconClassName, iconSlotClassName].filter(Boolean).join(" "),
|
|
61
|
+
...iconSlotProps
|
|
62
|
+
})
|
|
63
|
+
}, name.name)]
|
|
64
|
+
}),
|
|
65
|
+
renderRoot: ({ asChild, children, buttonRef, type, htmlName, rootClassName, rest, iconContent }) => {
|
|
66
|
+
if (asChild && isValidElement(children)) return /* @__PURE__ */ jsx(SpringMotionConfig, {
|
|
67
|
+
layoutSpeed: "3",
|
|
68
|
+
layoutVariant,
|
|
69
|
+
reducedMotion: props.disableEffects ? "always" : "user",
|
|
70
|
+
children: /* @__PURE__ */ jsx(MotionSlot, {
|
|
71
|
+
type,
|
|
72
|
+
className: rootClassName,
|
|
73
|
+
initial: "icon",
|
|
74
|
+
variants: buttonVariants,
|
|
75
|
+
whileHover: "hover",
|
|
76
|
+
whileTap: "pressed",
|
|
77
|
+
...rest,
|
|
78
|
+
children: renderIconButtonAsChild(children, iconContent)
|
|
79
|
+
})
|
|
80
|
+
});
|
|
81
|
+
return /* @__PURE__ */ jsx(SpringMotionConfig, {
|
|
82
|
+
layoutSpeed: "3",
|
|
83
|
+
layoutVariant,
|
|
84
|
+
reducedMotion: props.disableEffects ? "always" : "user",
|
|
85
|
+
children: /* @__PURE__ */ jsx(m.button, {
|
|
86
|
+
ref: buttonRef,
|
|
87
|
+
type,
|
|
88
|
+
className: rootClassName,
|
|
89
|
+
name: htmlName,
|
|
90
|
+
initial: "icon",
|
|
91
|
+
variants: buttonVariants,
|
|
92
|
+
whileHover: "hover",
|
|
93
|
+
whileTap: "pressed",
|
|
94
|
+
...rest,
|
|
95
|
+
children: iconContent
|
|
96
|
+
})
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
IconButton.displayName = "IconButton";
|
|
102
|
+
//#endregion
|
|
103
|
+
export { IconButton };
|
|
@@ -0,0 +1,68 @@
|
|
|
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_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
|
+
//#region src/components/client/IconButton/IconButtonBase.tsx
|
|
10
|
+
const defaultSizeRootClass = require_generateDefaultClassName.generateDefaultClassName("iconbutton", "size", "root");
|
|
11
|
+
const defaultSizeIconClass = require_generateDefaultClassName.generateDefaultClassName("iconbutton", "size", "icon");
|
|
12
|
+
const defaultVariantRootClass = require_generateDefaultClassName.generateDefaultClassName("button", "variant", "root");
|
|
13
|
+
const defaultVariantIconClass = require_generateDefaultClassName.generateDefaultClassName("button", "variant", "icon");
|
|
14
|
+
const IconButtonBase = (0, react.forwardRef)(function IconButtonBase({ variant, size, iconVariant, loading, disableEffects, name, asChild = false, slotProps, type = "button", htmlName, className, children, renderIconContent, renderRoot, ...rest }, forwardedRef) {
|
|
15
|
+
const { className: iconSlotClassName, ...iconSlotProps } = slotProps?.icon ?? {};
|
|
16
|
+
const Slot = (0, react.useMemo)(() => require_utils_createSlot.createSlot(), []);
|
|
17
|
+
const rootSizeClass = (0, react.useMemo)(() => size ? require_styles_styler.getStyles({ iconbuttonSizeRoot: size }) : defaultSizeRootClass, [size]);
|
|
18
|
+
const rootVariantClass = (0, react.useMemo)(() => variant ? require_styles_styler.getStyles({ buttonVariantRoot: variant }) : defaultVariantRootClass, [variant]);
|
|
19
|
+
const iconSizeClass = (0, react.useMemo)(() => size ? require_styles_styler.getStyles({ iconbuttonSizeIcon: size }) : defaultSizeIconClass, [size]);
|
|
20
|
+
const iconVariantClass = (0, react.useMemo)(() => variant ? require_styles_styler.getStyles({ buttonVariantIcon: variant }) : defaultVariantIconClass, [variant]);
|
|
21
|
+
const styles = (0, react.useMemo)(() => ({
|
|
22
|
+
root: require_styles_styler.cx("uds-ring", "uds-hit-target", "inline-flex overflow-hidden justify-center items-center", "[transform-origin:center]", "[backface-visibility:hidden]", "[transition-property:color,background-color,border-color,box-shadow,text-decoration-color,fill,stroke]", "[transition-timing-function:cubic-bezier(0,0,0.2,1)]", "[transition-duration:220ms]", rootSizeClass, rootVariantClass, rest?.disabled && "cursor-not-allowed", loading && "uds-button-loading", disableEffects && "uds-button-without-effects", className),
|
|
23
|
+
icon: require_styles_styler.getStyles({ className: require_styles_styler.cx(iconSizeClass, iconVariantClass) }),
|
|
24
|
+
loadingIcon: require_styles_styler.getStyles({ className: require_styles_styler.cx([
|
|
25
|
+
"animate-spin",
|
|
26
|
+
iconSizeClass,
|
|
27
|
+
iconVariantClass
|
|
28
|
+
]) })
|
|
29
|
+
}), [
|
|
30
|
+
className,
|
|
31
|
+
disableEffects,
|
|
32
|
+
iconSizeClass,
|
|
33
|
+
iconVariantClass,
|
|
34
|
+
loading,
|
|
35
|
+
rest?.disabled,
|
|
36
|
+
rootSizeClass,
|
|
37
|
+
rootVariantClass
|
|
38
|
+
]);
|
|
39
|
+
return renderRoot({
|
|
40
|
+
asChild,
|
|
41
|
+
Slot,
|
|
42
|
+
children,
|
|
43
|
+
buttonRef: forwardedRef,
|
|
44
|
+
type,
|
|
45
|
+
htmlName,
|
|
46
|
+
rootClassName: styles.root,
|
|
47
|
+
rest,
|
|
48
|
+
iconContent: renderIconContent({
|
|
49
|
+
asChild,
|
|
50
|
+
loading,
|
|
51
|
+
name,
|
|
52
|
+
iconVariant,
|
|
53
|
+
children,
|
|
54
|
+
iconClassName: styles.icon,
|
|
55
|
+
loadingIconClassName: styles.loadingIcon,
|
|
56
|
+
iconSlotClassName,
|
|
57
|
+
iconSlotProps
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
IconButtonBase.displayName = "IconButtonBase";
|
|
62
|
+
function renderIconButtonAsChild(children, content) {
|
|
63
|
+
const childProps = children.props;
|
|
64
|
+
return (0, react.cloneElement)(children, childProps, content);
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
exports.IconButtonBase = IconButtonBase;
|
|
68
|
+
exports.renderIconButtonAsChild = renderIconButtonAsChild;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
import { IconPropsWithSVGProps, UniversalIconButtonProps } from "../../../tokens/types.cjs";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
import { ForwardRefExoticComponent } from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/components/client/IconButton/IconButtonBase.d.ts
|
|
7
|
+
type HtmlButtonProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'color' | 'name'>;
|
|
8
|
+
type DataAttributes = {
|
|
9
|
+
[name: `data-${string}`]: string;
|
|
10
|
+
};
|
|
11
|
+
interface IconButtonProps extends HtmlButtonProps, UniversalIconButtonProps {
|
|
12
|
+
slotProps?: {
|
|
13
|
+
icon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
type IconButtonRenderArgs = {
|
|
17
|
+
asChild: boolean;
|
|
18
|
+
loading?: boolean;
|
|
19
|
+
name?: IconButtonProps['name'];
|
|
20
|
+
iconVariant: IconButtonProps['iconVariant'];
|
|
21
|
+
children: React.ReactNode;
|
|
22
|
+
iconClassName: string;
|
|
23
|
+
loadingIconClassName: string;
|
|
24
|
+
iconSlotClassName?: string;
|
|
25
|
+
iconSlotProps: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
26
|
+
};
|
|
27
|
+
type IconButtonRootRenderArgs = {
|
|
28
|
+
asChild: boolean;
|
|
29
|
+
Slot: ForwardRefExoticComponent<HtmlButtonProps>;
|
|
30
|
+
children: React.ReactNode;
|
|
31
|
+
buttonRef: React.ForwardedRef<HTMLButtonElement>;
|
|
32
|
+
type: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
|
|
33
|
+
htmlName?: string;
|
|
34
|
+
rootClassName: string;
|
|
35
|
+
rest: Record<string, unknown>;
|
|
36
|
+
iconContent: React.ReactNode;
|
|
37
|
+
};
|
|
38
|
+
interface IconButtonBaseProps extends IconButtonProps {
|
|
39
|
+
renderIconContent: (args: IconButtonRenderArgs) => React.ReactNode;
|
|
40
|
+
renderRoot: (args: IconButtonRootRenderArgs) => React.ReactNode;
|
|
41
|
+
}
|
|
42
|
+
declare const IconButtonBase: ForwardRefExoticComponent<IconButtonBaseProps & _$react.RefAttributes<HTMLButtonElement>>;
|
|
43
|
+
declare function renderIconButtonAsChild(children: React.ReactNode, content: React.ReactNode): _$react.ReactElement<unknown, string | _$react.JSXElementConstructor<any>>;
|
|
44
|
+
//#endregion
|
|
45
|
+
export { IconButtonBase, type IconButtonProps, type IconButtonRootRenderArgs, renderIconButtonAsChild };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { IconPropsWithSVGProps, UniversalIconButtonProps } from "../../../tokens/types.js";
|
|
4
|
+
import * as _$react from "react";
|
|
5
|
+
import { ForwardRefExoticComponent } from "react";
|
|
6
|
+
|
|
7
|
+
//#region src/components/client/IconButton/IconButtonBase.d.ts
|
|
8
|
+
type HtmlButtonProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'color' | 'name'>;
|
|
9
|
+
type DataAttributes = {
|
|
10
|
+
[name: `data-${string}`]: string;
|
|
11
|
+
};
|
|
12
|
+
interface IconButtonProps extends HtmlButtonProps, UniversalIconButtonProps {
|
|
13
|
+
slotProps?: {
|
|
14
|
+
icon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
type IconButtonRenderArgs = {
|
|
18
|
+
asChild: boolean;
|
|
19
|
+
loading?: boolean;
|
|
20
|
+
name?: IconButtonProps['name'];
|
|
21
|
+
iconVariant: IconButtonProps['iconVariant'];
|
|
22
|
+
children: React.ReactNode;
|
|
23
|
+
iconClassName: string;
|
|
24
|
+
loadingIconClassName: string;
|
|
25
|
+
iconSlotClassName?: string;
|
|
26
|
+
iconSlotProps: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
27
|
+
};
|
|
28
|
+
type IconButtonRootRenderArgs = {
|
|
29
|
+
asChild: boolean;
|
|
30
|
+
Slot: ForwardRefExoticComponent<HtmlButtonProps>;
|
|
31
|
+
children: React.ReactNode;
|
|
32
|
+
buttonRef: React.ForwardedRef<HTMLButtonElement>;
|
|
33
|
+
type: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
|
|
34
|
+
htmlName?: string;
|
|
35
|
+
rootClassName: string;
|
|
36
|
+
rest: Record<string, unknown>;
|
|
37
|
+
iconContent: React.ReactNode;
|
|
38
|
+
};
|
|
39
|
+
interface IconButtonBaseProps extends IconButtonProps {
|
|
40
|
+
renderIconContent: (args: IconButtonRenderArgs) => React.ReactNode;
|
|
41
|
+
renderRoot: (args: IconButtonRootRenderArgs) => React.ReactNode;
|
|
42
|
+
}
|
|
43
|
+
declare const IconButtonBase: ForwardRefExoticComponent<IconButtonBaseProps & _$react.RefAttributes<HTMLButtonElement>>;
|
|
44
|
+
declare function renderIconButtonAsChild(children: React.ReactNode, content: React.ReactNode): _$react.ReactElement<unknown, string | _$react.JSXElementConstructor<any>>;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { IconButtonBase, type IconButtonProps, type IconButtonRootRenderArgs, renderIconButtonAsChild };
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
//#region src/components/client/IconButton/IconButtonBase.tsx
|
|
8
|
+
const defaultSizeRootClass = generateDefaultClassName("iconbutton", "size", "root");
|
|
9
|
+
const defaultSizeIconClass = generateDefaultClassName("iconbutton", "size", "icon");
|
|
10
|
+
const defaultVariantRootClass = generateDefaultClassName("button", "variant", "root");
|
|
11
|
+
const defaultVariantIconClass = generateDefaultClassName("button", "variant", "icon");
|
|
12
|
+
const IconButtonBase = forwardRef(function IconButtonBase({ variant, size, iconVariant, loading, disableEffects, name, asChild = false, slotProps, type = "button", htmlName, className, children, renderIconContent, renderRoot, ...rest }, forwardedRef) {
|
|
13
|
+
const { className: iconSlotClassName, ...iconSlotProps } = slotProps?.icon ?? {};
|
|
14
|
+
const Slot = useMemo(() => createSlot(), []);
|
|
15
|
+
const rootSizeClass = useMemo(() => size ? getStyles({ iconbuttonSizeRoot: size }) : defaultSizeRootClass, [size]);
|
|
16
|
+
const rootVariantClass = useMemo(() => variant ? getStyles({ buttonVariantRoot: variant }) : defaultVariantRootClass, [variant]);
|
|
17
|
+
const iconSizeClass = useMemo(() => size ? getStyles({ iconbuttonSizeIcon: size }) : defaultSizeIconClass, [size]);
|
|
18
|
+
const iconVariantClass = useMemo(() => variant ? getStyles({ buttonVariantIcon: variant }) : defaultVariantIconClass, [variant]);
|
|
19
|
+
const styles = useMemo(() => ({
|
|
20
|
+
root: cx("uds-ring", "uds-hit-target", "inline-flex overflow-hidden justify-center items-center", "[transform-origin:center]", "[backface-visibility:hidden]", "[transition-property:color,background-color,border-color,box-shadow,text-decoration-color,fill,stroke]", "[transition-timing-function:cubic-bezier(0,0,0.2,1)]", "[transition-duration:220ms]", rootSizeClass, rootVariantClass, rest?.disabled && "cursor-not-allowed", loading && "uds-button-loading", disableEffects && "uds-button-without-effects", className),
|
|
21
|
+
icon: getStyles({ className: cx(iconSizeClass, iconVariantClass) }),
|
|
22
|
+
loadingIcon: getStyles({ className: cx([
|
|
23
|
+
"animate-spin",
|
|
24
|
+
iconSizeClass,
|
|
25
|
+
iconVariantClass
|
|
26
|
+
]) })
|
|
27
|
+
}), [
|
|
28
|
+
className,
|
|
29
|
+
disableEffects,
|
|
30
|
+
iconSizeClass,
|
|
31
|
+
iconVariantClass,
|
|
32
|
+
loading,
|
|
33
|
+
rest?.disabled,
|
|
34
|
+
rootSizeClass,
|
|
35
|
+
rootVariantClass
|
|
36
|
+
]);
|
|
37
|
+
return renderRoot({
|
|
38
|
+
asChild,
|
|
39
|
+
Slot,
|
|
40
|
+
children,
|
|
41
|
+
buttonRef: forwardedRef,
|
|
42
|
+
type,
|
|
43
|
+
htmlName,
|
|
44
|
+
rootClassName: styles.root,
|
|
45
|
+
rest,
|
|
46
|
+
iconContent: renderIconContent({
|
|
47
|
+
asChild,
|
|
48
|
+
loading,
|
|
49
|
+
name,
|
|
50
|
+
iconVariant,
|
|
51
|
+
children,
|
|
52
|
+
iconClassName: styles.icon,
|
|
53
|
+
loadingIconClassName: styles.loadingIcon,
|
|
54
|
+
iconSlotClassName,
|
|
55
|
+
iconSlotProps
|
|
56
|
+
})
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
IconButtonBase.displayName = "IconButtonBase";
|
|
60
|
+
function renderIconButtonAsChild(children, content) {
|
|
61
|
+
const childProps = children.props;
|
|
62
|
+
return cloneElement(children, childProps, content);
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { IconButtonBase, renderIconButtonAsChild };
|
|
@@ -0,0 +1,8 @@
|
|
|
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_IconButton_IconButtonBase = require("./IconButtonBase.cjs");
|
|
5
|
+
const require_components_client_IconButton_IconButton = require("./IconButton.cjs");
|
|
6
|
+
exports.IconButton = require_components_client_IconButton_IconButton.IconButton;
|
|
7
|
+
exports.IconButtonBase = require_components_client_IconButton_IconButtonBase.IconButtonBase;
|
|
8
|
+
exports.renderIconButtonAsChild = require_components_client_IconButton_IconButtonBase.renderIconButtonAsChild;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
|
|
2
|
+
import { IconButtonBase, IconButtonRootRenderArgs, renderIconButtonAsChild } from "./IconButtonBase.cjs";
|
|
3
|
+
import { IconButton, IconButtonProps } from "./IconButton.cjs";
|
|
4
|
+
export { IconButton, IconButtonBase, type IconButtonProps, type IconButtonRootRenderArgs, renderIconButtonAsChild };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { IconButtonBase, IconButtonRootRenderArgs, renderIconButtonAsChild } from "./IconButtonBase.js";
|
|
4
|
+
import { IconButton, IconButtonProps } from "./IconButton.js";
|
|
5
|
+
export { IconButton, IconButtonBase, type IconButtonProps, type IconButtonRootRenderArgs, renderIconButtonAsChild };
|
|
@@ -7,13 +7,13 @@ const require_components_IconSlot = require("../../IconSlot.cjs");
|
|
|
7
7
|
const require_components_Box = require("../../Box.cjs");
|
|
8
8
|
const require_components_HStack = require("../../HStack.cjs");
|
|
9
9
|
const require_components_VStack = require("../../VStack.cjs");
|
|
10
|
+
const require_hooks_usePrefersReducedMotion = require("../../../hooks/usePrefersReducedMotion.cjs");
|
|
10
11
|
const require_components_client_AnimateHeightChange = require("../AnimateHeightChange.cjs");
|
|
11
12
|
const require_components_client_Input_InputHelpTextInternal = require("./InputHelpTextInternal.cjs");
|
|
12
13
|
let react = require("react");
|
|
13
14
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
14
15
|
let lodash_isFunction_js = require("lodash/isFunction.js");
|
|
15
16
|
lodash_isFunction_js = require_runtime.__toESM(lodash_isFunction_js);
|
|
16
|
-
let motion_react = require("motion/react");
|
|
17
17
|
//#region src/components/client/Input/Input.tsx
|
|
18
18
|
function setNativeInputValue(input, next) {
|
|
19
19
|
(Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set)?.call(input, next);
|
|
@@ -132,7 +132,7 @@ const Input = (0, react.forwardRef)(function Input({ id, label, type = "text", s
|
|
|
132
132
|
onFocus,
|
|
133
133
|
slotProps
|
|
134
134
|
]);
|
|
135
|
-
const layoutVariant =
|
|
135
|
+
const layoutVariant = require_hooks_usePrefersReducedMotion.usePrefersReducedMotion() ? "smooth" : "bouncy";
|
|
136
136
|
const reduceMotion = forceReduceMotion ? "always" : "user";
|
|
137
137
|
const isInteractive = !readOnly && !disabled;
|
|
138
138
|
const classNames = {
|
|
@@ -5,12 +5,12 @@ import { IconSlot } from "../../IconSlot.js";
|
|
|
5
5
|
import { Box } from "../../Box.js";
|
|
6
6
|
import { HStack } from "../../HStack.js";
|
|
7
7
|
import { VStack } from "../../VStack.js";
|
|
8
|
+
import { usePrefersReducedMotion } from "../../../hooks/usePrefersReducedMotion.js";
|
|
8
9
|
import { AnimateHeightChange } from "../AnimateHeightChange.js";
|
|
9
10
|
import { InputHelpTextInternal as InputHelpTextInternalMemo } from "./InputHelpTextInternal.js";
|
|
10
11
|
import { forwardRef, memo, useCallback, useEffect, useId, useImperativeHandle, useRef, useState } from "react";
|
|
11
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
13
|
import { isFunction } from "lodash-es";
|
|
13
|
-
import { useReducedMotion } from "motion/react";
|
|
14
14
|
//#region src/components/client/Input/Input.tsx
|
|
15
15
|
function setNativeInputValue(input, next) {
|
|
16
16
|
(Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set)?.call(input, next);
|
|
@@ -129,7 +129,7 @@ const Input = forwardRef(function Input({ id, label, type = "text", size = "md",
|
|
|
129
129
|
onFocus,
|
|
130
130
|
slotProps
|
|
131
131
|
]);
|
|
132
|
-
const layoutVariant =
|
|
132
|
+
const layoutVariant = usePrefersReducedMotion() ? "smooth" : "bouncy";
|
|
133
133
|
const reduceMotion = forceReduceMotion ? "always" : "user";
|
|
134
134
|
const isInteractive = !readOnly && !disabled;
|
|
135
135
|
const classNames = {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
require("../../../_virtual/_rolldown/runtime.cjs");
|
|
5
|
+
const require_hooks_usePrefersReducedMotion = require("../../../hooks/usePrefersReducedMotion.cjs");
|
|
5
6
|
const require_components_client_Modal_modalStore = require("./modalStore.cjs");
|
|
6
7
|
const require_components_client_Modal_UDSModalConfigProvider = require("./UDSModalConfigProvider.cjs");
|
|
7
8
|
const require_components_client_Modal_ModalActions = require("./ModalActions.cjs");
|
|
@@ -11,12 +12,11 @@ const require_components_client_Modal_ModalTitle = require("./ModalTitle.cjs");
|
|
|
11
12
|
const require_components_client_Modal_Modal = require("./Modal.cjs");
|
|
12
13
|
let react = require("react");
|
|
13
14
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
14
|
-
let motion_react = require("motion/react");
|
|
15
15
|
//#region src/components/client/Modal/ManagedModal.tsx
|
|
16
16
|
const ManagedModal = ({ slot }) => {
|
|
17
17
|
const { animationDuration } = require_components_client_Modal_UDSModalConfigProvider.useModalConfig();
|
|
18
18
|
const durationOut = typeof animationDuration === "number" ? animationDuration : animationDuration.out;
|
|
19
|
-
const exitDuration =
|
|
19
|
+
const exitDuration = require_hooks_usePrefersReducedMotion.usePrefersReducedMotion() || slot.props.reduceMotion ? 0 : durationOut;
|
|
20
20
|
(0, react.useEffect)(() => {
|
|
21
21
|
if (!slot.closing) return;
|
|
22
22
|
const ownerId = slot.ownerId;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
"use client";
|
|
3
|
+
import { usePrefersReducedMotion } from "../../../hooks/usePrefersReducedMotion.js";
|
|
3
4
|
import { closeModalEntry, removeModalEntry } from "./modalStore.js";
|
|
4
5
|
import { useModalConfig } from "./UDSModalConfigProvider.js";
|
|
5
6
|
import { ModalActions } from "./ModalActions.js";
|
|
@@ -9,12 +10,11 @@ import { ModalTitle } from "./ModalTitle.js";
|
|
|
9
10
|
import { Modal } from "./Modal.js";
|
|
10
11
|
import { useEffect } from "react";
|
|
11
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
-
import { useReducedMotion } from "motion/react";
|
|
13
13
|
//#region src/components/client/Modal/ManagedModal.tsx
|
|
14
14
|
const ManagedModal = ({ slot }) => {
|
|
15
15
|
const { animationDuration } = useModalConfig();
|
|
16
16
|
const durationOut = typeof animationDuration === "number" ? animationDuration : animationDuration.out;
|
|
17
|
-
const exitDuration =
|
|
17
|
+
const exitDuration = usePrefersReducedMotion() || slot.props.reduceMotion ? 0 : durationOut;
|
|
18
18
|
useEffect(() => {
|
|
19
19
|
if (!slot.closing) return;
|
|
20
20
|
const ownerId = slot.ownerId;
|
|
@@ -9,6 +9,7 @@ const require_components_Box = require("../../Box.cjs");
|
|
|
9
9
|
const require_components_HStack = require("../../HStack.cjs");
|
|
10
10
|
const require_components_VStack = require("../../VStack.cjs");
|
|
11
11
|
const require_components_Scrim = require("../../Scrim.cjs");
|
|
12
|
+
const require_hooks_usePrefersReducedMotion = require("../../../hooks/usePrefersReducedMotion.cjs");
|
|
12
13
|
const require_utils_exposeAriakitScrollbarWidth = require("../../../utils/exposeAriakitScrollbarWidth.cjs");
|
|
13
14
|
const require_components_client_Modal_ModalContext = require("./ModalContext.cjs");
|
|
14
15
|
const require_components_client_Modal_UDSModalConfigProvider = require("./UDSModalConfigProvider.cjs");
|
|
@@ -21,7 +22,6 @@ let _yahoo_uds_icons = require("@yahoo/uds-icons");
|
|
|
21
22
|
let react = require("react");
|
|
22
23
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
23
24
|
let _ariakit_react = require("@ariakit/react");
|
|
24
|
-
let motion_react = require("motion/react");
|
|
25
25
|
//#region src/components/client/Modal/Modal.tsx
|
|
26
26
|
require_utils_exposeAriakitScrollbarWidth.exposeAriakitScrollbarWidth();
|
|
27
27
|
const Modal = ({ children, open, onClose, onOpen, portal = true, modal = true, includeScrim, closeAriaLabel = "Close", slotProps, hideDismissButton = false, reduceMotion: forceReduceMotion = false, closeIcon = _yahoo_uds_icons.Cross, maxWidth = "auto", maxHeight: maxHeightProp = "auto", fullWidth = false, fullHeight = false, title: titleProp, description: descriptionProp, content: contentProp, actions: actionsProp, scrollBehavior = "outside", className, style }) => {
|
|
@@ -37,7 +37,7 @@ const Modal = ({ children, open, onClose, onOpen, portal = true, modal = true, i
|
|
|
37
37
|
out: animationEasing
|
|
38
38
|
} : animationEasing;
|
|
39
39
|
const { title: modalTitle, description: modalDescription, content: modalContent, actions: modalActions } = require_components_client_Modal_utils.separateChildren(children);
|
|
40
|
-
const reducedMotion =
|
|
40
|
+
const reducedMotion = require_hooks_usePrefersReducedMotion.usePrefersReducedMotion() || forceReduceMotion;
|
|
41
41
|
(0, react.useEffect)(() => {
|
|
42
42
|
if (open && !prevOpen.current) onOpen?.();
|
|
43
43
|
prevOpen.current = open;
|
|
@@ -7,6 +7,7 @@ import { Box } from "../../Box.js";
|
|
|
7
7
|
import { HStack } from "../../HStack.js";
|
|
8
8
|
import { VStack } from "../../VStack.js";
|
|
9
9
|
import { Scrim } from "../../Scrim.js";
|
|
10
|
+
import { usePrefersReducedMotion } from "../../../hooks/usePrefersReducedMotion.js";
|
|
10
11
|
import { exposeAriakitScrollbarWidth } from "../../../utils/exposeAriakitScrollbarWidth.js";
|
|
11
12
|
import { ModalContext } from "./ModalContext.js";
|
|
12
13
|
import { useModalConfig } from "./UDSModalConfigProvider.js";
|
|
@@ -19,7 +20,6 @@ import { Cross } from "@yahoo/uds-icons";
|
|
|
19
20
|
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
20
21
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
21
22
|
import { Dialog, DialogDismiss } from "@ariakit/react";
|
|
22
|
-
import { useReducedMotion } from "motion/react";
|
|
23
23
|
//#region src/components/client/Modal/Modal.tsx
|
|
24
24
|
exposeAriakitScrollbarWidth();
|
|
25
25
|
const Modal = ({ children, open, onClose, onOpen, portal = true, modal = true, includeScrim, closeAriaLabel = "Close", slotProps, hideDismissButton = false, reduceMotion: forceReduceMotion = false, closeIcon = Cross, maxWidth = "auto", maxHeight: maxHeightProp = "auto", fullWidth = false, fullHeight = false, title: titleProp, description: descriptionProp, content: contentProp, actions: actionsProp, scrollBehavior = "outside", className, style }) => {
|
|
@@ -35,7 +35,7 @@ const Modal = ({ children, open, onClose, onOpen, portal = true, modal = true, i
|
|
|
35
35
|
out: animationEasing
|
|
36
36
|
} : animationEasing;
|
|
37
37
|
const { title: modalTitle, description: modalDescription, content: modalContent, actions: modalActions } = separateChildren(children);
|
|
38
|
-
const reducedMotion =
|
|
38
|
+
const reducedMotion = usePrefersReducedMotion() || forceReduceMotion;
|
|
39
39
|
useEffect(() => {
|
|
40
40
|
if (open && !prevOpen.current) onOpen?.();
|
|
41
41
|
prevOpen.current = open;
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
require("../../../_virtual/_rolldown/runtime.cjs");
|
|
5
|
+
const require_hooks_usePrefersReducedMotion = require("../../../hooks/usePrefersReducedMotion.cjs");
|
|
5
6
|
const require_components_client_Popover_PopoverContext = require("./PopoverContext.cjs");
|
|
6
7
|
const require_components_client_Popover_UDSPopoverConfigProvider = require("./UDSPopoverConfigProvider.cjs");
|
|
7
8
|
let react = require("react");
|
|
8
9
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
10
|
let _ariakit_react = require("@ariakit/react");
|
|
10
|
-
let motion_react = require("motion/react");
|
|
11
11
|
//#region src/components/client/Popover/Popover.tsx
|
|
12
12
|
const POPOVER_OPEN_EVENT = "uds:popover-open";
|
|
13
13
|
/**
|
|
@@ -61,7 +61,7 @@ function Popover({ children, placement, open, defaultOpen = false, portal = true
|
|
|
61
61
|
return () => document.removeEventListener(POPOVER_OPEN_EVENT, handler);
|
|
62
62
|
}, [id, store]);
|
|
63
63
|
const isControlled = open !== void 0;
|
|
64
|
-
const reducedMotion =
|
|
64
|
+
const reducedMotion = require_hooks_usePrefersReducedMotion.usePrefersReducedMotion() || forceReduceMotion;
|
|
65
65
|
const animationDuration = reducedMotion ? 0 : animationDurationConfig;
|
|
66
66
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Popover_PopoverContext.PopoverInternalContext.Provider, {
|
|
67
67
|
value: {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
"use client";
|
|
3
|
+
import { usePrefersReducedMotion } from "../../../hooks/usePrefersReducedMotion.js";
|
|
3
4
|
import { PopoverInternalContext } from "./PopoverContext.js";
|
|
4
5
|
import { usePopoverConfig } from "./UDSPopoverConfigProvider.js";
|
|
5
6
|
import { useCallback, useEffect, useId } from "react";
|
|
6
7
|
import { jsx } from "react/jsx-runtime";
|
|
7
8
|
import { PopoverProvider, usePopoverStore } from "@ariakit/react";
|
|
8
|
-
import { useReducedMotion } from "motion/react";
|
|
9
9
|
//#region src/components/client/Popover/Popover.tsx
|
|
10
10
|
const POPOVER_OPEN_EVENT = "uds:popover-open";
|
|
11
11
|
/**
|
|
@@ -59,7 +59,7 @@ function Popover({ children, placement, open, defaultOpen = false, portal = true
|
|
|
59
59
|
return () => document.removeEventListener(POPOVER_OPEN_EVENT, handler);
|
|
60
60
|
}, [id, store]);
|
|
61
61
|
const isControlled = open !== void 0;
|
|
62
|
-
const reducedMotion =
|
|
62
|
+
const reducedMotion = usePrefersReducedMotion() || forceReduceMotion;
|
|
63
63
|
const animationDuration = reducedMotion ? 0 : animationDurationConfig;
|
|
64
64
|
return /* @__PURE__ */ jsx(PopoverInternalContext.Provider, {
|
|
65
65
|
value: {
|
|
@@ -5,6 +5,7 @@ const require_runtime = 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_FormLabel = require("../../FormLabel.cjs");
|
|
8
|
+
const require_hooks_usePrefersReducedMotion = require("../../../hooks/usePrefersReducedMotion.cjs");
|
|
8
9
|
const require_components_client_SpringMotionConfig = require("../SpringMotionConfig.cjs");
|
|
9
10
|
const require_components_client_Radio_useRadioGroup = require("./useRadioGroup.cjs");
|
|
10
11
|
let react = require("react");
|
|
@@ -117,7 +118,7 @@ const Radio = (0, react.forwardRef)(function Radio({ id, name: nameProp, label,
|
|
|
117
118
|
const handleTapEnd = (0, react.useCallback)(() => {
|
|
118
119
|
setIsPressed(false);
|
|
119
120
|
}, []);
|
|
120
|
-
const prefersReducedMotion =
|
|
121
|
+
const prefersReducedMotion = require_hooks_usePrefersReducedMotion.usePrefersReducedMotion();
|
|
121
122
|
const reduceMotion = forceReduceMotion ? "always" : "user";
|
|
122
123
|
const cssAnimationDuration = prefersReducedMotion || forceReduceMotion ? "duration-0" : "duration-120";
|
|
123
124
|
const classNames = {
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
import { cx, getStyles } from "../../../styles/styler.js";
|
|
4
4
|
import { Box } from "../../Box.js";
|
|
5
5
|
import { FormLabel } from "../../FormLabel.js";
|
|
6
|
+
import { usePrefersReducedMotion } from "../../../hooks/usePrefersReducedMotion.js";
|
|
6
7
|
import { SpringMotionConfig } from "../SpringMotionConfig.js";
|
|
7
8
|
import { useRadioGroup } from "./useRadioGroup.js";
|
|
8
9
|
import { forwardRef, useCallback, useId, useMemo, useRef, useState } from "react";
|
|
9
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
import { m
|
|
11
|
+
import { m } from "motion/react";
|
|
11
12
|
//#region src/components/client/Radio/Radio.tsx
|
|
12
13
|
const RADIO_VARIANTS = ["primary", "secondary"];
|
|
13
14
|
const RADIO_SIZES = ["sm", "md"];
|
|
@@ -114,7 +115,7 @@ const Radio = forwardRef(function Radio({ id, name: nameProp, label, labelPositi
|
|
|
114
115
|
const handleTapEnd = useCallback(() => {
|
|
115
116
|
setIsPressed(false);
|
|
116
117
|
}, []);
|
|
117
|
-
const prefersReducedMotion =
|
|
118
|
+
const prefersReducedMotion = usePrefersReducedMotion();
|
|
118
119
|
const reduceMotion = forceReduceMotion ? "always" : "user";
|
|
119
120
|
const cssAnimationDuration = prefersReducedMotion || forceReduceMotion ? "duration-0" : "duration-120";
|
|
120
121
|
const classNames = {
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
4
4
|
require("../../_virtual/_rolldown/runtime.cjs");
|
|
5
5
|
const require_index = require("../../css-tokens/dist/index.cjs");
|
|
6
6
|
const require_index$1 = require("../../motion-tokens/dist/index.cjs");
|
|
7
|
-
const require_components_experimental_client_AvoidMotionLibraryProvider = require("../experimental/client/AvoidMotionLibraryProvider.cjs");
|
|
8
7
|
let react = require("react");
|
|
9
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
9
|
let motion_react = require("motion/react");
|
|
@@ -72,22 +71,20 @@ function SpringMotionConfig({ children, reducedMotion = "user", loadFeatures = d
|
|
|
72
71
|
layoutDampingVar,
|
|
73
72
|
layoutStiffnessVar
|
|
74
73
|
]);
|
|
75
|
-
const transition = (0, react.useMemo)(() => ({
|
|
76
|
-
type: "spring",
|
|
77
|
-
mass: 1,
|
|
78
|
-
...layoutConfig,
|
|
79
|
-
layout: layoutConfig,
|
|
80
|
-
opacity: colorConfig,
|
|
81
|
-
color: colorConfig,
|
|
82
|
-
borderColor: colorConfig,
|
|
83
|
-
backgroundColor: colorConfig
|
|
84
|
-
}), [colorConfig, layoutConfig]);
|
|
85
|
-
if (require_components_experimental_client_AvoidMotionLibraryProvider.useAvoidMotionLibrary()) return children;
|
|
86
74
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.LazyMotion, {
|
|
87
75
|
features: loadFeatures,
|
|
88
76
|
strict: true,
|
|
89
77
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.MotionConfig, {
|
|
90
|
-
transition,
|
|
78
|
+
transition: (0, react.useMemo)(() => ({
|
|
79
|
+
type: "spring",
|
|
80
|
+
mass: 1,
|
|
81
|
+
...layoutConfig,
|
|
82
|
+
layout: layoutConfig,
|
|
83
|
+
opacity: colorConfig,
|
|
84
|
+
color: colorConfig,
|
|
85
|
+
borderColor: colorConfig,
|
|
86
|
+
backgroundColor: colorConfig
|
|
87
|
+
}), [colorConfig, layoutConfig]),
|
|
91
88
|
reducedMotion,
|
|
92
89
|
children
|
|
93
90
|
})
|