@react-md/core 1.0.0-next.7 → 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 (60) hide show
  1. package/.turbo/turbo-build.log +6 -6
  2. package/CHANGELOG.md +6 -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 +39 -16
  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 +39 -16
  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
  60. package/.turbo/turbo-lint.log +0 -12
@@ -271,6 +271,7 @@ $variables: (
271
271
  focus-color,
272
272
  addon-top,
273
273
  addon-margin-top,
274
+ addon-left-offset,
274
275
  label-floating-top,
275
276
  label-left-offset,
276
277
  label-top-offset,
@@ -331,10 +332,12 @@ $variables: (
331
332
  text-field-hover-border-color,
332
333
  $text-field-light-hover-border-color
333
334
  );
334
- @include set-var(
335
- text-field-filled-color,
336
- $text-field-light-filled-background-color
337
- );
335
+ @if not $disable-text-field-filled-theme {
336
+ @include set-var(
337
+ text-field-filled-color,
338
+ $text-field-light-filled-background-color
339
+ );
340
+ }
338
341
  @if not $disable-switch {
339
342
  @include set-var(
340
343
  switch-track-background-color,
@@ -382,10 +385,12 @@ $variables: (
382
385
  text-field-hover-border-color,
383
386
  $text-field-dark-hover-border-color
384
387
  );
385
- @include set-var(
386
- text-field-filled-color,
387
- $text-field-dark-filled-background-color
388
- );
388
+ @if not $disable-text-field-filled-theme {
389
+ @include set-var(
390
+ text-field-filled-color,
391
+ $text-field-dark-filled-background-color
392
+ );
393
+ }
389
394
  @if not $disable-switch {
390
395
  @include set-var(
391
396
  switch-track-background-color,
@@ -615,7 +620,6 @@ $variables: (
615
620
  @mixin text-field-container-styles($disable-layer: false) {
616
621
  @include utils.optional-layer(form, $disable-layer) {
617
622
  .rmd-text-field-container {
618
- @include set-var(label-left-offset, get-var(text-field-padding-left));
619
623
  @include use-var(height, text-field-height);
620
624
 
621
625
  align-items: center;
@@ -684,13 +688,20 @@ $variables: (
684
688
  text-field-padding-right,
685
689
  $text-field-outlined-padding
686
690
  );
687
- @include set-var(label-top-offset, -50%);
688
- @include set-var(label-active-padding, 0 $label-floating-padding);
689
- @include set-var(
690
- label-active-background-color,
691
- theme.theme-get-var(background-color)
692
- );
693
691
  @include use-var(border-color, text-field-border-color);
692
+ @if not $disable-text-field-addon {
693
+ @include set-var(addon-left-offset, $text-field-outlined-padding);
694
+ }
695
+
696
+ @if not $disable-floating-label {
697
+ @include set-var(label-left-offset, $text-field-outlined-padding);
698
+ @include set-var(label-top-offset, -50%);
699
+ @include set-var(label-active-padding, 0 $label-floating-padding);
700
+ @include set-var(
701
+ label-active-background-color,
702
+ theme.theme-get-var(background-color)
703
+ );
704
+ }
694
705
 
695
706
  border-radius: $text-field-border-radius;
696
707
  border-style: solid;
@@ -738,6 +749,17 @@ $variables: (
738
749
  text-field-padding-right,
739
750
  $text-field-filled-padding
740
751
  );
752
+ @if not $disable-floating-label {
753
+ @include set-var(
754
+ label-left-offset,
755
+ $text-field-filled-padding + $label-floating-padding
756
+ );
757
+ }
758
+
759
+ @if not $disable-text-field-addon {
760
+ @include set-var(addon-left-offset, $text-field-filled-padding);
761
+ }
762
+
741
763
  @include use-var(background-color, text-field-filled-color);
742
764
  }
743
765
  }
@@ -1196,7 +1218,7 @@ $variables: (
1196
1218
  // `.rmd-text-field-container` which would prevent these styles from being
1197
1219
  // applied
1198
1220
  &--before {
1199
- @include utils.auto-rtl(left, get-var(label-left-offset));
1221
+ @include utils.auto-rtl(left, get-var(addon-left-offset));
1200
1222
  }
1201
1223
 
1202
1224
  &--after {
@@ -1989,6 +2011,7 @@ $variables: (
1989
2011
  @if not $disable-text-field-addon {
1990
2012
  @include set-var(addon-top, auto);
1991
2013
  @include set-var(addon-margin-top, 0px);
2014
+ @include set-var(addon-left-offset, 0px);
1992
2015
  }
1993
2016
 
1994
2017
  @if not $disable-switch {
@@ -0,0 +1,78 @@
1
+ import { cnb } from "cnbuilder";
2
+ import { bem } from "../utils/bem.js";
3
+
4
+ const styles = bem("rmd-menu-item-input-toggle");
5
+
6
+ /** @remarks \@since 6.0.0 */
7
+ export interface MenuItemInputToggleClassNameOptions {
8
+ className?: string;
9
+ type: "radio" | "checkbox" | "switch";
10
+ }
11
+
12
+ /**
13
+ * @remarks \@since 6.0.0
14
+ */
15
+ export function menuItemInputToggle(
16
+ options: MenuItemInputToggleClassNameOptions
17
+ ): string {
18
+ const { className, type } = options;
19
+ return cnb(
20
+ `rmd-${type}-menu-item`,
21
+ styles({ switch: type === "switch" }),
22
+ className
23
+ );
24
+ }
25
+
26
+ /**
27
+ * @remarks \@since 6.0.0
28
+ */
29
+ export interface MenuItemInputToggleTrackClassNameOptions {
30
+ className?: string;
31
+ }
32
+
33
+ /**
34
+ * @remarks \@since 6.0.0
35
+ */
36
+ export function menuItemInputToggleTrack(
37
+ options: MenuItemInputToggleTrackClassNameOptions = {}
38
+ ): string {
39
+ const { className } = options;
40
+
41
+ return cnb(styles("track"), className);
42
+ }
43
+
44
+ /**
45
+ * @remarks \@since 6.0.0
46
+ */
47
+ export interface MenuItemInputToggleBallClassNameOptions {
48
+ className?: string;
49
+ }
50
+
51
+ /**
52
+ * @remarks \@since 6.0.0
53
+ */
54
+ export function menuItemInputToggleBall(
55
+ options: MenuItemInputToggleBallClassNameOptions = {}
56
+ ): string {
57
+ const { className } = options;
58
+
59
+ return cnb(styles("ball"), className);
60
+ }
61
+
62
+ /**
63
+ * @remarks \@since 6.0.0
64
+ */
65
+ export interface MenuItemInputToggleIconClassNameOptions {
66
+ className?: string;
67
+ }
68
+
69
+ /**
70
+ * @remarks \@since 6.0.0
71
+ */
72
+ export function menuItemInputToggleIcon(
73
+ options: MenuItemInputToggleIconClassNameOptions = {}
74
+ ): string {
75
+ const { className } = options;
76
+
77
+ return cnb(styles("icon"), className);
78
+ }
@@ -58,6 +58,9 @@ $variables: (
58
58
  symbol-optical-size
59
59
  );
60
60
 
61
+ // shouldn't really use react-md without icons though...
62
+ $_disable-icons: $disable-font and $disable-svg and $disable-symbol;
63
+
61
64
  @function get-var($name, $fallback: null) {
62
65
  $var: utils.get-var-name($variables, $name, "icon");
63
66
  @if $fallback {
@@ -78,13 +81,13 @@ $variables: (
78
81
  }
79
82
 
80
83
  @mixin use-light-theme {
81
- @if not $disable-font or not $disable-svg {
84
+ @if not $_disable-icons {
82
85
  @include set-var(color, $light-theme-color);
83
86
  }
84
87
  }
85
88
 
86
89
  @mixin use-dark-theme {
87
- @if not $disable-font or not $disable-svg {
90
+ @if not $_disable-icons {
88
91
  @include set-var(color, $dark-theme-color);
89
92
  }
90
93
  }
@@ -96,7 +99,7 @@ $variables: (
96
99
  }
97
100
 
98
101
  @mixin variables {
99
- @if not $disable-font or not $disable-svg or not $disable-symbol {
102
+ @if not $_disable-icons {
100
103
  @include set-var(color, $color);
101
104
  @include set-var(size, $size);
102
105
  @include set-var(spacing, $spacing);
@@ -116,8 +119,7 @@ $variables: (
116
119
  }
117
120
 
118
121
  @mixin styles($disable-layer: false) {
119
- // shouldn't really use react-md without icons though...
120
- @if not $disable-font or not $disable-svg or not $disable-symbol {
122
+ @if not $_disable-icons {
121
123
  @include utils.optional-layer(icon, $disable-layer) {
122
124
  @include theme.default-system-theme {
123
125
  @include use-dark-theme;
package/src/index.ts CHANGED
@@ -86,6 +86,7 @@ export * from "./form/TextFieldContainerStyles.js";
86
86
  export * from "./form/fileUtils.js";
87
87
  export * from "./form/formConfig.js";
88
88
  export * from "./form/formMessageStyles.js";
89
+ export * from "./form/menuItemInputToggleStyles.js";
89
90
  export * from "./form/nativeSelectStyles.js";
90
91
  export * from "./form/optionStyles.js";
91
92
  export * from "./form/passwordStyles.js";
@@ -5,19 +5,20 @@
5
5
  @use "../theme/theme";
6
6
  @use "../transition/transition";
7
7
 
8
- /// ripple | press | both | null
8
+ /// ripple | press | both | none
9
9
  $mode: ripple !default;
10
+ $disable-surface: false !default;
10
11
  $disable-outline-offset: false !default;
11
12
  $disable-focus-background: false !default;
12
13
  $disable-ripple-inset-var: false !default;
13
14
  $disable-ripple-border-radius-var: false !default;
14
- $disable-surface-inset-var: false !default;
15
- $disable-surface-border-radius-var: false !default;
15
+ $disable-surface-inset-var: $disable-surface !default;
16
+ $disable-surface-border-radius-var: $disable-surface !default;
16
17
 
17
18
  $_disable-ripple: not
18
19
  list.index(
19
20
  (ripple, both),
20
- utils.validate((ripple, press, both, null), $mode, "interaction mode")
21
+ utils.validate((ripple, press, both, none), $mode, "interaction mode")
21
22
  );
22
23
 
23
24
  $pressed-class-name: "rmd-pressed";
@@ -189,22 +190,25 @@ $variables: (
189
190
  }
190
191
 
191
192
  @mixin use-light-surface {
192
- @include set-var(
193
- hover-background-color,
194
- $light-surface-hover-background-color
195
- );
196
- @include set-var(
197
- focus-background-color,
198
- $light-surface-focus-background-color
199
- );
200
- @include set-var(
201
- press-background-color,
202
- $light-surface-press-background-color
203
- );
204
- @include set-var(
205
- selected-background-color,
206
- $light-surface-selected-background-color
207
- );
193
+ @if not $disable-surface {
194
+ @include set-var(
195
+ hover-background-color,
196
+ $light-surface-hover-background-color
197
+ );
198
+ @include set-var(
199
+ focus-background-color,
200
+ $light-surface-focus-background-color
201
+ );
202
+ @include set-var(
203
+ press-background-color,
204
+ $light-surface-press-background-color
205
+ );
206
+ @include set-var(
207
+ selected-background-color,
208
+ $light-surface-selected-background-color
209
+ );
210
+ }
211
+
208
212
  @if not $_disable-ripple {
209
213
  @include set-var(
210
214
  ripple-background-color,
@@ -214,22 +218,25 @@ $variables: (
214
218
  }
215
219
 
216
220
  @mixin use-dark-surface {
217
- @include set-var(
218
- hover-background-color,
219
- $dark-surface-hover-background-color
220
- );
221
- @include set-var(
222
- focus-background-color,
223
- $dark-surface-focus-background-color
224
- );
225
- @include set-var(
226
- press-background-color,
227
- $dark-surface-press-background-color
228
- );
229
- @include set-var(
230
- selected-background-color,
231
- $dark-surface-selected-background-color
232
- );
221
+ @if not $disable-surface {
222
+ @include set-var(
223
+ hover-background-color,
224
+ $dark-surface-hover-background-color
225
+ );
226
+ @include set-var(
227
+ focus-background-color,
228
+ $dark-surface-focus-background-color
229
+ );
230
+ @include set-var(
231
+ press-background-color,
232
+ $dark-surface-press-background-color
233
+ );
234
+ @include set-var(
235
+ selected-background-color,
236
+ $dark-surface-selected-background-color
237
+ );
238
+ }
239
+
233
240
  @if not $_disable-ripple {
234
241
  @include set-var(
235
242
  ripple-background-color,
@@ -360,10 +367,13 @@ $variables: (
360
367
  @mixin variables {
361
368
  @include set-var(focus-color, $focus-color);
362
369
  @include set-var(focus-width, $focus-width);
363
- @include set-var(hover-background-color, $hover-background-color);
364
- @include set-var(focus-background-color, $focus-background-color);
365
- @include set-var(press-background-color, $press-background-color);
366
- @include set-var(selected-background-color, $selected-background-color);
370
+
371
+ @if not $disable-surface {
372
+ @include set-var(hover-background-color, $hover-background-color);
373
+ @include set-var(focus-background-color, $focus-background-color);
374
+ @include set-var(press-background-color, $press-background-color);
375
+ @include set-var(selected-background-color, $selected-background-color);
376
+ }
367
377
 
368
378
  @if not $_disable-ripple {
369
379
  @include set-var(ripple-background-color, $ripple-background-color);
@@ -415,10 +425,12 @@ $variables: (
415
425
  }
416
426
  }
417
427
 
418
- .rmd-interaction-surface {
419
- @include surface(
420
- $disabled-selector: "&:disabled,&[aria-disabled='true']"
421
- );
428
+ @if not $disable-surface {
429
+ .rmd-interaction-surface {
430
+ @include surface(
431
+ $disabled-selector: "&:disabled,&[aria-disabled='true']"
432
+ );
433
+ }
422
434
  }
423
435
  }
424
436
  }
package/src/list/types.ts CHANGED
@@ -138,7 +138,14 @@ export interface ListItemChildrenAddonProps {
138
138
  disableRightAddonCenteredMedia?: boolean;
139
139
  }
140
140
 
141
- export interface ListItemChildrenProps extends ListItemChildrenAddonProps {
141
+ /**
142
+ * Note: This interface was added since there are components that replace the
143
+ * {@link ListItemChildrenAddonProps} with renamed versions but should still
144
+ * support everything for rendering text.
145
+ *
146
+ * @remarks \@since 6.0.0
147
+ */
148
+ export interface ListItemChildrenTextProps {
142
149
  /**
143
150
  * The main content to display. When the `textChildren` prop is enabled and
144
151
  * there is child content, it will be treated as primary text and update the
@@ -214,3 +221,7 @@ export interface ListItemChildrenProps extends ListItemChildrenAddonProps {
214
221
  */
215
222
  multiline?: boolean;
216
223
  }
224
+
225
+ export interface ListItemChildrenProps
226
+ extends ListItemChildrenTextProps,
227
+ ListItemChildrenAddonProps {}
@@ -44,6 +44,7 @@ $variables: (background-color, color, min-width, spacing);
44
44
  .rmd-menu {
45
45
  outline: none;
46
46
  overflow: auto;
47
+ overflow-wrap: anywhere;
47
48
 
48
49
  &--elevated {
49
50
  @include box-shadows.box-shadow(