@react-md/core 6.0.2 → 6.1.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.
Files changed (65) hide show
  1. package/dist/_base.scss +6 -2
  2. package/dist/_border-radius.scss +92 -0
  3. package/dist/_core.scss +2 -0
  4. package/dist/_spacing.scss +86 -0
  5. package/dist/app-bar/_app-bar.scss +9 -7
  6. package/dist/app-bar/styles.js +1 -1
  7. package/dist/app-bar/styles.js.map +1 -1
  8. package/dist/avatar/_avatar.scss +3 -3
  9. package/dist/badge/_badge.scss +10 -2
  10. package/dist/box/_box.scss +78 -11
  11. package/dist/button/_button.scss +21 -11
  12. package/dist/card/_card.scss +9 -7
  13. package/dist/chip/_chip.scss +9 -7
  14. package/dist/dialog/_dialog.scss +7 -6
  15. package/dist/divider/_divider.scss +3 -2
  16. package/dist/expansion-panel/_expansion-panel.scss +4 -3
  17. package/dist/form/TextArea.js +1 -1
  18. package/dist/form/TextArea.js.map +1 -1
  19. package/dist/form/_form-message.scss +4 -3
  20. package/dist/form/_input-toggle.scss +2 -1
  21. package/dist/form/_label.scss +3 -2
  22. package/dist/form/_password.scss +2 -1
  23. package/dist/form/_select.scss +4 -4
  24. package/dist/form/_slider.scss +4 -3
  25. package/dist/form/_switch.scss +2 -1
  26. package/dist/form/_text-area.scss +3 -2
  27. package/dist/form/_text-field.scss +20 -16
  28. package/dist/form/utils.js +1 -0
  29. package/dist/form/utils.js.map +1 -1
  30. package/dist/icon/_icon.scss +2 -1
  31. package/dist/interaction/useElementInteraction.js +1 -1
  32. package/dist/interaction/useElementInteraction.js.map +1 -1
  33. package/dist/layout/LayoutNav.js +1 -1
  34. package/dist/layout/LayoutNav.js.map +1 -1
  35. package/dist/layout/useMainTabIndex.js +1 -0
  36. package/dist/layout/useMainTabIndex.js.map +1 -1
  37. package/dist/link/_link.scss +3 -2
  38. package/dist/list/_list.scss +7 -6
  39. package/dist/menu/_menu.scss +2 -1
  40. package/dist/navigation/_navigation.scss +5 -3
  41. package/dist/responsive-item/_responsive-item.scss +2 -1
  42. package/dist/segmented-button/_segmented-button.scss +20 -13
  43. package/dist/sheet/_sheet.scss +2 -1
  44. package/dist/snackbar/_snackbar.scss +12 -10
  45. package/dist/table/_table.scss +5 -4
  46. package/dist/tabs/_tabs.scss +7 -4
  47. package/dist/theme/utils.js +2 -2
  48. package/dist/theme/utils.js.map +1 -1
  49. package/dist/tooltip/_tooltip.scss +52 -25
  50. package/dist/transition/_transition.scss +2 -1
  51. package/dist/tree/_tree.scss +1 -1
  52. package/dist/utils/bem.js +1 -1
  53. package/dist/utils/bem.js.map +1 -1
  54. package/dist/utils/parseCssLengthUnit.js +3 -0
  55. package/dist/utils/parseCssLengthUnit.js.map +1 -1
  56. package/package.json +10 -10
  57. package/src/app-bar/styles.ts +1 -1
  58. package/src/form/TextArea.tsx +1 -1
  59. package/src/form/utils.ts +1 -0
  60. package/src/interaction/useElementInteraction.tsx +1 -1
  61. package/src/layout/LayoutNav.tsx +1 -1
  62. package/src/layout/useMainTabIndex.ts +1 -0
  63. package/src/theme/utils.ts +2 -1
  64. package/src/utils/bem.ts +1 -1
  65. package/src/utils/parseCssLengthUnit.ts +4 -0
package/dist/_base.scss CHANGED
@@ -28,6 +28,8 @@
28
28
  @use "chip/chip";
29
29
  @use "table/table";
30
30
  @use "theme/theme";
31
+ @use "border-radius";
32
+ @use "spacing";
31
33
  @use "dialog/dialog";
32
34
  @use "sheet/sheet";
33
35
  @use "transition/transition";
