@yahoo/uds 3.159.1 → 3.160.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/automated-config/dist/properties.cjs +1 -1
- package/dist/automated-config/dist/properties.js +1 -1
- package/dist/components/Text.cjs +4 -2
- package/dist/components/Text.js +4 -2
- package/dist/components/client/Button/Button.cjs +213 -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 +208 -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/IconButton/IconButton.cjs +104 -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 +102 -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/Pressable.cjs +3 -1
- package/dist/components/client/Pressable.js +3 -1
- 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/Toast/Toast.cjs +2 -2
- 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 +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 +24 -0
- package/dist/hooks/usePrefersReducedMotion.d.cts +5 -0
- package/dist/hooks/usePrefersReducedMotion.d.ts +5 -0
- package/dist/hooks/usePrefersReducedMotion.js +22 -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 +4 -4
- package/dist/styles/styler.d.ts +4 -4
- 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,55 @@
|
|
|
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_components_Icon = require("../../components/Icon.cjs");
|
|
6
|
+
require("../../components/client/Button/buttonConstants.cjs");
|
|
7
|
+
const require_components_client_IconButton_IconButtonBase = require("../../components/client/IconButton/IconButtonBase.cjs");
|
|
8
|
+
let _yahoo_uds_icons = require("@yahoo/uds-icons");
|
|
9
|
+
let react = require("react");
|
|
10
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
+
//#region src/css-animation/IconButton/IconButton.tsx
|
|
12
|
+
/**
|
|
13
|
+
* CSS-animation IconButton variant. This component intentionally never imports motion.
|
|
14
|
+
*
|
|
15
|
+
* @componentType Client component
|
|
16
|
+
*/
|
|
17
|
+
const IconButton = (0, react.forwardRef)(function IconButton(props, forwardedRef) {
|
|
18
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_IconButton_IconButtonBase.IconButtonBase, {
|
|
19
|
+
...props,
|
|
20
|
+
ref: forwardedRef,
|
|
21
|
+
renderIconContent: ({ asChild, loading, name, iconVariant, children, iconClassName, loadingIconClassName, iconSlotClassName, iconSlotProps }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [loading && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Icon.Icon, {
|
|
22
|
+
size: "sm",
|
|
23
|
+
name: _yahoo_uds_icons.Progress,
|
|
24
|
+
variant: iconVariant,
|
|
25
|
+
color: "current",
|
|
26
|
+
className: loadingIconClassName
|
|
27
|
+
}) }), name && !loading && (!asChild && children || /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Icon.Icon, {
|
|
28
|
+
size: "sm",
|
|
29
|
+
name,
|
|
30
|
+
variant: iconVariant,
|
|
31
|
+
color: "current",
|
|
32
|
+
className: [iconClassName, iconSlotClassName].filter(Boolean).join(" "),
|
|
33
|
+
...iconSlotProps
|
|
34
|
+
}))] }),
|
|
35
|
+
renderRoot: ({ asChild, Slot, children, buttonRef, type, htmlName, rootClassName, rest, iconContent }) => {
|
|
36
|
+
if (asChild && (0, react.isValidElement)(children)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Slot, {
|
|
37
|
+
type,
|
|
38
|
+
className: rootClassName,
|
|
39
|
+
...rest,
|
|
40
|
+
children: require_components_client_IconButton_IconButtonBase.renderIconButtonAsChild(children, iconContent)
|
|
41
|
+
});
|
|
42
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
43
|
+
ref: buttonRef,
|
|
44
|
+
type,
|
|
45
|
+
className: rootClassName,
|
|
46
|
+
name: htmlName,
|
|
47
|
+
...rest,
|
|
48
|
+
children: iconContent
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
IconButton.displayName = "IconButton";
|
|
54
|
+
//#endregion
|
|
55
|
+
exports.IconButton = IconButton;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
import { IconButtonProps } from "../../components/client/IconButton/IconButton.cjs";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/css-animation/IconButton/IconButton.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* CSS-animation IconButton variant. This component intentionally never imports motion.
|
|
8
|
+
*
|
|
9
|
+
* @componentType Client component
|
|
10
|
+
*/
|
|
11
|
+
declare const IconButton: _$react.ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & _$react.RefAttributes<HTMLButtonElement>>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { IconButton, type IconButtonProps };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { IconButtonProps } from "../../components/client/IconButton/IconButton.js";
|
|
4
|
+
import * as _$react from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/css-animation/IconButton/IconButton.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* CSS-animation IconButton variant. This component intentionally never imports motion.
|
|
9
|
+
*
|
|
10
|
+
* @componentType Client component
|
|
11
|
+
*/
|
|
12
|
+
declare const IconButton: _$react.ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & _$react.RefAttributes<HTMLButtonElement>>;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { IconButton, type IconButtonProps };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
import { Icon } from "../../components/Icon.js";
|
|
4
|
+
import "../../components/client/Button/buttonConstants.js";
|
|
5
|
+
import { IconButtonBase, renderIconButtonAsChild } from "../../components/client/IconButton/IconButtonBase.js";
|
|
6
|
+
import { Progress } from "@yahoo/uds-icons";
|
|
7
|
+
import { forwardRef, isValidElement } from "react";
|
|
8
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
//#region src/css-animation/IconButton/IconButton.tsx
|
|
10
|
+
/**
|
|
11
|
+
* CSS-animation IconButton variant. This component intentionally never imports motion.
|
|
12
|
+
*
|
|
13
|
+
* @componentType Client component
|
|
14
|
+
*/
|
|
15
|
+
const IconButton = forwardRef(function IconButton(props, forwardedRef) {
|
|
16
|
+
return /* @__PURE__ */ jsx(IconButtonBase, {
|
|
17
|
+
...props,
|
|
18
|
+
ref: forwardedRef,
|
|
19
|
+
renderIconContent: ({ asChild, loading, name, iconVariant, children, iconClassName, loadingIconClassName, iconSlotClassName, iconSlotProps }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [loading && /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Icon, {
|
|
20
|
+
size: "sm",
|
|
21
|
+
name: Progress,
|
|
22
|
+
variant: iconVariant,
|
|
23
|
+
color: "current",
|
|
24
|
+
className: loadingIconClassName
|
|
25
|
+
}) }), name && !loading && (!asChild && children || /* @__PURE__ */ jsx(Icon, {
|
|
26
|
+
size: "sm",
|
|
27
|
+
name,
|
|
28
|
+
variant: iconVariant,
|
|
29
|
+
color: "current",
|
|
30
|
+
className: [iconClassName, iconSlotClassName].filter(Boolean).join(" "),
|
|
31
|
+
...iconSlotProps
|
|
32
|
+
}))] }),
|
|
33
|
+
renderRoot: ({ asChild, Slot, children, buttonRef, type, htmlName, rootClassName, rest, iconContent }) => {
|
|
34
|
+
if (asChild && isValidElement(children)) return /* @__PURE__ */ jsx(Slot, {
|
|
35
|
+
type,
|
|
36
|
+
className: rootClassName,
|
|
37
|
+
...rest,
|
|
38
|
+
children: renderIconButtonAsChild(children, iconContent)
|
|
39
|
+
});
|
|
40
|
+
return /* @__PURE__ */ jsx("button", {
|
|
41
|
+
ref: buttonRef,
|
|
42
|
+
type,
|
|
43
|
+
className: rootClassName,
|
|
44
|
+
name: htmlName,
|
|
45
|
+
...rest,
|
|
46
|
+
children: iconContent
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
IconButton.displayName = "IconButton";
|
|
52
|
+
//#endregion
|
|
53
|
+
export { IconButton };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
const require_css_animation_IconButton_IconButton = require("./IconButton.cjs");
|
|
5
|
+
exports.IconButton = require_css_animation_IconButton_IconButton.IconButton;
|
|
@@ -0,0 +1,44 @@
|
|
|
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_components_client_Switch_SwitchBase = require("../../components/client/Switch/SwitchBase.cjs");
|
|
6
|
+
const require_css_animation_Switch_SwitchStaticHandle = require("./SwitchStaticHandle.cjs");
|
|
7
|
+
let react = require("react");
|
|
8
|
+
react = require_runtime.__toESM(react);
|
|
9
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
+
//#region src/css-animation/Switch/Switch.tsx
|
|
11
|
+
/**
|
|
12
|
+
* CSS-animation Switch variant. This component intentionally never imports motion.
|
|
13
|
+
*
|
|
14
|
+
* @componentType Client component
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* 'use client';
|
|
19
|
+
* import { Switch } from '@yahoo/uds/css-animation';
|
|
20
|
+
*
|
|
21
|
+
* <Switch label="Name" required />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
const Switch = (0, react.forwardRef)(function Switch(props, parentRef) {
|
|
25
|
+
const cssAnimationDuration = "duration-120";
|
|
26
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Switch_SwitchBase.SwitchBase, {
|
|
27
|
+
...props,
|
|
28
|
+
ref: parentRef,
|
|
29
|
+
cssAnimationDuration,
|
|
30
|
+
renderHandle: ({ size, isOn, isOnTranslateClass, disabled, onIcon, offIcon, cssAnimationDuration, handleSlotProps }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_css_animation_Switch_SwitchStaticHandle.SwitchStaticHandle, {
|
|
31
|
+
size,
|
|
32
|
+
isOn,
|
|
33
|
+
isOnTranslateClass,
|
|
34
|
+
cssAnimationDuration,
|
|
35
|
+
disabled,
|
|
36
|
+
onIcon,
|
|
37
|
+
offIcon,
|
|
38
|
+
handleSlotProps
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
Switch.displayName = "Switch";
|
|
43
|
+
//#endregion
|
|
44
|
+
exports.Switch = Switch;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
import { SwitchProps as SwitchProps$1 } from "../../components/client/Switch/types.cjs";
|
|
3
|
+
import React from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/css-animation/Switch/Switch.d.ts
|
|
6
|
+
type SwitchProps = SwitchProps$1;
|
|
7
|
+
/**
|
|
8
|
+
* CSS-animation Switch variant. This component intentionally never imports motion.
|
|
9
|
+
*
|
|
10
|
+
* @componentType Client component
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* 'use client';
|
|
15
|
+
* import { Switch } from '@yahoo/uds/css-animation';
|
|
16
|
+
*
|
|
17
|
+
* <Switch label="Name" required />
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
declare const Switch: React.ForwardRefExoticComponent<SwitchProps$1 & React.RefAttributes<HTMLInputElement>>;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Switch, type SwitchProps };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { SwitchProps as SwitchProps$1 } from "../../components/client/Switch/types.js";
|
|
4
|
+
import React from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/css-animation/Switch/Switch.d.ts
|
|
7
|
+
type SwitchProps = SwitchProps$1;
|
|
8
|
+
/**
|
|
9
|
+
* CSS-animation Switch variant. This component intentionally never imports motion.
|
|
10
|
+
*
|
|
11
|
+
* @componentType Client component
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* 'use client';
|
|
16
|
+
* import { Switch } from '@yahoo/uds/css-animation';
|
|
17
|
+
*
|
|
18
|
+
* <Switch label="Name" required />
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
declare const Switch: React.ForwardRefExoticComponent<SwitchProps$1 & React.RefAttributes<HTMLInputElement>>;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { Switch, type SwitchProps };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
import { SwitchBase } from "../../components/client/Switch/SwitchBase.js";
|
|
4
|
+
import { SwitchStaticHandle } from "./SwitchStaticHandle.js";
|
|
5
|
+
import { forwardRef } from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
//#region src/css-animation/Switch/Switch.tsx
|
|
8
|
+
/**
|
|
9
|
+
* CSS-animation Switch variant. This component intentionally never imports motion.
|
|
10
|
+
*
|
|
11
|
+
* @componentType Client component
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* 'use client';
|
|
16
|
+
* import { Switch } from '@yahoo/uds/css-animation';
|
|
17
|
+
*
|
|
18
|
+
* <Switch label="Name" required />
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
const Switch = forwardRef(function Switch(props, parentRef) {
|
|
22
|
+
const cssAnimationDuration = "duration-120";
|
|
23
|
+
return /* @__PURE__ */ jsx(SwitchBase, {
|
|
24
|
+
...props,
|
|
25
|
+
ref: parentRef,
|
|
26
|
+
cssAnimationDuration,
|
|
27
|
+
renderHandle: ({ size, isOn, isOnTranslateClass, disabled, onIcon, offIcon, cssAnimationDuration, handleSlotProps }) => /* @__PURE__ */ jsx(SwitchStaticHandle, {
|
|
28
|
+
size,
|
|
29
|
+
isOn,
|
|
30
|
+
isOnTranslateClass,
|
|
31
|
+
cssAnimationDuration,
|
|
32
|
+
disabled,
|
|
33
|
+
onIcon,
|
|
34
|
+
offIcon,
|
|
35
|
+
handleSlotProps
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
Switch.displayName = "Switch";
|
|
40
|
+
//#endregion
|
|
41
|
+
export { Switch };
|
|
@@ -0,0 +1,56 @@
|
|
|
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_components_IconSlot = require("../../components/IconSlot.cjs");
|
|
7
|
+
const require_components_Box = require("../../components/Box.cjs");
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
//#region src/css-animation/Switch/SwitchStaticHandle.tsx
|
|
10
|
+
function SwitchStaticHandle({ size, isOn, isOnTranslateClass, cssAnimationDuration, disabled, onIcon, offIcon, handleSlotProps }) {
|
|
11
|
+
const classNames = {
|
|
12
|
+
handle: require_styles_styler.getStyles({
|
|
13
|
+
switchSizeHandle: size,
|
|
14
|
+
className: require_styles_styler.cx("relative", "pointer-events-none", "uds-border-radius-full", "overflow-hidden")
|
|
15
|
+
}),
|
|
16
|
+
handleCircle: require_styles_styler.getStyles({
|
|
17
|
+
switchVariantActiveHandle: isOn ? "on" : "off",
|
|
18
|
+
switchVariantHandle: "default",
|
|
19
|
+
className: require_styles_styler.cx("absolute", "top-0", "left-0", "right-0", "bottom-0", "opacity-95", !disabled && "group-hover:opacity-100", cssAnimationDuration, "transition-[background-color,box-shadow,opacity]")
|
|
20
|
+
}),
|
|
21
|
+
handleIcon: require_styles_styler.getStyles({
|
|
22
|
+
switchSizeHandleIcon: size,
|
|
23
|
+
switchVariantHandleIcon: "default",
|
|
24
|
+
switchVariantActiveHandleIcon: isOn ? "on" : "off",
|
|
25
|
+
className: require_styles_styler.cx("absolute", "opacity-0", "top-1/2", "left-1/2", "transform", "translate-x-[-50%]", "translate-y-[-50%]", cssAnimationDuration, "transition-opacity")
|
|
26
|
+
})
|
|
27
|
+
};
|
|
28
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_Box.Box, {
|
|
29
|
+
className: require_styles_styler.cx(classNames.handle, isOn ? isOnTranslateClass : "translate-x-0", "opacity-95", !disabled && "group-hover:opacity-100", !disabled && "group-hover:scale-105", cssAnimationDuration, "transition-[transform,opacity]"),
|
|
30
|
+
...handleSlotProps,
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Box.Box, { className: classNames.handleCircle }),
|
|
33
|
+
onIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
34
|
+
icon: onIcon,
|
|
35
|
+
iconProps: {
|
|
36
|
+
variant: "fill",
|
|
37
|
+
size: "sm"
|
|
38
|
+
},
|
|
39
|
+
"data-testid": "on-icon",
|
|
40
|
+
className: require_styles_styler.cx(classNames.handleIcon, isOn ? "opacity-100" : "opacity-0")
|
|
41
|
+
}),
|
|
42
|
+
offIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
43
|
+
icon: offIcon,
|
|
44
|
+
iconProps: {
|
|
45
|
+
variant: "fill",
|
|
46
|
+
size: "sm"
|
|
47
|
+
},
|
|
48
|
+
"data-testid": "off-icon",
|
|
49
|
+
className: require_styles_styler.cx(classNames.handleIcon, !isOn ? "opacity-100" : "opacity-0")
|
|
50
|
+
})
|
|
51
|
+
]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
SwitchStaticHandle.displayName = "SwitchStaticHandle";
|
|
55
|
+
//#endregion
|
|
56
|
+
exports.SwitchStaticHandle = SwitchStaticHandle;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
import { SwitchSize, UniversalSwitchProps } from "../../types/dist/index.cjs";
|
|
3
|
+
import { DataAttributes } from "../../components/client/Switch/types.cjs";
|
|
4
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/css-animation/Switch/SwitchStaticHandle.d.ts
|
|
7
|
+
type SwitchStaticHandleProps = {
|
|
8
|
+
size: SwitchSize;
|
|
9
|
+
isOn: boolean;
|
|
10
|
+
isOnTranslateClass: string;
|
|
11
|
+
cssAnimationDuration: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
onIcon?: UniversalSwitchProps['onIcon'];
|
|
14
|
+
offIcon?: UniversalSwitchProps['offIcon'];
|
|
15
|
+
handleSlotProps?: DataAttributes;
|
|
16
|
+
};
|
|
17
|
+
declare function SwitchStaticHandle({
|
|
18
|
+
size,
|
|
19
|
+
isOn,
|
|
20
|
+
isOnTranslateClass,
|
|
21
|
+
cssAnimationDuration,
|
|
22
|
+
disabled,
|
|
23
|
+
onIcon,
|
|
24
|
+
offIcon,
|
|
25
|
+
handleSlotProps
|
|
26
|
+
}: SwitchStaticHandleProps): _$react_jsx_runtime0.JSX.Element;
|
|
27
|
+
declare namespace SwitchStaticHandle {
|
|
28
|
+
var displayName: string;
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { SwitchStaticHandle, type SwitchStaticHandleProps };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { SwitchSize, UniversalSwitchProps } from "../../types/dist/index.js";
|
|
4
|
+
import { DataAttributes } from "../../components/client/Switch/types.js";
|
|
5
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/css-animation/Switch/SwitchStaticHandle.d.ts
|
|
8
|
+
type SwitchStaticHandleProps = {
|
|
9
|
+
size: SwitchSize;
|
|
10
|
+
isOn: boolean;
|
|
11
|
+
isOnTranslateClass: string;
|
|
12
|
+
cssAnimationDuration: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
onIcon?: UniversalSwitchProps['onIcon'];
|
|
15
|
+
offIcon?: UniversalSwitchProps['offIcon'];
|
|
16
|
+
handleSlotProps?: DataAttributes;
|
|
17
|
+
};
|
|
18
|
+
declare function SwitchStaticHandle({
|
|
19
|
+
size,
|
|
20
|
+
isOn,
|
|
21
|
+
isOnTranslateClass,
|
|
22
|
+
cssAnimationDuration,
|
|
23
|
+
disabled,
|
|
24
|
+
onIcon,
|
|
25
|
+
offIcon,
|
|
26
|
+
handleSlotProps
|
|
27
|
+
}: SwitchStaticHandleProps): _$react_jsx_runtime0.JSX.Element;
|
|
28
|
+
declare namespace SwitchStaticHandle {
|
|
29
|
+
var displayName: string;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { SwitchStaticHandle, type SwitchStaticHandleProps };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
import { cx, getStyles } from "../../styles/styler.js";
|
|
4
|
+
import { IconSlot } from "../../components/IconSlot.js";
|
|
5
|
+
import { Box } from "../../components/Box.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/css-animation/Switch/SwitchStaticHandle.tsx
|
|
8
|
+
function SwitchStaticHandle({ size, isOn, isOnTranslateClass, cssAnimationDuration, disabled, onIcon, offIcon, handleSlotProps }) {
|
|
9
|
+
const classNames = {
|
|
10
|
+
handle: getStyles({
|
|
11
|
+
switchSizeHandle: size,
|
|
12
|
+
className: cx("relative", "pointer-events-none", "uds-border-radius-full", "overflow-hidden")
|
|
13
|
+
}),
|
|
14
|
+
handleCircle: getStyles({
|
|
15
|
+
switchVariantActiveHandle: isOn ? "on" : "off",
|
|
16
|
+
switchVariantHandle: "default",
|
|
17
|
+
className: cx("absolute", "top-0", "left-0", "right-0", "bottom-0", "opacity-95", !disabled && "group-hover:opacity-100", cssAnimationDuration, "transition-[background-color,box-shadow,opacity]")
|
|
18
|
+
}),
|
|
19
|
+
handleIcon: getStyles({
|
|
20
|
+
switchSizeHandleIcon: size,
|
|
21
|
+
switchVariantHandleIcon: "default",
|
|
22
|
+
switchVariantActiveHandleIcon: isOn ? "on" : "off",
|
|
23
|
+
className: cx("absolute", "opacity-0", "top-1/2", "left-1/2", "transform", "translate-x-[-50%]", "translate-y-[-50%]", cssAnimationDuration, "transition-opacity")
|
|
24
|
+
})
|
|
25
|
+
};
|
|
26
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
27
|
+
className: cx(classNames.handle, isOn ? isOnTranslateClass : "translate-x-0", "opacity-95", !disabled && "group-hover:opacity-100", !disabled && "group-hover:scale-105", cssAnimationDuration, "transition-[transform,opacity]"),
|
|
28
|
+
...handleSlotProps,
|
|
29
|
+
children: [
|
|
30
|
+
/* @__PURE__ */ jsx(Box, { className: classNames.handleCircle }),
|
|
31
|
+
onIcon && /* @__PURE__ */ jsx(IconSlot, {
|
|
32
|
+
icon: onIcon,
|
|
33
|
+
iconProps: {
|
|
34
|
+
variant: "fill",
|
|
35
|
+
size: "sm"
|
|
36
|
+
},
|
|
37
|
+
"data-testid": "on-icon",
|
|
38
|
+
className: cx(classNames.handleIcon, isOn ? "opacity-100" : "opacity-0")
|
|
39
|
+
}),
|
|
40
|
+
offIcon && /* @__PURE__ */ jsx(IconSlot, {
|
|
41
|
+
icon: offIcon,
|
|
42
|
+
iconProps: {
|
|
43
|
+
variant: "fill",
|
|
44
|
+
size: "sm"
|
|
45
|
+
},
|
|
46
|
+
"data-testid": "off-icon",
|
|
47
|
+
className: cx(classNames.handleIcon, !isOn ? "opacity-100" : "opacity-0")
|
|
48
|
+
})
|
|
49
|
+
]
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
SwitchStaticHandle.displayName = "SwitchStaticHandle";
|
|
53
|
+
//#endregion
|
|
54
|
+
export { SwitchStaticHandle };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
const require_css_animation_Switch_Switch = require("./Switch.cjs");
|
|
5
|
+
exports.Switch = require_css_animation_Switch_Switch.Switch;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
const require_css_animation_Button_Button = require("./Button/Button.cjs");
|
|
5
|
+
const require_css_animation_IconButton_IconButton = require("./IconButton/IconButton.cjs");
|
|
6
|
+
const require_css_animation_Switch_Switch = require("./Switch/Switch.cjs");
|
|
7
|
+
exports.Button = require_css_animation_Button_Button.Button;
|
|
8
|
+
exports.IconButton = require_css_animation_IconButton_IconButton.IconButton;
|
|
9
|
+
exports.Switch = require_css_animation_Switch_Switch.Switch;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
|
|
2
|
+
import { ButtonProps } from "../components/client/Button/Button.cjs";
|
|
3
|
+
import { IconButtonProps } from "../components/client/IconButton/IconButton.cjs";
|
|
4
|
+
import { Button } from "./Button/Button.cjs";
|
|
5
|
+
import { IconButton } from "./IconButton/IconButton.cjs";
|
|
6
|
+
import { Switch, SwitchProps } from "./Switch/Switch.cjs";
|
|
7
|
+
export { Button, type ButtonProps, IconButton, type IconButtonProps, Switch, type SwitchProps };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { ButtonProps } from "../components/client/Button/Button.js";
|
|
4
|
+
import { IconButtonProps } from "../components/client/IconButton/IconButton.js";
|
|
5
|
+
import { Button } from "./Button/Button.js";
|
|
6
|
+
import { IconButton } from "./IconButton/IconButton.js";
|
|
7
|
+
import { Switch, SwitchProps } from "./Switch/Switch.js";
|
|
8
|
+
export { Button, type ButtonProps, IconButton, type IconButtonProps, Switch, type SwitchProps };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
require("../_virtual/_rolldown/runtime.cjs");
|
|
4
|
+
let react = require("react");
|
|
5
|
+
//#region src/hooks/usePrefersReducedMotion.ts
|
|
6
|
+
const REDUCED_MOTION_QUERY = "(prefers-reduced-motion: reduce)";
|
|
7
|
+
const usePrefersReducedMotion = () => {
|
|
8
|
+
const [prefersReducedMotion, setPrefersReducedMotion] = (0, react.useState)(false);
|
|
9
|
+
(0, react.useEffect)(() => {
|
|
10
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
11
|
+
const mediaQueryList = window.matchMedia(REDUCED_MOTION_QUERY);
|
|
12
|
+
const updatePreference = () => {
|
|
13
|
+
setPrefersReducedMotion(mediaQueryList.matches);
|
|
14
|
+
};
|
|
15
|
+
updatePreference();
|
|
16
|
+
mediaQueryList.addEventListener("change", updatePreference);
|
|
17
|
+
return () => {
|
|
18
|
+
mediaQueryList.removeEventListener("change", updatePreference);
|
|
19
|
+
};
|
|
20
|
+
}, []);
|
|
21
|
+
return prefersReducedMotion;
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
|
+
exports.usePrefersReducedMotion = usePrefersReducedMotion;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
//#region src/hooks/usePrefersReducedMotion.ts
|
|
4
|
+
const REDUCED_MOTION_QUERY = "(prefers-reduced-motion: reduce)";
|
|
5
|
+
const usePrefersReducedMotion = () => {
|
|
6
|
+
const [prefersReducedMotion, setPrefersReducedMotion] = useState(false);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
9
|
+
const mediaQueryList = window.matchMedia(REDUCED_MOTION_QUERY);
|
|
10
|
+
const updatePreference = () => {
|
|
11
|
+
setPrefersReducedMotion(mediaQueryList.matches);
|
|
12
|
+
};
|
|
13
|
+
updatePreference();
|
|
14
|
+
mediaQueryList.addEventListener("change", updatePreference);
|
|
15
|
+
return () => {
|
|
16
|
+
mediaQueryList.removeEventListener("change", updatePreference);
|
|
17
|
+
};
|
|
18
|
+
}, []);
|
|
19
|
+
return prefersReducedMotion;
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
export { usePrefersReducedMotion };
|