@momentum-design/components 0.141.5 → 0.142.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.
- package/dist/styles/glass.css +54 -0
- package/dist/styles/gradient-border.css +121 -0
- package/package.json +4 -2
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/* 1px outline drawn as a pseudo-element, because the glass outline token is a gradient. */
|
|
2
|
+
.mdc-glass-border {
|
|
3
|
+
--mdc-glass-border-color: var(--mds-color-theme-outline-glass-normal, rgba(255, 255, 255, 0.1));
|
|
4
|
+
--mdc-glass-border-radius: var(--mds-radius-theme-lg);
|
|
5
|
+
|
|
6
|
+
position: relative;
|
|
7
|
+
border-radius: var(--mdc-glass-border-radius);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.mdc-glass-border::before {
|
|
11
|
+
content: '';
|
|
12
|
+
position: absolute;
|
|
13
|
+
inset: 0;
|
|
14
|
+
padding: 1px;
|
|
15
|
+
border-radius: inherit;
|
|
16
|
+
background: var(--mdc-glass-border-color);
|
|
17
|
+
z-index: 0;
|
|
18
|
+
mask:
|
|
19
|
+
linear-gradient(#000 0 0) content-box,
|
|
20
|
+
linear-gradient(#000 0 0);
|
|
21
|
+
-webkit-mask:
|
|
22
|
+
linear-gradient(#000 0 0) content-box,
|
|
23
|
+
linear-gradient(#000 0 0);
|
|
24
|
+
-webkit-mask-composite: xor;
|
|
25
|
+
mask-composite: exclude;
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
pointer-events: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.mdc-glass-overlay-background {
|
|
31
|
+
--mdc-glass-background: var(--mds-color-theme-background-glass-heavy);
|
|
32
|
+
--mdc-glass-backdrop-filter: var(--mds-effect-backdrop-filter-blur20);
|
|
33
|
+
--mdc-glass-border-radius: var(--mds-radius-theme-lg);
|
|
34
|
+
|
|
35
|
+
position: relative;
|
|
36
|
+
border-radius: var(--mdc-glass-border-radius);
|
|
37
|
+
background: var(--mdc-glass-background);
|
|
38
|
+
backdrop-filter: var(--mdc-glass-backdrop-filter);
|
|
39
|
+
-webkit-backdrop-filter: var(--mdc-glass-backdrop-filter);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Figma applies the radial highlight as a separate 11% layer; ::after keeps that
|
|
43
|
+
opacity applied to the resolved token values at runtime. */
|
|
44
|
+
.mdc-glass-overlay-background::after {
|
|
45
|
+
content: '';
|
|
46
|
+
position: absolute;
|
|
47
|
+
inset: 0;
|
|
48
|
+
border-radius: inherit;
|
|
49
|
+
opacity: 0.11;
|
|
50
|
+
background: radial-gradient(85.92% 85.92% at 50.12% -1.41%,
|
|
51
|
+
var(--mds-color-theme-background-glass-radial-0) 0%,
|
|
52
|
+
var(--mds-color-theme-background-glass-radial-1) 100%);
|
|
53
|
+
pointer-events: none;
|
|
54
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gradient Border
|
|
3
|
+
*
|
|
4
|
+
* A shared style, not a component. Import this stylesheet once, then add
|
|
5
|
+
* `mdc-gradient-border-primary` or `mdc-gradient-border-secondary` to any
|
|
6
|
+
* element that should carry an AI hint border, and
|
|
7
|
+
* `mdc-gradient-border-animated` to make that gradient travel around it.
|
|
8
|
+
*
|
|
9
|
+
* import '@momentum-design/components/dist/styles/gradient-border.css';
|
|
10
|
+
*
|
|
11
|
+
* <div class="mdc-gradient-border-primary mdc-gradient-border-animated">…</div>
|
|
12
|
+
*
|
|
13
|
+
* Requires a Momentum theme stylesheet to be loaded for the AI hint colour
|
|
14
|
+
* tokens to resolve.
|
|
15
|
+
*
|
|
16
|
+
* The ring is a masked pseudo-element rather than a box-shadow, so it leaves
|
|
17
|
+
* box-shadow free for the focus ring and never tints translucent or glass
|
|
18
|
+
* surfaces underneath it.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/* Registered so the angle is a typed <angle> and can therefore be animated.
|
|
22
|
+
A rule in a shadow root is ignored, which is why this ships as a document
|
|
23
|
+
level stylesheet; registration from here applies to shadow roots too. */
|
|
24
|
+
@property --mds-gradient-border-angle {
|
|
25
|
+
syntax: '<angle>';
|
|
26
|
+
inherits: false;
|
|
27
|
+
initial-value: 0deg;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* A full turn, so engines without the Properties and Values API (Firefox below
|
|
31
|
+
128) land on a value identical to the first frame instead of jumping. */
|
|
32
|
+
@keyframes mdc-gradient-border-rotate {
|
|
33
|
+
from {
|
|
34
|
+
--mds-gradient-border-angle: 0deg;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
to {
|
|
38
|
+
--mds-gradient-border-angle: 360deg;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.mdc-gradient-border-primary,
|
|
43
|
+
.mdc-gradient-border-secondary {
|
|
44
|
+
--mdc-gradient-border-width: 0.125rem;
|
|
45
|
+
--mdc-gradient-border-duration: 6s;
|
|
46
|
+
--mdc-gradient-border-iteration-count: infinite;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* Opaque end to end, so the ring reads as a steady hint. */
|
|
50
|
+
.mdc-gradient-border-primary {
|
|
51
|
+
--mdc-gradient-border-start-angle: 90deg;
|
|
52
|
+
--mdc-gradient-border-stops: var(--mds-color-theme-ai-hint-primary-gradient-0) 0%,
|
|
53
|
+
var(--mds-color-theme-ai-hint-primary-gradient-1) 53%, var(--mds-color-theme-ai-hint-primary-gradient-2) 100%;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* First and last stops are transparent, so the ring tapers into a comet tail. */
|
|
57
|
+
.mdc-gradient-border-secondary {
|
|
58
|
+
--mdc-gradient-border-start-angle: 180deg;
|
|
59
|
+
--mdc-gradient-border-stops: var(--mds-color-theme-ai-hint-secondary-gradient-0) 0%,
|
|
60
|
+
var(--mds-color-theme-ai-hint-secondary-gradient-1) 24%, var(--mds-color-theme-ai-hint-secondary-gradient-2) 41%,
|
|
61
|
+
var(--mds-color-theme-ai-hint-secondary-gradient-3) 62%, var(--mds-color-theme-ai-hint-secondary-gradient-4) 82%;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* Everything below is gated: engines without the unprefixed mask (Chrome and
|
|
65
|
+
Edge below 120) parse none of it and render the element unchanged. */
|
|
66
|
+
@supports (mask-composite: exclude) {
|
|
67
|
+
|
|
68
|
+
.mdc-gradient-border-primary,
|
|
69
|
+
.mdc-gradient-border-secondary {
|
|
70
|
+
position: relative;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.mdc-gradient-border-primary::after,
|
|
74
|
+
.mdc-gradient-border-secondary::after {
|
|
75
|
+
content: '';
|
|
76
|
+
position: absolute;
|
|
77
|
+
inset: 0;
|
|
78
|
+
border-radius: inherit;
|
|
79
|
+
padding: var(--mdc-gradient-border-width);
|
|
80
|
+
pointer-events: none;
|
|
81
|
+
mask:
|
|
82
|
+
linear-gradient(#000 0 0) content-box,
|
|
83
|
+
linear-gradient(#000 0 0);
|
|
84
|
+
mask-composite: exclude;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* Composed in the rule that paints the ring rather than in a token or in a
|
|
88
|
+
custom property on the host: a custom property's var() is substituted
|
|
89
|
+
where it is declared, so an angle baked in further up would resolve there
|
|
90
|
+
once and never see the animation, which runs on this pseudo-element. The
|
|
91
|
+
start angle is added here too, so it also applies when static. */
|
|
92
|
+
.mdc-gradient-border-primary::after {
|
|
93
|
+
background: linear-gradient(calc(var(--mdc-gradient-border-start-angle) + var(--mds-gradient-border-angle, 0deg)),
|
|
94
|
+
var(--mdc-gradient-border-stops));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.mdc-gradient-border-secondary::after {
|
|
98
|
+
background: conic-gradient(from calc(var(--mdc-gradient-border-start-angle) + var(--mds-gradient-border-angle, 0deg)),
|
|
99
|
+
var(--mdc-gradient-border-stops));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.mdc-gradient-border-animated::after {
|
|
103
|
+
animation: var(--mdc-gradient-border-duration) linear 0ms var(--mdc-gradient-border-iteration-count) mdc-gradient-border-rotate;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@media (prefers-reduced-motion: reduce) {
|
|
108
|
+
.mdc-gradient-border-animated::after {
|
|
109
|
+
animation: none;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* Gradients are not rendered in forced-colors mode. */
|
|
114
|
+
@media (forced-colors: active) {
|
|
115
|
+
|
|
116
|
+
.mdc-gradient-border-primary::after,
|
|
117
|
+
.mdc-gradient-border-secondary::after {
|
|
118
|
+
background: CanvasText;
|
|
119
|
+
animation: none;
|
|
120
|
+
}
|
|
121
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momentum-design/components",
|
|
3
3
|
"packageManager": "yarn@3.2.4",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.142.0",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=24.0.0",
|
|
7
7
|
"npm": ">=8.0.0"
|
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
"./components": "./dist/components/index.js",
|
|
23
23
|
"./components/*": "./dist/components/*",
|
|
24
24
|
"./dist/components": "./dist/components/index.js",
|
|
25
|
-
"./dist/components/*": "./dist/components/*"
|
|
25
|
+
"./dist/components/*": "./dist/components/*",
|
|
26
|
+
"./styles/*": "./dist/styles/*",
|
|
27
|
+
"./dist/styles/*": "./dist/styles/*"
|
|
26
28
|
},
|
|
27
29
|
"files": [
|
|
28
30
|
"/dist/",
|