@yahoo/uds 3.160.0 → 3.162.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/components/client/BottomSheet/BottomSheet.cjs +2 -2
- package/dist/components/client/BottomSheet/BottomSheet.js +2 -2
- package/dist/components/client/Button/Button.cjs +2 -1
- package/dist/components/client/Button/Button.js +3 -2
- package/dist/components/client/Checkbox/Checkbox.cjs +118 -0
- package/dist/components/client/{Checkbox.d.cts → Checkbox/Checkbox.d.cts} +5 -18
- package/dist/components/client/{Checkbox.d.ts → Checkbox/Checkbox.d.ts} +5 -18
- package/dist/components/client/Checkbox/Checkbox.js +113 -0
- package/dist/components/client/Checkbox/CheckboxBase.cjs +141 -0
- package/dist/components/client/Checkbox/CheckboxBase.d.cts +48 -0
- package/dist/components/client/Checkbox/CheckboxBase.d.ts +49 -0
- package/dist/components/client/Checkbox/CheckboxBase.js +138 -0
- package/dist/components/client/Checkbox/checkboxConstants.cjs +23 -0
- package/dist/components/client/Checkbox/checkboxConstants.d.cts +25 -0
- package/dist/components/client/Checkbox/checkboxConstants.d.ts +26 -0
- package/dist/components/client/Checkbox/checkboxConstants.js +17 -0
- package/dist/components/client/Checkbox/index.cjs +10 -0
- package/dist/components/client/Checkbox/index.d.cts +6 -0
- package/dist/components/client/Checkbox/index.d.ts +7 -0
- package/dist/components/client/Checkbox/index.js +6 -0
- package/dist/components/client/Checkbox/types.cjs +2 -0
- package/dist/components/client/Checkbox/types.d.cts +22 -0
- package/dist/components/client/Checkbox/types.d.ts +23 -0
- package/dist/components/client/Checkbox/types.js +2 -0
- 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 +2 -1
- package/dist/components/client/IconButton/IconButton.js +3 -2
- package/dist/components/client/Input/Input.cjs +2 -2
- package/dist/components/client/Input/Input.js +2 -2
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.cts +1 -1
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.ts +1 -1
- 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/Popover/UDSPopoverConfigProvider.d.cts +1 -1
- package/dist/components/client/Popover/UDSPopoverConfigProvider.d.ts +1 -1
- package/dist/components/client/Radio/Radio.cjs +69 -165
- package/dist/components/client/Radio/Radio.d.cts +4 -17
- package/dist/components/client/Radio/Radio.d.ts +4 -17
- package/dist/components/client/Radio/Radio.js +69 -165
- package/dist/components/client/Radio/RadioBase.cjs +133 -0
- package/dist/components/client/Radio/RadioBase.d.cts +45 -0
- package/dist/components/client/Radio/RadioBase.d.ts +46 -0
- package/dist/components/client/Radio/RadioBase.js +130 -0
- package/dist/components/client/Radio/radioConstants.cjs +14 -0
- package/dist/components/client/Radio/radioConstants.d.cts +8 -0
- package/dist/components/client/Radio/radioConstants.d.ts +9 -0
- package/dist/components/client/Radio/radioConstants.js +11 -0
- package/dist/components/client/Radio/types.cjs +2 -0
- package/dist/components/client/Radio/types.d.cts +20 -0
- package/dist/components/client/Radio/types.d.ts +21 -0
- package/dist/components/client/Radio/types.js +2 -0
- package/dist/components/client/Switch/Switch.cjs +1 -1
- package/dist/components/client/Switch/Switch.js +1 -1
- 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 +2 -2
- package/dist/components/client/Toast/Toast.js +2 -2
- package/dist/components/client/index.cjs +2 -2
- package/dist/components/client/index.d.cts +1 -1
- package/dist/components/client/index.d.ts +1 -1
- package/dist/components/client/index.js +1 -1
- package/dist/components/index.cjs +2 -2
- package/dist/components/index.d.cts +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +1 -1
- package/dist/css-animation/Checkbox/Checkbox.cjs +75 -0
- package/dist/css-animation/Checkbox/Checkbox.d.cts +22 -0
- package/dist/css-animation/Checkbox/Checkbox.d.ts +23 -0
- package/dist/css-animation/Checkbox/Checkbox.js +72 -0
- package/dist/css-animation/Checkbox/index.cjs +5 -0
- package/dist/css-animation/Checkbox/index.d.cts +3 -0
- package/dist/css-animation/Checkbox/index.d.ts +4 -0
- package/dist/css-animation/Checkbox/index.js +4 -0
- package/dist/css-animation/Radio/Radio.cjs +92 -0
- package/dist/css-animation/Radio/Radio.d.cts +22 -0
- package/dist/css-animation/Radio/Radio.d.ts +23 -0
- package/dist/css-animation/Radio/Radio.js +89 -0
- package/dist/css-animation/Radio/index.cjs +5 -0
- package/dist/css-animation/Radio/index.d.cts +3 -0
- package/dist/css-animation/Radio/index.d.ts +4 -0
- package/dist/css-animation/Radio/index.js +4 -0
- package/dist/css-animation/index.cjs +4 -0
- package/dist/css-animation/index.d.cts +3 -1
- package/dist/css-animation/index.d.ts +3 -1
- package/dist/css-animation/index.js +3 -1
- package/dist/hooks/usePrefersReducedMotion.cjs +27 -15
- package/dist/hooks/usePrefersReducedMotion.js +28 -16
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/styles/styler.d.cts +45 -45
- package/dist/styles/styler.d.ts +45 -45
- package/dist/uds/generated/componentData.cjs +2540 -2490
- package/dist/uds/generated/componentData.js +2540 -2490
- package/dist/uds/generated/tailwindPurge.cjs +12 -12
- package/dist/uds/generated/tailwindPurge.js +12 -12
- package/generated/componentData.json +3258 -3169
- package/generated/tailwindPurge.ts +2 -2
- package/package.json +1 -1
- package/dist/components/client/Checkbox.cjs +0 -223
- package/dist/components/client/Checkbox.js +0 -218
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
import { cx, getStyles } from "../../../styles/styler.js";
|
|
4
|
+
import { FormLabel } from "../../FormLabel.js";
|
|
5
|
+
import { VARIANT_ERROR_MAP, getIcon, isIndeterminate } from "./checkboxConstants.js";
|
|
6
|
+
import { forwardRef, useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
7
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/client/Checkbox/CheckboxBase.tsx
|
|
9
|
+
const CheckboxBase = forwardRef(function CheckboxBase({ id, checked: checkedProp, defaultChecked, onChange, label, labelPosition = "start", variant: variantProp = "primary", size = "md", reduceMotion: _reduceMotion, disabled, required, hasError, className, style, slotProps, cssAnimationDuration, enableInteractionTracking = false, renderRoot, renderIndicator, ...checkboxProps }, parentRef) {
|
|
10
|
+
const generatedId = useId();
|
|
11
|
+
const uid = id ?? `uds-input-${generatedId}`;
|
|
12
|
+
const rootSlotProps = slotProps?.root ?? {};
|
|
13
|
+
const checkboxSlotProps = slotProps?.checkbox ?? {};
|
|
14
|
+
const iconSlotProps = slotProps?.icon ?? {};
|
|
15
|
+
const labelSlotProps = slotProps?.label ?? {};
|
|
16
|
+
const innerRef = useRef(null);
|
|
17
|
+
/**
|
|
18
|
+
* State
|
|
19
|
+
*/
|
|
20
|
+
const isControlled = checkedProp !== void 0;
|
|
21
|
+
const [checked, setChecked] = useState(isControlled ? checkedProp : defaultChecked);
|
|
22
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
23
|
+
const [isPressed, setIsPressed] = useState(false);
|
|
24
|
+
/**
|
|
25
|
+
* Derived values
|
|
26
|
+
*/
|
|
27
|
+
const variant = useMemo(() => hasError ? VARIANT_ERROR_MAP[variantProp] : variantProp, [hasError, variantProp]);
|
|
28
|
+
const showHoverEffect = enableInteractionTracking && !disabled && isHovered;
|
|
29
|
+
const showPressedEffect = enableInteractionTracking && !disabled && isPressed;
|
|
30
|
+
/**
|
|
31
|
+
* Handlers
|
|
32
|
+
*/
|
|
33
|
+
const handleChange = useCallback((e) => {
|
|
34
|
+
onChange?.(e);
|
|
35
|
+
if (!isControlled) setChecked(e.target.checked);
|
|
36
|
+
}, [isControlled, onChange]);
|
|
37
|
+
const handleHoverStart = useCallback(() => {
|
|
38
|
+
if (enableInteractionTracking) setIsHovered(true);
|
|
39
|
+
}, [enableInteractionTracking]);
|
|
40
|
+
const handleHoverEnd = useCallback(() => {
|
|
41
|
+
if (enableInteractionTracking) setIsHovered(false);
|
|
42
|
+
}, [enableInteractionTracking]);
|
|
43
|
+
const handleTapStart = useCallback(() => {
|
|
44
|
+
if (enableInteractionTracking) setIsPressed(true);
|
|
45
|
+
}, [enableInteractionTracking]);
|
|
46
|
+
const handleTapEnd = useCallback(() => {
|
|
47
|
+
if (enableInteractionTracking) setIsPressed(false);
|
|
48
|
+
}, [enableInteractionTracking]);
|
|
49
|
+
/**
|
|
50
|
+
* Helpers
|
|
51
|
+
*/
|
|
52
|
+
const setDOMIndeterminate = (checked_) => {
|
|
53
|
+
if (!innerRef.current) return;
|
|
54
|
+
innerRef.current.indeterminate = isIndeterminate(checked_);
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Effects
|
|
58
|
+
*/
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (isControlled) setChecked(checkedProp);
|
|
61
|
+
}, [checkedProp, isControlled]);
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
setDOMIndeterminate(checked);
|
|
64
|
+
}, [checked]);
|
|
65
|
+
const valueState = isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
|
|
66
|
+
const classNames = {
|
|
67
|
+
root: getStyles({
|
|
68
|
+
checkboxSizeRoot: size,
|
|
69
|
+
checkboxVariantRoot: variant,
|
|
70
|
+
checkboxVariantValueRoot: valueState,
|
|
71
|
+
display: "flex",
|
|
72
|
+
flexDirection: labelPosition === "start" ? "row" : "row-reverse",
|
|
73
|
+
alignItems: "center",
|
|
74
|
+
className: cx({
|
|
75
|
+
"cursor-pointer": !disabled,
|
|
76
|
+
"cursor-default": disabled,
|
|
77
|
+
"opacity-50": disabled
|
|
78
|
+
}, className)
|
|
79
|
+
}),
|
|
80
|
+
htmlCheckbox: cx("cursor-[inherit]", "absolute", "opacity-0", "top-1/2", "left-1/2", "w-[calc(100%+2px)]", "h-[calc(100%+2px)]", "transform", "translate-x-[-50%]", "translate-y-[-50%]"),
|
|
81
|
+
label: cx(labelPosition === "start" ? "text-start" : "text-end")
|
|
82
|
+
};
|
|
83
|
+
const input = /* @__PURE__ */ jsx("input", {
|
|
84
|
+
type: "checkbox",
|
|
85
|
+
tabIndex: 0,
|
|
86
|
+
...checkboxProps,
|
|
87
|
+
ref: (ref) => {
|
|
88
|
+
innerRef.current = ref;
|
|
89
|
+
setDOMIndeterminate(checked);
|
|
90
|
+
if (typeof parentRef === "function") parentRef(ref);
|
|
91
|
+
else if (parentRef !== null) parentRef.current = ref;
|
|
92
|
+
},
|
|
93
|
+
id: uid,
|
|
94
|
+
disabled,
|
|
95
|
+
required,
|
|
96
|
+
"aria-invalid": hasError,
|
|
97
|
+
checked: isControlled ? isIndeterminate(checked) ? false : checked : void 0,
|
|
98
|
+
defaultChecked: isControlled ? void 0 : defaultChecked,
|
|
99
|
+
onChange: handleChange,
|
|
100
|
+
className: classNames.htmlCheckbox
|
|
101
|
+
});
|
|
102
|
+
return renderRoot({
|
|
103
|
+
className: classNames.root,
|
|
104
|
+
style,
|
|
105
|
+
rootSlotProps,
|
|
106
|
+
hasLabel: Boolean(label),
|
|
107
|
+
isPressed,
|
|
108
|
+
onHoverStart: handleHoverStart,
|
|
109
|
+
onHoverEnd: handleHoverEnd,
|
|
110
|
+
onTapStart: handleTapStart,
|
|
111
|
+
onTapEnd: handleTapEnd,
|
|
112
|
+
children: /* @__PURE__ */ jsxs(Fragment$1, { children: [renderIndicator({
|
|
113
|
+
size,
|
|
114
|
+
variant,
|
|
115
|
+
valueState,
|
|
116
|
+
checked,
|
|
117
|
+
disabled,
|
|
118
|
+
showHoverEffect,
|
|
119
|
+
showPressedEffect,
|
|
120
|
+
cssAnimationDuration,
|
|
121
|
+
checkIcon: getIcon(checked),
|
|
122
|
+
checkboxSlotProps,
|
|
123
|
+
iconSlotProps,
|
|
124
|
+
children: input
|
|
125
|
+
}), label && /* @__PURE__ */ jsx(FormLabel, {
|
|
126
|
+
as: "div",
|
|
127
|
+
variant: "inherit",
|
|
128
|
+
color: "inherit",
|
|
129
|
+
required,
|
|
130
|
+
label,
|
|
131
|
+
className: classNames.label,
|
|
132
|
+
...labelSlotProps
|
|
133
|
+
})] })
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
CheckboxBase.displayName = "CheckboxBase";
|
|
137
|
+
//#endregion
|
|
138
|
+
export { CheckboxBase };
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
let _yahoo_uds_icons = require("@yahoo/uds-icons");
|
|
6
|
+
//#region src/components/client/Checkbox/checkboxConstants.ts
|
|
7
|
+
const VARIANTS = ["primary", "secondary"];
|
|
8
|
+
const SIZES = ["sm", "md"];
|
|
9
|
+
const VARIANT_ERROR_MAP = {
|
|
10
|
+
primary: "alert",
|
|
11
|
+
secondary: "alert-secondary"
|
|
12
|
+
};
|
|
13
|
+
const isIndeterminate = (checked) => checked === "indeterminate";
|
|
14
|
+
const getIcon = (checked) => {
|
|
15
|
+
if (isIndeterminate(checked)) return _yahoo_uds_icons.Minus;
|
|
16
|
+
return _yahoo_uds_icons.Check;
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
exports.SIZES = SIZES;
|
|
20
|
+
exports.VARIANTS = VARIANTS;
|
|
21
|
+
exports.VARIANT_ERROR_MAP = VARIANT_ERROR_MAP;
|
|
22
|
+
exports.getIcon = getIcon;
|
|
23
|
+
exports.isIndeterminate = isIndeterminate;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
import { CheckboxValue, CheckboxVariant } from "../../../types/dist/index.cjs";
|
|
3
|
+
import { IconVariant, SvgIconProps } from "../../../icons/dist/types.cjs";
|
|
4
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/components/client/Checkbox/checkboxConstants.d.ts
|
|
7
|
+
declare const VARIANTS: ("primary" | "secondary")[];
|
|
8
|
+
declare const SIZES: ("sm" | "md")[];
|
|
9
|
+
declare const VARIANT_ERROR_MAP: Record<CheckboxVariant, 'alert' | 'alert-secondary'>;
|
|
10
|
+
declare const isIndeterminate: (checked?: CheckboxValue) => checked is "indeterminate";
|
|
11
|
+
declare const getIcon: (checked?: CheckboxValue) => {
|
|
12
|
+
({
|
|
13
|
+
size,
|
|
14
|
+
variant
|
|
15
|
+
}: SvgIconProps): _$react_jsx_runtime0.JSX.Element;
|
|
16
|
+
metadata: {
|
|
17
|
+
name: string;
|
|
18
|
+
isSvgIcon: boolean;
|
|
19
|
+
variants: IconVariant[];
|
|
20
|
+
category: string;
|
|
21
|
+
tags: string[];
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export { SIZES, VARIANTS, VARIANT_ERROR_MAP, getIcon, isIndeterminate };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { CheckboxValue, CheckboxVariant } from "../../../types/dist/index.js";
|
|
4
|
+
import { IconVariant, SvgIconProps } from "../../../icons/dist/types.js";
|
|
5
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/components/client/Checkbox/checkboxConstants.d.ts
|
|
8
|
+
declare const VARIANTS: ("primary" | "secondary")[];
|
|
9
|
+
declare const SIZES: ("sm" | "md")[];
|
|
10
|
+
declare const VARIANT_ERROR_MAP: Record<CheckboxVariant, 'alert' | 'alert-secondary'>;
|
|
11
|
+
declare const isIndeterminate: (checked?: CheckboxValue) => checked is "indeterminate";
|
|
12
|
+
declare const getIcon: (checked?: CheckboxValue) => {
|
|
13
|
+
({
|
|
14
|
+
size,
|
|
15
|
+
variant
|
|
16
|
+
}: SvgIconProps): _$react_jsx_runtime0.JSX.Element;
|
|
17
|
+
metadata: {
|
|
18
|
+
name: string;
|
|
19
|
+
isSvgIcon: boolean;
|
|
20
|
+
variants: IconVariant[];
|
|
21
|
+
category: string;
|
|
22
|
+
tags: string[];
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { SIZES, VARIANTS, VARIANT_ERROR_MAP, getIcon, isIndeterminate };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
import { Check, Minus } from "@yahoo/uds-icons";
|
|
4
|
+
//#region src/components/client/Checkbox/checkboxConstants.ts
|
|
5
|
+
const VARIANTS = ["primary", "secondary"];
|
|
6
|
+
const SIZES = ["sm", "md"];
|
|
7
|
+
const VARIANT_ERROR_MAP = {
|
|
8
|
+
primary: "alert",
|
|
9
|
+
secondary: "alert-secondary"
|
|
10
|
+
};
|
|
11
|
+
const isIndeterminate = (checked) => checked === "indeterminate";
|
|
12
|
+
const getIcon = (checked) => {
|
|
13
|
+
if (isIndeterminate(checked)) return Minus;
|
|
14
|
+
return Check;
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { SIZES, VARIANTS, VARIANT_ERROR_MAP, getIcon, isIndeterminate };
|
|
@@ -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_Checkbox_checkboxConstants = require("./checkboxConstants.cjs");
|
|
5
|
+
const require_components_client_Checkbox_CheckboxBase = require("./CheckboxBase.cjs");
|
|
6
|
+
const require_components_client_Checkbox_Checkbox = require("./Checkbox.cjs");
|
|
7
|
+
exports.Checkbox = require_components_client_Checkbox_Checkbox.Checkbox;
|
|
8
|
+
exports.CheckboxBase = require_components_client_Checkbox_CheckboxBase.CheckboxBase;
|
|
9
|
+
exports.SIZES = require_components_client_Checkbox_checkboxConstants.SIZES;
|
|
10
|
+
exports.VARIANTS = require_components_client_Checkbox_checkboxConstants.VARIANTS;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
|
|
2
|
+
import { SIZES, VARIANTS } from "./checkboxConstants.cjs";
|
|
3
|
+
import { CheckboxChangeEvent, CheckboxValueState, DataAttributes } from "./types.cjs";
|
|
4
|
+
import { Checkbox, CheckboxProps } from "./Checkbox.cjs";
|
|
5
|
+
import { CheckboxBase, CheckboxBaseProps } from "./CheckboxBase.cjs";
|
|
6
|
+
export { Checkbox, CheckboxBase, type CheckboxBaseProps, type CheckboxChangeEvent, type CheckboxProps, type CheckboxValueState, type DataAttributes, SIZES, VARIANTS };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { SIZES, VARIANTS } from "./checkboxConstants.js";
|
|
4
|
+
import { CheckboxChangeEvent, CheckboxValueState, DataAttributes } from "./types.js";
|
|
5
|
+
import { Checkbox, CheckboxProps } from "./Checkbox.js";
|
|
6
|
+
import { CheckboxBase, CheckboxBaseProps } from "./CheckboxBase.js";
|
|
7
|
+
export { Checkbox, CheckboxBase, type CheckboxBaseProps, type CheckboxChangeEvent, type CheckboxProps, type CheckboxValueState, type DataAttributes, SIZES, VARIANTS };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
import { SIZES, VARIANTS } from "./checkboxConstants.js";
|
|
4
|
+
import { CheckboxBase } from "./CheckboxBase.js";
|
|
5
|
+
import { Checkbox } from "./Checkbox.js";
|
|
6
|
+
export { Checkbox, CheckboxBase, SIZES, VARIANTS };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
import { UniversalCheckboxProps } from "../../../types/dist/index.cjs";
|
|
3
|
+
import React, { ChangeEvent } from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/client/Checkbox/types.d.ts
|
|
6
|
+
type DataAttributes = {
|
|
7
|
+
[name: `data-${string}`]: string;
|
|
8
|
+
};
|
|
9
|
+
type NativeInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'checked' | 'size' | 'height' | 'width' | 'color'>;
|
|
10
|
+
type CheckboxChangeEvent = ChangeEvent<HTMLInputElement>;
|
|
11
|
+
type CheckboxValueState = 'checked' | 'unchecked' | 'indeterminate';
|
|
12
|
+
interface CheckboxProps extends NativeInputProps, UniversalCheckboxProps {
|
|
13
|
+
/** Props to be passed into various slots within the component. */
|
|
14
|
+
slotProps?: {
|
|
15
|
+
root?: DataAttributes;
|
|
16
|
+
checkbox?: DataAttributes;
|
|
17
|
+
icon?: DataAttributes;
|
|
18
|
+
label?: DataAttributes;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { type CheckboxChangeEvent, type CheckboxProps, type CheckboxValueState, type DataAttributes, type NativeInputProps };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { UniversalCheckboxProps } from "../../../types/dist/index.js";
|
|
4
|
+
import React, { ChangeEvent } from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/components/client/Checkbox/types.d.ts
|
|
7
|
+
type DataAttributes = {
|
|
8
|
+
[name: `data-${string}`]: string;
|
|
9
|
+
};
|
|
10
|
+
type NativeInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'checked' | 'size' | 'height' | 'width' | 'color'>;
|
|
11
|
+
type CheckboxChangeEvent = ChangeEvent<HTMLInputElement>;
|
|
12
|
+
type CheckboxValueState = 'checked' | 'unchecked' | 'indeterminate';
|
|
13
|
+
interface CheckboxProps extends NativeInputProps, UniversalCheckboxProps {
|
|
14
|
+
/** Props to be passed into various slots within the component. */
|
|
15
|
+
slotProps?: {
|
|
16
|
+
root?: DataAttributes;
|
|
17
|
+
checkbox?: DataAttributes;
|
|
18
|
+
icon?: DataAttributes;
|
|
19
|
+
label?: DataAttributes;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { type CheckboxChangeEvent, type CheckboxProps, type CheckboxValueState, type DataAttributes, type NativeInputProps };
|
|
@@ -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 ?? {};
|
|
@@ -5,6 +5,7 @@ require("../../../_virtual/_rolldown/runtime.cjs");
|
|
|
5
5
|
const require_index = require("../../../css-tokens/dist/index.cjs");
|
|
6
6
|
const require_utils_createSlot = require("../../../utils/createSlot.cjs");
|
|
7
7
|
const require_components_Icon = require("../../Icon.cjs");
|
|
8
|
+
const require_hooks_usePrefersReducedMotion = require("../../../hooks/usePrefersReducedMotion.cjs");
|
|
8
9
|
const require_components_client_SpringMotionConfig = require("../SpringMotionConfig.cjs");
|
|
9
10
|
require("../Button/buttonConstants.cjs");
|
|
10
11
|
const require_components_client_Button_Button = require("../Button/Button.cjs");
|
|
@@ -20,7 +21,7 @@ let motion_react = require("motion/react");
|
|
|
20
21
|
* @componentType Client component
|
|
21
22
|
*/
|
|
22
23
|
const IconButton = (0, react.forwardRef)(function IconButton(props, forwardedRef) {
|
|
23
|
-
const prefersReducedMotion =
|
|
24
|
+
const prefersReducedMotion = require_hooks_usePrefersReducedMotion.usePrefersReducedMotion();
|
|
24
25
|
const disableMotion = !!props.disableEffects || !!props.disabled;
|
|
25
26
|
const layoutVariant = (0, react.useMemo)(() => prefersReducedMotion ? "smooth" : "subtle", [prefersReducedMotion]);
|
|
26
27
|
const Slot = (0, react.useMemo)(() => require_utils_createSlot.createSlot(), []);
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { BUTTON_SCALE_EFFECT_HOVER, BUTTON_SCALE_EFFECT_PRESSED, BUTTON_SCALE_EFFECT_REST } from "../../../css-tokens/dist/index.js";
|
|
4
4
|
import { createSlot } from "../../../utils/createSlot.js";
|
|
5
5
|
import { Icon } from "../../Icon.js";
|
|
6
|
+
import { usePrefersReducedMotion } from "../../../hooks/usePrefersReducedMotion.js";
|
|
6
7
|
import { SpringMotionConfig } from "../SpringMotionConfig.js";
|
|
7
8
|
import "../Button/buttonConstants.js";
|
|
8
9
|
import { iconMotionVariants, loadingMotionVariants } from "../Button/Button.js";
|
|
@@ -10,7 +11,7 @@ import { IconButtonBase, renderIconButtonAsChild } from "./IconButtonBase.js";
|
|
|
10
11
|
import { Progress } from "@yahoo/uds-icons";
|
|
11
12
|
import { forwardRef, isValidElement, useMemo } from "react";
|
|
12
13
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { AnimatePresence, m
|
|
14
|
+
import { AnimatePresence, m } from "motion/react";
|
|
14
15
|
//#region src/components/client/IconButton/IconButton.tsx
|
|
15
16
|
/**
|
|
16
17
|
* **⚙️️ An icon button element that can be used to trigger an action**
|
|
@@ -18,7 +19,7 @@ import { AnimatePresence, m, useReducedMotion } from "motion/react";
|
|
|
18
19
|
* @componentType Client component
|
|
19
20
|
*/
|
|
20
21
|
const IconButton = forwardRef(function IconButton(props, forwardedRef) {
|
|
21
|
-
const prefersReducedMotion =
|
|
22
|
+
const prefersReducedMotion = usePrefersReducedMotion();
|
|
22
23
|
const disableMotion = !!props.disableEffects || !!props.disabled;
|
|
23
24
|
const layoutVariant = useMemo(() => prefersReducedMotion ? "smooth" : "subtle", [prefersReducedMotion]);
|
|
24
25
|
const Slot = useMemo(() => createSlot(), []);
|
|
@@ -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 = {
|
|
@@ -131,6 +131,6 @@ interface MenuItemCheckboxProps extends Omit<PressableProps, 'asChild'>, HtmlBut
|
|
|
131
131
|
*
|
|
132
132
|
* @related [Menu](https://uds.build/docs/components/menu), [Menu.Item](https://uds.build/docs/components/menu-item)
|
|
133
133
|
**/
|
|
134
|
-
declare const MenuItemCheckbox: _$react.ForwardRefExoticComponent<Omit<MenuItemCheckboxProps, "active" | "
|
|
134
|
+
declare const MenuItemCheckbox: _$react.ForwardRefExoticComponent<Omit<MenuItemCheckboxProps, "active" | "rootProps" | "hideEndIcon"> & _$react.RefAttributes<HTMLDivElement>>;
|
|
135
135
|
//#endregion
|
|
136
136
|
export { MenuItemCheckbox, type MenuItemCheckboxProps };
|
|
@@ -132,6 +132,6 @@ interface MenuItemCheckboxProps extends Omit<PressableProps, 'asChild'>, HtmlBut
|
|
|
132
132
|
*
|
|
133
133
|
* @related [Menu](https://uds.build/docs/components/menu), [Menu.Item](https://uds.build/docs/components/menu-item)
|
|
134
134
|
**/
|
|
135
|
-
declare const MenuItemCheckbox: _$react.ForwardRefExoticComponent<Omit<MenuItemCheckboxProps, "active" | "
|
|
135
|
+
declare const MenuItemCheckbox: _$react.ForwardRefExoticComponent<Omit<MenuItemCheckboxProps, "active" | "rootProps" | "hideEndIcon"> & _$react.RefAttributes<HTMLDivElement>>;
|
|
136
136
|
//#endregion
|
|
137
137
|
export { MenuItemCheckbox, type MenuItemCheckboxProps };
|
|
@@ -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: {
|
|
@@ -29,7 +29,7 @@ declare function usePopoverConfig(sizeProp?: PopoverSize | undefined, variantPro
|
|
|
29
29
|
gap: SpacingAlias;
|
|
30
30
|
dismissButtonSpacing: SpacingAlias;
|
|
31
31
|
dismissIconSize: number;
|
|
32
|
-
ariaKitPlacement: ("
|
|
32
|
+
ariaKitPlacement: ("top-start" | "top-end" | "bottom-start" | "bottom-end" | ("top" | "bottom" | "left" | "right") | "left-start" | "right-start" | "left-end" | "right-end") | undefined;
|
|
33
33
|
animationDuration: number;
|
|
34
34
|
};
|
|
35
35
|
//#endregion
|