source: imaps-frontend/node_modules/bootstrap/scss/forms/_form-control.scss

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 6.4 KB
Line 
1//
2// General form controls (plus a few specific high-level interventions)
3//
4
5.form-control {
6 display: block;
7 width: 100%;
8 padding: $input-padding-y $input-padding-x;
9 font-family: $input-font-family;
10 @include font-size($input-font-size);
11 font-weight: $input-font-weight;
12 line-height: $input-line-height;
13 color: $input-color;
14 appearance: none; // Fix appearance for date inputs in Safari
15 background-color: $input-bg;
16 background-clip: padding-box;
17 border: $input-border-width solid $input-border-color;
18
19 // Note: This has no effect on <select>s in some browsers, due to the limited stylability of `<select>`s in CSS.
20 @include border-radius($input-border-radius, 0);
21
22 @include box-shadow($input-box-shadow);
23 @include transition($input-transition);
24
25 &[type="file"] {
26 overflow: hidden; // prevent pseudo element button overlap
27
28 &:not(:disabled):not([readonly]) {
29 cursor: pointer;
30 }
31 }
32
33 // Customize the `:focus` state to imitate native WebKit styles.
34 &:focus {
35 color: $input-focus-color;
36 background-color: $input-focus-bg;
37 border-color: $input-focus-border-color;
38 outline: 0;
39 @if $enable-shadows {
40 @include box-shadow($input-box-shadow, $input-focus-box-shadow);
41 } @else {
42 // Avoid using mixin so we can pass custom focus shadow properly
43 box-shadow: $input-focus-box-shadow;
44 }
45 }
46
47 &::-webkit-date-and-time-value {
48 // On Android Chrome, form-control's "width: 100%" makes the input width too small
49 // Tested under Android 11 / Chrome 89, Android 12 / Chrome 100, Android 13 / Chrome 109
50 //
51 // On iOS Safari, form-control's "appearance: none" + "width: 100%" makes the input width too small
52 // Tested under iOS 16.2 / Safari 16.2
53 min-width: 85px; // Seems to be a good minimum safe width
54
55 // Add some height to date inputs on iOS
56 // https://github.com/twbs/bootstrap/issues/23307
57 // TODO: we can remove this workaround once https://bugs.webkit.org/show_bug.cgi?id=198959 is resolved
58 // Multiply line-height by 1em if it has no unit
59 height: if(unit($input-line-height) == "", $input-line-height * 1em, $input-line-height);
60
61 // Android Chrome type="date" is taller than the other inputs
62 // because of "margin: 1px 24px 1px 4px" inside the shadow DOM
63 // Tested under Android 11 / Chrome 89, Android 12 / Chrome 100, Android 13 / Chrome 109
64 margin: 0;
65 }
66
67 // Prevent excessive date input height in Webkit
68 // https://github.com/twbs/bootstrap/issues/34433
69 &::-webkit-datetime-edit {
70 display: block;
71 padding: 0;
72 }
73
74 // Placeholder
75 &::placeholder {
76 color: $input-placeholder-color;
77 // Override Firefox's unusual default opacity; see https://github.com/twbs/bootstrap/pull/11526.
78 opacity: 1;
79 }
80
81 // Disabled inputs
82 //
83 // HTML5 says that controls under a fieldset > legend:first-child won't be
84 // disabled if the fieldset is disabled. Due to implementation difficulty, we
85 // don't honor that edge case; we style them as disabled anyway.
86 &:disabled {
87 color: $input-disabled-color;
88 background-color: $input-disabled-bg;
89 border-color: $input-disabled-border-color;
90 // iOS fix for unreadable disabled content; see https://github.com/twbs/bootstrap/issues/11655.
91 opacity: 1;
92 }
93
94 // File input buttons theming
95 &::file-selector-button {
96 padding: $input-padding-y $input-padding-x;
97 margin: (-$input-padding-y) (-$input-padding-x);
98 margin-inline-end: $input-padding-x;
99 color: $form-file-button-color;
100 @include gradient-bg($form-file-button-bg);
101 pointer-events: none;
102 border-color: inherit;
103 border-style: solid;
104 border-width: 0;
105 border-inline-end-width: $input-border-width;
106 border-radius: 0; // stylelint-disable-line property-disallowed-list
107 @include transition($btn-transition);
108 }
109
110 &:hover:not(:disabled):not([readonly])::file-selector-button {
111 background-color: $form-file-button-hover-bg;
112 }
113}
114
115// Readonly controls as plain text
116//
117// Apply class to a readonly input to make it appear like regular plain
118// text (without any border, background color, focus indicator)
119
120.form-control-plaintext {
121 display: block;
122 width: 100%;
123 padding: $input-padding-y 0;
124 margin-bottom: 0; // match inputs if this class comes on inputs with default margins
125 line-height: $input-line-height;
126 color: $input-plaintext-color;
127 background-color: transparent;
128 border: solid transparent;
129 border-width: $input-border-width 0;
130
131 &:focus {
132 outline: 0;
133 }
134
135 &.form-control-sm,
136 &.form-control-lg {
137 padding-right: 0;
138 padding-left: 0;
139 }
140}
141
142// Form control sizing
143//
144// Build on `.form-control` with modifier classes to decrease or increase the
145// height and font-size of form controls.
146//
147// Repeated in `_input_group.scss` to avoid Sass extend issues.
148
149.form-control-sm {
150 min-height: $input-height-sm;
151 padding: $input-padding-y-sm $input-padding-x-sm;
152 @include font-size($input-font-size-sm);
153 @include border-radius($input-border-radius-sm);
154
155 &::file-selector-button {
156 padding: $input-padding-y-sm $input-padding-x-sm;
157 margin: (-$input-padding-y-sm) (-$input-padding-x-sm);
158 margin-inline-end: $input-padding-x-sm;
159 }
160}
161
162.form-control-lg {
163 min-height: $input-height-lg;
164 padding: $input-padding-y-lg $input-padding-x-lg;
165 @include font-size($input-font-size-lg);
166 @include border-radius($input-border-radius-lg);
167
168 &::file-selector-button {
169 padding: $input-padding-y-lg $input-padding-x-lg;
170 margin: (-$input-padding-y-lg) (-$input-padding-x-lg);
171 margin-inline-end: $input-padding-x-lg;
172 }
173}
174
175// Make sure textareas don't shrink too much when resized
176// https://github.com/twbs/bootstrap/pull/29124
177// stylelint-disable selector-no-qualifying-type
178textarea {
179 &.form-control {
180 min-height: $input-height;
181 }
182
183 &.form-control-sm {
184 min-height: $input-height-sm;
185 }
186
187 &.form-control-lg {
188 min-height: $input-height-lg;
189 }
190}
191// stylelint-enable selector-no-qualifying-type
192
193.form-control-color {
194 width: $form-color-width;
195 height: $input-height;
196 padding: $input-padding-y;
197
198 &:not(:disabled):not([readonly]) {
199 cursor: pointer;
200 }
201
202 &::-moz-color-swatch {
203 border: 0 !important; // stylelint-disable-line declaration-no-important
204 @include border-radius($input-border-radius);
205 }
206
207 &::-webkit-color-swatch {
208 border: 0 !important; // stylelint-disable-line declaration-no-important
209 @include border-radius($input-border-radius);
210 }
211
212 &.form-control-sm { height: $input-height-sm; }
213 &.form-control-lg { height: $input-height-lg; }
214}
Note: See TracBrowser for help on using the repository browser.