@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.
- package/dist/cli/commands/purge.cjs +8 -1
- package/dist/cli/commands/purge.helpers.cjs +7 -0
- package/dist/cli/commands/purge.helpers.d.cts +3 -0
- package/dist/cli/commands/purge.helpers.d.ts +3 -0
- package/dist/cli/commands/purge.helpers.js +7 -0
- package/dist/cli/commands/purge.js +8 -1
- 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/Popover/UDSPopoverConfigProvider.d.cts +1 -1
- package/dist/components/client/Popover/UDSPopoverConfigProvider.d.ts +1 -1
- package/dist/components/client/Radio/Radio.cjs +67 -164
- 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 +66 -163
- 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/Toast/UDSToastConfigProvider.d.cts +1 -1
- package/dist/components/client/Toast/UDSToastConfigProvider.d.ts +1 -1
- 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/dist/commands/css.cjs +2 -0
- package/dist/css/dist/commands/css.helpers.cjs +2 -0
- package/dist/css/dist/commands/css.helpers.js +2 -0
- package/dist/css/dist/commands/css.js +2 -0
- package/dist/css/dist/css/nodeUtils.cjs +28 -11
- package/dist/css/dist/css/nodeUtils.js +29 -12
- package/dist/css/dist/css/runner.cjs +8 -3
- package/dist/css/dist/css/runner.js +8 -3
- package/dist/css/dist/css/theme.d.cts +16 -0
- package/dist/css/dist/css/theme.d.ts +16 -0
- package/dist/css/dist/css/workerPool.cjs +2 -1
- package/dist/css/dist/css/workerPool.js +2 -1
- package/dist/css/dist/purger/optimized/ast/expressions.cjs +104 -11
- package/dist/css/dist/purger/optimized/ast/expressions.js +104 -11
- package/dist/css/dist/purger/optimized/ast/jsx.cjs +74 -0
- package/dist/css/dist/purger/optimized/ast/jsx.js +73 -0
- package/dist/css/dist/purger/optimized/ast/props.cjs +47 -0
- package/dist/css/dist/purger/optimized/ast/props.js +46 -0
- package/dist/css/dist/purger/optimized/ast/spread.cjs +87 -0
- package/dist/css/dist/purger/optimized/ast/spread.js +86 -0
- package/dist/css/dist/purger/optimized/purge.cjs +14 -8
- package/dist/css/dist/purger/optimized/purge.js +15 -9
- package/dist/css/dist/purger/optimized/purgeFromCode.cjs +176 -18
- package/dist/css/dist/purger/optimized/purgeFromCode.js +176 -19
- package/dist/css/dist/purger/optimized/utils/files.cjs +22 -2
- package/dist/css/dist/purger/optimized/utils/files.js +21 -3
- 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/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 +26 -26
- package/dist/styles/styler.d.ts +26 -26
- package/dist/uds/generated/componentData.cjs +343 -293
- package/dist/uds/generated/componentData.js +343 -293
- package/dist/uds/generated/tailwindPurge.cjs +12 -12
- package/dist/uds/generated/tailwindPurge.js +12 -12
- package/generated/componentData.json +471 -382
- package/generated/tailwindPurge.ts +2 -2
- package/package.json +1 -1
- package/dist/components/client/Checkbox.cjs +0 -224
- package/dist/components/client/Checkbox.js +0 -219
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { CheckboxVariant } from "../../../types/dist/index.js";
|
|
4
|
+
import { getIcon } from "./checkboxConstants.js";
|
|
5
|
+
import { CheckboxProps, CheckboxValueState, DataAttributes } from "./types.js";
|
|
6
|
+
import React, { CSSProperties, ReactNode } from "react";
|
|
7
|
+
|
|
8
|
+
//#region src/components/client/Checkbox/CheckboxBase.d.ts
|
|
9
|
+
type ResolvedCheckboxVariant = CheckboxVariant | 'alert' | 'alert-secondary';
|
|
10
|
+
type RenderRootArgs = {
|
|
11
|
+
className: string;
|
|
12
|
+
style?: CSSProperties;
|
|
13
|
+
rootSlotProps: DataAttributes;
|
|
14
|
+
hasLabel: boolean;
|
|
15
|
+
isPressed: boolean;
|
|
16
|
+
onHoverStart: () => void;
|
|
17
|
+
onHoverEnd: () => void;
|
|
18
|
+
onTapStart: () => void;
|
|
19
|
+
onTapEnd: () => void;
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
};
|
|
22
|
+
type RenderIndicatorArgs = {
|
|
23
|
+
size: NonNullable<CheckboxProps['size']>;
|
|
24
|
+
variant: ResolvedCheckboxVariant;
|
|
25
|
+
valueState: CheckboxValueState;
|
|
26
|
+
checked: CheckboxProps['checked'];
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
showHoverEffect: boolean;
|
|
29
|
+
showPressedEffect: boolean;
|
|
30
|
+
cssAnimationDuration: string;
|
|
31
|
+
checkIcon: ReturnType<typeof getIcon>;
|
|
32
|
+
checkboxSlotProps: DataAttributes;
|
|
33
|
+
iconSlotProps: DataAttributes;
|
|
34
|
+
children: ReactNode;
|
|
35
|
+
};
|
|
36
|
+
type CheckboxBaseProps = CheckboxProps & {
|
|
37
|
+
cssAnimationDuration: string;
|
|
38
|
+
enableInteractionTracking?: boolean;
|
|
39
|
+
renderRoot: (args: RenderRootArgs) => ReactNode;
|
|
40
|
+
renderIndicator: (args: RenderIndicatorArgs) => ReactNode;
|
|
41
|
+
};
|
|
42
|
+
declare const CheckboxBase: React.ForwardRefExoticComponent<CheckboxProps & {
|
|
43
|
+
cssAnimationDuration: string;
|
|
44
|
+
enableInteractionTracking?: boolean;
|
|
45
|
+
renderRoot: (args: RenderRootArgs) => ReactNode;
|
|
46
|
+
renderIndicator: (args: RenderIndicatorArgs) => ReactNode;
|
|
47
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
48
|
+
//#endregion
|
|
49
|
+
export { CheckboxBase, type CheckboxBaseProps, type RenderIndicatorArgs, type RenderRootArgs, type ResolvedCheckboxVariant };
|
|
@@ -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 };
|
|
@@ -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
|
|
@@ -30,7 +30,7 @@ declare function usePopoverConfig(sizeProp?: PopoverSize | undefined, variantPro
|
|
|
30
30
|
gap: SpacingAlias;
|
|
31
31
|
dismissButtonSpacing: SpacingAlias;
|
|
32
32
|
dismissIconSize: number;
|
|
33
|
-
ariaKitPlacement: ("
|
|
33
|
+
ariaKitPlacement: ("top-start" | "top-end" | "bottom-start" | "bottom-end" | ("top" | "bottom" | "left" | "right") | "left-start" | "right-start" | "left-end" | "right-end") | undefined;
|
|
34
34
|
animationDuration: number;
|
|
35
35
|
};
|
|
36
36
|
//#endregion
|