@react-md/core 1.0.0-next.6 → 1.0.0-next.8

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.
Files changed (59) hide show
  1. package/.turbo/turbo-build.log +6 -6
  2. package/CHANGELOG.md +12 -0
  3. package/coverage/clover.xml +264 -389
  4. package/coverage/coverage-final.json +2 -3
  5. package/coverage/lcov-report/MenuItemCheckbox.tsx.html +223 -0
  6. package/coverage/lcov-report/MenuItemInputToggle.tsx.html +178 -232
  7. package/coverage/lcov-report/MenuItemRadio.tsx.html +436 -0
  8. package/coverage/lcov-report/SrOnly.tsx.html +328 -0
  9. package/coverage/lcov-report/Typography.tsx.html +1027 -0
  10. package/coverage/lcov-report/index.html +15 -30
  11. package/coverage/lcov-report/menuItemInputToggleStyles.ts.html +319 -0
  12. package/coverage/lcov.info +304 -436
  13. package/dist/_core.scss +49 -43
  14. package/dist/badge/_badge.scss +23 -19
  15. package/dist/form/MenuItemInputToggle.d.ts +2 -15
  16. package/dist/form/MenuItemInputToggle.js +26 -37
  17. package/dist/form/MenuItemInputToggle.js.map +1 -1
  18. package/dist/form/_form.scss +109 -87
  19. package/dist/form/menuItemInputToggleStyles.d.ts +39 -0
  20. package/dist/form/menuItemInputToggleStyles.js +31 -0
  21. package/dist/form/menuItemInputToggleStyles.js.map +1 -0
  22. package/dist/icon/_icon.scss +7 -5
  23. package/dist/index.d.ts +1 -0
  24. package/dist/index.js +1 -0
  25. package/dist/index.js.map +1 -1
  26. package/dist/interaction/_interaction.scss +56 -44
  27. package/dist/list/types.d.ts +10 -1
  28. package/dist/list/types.js.map +1 -1
  29. package/dist/menu/_menu.scss +1 -0
  30. package/dist/theme/_theme.scss +192 -34
  31. package/dist/typography/SrOnly.d.ts +3 -3
  32. package/dist/typography/SrOnly.js +4 -4
  33. package/dist/typography/SrOnly.js.map +1 -1
  34. package/dist/typography/Typography.d.ts +19 -19
  35. package/dist/typography/Typography.js +19 -19
  36. package/dist/typography/Typography.js.map +1 -1
  37. package/dist/typography/_typography.scss +65 -25
  38. package/package.json +11 -11
  39. package/src/_core.scss +49 -43
  40. package/src/badge/_badge.scss +23 -19
  41. package/src/button/__tests__/__snapshots__/Button.tsx.snap +1 -1
  42. package/src/form/MenuItemInputToggle.tsx +46 -64
  43. package/src/form/__tests__/MenuItemCheckbox.tsx +53 -0
  44. package/src/form/__tests__/MenuItemRadio.tsx +53 -0
  45. package/src/form/__tests__/__snapshots__/FileInput.tsx.snap +23 -23
  46. package/src/form/__tests__/__snapshots__/MenuItemCheckbox.tsx.snap +96 -0
  47. package/src/form/__tests__/__snapshots__/MenuItemRadio.tsx.snap +96 -0
  48. package/src/form/_form.scss +109 -87
  49. package/src/form/menuItemInputToggleStyles.ts +78 -0
  50. package/src/icon/_icon.scss +7 -5
  51. package/src/index.ts +1 -0
  52. package/src/interaction/_interaction.scss +56 -44
  53. package/src/list/types.ts +12 -1
  54. package/src/menu/_menu.scss +1 -0
  55. package/src/theme/_theme.scss +192 -34
  56. package/src/typography/SrOnly.tsx +9 -9
  57. package/src/typography/Typography.tsx +19 -19
  58. package/src/typography/__tests__/__snapshots__/SrOnly.tsx.snap +5 -5
  59. package/src/typography/_typography.scss +65 -25
@@ -62,24 +62,24 @@ export type NullableTypographyClassNameOptions = Omit<
62
62
  * @example
63
63
  * Simple Example
