File: cr_checkbox.css

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (196 lines) | stat: -rw-r--r-- 5,150 bytes parent folder | download | duplicates (9)
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/* Copyright 2024 The Chromium Authors
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file. */

/* #css_wrapper_metadata_start
 * #type=style-lit
 * #import=../cr_shared_vars.css.js
 * #scheme=relative
 * #css_wrapper_metadata_end */

:host {
  -webkit-tap-highlight-color: transparent;
  align-items: center;
  cursor: pointer;
  display: flex;
  outline: none;
  user-select: none;

  /* Sizes. */
  --cr-checkbox-border-size: 2px;
  --cr-checkbox-size: 16px;
  --cr-checkbox-ripple-size: 32px;

  /* Derived sizes (offsets). */
  --cr-checkbox-ripple-offset: 50%;

  /* --cr-checked-color automatically flips for light/dark mode. */
  --cr-checkbox-checked-box-color: var(--cr-checked-color);
  --cr-checkbox-ripple-checked-color: var(--cr-active-background-color);
  --cr-checkbox-ripple-opacity: 1;

  /* Colors. */
  --cr-checkbox-mark-color: var(
      --color-checkbox-check,
      var(--cr-fallback-color-on-primary));
  --cr-checkbox-ripple-unchecked-color: var(--cr-active-background-color);
  --cr-checkbox-unchecked-box-color: var(
      --color-checkbox-foreground-unchecked,
      var(--cr-fallback-color-outline));

  /* Light mode colors. */
  --cr-checkbox-checked-ripple-opacity: .2;
  --cr-checkbox-unchecked-ripple-opacity: .15;
}

@media (prefers-color-scheme: dark) {
  :host {
    /* Dark mode colors. */
    --cr-checkbox-checked-ripple-opacity: .4;
    --cr-checkbox-unchecked-ripple-opacity: .4;
  }
}

:host([disabled]) {
  cursor: initial;
  opacity: 1;
  pointer-events: none;
  --cr-checkbox-checked-box-color: var(
      --color-checkbox-container-disabled,
      var(--cr-fallback-color-disabled-background));
  --cr-checkbox-unchecked-box-color: var(
      --color-checkbox-outline-disabled,
      var(--cr-fallback-color-disabled-background));
  --cr-checkbox-mark-color: var(--color-checkbox-check-disabled,
      var(--cr-fallback-color-disabled-foreground));
}

#checkbox {
  background: none;
  border: var(--cr-checkbox-border-size) solid
      var(--cr-checkbox-unchecked-box-color);
  border-radius: 2px;
  box-sizing: border-box;
  cursor: pointer;
  display: block;
  flex-shrink: 0;
  height: var(--cr-checkbox-size);
  isolation: isolate;
  margin: 0;
  outline: none;
  padding: 0;
  position: relative;
  transform: none;  /* Checkboxes shouldn't flip even in RTL. */
  width: var(--cr-checkbox-size);
}

:host([disabled][checked]) #checkbox {
  border-color: transparent;
}

#hover-layer {
  display: none;
}

#checkbox:hover #hover-layer {
  background-color: var(--cr-hover-background-color);
  border-radius: 50%;
  display: block;
  height: 32px;
  left: 50%;
  overflow: hidden;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
}

@media (forced-colors: active) {
  /* paper-ripple is not showing in Windows HCM. Use outline instead. */
  :host(:focus) #checkbox {
    outline: var(--cr-focus-outline-hcm);
  }
}

#checkbox:focus-visible {
  outline: var(--cr-checkbox-focus-outline,
      2px solid var(--cr-focus-outline-color));
  outline-offset: 2px;
}

#checkmark {
  display: block;
  /* Automatically adjust color of the checkmark SVG in forced colors mode.
   * Otherwise, this property defaults to preserve-parent-color.
   * https://www.w3.org/TR/css-color-adjust-1/#forced-color-adjust-prop */
  forced-color-adjust: auto;
  position: relative;
  transform: scale(0);
  z-index: 1;
}

#checkmark path {
  fill: var(--cr-checkbox-mark-color);
}

:host([checked]) #checkmark {
  transform: scale(1);
  /* Only animate when showing checkmark. */
  transition: transform 140ms ease-out;
}

:host([checked]) #checkbox {
  background: var(--cr-checkbox-checked-box-background-color,
      var(--cr-checkbox-checked-box-color));
  border-color: var(--cr-checkbox-checked-box-color);
}

#ink {
  --paper-ripple-opacity: var(--cr-checkbox-ripple-opacity,
      var(--cr-checkbox-unchecked-ripple-opacity));
  color: var(--cr-checkbox-ripple-unchecked-color);
  height: var(--cr-checkbox-ripple-size);
  left: var(--cr-checkbox-ripple-offset);
  outline: var(--cr-checkbox-ripple-ring, none);
  pointer-events: none;
  top: var(--cr-checkbox-ripple-offset);
  transform: translate(-50%, -50%);
  transition: color linear 80ms;
  width: var(--cr-checkbox-ripple-size);
}

:host([checked]) #ink {
  --paper-ripple-opacity: var(--cr-checkbox-ripple-opacity,
      var(--cr-checkbox-checked-ripple-opacity));
  color: var(--cr-checkbox-ripple-checked-color);
}

:host-context([dir=rtl]) #ink {
  left: auto;
  right: var(--cr-checkbox-ripple-offset);
  transform: translate(50%, -50%);
}

#labelContainer {
  color: var(--cr-checkbox-label-color, var(--cr-primary-text-color));
  padding-inline-start: var(--cr-checkbox-label-padding-start, 20px);
  white-space: normal;
}

:host(.label-first) #labelContainer {
  order: -1;
  padding-inline-end: var(--cr-checkbox-label-padding-end, 20px);
  padding-inline-start: 0;
}

:host(.no-label) #labelContainer {
  display: none;
}

/* Hidden from UI, but not screen readers. */
#ariaDescription {
  height: 0;
  overflow: hidden;
  width: 0;
}