/
calcite-notice.scss
178 lines (154 loc) · 3.94 KB
/
calcite-notice.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/**
* CSS Custom Properties
*
* These properties can be overridden using the component's tag as selector.
*
* @prop --calcite-notice-width: the width of the notice
*/
// scale variables
:host([scale="s"]) {
--calcite-notice-spacing-token-small: theme("spacing.2");
--calcite-notice-spacing-token-large: theme("spacing.3");
@include slotted("title", "*", ".container") {
@apply text--1-wrap my-0.5;
}
@include slotted("message", "*", ".container") {
@apply text--2-wrap my-0.5;
}
::slotted(calcite-link) {
@apply text--2-wrap my-0.5;
}
.notice-close {
// specific padding for close button to align with calcite-action small-scale spacing
@apply p-2;
}
}
:host([scale="m"]) {
--calcite-notice-spacing-token-small: theme("spacing.3");
--calcite-notice-spacing-token-large: theme("spacing.4");
@include slotted("title", "*", ".container") {
@apply text-0-wrap my-0.5;
}
@include slotted("message", "*", ".container") {
@apply text--1-wrap my-0.5;
}
::slotted(calcite-link) {
@apply text--1-wrap my-0.5;
}
}
:host([scale="l"]) {
--calcite-notice-spacing-token-small: theme("spacing.4");
--calcite-notice-spacing-token-large: theme("spacing.5");
@include slotted("title", "*", ".container") {
@apply text-1-wrap my-0.5;
}
@include slotted("message", "*", ".container") {
@apply text-0-wrap my-0.5;
}
::slotted(calcite-link) {
@apply text-0-wrap my-0.5;
}
}
:host([width="auto"]) {
--calcite-notice-width: theme("width.auto");
}
:host([width="half"]) {
--calcite-notice-width: theme("width.1/2");
}
:host([width="full"]) {
--calcite-notice-width: theme("width.full");
}
:host {
@apply hidden mx-auto max-w-full items-center;
width: var(--calcite-notice-width);
}
.container {
@apply hidden
my-0
box-border
w-full
opacity-0
pointer-events-none
bg-foreground-1;
max-height: 0;
text-align: start;
transition: $transition;
border-inline-start: 0px solid;
box-shadow: 0 0 0 0 transparent;
}
// focus styles
.notice-close {
@apply focus-base;
&:focus {
@apply focus-inset;
}
}
:host {
@apply flex;
}
:host([active]) .container {
@apply flex
shadow-1
items-center
opacity-100
max-h-full
border-2
pointer-events-auto;
}
@include slotted("title", "*", ".container") {
@apply m-0 font-medium text-color-1;
}
@include slotted("message", "*", ".container") {
@apply inline m-0 font-normal text-color-2;
margin-inline-end: var(--calcite-notice-spacing-token-small);
}
@mixin notice-element-base() {
@apply box-border;
padding: var(--calcite-notice-spacing-token-small) var(--calcite-notice-spacing-token-large);
flex: 0 0 auto;
transition: all 0.15s ease-in-out;
}
.notice-content {
@include notice-element-base;
@apply flex flex-col min-w-0 break-words;
flex: 1 1 0;
padding-block: var(--calcite-notice-spacing-token-small);
padding-inline: 0 var(--calcite-notice-spacing-token-small);
&:first-of-type:not(:only-child) {
padding-inline-start: var(--calcite-notice-spacing-token-large);
}
&:only-of-type {
padding: var(--calcite-notice-spacing-token-small) var(--calcite-notice-spacing-token-large);
}
}
.notice-icon {
@apply flex items-center;
@include notice-element-base;
}
.notice-close {
@apply flex items-center self-stretch bg-transparent border-none outline-none cursor-pointer text-color-3;
@include notice-element-base;
-webkit-appearance: none;
&:hover,
&:focus {
@apply bg-foreground-2 text-color-1;
}
&:active {
@apply bg-foreground-3;
}
}
.actions-end {
@apply flex self-stretch;
}
$noticeColors: "blue" var(--calcite-ui-brand), "red" var(--calcite-ui-danger), "yellow" var(--calcite-ui-warning),
"green" var(--calcite-ui-success);
@each $noticeColor in $noticeColors {
$name: nth($noticeColor, 1);
$color: nth($noticeColor, 2);
:host([color="#{$name}"]) .container {
border-color: $color;
& .notice-icon {
color: $color;
}
}
}