@charcoal-ui/react 3.2.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/Button/index.test.d.ts +2 -2
- package/dist/components/Button/index.test.d.ts.map +1 -1
- 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/components/Checkbox/performance.test.d.ts +2 -2
- package/dist/components/Checkbox/performance.test.d.ts.map +1 -1
- package/dist/components/LoadingSpinner/index.story.d.ts +1 -1
- package/dist/core/CharcoalProvider.d.ts +3 -2
- package/dist/core/CharcoalProvider.d.ts.map +1 -1
- package/dist/index.cjs.js +12 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +12 -9
- package/dist/index.esm.js.map +1 -1
- package/package.json +16 -14
- package/src/components/Button/index.test.tsx +2 -2
- package/src/components/Button/index.tsx +2 -2
- package/src/components/Checkbox/index.story.tsx +3 -0
- package/src/components/Checkbox/index.tsx +7 -4
- package/src/components/Checkbox/performance.test.tsx +2 -2
- package/src/components/LoadingSpinner/index.tsx +2 -2
- package/src/core/CharcoalProvider.tsx +6 -2
package/dist/index.esm.js
CHANGED
|
@@ -39,10 +39,11 @@ function CharcoalProvider({
|
|
|
39
39
|
defaultTheme = themeMap[":root"],
|
|
40
40
|
components = {},
|
|
41
41
|
injectTokens = true,
|
|
42
|
-
children
|
|
42
|
+
children,
|
|
43
|
+
background
|
|
43
44
|
}) {
|
|
44
45
|
return /* @__PURE__ */ jsx2(SSRProvider, { children: /* @__PURE__ */ jsxs(ThemeProvider, { theme: defaultTheme, children: [
|
|
45
|
-
injectTokens && /* @__PURE__ */ jsx2(TokenInjector, { theme: themeMap }),
|
|
46
|
+
injectTokens && /* @__PURE__ */ jsx2(TokenInjector, { theme: themeMap, background }),
|
|
46
47
|
/* @__PURE__ */ jsx2(ComponentAbstraction, { components, children: /* @__PURE__ */ jsx2(OverlayProvider, { children }) })
|
|
47
48
|
] }) });
|
|
48
49
|
}
|
|
@@ -198,7 +199,7 @@ var StyledButton = styled3(Clickable_default)`
|
|
|
198
199
|
|
|
199
200
|
${(p) => theme((o) => [
|
|
200
201
|
o.font[variantToFont(p.$variant)].hover.press,
|
|
201
|
-
o.bg[
|
|
202
|
+
o.bg[variantToBackground(p.$variant)].hover.press,
|
|
202
203
|
o.typography(14).bold.preserveHalfLeading,
|
|
203
204
|
o.padding.horizontal(p.$size === "M" ? 24 : 16),
|
|
204
205
|
o.disabled,
|
|
@@ -209,7 +210,7 @@ var StyledButton = styled3(Clickable_default)`
|
|
|
209
210
|
/* よく考えたらheight=32って定義が存在しないな... */
|
|
210
211
|
height: ${(p) => p.$size === "M" ? 40 : 32}px;
|
|
211
212
|
`;
|
|
212
|
-
function
|
|
213
|
+
function variantToBackground(variant) {
|
|
213
214
|
switch (variant) {
|
|
214
215
|
case "Overlay":
|
|
215
216
|
return "surface4";
|
|
@@ -1532,7 +1533,7 @@ var LoadingSpinnerRoot = styled13.div.attrs({ role: "progressbar" })`
|
|
|
1532
1533
|
transparent ? o.bg.transparent : o.bg.background1
|
|
1533
1534
|
])}
|
|
1534
1535
|
`;
|
|
1535
|
-
var
|
|
1536
|
+
var scaleOut = keyframes`
|
|
1536
1537
|
from {
|
|
1537
1538
|
transform: scale(0);
|
|
1538
1539
|
opacity: 1;
|
|
@@ -1548,7 +1549,7 @@ var Icon2 = styled13.div.attrs({ role: "presentation" })`
|
|
|
1548
1549
|
height: 1em;
|
|
1549
1550
|
border-radius: 1em;
|
|
1550
1551
|
background-color: currentColor;
|
|
1551
|
-
animation: ${
|
|
1552
|
+
animation: ${scaleOut} 1s both ease-out;
|
|
1552
1553
|
animation-iteration-count: ${(p) => p.once ? 1 : "infinite"};
|
|
1553
1554
|
|
|
1554
1555
|
&[data-reset-animation] {
|
|
@@ -2181,16 +2182,17 @@ import { useToggleState as useToggleState2 } from "react-stately";
|
|
|
2181
2182
|
import { disabledSelector as disabledSelector6, px as px3 } from "@charcoal-ui/utils";
|
|
2182
2183
|
import { jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2183
2184
|
var Checkbox = forwardRef15(
|
|
2184
|
-
function CheckboxInner(props, ref) {
|
|
2185
|
+
function CheckboxInner({ invalid = false, ...props }, ref) {
|
|
2185
2186
|
const ariaCheckboxProps = useMemo3(
|
|
2186
2187
|
() => ({
|
|
2187
2188
|
...props,
|
|
2188
2189
|
isSelected: props.checked,
|
|
2189
2190
|
defaultSelected: props.defaultChecked,
|
|
2191
|
+
validationState: invalid ? "invalid" : "valid",
|
|
2190
2192
|
"aria-label": "children" in props ? void 0 : props.label,
|
|
2191
2193
|
isDisabled: props.disabled
|
|
2192
2194
|
}),
|
|
2193
|
-
[props]
|
|
2195
|
+
[invalid, props]
|
|
2194
2196
|
);
|
|
2195
2197
|
const state = useToggleState2(ariaCheckboxProps);
|
|
2196
2198
|
const objectRef = useObjectRef3(ref);
|
|
@@ -2198,7 +2200,7 @@ var Checkbox = forwardRef15(
|
|
|
2198
2200
|
const isDisabled = (props.disabled ?? false) || (props.readonly ?? false);
|
|
2199
2201
|
return /* @__PURE__ */ jsxs14(InputRoot, { "aria-disabled": isDisabled, className: props.className, children: [
|
|
2200
2202
|
/* @__PURE__ */ jsxs14(CheckboxRoot, { children: [
|
|
2201
|
-
/* @__PURE__ */ jsx26(CheckboxInput, { type: "checkbox", ...inputProps }),
|
|
2203
|
+
/* @__PURE__ */ jsx26(CheckboxInput, { type: "checkbox", ...inputProps, invalid }),
|
|
2202
2204
|
/* @__PURE__ */ jsx26(CheckboxInputOverlay, { "aria-hidden": true, checked: inputProps.checked, children: /* @__PURE__ */ jsx26(Icon_default, { name: "24/Check", unsafeNonGuidelineScale: 2 / 3 }) })
|
|
2203
2205
|
] }),
|
|
2204
2206
|
"children" in props && /* @__PURE__ */ jsx26(InputLabel, { children: props.children })
|
|
@@ -2242,6 +2244,7 @@ var CheckboxInput = styled21.input`
|
|
|
2242
2244
|
border-color: ${({ theme: theme3 }) => theme3.color.text4};
|
|
2243
2245
|
}
|
|
2244
2246
|
${theme((o) => [o.outline.default.focus, o.borderRadius(4)])}
|
|
2247
|
+
${(p) => p.invalid && theme((o) => [o.outline.assertive])}
|
|
2245
2248
|
|
|
2246
2249
|
/* FIXME: o.outline.default.focus の transition に o.bg.brand の transition が打ち消されてしまう */
|
|
2247
2250
|
transition: all 0.2s !important;
|