@charcoal-ui/react 3.1.2-beta.6 → 3.3.0-beta.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.d.ts +2 -12
- package/dist/components/Button/index.d.ts.map +1 -1
- 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/performance.test.d.ts +4 -0
- package/dist/components/Checkbox/performance.test.d.ts.map +1 -0
- package/dist/components/Checkbox/snapshot.test.d.ts +2 -0
- package/dist/components/Checkbox/snapshot.test.d.ts.map +1 -0
- 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 +40 -48
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +40 -48
- package/dist/index.esm.js.map +1 -1
- package/package.json +16 -14
- package/src/components/Button/__snapshots__/index.test.tsx.snap +0 -155
- package/src/components/Button/index.test.tsx +2 -2
- package/src/components/Button/index.tsx +37 -54
- package/src/components/Checkbox/__snapshots__/snapshot.test.tsx.snap +763 -0
- package/src/components/Checkbox/performance.test.tsx +30 -0
- package/src/components/Checkbox/snapshot.test.tsx +66 -0
- 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
|
}
|
|
@@ -178,21 +179,17 @@ var Button2 = forwardRef3(function Button3({
|
|
|
178
179
|
{
|
|
179
180
|
...rest,
|
|
180
181
|
disabled,
|
|
181
|
-
variant,
|
|
182
|
-
size,
|
|
183
|
-
fullWidth: fixed,
|
|
182
|
+
$variant: variant,
|
|
183
|
+
$size: size,
|
|
184
|
+
$fullWidth: fixed,
|
|
184
185
|
ref,
|
|
185
186
|
children
|
|
186
187
|
}
|
|
187
188
|
);
|
|
188
189
|
});
|
|
189
190
|
var Button_default = Button2;
|
|
190
|
-
var StyledButton = styled3(Clickable_default)
|
|
191
|
-
|
|
192
|
-
return prop !== "fullWidth";
|
|
193
|
-
}
|
|
194
|
-
}).attrs(styledProps)`
|
|
195
|
-
width: ${(p) => p.fullWidth ? "stretch" : "min-content"};
|
|
191
|
+
var StyledButton = styled3(Clickable_default)`
|
|
192
|
+
width: ${(p) => p.$fullWidth ? "stretch" : "min-content"};
|
|
196
193
|
display: inline-grid;
|
|
197
194
|
align-items: center;
|
|
198
195
|
justify-content: center;
|
|
@@ -201,53 +198,48 @@ var StyledButton = styled3(Clickable_default).withConfig({
|
|
|
201
198
|
white-space: nowrap;
|
|
202
199
|
|
|
203
200
|
${(p) => theme((o) => [
|
|
204
|
-
o.font[p
|
|
205
|
-
o.bg[p
|
|
201
|
+
o.font[variantToFont(p.$variant)].hover.press,
|
|
202
|
+
o.bg[variantToBackground(p.$variant)].hover.press,
|
|
206
203
|
o.typography(14).bold.preserveHalfLeading,
|
|
207
|
-
o.padding.horizontal(p
|
|
204
|
+
o.padding.horizontal(p.$size === "M" ? 24 : 16),
|
|
208
205
|
o.disabled,
|
|
209
206
|
o.borderRadius("oval"),
|
|
210
207
|
o.outline.default.focus
|
|
211
208
|
])}
|
|
212
209
|
|
|
213
210
|
/* よく考えたらheight=32って定義が存在しないな... */
|
|
214
|
-
height: ${(p) => p
|
|
211
|
+
height: ${(p) => p.$size === "M" ? 40 : 32}px;
|
|
215
212
|
`;
|
|
216
|
-
function
|
|
217
|
-
return {
|
|
218
|
-
...props,
|
|
219
|
-
...variantToProps(props.variant),
|
|
220
|
-
...sizeToProps(props.size)
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
function variantToProps(variant) {
|
|
213
|
+
function variantToBackground(variant) {
|
|
224
214
|
switch (variant) {
|
|
225
215
|
case "Overlay":
|
|
226
|
-
return
|
|
216
|
+
return "surface4";
|
|
227
217
|
case "Default":
|
|
228
|
-
return
|
|
218
|
+
return "surface3";
|
|
229
219
|
case "Primary":
|
|
230
|
-
return
|
|
220
|
+
return "brand";
|
|
231
221
|
case "Navigation":
|
|
232
|
-
return
|
|
222
|
+
return "surface6";
|
|
233
223
|
case "Danger":
|
|
234
|
-
return
|
|
224
|
+
return "assertive";
|
|
235
225
|
default:
|
|
236
226
|
return unreachable(variant);
|
|
237
227
|
}
|
|
238
228
|
}
|
|
239
|
-
function
|
|
240
|
-
switch (
|
|
241
|
-
case "
|
|
242
|
-
return
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
229
|
+
function variantToFont(variant) {
|
|
230
|
+
switch (variant) {
|
|
231
|
+
case "Overlay":
|
|
232
|
+
return "text5";
|
|
233
|
+
case "Default":
|
|
234
|
+
return "text2";
|
|
235
|
+
case "Primary":
|
|
236
|
+
return "text5";
|
|
237
|
+
case "Navigation":
|
|
238
|
+
return "text5";
|
|
239
|
+
case "Danger":
|
|
240
|
+
return "text5";
|
|
241
|
+
default:
|
|
242
|
+
return unreachable(variant);
|
|
251
243
|
}
|
|
252
244
|
}
|
|
253
245
|
|
|
@@ -262,7 +254,7 @@ var IconButton = forwardRef4(
|
|
|
262
254
|
}
|
|
263
255
|
);
|
|
264
256
|
var IconButton_default = IconButton;
|
|
265
|
-
var StyledIconButton = styled4(Clickable_default).attrs(
|
|
257
|
+
var StyledIconButton = styled4(Clickable_default).attrs(styledProps)`
|
|
266
258
|
user-select: none;
|
|
267
259
|
|
|
268
260
|
width: ${(p) => p.width}px;
|
|
@@ -279,14 +271,14 @@ var StyledIconButton = styled4(Clickable_default).attrs(styledProps2)`
|
|
|
279
271
|
o.outline.default.focus
|
|
280
272
|
])}
|
|
281
273
|
`;
|
|
282
|
-
function
|
|
274
|
+
function styledProps(props) {
|
|
283
275
|
return {
|
|
284
276
|
...props,
|
|
285
|
-
...
|
|
286
|
-
...
|
|
277
|
+
...variantToProps(props.variant),
|
|
278
|
+
...sizeToProps(props.size)
|
|
287
279
|
};
|
|
288
280
|
}
|
|
289
|
-
function
|
|
281
|
+
function variantToProps(variant) {
|
|
290
282
|
switch (variant) {
|
|
291
283
|
case "Default":
|
|
292
284
|
return { font: "text3", background: "transparent" };
|
|
@@ -294,7 +286,7 @@ function variantToProps2(variant) {
|
|
|
294
286
|
return { font: "text5", background: "surface4" };
|
|
295
287
|
}
|
|
296
288
|
}
|
|
297
|
-
function
|
|
289
|
+
function sizeToProps(size) {
|
|
298
290
|
switch (size) {
|
|
299
291
|
case "XS":
|
|
300
292
|
return {
|
|
@@ -1541,7 +1533,7 @@ var LoadingSpinnerRoot = styled13.div.attrs({ role: "progressbar" })`
|
|
|
1541
1533
|
transparent ? o.bg.transparent : o.bg.background1
|
|
1542
1534
|
])}
|
|
1543
1535
|
`;
|
|
1544
|
-
var
|
|
1536
|
+
var scaleOut = keyframes`
|
|
1545
1537
|
from {
|
|
1546
1538
|
transform: scale(0);
|
|
1547
1539
|
opacity: 1;
|
|
@@ -1557,7 +1549,7 @@ var Icon2 = styled13.div.attrs({ role: "presentation" })`
|
|
|
1557
1549
|
height: 1em;
|
|
1558
1550
|
border-radius: 1em;
|
|
1559
1551
|
background-color: currentColor;
|
|
1560
|
-
animation: ${
|
|
1552
|
+
animation: ${scaleOut} 1s both ease-out;
|
|
1561
1553
|
animation-iteration-count: ${(p) => p.once ? 1 : "infinite"};
|
|
1562
1554
|
|
|
1563
1555
|
&[data-reset-animation] {
|