Skip to content

Commit 2a11807

Browse files
committed
fixup! chore(checkbox): get rid of imported MDC's styles
1 parent 92d8fc8 commit 2a11807

File tree

2 files changed

+38
-5
lines changed

2 files changed

+38
-5
lines changed

src/components/checkbox/checkbox.scss

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
$box-size: 1.25rem;
77
$gap-size: 0.5rem;
88

9+
:host(limel-checkbox) {
10+
min-height: var(--limel-checkbox-min-height, 2.5rem); // prevents flickering
11+
// when switching between `readonly` and normal states in `limel-checkbox`,
12+
// but not where `CheckboxTemplate` is imported & used.
13+
}
14+
915
*,
1016
*:before,
1117
*:after {
@@ -64,7 +70,9 @@ label {
6470
}
6571

6672
.box {
67-
position: absolute;
73+
position: absolute; // since `label` is the clickable part,
74+
// and thus needs to
75+
// stretch below the checkbox
6876
pointer-events: none;
6977

7078
transition:
@@ -91,7 +99,8 @@ label {
9199
rgb(var(--contrast-300))
92100
);
93101

94-
.checked & {
102+
.checked &,
103+
.checkbox:has(input[type='checkbox']:checked) & {
95104
background-color: var(
96105
--lime-primary-color,
97106
var(--limel-theme-primary-color)
@@ -130,12 +139,35 @@ label {
130139
box-shadow: var(--shadow-depth-8-focused);
131140
}
132141
}
142+
143+
&:after {
144+
// For indicating the indeterminate state
145+
transition:
146+
opacity 0.2s ease,
147+
width 0.4s ease;
148+
content: '';
149+
position: absolute;
150+
inset: 0;
151+
margin: auto;
152+
153+
height: 0.125rem;
154+
width: 0.25rem;
155+
156+
border-radius: 1rem;
157+
opacity: 0;
158+
159+
background-color: rgb(var(--color-white));
160+
161+
.indeterminate & {
162+
opacity: 1;
163+
width: calc($box-size - 0.5rem);
164+
}
165+
}
133166
}
134167

135168
svg {
136169
position: absolute;
137170
z-index: 1;
138-
pointer-events: none;
139171
inset: 0;
140172

141173
transform: translate3d(-0.125rem, -0.125rem, 0);
@@ -159,7 +191,7 @@ svg {
159191
transition: stroke-dashoffset 180ms cubic-bezier(0.4, 0, 0.6, 1);
160192
}
161193

162-
.checked:not(.indeterminate) & {
194+
.checkbox:not(.indeterminate):has(input[type='checkbox']:checked) & {
163195
opacity: 1;
164196

165197
path {
@@ -170,6 +202,7 @@ svg {
170202

171203
limel-dynamic-label {
172204
margin-top: 0.375rem;
205+
margin-left: -0.25rem;
173206
}
174207

175208
@include mixins.hide-helper-line-when-not-needed(limel-checkbox);

src/components/dynamic-label/dynamic-label.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
:host(limel-dynamic-label) {
77
--limel-dynamic-label-min-height: 1.75rem;
88
display: flex;
9-
gap: 0.5rem;
9+
gap: 0.25rem;
1010
align-items: flex-start;
1111
border-radius: 0.5rem;
1212
min-width: 0;

0 commit comments

Comments
 (0)