@charcoal-ui/react 3.1.2-beta.6 → 3.2.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/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/index.cjs.js +35 -44
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +35 -44
- package/dist/index.esm.js.map +1 -1
- package/package.json +6 -6
- package/src/components/Button/__snapshots__/index.test.tsx.snap +0 -155
- 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/dist/index.esm.js
CHANGED
|
@@ -178,21 +178,17 @@ var Button2 = forwardRef3(function Button3({
|
|
|
178
178
|
{
|
|
179
179
|
...rest,
|
|
180
180
|
disabled,
|
|
181
|
-
variant,
|
|
182
|
-
size,
|
|
183
|
-
fullWidth: fixed,
|
|
181
|
+
$variant: variant,
|
|
182
|
+
$size: size,
|
|
183
|
+
$fullWidth: fixed,
|
|
184
184
|
ref,
|
|
185
185
|
children
|
|
186
186
|
}
|
|
187
187
|
);
|
|
188
188
|
});
|
|
189
189
|
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"};
|
|
190
|
+
var StyledButton = styled3(Clickable_default)`
|
|
191
|
+
width: ${(p) => p.$fullWidth ? "stretch" : "min-content"};
|
|
196
192
|
display: inline-grid;
|
|
197
193
|
align-items: center;
|
|
198
194
|
justify-content: center;
|
|
@@ -201,53 +197,48 @@ var StyledButton = styled3(Clickable_default).withConfig({
|
|
|
201
197
|
white-space: nowrap;
|
|
202
198
|
|
|
203
199
|
${(p) => theme((o) => [
|
|
204
|
-
o.font[p
|
|
205
|
-
o.bg[p
|
|
200
|
+
o.font[variantToFont(p.$variant)].hover.press,
|
|
201
|
+
o.bg[variantToBackgraund(p.$variant)].hover.press,
|
|
206
202
|
o.typography(14).bold.preserveHalfLeading,
|
|
207
|
-
o.padding.horizontal(p
|
|
203
|
+
o.padding.horizontal(p.$size === "M" ? 24 : 16),
|
|
208
204
|
o.disabled,
|
|
209
205
|
o.borderRadius("oval"),
|
|
210
206
|
o.outline.default.focus
|
|
211
207
|
])}
|
|
212
208
|
|
|
213
209
|
/* よく考えたらheight=32って定義が存在しないな... */
|
|
214
|
-
height: ${(p) => p
|
|
210
|
+
height: ${(p) => p.$size === "M" ? 40 : 32}px;
|
|
215
211
|
`;
|
|
216
|
-
function
|
|
217
|
-
return {
|
|
218
|
-
...props,
|
|
219
|
-
...variantToProps(props.variant),
|
|
220
|
-
...sizeToProps(props.size)
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
function variantToProps(variant) {
|
|
212
|
+
function variantToBackgraund(variant) {
|
|
224
213
|
switch (variant) {
|
|
225
214
|
case "Overlay":
|
|
226
|
-
return
|
|
215
|
+
return "surface4";
|
|
227
216
|
case "Default":
|
|
228
|
-
return
|
|
217
|
+
return "surface3";
|
|
229
218
|
case "Primary":
|
|
230
|
-
return
|
|
219
|
+
return "brand";
|
|
231
220
|
case "Navigation":
|
|
232
|
-
return
|
|
221
|
+
return "surface6";
|
|
233
222
|
case "Danger":
|
|
234
|
-
return
|
|
223
|
+
return "assertive";
|
|
235
224
|
default:
|
|
236
225
|
return unreachable(variant);
|
|
237
226
|
}
|
|
238
227
|
}
|
|
239
|
-
function
|
|
240
|
-
switch (
|
|
241
|
-
case "
|
|
242
|
-
return
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
228
|
+
function variantToFont(variant) {
|
|
229
|
+
switch (variant) {
|
|
230
|
+
case "Overlay":
|
|
231
|
+
return "text5";
|
|
232
|
+
case "Default":
|
|
233
|
+
return "text2";
|
|
234
|
+
case "Primary":
|
|
235
|
+
return "text5";
|
|
236
|
+
case "Navigation":
|
|
237
|
+
return "text5";
|
|
238
|
+
case "Danger":
|
|
239
|
+
return "text5";
|
|
240
|
+
default:
|
|
241
|
+
return unreachable(variant);
|
|
251
242
|
}
|
|
252
243
|
}
|
|
253
244
|
|
|
@@ -262,7 +253,7 @@ var IconButton = forwardRef4(
|
|
|
262
253
|
}
|
|
263
254
|
);
|
|
264
255
|
var IconButton_default = IconButton;
|
|
265
|
-
var StyledIconButton = styled4(Clickable_default).attrs(
|
|
256
|
+
var StyledIconButton = styled4(Clickable_default).attrs(styledProps)`
|
|
266
257
|
user-select: none;
|
|
267
258
|
|
|
268
259
|
width: ${(p) => p.width}px;
|
|
@@ -279,14 +270,14 @@ var StyledIconButton = styled4(Clickable_default).attrs(styledProps2)`
|
|
|
279
270
|
o.outline.default.focus
|
|
280
271
|
])}
|
|
281
272
|
`;
|
|
282
|
-
function
|
|
273
|
+
function styledProps(props) {
|
|
283
274
|
return {
|
|
284
275
|
...props,
|
|
285
|
-
...
|
|
286
|
-
...
|
|
276
|
+
...variantToProps(props.variant),
|
|
277
|
+
...sizeToProps(props.size)
|
|
287
278
|
};
|
|
288
279
|
}
|
|
289
|
-
function
|
|
280
|
+
function variantToProps(variant) {
|
|
290
281
|
switch (variant) {
|
|
291
282
|
case "Default":
|
|
292
283
|
return { font: "text3", background: "transparent" };
|
|
@@ -294,7 +285,7 @@ function variantToProps2(variant) {
|
|
|
294
285
|
return { font: "text5", background: "surface4" };
|
|
295
286
|
}
|
|
296
287
|
}
|
|
297
|
-
function
|
|
288
|
+
function sizeToProps(size) {
|
|
298
289
|
switch (size) {
|
|
299
290
|
case "XS":
|
|
300
291
|
return {
|