@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,120 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
5
|
+
const require_styles_styler = require("../../../styles/styler.cjs");
|
|
6
|
+
const require_utils_createSlot = require("../../../utils/createSlot.cjs");
|
|
7
|
+
const require_generateDefaultClassName = require("../../../automated-config/dist/utils/generateDefaultClassName.cjs");
|
|
8
|
+
let react = require("react");
|
|
9
|
+
react = require_runtime.__toESM(react);
|
|
10
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
+
//#region src/components/client/Button/ButtonBase.tsx
|
|
12
|
+
const defaultVariantRootClass = require_generateDefaultClassName.generateDefaultClassName("button", "variant", "root");
|
|
13
|
+
const defaultVariantIconClass = require_generateDefaultClassName.generateDefaultClassName("button", "variant", "icon");
|
|
14
|
+
const defaultSizeRootClass = require_generateDefaultClassName.generateDefaultClassName("button", "size", "root");
|
|
15
|
+
const defaultSizeIconClass = require_generateDefaultClassName.generateDefaultClassName("button", "size", "icon");
|
|
16
|
+
const ButtonBase = (0, react.forwardRef)(function ButtonBase({ size, variant, startIcon, endIcon, iconVariant, loading, disableEffects, children, asChild = false, slotProps, type = "button", className, width, renderStartContent, renderEndContent, renderRoot, ...rest }, forwardedRef) {
|
|
17
|
+
const { className: startIconClassName, ...startIconSlotProps } = slotProps?.startIcon ?? {};
|
|
18
|
+
const { className: endIconClassName, ...endIconSlotProps } = slotProps?.endIcon ?? {};
|
|
19
|
+
const { className: contentClassName, ...contentSlotProps } = slotProps?.content ?? {};
|
|
20
|
+
const gapVariant = loading || startIcon || endIcon ? "withIcon" : "withoutIcon";
|
|
21
|
+
const Slot = (0, react.useMemo)(() => require_utils_createSlot.createSlot(), []);
|
|
22
|
+
const rootSizeClass = (0, react.useMemo)(() => size ? require_styles_styler.getStyles({ buttonSizeRoot: size }) : defaultSizeRootClass, [size]);
|
|
23
|
+
const rootVariantClass = (0, react.useMemo)(() => variant ? require_styles_styler.getStyles({ buttonVariantRoot: variant }) : defaultVariantRootClass, [variant]);
|
|
24
|
+
const iconSizeClass = (0, react.useMemo)(() => size ? require_styles_styler.getStyles({ buttonSizeIcon: size }) : defaultSizeIconClass, [size]);
|
|
25
|
+
const iconVariantClass = (0, react.useMemo)(() => variant ? require_styles_styler.getStyles({ buttonVariantIcon: variant }) : defaultVariantIconClass, [variant]);
|
|
26
|
+
const styles = (0, react.useMemo)(() => ({
|
|
27
|
+
root: require_styles_styler.getStyles({
|
|
28
|
+
width,
|
|
29
|
+
className: require_styles_styler.cx([
|
|
30
|
+
"uds-ring",
|
|
31
|
+
"uds-hit-target",
|
|
32
|
+
"inline-flex max-w-full overflow-hidden justify-center items-center whitespace-nowrap select-none",
|
|
33
|
+
"[transform-origin:center]",
|
|
34
|
+
"[backface-visibility:hidden]",
|
|
35
|
+
"[transition-property:color,background-color,border-color,box-shadow,text-decoration-color,fill,stroke]",
|
|
36
|
+
"[transition-timing-function:cubic-bezier(0,0,0.2,1)]",
|
|
37
|
+
"[transition-duration:220ms]",
|
|
38
|
+
rootSizeClass,
|
|
39
|
+
rootVariantClass,
|
|
40
|
+
rest?.disabled && "cursor-not-allowed",
|
|
41
|
+
loading && "uds-button-loading",
|
|
42
|
+
disableEffects && "uds-button-without-effects",
|
|
43
|
+
gapVariant === "withIcon" && "uds-button-with-gap",
|
|
44
|
+
className
|
|
45
|
+
])
|
|
46
|
+
}),
|
|
47
|
+
iconContainer: require_styles_styler.cx(["flex shrink-0 overflow-clip uds-button-icon-container"]),
|
|
48
|
+
icon: require_styles_styler.getStyles({ className: require_styles_styler.cx([iconSizeClass, iconVariantClass]) }),
|
|
49
|
+
loadingIcon: require_styles_styler.getStyles({ className: require_styles_styler.cx([
|
|
50
|
+
"animate-spin",
|
|
51
|
+
iconSizeClass,
|
|
52
|
+
iconVariantClass
|
|
53
|
+
]) }),
|
|
54
|
+
content: require_styles_styler.cx(["min-w-0 truncate"])
|
|
55
|
+
}), [
|
|
56
|
+
className,
|
|
57
|
+
disableEffects,
|
|
58
|
+
gapVariant,
|
|
59
|
+
iconSizeClass,
|
|
60
|
+
iconVariantClass,
|
|
61
|
+
loading,
|
|
62
|
+
rest?.disabled,
|
|
63
|
+
rootSizeClass,
|
|
64
|
+
rootVariantClass,
|
|
65
|
+
width
|
|
66
|
+
]);
|
|
67
|
+
const iconRenderArgs = (0, react.useMemo)(() => ({
|
|
68
|
+
iconVariant,
|
|
69
|
+
loading,
|
|
70
|
+
startIcon,
|
|
71
|
+
endIcon,
|
|
72
|
+
iconClassName: styles.icon,
|
|
73
|
+
loadingIconClassName: styles.loadingIcon,
|
|
74
|
+
iconContainerClassName: styles.iconContainer,
|
|
75
|
+
startIconClassName,
|
|
76
|
+
endIconClassName,
|
|
77
|
+
startIconSlotProps,
|
|
78
|
+
endIconSlotProps
|
|
79
|
+
}), [
|
|
80
|
+
endIcon,
|
|
81
|
+
endIconClassName,
|
|
82
|
+
endIconSlotProps,
|
|
83
|
+
iconVariant,
|
|
84
|
+
loading,
|
|
85
|
+
startIcon,
|
|
86
|
+
startIconClassName,
|
|
87
|
+
startIconSlotProps,
|
|
88
|
+
styles.icon,
|
|
89
|
+
styles.iconContainer,
|
|
90
|
+
styles.loadingIcon
|
|
91
|
+
]);
|
|
92
|
+
return renderRoot({
|
|
93
|
+
asChild,
|
|
94
|
+
Slot,
|
|
95
|
+
children,
|
|
96
|
+
buttonRef: forwardedRef,
|
|
97
|
+
type,
|
|
98
|
+
rootClassName: styles.root,
|
|
99
|
+
rest,
|
|
100
|
+
contentClassName: require_styles_styler.cx(styles.content, contentClassName),
|
|
101
|
+
contentSlotProps,
|
|
102
|
+
startContent: renderStartContent(iconRenderArgs),
|
|
103
|
+
endContent: renderEndContent(iconRenderArgs)
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
ButtonBase.displayName = "ButtonBase";
|
|
107
|
+
function renderButtonChildren(children, childProps, startContent, contentClassName, contentSlotProps, endContent) {
|
|
108
|
+
return (0, react.cloneElement)(children, childProps, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
109
|
+
startContent,
|
|
110
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
111
|
+
className: contentClassName,
|
|
112
|
+
...contentSlotProps,
|
|
113
|
+
children: children.props.children
|
|
114
|
+
}),
|
|
115
|
+
endContent
|
|
116
|
+
] }));
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
exports.ButtonBase = ButtonBase;
|
|
120
|
+
exports.renderButtonChildren = renderButtonChildren;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
|
|
2
|
+
import { UniversalButtonProps } from "../../../types/dist/index.cjs";
|
|
3
|
+
import { IconPropsWithSVGProps } from "../../../tokens/types.cjs";
|
|
4
|
+
import React, { ForwardRefExoticComponent } from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/components/client/Button/ButtonBase.d.ts
|
|
7
|
+
type HtmlButtonProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'color' | 'name'>;
|
|
8
|
+
type DataAttributes = {
|
|
9
|
+
[name: `data-${string}`]: string;
|
|
10
|
+
};
|
|
11
|
+
interface ButtonProps extends HtmlButtonProps, UniversalButtonProps {
|
|
12
|
+
slotProps?: {
|
|
13
|
+
startIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
14
|
+
endIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
15
|
+
content?: Partial<React.HTMLAttributes<HTMLSpanElement> & DataAttributes>;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
type ButtonIconRenderArgs = {
|
|
19
|
+
iconVariant: ButtonProps['iconVariant'];
|
|
20
|
+
loading?: boolean;
|
|
21
|
+
startIcon?: ButtonProps['startIcon'];
|
|
22
|
+
endIcon?: ButtonProps['endIcon'];
|
|
23
|
+
iconClassName: string;
|
|
24
|
+
loadingIconClassName: string;
|
|
25
|
+
iconContainerClassName: string;
|
|
26
|
+
startIconClassName?: string;
|
|
27
|
+
endIconClassName?: string;
|
|
28
|
+
startIconSlotProps: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
29
|
+
endIconSlotProps: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
30
|
+
};
|
|
31
|
+
type ButtonRootRenderArgs = {
|
|
32
|
+
asChild: boolean;
|
|
33
|
+
Slot: ForwardRefExoticComponent<HtmlButtonProps>;
|
|
34
|
+
children: React.ReactNode;
|
|
35
|
+
buttonRef: React.ForwardedRef<HTMLButtonElement>;
|
|
36
|
+
type: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
|
|
37
|
+
rootClassName: string;
|
|
38
|
+
rest: Omit<ButtonProps, 'children' | 'slotProps' | 'asChild' | 'type' | 'className'>;
|
|
39
|
+
contentClassName: string;
|
|
40
|
+
contentSlotProps: Partial<React.HTMLAttributes<HTMLSpanElement> & DataAttributes>;
|
|
41
|
+
startContent: React.ReactNode;
|
|
42
|
+
endContent: React.ReactNode;
|
|
43
|
+
};
|
|
44
|
+
interface ButtonBaseProps extends ButtonProps {
|
|
45
|
+
renderStartContent: (args: ButtonIconRenderArgs) => React.ReactNode;
|
|
46
|
+
renderEndContent: (args: ButtonIconRenderArgs) => React.ReactNode;
|
|
47
|
+
renderRoot: (args: ButtonRootRenderArgs) => React.ReactNode;
|
|
48
|
+
}
|
|
49
|
+
declare const ButtonBase: ForwardRefExoticComponent<ButtonBaseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
50
|
+
declare function renderButtonChildren(children: React.ReactNode, childProps: Record<string, unknown>, startContent: React.ReactNode, contentClassName: string, contentSlotProps: Partial<React.HTMLAttributes<HTMLSpanElement> & DataAttributes>, endContent: React.ReactNode): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
51
|
+
//#endregion
|
|
52
|
+
export { ButtonBase, type ButtonProps, type ButtonRootRenderArgs, renderButtonChildren };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { UniversalButtonProps } from "../../../types/dist/index.js";
|
|
4
|
+
import { IconPropsWithSVGProps } from "../../../tokens/types.js";
|
|
5
|
+
import React, { ForwardRefExoticComponent } from "react";
|
|
6
|
+
|
|
7
|
+
//#region src/components/client/Button/ButtonBase.d.ts
|
|
8
|
+
type HtmlButtonProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'color' | 'name'>;
|
|
9
|
+
type DataAttributes = {
|
|
10
|
+
[name: `data-${string}`]: string;
|
|
11
|
+
};
|
|
12
|
+
interface ButtonProps extends HtmlButtonProps, UniversalButtonProps {
|
|
13
|
+
slotProps?: {
|
|
14
|
+
startIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
15
|
+
endIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
16
|
+
content?: Partial<React.HTMLAttributes<HTMLSpanElement> & DataAttributes>;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
type ButtonIconRenderArgs = {
|
|
20
|
+
iconVariant: ButtonProps['iconVariant'];
|
|
21
|
+
loading?: boolean;
|
|
22
|
+
startIcon?: ButtonProps['startIcon'];
|
|
23
|
+
endIcon?: ButtonProps['endIcon'];
|
|
24
|
+
iconClassName: string;
|
|
25
|
+
loadingIconClassName: string;
|
|
26
|
+
iconContainerClassName: string;
|
|
27
|
+
startIconClassName?: string;
|
|
28
|
+
endIconClassName?: string;
|
|
29
|
+
startIconSlotProps: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
30
|
+
endIconSlotProps: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
31
|
+
};
|
|
32
|
+
type ButtonRootRenderArgs = {
|
|
33
|
+
asChild: boolean;
|
|
34
|
+
Slot: ForwardRefExoticComponent<HtmlButtonProps>;
|
|
35
|
+
children: React.ReactNode;
|
|
36
|
+
buttonRef: React.ForwardedRef<HTMLButtonElement>;
|
|
37
|
+
type: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
|
|
38
|
+
rootClassName: string;
|
|
39
|
+
rest: Omit<ButtonProps, 'children' | 'slotProps' | 'asChild' | 'type' | 'className'>;
|
|
40
|
+
contentClassName: string;
|
|
41
|
+
contentSlotProps: Partial<React.HTMLAttributes<HTMLSpanElement> & DataAttributes>;
|
|
42
|
+
startContent: React.ReactNode;
|
|
43
|
+
endContent: React.ReactNode;
|
|
44
|
+
};
|
|
45
|
+
interface ButtonBaseProps extends ButtonProps {
|
|
46
|
+
renderStartContent: (args: ButtonIconRenderArgs) => React.ReactNode;
|
|
47
|
+
renderEndContent: (args: ButtonIconRenderArgs) => React.ReactNode;
|
|
48
|
+
renderRoot: (args: ButtonRootRenderArgs) => React.ReactNode;
|
|
49
|
+
}
|
|
50
|
+
declare const ButtonBase: ForwardRefExoticComponent<ButtonBaseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
51
|
+
declare function renderButtonChildren(children: React.ReactNode, childProps: Record<string, unknown>, startContent: React.ReactNode, contentClassName: string, contentSlotProps: Partial<React.HTMLAttributes<HTMLSpanElement> & DataAttributes>, endContent: React.ReactNode): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
52
|
+
//#endregion
|
|
53
|
+
export { ButtonBase, type ButtonProps, type ButtonRootRenderArgs, renderButtonChildren };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
import { cx, getStyles } from "../../../styles/styler.js";
|
|
4
|
+
import { createSlot } from "../../../utils/createSlot.js";
|
|
5
|
+
import { generateDefaultClassName } from "../../../automated-config/dist/utils/generateDefaultClassName.js";
|
|
6
|
+
import { cloneElement, forwardRef, useMemo } from "react";
|
|
7
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/client/Button/ButtonBase.tsx
|
|
9
|
+
const defaultVariantRootClass = generateDefaultClassName("button", "variant", "root");
|
|
10
|
+
const defaultVariantIconClass = generateDefaultClassName("button", "variant", "icon");
|
|
11
|
+
const defaultSizeRootClass = generateDefaultClassName("button", "size", "root");
|
|
12
|
+
const defaultSizeIconClass = generateDefaultClassName("button", "size", "icon");
|
|
13
|
+
const ButtonBase = forwardRef(function ButtonBase({ size, variant, startIcon, endIcon, iconVariant, loading, disableEffects, children, asChild = false, slotProps, type = "button", className, width, renderStartContent, renderEndContent, renderRoot, ...rest }, forwardedRef) {
|
|
14
|
+
const { className: startIconClassName, ...startIconSlotProps } = slotProps?.startIcon ?? {};
|
|
15
|
+
const { className: endIconClassName, ...endIconSlotProps } = slotProps?.endIcon ?? {};
|
|
16
|
+
const { className: contentClassName, ...contentSlotProps } = slotProps?.content ?? {};
|
|
17
|
+
const gapVariant = loading || startIcon || endIcon ? "withIcon" : "withoutIcon";
|
|
18
|
+
const Slot = useMemo(() => createSlot(), []);
|
|
19
|
+
const rootSizeClass = useMemo(() => size ? getStyles({ buttonSizeRoot: size }) : defaultSizeRootClass, [size]);
|
|
20
|
+
const rootVariantClass = useMemo(() => variant ? getStyles({ buttonVariantRoot: variant }) : defaultVariantRootClass, [variant]);
|
|
21
|
+
const iconSizeClass = useMemo(() => size ? getStyles({ buttonSizeIcon: size }) : defaultSizeIconClass, [size]);
|
|
22
|
+
const iconVariantClass = useMemo(() => variant ? getStyles({ buttonVariantIcon: variant }) : defaultVariantIconClass, [variant]);
|
|
23
|
+
const styles = useMemo(() => ({
|
|
24
|
+
root: getStyles({
|
|
25
|
+
width,
|
|
26
|
+
className: cx([
|
|
27
|
+
"uds-ring",
|
|
28
|
+
"uds-hit-target",
|
|
29
|
+
"inline-flex max-w-full overflow-hidden justify-center items-center whitespace-nowrap select-none",
|
|
30
|
+
"[transform-origin:center]",
|
|
31
|
+
"[backface-visibility:hidden]",
|
|
32
|
+
"[transition-property:color,background-color,border-color,box-shadow,text-decoration-color,fill,stroke]",
|
|
33
|
+
"[transition-timing-function:cubic-bezier(0,0,0.2,1)]",
|
|
34
|
+
"[transition-duration:220ms]",
|
|
35
|
+
rootSizeClass,
|
|
36
|
+
rootVariantClass,
|
|
37
|
+
rest?.disabled && "cursor-not-allowed",
|
|
38
|
+
loading && "uds-button-loading",
|
|
39
|
+
disableEffects && "uds-button-without-effects",
|
|
40
|
+
gapVariant === "withIcon" && "uds-button-with-gap",
|
|
41
|
+
className
|
|
42
|
+
])
|
|
43
|
+
}),
|
|
44
|
+
iconContainer: cx(["flex shrink-0 overflow-clip uds-button-icon-container"]),
|
|
45
|
+
icon: getStyles({ className: cx([iconSizeClass, iconVariantClass]) }),
|
|
46
|
+
loadingIcon: getStyles({ className: cx([
|
|
47
|
+
"animate-spin",
|
|
48
|
+
iconSizeClass,
|
|
49
|
+
iconVariantClass
|
|
50
|
+
]) }),
|
|
51
|
+
content: cx(["min-w-0 truncate"])
|
|
52
|
+
}), [
|
|
53
|
+
className,
|
|
54
|
+
disableEffects,
|
|
55
|
+
gapVariant,
|
|
56
|
+
iconSizeClass,
|
|
57
|
+
iconVariantClass,
|
|
58
|
+
loading,
|
|
59
|
+
rest?.disabled,
|
|
60
|
+
rootSizeClass,
|
|
61
|
+
rootVariantClass,
|
|
62
|
+
width
|
|
63
|
+
]);
|
|
64
|
+
const iconRenderArgs = useMemo(() => ({
|
|
65
|
+
iconVariant,
|
|
66
|
+
loading,
|
|
67
|
+
startIcon,
|
|
68
|
+
endIcon,
|
|
69
|
+
iconClassName: styles.icon,
|
|
70
|
+
loadingIconClassName: styles.loadingIcon,
|
|
71
|
+
iconContainerClassName: styles.iconContainer,
|
|
72
|
+
startIconClassName,
|
|
73
|
+
endIconClassName,
|
|
74
|
+
startIconSlotProps,
|
|
75
|
+
endIconSlotProps
|
|
76
|
+
}), [
|
|
77
|
+
endIcon,
|
|
78
|
+
endIconClassName,
|
|
79
|
+
endIconSlotProps,
|
|
80
|
+
iconVariant,
|
|
81
|
+
loading,
|
|
82
|
+
startIcon,
|
|
83
|
+
startIconClassName,
|
|
84
|
+
startIconSlotProps,
|
|
85
|
+
styles.icon,
|
|
86
|
+
styles.iconContainer,
|
|
87
|
+
styles.loadingIcon
|
|
88
|
+
]);
|
|
89
|
+
return renderRoot({
|
|
90
|
+
asChild,
|
|
91
|
+
Slot,
|
|
92
|
+
children,
|
|
93
|
+
buttonRef: forwardedRef,
|
|
94
|
+
type,
|
|
95
|
+
rootClassName: styles.root,
|
|
96
|
+
rest,
|
|
97
|
+
contentClassName: cx(styles.content, contentClassName),
|
|
98
|
+
contentSlotProps,
|
|
99
|
+
startContent: renderStartContent(iconRenderArgs),
|
|
100
|
+
endContent: renderEndContent(iconRenderArgs)
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
ButtonBase.displayName = "ButtonBase";
|
|
104
|
+
function renderButtonChildren(children, childProps, startContent, contentClassName, contentSlotProps, endContent) {
|
|
105
|
+
return cloneElement(children, childProps, /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
106
|
+
startContent,
|
|
107
|
+
/* @__PURE__ */ jsx("span", {
|
|
108
|
+
className: contentClassName,
|
|
109
|
+
...contentSlotProps,
|
|
110
|
+
children: children.props.children
|
|
111
|
+
}),
|
|
112
|
+
endContent
|
|
113
|
+
] }));
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
export { ButtonBase, renderButtonChildren };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
"use client";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
//#region src/components/client/buttonConstants.ts
|
|
4
|
+
//#region src/components/client/Button/buttonConstants.ts
|
|
5
5
|
/** The icon size used for icons in Button and IconButton components */
|
|
6
6
|
const buttonIconSvgSize = "sm";
|
|
7
7
|
//#endregion
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
|
|
2
|
+
import { ButtonSize } from "../../../types/dist/index.cjs";
|
|
3
|
+
//#region src/components/client/Button/buttonConstants.d.ts
|
|
4
|
+
/** The icon size used for icons in Button and IconButton components */
|
|
5
|
+
declare const buttonIconSvgSize: ButtonSize;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { buttonIconSvgSize };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { ButtonSize } from "../../../types/dist/index.js";
|
|
4
|
+
//#region src/components/client/Button/buttonConstants.d.ts
|
|
5
|
+
/** The icon size used for icons in Button and IconButton components */
|
|
6
|
+
declare const buttonIconSvgSize: ButtonSize;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { buttonIconSvgSize };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
"use client";
|
|
3
|
-
//#region src/components/client/buttonConstants.ts
|
|
3
|
+
//#region src/components/client/Button/buttonConstants.ts
|
|
4
4
|
/** The icon size used for icons in Button and IconButton components */
|
|
5
5
|
const buttonIconSvgSize = "sm";
|
|
6
6
|
//#endregion
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
const require_components_client_Button_ButtonBase = require("./ButtonBase.cjs");
|
|
5
|
+
const require_components_client_Button_Button = require("./Button.cjs");
|
|
6
|
+
exports.Button = require_components_client_Button_Button.Button;
|
|
7
|
+
exports.ButtonBase = require_components_client_Button_ButtonBase.ButtonBase;
|
|
8
|
+
exports.iconMotionVariants = require_components_client_Button_Button.iconMotionVariants;
|
|
9
|
+
exports.loadingMotionVariants = require_components_client_Button_Button.loadingMotionVariants;
|
|
10
|
+
exports.renderButtonChildren = require_components_client_Button_ButtonBase.renderButtonChildren;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
|
|
2
|
+
import { ButtonBase, ButtonRootRenderArgs, renderButtonChildren } from "./ButtonBase.cjs";
|
|
3
|
+
import { Button, ButtonProps, iconMotionVariants, loadingMotionVariants } from "./Button.cjs";
|
|
4
|
+
export { Button, ButtonBase, type ButtonProps, type ButtonRootRenderArgs, iconMotionVariants, loadingMotionVariants, renderButtonChildren };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { ButtonBase, ButtonRootRenderArgs, renderButtonChildren } from "./ButtonBase.js";
|
|
4
|
+
import { Button, ButtonProps, iconMotionVariants, loadingMotionVariants } from "./Button.js";
|
|
5
|
+
export { Button, ButtonBase, type ButtonProps, type ButtonRootRenderArgs, iconMotionVariants, loadingMotionVariants, renderButtonChildren };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
import { ButtonBase, renderButtonChildren } from "./ButtonBase.js";
|
|
4
|
+
import { Button, iconMotionVariants, loadingMotionVariants } from "./Button.js";
|
|
5
|
+
export { Button, ButtonBase, iconMotionVariants, loadingMotionVariants, renderButtonChildren };
|
|
@@ -6,6 +6,7 @@ const require_styles_styler = require("../../styles/styler.cjs");
|
|
|
6
6
|
const require_components_Icon = require("../Icon.cjs");
|
|
7
7
|
const require_components_Box = require("../Box.cjs");
|
|
8
8
|
const require_components_FormLabel = require("../FormLabel.cjs");
|
|
9
|
+
const require_hooks_usePrefersReducedMotion = require("../../hooks/usePrefersReducedMotion.cjs");
|
|
9
10
|
const require_components_client_SpringMotionConfig = require("./SpringMotionConfig.cjs");
|
|
10
11
|
let _yahoo_uds_icons = require("@yahoo/uds-icons");
|
|
11
12
|
let react = require("react");
|
|
@@ -116,7 +117,7 @@ const Checkbox = (0, react.forwardRef)(function Checkbox({ id, checked: checkedP
|
|
|
116
117
|
if (!innerRef.current) return;
|
|
117
118
|
innerRef.current.indeterminate = isIndeterminate(checked_);
|
|
118
119
|
};
|
|
119
|
-
const prefersReducedMotion =
|
|
120
|
+
const prefersReducedMotion = require_hooks_usePrefersReducedMotion.usePrefersReducedMotion();
|
|
120
121
|
const reduceMotion = forceReduceMotion ? "always" : "user";
|
|
121
122
|
const cssAnimationDuration = prefersReducedMotion || forceReduceMotion ? "duration-0" : "duration-120";
|
|
122
123
|
/**
|
|
@@ -4,11 +4,12 @@ import { cx, getStyles } from "../../styles/styler.js";
|
|
|
4
4
|
import { Icon } from "../Icon.js";
|
|
5
5
|
import { Box } from "../Box.js";
|
|
6
6
|
import { FormLabel } from "../FormLabel.js";
|
|
7
|
+
import { usePrefersReducedMotion } from "../../hooks/usePrefersReducedMotion.js";
|
|
7
8
|
import { SpringMotionConfig } from "./SpringMotionConfig.js";
|
|
8
9
|
import { Check, Minus } from "@yahoo/uds-icons";
|
|
9
10
|
import { forwardRef, useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
10
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
-
import { m
|
|
12
|
+
import { m } from "motion/react";
|
|
12
13
|
//#region src/components/client/Checkbox.tsx
|
|
13
14
|
const VARIANTS = ["primary", "secondary"];
|
|
14
15
|
const SIZES = ["sm", "md"];
|
|
@@ -113,7 +114,7 @@ const Checkbox = forwardRef(function Checkbox({ id, checked: checkedProp, defaul
|
|
|
113
114
|
if (!innerRef.current) return;
|
|
114
115
|
innerRef.current.indeterminate = isIndeterminate(checked_);
|
|
115
116
|
};
|
|
116
|
-
const prefersReducedMotion =
|
|
117
|
+
const prefersReducedMotion = usePrefersReducedMotion();
|
|
117
118
|
const reduceMotion = forceReduceMotion ? "always" : "user";
|
|
118
119
|
const cssAnimationDuration = prefersReducedMotion || forceReduceMotion ? "duration-0" : "duration-120";
|
|
119
120
|
/**
|
|
@@ -6,16 +6,16 @@ const require_styles_styler = require("../../../styles/styler.cjs");
|
|
|
6
6
|
const require_components_IconSlot = require("../../IconSlot.cjs");
|
|
7
7
|
const require_components_Text = require("../../Text.cjs");
|
|
8
8
|
const require_components_HStack = require("../../HStack.cjs");
|
|
9
|
+
const require_hooks_usePrefersReducedMotion = require("../../../hooks/usePrefersReducedMotion.cjs");
|
|
9
10
|
let react = require("react");
|
|
10
11
|
react = require_runtime.__toESM(react);
|
|
11
12
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
12
|
-
let motion_react = require("motion/react");
|
|
13
13
|
//#region src/components/client/Chip/ChipBase.tsx
|
|
14
14
|
const SIZE_DEFAULT = "md";
|
|
15
15
|
const VARIANT_DEFAULT = "primary";
|
|
16
16
|
const MAX_WIDTH_DEFAULT = 200;
|
|
17
17
|
const ChipBase = (0, react.forwardRef)(function ChipBase({ size = SIZE_DEFAULT, minWidth, maxWidth = MAX_WIDTH_DEFAULT, startIcon, endIcon, as: As = "div", reduceMotion: forceReduceMotion, disabled = false, className, slotProps, children, ...rest }, ref) {
|
|
18
|
-
const cssAnimationDuration =
|
|
18
|
+
const cssAnimationDuration = require_hooks_usePrefersReducedMotion.usePrefersReducedMotion() || forceReduceMotion ? "duration-0" : "duration-120";
|
|
19
19
|
const { className: textClassName, ...textProps } = slotProps?.text ?? {};
|
|
20
20
|
const { className: startIconClassName, ...startIconProps } = slotProps?.startIcon ?? {};
|
|
21
21
|
const { className: endIconClassName, ...endIconProps } = slotProps?.endIcon ?? {};
|
|
@@ -4,15 +4,15 @@ import { cx, getStyles } from "../../../styles/styler.js";
|
|
|
4
4
|
import { IconSlot } from "../../IconSlot.js";
|
|
5
5
|
import { Text } from "../../Text.js";
|
|
6
6
|
import { HStack } from "../../HStack.js";
|
|
7
|
+
import { usePrefersReducedMotion } from "../../../hooks/usePrefersReducedMotion.js";
|
|
7
8
|
import { forwardRef, useMemo } from "react";
|
|
8
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
import { useReducedMotion } from "motion/react";
|
|
10
10
|
//#region src/components/client/Chip/ChipBase.tsx
|
|
11
11
|
const SIZE_DEFAULT = "md";
|
|
12
12
|
const VARIANT_DEFAULT = "primary";
|
|
13
13
|
const MAX_WIDTH_DEFAULT = 200;
|
|
14
14
|
const ChipBase = forwardRef(function ChipBase({ size = SIZE_DEFAULT, minWidth, maxWidth = MAX_WIDTH_DEFAULT, startIcon, endIcon, as: As = "div", reduceMotion: forceReduceMotion, disabled = false, className, slotProps, children, ...rest }, ref) {
|
|
15
|
-
const cssAnimationDuration =
|
|
15
|
+
const cssAnimationDuration = usePrefersReducedMotion() || forceReduceMotion ? "duration-0" : "duration-120";
|
|
16
16
|
const { className: textClassName, ...textProps } = slotProps?.text ?? {};
|
|
17
17
|
const { className: startIconClassName, ...startIconProps } = slotProps?.startIcon ?? {};
|
|
18
18
|
const { className: endIconClassName, ...endIconProps } = slotProps?.endIcon ?? {};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
require("../../../_virtual/_rolldown/runtime.cjs");
|
|
5
|
+
const require_index = require("../../../css-tokens/dist/index.cjs");
|
|
6
|
+
const require_utils_createSlot = require("../../../utils/createSlot.cjs");
|
|
7
|
+
const require_components_Icon = require("../../Icon.cjs");
|
|
8
|
+
const require_hooks_usePrefersReducedMotion = require("../../../hooks/usePrefersReducedMotion.cjs");
|
|
9
|
+
const require_components_client_SpringMotionConfig = require("../SpringMotionConfig.cjs");
|
|
10
|
+
require("../Button/buttonConstants.cjs");
|
|
11
|
+
const require_components_client_Button_Button = require("../Button/Button.cjs");
|
|
12
|
+
const require_components_client_IconButton_IconButtonBase = require("./IconButtonBase.cjs");
|
|
13
|
+
let _yahoo_uds_icons = require("@yahoo/uds-icons");
|
|
14
|
+
let react = require("react");
|
|
15
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
16
|
+
let motion_react = require("motion/react");
|
|
17
|
+
//#region src/components/client/IconButton/IconButton.tsx
|
|
18
|
+
/**
|
|
19
|
+
* **⚙️️ An icon button element that can be used to trigger an action**
|
|
20
|
+
*
|
|
21
|
+
* @componentType Client component
|
|
22
|
+
*/
|
|
23
|
+
const IconButton = (0, react.forwardRef)(function IconButton(props, forwardedRef) {
|
|
24
|
+
const prefersReducedMotion = require_hooks_usePrefersReducedMotion.usePrefersReducedMotion();
|
|
25
|
+
const disableMotion = !!props.disableEffects || !!props.disabled;
|
|
26
|
+
const layoutVariant = (0, react.useMemo)(() => prefersReducedMotion ? "smooth" : "subtle", [prefersReducedMotion]);
|
|
27
|
+
const Slot = (0, react.useMemo)(() => require_utils_createSlot.createSlot(), []);
|
|
28
|
+
const MotionSlot = (0, react.useMemo)(() => motion_react.m.create(Slot), [Slot]);
|
|
29
|
+
const buttonVariants = (0, react.useMemo)(() => ({
|
|
30
|
+
rest: { scale: disableMotion ? 1 : `var(${require_index.BUTTON_SCALE_EFFECT_REST})` },
|
|
31
|
+
hover: { scale: disableMotion ? 1 : `var(${require_index.BUTTON_SCALE_EFFECT_HOVER})` },
|
|
32
|
+
pressed: { scale: disableMotion ? 1 : `var(${require_index.BUTTON_SCALE_EFFECT_PRESSED})` }
|
|
33
|
+
}), [disableMotion]);
|
|
34
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_IconButton_IconButtonBase.IconButtonBase, {
|
|
35
|
+
...props,
|
|
36
|
+
ref: forwardedRef,
|
|
37
|
+
renderIconContent: ({ asChild, loading, name, iconVariant, children, iconClassName, loadingIconClassName, iconSlotClassName, iconSlotProps }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(motion_react.AnimatePresence, {
|
|
38
|
+
initial: false,
|
|
39
|
+
mode: "popLayout",
|
|
40
|
+
children: [loading && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.span, {
|
|
41
|
+
variants: require_components_client_Button_Button.loadingMotionVariants,
|
|
42
|
+
initial: "loading",
|
|
43
|
+
animate: "loading",
|
|
44
|
+
exit: "hide",
|
|
45
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Icon.Icon, {
|
|
46
|
+
size: "sm",
|
|
47
|
+
name: _yahoo_uds_icons.Progress,
|
|
48
|
+
variant: iconVariant,
|
|
49
|
+
color: "current",
|
|
50
|
+
className: loadingIconClassName
|
|
51
|
+
})
|
|
52
|
+
}, "loading"), name && !loading && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.span, {
|
|
53
|
+
variants: require_components_client_Button_Button.iconMotionVariants,
|
|
54
|
+
initial: "icon",
|
|
55
|
+
animate: "icon",
|
|
56
|
+
exit: "hide",
|
|
57
|
+
children: !asChild && children || /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Icon.Icon, {
|
|
58
|
+
size: "sm",
|
|
59
|
+
name,
|
|
60
|
+
variant: iconVariant,
|
|
61
|
+
color: "current",
|
|
62
|
+
className: [iconClassName, iconSlotClassName].filter(Boolean).join(" "),
|
|
63
|
+
...iconSlotProps
|
|
64
|
+
})
|
|
65
|
+
}, name.name)]
|
|
66
|
+
}),
|
|
67
|
+
renderRoot: ({ asChild, children, buttonRef, type, htmlName, rootClassName, rest, iconContent }) => {
|
|
68
|
+
if (asChild && (0, react.isValidElement)(children)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_SpringMotionConfig.SpringMotionConfig, {
|
|
69
|
+
layoutSpeed: "3",
|
|
70
|
+
layoutVariant,
|
|
71
|
+
reducedMotion: props.disableEffects ? "always" : "user",
|
|
72
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MotionSlot, {
|
|
73
|
+
type,
|
|
74
|
+
className: rootClassName,
|
|
75
|
+
initial: "icon",
|
|
76
|
+
variants: buttonVariants,
|
|
77
|
+
whileHover: "hover",
|
|
78
|
+
whileTap: "pressed",
|
|
79
|
+
...rest,
|
|
80
|
+
children: require_components_client_IconButton_IconButtonBase.renderIconButtonAsChild(children, iconContent)
|
|
81
|
+
})
|
|
82
|
+
});
|
|
83
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_SpringMotionConfig.SpringMotionConfig, {
|
|
84
|
+
layoutSpeed: "3",
|
|
85
|
+
layoutVariant,
|
|
86
|
+
reducedMotion: props.disableEffects ? "always" : "user",
|
|
87
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.button, {
|
|
88
|
+
ref: buttonRef,
|
|
89
|
+
type,
|
|
90
|
+
className: rootClassName,
|
|
91
|
+
name: htmlName,
|
|
92
|
+
initial: "icon",
|
|
93
|
+
variants: buttonVariants,
|
|
94
|
+
whileHover: "hover",
|
|
95
|
+
whileTap: "pressed",
|
|
96
|
+
...rest,
|
|
97
|
+
children: iconContent
|
|
98
|
+
})
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
IconButton.displayName = "IconButton";
|
|
104
|
+
//#endregion
|
|
105
|
+
exports.IconButton = IconButton;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
import { IconButtonProps as IconButtonProps$1 } from "./IconButtonBase.cjs";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
import { ForwardRefExoticComponent } from "react";
|
|
5
|
+
import { HTMLMotionProps } from "motion/react";
|
|
6
|
+
|
|
7
|
+
//#region src/components/client/IconButton/IconButton.d.ts
|
|
8
|
+
type HtmlButtonProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'color' | 'name'> & Omit<HTMLMotionProps<'button'>, 'name'>;
|
|
9
|
+
type IconButtonProps = IconButtonProps$1 & HtmlButtonProps;
|
|
10
|
+
/**
|
|
11
|
+
* **⚙️️ An icon button element that can be used to trigger an action**
|
|
12
|
+
*
|
|
13
|
+
* @componentType Client component
|
|
14
|
+
*/
|
|
15
|
+
declare const IconButton: ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & _$react.RefAttributes<HTMLButtonElement>>;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { IconButton, type IconButtonProps };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { IconButtonProps as IconButtonProps$1 } from "./IconButtonBase.js";
|
|
4
|
+
import * as _$react from "react";
|
|
5
|
+
import { ForwardRefExoticComponent } from "react";
|
|
6
|
+
import { HTMLMotionProps } from "motion/react";
|
|
7
|
+
|
|
8
|
+
//#region src/components/client/IconButton/IconButton.d.ts
|
|
9
|
+
type HtmlButtonProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'color' | 'name'> & Omit<HTMLMotionProps<'button'>, 'name'>;
|
|
10
|
+
type IconButtonProps = IconButtonProps$1 & HtmlButtonProps;
|
|
11
|
+
/**
|
|
12
|
+
* **⚙️️ An icon button element that can be used to trigger an action**
|
|
13
|
+
*
|
|
14
|
+
* @componentType Client component
|
|
15
|
+
*/
|
|
16
|
+
declare const IconButton: ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & _$react.RefAttributes<HTMLButtonElement>>;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { IconButton, type IconButtonProps };
|