@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.
Files changed (107) hide show
  1. package/dist/components/client/BottomSheet/BottomSheet.cjs +2 -2
  2. package/dist/components/client/BottomSheet/BottomSheet.js +2 -2
  3. package/dist/components/client/Button/Button.cjs +2 -1
  4. package/dist/components/client/Button/Button.js +3 -2
  5. package/dist/components/client/Checkbox/Checkbox.cjs +118 -0
  6. package/dist/components/client/{Checkbox.d.cts → Checkbox/Checkbox.d.cts} +5 -18
  7. package/dist/components/client/{Checkbox.d.ts → Checkbox/Checkbox.d.ts} +5 -18
  8. package/dist/components/client/Checkbox/Checkbox.js +113 -0
  9. package/dist/components/client/Checkbox/CheckboxBase.cjs +141 -0
  10. package/dist/components/client/Checkbox/CheckboxBase.d.cts +48 -0
  11. package/dist/components/client/Checkbox/CheckboxBase.d.ts +49 -0
  12. package/dist/components/client/Checkbox/CheckboxBase.js +138 -0
  13. package/dist/components/client/Checkbox/checkboxConstants.cjs +23 -0
  14. package/dist/components/client/Checkbox/checkboxConstants.d.cts +25 -0
  15. package/dist/components/client/Checkbox/checkboxConstants.d.ts +26 -0
  16. package/dist/components/client/Checkbox/checkboxConstants.js +17 -0
  17. package/dist/components/client/Checkbox/index.cjs +10 -0
  18. package/dist/components/client/Checkbox/index.d.cts +6 -0
  19. package/dist/components/client/Checkbox/index.d.ts +7 -0
  20. package/dist/components/client/Checkbox/index.js +6 -0
  21. package/dist/components/client/Checkbox/types.cjs +2 -0
  22. package/dist/components/client/Checkbox/types.d.cts +22 -0
  23. package/dist/components/client/Checkbox/types.d.ts +23 -0
  24. package/dist/components/client/Checkbox/types.js +2 -0
  25. package/dist/components/client/Chip/ChipBase.cjs +2 -2
  26. package/dist/components/client/Chip/ChipBase.js +2 -2
  27. package/dist/components/client/IconButton/IconButton.cjs +2 -1
  28. package/dist/components/client/IconButton/IconButton.js +3 -2
  29. package/dist/components/client/Input/Input.cjs +2 -2
  30. package/dist/components/client/Input/Input.js +2 -2
  31. package/dist/components/client/Menu/Menu.ItemCheckbox.d.cts +1 -1
  32. package/dist/components/client/Menu/Menu.ItemCheckbox.d.ts +1 -1
  33. package/dist/components/client/Modal/ManagedModal.cjs +2 -2
  34. package/dist/components/client/Modal/ManagedModal.js +2 -2
  35. package/dist/components/client/Modal/Modal.cjs +2 -2
  36. package/dist/components/client/Modal/Modal.js +2 -2
  37. package/dist/components/client/Popover/Popover.cjs +2 -2
  38. package/dist/components/client/Popover/Popover.js +2 -2
  39. package/dist/components/client/Popover/UDSPopoverConfigProvider.d.cts +1 -1
  40. package/dist/components/client/Popover/UDSPopoverConfigProvider.d.ts +1 -1
  41. package/dist/components/client/Radio/Radio.cjs +69 -165
  42. package/dist/components/client/Radio/Radio.d.cts +4 -17
  43. package/dist/components/client/Radio/Radio.d.ts +4 -17
  44. package/dist/components/client/Radio/Radio.js +69 -165
  45. package/dist/components/client/Radio/RadioBase.cjs +133 -0
  46. package/dist/components/client/Radio/RadioBase.d.cts +45 -0
  47. package/dist/components/client/Radio/RadioBase.d.ts +46 -0
  48. package/dist/components/client/Radio/RadioBase.js +130 -0
  49. package/dist/components/client/Radio/radioConstants.cjs +14 -0
  50. package/dist/components/client/Radio/radioConstants.d.cts +8 -0
  51. package/dist/components/client/Radio/radioConstants.d.ts +9 -0
  52. package/dist/components/client/Radio/radioConstants.js +11 -0
  53. package/dist/components/client/Radio/types.cjs +2 -0
  54. package/dist/components/client/Radio/types.d.cts +20 -0
  55. package/dist/components/client/Radio/types.d.ts +21 -0
  56. package/dist/components/client/Radio/types.js +2 -0
  57. package/dist/components/client/Switch/Switch.cjs +1 -1
  58. package/dist/components/client/Switch/Switch.js +1 -1
  59. package/dist/components/client/Tabs/TabList.cjs +2 -2
  60. package/dist/components/client/Tabs/TabList.js +2 -2
  61. package/dist/components/client/Toast/Toast.cjs +2 -2
  62. package/dist/components/client/Toast/Toast.js +2 -2
  63. package/dist/components/client/index.cjs +2 -2
  64. package/dist/components/client/index.d.cts +1 -1
  65. package/dist/components/client/index.d.ts +1 -1
  66. package/dist/components/client/index.js +1 -1
  67. package/dist/components/index.cjs +2 -2
  68. package/dist/components/index.d.cts +1 -1
  69. package/dist/components/index.d.ts +1 -1
  70. package/dist/components/index.js +1 -1
  71. package/dist/css-animation/Checkbox/Checkbox.cjs +75 -0
  72. package/dist/css-animation/Checkbox/Checkbox.d.cts +22 -0
  73. package/dist/css-animation/Checkbox/Checkbox.d.ts +23 -0
  74. package/dist/css-animation/Checkbox/Checkbox.js +72 -0
  75. package/dist/css-animation/Checkbox/index.cjs +5 -0
  76. package/dist/css-animation/Checkbox/index.d.cts +3 -0
  77. package/dist/css-animation/Checkbox/index.d.ts +4 -0
  78. package/dist/css-animation/Checkbox/index.js +4 -0
  79. package/dist/css-animation/Radio/Radio.cjs +92 -0
  80. package/dist/css-animation/Radio/Radio.d.cts +22 -0
  81. package/dist/css-animation/Radio/Radio.d.ts +23 -0
  82. package/dist/css-animation/Radio/Radio.js +89 -0
  83. package/dist/css-animation/Radio/index.cjs +5 -0
  84. package/dist/css-animation/Radio/index.d.cts +3 -0
  85. package/dist/css-animation/Radio/index.d.ts +4 -0
  86. package/dist/css-animation/Radio/index.js +4 -0
  87. package/dist/css-animation/index.cjs +4 -0
  88. package/dist/css-animation/index.d.cts +3 -1
  89. package/dist/css-animation/index.d.ts +3 -1
  90. package/dist/css-animation/index.js +3 -1
  91. package/dist/hooks/usePrefersReducedMotion.cjs +27 -15
  92. package/dist/hooks/usePrefersReducedMotion.js +28 -16
  93. package/dist/index.cjs +2 -2
  94. package/dist/index.d.cts +1 -1
  95. package/dist/index.d.ts +1 -1
  96. package/dist/index.js +1 -1
  97. package/dist/styles/styler.d.cts +45 -45
  98. package/dist/styles/styler.d.ts +45 -45
  99. package/dist/uds/generated/componentData.cjs +2540 -2490
  100. package/dist/uds/generated/componentData.js +2540 -2490
  101. package/dist/uds/generated/tailwindPurge.cjs +12 -12
  102. package/dist/uds/generated/tailwindPurge.js +12 -12
  103. package/generated/componentData.json +3258 -3169
  104. package/generated/tailwindPurge.ts +2 -2
  105. package/package.json +1 -1
  106. package/dist/components/client/Checkbox.cjs +0 -223
  107. package/dist/components/client/Checkbox.js +0 -218
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@yahoo/uds",
3
3
  "description": "Yahoo Universal System",