64
64
  * ```ts
65
- * import { getTypographyClassName } from "@react-md/core";
65
+ * import { typography } from "@react-md/core";
66
66
  *
67
67
  * function Example() {
68
68
  * return (
69
69
  * <>
70
- * <h1 className={getTypographyClassName({ type: "headline-1" })} />
71
- * <h2 className={getTypographyClassName({ type: "headline-2" })} />
72
- * <h3 className={getTypographyClassName({ type: "headline-3" })} />
73
- * <h4 className={getTypographyClassName({ type: "headline-4" })} />
74
- * <h5 className={getTypographyClassName({ type: "headline-5" })} />
75
- * <h6 className={getTypographyClassName({ type: "headline-6" })} />
76
- * <h5 className={getTypographyClassName({ type: "subtitle-1" })} />
77
- * <h6 className={getTypographyClassName({ type: "subtitle-2" })} />
78
- * <p className={getTypographyClassName()} />
79
- * <p className={getTypographyClassName({ type "body-1" })} />
80
- * <p className={getTypographyClassName({ type "body-1" })} />
81
- * <caption className={getTypographyClassName({ type: "caption" })} />
82
- * <span className={getTypographyClassName({ type: "overline" })} />
70
+ * <h1 className={typography({ type: "headline-1" })} />
71
+ * <h2 className={typography({ type: "headline-2" })} />
72
+ * <h3 className={typography({ type: "headline-3" })} />
73
+ * <h4 className={typography({ type: "headline-4" })} />
74
+ * <h5 className={typography({ type: "headline-5" })} />
75
+ * <h6 className={typography({ type: "headline-6" })} />
76
+ * <h5 className={typography({ type: "subtitle-1" })} />
77
+ * <h6 className={typography({ type: "subtitle-2" })} />
78
+ * <p className={typography()} />
79
+ * <p className={typography({ type "body-1" })} />
80
+ * <p className={typography({ type "body-1" })} />
81
+ * <caption className={typography({ type: "caption" })} />
82
+ * <span className={typography({ type: "overline" })} />
83
83
  * </>
84
84
  * );
85
85
  * }
@@ -88,14 +88,14 @@ export type NullableTypographyClassNameOptions = Omit<
88
88
  * @example
89
89
  * Applying Additional Styles
90
90
  * ```ts
91
- * import { getTypography } from "@react-md/core";
91
+ * import { typography } from "@react-md/core";
92
92
  *
