@yahoo/uds 3.161.0 → 3.162.1

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 (115) hide show
  1. package/dist/cli/commands/purge.cjs +8 -1
  2. package/dist/cli/commands/purge.helpers.cjs +7 -0
  3. package/dist/cli/commands/purge.helpers.d.cts +3 -0
  4. package/dist/cli/commands/purge.helpers.d.ts +3 -0
  5. package/dist/cli/commands/purge.helpers.js +7 -0
  6. package/dist/cli/commands/purge.js +8 -1
  7. package/dist/components/client/Checkbox/Checkbox.cjs +118 -0
  8. package/dist/components/client/{Checkbox.d.cts → Checkbox/Checkbox.d.cts} +5 -18
  9. package/dist/components/client/{Checkbox.d.ts → Checkbox/Checkbox.d.ts} +5 -18
  10. package/dist/components/client/Checkbox/Checkbox.js +113 -0
  11. package/dist/components/client/Checkbox/CheckboxBase.cjs +141 -0
  12. package/dist/components/client/Checkbox/CheckboxBase.d.cts +48 -0
  13. package/dist/components/client/Checkbox/CheckboxBase.d.ts +49 -0
  14. package/dist/components/client/Checkbox/CheckboxBase.js +138 -0
  15. package/dist/components/client/Checkbox/checkboxConstants.cjs +23 -0
  16. package/dist/components/client/Checkbox/checkboxConstants.d.cts +25 -0
  17. package/dist/components/client/Checkbox/checkboxConstants.d.ts +26 -0
  18. package/dist/components/client/Checkbox/checkboxConstants.js +17 -0
  19. package/dist/components/client/Checkbox/index.cjs +10 -0
  20. package/dist/components/client/Checkbox/index.d.cts +6 -0
  21. package/dist/components/client/Checkbox/index.d.ts +7 -0
  22. package/dist/components/client/Checkbox/index.js +6 -0
  23. package/dist/components/client/Checkbox/types.cjs +2 -0
  24. package/dist/components/client/Checkbox/types.d.cts +22 -0
  25. package/dist/components/client/Checkbox/types.d.ts +23 -0
  26. package/dist/components/client/Checkbox/types.js +2 -0
  27. package/dist/components/client/Popover/UDSPopoverConfigProvider.d.cts +1 -1
  28. package/dist/components/client/Popover/UDSPopoverConfigProvider.d.ts +1 -1
  29. package/dist/components/client/Radio/Radio.cjs +67 -164
  30. package/dist/components/client/Radio/Radio.d.cts +4 -17
  31. package/dist/components/client/Radio/Radio.d.ts +4 -17
  32. package/dist/components/client/Radio/Radio.js +66 -163
  33. package/dist/components/client/Radio/RadioBase.cjs +133 -0
  34. package/dist/components/client/Radio/RadioBase.d.cts +45 -0
  35. package/dist/components/client/Radio/RadioBase.d.ts +46 -0
  36. package/dist/components/client/Radio/RadioBase.js +130 -0
  37. package/dist/components/client/Radio/radioConstants.cjs +14 -0
  38. package/dist/components/client/Radio/radioConstants.d.cts +8 -0
  39. package/dist/components/client/Radio/radioConstants.d.ts +9 -0
  40. package/dist/components/client/Radio/radioConstants.js +11 -0
  41. package/dist/components/client/Radio/types.cjs +2 -0
  42. package/dist/components/client/Radio/types.d.cts +20 -0
  43. package/dist/components/client/Radio/types.d.ts +21 -0
  44. package/dist/components/client/Radio/types.js +2 -0
  45. package/dist/components/client/Toast/UDSToastConfigProvider.d.cts +1 -1
  46. package/dist/components/client/Toast/UDSToastConfigProvider.d.ts +1 -1
  47. package/dist/components/client/index.cjs +2 -2
  48. package/dist/components/client/index.d.cts +1 -1
  49. package/dist/components/client/index.d.ts +1 -1
  50. package/dist/components/client/index.js +1 -1
  51. package/dist/components/index.cjs +2 -2
  52. package/dist/components/index.d.cts +1 -1
  53. package/dist/components/index.d.ts +1 -1
  54. package/dist/components/index.js +1 -1
  55. package/dist/css/dist/commands/css.cjs +2 -0
  56. package/dist/css/dist/commands/css.helpers.cjs +2 -0
  57. package/dist/css/dist/commands/css.helpers.js +2 -0
  58. package/dist/css/dist/commands/css.js +2 -0
  59. package/dist/css/dist/css/nodeUtils.cjs +28 -11
  60. package/dist/css/dist/css/nodeUtils.js +29 -12
  61. package/dist/css/dist/css/runner.cjs +8 -3
  62. package/dist/css/dist/css/runner.js +8 -3
  63. package/dist/css/dist/css/theme.d.cts +16 -0
  64. package/dist/css/dist/css/theme.d.ts +16 -0
  65. package/dist/css/dist/css/workerPool.cjs +2 -1
  66. package/dist/css/dist/css/workerPool.js +2 -1
  67. package/dist/css/dist/purger/optimized/ast/expressions.cjs +104 -11
  68. package/dist/css/dist/purger/optimized/ast/expressions.js +104 -11
  69. package/dist/css/dist/purger/optimized/ast/jsx.cjs +74 -0
  70. package/dist/css/dist/purger/optimized/ast/jsx.js +73 -0
  71. package/dist/css/dist/purger/optimized/ast/props.cjs +47 -0
  72. package/dist/css/dist/purger/optimized/ast/props.js +46 -0
  73. package/dist/css/dist/purger/optimized/ast/spread.cjs +87 -0
  74. package/dist/css/dist/purger/optimized/ast/spread.js +86 -0
  75. package/dist/css/dist/purger/optimized/purge.cjs +14 -8
  76. package/dist/css/dist/purger/optimized/purge.js +15 -9
  77. package/dist/css/dist/purger/optimized/purgeFromCode.cjs +176 -18
  78. package/dist/css/dist/purger/optimized/purgeFromCode.js +176 -19
  79. package/dist/css/dist/purger/optimized/utils/files.cjs +22 -2
  80. package/dist/css/dist/purger/optimized/utils/files.js +21 -3
  81. package/dist/css-animation/Checkbox/Checkbox.cjs +75 -0
  82. package/dist/css-animation/Checkbox/Checkbox.d.cts +22 -0
  83. package/dist/css-animation/Checkbox/Checkbox.d.ts +23 -0
  84. package/dist/css-animation/Checkbox/Checkbox.js +72 -0
  85. package/dist/css-animation/Checkbox/index.cjs +5 -0
  86. package/dist/css-animation/Checkbox/index.d.cts +3 -0
  87. package/dist/css-animation/Checkbox/index.d.ts +4 -0
  88. package/dist/css-animation/Checkbox/index.js +4 -0
  89. package/dist/css-animation/Radio/Radio.cjs +92 -0
  90. package/dist/css-animation/Radio/Radio.d.cts +22 -0
  91. package/dist/css-animation/Radio/Radio.d.ts +23 -0
  92. package/dist/css-animation/Radio/Radio.js +89 -0
  93. package/dist/css-animation/Radio/index.cjs +5 -0
  94. package/dist/css-animation/Radio/index.d.cts +3 -0
  95. package/dist/css-animation/Radio/index.d.ts +4 -0
  96. package/dist/css-animation/Radio/index.js +4 -0
  97. package/dist/css-animation/index.cjs +4 -0
  98. package/dist/css-animation/index.d.cts +3 -1
  99. package/dist/css-animation/index.d.ts +3 -1
  100. package/dist/css-animation/index.js +3 -1
  101. package/dist/index.cjs +2 -2
  102. package/dist/index.d.cts +1 -1
  103. package/dist/index.d.ts +1 -1
  104. package/dist/index.js +1 -1
  105. package/dist/styles/styler.d.cts +26 -26
  106. package/dist/styles/styler.d.ts +26 -26
  107. package/dist/uds/generated/componentData.cjs +343 -293
  108. package/dist/uds/generated/componentData.js +343 -293
  109. package/dist/uds/generated/tailwindPurge.cjs +12 -12
  110. package/dist/uds/generated/tailwindPurge.js +12 -12
  111. package/generated/componentData.json +471 -382
  112. package/generated/tailwindPurge.ts +2 -2
  113. package/package.json +1 -1
  114. package/dist/components/client/Checkbox.cjs +0 -224
  115. package/dist/components/client/Checkbox.js +0 -219