4
- "version": "3.160.0",
4
+ "version": "3.162.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.js",
@@ -1,223 +0,0 @@
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_components_Icon = require("../Icon.cjs");
7
- const require_components_Box = require("../Box.cjs");
8
- const require_components_FormLabel = require("../FormLabel.cjs");
9
- const require_components_client_SpringMotionConfig = require("./SpringMotionConfig.cjs");
10
- let _yahoo_uds_icons = require("@yahoo/uds-icons");
11
- let react = require("react");
12
- react = require_runtime.__toESM(react);
13
- let react_jsx_runtime = require("react/jsx-runtime");
14
- let motion_react = require("motion/react");
15
- //#region src/components/client/Checkbox.tsx
16
- const VARIANTS = ["primary", "secondary"];
17
- const SIZES = ["sm", "md"];
18
- const VARIANT_ERROR_MAP = {
19
- primary: "alert",
20
- secondary: "alert-secondary"
21
- };
22
- const isIndeterminate = (checked) => checked === "indeterminate";
23
- const getIcon = (checked) => {
24
- if (isIndeterminate(checked)) return _yahoo_uds_icons.Minus;
25
- return _yahoo_uds_icons.Check;
26
- };
27
- const MotionBox = motion_react.m.create(require_components_Box.Box);
28
- const hoverTransition = {
29
- layoutVariant: "smooth",
30
- layoutSpeed: "3"
31
- };
32
- const pressTransition = {
33
- layoutVariant: "veryBouncy",
34
- layoutSpeed: "4"
35
- };
36
- /**
37
- * **⚙️️ An checkbox.
38
- *
39
- * @componentType Client component
40
- *
41
- * @description
42
- * A checkbox component allows users to select one or multiple options from a set. It represents a binary state, typically as checked or unchecked, and optionally includes a third "indeterminate" state to indicate partial selection.
43
- *
44
- * @see
45
- * Check out the {@link https://uds.build/docs/components/checkbox Checkbox Docs} for more info
46
- *
47
- * @usage
48
- * - Forms: checkbox
49
- *
50
- * @example
51
- * ```tsx
52
- * 'use client';
53
- * import { Checkbox } from "@yahoo/uds";
54
- *
55
- * <Checkbox label="Name" required />
56
- *```
57
- *
58
- * @related [Radio](https://uds.build/docs/components/radio), [Switch](https://uds.build/docs/components/switch), [Input](https://uds.build/docs/components/input).
59
- **/
60
- const Checkbox = (0, react.forwardRef)(function Checkbox({ id, checked: checkedProp, defaultChecked, onChange, label, labelPosition = "start", variant: variantProp = "primary", size = "md", reduceMotion: forceReduceMotion, disabled, required, hasError, className, style, slotProps, ...checkboxProps }, parentRef) {
61
- const generatedId = (0, react.useId)();
62
- const uid = id ?? `uds-input-${generatedId}`;
63
- const rootSlotProps = slotProps?.root ?? {};
64
- const checkboxSlotProps = slotProps?.checkbox ?? {};
65
- const iconSlotProps = slotProps?.icon ?? {};
66
- const labelSlotProps = slotProps?.label ?? {};
67
- const innerRef = (0, react.useRef)(null);
68
- /**
69
- * State
70
- */
71
- const isControlled = checkedProp !== void 0;
72
- const [checked, setChecked] = (0, react.useState)(isControlled ? checkedProp : defaultChecked);
73
- const [isHovered, setIsHovered] = (0, react.useState)(false);
74
- const [isPressed, setIsPressed] = (0, react.useState)(false);
75
- /**
76
- * Derived values
77
- */
78
- const variant = (0, react.useMemo)(() => hasError ? VARIANT_ERROR_MAP[variantProp] : variantProp, [hasError, variantProp]);
79
- const showHoverEffect = !disabled && isHovered;
80
- const showPressedEffect = !disabled && isPressed;
81
- const scale = (0, react.useMemo)(() => {
82
- if (showPressedEffect) return .9;
83
- if (showHoverEffect) return 1.1;
84
- return 1;
85
- }, [showPressedEffect, showHoverEffect]);
86
- const checkOpacity = (0, react.useMemo)(() => {
87
- if (!checked) return "opacity-0";
88
- if (showPressedEffect) return "opacity-55";
89
- return "opacity-100";
90
- }, [checked, showPressedEffect]);
91
- const motionAnimate = (0, react.useMemo)(() => ({ scale }), [scale]);
92
- const motionTransition = (0, react.useMemo)(() => isPressed ? pressTransition : hoverTransition, [isPressed]);
93
- /**
94
- * Handlers
95
- */
96
- const handleChange = (0, react.useCallback)((e) => {
97
- onChange?.(e);
98
- if (!isControlled) setChecked(e.target.checked);
99
- }, [isControlled, onChange]);
100
- const handleHoverStart = (0, react.useCallback)(() => {
101
- setIsHovered(true);
102
- }, []);
103
- const handleHoverEnd = (0, react.useCallback)(() => {
104
- setIsHovered(false);
105
- }, []);
106
- const handleTapStart = (0, react.useCallback)(() => {
107
- setIsPressed(true);
108
- }, []);
109
- const handleTapEnd = (0, react.useCallback)(() => {
110
- setIsPressed(false);
111
- }, []);
112
- /**
113
- * Helpers
114
- */
115
- const setDOMIndeterminate = (checked_) => {
116
- if (!innerRef.current) return;
117
- innerRef.current.indeterminate = isIndeterminate(checked_);
118
- };
119
- const prefersReducedMotion = (0, motion_react.useReducedMotion)();
120
- const reduceMotion = forceReduceMotion ? "always" : "user";
121
- const cssAnimationDuration = prefersReducedMotion || forceReduceMotion ? "duration-0" : "duration-120";
122
- /**
123
- * Effects
124
- */
125
- (0, react.useEffect)(() => {
126
- if (isControlled) setChecked(checkedProp);
127
- }, [checkedProp, isControlled]);
128
- (0, react.useEffect)(() => {
129
- setDOMIndeterminate(checked);
130
- }, [checked]);
131
- const valueState = isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
132
- const classNames = {
133
- root: require_styles_styler.getStyles({
134
- checkboxSizeRoot: size,
135
- checkboxVariantRoot: variant,
136
- checkboxVariantValueRoot: valueState,
137
- display: "flex",
138
- flexDirection: labelPosition === "start" ? "row" : "row-reverse",
139
- alignItems: "center",
140
- className: require_styles_styler.cx({
141
- "cursor-pointer": !disabled,
142
- "cursor-default": disabled,
143
- "opacity-50": disabled
144
- }, className)
145
- }),
146
- checkbox: require_styles_styler.getStyles({
147
- checkboxSizeCheckbox: size,
148
- checkboxVariantCheckbox: variant,
149
- checkboxVariantValueCheckbox: valueState,
150
- className: require_styles_styler.cx("uds-ring", "uds-ring-within", cssAnimationDuration, "transition-[background-color,border-color,box-shadow]")
151
- }),
152
- check: require_styles_styler.getStyles({
153
- checkboxVariantCheckboxIcon: variant,
154
- checkboxVariantValueCheckboxIcon: valueState,
155
- className: require_styles_styler.cx("pointer-events-none", checkOpacity, cssAnimationDuration, "transition-opacity")
156
- }),
157
- htmlCheckbox: require_styles_styler.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%]"),
158
- label: require_styles_styler.cx(labelPosition === "start" ? "text-start" : "text-end")
159
- };
160
- const RootElement = label ? motion_react.m.label : motion_react.m.div;
161
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_SpringMotionConfig.SpringMotionConfig, {
162
- reducedMotion: reduceMotion,
163
- ...motionTransition,
164
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(RootElement, {
165
- className: classNames.root,
166
- "data-testid": "container",
167
- style,
168
- onHoverStart: handleHoverStart,
169
- onHoverEnd: handleHoverEnd,
170
- onTapStart: handleTapStart,
171
- onTap: handleTapEnd,
172
- onTapCancel: handleTapEnd,
173
- tabIndex: -1,
174
- ...rootSlotProps,
175
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(MotionBox, {
176
- position: "relative",
177
- className: classNames.checkbox,
178
- alignItems: "center",
179
- justifyContent: "center",
180
- flex: "none",
181
- animate: motionAnimate,
182
- ...checkboxSlotProps,
183
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
184
- type: "checkbox",
185
- tabIndex: 0,
186
- ...checkboxProps,
187
- ref: (ref) => {
188
- innerRef.current = ref;
189
- setDOMIndeterminate(checked);
190
- if (typeof parentRef === "function") parentRef(ref);
191
- else if (parentRef !== null) parentRef.current = ref;
192
- },
193
- id: uid,
194
- disabled,
195
- required,
196
- "aria-invalid": hasError,
197
- checked: isControlled ? isIndeterminate(checked) ? false : checked : void 0,
198
- defaultChecked: isControlled ? void 0 : defaultChecked,
199
- onChange: handleChange,
200
- className: classNames.htmlCheckbox
201
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Icon.Icon, {
202
- name: getIcon(checked),
203
- size: "sm",
204
- className: classNames.check,
205
- ...iconSlotProps
206
- })]
207
- }), label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_FormLabel.FormLabel, {
208
- as: "div",
209
- variant: "inherit",
210
- color: "inherit",
211
- required,
212
- label,
213
- className: classNames.label,
214
- ...labelSlotProps
215
- })]
216
- })
217
- });
218
- });
219
- Checkbox.displayName = "Checkbox";
220
- //#endregion
221
- exports.Checkbox = Checkbox;
222
- exports.SIZES = SIZES;
223
- exports.VARIANTS = VARIANTS;
@@ -1,218 +0,0 @@
1
- /*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
2
- "use client";
3
- import { cx, getStyles } from "../../styles/styler.js";
4
- import { Icon } from "../Icon.js";
5
- import { Box } from "../Box.js";
6
- import { FormLabel } from "../FormLabel.js";
7
- import { SpringMotionConfig } from "./SpringMotionConfig.js";
8
- import { Check, Minus } from "@yahoo/uds-icons";
9
- import { forwardRef, useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
10
- import { jsx, jsxs } from "react/jsx-runtime";
11
- import { m, useReducedMotion } from "motion/react";
12
- //#region src/components/client/Checkbox.tsx
13
- const VARIANTS = ["primary", "secondary"];
14
- const SIZES = ["sm", "md"];
15
- const VARIANT_ERROR_MAP = {
16
- primary: "alert",
17
- secondary: "alert-secondary"
18
- };
19
- const isIndeterminate = (checked) => checked === "indeterminate";
20
- const getIcon = (checked) => {
21
- if (isIndeterminate(checked)) return Minus;
22
- return Check;
23
- };
24
- const MotionBox = m.create(Box);
25
- const hoverTransition = {
26
- layoutVariant: "smooth",
27
- layoutSpeed: "3"
28
- };
29
- const pressTransition = {
30
- layoutVariant: "veryBouncy",
31
- layoutSpeed: "4"
32
- };
33
- /**
34
- * **⚙️️ An checkbox.
35
- *
36
- * @componentType Client component
37
- *
38
- * @description
39
- * A checkbox component allows users to select one or multiple options from a set. It represents a binary state, typically as checked or unchecked, and optionally includes a third "indeterminate" state to indicate partial selection.
40
- *
41
- * @see
42
- * Check out the {@link https://uds.build/docs/components/checkbox Checkbox Docs} for more info
43
- *
44
- * @usage
45
- * - Forms: checkbox
46
- *
47
- * @example
48
- * ```tsx
49
- * 'use client';
50
- * import { Checkbox } from "@yahoo/uds";
51
- *
52
- * <Checkbox label="Name" required />
53
- *```
54
- *
55
- * @related [Radio](https://uds.build/docs/components/radio), [Switch](https://uds.build/docs/components/switch), [Input](https://uds.build/docs/components/input).
56
- **/
57
- const Checkbox = forwardRef(function Checkbox({ id, checked: checkedProp, defaultChecked, onChange, label, labelPosition = "start", variant: variantProp = "primary", size = "md", reduceMotion: forceReduceMotion, disabled, required, hasError, className, style, slotProps, ...checkboxProps }, parentRef) {
58
- const generatedId = useId();
59
- const uid = id ?? `uds-input-${generatedId}`;
60
- const rootSlotProps = slotProps?.root ?? {};
61
- const checkboxSlotProps = slotProps?.checkbox ?? {};
62
- const iconSlotProps = slotProps?.icon ?? {};
63
- const labelSlotProps = slotProps?.label ?? {};
64
- const innerRef = useRef(null);
65
- /**
66
- * State
67
- */
68
- const isControlled = checkedProp !== void 0;
69
- const [checked, setChecked] = useState(isControlled ? checkedProp : defaultChecked);
70
- const [isHovered, setIsHovered] = useState(false);
71
- const [isPressed, setIsPressed] = useState(false);
72
- /**
73
- * Derived values
74
- */
75
- const variant = useMemo(() => hasError ? VARIANT_ERROR_MAP[variantProp] : variantProp, [hasError, variantProp]);
76
- const showHoverEffect = !disabled && isHovered;
77
- const showPressedEffect = !disabled && isPressed;
78
- const scale = useMemo(() => {
79
- if (showPressedEffect) return .9;
80
- if (showHoverEffect) return 1.1;
81
- return 1;
82
- }, [showPressedEffect, showHoverEffect]);
83
- const checkOpacity = useMemo(() => {
84
- if (!checked) return "opacity-0";
85
- if (showPressedEffect) return "opacity-55";
86
- return "opacity-100";
87
- }, [checked, showPressedEffect]);
88
- const motionAnimate = useMemo(() => ({ scale }), [scale]);
89
- const motionTransition = useMemo(() => isPressed ? pressTransition : hoverTransition, [isPressed]);
90
- /**
91
- * Handlers
92
- */
93
- const handleChange = useCallback((e) => {
94
- onChange?.(e);
95
- if (!isControlled) setChecked(e.target.checked);
96
- }, [isControlled, onChange]);
97
- const handleHoverStart = useCallback(() => {
98
- setIsHovered(true);
99
- }, []);
100
- const handleHoverEnd = useCallback(() => {
101
- setIsHovered(false);
102
- }, []);
103
- const handleTapStart = useCallback(() => {
104
- setIsPressed(true);
105
- }, []);
106
- const handleTapEnd = useCallback(() => {
107
- setIsPressed(false);
108
- }, []);
109
- /**
110
- * Helpers
111
- */
112
- const setDOMIndeterminate = (checked_) => {
113
- if (!innerRef.current) return;
114
- innerRef.current.indeterminate = isIndeterminate(checked_);
115
- };
116
- const prefersReducedMotion = useReducedMotion();
117
- const reduceMotion = forceReduceMotion ? "always" : "user";
118
- const cssAnimationDuration = prefersReducedMotion || forceReduceMotion ? "duration-0" : "duration-120";
119
- /**
120
- * Effects
121
- */
122
- useEffect(() => {
123
- if (isControlled) setChecked(checkedProp);
124
- }, [checkedProp, isControlled]);
125
- useEffect(() => {
126
- setDOMIndeterminate(checked);
127
- }, [checked]);
128
- const valueState = isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
129
- const classNames = {
130
- root: getStyles({
131
- checkboxSizeRoot: size,
132
- checkboxVariantRoot: variant,
133
- checkboxVariantValueRoot: valueState,
134
- display: "flex",
135
- flexDirection: labelPosition === "start" ? "row" : "row-reverse",
136
- alignItems: "center",
137
- className: cx({
138
- "cursor-pointer": !disabled,
139
- "cursor-default": disabled,
140
- "opacity-50": disabled
141
- }, className)
142
- }),
143
- checkbox: getStyles({
144
- checkboxSizeCheckbox: size,
145
- checkboxVariantCheckbox: variant,
146
- checkboxVariantValueCheckbox: valueState,
147
- className: cx("uds-ring", "uds-ring-within", cssAnimationDuration, "transition-[background-color,border-color,box-shadow]")
148
- }),
149
- check: getStyles({
150
- checkboxVariantCheckboxIcon: variant,
151
- checkboxVariantValueCheckboxIcon: valueState,
152
- className: cx("pointer-events-none", checkOpacity, cssAnimationDuration, "transition-opacity")
153
- }),
154
- 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%]"),
155
- label: cx(labelPosition === "start" ? "text-start" : "text-end")
156
- };
157
- const RootElement = label ? m.label : m.div;
158
- return /* @__PURE__ */ jsx(SpringMotionConfig, {
159
- reducedMotion: reduceMotion,
160
- ...motionTransition,
161
- children: /* @__PURE__ */ jsxs(RootElement, {
162
- className: classNames.root,
163
- "data-testid": "container",
164
- style,
165
- onHoverStart: handleHoverStart,
166
- onHoverEnd: handleHoverEnd,
167
- onTapStart: handleTapStart,
168
- onTap: handleTapEnd,
169
- onTapCancel: handleTapEnd,
170
- tabIndex: -1,
171
- ...rootSlotProps,
172
- children: [/* @__PURE__ */ jsxs(MotionBox, {
173
- position: "relative",
174
- className: classNames.checkbox,
175
- alignItems: "center",
176
- justifyContent: "center",
177
- flex: "none",
178
- animate: motionAnimate,
179
- ...checkboxSlotProps,
180
- children: [/* @__PURE__ */ jsx("input", {
181
- type: "checkbox",
182
- tabIndex: 0,
183
- ...checkboxProps,
184
- ref: (ref) => {
185
- innerRef.current = ref;
186
- setDOMIndeterminate(checked);
187
- if (typeof parentRef === "function") parentRef(ref);
188
- else if (parentRef !== null) parentRef.current = ref;
189
- },
190
- id: uid,
191
- disabled,
192
- required,
193
- "aria-invalid": hasError,
194
- checked: isControlled ? isIndeterminate(checked) ? false : checked : void 0,
195
- defaultChecked: isControlled ? void 0 : defaultChecked,
196
- onChange: handleChange,
197
- className: classNames.htmlCheckbox
198
- }), /* @__PURE__ */ jsx(Icon, {
199
- name: getIcon(checked),
200
- size: "sm",
201
- className: classNames.check,
202
- ...iconSlotProps
203
- })]
204
- }), label && /* @__PURE__ */ jsx(FormLabel, {
205
- as: "div",
206
- variant: "inherit",
207
- color: "inherit",
208
- required,
209
- label,
210
- className: classNames.label,
211
- ...labelSlotProps
212
- })]
213
- })
214
- });
215
- });
216
- Checkbox.displayName = "Checkbox";
217
- //#endregion
218
- export { Checkbox, SIZES, VARIANTS };