@charcoal-ui/react 3.3.0-beta.0 → 3.3.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/Checkbox/index.d.ts +1 -0
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.story.d.ts +1 -0
- package/dist/components/Checkbox/index.story.d.ts.map +1 -1
- package/dist/index.cjs.js +5 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +5 -3
- package/dist/index.esm.js.map +1 -1
- package/package.json +6 -6
- package/src/components/Checkbox/index.story.tsx +3 -0
- package/src/components/Checkbox/index.tsx +7 -4
package/dist/index.esm.js
CHANGED
|
@@ -2182,16 +2182,17 @@ import { useToggleState as useToggleState2 } from "react-stately";
|
|
|
2182
2182
|
import { disabledSelector as disabledSelector6, px as px3 } from "@charcoal-ui/utils";
|
|
2183
2183
|
import { jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2184
2184
|
var Checkbox = forwardRef15(
|
|
2185
|
-
function CheckboxInner(props, ref) {
|
|
2185
|
+
function CheckboxInner({ invalid = false, ...props }, ref) {
|
|
2186
2186
|
const ariaCheckboxProps = useMemo3(
|
|
2187
2187
|
() => ({
|
|
2188
2188
|
...props,
|
|
2189
2189
|
isSelected: props.checked,
|
|
2190
2190
|
defaultSelected: props.defaultChecked,
|
|
2191
|
+
validationState: invalid ? "invalid" : "valid",
|
|
2191
2192
|
"aria-label": "children" in props ? void 0 : props.label,
|
|
2192
2193
|
isDisabled: props.disabled
|
|
2193
2194
|
}),
|
|
2194
|
-
[props]
|
|
2195
|
+
[invalid, props]
|
|
2195
2196
|
);
|
|
2196
2197
|
const state = useToggleState2(ariaCheckboxProps);
|
|
2197
2198
|
const objectRef = useObjectRef3(ref);
|
|
@@ -2199,7 +2200,7 @@ var Checkbox = forwardRef15(
|
|
|
2199
2200
|
const isDisabled = (props.disabled ?? false) || (props.readonly ?? false);
|
|
2200
2201
|
return /* @__PURE__ */ jsxs14(InputRoot, { "aria-disabled": isDisabled, className: props.className, children: [
|
|
2201
2202
|
/* @__PURE__ */ jsxs14(CheckboxRoot, { children: [
|
|
2202
|
-
/* @__PURE__ */ jsx26(CheckboxInput, { type: "checkbox", ...inputProps }),
|
|
2203
|
+
/* @__PURE__ */ jsx26(CheckboxInput, { type: "checkbox", ...inputProps, invalid }),
|
|
2203
2204
|
/* @__PURE__ */ jsx26(CheckboxInputOverlay, { "aria-hidden": true, checked: inputProps.checked, children: /* @__PURE__ */ jsx26(Icon_default, { name: "24/Check", unsafeNonGuidelineScale: 2 / 3 }) })
|
|
2204
2205
|
] }),
|
|
2205
2206
|
"children" in props && /* @__PURE__ */ jsx26(InputLabel, { children: props.children })
|
|
@@ -2243,6 +2244,7 @@ var CheckboxInput = styled21.input`
|
|
|
2243
2244
|
border-color: ${({ theme: theme3 }) => theme3.color.text4};
|
|
2244
2245
|
}
|
|
2245
2246
|
${theme((o) => [o.outline.default.focus, o.borderRadius(4)])}
|
|
2247
|
+
${(p) => p.invalid && theme((o) => [o.outline.assertive])}
|
|
2246
2248
|
|
|
2247
2249
|
/* FIXME: o.outline.default.focus の transition に o.bg.brand の transition が打ち消されてしまう */
|
|
2248
2250
|
transition: all 0.2s !important;
|