@rcarls/rc-theme-material 0.6.0 → 0.7.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 (52) hide show
  1. package/CHANGELOG.md +544 -0
  2. package/DESIGN.md +1399 -0
  3. package/README.md +88 -5
  4. package/bridge.css +132 -55
  5. package/components/accordion.css +43 -157
  6. package/components/adaptive-menu.css +47 -86
  7. package/components/app-bar.css +4 -2
  8. package/components/bottom-sheet.css +2 -2
  9. package/components/button.css +2 -1
  10. package/components/card.css +2 -0
  11. package/components/chip.css +12 -1
  12. package/components/combobox.css +61 -14
  13. package/components/dialog.css +27 -26
  14. package/components/disclosure.css +128 -84
  15. package/components/field.css +566 -0
  16. package/components/icons.css +9 -0
  17. package/components/list-item.css +65 -3
  18. package/components/listbox.css +5 -4
  19. package/components/markdown-editor.css +62 -35
  20. package/components/menu-button.css +4 -1
  21. package/components/menu.css +18 -31
  22. package/components/menubar.css +4 -1
  23. package/components/modes.css +22 -5
  24. package/components/navigation-bar.css +3 -5
  25. package/components/navigation-rail.css +5 -7
  26. package/components/popover.css +50 -0
  27. package/components/progress.css +5 -0
  28. package/components/range-slider.css +3 -2
  29. package/components/search-bar.css +12 -2
  30. package/components/segmented-button.css +2 -28
  31. package/components/select.css +99 -14
  32. package/components/splitter.css +4 -1
  33. package/components/switch.css +9 -1
  34. package/components/textarea.css +7 -3
  35. package/components/toolbar.css +2 -1
  36. package/components/tooltip.css +12 -0
  37. package/components/transfer-list.css +5 -1
  38. package/components/virtual-scroller.css +7 -0
  39. package/components.css +6 -1
  40. package/css-components/button.css +66 -0
  41. package/css-components/card.css +14 -0
  42. package/css-components/chip-group.css +9 -0
  43. package/css-components/chip.css +80 -0
  44. package/css-components/disclosure.css +25 -0
  45. package/css-components/list.css +34 -0
  46. package/css-components/select.css +20 -0
  47. package/css-components/textarea.css +22 -0
  48. package/css-components.css +31 -0
  49. package/defaults.css +189 -3
  50. package/native.css +258 -0
  51. package/package.json +20 -6
  52. package/state-layer.css +5 -1
