@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.
- package/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +12 -0
- package/coverage/clover.xml +264 -389
- package/coverage/coverage-final.json +2 -3
- package/coverage/lcov-report/MenuItemCheckbox.tsx.html +223 -0
- package/coverage/lcov-report/MenuItemInputToggle.tsx.html +178 -232
- package/coverage/lcov-report/MenuItemRadio.tsx.html +436 -0
- package/coverage/lcov-report/SrOnly.tsx.html +328 -0
- package/coverage/lcov-report/Typography.tsx.html +1027 -0
- package/coverage/lcov-report/index.html +15 -30
- package/coverage/lcov-report/menuItemInputToggleStyles.ts.html +319 -0
- package/coverage/lcov.info +304 -436
- package/dist/_core.scss +49 -43
- package/dist/badge/_badge.scss +23 -19
- package/dist/form/MenuItemInputToggle.d.ts +2 -15
- package/dist/form/MenuItemInputToggle.js +26 -37
- package/dist/form/MenuItemInputToggle.js.map +1 -1
- package/dist/form/_form.scss +109 -87
- package/dist/form/menuItemInputToggleStyles.d.ts +39 -0
- package/dist/form/menuItemInputToggleStyles.js +31 -0
- package/dist/form/menuItemInputToggleStyles.js.map +1 -0
- package/dist/icon/_icon.scss +7 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/interaction/_interaction.scss +56 -44
- package/dist/list/types.d.ts +10 -1
- package/dist/list/types.js.map +1 -1
- package/dist/menu/_menu.scss +1 -0
- package/dist/theme/_theme.scss +192 -34
- package/dist/typography/SrOnly.d.ts +3 -3
- package/dist/typography/SrOnly.js +4 -4
- package/dist/typography/SrOnly.js.map +1 -1
- package/dist/typography/Typography.d.ts +19 -19
- package/dist/typography/Typography.js +19 -19
- package/dist/typography/Typography.js.map +1 -1
- package/dist/typography/_typography.scss +65 -25
- package/package.json +11 -11
- package/src/_core.scss +49 -43
- package/src/badge/_badge.scss +23 -19
- package/src/button/__tests__/__snapshots__/Button.tsx.snap +1 -1
- package/src/form/MenuItemInputToggle.tsx +46 -64
- package/src/form/__tests__/MenuItemCheckbox.tsx +53 -0
- package/src/form/__tests__/MenuItemRadio.tsx +53 -0
- package/src/form/__tests__/__snapshots__/FileInput.tsx.snap +23 -23
- package/src/form/__tests__/__snapshots__/MenuItemCheckbox.tsx.snap +96 -0
- package/src/form/__tests__/__snapshots__/MenuItemRadio.tsx.snap +96 -0
- package/src/form/_form.scss +109 -87
- package/src/form/menuItemInputToggleStyles.ts +78 -0
- package/src/icon/_icon.scss +7 -5
- package/src/index.ts +1 -0
- package/src/interaction/_interaction.scss +56 -44
- package/src/list/types.ts +12 -1
- package/src/menu/_menu.scss +1 -0
- package/src/theme/_theme.scss +192 -34
- package/src/typography/SrOnly.tsx +9 -9
- package/src/typography/Typography.tsx +19 -19
- package/src/typography/__tests__/__snapshots__/SrOnly.tsx.snap +5 -5
- package/src/typography/_typography.scss +65 -25
|
@@ -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
|
+
}
|
package/src/icon/_icon.scss
CHANGED
|
@@ -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 $
|
|
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 $
|
|
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 $
|
|
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
|
-
|
|
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 |
|
|
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:
|
|
15
|
-
$disable-surface-border-radius-var:
|
|
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,
|
|
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
|
-
@
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
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
|
-
@
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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
|
-
|
|
364
|
-
@
|
|
365
|
-
|
|
366
|
-
|
|
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
|
-
|
|
419
|
-
|
|
420
|
-
|
|
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
|
-
|
|
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 {}
|
package/src/menu/_menu.scss
CHANGED
package/src/theme/_theme.scss
CHANGED
|
@@ -37,6 +37,25 @@ $disable-dark-elevation: $color-scheme == light !default;
|
|
|
37
37
|
$disable-default-system-theme: false !default;
|
|
38
38
|
$disable-default-root-theme: false !default;
|
|
39
39
|
|
|
40
|
+
// this should only be used if your application does not use menu, dialog,
|
|
41
|
+
// sheet, card, expansion-panel, select, app-bar (theme="surface")
|
|
42
|
+
$disable-surface-color: false !default;
|
|
43
|
+
$disable-primary-color: false !default;
|
|
44
|
+
$disable-on-primary-color: $disable-primary-color !default;
|
|
45
|
+
$disable-secondary-color: false !default;
|
|
46
|
+
$disable-on-secondary-color: $disable-secondary-color !default;
|
|
47
|
+
$disable-warning-color: false !default;
|
|
48
|
+
$disable-on-warning-color: $disable-warning-color !default;
|
|
49
|
+
$disable-error-color: false !default;
|
|
50
|
+
$disable-on-error-color: $disable-error-color !default;
|
|
51
|
+
$disable-success-color: false !default;
|
|
52
|
+
$disable-on-success-color: $disable-success-color !default;
|
|
53
|
+
$disable-outline-grey-color: false !default;
|
|
54
|
+
$disable-text-primary-color: false !default;
|
|
55
|
+
$disable-text-secondary-color: false !default;
|
|
56
|
+
$disable-text-hint-color: false !default;
|
|
57
|
+
$disable-text-disabled-color: false !default;
|
|
58
|
+
|
|
40
59
|
$primary-color: colors.$blue-500 !default;
|
|
41
60
|
$on-primary-color: a11y.contrast-color($primary-color) !default;
|
|
42
61
|
$secondary-color: colors.$orange-a-400 !default;
|
|
@@ -152,7 +171,79 @@ $theme-variables: (
|
|
|
152
171
|
outline-grey-color
|
|
153
172
|
);
|
|
154
173
|
|
|
174
|
+
@function _is-var-disabled($name) {
|
|
175
|
+
@if $name == surface-color {
|
|
176
|
+
@return $disable-surface-color;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
@if $name == primary-color {
|
|
180
|
+
@return $disable-primary-color;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
@if $name == on-primary-color {
|
|
184
|
+
@return $disable-on-primary-color;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
@if $name == secondary-color {
|
|
188
|
+
@return $disable-secondary-color;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
@if $name == on-secondary-color {
|
|
192
|
+
@return $disable-on-secondary-color;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
@if $name == warning-color {
|
|
196
|
+
@return $disable-warning-color;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
@if $name == on-warning-color {
|
|
200
|
+
@return $disable-on-warning-color;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@if $name == error-color {
|
|
204
|
+
@return $disable-error-color;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
@if $name == on-error-color {
|
|
208
|
+
@return $disable-on-error-color;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
@if $name == success-color {
|
|
212
|
+
@return $disable-success-color;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
@if $name == on-success-color {
|
|
216
|
+
@return $disable-on-success-color;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
@if $name == text-primary-color {
|
|
220
|
+
@return $disable-text-primary-color;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
@if $name == text-secondary-color {
|
|
224
|
+
@return $disable-text-secondary-color;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
@if $name == text-hint-color {
|
|
228
|
+
@return $disable-text-hint-color;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
@if $name == text-disabled-color {
|
|
232
|
+
@return $disable-text-disabled-color;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
@if $name == outline-grey-color {
|
|
236
|
+
@return $disable-outline-grey-color;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
@return false;
|
|
240
|
+
}
|
|
241
|
+
|
|
155
242
|
@function theme-get-var($name, $fallback: null) {
|
|
243
|
+
@if _is-var-disabled($name) {
|
|
244
|
+
@return $fallback;
|
|
245
|
+
}
|
|
246
|
+
|
|
156
247
|
$var: utils.get-var-name($theme-variables, $name, "theme");
|
|
157
248
|
|
|
158
249
|
@if $fallback {
|
|
@@ -175,6 +266,10 @@ $theme-variables: (
|
|
|
175
266
|
}
|
|
176
267
|
|
|
177
268
|
@mixin theme-set-var($name, $value-or-theme-name) {
|
|
269
|
+
@if _is-var-disabled($name) {
|
|
270
|
+
@error '"#{$name}" is currently disabled and cannot be changed. Set "$disable-#{$name}-var" to `true` or remove it from the Sass module overrides.';
|
|
271
|
+
}
|
|
272
|
+
|
|
178
273
|
$var: utils.get-var-name($theme-variables, $name, "theme");
|
|
179
274
|
$value: $value-or-theme-name;
|
|
180
275
|
@if list.index($theme-variables, $value-or-theme-name) {
|
|
@@ -186,6 +281,10 @@ $theme-variables: (
|
|
|
186
281
|
}
|
|
187
282
|
|
|
188
283
|
@mixin theme-use-var($property, $name: $property, $fallback: null) {
|
|
284
|
+
@if _is-var-disabled($name) {
|
|
285
|
+
@error '"#{$name}" is currently disabled and cannot be changed. Set "$disable-#{$name}-var" to `true` or remove it from the Sass module overrides.';
|
|
286
|
+
}
|
|
287
|
+
|
|
189
288
|
#{$property}: theme-get-var($name, $fallback);
|
|
190
289
|
}
|
|
191
290
|
|
|
@@ -203,16 +302,27 @@ $theme-variables: (
|
|
|
203
302
|
|
|
204
303
|
@mixin use-light-theme-colors {
|
|
205
304
|
@include theme-set-var(background-color, $light-theme-background-color);
|
|
206
|
-
@if $disable-dark-elevation {
|
|
305
|
+
@if $disable-dark-elevation and not $disable-surface-color {
|
|
207
306
|
@include theme-set-var(surface-color, $light-theme-surface-color);
|
|
208
307
|
}
|
|
209
|
-
@
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
308
|
+
@if not $disable-text-primary-color {
|
|
309
|
+
@include theme-set-var(text-primary-color, $light-theme-text-primary-color);
|
|
310
|
+
}
|
|
311
|
+
@if not $disable-text-secondary-color {
|
|
312
|
+
@include theme-set-var(
|
|
313
|
+
text-secondary-color,
|
|
314
|
+
$light-theme-text-secondary-color
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
@if not $disable-text-hint-color {
|
|
318
|
+
@include theme-set-var(text-hint-color, $light-theme-text-hint-color);
|
|
319
|
+
}
|
|
320
|
+
@if not $disable-text-disabled-color {
|
|
321
|
+
@include theme-set-var(
|
|
322
|
+
text-disabled-color,
|
|
323
|
+
$light-theme-text-disabled-color
|
|
324
|
+
);
|
|
325
|
+
}
|
|
216
326
|
|
|
217
327
|
@if not $disable-dark-elevation and $color-scheme != light {
|
|
218
328
|
@include use-light-theme-elevation-colors;
|
|
@@ -221,16 +331,27 @@ $theme-variables: (
|
|
|
221
331
|
|
|
222
332
|
@mixin use-dark-theme-colors {
|
|
223
333
|
@include theme-set-var(background-color, $dark-theme-background-color);
|
|
224
|
-
@if $disable-dark-elevation {
|
|
334
|
+
@if $disable-dark-elevation and not $disable-surface-color {
|
|
225
335
|
@include theme-set-var(surface-color, $dark-theme-surface-color);
|
|
226
336
|
}
|
|
227
|
-
@
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
337
|
+
@if not $disable-text-primary-color {
|
|
338
|
+
@include theme-set-var(text-primary-color, $dark-theme-text-primary-color);
|
|
339
|
+
}
|
|
340
|
+
@if not $disable-text-secondary-color {
|
|
341
|
+
@include theme-set-var(
|
|
342
|
+
text-secondary-color,
|
|
343
|
+
$dark-theme-text-secondary-color
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
@if not $disable-text-hint-color {
|
|
347
|
+
@include theme-set-var(text-hint-color, $dark-theme-text-hint-color);
|
|
348
|
+
}
|
|
349
|
+
@if not $disable-text-disabled-color {
|
|
350
|
+
@include theme-set-var(
|
|
351
|
+
text-disabled-color,
|
|
352
|
+
$dark-theme-text-disabled-color
|
|
353
|
+
);
|
|
354
|
+
}
|
|
234
355
|
|
|
235
356
|
@if not $disable-dark-elevation {
|
|
236
357
|
@include use-dark-theme-elevation-colors;
|
|
@@ -239,24 +360,52 @@ $theme-variables: (
|
|
|
239
360
|
|
|
240
361
|
@mixin theme-variables {
|
|
241
362
|
@include theme-set-var(background-color, $background-color);
|
|
242
|
-
@if $disable-dark-elevation {
|
|
363
|
+
@if $disable-dark-elevation and not $disable-surface-color {
|
|
243
364
|
@include theme-set-var(surface-color, $surface-color);
|
|
244
365
|
}
|
|
245
366
|
|
|
246
|
-
@
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
@
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
@
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
@
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
@
|
|
259
|
-
|
|
367
|
+
@if not $disable-primary-color {
|
|
368
|
+
@include theme-set-var(primary-color, $primary-color);
|
|
369
|
+
}
|
|
370
|
+
@if not $disable-on-primary-color {
|
|
371
|
+
@include theme-set-var(on-primary-color, $on-primary-color);
|
|
372
|
+
}
|
|
373
|
+
@if not $disable-secondary-color {
|
|
374
|
+
@include theme-set-var(secondary-color, $secondary-color);
|
|
375
|
+
}
|
|
376
|
+
@if not $disable-on-secondary-color {
|
|
377
|
+
@include theme-set-var(on-secondary-color, $on-secondary-color);
|
|
378
|
+
}
|
|
379
|
+
@if not $disable-warning-color {
|
|
380
|
+
@include theme-set-var(warning-color, $warning-color);
|
|
381
|
+
}
|
|
382
|
+
@if not $disable-on-warning-color {
|
|
383
|
+
@include theme-set-var(on-warning-color, $on-warning-color);
|
|
384
|
+
}
|
|
385
|
+
@if not $disable-error-color {
|
|
386
|
+
@include theme-set-var(error-color, $error-color);
|
|
387
|
+
}
|
|
388
|
+
@if not $disable-on-error-color {
|
|
389
|
+
@include theme-set-var(on-error-color, $on-error-color);
|
|
390
|
+
}
|
|
391
|
+
@if not $disable-success-color {
|
|
392
|
+
@include theme-set-var(success-color, $success-color);
|
|
393
|
+
}
|
|
394
|
+
@if not $disable-on-success-color {
|
|
395
|
+
@include theme-set-var(on-success-color, $on-success-color);
|
|
396
|
+
}
|
|
397
|
+
@if not $disable-text-primary-color {
|
|
398
|
+
@include theme-set-var(text-primary-color, $text-primary-color);
|
|
399
|
+
}
|
|
400
|
+
@if not $disable-text-secondary-color {
|
|
401
|
+
@include theme-set-var(text-secondary-color, $text-secondary-color);
|
|
402
|
+
}
|
|
403
|
+
@if not $disable-text-hint-color {
|
|
404
|
+
@include theme-set-var(text-hint-color, $text-hint-color);
|
|
405
|
+
}
|
|
406
|
+
@if not $disable-text-disabled-color {
|
|
407
|
+
@include theme-set-var(text-disabled-color, $text-disabled-color);
|
|
408
|
+
}
|
|
260
409
|
|
|
261
410
|
@if not $disable-dark-elevation {
|
|
262
411
|
@if $color-scheme == dark {
|
|
@@ -268,7 +417,9 @@ $theme-variables: (
|
|
|
268
417
|
|
|
269
418
|
@include theme-set-var(outline-width, $outline-width);
|
|
270
419
|
@include theme-set-var(outline-color, $outline-color);
|
|
271
|
-
@
|
|
420
|
+
@if not $disable-outline-grey-color {
|
|
421
|
+
@include theme-set-var(outline-grey-color, $outline-grey-color);
|
|
422
|
+
}
|
|
272
423
|
}
|
|
273
424
|
|
|
274
425
|
@mixin create-surface($z-value, $disable-colors: $disable-dark-elevation) {
|
|
@@ -278,7 +429,9 @@ $theme-variables: (
|
|
|
278
429
|
@if not $disable-colors {
|
|
279
430
|
@include theme-set-var(background-color, theme-get-var(surface-color));
|
|
280
431
|
@include theme-use-var(background-color);
|
|
281
|
-
@
|
|
432
|
+
@if not $disable-text-primary-color {
|
|
433
|
+
@include theme-use-var(color, text-primary-color);
|
|
434
|
+
}
|
|
282
435
|
}
|
|
283
436
|
}
|
|
284
437
|
|
|
@@ -351,7 +504,12 @@ $theme-variables: (
|
|
|
351
504
|
}
|
|
352
505
|
|
|
353
506
|
@mixin default-system-theme {
|
|
354
|
-
@if not
|
|
507
|
+
@if not
|
|
508
|
+
$disable-default-system-theme and
|
|
509
|
+
$disable-default-root-theme and
|
|
510
|
+
$color-scheme ==
|
|
511
|
+
system
|
|
512
|
+
{
|
|
355
513
|
@media (prefers-color-scheme: dark) {
|
|
356
514
|
:root {
|
|
357
515
|
@content;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { forwardRef } from "react";
|
|
1
|
+
import { forwardRef, type ElementType, type HTMLAttributes } from "react";
|
|
2
|
+
import { cssUtils } from "../cssUtils.js";
|
|
2
3
|
import {
|
|
3
|
-
Typography,
|
|
4
4
|
type CustomTypographyComponent,
|
|
5
5
|
type TypographyHTMLElement,
|
|
6
|
-
type TypographyProps,
|
|
7
6
|
} from "./Typography.js";
|
|
8
|
-
import { cssUtils } from "../cssUtils.js";
|
|
9
7
|
|
|
10
|
-
export interface SrOnlyProps extends
|
|
8
|
+
export interface SrOnlyProps extends HTMLAttributes<TypographyHTMLElement> {
|
|
11
9
|
/** @defaultValue `"span"` */
|
|
12
10
|
as?: CustomTypographyComponent;
|
|
13
11
|
|
|
@@ -54,7 +52,7 @@ export interface SrOnlyProps extends TypographyProps {
|
|
|
54
52
|
export const SrOnly = forwardRef<TypographyHTMLElement, SrOnlyProps>(
|
|
55
53
|
function SrOnly(props, ref) {
|
|
56
54
|
const {
|
|
57
|
-
as = "span",
|
|
55
|
+
as: AsComponent = "span",
|
|
58
56
|
className,
|
|
59
57
|
phoneOnly,
|
|
60
58
|
focusable,
|
|
@@ -63,10 +61,12 @@ export const SrOnly = forwardRef<TypographyHTMLElement, SrOnlyProps>(
|
|
|
63
61
|
...remaining
|
|
64
62
|
} = props;
|
|
65
63
|
|
|
64
|
+
// do some type-casting so ref works
|
|
65
|
+
const Component = AsComponent as ElementType;
|
|
66
|
+
|
|
66
67
|
return (
|
|
67
|
-
<
|
|
68
|
+
<Component
|
|
68
69
|
{...remaining}
|
|
69
|
-
as={as}
|
|
70
70
|
ref={ref}
|
|
71
71
|
tabIndex={tabIndex ?? (focusable ? 0 : undefined)}
|
|
72
72
|
className={cssUtils({
|
|
@@ -75,7 +75,7 @@ export const SrOnly = forwardRef<TypographyHTMLElement, SrOnlyProps>(
|
|
|
75
75
|
})}
|
|
76
76
|
>
|
|
77
77
|
{children}
|
|
78
|
-
</
|
|
78
|
+
</Component>
|
|
79
79
|
);
|
|
80
80
|
}
|
|
81
81
|
);
|