93
93
  * function Example() {
94
94
  * return (
95
95
  * <>
96
96
  * <h1
97
97
  * // only maintain the default margin-bottom
98
- * className={getTypographyClassName({
98
+ * className={typography({
99
99
  * type: "headline-1",
100
100
  * margin: "bottom",
101
101
  * })}
@@ -103,7 +103,7 @@ export type NullableTypographyClassNameOptions = Omit<
103
103
  *
104
104
  * <h2
105
105
  * // remove all default margin
106
- * className={getTypographyClassName({
106
+ * className={typography({
107
107
  * type: "headline-2",
108
108
  * margin: "none",
109
109
  * })}
@@ -111,7 +111,7 @@ export type NullableTypographyClassNameOptions = Omit<
111
111
  *
112
112
  * <h3
113
113
  * // only maintain the default margin-top
114
- * className={getTypographyClassName({
114
+ * className={typography({
115
115
  * type: "headline-3",
116
116
  * margin: "top",
117
117
  * })}
@@ -119,7 +119,7 @@ export type NullableTypographyClassNameOptions = Omit<
119
119
  *
120
120
  * <p
121
121
  * // center the text, set to bold, and only maintain default margin-bottom
122
- * className={getTypographyClassName({
122
+ * className={typography({
123
123
  * type "subtitle-1",
124
124
  * align: "center",
125
125
  * margin: "bottom",
@@ -3,7 +3,7 @@
3
3
  exports[`SrOnly should apply the correct styling, HTML attributes, and allow a ref 1`] = `
4
4
  <div>
5
5
  <span
6
- class="rmd-typography rmd-typography--body-1 rmd-sr-only"
6
+ class="rmd-sr-only"
7
7
  >
8
8
  Some content
9
9
  </span>
@@ -13,7 +13,7 @@ exports[`SrOnly should apply the correct styling, HTML attributes, and allow a r
13
13
  exports[`SrOnly should apply the correct styling, HTML attributes, and allow a ref 2`] = `
14
14
  <div>
15
15
  <span
16
- class="rmd-typography rmd-typography--body-1 rmd-sr-only custom-class-name"
16
+ class="rmd-sr-only custom-class-name"
17
17
  style="opacity: 0.3;"
18
18
  >
19
19
  Some content
@@ -24,7 +24,7 @@ exports[`SrOnly should apply the correct styling, HTML attributes, and allow a r
24
24
  exports[`SrOnly should apply the correct styling, HTML attributes, and allow a ref 3`] = `
25
25
  <div>
26
26
  <span
27
- class="rmd-typography rmd-typography--body-1 rmd-sr-only rmd-sr-only--focusable"
27
+ class="rmd-sr-only rmd-sr-only--focusable"
28
28
  style=""
29
29
  tabindex="0"
30
30
  >
@@ -36,7 +36,7 @@ exports[`SrOnly should apply the correct styling, HTML attributes, and allow a r
36
36
  exports[`SrOnly should apply the correct styling, HTML attributes, and allow a ref 4`] = `
37
37
  <div>
38
38
  <span
39
- class="rmd-typography rmd-typography--body-1 rmd-sr-only rmd-sr-only--focusable"
39
+ class="rmd-sr-only rmd-sr-only--focusable"
40
40
  style=""
41
41
  tabindex="-1"
42
42
  >
@@ -48,7 +48,7 @@ exports[`SrOnly should apply the correct styling, HTML attributes, and allow a r
48
48
  exports[`SrOnly should apply the correct styling, HTML attributes, and allow a ref 5`] = `
49
49
  <div>
50
50
  <h4
51
- class="rmd-typography rmd-typography--body-1 rmd-sr-only"
51
+ class="rmd-sr-only"
52
52
  >
53
53
  Some content
54
54
  </h4>
@@ -4,6 +4,18 @@
4
4
  @use "../utils";
5
5
 
6
6
  $disable-text-container: false !default;
7
+ $disable-headline-1: false !default;
8
+ $disable-headline-2: false !default;
9
+ $disable-headline-3: false !default;
10
+ $disable-headline-4: false !default;
11
+ $disable-headline-5: false !default;
12
+ $disable-headline-6: false !default;
13
+ $disable-subtitle-1: false !default;
14
+ $disable-subtitle-2: false !default;
15
+ $disable-body-1: false !default;
16
+ $disable-body-2: false !default;
17
+ $disable-caption: false !default;
18
+ $disable-overline: false !default;
7
19
 
8
20
  /// A small utility function to get the letter spacing based on tracking and
9
21
  /// font-size
@@ -216,9 +228,13 @@ $button-recommended-styles: map.merge(
216
228
  $base-font-styles,
217
229
  (
218
230
  font-size: 0.875rem,
219
- line-height: 2.25rem,
220
231
  font-weight: map.get($font-weights, medium),
221
232
  letter-spacing: get-letter-spacing(1.25, 0.875),
233
+ line-height: 2.25rem,
234
+ // buttons with multiple lines of text look terrible because of the large
235
+ // line-height. You normally want to use a different component if the
236
+ // clickable area has so much content to line-wrap
237
+ line-wrap: nowrap,
222
238
  )
223
239
  );
224
240
  $button-custom-styles: () !default;
@@ -276,52 +292,76 @@ $typography-variables: (line-length, text-container-padding);
276
292
  .rmd-typography {
277
293
  @include utils.map-to-styles($base-font-styles);
278
294
 
279
- &--headline-1 {
280
- @include utils.map-to-styles($headline-1-styles);
295
+ @if not $disable-headline-1 {
296
+ &--headline-1 {
297
+ @include utils.map-to-styles($headline-1-styles);
298
+ }
281
299
  }
282
300
 
283
- &--headline-2 {
284
- @include utils.map-to-styles($headline-2-styles);
301
+ @if not $disable-headline-2 {
302
+ &--headline-2 {
303
+ @include utils.map-to-styles($headline-2-styles);
304
+ }
285
305
  }
286
306
 
287
- &--headline-3 {
288
- @include utils.map-to-styles($headline-3-styles);
307
+ @if not $disable-headline-3 {
308
+ &--headline-3 {
309
+ @include utils.map-to-styles($headline-3-styles);
310
+ }
289
311
  }
290
312
 
291
- &--headline-4 {
292
- @include utils.map-to-styles($headline-4-styles);
313
+ @if not $disable-headline-4 {
314
+ &--headline-4 {
315
+ @include utils.map-to-styles($headline-4-styles);
316
+ }
293
317
  }
294
318
 
295
- &--headline-5 {
296
- @include utils.map-to-styles($headline-5-styles);
319
+ @if not $disable-headline-5 {
320
+ &--headline-5 {
321
+ @include utils.map-to-styles($headline-5-styles);
322
+ }
297
323
  }
298
324
 
299
- &--headline-6 {
300
- @include utils.map-to-styles($headline-6-styles);
325
+ @if not $disable-headline-6 {
326
+ &--headline-6 {
327
+ @include utils.map-to-styles($headline-6-styles);
328
+ }
301
329
  }
302
330
 
303
- &--subtitle-1 {
304
- @include utils.map-to-styles($subtitle-1-styles);
331
+ @if not $disable-subtitle-1 {
332
+ &--subtitle-1 {
333
+ @include utils.map-to-styles($subtitle-1-styles);
334
+ }
305
335
  }
306
336
 
307
- &--subtitle-2 {
308
- @include utils.map-to-styles($subtitle-2-styles);
337
+ @if not $disable-subtitle-2 {
338
+ &--subtitle-2 {
339
+ @include utils.map-to-styles($subtitle-2-styles);
340
+ }
309
341
  }
310
342
 
311
- &--body-1 {
312
- @include utils.map-to-styles($body-1-styles);
343
+ @if not $disable-body-1 {
344
+ &--body-1 {
345
+ @include utils.map-to-styles($body-1-styles);
346
+ }
313
347
  }
314
348
 
315
- &--body-2 {
316
- @include utils.map-to-styles($body-2-styles);
349
+ @if not $disable-body-2 {
350
+ &--body-2 {
351
+ @include utils.map-to-styles($body-2-styles);
352
+ }
317
353
  }
318
354
 
319
- &--caption {
320
- @include utils.map-to-styles($caption-styles);
355
+ @if not $disable-caption {
356
+ &--caption {
357
+ @include utils.map-to-styles($caption-styles);
358
+ }
321
359
  }
322
360
 
323
- &--overline {
324
- @include utils.map-to-styles($overline-styles);
361
+ @if not $disable-overline {
362
+ &--overline {
363
+ @include utils.map-to-styles($overline-styles);
364
+ }
325
365
  }
326
366
  }
327
367
  }