@@ -1,123 +1,167 @@
1
1
  @layer rc-theme-material.components {
2
+ /*
3
+ * Maps Material tokens onto the public rc-disclosure properties. The panel,
4
+ * summary, and content boxes are drawn by the component's own light-DOM base
5
+ * layer; what is left here is the token mapping plus decoration that genuinely
6
+ * depends on a selector.
7
+ *
8
+ * One mapping covers both `rc-disclosure` and `rc-accordion`, since a panel
9
+ * reads the same properties either way.
10
+ */
2
11
  :where(.rc-theme-material, :host(.rc-theme-material)) rc-disclosure {
12
+ /*
13
+ * Layout stays in theme CSS so a disclosure is laid out before the element
14
+ * upgrades; only the property-driven drawing lives in the component's base
15
+ * layer, which needs JS to install.
16
+ */
3
17
  display: block;
18
+ }
19
+
20
+ :where(.rc-theme-material, :host(.rc-theme-material)) :is(rc-disclosure, rc-accordion) {
4
21
  --rc-theme-material-disclosure-easing: cubic-bezier(
5
22
  var(--md-sys-motion-easing-standard-x0, 0.2),
6
23
  var(--md-sys-motion-easing-standard-y0, 0),
7
24
  var(--md-sys-motion-easing-standard-x1, 0),
8
25
  var(--md-sys-motion-easing-standard-y1, 1)
9
26
  );
27
+
28
+ --rc-disclosure-border: 1px solid var(--md-sys-color-outline-variant, ButtonBorder);
29
+ --rc-disclosure-radius: var(--md-sys-shape-corner-large, 1rem);
30
+ --rc-disclosure-background: var(--md-sys-color-surface-container-low, Canvas);
31
+ --rc-disclosure-color: var(--md-sys-color-on-surface, CanvasText);
32
+ --rc-disclosure-open-background: var(--md-sys-color-surface-container, Canvas);
33
+ --rc-disclosure-open-shadow: var(
34
+ --rc-shadow-level1,
35
+ 0 1px 2px 0 rgb(0 0 0 / 0.3),
36
+ 0 1px 3px 1px rgb(0 0 0 / 0.15)
37
+ );
38
+
39
+ --rc-disclosure-summary-min-block-size: 3.5rem;
40
+ --rc-disclosure-summary-padding-block: 0.75rem;
41
+ --rc-disclosure-summary-padding-inline: 1rem;
42
+ --rc-disclosure-summary-color: var(--md-sys-color-on-surface, CanvasText);
43
+ --rc-disclosure-summary-font: var(--md-sys-typescale-title-small-weight, 500)
44
+ var(--md-sys-typescale-title-small-size, 0.875rem) /
45
+ var(--md-sys-typescale-title-small-line-height, 1.25rem)
46
+ var(--md-sys-typescale-title-small-font, sans-serif);
47
+ --rc-disclosure-summary-marker-color: var(--md-sys-color-on-surface-variant, GrayText);
48
+ --rc-disclosure-summary-hover-background: color-mix(
49
+ in srgb,
50
+ var(--md-sys-color-on-surface, CanvasText)
51
+ calc(var(--md-sys-state-hover-state-layer-opacity, 0.08) * 100%),
52
+ transparent
53
+ );
54
+ --rc-disclosure-focus-ring-offset: -2px;
55
+
56
+ --rc-disclosure-content-padding-block: 0.5rem 1rem;
57
+ --rc-disclosure-content-padding-inline: 1rem;
58
+ --rc-disclosure-content-color: var(--md-sys-color-on-surface-variant, CanvasText);
59
+ --rc-disclosure-content-font: var(--md-sys-typescale-body-medium-size, 0.875rem) /
60
+ var(--md-sys-typescale-body-medium-line-height, 1.25rem)
61
+ var(--md-sys-typescale-body-medium-font, sans-serif);
62
+
63
+ --rc-disclosure-duration: var(--rc-motion-effects-duration-slow, 300ms);
64
+ --rc-disclosure-easing: var(--rc-theme-material-disclosure-easing);
10
65
  }
11
66
 
12
- :where(.rc-theme-material, :host(.rc-theme-material)) rc-disclosure > details {
67
+ /*
68
+ * Clipping keeps the summary's hover layer and the animating content inside
69
+ * the corner radius, and the panel cross-fades its own surface as it opens.
70
+ */
71
+ :where(.rc-theme-material, :host(.rc-theme-material)) :is(rc-disclosure, rc-accordion) > details {
13
72
  overflow: clip;
14
- border: 1px solid var(--md-sys-color-outline-variant, ButtonBorder);
15
- border-radius: var(--md-sys-shape-corner-large, 1rem);
16
- background: var(--md-sys-color-surface-container-low, Canvas);
17
- color: var(--md-sys-color-on-surface, CanvasText);
18
73
  transition:
19
- background-color var(--md-sys-motion-duration-200, 200ms)
74
+ background-color var(--rc-motion-effects-duration-default, 200ms)
20
75
  var(--rc-theme-material-disclosure-easing),
21
- border-color var(--md-sys-motion-duration-200, 200ms)
76
+ border-color var(--rc-motion-effects-duration-default, 200ms)
22
77
  var(--rc-theme-material-disclosure-easing),
23
- box-shadow var(--md-sys-motion-duration-200, 200ms) var(--rc-theme-material-disclosure-easing);
78
+ box-shadow var(--rc-motion-effects-duration-default, 200ms)
79
+ var(--rc-theme-material-disclosure-easing);
24
80
  }
25
81
 
26
- :where(.rc-theme-material, :host(.rc-theme-material)) rc-disclosure > details[open] {
27
- background: var(--md-sys-color-surface-container, Canvas);
28
- box-shadow: var(
29
- --rc-shadow-level1,
30
- 0 1px 2px 0 rgb(0 0 0 / 0.3),
31
- 0 1px 3px 1px rgb(0 0 0 / 0.15)
32
- );
33
- }
82
+ :where(.rc-theme-material, :host(.rc-theme-material))
83
+ :is(rc-disclosure, rc-accordion)
84
+ > details
85
+ > summary {
86
+ -webkit-tap-highlight-color: transparent;
34
87
 
35
- :where(.rc-theme-material, :host(.rc-theme-material)) rc-disclosure > details > summary {
36
- display: grid;
37
- grid-template-columns: minmax(0, 1fr);
88
+ /*
89
+ * Material replaces the native marker with a trailing expand chevron, the
90
+ * Android expandable-list-item affordance, so it owns both halves of that
91
+ * swap: hiding `::marker` and drawing the replacement. That is what makes
92
+ * dropping the `list-item` box safe. Flex centers the authored summary
93
+ * content without assigning one of its children to the chevron column.
94
+ */
95
+ display: flex;
38
96
  align-items: center;
39
- box-sizing: border-box;
40
- min-block-size: 3.5rem;
41
- padding-block: 0.75rem;
42
- padding-inline: 1rem;
43
- border-radius: calc(var(--md-sys-shape-corner-large, 1rem) - 1px);
44
- color: var(--md-sys-color-on-surface, CanvasText);
45
- cursor: pointer;
46
- font-family: var(--md-sys-typescale-title-small-font, inherit);
47
- font-size: var(--md-sys-typescale-title-small-size, 0.875rem);
48
- font-weight: var(--md-sys-typescale-title-small-weight, 500);
49
- line-height: var(--md-sys-typescale-title-small-line-height, 1.25rem);
50
- transition: background-color var(--md-sys-motion-duration-100, 100ms)
51
- var(--rc-theme-material-disclosure-easing);
52
- }
97
+ gap: 1rem;
53
98
 
54
- :where(.rc-theme-material, :host(.rc-theme-material)) rc-disclosure > details > summary::marker {
55
- color: var(--md-sys-color-on-surface-variant, GrayText);
99
+ /* The accordion applies matching logical outer corners to this hover surface. */
100
+ border-radius: var(--rc-disclosure-radius, 0);
101
+ transition: background-color var(--rc-motion-effects-duration-fast, 150ms)
102
+ var(--rc-theme-material-disclosure-easing);
56
103
  }
57
104
 
58
- :where(.rc-theme-material, :host(.rc-theme-material)) rc-disclosure > details > summary:hover {
59
- background: color-mix(in srgb, var(--md-sys-color-on-surface, CanvasText) 8%, transparent);
60
- background: color-mix(
61
- in srgb,
62
- var(--md-sys-color-on-surface, CanvasText)
63
- calc(var(--md-sys-state-hover-state-layer-opacity, 0.08) * 100%),
64
- transparent
65
- );
105
+ :where(.rc-theme-material, :host(.rc-theme-material))
106
+ :is(rc-disclosure, rc-accordion)
107
+ > details
108
+ > summary::marker {
109
+ content: '';
66
110
  }
67
111
 
68
112
  :where(.rc-theme-material, :host(.rc-theme-material))
69
- rc-disclosure
113
+ :is(rc-disclosure, rc-accordion)
70
114
  > details
71
- > summary:focus-visible {
72
- outline: var(--rc-focus-ring, 2px solid Highlight);
73
- outline-offset: -2px;
115
+ > summary::-webkit-details-marker {
116
+ display: none;
74
117
  }
75
118
 
76
- :where(.rc-theme-material, :host(.rc-theme-material)) rc-disclosure > details > :not(summary) {
77
- box-sizing: border-box;
78
- max-block-size: 0;
79
- overflow: clip;
80
- padding-block: 0;
81
- padding-inline: 1rem;
82
- color: var(--md-sys-color-on-surface-variant, CanvasText);
83
- font-family: var(--md-sys-typescale-body-medium-font, inherit);
84
- font-size: var(--md-sys-typescale-body-medium-size, 0.875rem);
85
- line-height: var(--md-sys-typescale-body-medium-line-height, 1.25rem);
86
- opacity: 0;
119
+ /*
120
+ * A border-drawn chevron rather than a masked icon, so forced-colors mode
121
+ * repaints it as a system color without a separate override. Keep its own
122
+ * axes horizontal and left-to-right so inherited RTL or vertical writing
123
+ * does not turn the down/up affordance sideways.
124
+ */
125
+ :where(.rc-theme-material, :host(.rc-theme-material))
126
+ :is(rc-disclosure, rc-accordion)
127
+ > details
128
+ > summary::after {
129
+ content: '';
130
+ direction: ltr;
131
+ writing-mode: horizontal-tb;
132
+ flex: none;
133
+ margin-inline-start: auto;
134
+ inline-size: 0.4375rem;
135
+ block-size: 0.4375rem;
136
+ border-block-start: 2px solid currentColor;
137
+ border-inline-end: 2px solid currentColor;
138
+ color: var(--rc-disclosure-summary-marker-color, currentColor);
139
+ translate: 0 -0.125rem;
140
+ rotate: 135deg;
87
141
  transition:
88
- max-block-size var(--md-sys-motion-duration-300, 300ms)
142
+ rotate var(--rc-motion-spatial-duration-fast, 300ms)
89
143
  var(--rc-theme-material-disclosure-easing),
90
- opacity var(--md-sys-motion-duration-200, 200ms) var(--rc-theme-material-disclosure-easing),
91
- padding-block var(--md-sys-motion-duration-200, 200ms)
144
+ translate var(--rc-motion-spatial-duration-fast, 300ms)
92
145
  var(--rc-theme-material-disclosure-easing);
93
146
  }
94
147
 
95
148
  :where(.rc-theme-material, :host(.rc-theme-material))
96
- rc-disclosure
149
+ :is(rc-disclosure, rc-accordion)
97
150
  > details[open]
98
- > :not(summary) {
99
- max-block-size: 60rem;
100
- padding-block: 0 1rem;
101
- opacity: 1;
102
- }
103
-
104
- @supports (transition-behavior: allow-discrete) {
105
- :where(.rc-theme-material, :host(.rc-theme-material)) rc-disclosure > details > :not(summary) {
106
- transition:
107
- content-visibility var(--md-sys-motion-duration-300, 300ms) allow-discrete,
108
- max-block-size var(--md-sys-motion-duration-300, 300ms)
109
- var(--rc-theme-material-disclosure-easing),
110
- opacity var(--md-sys-motion-duration-200, 200ms) var(--rc-theme-material-disclosure-easing),
111
- padding-block var(--md-sys-motion-duration-200, 200ms)
112
- var(--rc-theme-material-disclosure-easing);
113
- }
151
+ > summary::after {
152
+ translate: 0 0.125rem;
153
+ rotate: 315deg;
114
154
  }
115
155
 
116
- @media (prefers-reduced-motion: reduce) {
117
- :where(.rc-theme-material, :host(.rc-theme-material)) rc-disclosure > details,
118
- :where(.rc-theme-material, :host(.rc-theme-material)) rc-disclosure > details > summary,
119
- :where(.rc-theme-material, :host(.rc-theme-material)) rc-disclosure > details > :not(summary) {
120
- transition-duration: 0ms;
121
- }
156
+ :where(.rc-theme-material, :host(.rc-theme-material))
157
+ :is(rc-disclosure, rc-accordion)
158
+ > details
159
+ > summary:active {
160
+ background: color-mix(
161
+ in srgb,
162
+ var(--md-sys-color-on-surface, CanvasText)
163
+ calc(var(--md-sys-state-pressed-state-layer-opacity, 0.12) * 100%),
164
+ transparent
165
+ );
122
166
  }
123
167
  }