@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/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).withConfig({
191
- shouldForwardProp(prop) {
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.font].hover.press,
205
- o.bg[p.background].hover.press,
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.padding),
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.height}px;
210
+ height: ${(p) => p.$size === "M" ? 40 : 32}px;
215
211
  `;
216
- function styledProps(props) {
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 { font: "text5", background: "surface4" };
215
+ return "surface4";
227
216
  case "Default":
228
- return { font: "text2", background: "surface3" };
217
+ return "surface3";
229
218
  case "Primary":
230
- return { font: "text5", background: "brand" };
219
+ return "brand";
231
220
  case "Navigation":
232
- return { font: "text5", background: "surface6" };
221
+ return "surface6";
233
222
  case "Danger":
234
- return { font: "text5", background: "assertive" };
223
+ return "assertive";
235
224
  default:
236
225
  return unreachable(variant);
237
226
  }
238
227
  }
239
- function sizeToProps(size) {
240
- switch (size) {
241
- case "S":
242
- return {
243
- height: 32,
244
- padding: 16
245
- };
246
- case "M":
247
- return {
248
- height: 40,
249
- padding: 24
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(styledProps2)`
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 styledProps2(props) {
273
+ function styledProps(props) {
283
274
  return {
284
275
  ...props,
285
- ...variantToProps2(props.variant),
286
- ...sizeToProps2(props.size)
276
+ ...variantToProps(props.variant),
277
+ ...sizeToProps(props.size)
287
278
  };
288
279
  }
289
- function variantToProps2(variant) {
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 sizeToProps2(size) {
288
+ function sizeToProps(size) {
298
289
  switch (size) {
299
290
  case "XS":
300
291
  return {