-
Notifications
You must be signed in to change notification settings - Fork 75
/
includes.scss
141 lines (122 loc) · 3.06 KB
/
includes.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
@import "../../node_modules/@esri/calcite-colors/dist/colors";
@import "../../node_modules/@esri/calcite-base/dist/_index";
/* mixins & extensions */
@import "animation";
@import "focus";
@import "host";
@import "spacing";
@import "floating-ui";
@import "sortable";
@mixin slotted($selector, $tag, $scope: "") {
#{$scope} slot[name="#{$selector}"]::slotted(#{$tag}),
#{$scope} #{$tag}::slotted([slot="#{$selector}"]) {
@content;
}
}
@mixin word-break() {
word-wrap: break-word;
word-break: break-word;
}
// mixin to hide inputs from form-associated components
@mixin hidden-form-input() {
::slotted(input[slot="hidden-form-input"]) {
margin: 0 !important;
opacity: 0 !important;
outline: none !important;
padding: 0 !important;
position: absolute !important;
inset: 0 !important;
transform: none !important;
-webkit-appearance: none !important;
z-index: -1 !important;
}
}
// mixin to provide base disabled styles for interactive components
// additional styling can be passed via @content
@mixin disabled() {
:host([disabled]) {
@extend %disabled-host-only;
@content;
::slotted([calcite-hydrated][disabled]),
[calcite-hydrated][disabled] {
/* prevent opacity stacking */
@apply opacity-100;
}
}
}
// used for host-specific styling when the `disabled` mixin cannot be applied on the host (e.g., `display: contents`)
%disabled-host-only {
@apply opacity-disabled cursor-default select-none;
@extend %non-interactive-host-contents;
}
%non-interactive-host-contents {
*,
::slotted(*) {
@apply pointer-events-none;
}
}
// mixin to provide default invisibility and disabling of pointer events for components.
@mixin calciteHydratedHidden() {
:host([calcite-hydrated-hidden]) {
visibility: hidden !important; // 'important' is being used here to temporarily handle precendence of visibility set with calcite-hydrated. Do not follow this pattern. See #991.
pointer-events: none;
}
}
@mixin base-component() {
:host([hidden]) {
@apply hidden;
}
[hidden] {
@apply hidden;
}
}
@mixin xButton() {
:host([scale="s"]) {
.x-button {
inline-size: theme("spacing.4");
block-size: theme("spacing.4");
}
}
:host([scale="m"]) {
.x-button {
inline-size: theme("spacing.6");
block-size: theme("spacing.6");
}
}
:host([scale="l"]) {
.x-button {
inline-size: theme("spacing.8");
block-size: theme("spacing.8");
}
}
.x-button {
@apply appearance-none
bg-transparent
border-2
content-center
cursor-pointer
flex
focus-base
items-center
justify-center
m-0
self-center
text-color-3
transition-default;
border-radius: 50%;
border-color: transparent;
background-color: var(--calcite-ui-foreground-2);
&:active,
&:hover {
@apply text-color-1;
background-color: var(--calcite-ui-foreground-3);
}
&:active {
@apply border-solid;
border-color: theme("borderColor.color-brand");
}
& calcite-icon {
color: inherit;
}
}
}