@@ -385,6 +387,10 @@ $_layer-order: (
385
387
  /// }
386
388
  ///
387
389
  @mixin variables {
390
+ @include theme.theme-variables;
391
+ @include border-radius.variables;
392
+ @include spacing.variables;
393
+ @include typography.typography-variables;
388
394
  @include app-bar.variables;
389
395
  @include autocomplete.variables;
390
396
  @include avatar.variables;
@@ -416,11 +422,9 @@ $_layer-order: (
416
422
  @include tabs.variables;
417
423
  @include text-field.variables;
418
424
  @include text-area.variables;
419
- @include theme.theme-variables;
420
425
  @include tooltip.variables;
421
426
  @include transition.transition-variables;
422
427
  @include tree.variables;
423
- @include typography.typography-variables;
424
428
  @include window-splitter.variables;
425
429
  }
426
430
 
@@ -0,0 +1,92 @@
1
+ ////
2
+ /// @group core.border-radius
3
+ ////
4
+
5
+ @use "utils";
6
+
7
+ /// Set to `true` to disable the border radius variables. You probably don't
8
+ /// want to do this.
9
+ /// @type Boolean
10
+ $disable-everything: false !default;
11
+
12
+ /// No Border Radius.
13
+ ///
14
+ /// @type Number
15
+ $none: 0 !default;
16
+
17
+ /// Extra Small Border Radius.
18
+ ///
19
+ /// @type Number
20
+ $xs: 0.25rem !default;
21
+
22
+ /// Small Border Radius.
23
+ ///
24
+ /// @type Number
25
+ $sm: 0.5rem !default;
26
+
27
+ /// Medium Border Radius.
28
+ ///
29
+ /// @type Number
30
+ $md: 0.75rem !default;
31
+
32
+ /// Large Border Radius.
33
+ ///
34
+ /// @type Number
35
+ $lg: 1rem !default;
36
+
37
+ /// Extra Large Border Radius.
38
+ ///
39
+ /// @type Number
40
+ $xl: 1.75rem !default;
41
+
42
+ /// Full Border Radius.
43
+ ///
44
+ /// @type Number
45
+ $full: 50% !default;
46
+
47
+ /// The available configurable css variables and mostly used internally for the
48
+ /// `get-var`, `set-var`, and `use-var` utils.
49
+ /// @type List
50
+ $variables: (none, xs, sm, md, lg, xl, full);
51
+
52
+ /// @param {String} name - The supported variable name
53
+ /// @param {any} fallback [null] - An optional fallback value
54
+ /// @returns {String} a `var()` statement
55
+ @function get-var($name, $fallback: null) {
56
+ $var: utils.get-var-name($variables, $name, "border-radius");
57
+ @if $fallback {
58
+ @return var(#{$var}, #{$fallback});
59
+ }
60
+
61
+ @return var(#{$var});
62
+ }
63
+
64
+ /// @param {String} name - The supported variable name
65
+ /// @param {any} value - The value to set the variable to. Supports `null` which
66
+ /// will just be a no-op.
67
+ @mixin set-var($name, $value) {
68
+ @if $value {
69
+ #{utils.get-var-name($variables, $name, "border-radius")}: #{$value};
70
+ }
71
+ }
72
+
73
+ /// @param {String} property - The css property to apply the variable to
74
+ /// @param {String} name [$property] - The supported variable name
75
+ /// @param {any} fallback [null] - An optional fallback value if the variable
76
+ /// has not been set
77
+ @mixin use-var($property, $name: $property, $fallback: null) {
78
+ #{$property}: get-var($name, $fallback);
79
+ }
80
+
81
+ /// Conditionally applies the css variables based on feature flags
82
+ @mixin variables {
83
+ @if not $disable-everything {
84
+ @include set-var(none, $none);
85
+ @include set-var(xs, $xs);
86
+ @include set-var(sm, $sm);
87
+ @include set-var(md, $md);
88
+ @include set-var(lg, $lg);
89
+ @include set-var(xl, $xl);
90
+ @include set-var(full, $full);
91
+ }
92
+ }
package/dist/_core.scss CHANGED
@@ -8,6 +8,8 @@
8
8
  @forward "theme/a11y";
9
9
  @forward "theme/colors";
10
10
  @forward "theme/theme";
11
+ @forward "border-radius" as border-radius-*;
12
+ @forward "spacing" as spacing-*;
11
13
  @forward "typography/typography";
12
14
  @forward "transition/transition";
13
15
  @forward "box-shadows";
@@ -0,0 +1,86 @@
1
+ ////
2
+ /// @group core.spacing
3
+ ////
4
+
5
+ @use "utils";
6
+
7
+ /// Set to `true` to disable all the spacing variables. You probably don't want
8
+ /// to do this.
9
+ /// @type Boolean
10
+ $disable-everything: false !default;
11
+
12
+ /// No spacing. Generally applied as `gap`, `padding`, or `margin`.
13
+ ///
14
+ /// @type Number
15
+ $none: 0 !default;
16
+
17
+ /// Extra Small Spacing. Generally applied as `gap`, `padding`, or `margin`.
18
+ ///
19
+ /// @type Number
20
+ $xs: 0.25rem !default;
21
+
22
+ /// Small Spacing. Generally applied as `gap`, `padding`, or `margin`.
23
+ ///
24
+ /// @type Number
25
+ $sm: 0.5rem !default;
26
+
27
+ /// Medium Spacing. Generally applied as `gap`, `padding`, or `margin`.
28
+ ///
29
+ /// @type Number
30
+ $md: 1rem !default;
31
+
32
+ /// Large Spacing. Generally applied as `gap`, `padding`, or `margin`.
33
+ ///
34
+ /// @type Number
35
+ $lg: 1.5rem !default;
36
+
37
+ /// Extra Large Spacing. Generally applied as `gap`, `padding`, or `margin`.
38
+ ///
39
+ /// @type Number
40
+ $xl: 2rem !default;
41
+
42
+ /// The available configurable css variables and mostly used internally for the
43
+ /// `get-var`, `set-var`, and `use-var` utils.
44
+ /// @type List
45
+ $variables: (none, xs, sm, md, lg, xl);
46
+
47
+ /// @param {String} name - The supported variable name
48
+ /// @param {any} fallback [null] - An optional fallback value
49
+ /// @returns {String} a `var()` statement
50
+ @function get-var($name, $fallback: null) {
51
+ $var: utils.get-var-name($variables, $name, "spacing");
52
+ @if $fallback {
53
+ @return var(#{$var}, #{$fallback});
54
+ }
55
+
56
+ @return var(#{$var});
57
+ }
58
+
59
+ /// @param {String} name - The supported variable name
60
+ /// @param {any} value - The value to set the variable to. Supports `null` which
61
+ /// will just be a no-op.
62
+ @mixin set-var($name, $value) {
63
+ @if $value {
64
+ #{utils.get-var-name($variables, $name, "spacing")}: #{$value};
65
+ }
66
+ }
67
+
68
+ /// @param {String} property - The css property to apply the variable to
69
+ /// @param {String} name [$property] - The supported variable name
70
+ /// @param {any} fallback [null] - An optional fallback value if the variable
71
+ /// has not been set
72
+ @mixin use-var($property, $name: $property, $fallback: null) {
73
+ #{$property}: get-var($name, $fallback);
74
+ }
75
+
76
+ /// Conditionally applies the css variables based on feature flags
77
+ @mixin variables {
78
+ @if not $disable-everything {
79
+ @include set-var(none, $none);
80
+ @include set-var(xs, $xs);
81
+ @include set-var(sm, $sm);
82
+ @include set-var(md, $md);
83
+ @include set-var(lg, $lg);
84
+ @include set-var(xl, $xl);
85
+ }
86
+ }
@@ -5,6 +5,7 @@
5
5
  @use "sass:map";
6
6
 
7
7
  @use "../utils";
8
+ @use "../spacing";
8
9
  @use "../box/box";
9
10
  @use "../box-shadows";
10
11
  @use "../interaction/interaction";
@@ -60,7 +61,7 @@ $disable-title: false !default;
60
61
 
61
62
  /// Sets the `gap` css property to apply spacing between each item.
62
63
  /// @type Number
63
- $gap: 0.25rem !default;
64
+ $gap: spacing.get-var(xs) !default;
64
65
 
65
66
  /// The default height for an app bar.
66
67
  /// @type Number
@@ -142,11 +143,11 @@ $surface-color: theme.get-default-color(
142
143
 
143
144
  /// Horizontal padding for the app bar
144
145
  /// @type String|Number
145
- $horizontal-padding: 0.25rem !default;
146
+ $horizontal-padding: spacing.get-var(xs) !default;
146
147
 
147
148
  /// Vertical padding for the app bar
148
149
  /// @type String|Number
149
- $vertical-padding: 0 !default;
150
+ $vertical-padding: spacing.get-var(none) !default;
150
151
 
151
152
  /// This value is used to align the first element (normally a button) nicely with
152
153
  /// other elements on the page.
@@ -166,7 +167,7 @@ $title-keyline: 4.5rem !default;
166
167
  /// based on font-size now and `em`
167
168
  ///
168
169
  /// @type String|Number
169
- $nav-keyline: $title-keyline - $horizontal-padding - $gap - 3rem !default;
170
+ $nav-keyline: calc($title-keyline - $horizontal-padding - $gap - 3rem) !default;
170
171
 
171
172
  /// The available configurable css variables and mostly used internally for the
172
173
  /// `get-var`, `set-var`, and `use-var` utils.
@@ -253,7 +254,8 @@ $variables: (height, surface-background-color, surface-color);
253
254
 
254
255
  .rmd-app-bar {
255
256
  @include box.set-var(gap, $gap);
256
- @include box.set-var(padding, $vertical-padding $horizontal-padding);
257
+ @include box.set-var(padding-v, $vertical-padding);
258
+ @include box.set-var(padding-h, $horizontal-padding);
257
259
  @include use-var(height);
258
260
 
259
261
  // since app bars can appear a lot in full page dialogs, setting these flex
@@ -348,8 +350,8 @@ $variables: (height, surface-background-color, surface-color);
348
350
 
349
351
  @if not $disable-title {
350
352
  .rmd-app-bar-title {
351
- $title-h-margin: $keyline - $horizontal-padding;
352
- $title-keyline-h-margin: $title-keyline - $horizontal-padding;
353
+ $title-h-margin: calc($keyline - $horizontal-padding);
354
+ $title-keyline-h-margin: calc($title-keyline - $horizontal-padding);
353
355
 
354
356
  flex: 1 1 auto;
355
357
  margin: 0 auto 0 $title-h-margin;
@@ -47,7 +47,7 @@ const titleStyles = bem("rmd-app-bar-title");
47
47
  */ export function appBarTitle(options = {}) {
48
48
  const { className, keyline = "small" } = options;
49
49
  return cnb(titleStyles({
50
- keyline: keyline == "list",
50
+ keyline: keyline === "list",
51
51
  "nav-keyline": keyline === "nav"
52
52
  }), className);
53
53
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/app-bar/styles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\n\nimport { type BoxOptions, box } from \"../box/styles.js\";\nimport { type BackgroundColor, cssUtils } from \"../cssUtils.js\";\nimport { type CssPosition } from \"../types.js\";\nimport { bem } from \"../utils/bem.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-app-bar-height\"?: string | number;\n \"--rmd-app-bar-background-color\"?: string;\n \"--rmd-app-bar-color\"?: string;\n \"--rmd-app-bar-surface-background-color\"?: string;\n \"--rmd-app-bar-surface-color\"?: string;\n }\n}\n\nconst styles = bem(\"rmd-app-bar\");\nconst titleStyles = bem(\"rmd-app-bar-title\");\n\nexport type AppBarPosition = \"top\" | \"bottom\";\n\n/**\n * - `\"clear\"` - the background color will be transparent\n * - `\"primary\"` - defaults to the current primary theme color\n * - `\"secondary\"` - defaults to the current secondary theme color\n * - `\"surface\"` - this will use the current surface background color which\n * defaults to `#fff` for light themes, `#242424` for dark themes, and\n * `#424242` for dark themes when the `$disable-dark-elevation` is set to\n * `true`\n *\n * The default dark theme surface color also depends on the `$fixed-elevation`\n * value.\n */\nexport type AppBarTheme = BackgroundColor | \"clear\";\n\n/**\n * - `\"auto\"` - the height will be determined by the height of the content\n * - `\"normal\"` - defaults to `3.5rem` (`$height`)\n * - `\"prominent\"` - defaults to `7rem` (`$prominent-height`)\n * - `\"dense\"` - defaults to `3rem` (`$dense-height`)\n * - `\"prominent-dense\"` - defaults to `6rem` (`$prominent-dense-height`)\n */\nexport type AppBarHeight =\n | \"auto\"\n | \"normal\"\n | \"prominent\"\n | \"dense\"\n | \"prominent-dense\";\n\n/** @since 6.0.0 */\nexport interface AppBarClassNameOptions extends Omit<BoxOptions, \"fullWidth\"> {\n className?: string;\n\n /**\n * Set this to `\"fixed\"` or `\"sticky\"` to set `position: fixed;` or\n * `position: sticky;` to the app bar. The default position will be static and\n * inline with other content.\n *\n * @defaultValue `'static'`\n */\n position?: CssPosition;\n\n /**\n * The position within the page to \"fix\" the `AppBar` when the `fixed` prop is\n * enabled.\n *\n * @defaultValue `\"top\"`\n */\n pagePosition?: AppBarPosition;\n\n /**\n * Set this to `true` to remove the box-shadow.\n *\n * @defaultValue `false`\n */\n disableElevation?: boolean;\n\n /**\n * The theme to apply to the `AppBar`.\n *\n * @defaultValue `\"primary\"`\n * @see {@link AppBarTheme}\n */\n theme?: AppBarTheme;\n\n /**\n * @defaultValue `stacked ? \"auto\" : \"normal\"`\n * @see {@link AppBarHeight}\n */\n height?: AppBarHeight;\n\n /** @see {@link CssUtilsOptions.surfaceColor} */\n surfaceColor?: \"light\" | \"dark\";\n\n /**\n * Set this to `true` if the app bar's positioning and width should be\n * changed whenever the scrollbar is visible on the page. This defaults to\n * `true` when the {@link position} prop is `true` so that once dialogs and menus\n * become visible the contents in the app bar do not need to be repainted.\n *\n * @since 6.0.0\n * @defaultValue `position === \"fixed\"`\n */\n scrollbarOffset?: boolean;\n}\n\n/**\n * Apply the `className`s for a tree component. This will be type-safe if using\n * typescript.\n *\n * @since 6.0.0\n */\nexport function appBar(options: AppBarClassNameOptions = {}): string {\n const {\n className,\n theme = \"primary\",\n stacked,\n height = stacked ? \"auto\" : \"normal\",\n position = \"static\",\n pagePosition = \"top\",\n scrollbarOffset = position === \"fixed\",\n align,\n grid,\n gridColumns,\n gridName,\n justify,\n reversed,\n surfaceColor,\n disableWrap = true,\n disablePadding,\n disableElevation,\n } = options;\n const surface = theme === \"surface\";\n const clear = theme === \"clear\";\n\n return cnb(\n styles({\n surface,\n [height]: height !== \"normal\",\n fixed: position !== \"static\",\n stacked,\n sticky: position === \"sticky\",\n [pagePosition]: position !== \"static\",\n elevated: position !== \"static\" && !disableElevation,\n \"scrollbar-offset\": scrollbarOffset,\n \"static-scrollbar-offset\": position === \"static\" && scrollbarOffset,\n }),\n box({\n align,\n stacked,\n fullWidth: true,\n grid,\n gridColumns,\n gridName,\n justify,\n reversed,\n disableWrap,\n disablePadding,\n }),\n cssUtils({\n backgroundColor: !surface && !clear ? theme : undefined,\n surfaceColor,\n }),\n className\n );\n}\n\n/**\n * - `\"small\"` - the first character in the title will be `1rem` (`$keyline`)\n * from the edge of the app bar horizontally\n * - `\"nav\"` - this should be set when there is a nav button before the title so\n * that the first character in the title will be `4.5rem` (`title-keyline`)\n * - `\"list\"` - this should be used when the title should align with the list\n * item keyline and there is no nav icon before.\n *\n * @since 6.0.0\n */\nexport type AppBarTitleKeyline = \"small\" | \"nav\" | \"list\";\n\n/** @since 6.0.0 */\nexport interface AppBarTitleClassNameOptions {\n className?: string;\n\n /**\n * @defaultValue `\"small\"`\n * @see {@link AppBarTitleKeyline}\n */\n keyline?: AppBarTitleKeyline;\n}\n\n/**\n * Apply the `className`s for a `AppBarTitle` component. This will be type-safe\n * if using typescript.\n *\n * @since 6.0.0\n */\nexport function appBarTitle(options: AppBarTitleClassNameOptions = {}): string {\n const { className, keyline = \"small\" } = options;\n return cnb(\n titleStyles({\n keyline: keyline == \"list\",\n \"nav-keyline\": keyline === \"nav\",\n }),\n className\n );\n}\n"],"names":["cnb","box","cssUtils","bem","styles","titleStyles","appBar","options","className","theme","stacked","height","position","pagePosition","scrollbarOffset","align","grid","gridColumns","gridName","justify","reversed","surfaceColor","disableWrap","disablePadding","disableElevation","surface","clear","fixed","sticky","elevated","fullWidth","backgroundColor","undefined","appBarTitle","keyline"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAEhC,SAA0BC,GAAG,QAAQ,mBAAmB;AACxD,SAA+BC,QAAQ,QAAQ,iBAAiB;AAEhE,SAASC,GAAG,QAAQ,kBAAkB;AAYtC,MAAMC,SAASD,IAAI;AACnB,MAAME,cAAcF,IAAI;AAyFxB;;;;;CAKC,GACD,OAAO,SAASG,OAAOC,UAAkC,CAAC,CAAC;IACzD,MAAM,EACJC,SAAS,EACTC,QAAQ,SAAS,EACjBC,OAAO,EACPC,SAASD,UAAU,SAAS,QAAQ,EACpCE,WAAW,QAAQ,EACnBC,eAAe,KAAK,EACpBC,kBAAkBF,aAAa,OAAO,EACtCG,KAAK,EACLC,IAAI,EACJC,WAAW,EACXC,QAAQ,EACRC,OAAO,EACPC,QAAQ,EACRC,YAAY,EACZC,cAAc,IAAI,EAClBC,cAAc,EACdC,gBAAgB,EACjB,GAAGjB;IACJ,MAAMkB,UAAUhB,UAAU;IAC1B,MAAMiB,QAAQjB,UAAU;IAExB,OAAOT,IACLI,OAAO;QACLqB;QACA,CAACd,OAAO,EAAEA,WAAW;QACrBgB,OAAOf,aAAa;QACpBF;QACAkB,QAAQhB,aAAa;QACrB,CAACC,aAAa,EAAED,aAAa;QAC7BiB,UAAUjB,aAAa,YAAY,CAACY;QACpC,oBAAoBV;QACpB,2BAA2BF,aAAa,YAAYE;IACtD,IACAb,IAAI;QACFc;QACAL;QACAoB,WAAW;QACXd;QACAC;QACAC;QACAC;QACAC;QACAE;QACAC;IACF,IACArB,SAAS;QACP6B,iBAAiB,CAACN,WAAW,CAACC,QAAQjB,QAAQuB;QAC9CX;IACF,IACAb;AAEJ;AAyBA;;;;;CAKC,GACD,OAAO,SAASyB,YAAY1B,UAAuC,CAAC,CAAC;IACnE,MAAM,EAAEC,SAAS,EAAE0B,UAAU,OAAO,EAAE,GAAG3B;IACzC,OAAOP,IACLK,YAAY;QACV6B,SAASA,WAAW;QACpB,eAAeA,YAAY;IAC7B,IACA1B;AAEJ"}
1
+ {"version":3,"sources":["../../src/app-bar/styles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\n\nimport { type BoxOptions, box } from \"../box/styles.js\";\nimport { type BackgroundColor, cssUtils } from \"../cssUtils.js\";\nimport { type CssPosition } from \"../types.js\";\nimport { bem } from \"../utils/bem.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-app-bar-height\"?: string | number;\n \"--rmd-app-bar-background-color\"?: string;\n \"--rmd-app-bar-color\"?: string;\n \"--rmd-app-bar-surface-background-color\"?: string;\n \"--rmd-app-bar-surface-color\"?: string;\n }\n}\n\nconst styles = bem(\"rmd-app-bar\");\nconst titleStyles = bem(\"rmd-app-bar-title\");\n\nexport type AppBarPosition = \"top\" | \"bottom\";\n\n/**\n * - `\"clear\"` - the background color will be transparent\n * - `\"primary\"` - defaults to the current primary theme color\n * - `\"secondary\"` - defaults to the current secondary theme color\n * - `\"surface\"` - this will use the current surface background color which\n * defaults to `#fff` for light themes, `#242424` for dark themes, and\n * `#424242` for dark themes when the `$disable-dark-elevation` is set to\n * `true`\n *\n * The default dark theme surface color also depends on the `$fixed-elevation`\n * value.\n */\nexport type AppBarTheme = BackgroundColor | \"clear\";\n\n/**\n * - `\"auto\"` - the height will be determined by the height of the content\n * - `\"normal\"` - defaults to `3.5rem` (`$height`)\n * - `\"prominent\"` - defaults to `7rem` (`$prominent-height`)\n * - `\"dense\"` - defaults to `3rem` (`$dense-height`)\n * - `\"prominent-dense\"` - defaults to `6rem` (`$prominent-dense-height`)\n */\nexport type AppBarHeight =\n | \"auto\"\n | \"normal\"\n | \"prominent\"\n | \"dense\"\n | \"prominent-dense\";\n\n/** @since 6.0.0 */\nexport interface AppBarClassNameOptions extends Omit<BoxOptions, \"fullWidth\"> {\n className?: string;\n\n /**\n * Set this to `\"fixed\"` or `\"sticky\"` to set `position: fixed;` or\n * `position: sticky;` to the app bar. The default position will be static and\n * inline with other content.\n *\n * @defaultValue `'static'`\n */\n position?: CssPosition;\n\n /**\n * The position within the page to \"fix\" the `AppBar` when the `fixed` prop is\n * enabled.\n *\n * @defaultValue `\"top\"`\n */\n pagePosition?: AppBarPosition;\n\n /**\n * Set this to `true` to remove the box-shadow.\n *\n * @defaultValue `false`\n */\n disableElevation?: boolean;\n\n /**\n * The theme to apply to the `AppBar`.\n *\n * @defaultValue `\"primary\"`\n * @see {@link AppBarTheme}\n */\n theme?: AppBarTheme;\n\n /**\n * @defaultValue `stacked ? \"auto\" : \"normal\"`\n * @see {@link AppBarHeight}\n */\n height?: AppBarHeight;\n\n /** @see {@link CssUtilsOptions.surfaceColor} */\n surfaceColor?: \"light\" | \"dark\";\n\n /**\n * Set this to `true` if the app bar's positioning and width should be\n * changed whenever the scrollbar is visible on the page. This defaults to\n * `true` when the {@link position} prop is `true` so that once dialogs and menus\n * become visible the contents in the app bar do not need to be repainted.\n *\n * @since 6.0.0\n * @defaultValue `position === \"fixed\"`\n */\n scrollbarOffset?: boolean;\n}\n\n/**\n * Apply the `className`s for a tree component. This will be type-safe if using\n * typescript.\n *\n * @since 6.0.0\n */\nexport function appBar(options: AppBarClassNameOptions = {}): string {\n const {\n className,\n theme = \"primary\",\n stacked,\n height = stacked ? \"auto\" : \"normal\",\n position = \"static\",\n pagePosition = \"top\",\n scrollbarOffset = position === \"fixed\",\n align,\n grid,\n gridColumns,\n gridName,\n justify,\n reversed,\n surfaceColor,\n disableWrap = true,\n disablePadding,\n disableElevation,\n } = options;\n const surface = theme === \"surface\";\n const clear = theme === \"clear\";\n\n return cnb(\n styles({\n surface,\n [height]: height !== \"normal\",\n fixed: position !== \"static\",\n stacked,\n sticky: position === \"sticky\",\n [pagePosition]: position !== \"static\",\n elevated: position !== \"static\" && !disableElevation,\n \"scrollbar-offset\": scrollbarOffset,\n \"static-scrollbar-offset\": position === \"static\" && scrollbarOffset,\n }),\n box({\n align,\n stacked,\n fullWidth: true,\n grid,\n gridColumns,\n gridName,\n justify,\n reversed,\n disableWrap,\n disablePadding,\n }),\n cssUtils({\n backgroundColor: !surface && !clear ? theme : undefined,\n surfaceColor,\n }),\n className\n );\n}\n\n/**\n * - `\"small\"` - the first character in the title will be `1rem` (`$keyline`)\n * from the edge of the app bar horizontally\n * - `\"nav\"` - this should be set when there is a nav button before the title so\n * that the first character in the title will be `4.5rem` (`title-keyline`)\n * - `\"list\"` - this should be used when the title should align with the list\n * item keyline and there is no nav icon before.\n *\n * @since 6.0.0\n */\nexport type AppBarTitleKeyline = \"small\" | \"nav\" | \"list\";\n\n/** @since 6.0.0 */\nexport interface AppBarTitleClassNameOptions {\n className?: string;\n\n /**\n * @defaultValue `\"small\"`\n * @see {@link AppBarTitleKeyline}\n */\n keyline?: AppBarTitleKeyline;\n}\n\n/**\n * Apply the `className`s for a `AppBarTitle` component. This will be type-safe\n * if using typescript.\n *\n * @since 6.0.0\n */\nexport function appBarTitle(options: AppBarTitleClassNameOptions = {}): string {\n const { className, keyline = \"small\" } = options;\n return cnb(\n titleStyles({\n keyline: keyline === \"list\",\n \"nav-keyline\": keyline === \"nav\",\n }),\n className\n );\n}\n"],"names":["cnb","box","cssUtils","bem","styles","titleStyles","appBar","options","className","theme","stacked","height","position","pagePosition","scrollbarOffset","align","grid","gridColumns","gridName","justify","reversed","surfaceColor","disableWrap","disablePadding","disableElevation","surface","clear","fixed","sticky","elevated","fullWidth","backgroundColor","undefined","appBarTitle","keyline"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAEhC,SAA0BC,GAAG,QAAQ,mBAAmB;AACxD,SAA+BC,QAAQ,QAAQ,iBAAiB;AAEhE,SAASC,GAAG,QAAQ,kBAAkB;AAYtC,MAAMC,SAASD,IAAI;AACnB,MAAME,cAAcF,IAAI;AAyFxB;;;;;CAKC,GACD,OAAO,SAASG,OAAOC,UAAkC,CAAC,CAAC;IACzD,MAAM,EACJC,SAAS,EACTC,QAAQ,SAAS,EACjBC,OAAO,EACPC,SAASD,UAAU,SAAS,QAAQ,EACpCE,WAAW,QAAQ,EACnBC,eAAe,KAAK,EACpBC,kBAAkBF,aAAa,OAAO,EACtCG,KAAK,EACLC,IAAI,EACJC,WAAW,EACXC,QAAQ,EACRC,OAAO,EACPC,QAAQ,EACRC,YAAY,EACZC,cAAc,IAAI,EAClBC,cAAc,EACdC,gBAAgB,EACjB,GAAGjB;IACJ,MAAMkB,UAAUhB,UAAU;IAC1B,MAAMiB,QAAQjB,UAAU;IAExB,OAAOT,IACLI,OAAO;QACLqB;QACA,CAACd,OAAO,EAAEA,WAAW;QACrBgB,OAAOf,aAAa;QACpBF;QACAkB,QAAQhB,aAAa;QACrB,CAACC,aAAa,EAAED,aAAa;QAC7BiB,UAAUjB,aAAa,YAAY,CAACY;QACpC,oBAAoBV;QACpB,2BAA2BF,aAAa,YAAYE;IACtD,IACAb,IAAI;QACFc;QACAL;QACAoB,WAAW;QACXd;QACAC;QACAC;QACAC;QACAC;QACAE;QACAC;IACF,IACArB,SAAS;QACP6B,iBAAiB,CAACN,WAAW,CAACC,QAAQjB,QAAQuB;QAC9CX;IACF,IACAb;AAEJ;AAyBA;;;;;CAKC,GACD,OAAO,SAASyB,YAAY1B,UAAuC,CAAC,CAAC;IACnE,MAAM,EAAEC,SAAS,EAAE0B,UAAU,OAAO,EAAE,GAAG3B;IACzC,OAAOP,IACLK,YAAY;QACV6B,SAASA,YAAY;QACrB,eAAeA,YAAY;IAC7B,IACA1B;AAEJ"}
@@ -6,6 +6,7 @@
6
6
  @use "sass:map";
7
7
  @use "sass:math";
8
8
  @use "../utils";
9
+ @use "../border-radius";
9
10
  @use "../theme/colors";
10
11
  @use "../typography/typography";
11
12
  @use "../icon/icon";
@@ -53,7 +54,7 @@ $border-color: transparent !default;
53
54
  /// set this to something like 0.25rem.
54
55
  ///
55
56
  /// @type Number
56
- $border-radius: 50% !default;
57
+ $border-radius: border-radius.get-var(full) !default;
57
58
 
58
59
  /// The default height and width
59
60
  /// @type Number
@@ -178,7 +179,6 @@ $variables: (
178
179
  @include set-var(background-color, $background-color);
179
180
  @include set-var(color, $color);
180
181
  @include set-var(border-color, $border-color);
181
- @include set-var(border-radius, $border-radius);
182
182
  @include set-var(size, $size);
183
183
  @include set-var(font-size, $font-size);
184
184
  }
@@ -198,7 +198,7 @@ $variables: (
198
198
  }
199
199
  @include utils.map-to-styles(typography.$base-font-styles);
200
200
  @include use-var(background-color);
201
- @include use-var(border-radius);
201
+ @include use-var(border-radius, $fallback: $border-radius);
202
202
  @include use-var(color);
203
203
  @include use-var(font-size);
204
204
  @include use-var(height, size);
@@ -4,6 +4,7 @@
4
4
 
5
5
  @use "sass:map";
6
6
  @use "../utils";
7
+ @use "../border-radius";
7
8
  @use "../theme/a11y";
8
9
  @use "../theme/colors";
9
10
  @use "../theme/theme";
@@ -60,7 +61,7 @@ $offset-right: $offset !default;
60
61
 
61
62
  /// The default border radius
62
63
  /// @type Number
63
- $border-radius: 50% !default;
64
+ $border-radius: border-radius.get-var(full) !default;
64
65
 
65
66
  /// The default typography to use
66
67
  /// @type Map
@@ -110,6 +111,7 @@ $greyscale-color: theme.get-default-color(
110
111
  /// `get-var`, `set-var`, and `use-var` utils.
111
112
  /// @type List
112
113
  $variables: (
114
+ border-radius,
113
115
  greyscale-background-color,
114
116
  greyscale-color,
115
117
  size,
@@ -144,6 +146,12 @@ $variables: (
144
146
  /// @param {any} fallback [null] - An optional fallback value if the variable
145
147
  /// has not been set
146
148
  @mixin use-var($property, $name: $property, $fallback: null) {
149
+ @if not $fallback {
150
+ @if $name == border-radius {
151
+ $fallback: $border-radius;
152
+ }
153
+ }
154
+
147
155
  #{$property}: get-var($name, $fallback);
148
156
  }
149
157
 
@@ -207,12 +215,12 @@ $variables: (
207
215
  @include utils.optional-layer(badge, $disable-layer) {
208
216
  .rmd-badge {
209
217
  @include utils.map-to-styles($typography);
218
+ @include use-var(border-radius);
210
219
  @include use-var(height, size);
211
220
  @include use-var(width, size);
212
221
  @include use-var(top, offset-top, get-var(offset));
213
222
 
214
223
  align-items: center;
215
- border-radius: $border-radius;
216
224
  display: inline-flex;
217
225
  justify-content: center;
218
226
  pointer-events: none; // badges are _kind_ of presentational and shouldn't trigger mouse events
@@ -4,6 +4,7 @@
4
4
 
5
5
  @use "sass:map";
6
6
  @use "../utils";
7
+ @use "../spacing";
7
8
  @use "../media-queries/media-queries";
8
9
 
9
10
  /// Set to `true` to disable all the styles
@@ -101,7 +102,7 @@ $justify-content: (
101
102
 
102
103
  /// The default flex and grid gap to apply between each item
103
104
  /// @type Number
104
- $gap: 1rem !default;
105
+ $gap: spacing.get-var(md) !default;
105
106
 
106
107
  /// The default padding to apply to the container.
107
108
  /// @type Number
@@ -157,7 +158,11 @@ $_breakpoints: (
157
158
  /// @type List
158
159
  $variables: (
159
160
  gap,
161
+ column-gap,
162
+ row-gap,
160
163
  padding,
164
+ padding-v,
165
+ padding-h,
161
166
  item-min-size,
162
167
  item-min-height,
163
168
  columns,
@@ -182,6 +187,7 @@ $variables: (
182
187
  /// @returns {String} a `var()` statement
183
188
  @function get-var($name, $fallback: null) {
184
189
  $var: utils.get-var-name($variables, $name, "box");
190
+
185
191
  @if $fallback {
186
192
  @return var(#{$var}, #{$fallback});
187
193
  }
@@ -203,6 +209,72 @@ $variables: (
203
209
  /// @param {any} fallback [null] - An optional fallback value if the variable
204
210
  /// has not been set
205
211
  @mixin use-var($property, $name: $property, $fallback: null) {
212
+ // these variables define another fallback and are not set at the root so
213
+ // they can easily be overridden. if they have a default value at the root,
214
+ // that root value will be used instead of the lowest defined override.
215
+ //
216
+ // i.e.
217
+ // ```scss
218
+ //
219
+ // :root {
220
+ // --rmd-box-padding: 3rem;
221
+ // --rmd-box-padding-v: var(--rmd-box-padding);
222
+ // --rmd-box-padding-h: var(--rmd-box-padding);
223
+ // }
224
+ //
225
+ // .some-child {
226
+ // --rmd-box-padding: 1rem;
227
+ //
228
+ // }
229
+ // ```
230
+ //
231
+ // `--rmd-box-padding-v` and `--rmd-box-padding-h` would still have a value
232
+ // of `1rem`
233
+ @if not $fallback {
234
+ @if $name == padding-v or $name == padding-h {
235
+ $fallback: get-var(padding);
236
+ } @else if $name == column-gap or $name == row-gap {
237
+ $fallback: get-var(gap);
238
+ } @else if
239
+ $name ==
240
+ phone-columns or
241
+ $name ==
242
+ tablet-columns or
243
+ $name ==
244
+ desktop-columns or
245
+ $name ==
246
+ large-desktop-columns
247
+ {
248
+ $fallback: get-var(columns);
249
+ } @else if
250
+ $name ==
251
+ phone-item-min-height or
252
+ $name ==
253
+ tablet-item-min-height or
254
+ $name ==
255
+ desktop-item-min-height or
256
+ $name ==
257
+ large-desktop-item-min-height
258
+ {
259
+ $fallback: get-var(item-min-height);
260
+ } @else if
261
+ $name ==
262
+ phone-size or
263
+ $name ==
264
+ tablet-size or
265
+ $name ==
266
+ desktop-size or
267
+ $name ==
268
+ large-desktop-size
269
+ {
270
+ $fallback: get-var(size);
271
+ } @else if $name == gap {
272
+ $fallback: $gap;
273
+ } @else if $name == padding {
274
+ $fallback: $padding;
275
+ }
276
+ }
277
+
206
278
  #{$property}: get-var($name, $fallback);
207
279
  }
208
280
 
@@ -259,14 +331,8 @@ $variables: (
259
331
  /// Conditionally applies the css variables based on feature flags
260
332
  @mixin variables {
261
333
  @if not $disable-everything {
262
- @include set-var(gap, $gap);
263
- @include set-var(padding, $padding);
264
334
  @include set-var(item-min-size, $item-min-size);
265
335
  @include set-var(columns, auto-fit);
266
- @include set-var(phone-columns, auto-fit);
267
- @include set-var(tablet-columns, auto-fit);
268
- @include set-var(desktop-columns, auto-fit);
269
- @include set-var(large-desktop-columns, auto-fit);
270
336
  }
271
337
  }
272
338
 
@@ -282,19 +348,20 @@ $variables: (
282
348
  display: flex;
283
349
 
284
350
  &--gap {
285
- @include use-var(gap, gap);
351
+ @include use-var(gap);
286
352
  }
287
353
 
288
354
  &--gap-h {
289
- @include use-var(column-gap, gap);
355
+ @include use-var(column-gap);
290
356
  }
291
357
 
292
358
  &--gap-v {
293
- @include use-var(row-gap, gap);
359
+ @include use-var(row-gap);
294
360
  }
295
361
 
296
362
  &--padded {
297
- @include use-var(padding);
363
+ padding: get-var(padding-v, get-var(padding, $padding))
364
+ get-var(padding-h, get-var(padding, $padding));
298
365
  }
299
366
 
300
367
  &--wrap {
@@ -5,6 +5,8 @@
5
5
  @use "sass:list";
6
6
  @use "sass:map";
7
7
  @use "../utils";
8
+ @use "../border-radius";
9
+ @use "../spacing";
8
10
  @use "../theme/a11y";
9
11
  @use "../theme/theme";
10
12
  @use "../icon/icon";
@@ -69,15 +71,15 @@ $disable-unstyled-utility-class: false !default;
69
71
 
70
72
  /// The default border radius to apply to text buttons
71
73
  /// @type Number
72
- $text-border-radius: 0.5rem !default;
74
+ $text-border-radius: border-radius.get-var(sm) !default;
73
75
 
74
76
  /// The default horizontal padding to apply to text buttons
75
77
  /// @type Number
76
- $text-horizontal-padding: 1rem !default;
78
+ $text-horizontal-padding: spacing.get-var(md) !default;
77
79
 
78
80
  /// The default vertical padding to apply to text buttons
79
81
  /// @type Number
80
- $text-vertical-padding: 0 !default;
82
+ $text-vertical-padding: spacing.get-var(none) !default;
81
83
 
82
84
  /// The default min-height to apply to text buttons
83
85
  /// @type Number
@@ -93,7 +95,7 @@ $text-icon-size: 1.125rem !default;
93
95
 
94
96
  /// The default border radius to apply to icon buttons
95
97
  /// @type Number
96
- $icon-border-radius: 50% !default;
98
+ $icon-border-radius: border-radius.get-var(full) !default;
97
99
 
98
100
  /// The default border radius to apply to square icon buttons
99
101
  /// @type Number
@@ -151,7 +153,7 @@ $circular-progress-size: icon.get-var(size) !default;
151
153
 
152
154
  /// The default viewport margin for a floating action button
153
155
  /// @type Number
154
- $floating-margin: 1.5rem !default;
156
+ $floating-margin: spacing.get-var(lg) !default;
155
157
 
156
158
  /// The default z-index for a floating action button
157
159
  /// @type Number
@@ -196,9 +198,12 @@ $variables: (
196
198
  text-vertical-padding,
197
199
  text-min-height,
198
200
  text-min-width,
201
+ text-border-radius,
199
202
  icon-size,
203
+ icon-padding,
200
204
  icon-font-size,
201
205
  icon-border-radius,
206
+ icon-square-border-radius,
202
207
  fab-offset
203
208
  );
204
209
 
@@ -277,8 +282,8 @@ $variables: (
277
282
  /// }
278
283
  @mixin text-styles {
279
284
  @include icon.set-var(size, $text-icon-size);
280
- @include set-var(border-radius, $text-border-radius);
281
285
  @include utils.map-to-styles(typography.$button-styles);
286
+ @include use-var(border-radius, text-border-radius, $text-border-radius);
282
287
  @include use-var(min-height, text-min-height);
283
288
  @include use-var(min-width, text-min-width);
284
289
 
@@ -308,7 +313,7 @@ $variables: (
308
313
  @if not $disable-icon {
309
314
  @include set-var(icon-size, $icon-size);
310
315
  @include set-var(icon-font-size, $icon-font-size);
311
- @include set-var(icon-border-radius, $icon-border-radius);
316
+ @include set-var(icon-padding, $icon-padding);
312
317
  }
313
318
 
314
319
  @if not $disable-floating {
@@ -350,17 +355,22 @@ $variables: (
350
355
  @if not $disable-icon {
351
356
  &--icon {
352
357
  @include icon.set-var(size, 1em);
353
- @include set-var(border-radius, get-var(icon-border-radius));
358
+ @include set-var(
359
+ border-radius,
360
+ get-var(icon-border-radius, $icon-border-radius)
361
+ );
354
362
  @include use-var(font-size, icon-font-size);
355
363
  @include use-var(height, icon-size);
356
364
  @include use-var(width, icon-size);
357
-
358
- padding: $icon-padding;
365
+ @include use-var(padding, icon-padding);
359
366
  }
360
367
 
361
368
  @if not $disable-icon-square {
362
369
  &--icon-square {
363
- @include set-var(icon-border-radius, $icon-square-border-radius);
370
+ @include set-var(
371
+ icon-border-radius,
372
+ get-var(icon-square-border-radius)
373
+ );
364
374
  }
365
375
  }
366
376