@@ -17,6 +17,9 @@ const showHelp = () => {
17
17
  require_print.print(`${require_colors.magenta("Options:")}`);
18
18
  require_print.print(` ${require_colors.cyan("--entry <path>")} Entry directory or file to scan (default: ./src)`);
19
19
  require_print.print(` ${require_colors.cyan("--output <path>")} Output safelist file (default: dist/safelist.ts)`);
20
+ require_print.print(` ${require_colors.cyan("--ignore <glob>")} Extra glob(s) to exclude from the scan (comma-separated)`);
21
+ require_print.print(` ${require_colors.cyan("--include-dev-files")} Also scan test/spec/story files (excluded by default)`);
22
+ require_print.print(` ${require_colors.cyan("--include-stories")} Also scan story files, keeping test/spec excluded`);
20
23
  require_print.print(` ${require_colors.cyan("--config <path>")} Path to uds.config.ts for legacy purge mode`);
21
24
  require_print.print(` ${require_colors.cyan("--optimized")} Use the optimized AST-based purger implementation`);
22
25
  require_print.print(` ${require_colors.cyan("--help, -h")} Show this help message`);
@@ -36,7 +39,7 @@ const makePurgeCommand = (getContext) => ({
36
39
  showHelp();
37
40
  return;
38
41
  }
39
- const { config, entry, optimized, output } = require_cli_commands_purge_helpers.getPurgeRunOptions(props.options);
42
+ const { config, entry, ignore, ignoreDevFiles, includeStories, optimized, output } = require_cli_commands_purge_helpers.getPurgeRunOptions(props.options);
40
43
  const { variants, autoVariants, componentData, packageJson, generatedPurgeCssData } = await getContext();
41
44
  if (optimized) {
42
45
  require_spinner.spinStart("Purging CSS with optimized purger...");
@@ -44,6 +47,9 @@ const makePurgeCommand = (getContext) => ({
44
47
  const result = await require_purge.purgeOptimized({
45
48
  entry,
46
49
  output,
50
+ ignore,
51
+ ignoreDevFiles,
52
+ includeStories,
47
53
  variants,
48
54
  autoVariants,
49
55
  componentData
@@ -51,6 +57,7 @@ const makePurgeCommand = (getContext) => ({
51
57
  require_spinner.spinStop("✅", `Purging done (optimized)! Generated ${result.stats.classesGenerated} classes in ${result.stats.timeMs}ms`);
52
58
  require_print.print(` Files scanned: ${result.stats.filesScanned}`);
53
59
  require_print.print(` Spreads traced: ${result.stats.spreadsTraced}`);
60
+ require_print.print(` Spreads unresolved: ${result.stats.spreadsUnresolved}`);
54
61
  require_print.print(` Expressions resolved: ${result.stats.expressionsResolved}`);
55
62
  return;
56
63
  } catch (error) {
@@ -7,11 +7,18 @@ const entryOption = (value) => {
7
7
  if (typeof value === "string") return value;
8
8
  if (Array.isArray(value) && value.every((item) => typeof item === "string")) return value;
9
9
  };
10
+ const ignoreOption = (value) => {
11
+ if (typeof value === "string") return value.split(",").map((glob) => glob.trim()).filter(Boolean);
12
+ if (Array.isArray(value) && value.every((item) => typeof item === "string")) return value;
13
+ };
10
14
  const shouldShowHelp = (options) => isTruthyFlag(options.help) || isTruthyFlag(options.h);
11
15
  const isOptimizedPurgeEnabled = (options) => isTruthyFlag(options.optimized);
12
16
  const getPurgeRunOptions = (options) => ({
13
17
  config: stringOption(options.config),
14
18
  entry: entryOption(options.entry),
19
+ ignore: ignoreOption(options.ignore),
20
+ ignoreDevFiles: !(isTruthyFlag(options["include-dev-files"]) || isTruthyFlag(options.includeDevFiles)),
21
+ includeStories: isTruthyFlag(options["include-stories"]) || isTruthyFlag(options.includeStories),
15
22
  optimized: isOptimizedPurgeEnabled(options),
16
23
  output: stringOption(options.output)
17
24
  });
@@ -4,6 +4,9 @@ type PurgeCliOptions = Record<string, unknown>;
4
4
  type PurgeRunOptions = {
5
5
  config?: string;
6
6
  entry?: string | string[];
7
+ ignore?: string[];
8
+ ignoreDevFiles: boolean;
9
+ includeStories: boolean;
7
10
  optimized: boolean;
8
11
  output?: string;
9
12
  };
@@ -4,6 +4,9 @@ type PurgeCliOptions = Record<string, unknown>;
4
4
  type PurgeRunOptions = {
5
5
  config?: string;
6
6
  entry?: string | string[];
7
+ ignore?: string[];
8
+ ignoreDevFiles: boolean;
9
+ includeStories: boolean;
7
10
  optimized: boolean;
8
11
  output?: string;
9
12
  };
@@ -6,11 +6,18 @@ const entryOption = (value) => {
6
6
  if (typeof value === "string") return value;
7
7
  if (Array.isArray(value) && value.every((item) => typeof item === "string")) return value;
8
8
  };
9
+ const ignoreOption = (value) => {
10
+ if (typeof value === "string") return value.split(",").map((glob) => glob.trim()).filter(Boolean);
11
+ if (Array.isArray(value) && value.every((item) => typeof item === "string")) return value;
12
+ };
9
13
  const shouldShowHelp = (options) => isTruthyFlag(options.help) || isTruthyFlag(options.h);
10
14
  const isOptimizedPurgeEnabled = (options) => isTruthyFlag(options.optimized);
11
15
  const getPurgeRunOptions = (options) => ({
12
16
  config: stringOption(options.config),
13
17
  entry: entryOption(options.entry),
18
+ ignore: ignoreOption(options.ignore),
19
+ ignoreDevFiles: !(isTruthyFlag(options["include-dev-files"]) || isTruthyFlag(options.includeDevFiles)),
20
+ includeStories: isTruthyFlag(options["include-stories"]) || isTruthyFlag(options.includeStories),
14
21
  optimized: isOptimizedPurgeEnabled(options),
15
22
  output: stringOption(options.output)
16
23
  });
@@ -16,6 +16,9 @@ const showHelp = () => {
16
16
  print(`${magenta("Options:")}`);
17
17
  print(` ${cyan("--entry <path>")} Entry directory or file to scan (default: ./src)`);
18
18
  print(` ${cyan("--output <path>")} Output safelist file (default: dist/safelist.ts)`);
19
+ print(` ${cyan("--ignore <glob>")} Extra glob(s) to exclude from the scan (comma-separated)`);
20
+ print(` ${cyan("--include-dev-files")} Also scan test/spec/story files (excluded by default)`);
21
+ print(` ${cyan("--include-stories")} Also scan story files, keeping test/spec excluded`);
19
22
  print(` ${cyan("--config <path>")} Path to uds.config.ts for legacy purge mode`);
20
23
  print(` ${cyan("--optimized")} Use the optimized AST-based purger implementation`);
21
24
  print(` ${cyan("--help, -h")} Show this help message`);
@@ -35,7 +38,7 @@ const makePurgeCommand = (getContext) => ({
35
38
  showHelp();
36
39
  return;
37
40
  }
38
- const { config, entry, optimized, output } = getPurgeRunOptions(props.options);
41
+ const { config, entry, ignore, ignoreDevFiles, includeStories, optimized, output } = getPurgeRunOptions(props.options);
39
42
  const { variants, autoVariants, componentData, packageJson, generatedPurgeCssData } = await getContext();
40
43
  if (optimized) {
41
44
  spinStart("Purging CSS with optimized purger...");
@@ -43,6 +46,9 @@ const makePurgeCommand = (getContext) => ({
43
46
  const result = await purgeOptimized({
44
47
  entry,
45
48
  output,
49
+ ignore,
50
+ ignoreDevFiles,
51
+ includeStories,
46
52
  variants,
47
53
  autoVariants,
48
54
  componentData
@@ -50,6 +56,7 @@ const makePurgeCommand = (getContext) => ({
50
56
  spinStop("✅", `Purging done (optimized)! Generated ${result.stats.classesGenerated} classes in ${result.stats.timeMs}ms`);
51
57
  print(` Files scanned: ${result.stats.filesScanned}`);
52
58
  print(` Spreads traced: ${result.stats.spreadsTraced}`);
59
+ print(` Spreads unresolved: ${result.stats.spreadsUnresolved}`);
53
60
  print(` Expressions resolved: ${result.stats.expressionsResolved}`);
54
61
  return;
55
62
  } catch (error) {
@@ -0,0 +1,118 @@
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_hooks_usePrefersReducedMotion = require("../../../hooks/usePrefersReducedMotion.cjs");
9
+ const require_components_client_SpringMotionConfig = require("../SpringMotionConfig.cjs");
10
+ const require_components_client_Checkbox_checkboxConstants = require("./checkboxConstants.cjs");
11
+ const require_components_client_Checkbox_CheckboxBase = require("./CheckboxBase.cjs");
12
+ let react = require("react");
13
+ react = require_runtime.__toESM(react);
14
+ let react_jsx_runtime = require("react/jsx-runtime");
15
+ let motion_react = require("motion/react");
16
+ //#region src/components/client/Checkbox/Checkbox.tsx
17
+ const MotionBox = motion_react.m.create(require_components_Box.Box);
18
+ MotionBox.displayName = "CheckboxMotionBox";
19
+ const hoverTransition = {
20
+ layoutVariant: "smooth",
21
+ layoutSpeed: "3"
22
+ };
23
+ const pressTransition = {
24
+ layoutVariant: "veryBouncy",
25
+ layoutSpeed: "4"
26
+ };
27
+ /**
28
+ * **⚙️️ An checkbox.
29
+ *
30
+ * @componentType Client component
31
+ *
32
+ * @description
33
+ * 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.
34
+ *
35
+ * @see
36
+ * Check out the {@link https://uds.build/docs/components/checkbox Checkbox Docs} for more info
37
+ *
38
+ * @usage
39
+ * - Forms: checkbox
40
+ *
41
+ * @example
42
+ * ```tsx
43
+ * 'use client';
44
+ * import { Checkbox } from "@yahoo/uds";
45
+ *
46
+ * <Checkbox label="Name" required />
47
+ *```
48
+ *
49
+ * @related [Radio](https://uds.build/docs/components/radio), [Switch](https://uds.build/docs/components/switch), [Input](https://uds.build/docs/components/input).
50
+ **/
51
+ const Checkbox = (0, react.forwardRef)(function Checkbox({ reduceMotion: forceReduceMotion, ...props }, parentRef) {
52
+ const prefersReducedMotion = require_hooks_usePrefersReducedMotion.usePrefersReducedMotion();
53
+ const reduceMotion = forceReduceMotion ? "always" : "user";
54
+ const cssAnimationDuration = prefersReducedMotion || forceReduceMotion ? "duration-0" : "duration-120";
55
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Checkbox_CheckboxBase.CheckboxBase, {
56
+ ...props,
57
+ ref: parentRef,
58
+ cssAnimationDuration,
59
+ enableInteractionTracking: true,
60
+ renderRoot: ({ className, style, rootSlotProps, hasLabel, isPressed, onHoverStart, onHoverEnd, onTapStart, onTapEnd, children }) => {
61
+ const RootElement = hasLabel ? motion_react.m.label : motion_react.m.div;
62
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_SpringMotionConfig.SpringMotionConfig, {
63
+ reducedMotion: reduceMotion,
64
+ ...isPressed ? pressTransition : hoverTransition,
65
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RootElement, {
66
+ className,
67
+ "data-testid": "container",
68
+ style,
69
+ onHoverStart,
70
+ onHoverEnd,
71
+ onTapStart,
72
+ onTap: onTapEnd,
73
+ onTapCancel: onTapEnd,
74
+ tabIndex: -1,
75
+ ...rootSlotProps,
76
+ children
77
+ })
78
+ });
79
+ },
80
+ renderIndicator: ({ size, variant, valueState, checked, showHoverEffect, showPressedEffect, cssAnimationDuration, checkIcon, checkboxSlotProps, iconSlotProps, children }) => {
81
+ const scale = showPressedEffect ? .9 : showHoverEffect ? 1.1 : 1;
82
+ const checkOpacity = !checked ? require_styles_styler.cx("opacity-0") : showPressedEffect ? require_styles_styler.cx("opacity-55") : require_styles_styler.cx("opacity-100");
83
+ const classNames = {
84
+ checkbox: require_styles_styler.getStyles({
85
+ checkboxSizeCheckbox: size,
86
+ checkboxVariantCheckbox: variant,
87
+ checkboxVariantValueCheckbox: valueState,
88
+ className: require_styles_styler.cx("uds-ring", "uds-ring-within", cssAnimationDuration, "transition-[background-color,border-color,box-shadow]")
89
+ }),
90
+ check: require_styles_styler.getStyles({
91
+ checkboxVariantCheckboxIcon: variant,
92
+ checkboxVariantValueCheckboxIcon: valueState,
93
+ className: require_styles_styler.cx("pointer-events-none", checkOpacity, cssAnimationDuration, "transition-opacity")
94
+ })
95
+ };
96
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(MotionBox, {
97
+ position: "relative",
98
+ className: classNames.checkbox,
99
+ alignItems: "center",
100
+ justifyContent: "center",
101
+ flex: "none",
102
+ animate: { scale },
103
+ ...checkboxSlotProps,
104
+ children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Icon.Icon, {
105
+ name: checkIcon,
106
+ size: "sm",
107
+ className: classNames.check,
108
+ ...iconSlotProps
109
+ })]
110
+ });
111
+ }
112
+ });
113
+ });
114
+ Checkbox.displayName = "Checkbox";
115
+ //#endregion
116
+ exports.Checkbox = Checkbox;
117
+ exports.SIZES = require_components_client_Checkbox_checkboxConstants.SIZES;
118
+ exports.VARIANTS = require_components_client_Checkbox_checkboxConstants.VARIANTS;
@@ -1,23 +1,10 @@
1
1
 
2
- import { UniversalCheckboxProps } from "../../types/dist/index.cjs";
2
+ import { SIZES, VARIANTS } from "./checkboxConstants.cjs";
3
+ import { CheckboxProps as CheckboxProps$1 } from "./types.cjs";
3
4
  import React from "react";
4
5
 
5
- //#region src/components/client/Checkbox.d.ts
6
- type NativeInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'checked' | 'size' | 'height' | 'width' | 'color'>;
7
- type DataAttributes = {
8
- [name: `data-${string}`]: string;
9
- };
10
- interface CheckboxProps extends NativeInputProps, UniversalCheckboxProps {
11
- /** Props to be passed into various slots within the component. */
12
- slotProps?: {
13
- root?: DataAttributes;
14
- checkbox?: DataAttributes;
15
- icon?: DataAttributes;
16
- label?: DataAttributes;
17
- };
18
- }
19
- declare const VARIANTS: ("primary" | "secondary")[];
20
- declare const SIZES: ("sm" | "md")[];
6
+ //#region src/components/client/Checkbox/Checkbox.d.ts
7
+ type CheckboxProps = CheckboxProps$1;
21
8
  /**
22
9
  * **⚙️️ An checkbox.
23
10
  *
@@ -42,6 +29,6 @@ declare const SIZES: ("sm" | "md")[];
42
29
  *
43
30
  * @related [Radio](https://uds.build/docs/components/radio), [Switch](https://uds.build/docs/components/switch), [Input](https://uds.build/docs/components/input).
44
31
  **/
45
- declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
32
+ declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps$1 & React.RefAttributes<HTMLInputElement>>;
46
33
  //#endregion
47
34
  export { Checkbox, type CheckboxProps, SIZES, VARIANTS };
@@ -1,24 +1,11 @@
1
1
 
2
2
  "use client";
3
- import { UniversalCheckboxProps } from "../../types/dist/index.js";
3
+ import { SIZES, VARIANTS } from "./checkboxConstants.js";
4
+ import { CheckboxProps as CheckboxProps$1 } from "./types.js";
4
5
  import React from "react";
5
6
 
6
- //#region src/components/client/Checkbox.d.ts
7
- type NativeInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'checked' | 'size' | 'height' | 'width' | 'color'>;
8
- type DataAttributes = {
9
- [name: `data-${string}`]: string;
10
- };
11
- interface CheckboxProps extends NativeInputProps, UniversalCheckboxProps {
12
- /** Props to be passed into various slots within the component. */
13
- slotProps?: {
14
- root?: DataAttributes;
15
- checkbox?: DataAttributes;
16
- icon?: DataAttributes;
17
- label?: DataAttributes;
18
- };
19
- }
20
- declare const VARIANTS: ("primary" | "secondary")[];
21
- declare const SIZES: ("sm" | "md")[];
7
+ //#region src/components/client/Checkbox/Checkbox.d.ts
8
+ type CheckboxProps = CheckboxProps$1;
22
9
  /**
23
10
  * **⚙️️ An checkbox.
24
11
  *
@@ -43,6 +30,6 @@ declare const SIZES: ("sm" | "md")[];
43
30
  *
44
31
  * @related [Radio](https://uds.build/docs/components/radio), [Switch](https://uds.build/docs/components/switch), [Input](https://uds.build/docs/components/input).
45
32
  **/
46
- declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
33
+ declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps$1 & React.RefAttributes<HTMLInputElement>>;
47
34
  //#endregion
48
35
  export { Checkbox, type CheckboxProps, SIZES, VARIANTS };
@@ -0,0 +1,113 @@
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 { usePrefersReducedMotion } from "../../../hooks/usePrefersReducedMotion.js";
7
+ import { SpringMotionConfig } from "../SpringMotionConfig.js";
8
+ import { SIZES, VARIANTS } from "./checkboxConstants.js";
9
+ import { CheckboxBase } from "./CheckboxBase.js";
10
+ import { forwardRef } from "react";
11
+ import { jsx, jsxs } from "react/jsx-runtime";
12
+ import { m } from "motion/react";
13
+ //#region src/components/client/Checkbox/Checkbox.tsx
14
+ const MotionBox = m.create(Box);
15
+ MotionBox.displayName = "CheckboxMotionBox";
16
+ const hoverTransition = {
17
+ layoutVariant: "smooth",
18
+ layoutSpeed: "3"
19
+ };
20
+ const pressTransition = {
21
+ layoutVariant: "veryBouncy",
22
+ layoutSpeed: "4"
23
+ };
24
+ /**
25
+ * **⚙️️ An checkbox.
26
+ *
27
+ * @componentType Client component
28
+ *
29
+ * @description
30
+ * 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.
31
+ *
32
+ * @see
33
+ * Check out the {@link https://uds.build/docs/components/checkbox Checkbox Docs} for more info
34
+ *
35
+ * @usage
36
+ * - Forms: checkbox
37
+ *
38
+ * @example
39
+ * ```tsx
40
+ * 'use client';
41
+ * import { Checkbox } from "@yahoo/uds";
42
+ *
43
+ * <Checkbox label="Name" required />
44
+ *```
45
+ *
46
+ * @related [Radio](https://uds.build/docs/components/radio), [Switch](https://uds.build/docs/components/switch), [Input](https://uds.build/docs/components/input).
47
+ **/
48
+ const Checkbox = forwardRef(function Checkbox({ reduceMotion: forceReduceMotion, ...props }, parentRef) {
49
+ const prefersReducedMotion = usePrefersReducedMotion();
50
+ const reduceMotion = forceReduceMotion ? "always" : "user";
51
+ const cssAnimationDuration = prefersReducedMotion || forceReduceMotion ? "duration-0" : "duration-120";
52
+ return /* @__PURE__ */ jsx(CheckboxBase, {
53
+ ...props,
54
+ ref: parentRef,
55
+ cssAnimationDuration,
56
+ enableInteractionTracking: true,
57
+ renderRoot: ({ className, style, rootSlotProps, hasLabel, isPressed, onHoverStart, onHoverEnd, onTapStart, onTapEnd, children }) => {
58
+ const RootElement = hasLabel ? m.label : m.div;
59
+ return /* @__PURE__ */ jsx(SpringMotionConfig, {
60
+ reducedMotion: reduceMotion,
61
+ ...isPressed ? pressTransition : hoverTransition,
62
+ children: /* @__PURE__ */ jsx(RootElement, {
63
+ className,
64
+ "data-testid": "container",
65
+ style,
66
+ onHoverStart,
67
+ onHoverEnd,
68
+ onTapStart,
69
+ onTap: onTapEnd,
70
+ onTapCancel: onTapEnd,
71
+ tabIndex: -1,
72
+ ...rootSlotProps,
73
+ children
74
+ })
75
+ });
76
+ },
77
+ renderIndicator: ({ size, variant, valueState, checked, showHoverEffect, showPressedEffect, cssAnimationDuration, checkIcon, checkboxSlotProps, iconSlotProps, children }) => {
78
+ const scale = showPressedEffect ? .9 : showHoverEffect ? 1.1 : 1;
79
+ const checkOpacity = !checked ? cx("opacity-0") : showPressedEffect ? cx("opacity-55") : cx("opacity-100");
80
+ const classNames = {
81
+ checkbox: getStyles({
82
+ checkboxSizeCheckbox: size,
83
+ checkboxVariantCheckbox: variant,
84
+ checkboxVariantValueCheckbox: valueState,
85
+ className: cx("uds-ring", "uds-ring-within", cssAnimationDuration, "transition-[background-color,border-color,box-shadow]")
86
+ }),
87
+ check: getStyles({
88
+ checkboxVariantCheckboxIcon: variant,
89
+ checkboxVariantValueCheckboxIcon: valueState,
90
+ className: cx("pointer-events-none", checkOpacity, cssAnimationDuration, "transition-opacity")
91
+ })
92
+ };
93
+ return /* @__PURE__ */ jsxs(MotionBox, {
94
+ position: "relative",
95
+ className: classNames.checkbox,
96
+ alignItems: "center",
97
+ justifyContent: "center",
98
+ flex: "none",
99
+ animate: { scale },
100
+ ...checkboxSlotProps,
101
+ children: [children, /* @__PURE__ */ jsx(Icon, {
102
+ name: checkIcon,
103
+ size: "sm",
104
+ className: classNames.check,
105
+ ...iconSlotProps
106
+ })]
107
+ });
108
+ }
109
+ });
110
+ });
111
+ Checkbox.displayName = "Checkbox";
112
+ //#endregion
113
+ export { Checkbox, SIZES, VARIANTS };
@@ -0,0 +1,141 @@
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_FormLabel = require("../../FormLabel.cjs");
7
+ const require_components_client_Checkbox_checkboxConstants = require("./checkboxConstants.cjs");
8
+ let react = require("react");
9
+ react = require_runtime.__toESM(react);
10
+ let react_jsx_runtime = require("react/jsx-runtime");
11
+ //#region src/components/client/Checkbox/CheckboxBase.tsx
12
+ const CheckboxBase = (0, react.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) {
13
+ const generatedId = (0, react.useId)();
14
+ const uid = id ?? `uds-input-${generatedId}`;
15
+ const rootSlotProps = slotProps?.root ?? {};
16
+ const checkboxSlotProps = slotProps?.checkbox ?? {};
17
+ const iconSlotProps = slotProps?.icon ?? {};
18
+ const labelSlotProps = slotProps?.label ?? {};
19
+ const innerRef = (0, react.useRef)(null);
20
+ /**
21
+ * State
22
+ */
23
+ const isControlled = checkedProp !== void 0;
24
+ const [checked, setChecked] = (0, react.useState)(isControlled ? checkedProp : defaultChecked);
25
+ const [isHovered, setIsHovered] = (0, react.useState)(false);
26
+ const [isPressed, setIsPressed] = (0, react.useState)(false);
27
+ /**
28
+ * Derived values
29
+ */
30
+ const variant = (0, react.useMemo)(() => hasError ? require_components_client_Checkbox_checkboxConstants.VARIANT_ERROR_MAP[variantProp] : variantProp, [hasError, variantProp]);
31
+ const showHoverEffect = enableInteractionTracking && !disabled && isHovered;
32
+ const showPressedEffect = enableInteractionTracking && !disabled && isPressed;
33
+ /**
34
+ * Handlers
35
+ */
36
+ const handleChange = (0, react.useCallback)((e) => {
37
+ onChange?.(e);
38
+ if (!isControlled) setChecked(e.target.checked);
39
+ }, [isControlled, onChange]);
40
+ const handleHoverStart = (0, react.useCallback)(() => {
41
+ if (enableInteractionTracking) setIsHovered(true);
42
+ }, [enableInteractionTracking]);
43
+ const handleHoverEnd = (0, react.useCallback)(() => {
44
+ if (enableInteractionTracking) setIsHovered(false);
45
+ }, [enableInteractionTracking]);
46
+ const handleTapStart = (0, react.useCallback)(() => {
47
+ if (enableInteractionTracking) setIsPressed(true);
48
+ }, [enableInteractionTracking]);
49
+ const handleTapEnd = (0, react.useCallback)(() => {
50
+ if (enableInteractionTracking) setIsPressed(false);
51
+ }, [enableInteractionTracking]);
52
+ /**
53
+ * Helpers
54
+ */
55
+ const setDOMIndeterminate = (checked_) => {
56
+ if (!innerRef.current) return;
57
+ innerRef.current.indeterminate = require_components_client_Checkbox_checkboxConstants.isIndeterminate(checked_);
58
+ };
59
+ /**
60
+ * Effects
61
+ */
62
+ (0, react.useEffect)(() => {
63
+ if (isControlled) setChecked(checkedProp);
64
+ }, [checkedProp, isControlled]);
65
+ (0, react.useEffect)(() => {
66
+ setDOMIndeterminate(checked);
67
+ }, [checked]);
68
+ const valueState = require_components_client_Checkbox_checkboxConstants.isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
69
+ const classNames = {
70
+ root: require_styles_styler.getStyles({
71
+ checkboxSizeRoot: size,
72
+ checkboxVariantRoot: variant,
73
+ checkboxVariantValueRoot: valueState,
74
+ display: "flex",
75
+ flexDirection: labelPosition === "start" ? "row" : "row-reverse",
76
+ alignItems: "center",
77
+ className: require_styles_styler.cx({
78
+ "cursor-pointer": !disabled,
79
+ "cursor-default": disabled,
80
+ "opacity-50": disabled
81
+ }, className)
82
+ }),
83
+ 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%]"),
84
+ label: require_styles_styler.cx(labelPosition === "start" ? "text-start" : "text-end")
85
+ };
86
+ const input = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
87
+ type: "checkbox",
88
+ tabIndex: 0,
89
+ ...checkboxProps,
90
+ ref: (ref) => {
91
+ innerRef.current = ref;
92
+ setDOMIndeterminate(checked);
93
+ if (typeof parentRef === "function") parentRef(ref);
94
+ else if (parentRef !== null) parentRef.current = ref;
95
+ },
96
+ id: uid,
97
+ disabled,
98
+ required,
99
+ "aria-invalid": hasError,
100
+ checked: isControlled ? require_components_client_Checkbox_checkboxConstants.isIndeterminate(checked) ? false : checked : void 0,
101
+ defaultChecked: isControlled ? void 0 : defaultChecked,
102
+ onChange: handleChange,
103
+ className: classNames.htmlCheckbox
104
+ });
105
+ return renderRoot({
106
+ className: classNames.root,
107
+ style,
108
+ rootSlotProps,
109
+ hasLabel: Boolean(label),
110
+ isPressed,
111
+ onHoverStart: handleHoverStart,
112
+ onHoverEnd: handleHoverEnd,
113
+ onTapStart: handleTapStart,
114
+ onTapEnd: handleTapEnd,
115
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [renderIndicator({
116
+ size,
117
+ variant,
118
+ valueState,
119
+ checked,
120
+ disabled,
121
+ showHoverEffect,
122
+ showPressedEffect,
123
+ cssAnimationDuration,
124
+ checkIcon: require_components_client_Checkbox_checkboxConstants.getIcon(checked),
125
+ checkboxSlotProps,
126
+ iconSlotProps,
127
+ children: input
128
+ }), label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_FormLabel.FormLabel, {
129
+ as: "div",
130
+ variant: "inherit",
131
+ color: "inherit",
132
+ required,
133
+ label,
134
+ className: classNames.label,
135
+ ...labelSlotProps
136
+ })] })
137
+ });
138
+ });
139
+ CheckboxBase.displayName = "CheckboxBase";
140
+ //#endregion
141
+ exports.CheckboxBase = CheckboxBase;
@@ -0,0 +1,48 @@
1
+
2
+ import { CheckboxVariant } from "../../../types/dist/index.cjs";
3
+ import { getIcon } from "./checkboxConstants.cjs";
4
+ import { CheckboxProps, CheckboxValueState, DataAttributes } from "./types.cjs";
5
+ import React, { CSSProperties, ReactNode } from "react";
6
+
7
+ //#region src/components/client/Checkbox/CheckboxBase.d.ts
8
+ type ResolvedCheckboxVariant = CheckboxVariant | 'alert' | 'alert-secondary';
9
+ type RenderRootArgs = {
10
+ className: string;
11
+ style?: CSSProperties;
12
+ rootSlotProps: DataAttributes;
13
+ hasLabel: boolean;
14
+ isPressed: boolean;
15
+ onHoverStart: () => void;
16
+ onHoverEnd: () => void;
17
+ onTapStart: () => void;
18
+ onTapEnd: () => void;
19
+ children: ReactNode;
20
+ };
21
+ type RenderIndicatorArgs = {
22
+ size: NonNullable<CheckboxProps['size']>;
23
+ variant: ResolvedCheckboxVariant;
24
+ valueState: CheckboxValueState;
25
+ checked: CheckboxProps['checked'];
26
+ disabled?: boolean;
27
+ showHoverEffect: boolean;
28
+ showPressedEffect: boolean;
29
+ cssAnimationDuration: string;
30
+ checkIcon: ReturnType<typeof getIcon>;
31
+ checkboxSlotProps: DataAttributes;
32
+ iconSlotProps: DataAttributes;
33
+ children: ReactNode;
34
+ };
35
+ type CheckboxBaseProps = CheckboxProps & {
36
+ cssAnimationDuration: string;
37
+ enableInteractionTracking?: boolean;
38
+ renderRoot: (args: RenderRootArgs) => ReactNode;
39
+ renderIndicator: (args: RenderIndicatorArgs) => ReactNode;
40
+ };
41
+ declare const CheckboxBase: React.ForwardRefExoticComponent<CheckboxProps & {
42
+ cssAnimationDuration: string;
43
+ enableInteractionTracking?: boolean;
44
+ renderRoot: (args: RenderRootArgs) => ReactNode;
45
+ renderIndicator: (args: RenderIndicatorArgs) => ReactNode;
46
+ } & React.RefAttributes<HTMLInputElement>>;
47
+ //#endregion
48
+ export { CheckboxBase, type CheckboxBaseProps, type RenderIndicatorArgs, type RenderRootArgs, type ResolvedCheckboxVariant };