@stoplight/ui-kit 3.0.0-beta.37 → 3.0.0-beta.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/TableOfContents/index.d.ts +3 -0
- package/TableOfContents/index.js +45 -6
- package/TableOfContents/index.js.map +1 -1
- package/package.json +1 -1
- package/styles/_blueprint.scss +4 -4
- package/styles/blueprint/_variables.scss +3 -1
- package/styles/blueprint/select/blueprint-select.scss +8 -0
- package/styles/blueprint/select/components/_index.scss +6 -0
- package/styles/blueprint/select/components/omnibar/_omnibar.scss +63 -0
- package/styles/blueprint/select/components/select/_multi-select.scss +17 -0
- package/styles/blueprint/select/components/select/_select.scss +31 -0
- package/styles/blueprint/src/_reset.scss +43 -0
- package/styles/blueprint/src/_typography.scss +459 -0
- package/styles/blueprint/src/accessibility/_focus-states.scss +17 -0
- package/styles/blueprint/src/blueprint-hi-contrast.scss +22 -0
- package/styles/blueprint/src/blueprint.scss +16 -0
- package/styles/blueprint/src/common/_color-aliases.scss +43 -0
- package/styles/blueprint/src/common/_colors.scss +116 -0
- package/styles/blueprint/src/common/_flex.scss +49 -0
- package/styles/blueprint/src/common/_mixins.scss +128 -0
- package/styles/blueprint/src/common/_react-transition.scss +117 -0
- package/styles/blueprint/src/common/_variables.scss +131 -0
- package/styles/blueprint/src/components/_index.scss +38 -0
- package/styles/blueprint/src/components/alert/_alert.scss +33 -0
- package/styles/blueprint/src/components/breadcrumbs/_breadcrumbs.scss +142 -0
- package/styles/blueprint/src/components/button/_button-group.scss +240 -0
- package/styles/blueprint/src/components/button/_button.scss +206 -0
- package/styles/blueprint/src/components/button/_common.scss +507 -0
- package/styles/blueprint/src/components/callout/_callout.scss +99 -0
- package/styles/blueprint/src/components/card/_card.scss +91 -0
- package/styles/blueprint/src/components/collapse/_collapse.scss +20 -0
- package/styles/blueprint/src/components/context-menu/_context-menu.scss +10 -0
- package/styles/blueprint/src/components/dialog/_dialog.scss +146 -0
- package/styles/blueprint/src/components/divider/_divider.scss +19 -0
- package/styles/blueprint/src/components/drawer/_drawer.scss +232 -0
- package/styles/blueprint/src/components/editable-text/_editable-text.scss +156 -0
- package/styles/blueprint/src/components/forms/_common.scss +239 -0
- package/styles/blueprint/src/components/forms/_control-group.scss +276 -0
- package/styles/blueprint/src/components/forms/_controls.scss +526 -0
- package/styles/blueprint/src/components/forms/_file-input.scss +155 -0
- package/styles/blueprint/src/components/forms/_form-group.scss +111 -0
- package/styles/blueprint/src/components/forms/_index.scss +20 -0
- package/styles/blueprint/src/components/forms/_input-group.scss +247 -0
- package/styles/blueprint/src/components/forms/_input.scss +115 -0
- package/styles/blueprint/src/components/forms/_label.scss +114 -0
- package/styles/blueprint/src/components/forms/_numeric-input.scss +40 -0
- package/styles/blueprint/src/components/hotkeys/_hotkeys.scss +50 -0
- package/styles/blueprint/src/components/html-select/_common.scss +52 -0
- package/styles/blueprint/src/components/html-select/_html-select.scss +104 -0
- package/styles/blueprint/src/components/html-table/_html-table.scss +208 -0
- package/styles/blueprint/src/components/icon/_icon.scss +79 -0
- package/styles/blueprint/src/components/menu/_common.scss +172 -0
- package/styles/blueprint/src/components/menu/_menu.scss +197 -0
- package/styles/blueprint/src/components/menu/_submenu.scss +41 -0
- package/styles/blueprint/src/components/navbar/_navbar.scss +117 -0
- package/styles/blueprint/src/components/non-ideal-state/_non-ideal-state.scss +43 -0
- package/styles/blueprint/src/components/overflow-list/_overflow-list.scss +13 -0
- package/styles/blueprint/src/components/overlay/_overlay.scss +94 -0
- package/styles/blueprint/src/components/panel-stack/_panel-stack.scss +103 -0
- package/styles/blueprint/src/components/popover/_common.scss +171 -0
- package/styles/blueprint/src/components/popover/_popover.scss +127 -0
- package/styles/blueprint/src/components/portal/_portal.scss +15 -0
- package/styles/blueprint/src/components/progress-bar/_common.scss +9 -0
- package/styles/blueprint/src/components/progress-bar/_progress-bar.scss +98 -0
- package/styles/blueprint/src/components/skeleton/_common.scss +8 -0
- package/styles/blueprint/src/components/skeleton/_skeleton.scss +64 -0
- package/styles/blueprint/src/components/slider/_common.scss +48 -0
- package/styles/blueprint/src/components/slider/_slider.scss +216 -0
- package/styles/blueprint/src/components/spinner/_spinner.scss +65 -0
- package/styles/blueprint/src/components/tabs/_tabs.scss +199 -0
- package/styles/blueprint/src/components/tag/_common.scss +202 -0
- package/styles/blueprint/src/components/tag/_tag.scss +75 -0
- package/styles/blueprint/src/components/tag-input/_tag-input.scss +165 -0
- package/styles/blueprint/src/components/toast/_toast.scss +203 -0
- package/styles/blueprint/src/components/tooltip/_common.scss +11 -0
- package/styles/blueprint/src/components/tooltip/_tooltip.scss +61 -0
- package/styles/blueprint/src/components/tree/_tree.scss +194 -0
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
// Copyright 2015 Palantir Technologies, Inc. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License, Version 2.0.
|
|
3
|
+
|
|
4
|
+
@use "sass:math";
|
|
5
|
+
|
|
6
|
+
@import "../../common/mixins";
|
|
7
|
+
@import "../../common/variables";
|
|
8
|
+
@import "../button/common";
|
|
9
|
+
|
|
10
|
+
$control-background-color: $button-background-color !default;
|
|
11
|
+
$control-background-color-hover: $button-background-color-hover !default;
|
|
12
|
+
$control-background-color-active: $button-background-color-active !default;
|
|
13
|
+
$dark-control-background-color: $dark-button-background-color !default;
|
|
14
|
+
$dark-control-background-color-hover: $dark-button-background-color-hover !default;
|
|
15
|
+
$dark-control-background-color-active: $dark-button-background-color-active !default;
|
|
16
|
+
|
|
17
|
+
$control-checked-background-color: nth(map-get($button-intents, "primary"), 1) !default;
|
|
18
|
+
$control-checked-background-color-hover: nth(map-get($button-intents, "primary"), 2) !default;
|
|
19
|
+
$control-checked-background-color-active: nth(map-get($button-intents, "primary"), 3) !default;
|
|
20
|
+
|
|
21
|
+
$control-indicator-size: $pt-icon-size-standard !default;
|
|
22
|
+
$control-indicator-size-large: $pt-icon-size-large !default;
|
|
23
|
+
$control-indicator-spacing: $pt-grid-size !default;
|
|
24
|
+
|
|
25
|
+
@mixin control-checked-colors($selector: ":checked") {
|
|
26
|
+
input#{$selector} ~ .#{$ns}-control-indicator {
|
|
27
|
+
background-color: $control-checked-background-color;
|
|
28
|
+
background-image: $button-intent-gradient;
|
|
29
|
+
box-shadow: $button-intent-box-shadow;
|
|
30
|
+
color: $white;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&:hover input#{$selector} ~ .#{$ns}-control-indicator {
|
|
34
|
+
background-color: $control-checked-background-color-hover;
|
|
35
|
+
box-shadow: $button-intent-box-shadow;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
input:not(:disabled):active#{$selector} ~ .#{$ns}-control-indicator {
|
|
39
|
+
background: $control-checked-background-color-active;
|
|
40
|
+
box-shadow: $button-intent-box-shadow-active;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
input:disabled#{$selector} ~ .#{$ns}-control-indicator {
|
|
44
|
+
background: rgba($control-checked-background-color, 0.5);
|
|
45
|
+
box-shadow: none;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.#{$ns}-dark & {
|
|
49
|
+
input#{$selector} ~ .#{$ns}-control-indicator {
|
|
50
|
+
box-shadow: $dark-button-intent-box-shadow;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&:hover input#{$selector} ~ .#{$ns}-control-indicator {
|
|
54
|
+
background-color: $control-checked-background-color-hover;
|
|
55
|
+
box-shadow: $dark-button-intent-box-shadow;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
input:not(:disabled):active#{$selector} ~ .#{$ns}-control-indicator {
|
|
59
|
+
background-color: $control-checked-background-color-active;
|
|
60
|
+
box-shadow: $dark-button-intent-box-shadow-active;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
input:disabled#{$selector} ~ .#{$ns}-control-indicator {
|
|
64
|
+
background: rgba($control-checked-background-color-active, 0.5);
|
|
65
|
+
box-shadow: none;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@mixin indicator-position($size) {
|
|
71
|
+
$padding: $size + $control-indicator-spacing;
|
|
72
|
+
|
|
73
|
+
&:not(.#{$ns}-align-right) {
|
|
74
|
+
padding-left: $padding;
|
|
75
|
+
|
|
76
|
+
.#{$ns}-control-indicator {
|
|
77
|
+
margin-left: -$padding;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&.#{$ns}-align-right {
|
|
82
|
+
padding-right: $padding;
|
|
83
|
+
|
|
84
|
+
.#{$ns}-control-indicator {
|
|
85
|
+
margin-right: -$padding;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.#{$ns}-control {
|
|
91
|
+
@include control-checked-colors();
|
|
92
|
+
@include indicator-position($control-indicator-size);
|
|
93
|
+
cursor: pointer;
|
|
94
|
+
|
|
95
|
+
display: block;
|
|
96
|
+
margin-bottom: $pt-grid-size;
|
|
97
|
+
position: relative;
|
|
98
|
+
text-transform: none;
|
|
99
|
+
|
|
100
|
+
&.#{$ns}-disabled {
|
|
101
|
+
color: $pt-text-color-disabled;
|
|
102
|
+
cursor: not-allowed;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&.#{$ns}-inline {
|
|
106
|
+
display: inline-block;
|
|
107
|
+
margin-right: $pt-grid-size * 2;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
input {
|
|
111
|
+
left: 0;
|
|
112
|
+
opacity: 0;
|
|
113
|
+
position: absolute;
|
|
114
|
+
top: 0;
|
|
115
|
+
z-index: -1; // don't let it intercept clicks
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.#{$ns}-control-indicator {
|
|
119
|
+
background-clip: padding-box;
|
|
120
|
+
background-color: $control-background-color;
|
|
121
|
+
background-image: $button-gradient;
|
|
122
|
+
border: none;
|
|
123
|
+
box-shadow: $button-box-shadow;
|
|
124
|
+
cursor: pointer;
|
|
125
|
+
display: inline-block;
|
|
126
|
+
// font-size is used to size indicator for all control types,
|
|
127
|
+
// to reduce property changes needed across types and sizes (large).
|
|
128
|
+
font-size: $control-indicator-size;
|
|
129
|
+
height: 1em;
|
|
130
|
+
margin-right: $control-indicator-spacing;
|
|
131
|
+
margin-top: -3px;
|
|
132
|
+
position: relative;
|
|
133
|
+
user-select: none;
|
|
134
|
+
vertical-align: middle;
|
|
135
|
+
width: 1em;
|
|
136
|
+
|
|
137
|
+
&::before {
|
|
138
|
+
content: "";
|
|
139
|
+
display: block;
|
|
140
|
+
height: 1em;
|
|
141
|
+
width: 1em;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
&:hover .#{$ns}-control-indicator {
|
|
146
|
+
background-color: $control-background-color-hover;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
input:not(:disabled):active ~ .#{$ns}-control-indicator {
|
|
150
|
+
background: $control-background-color-active;
|
|
151
|
+
box-shadow: $button-box-shadow-active;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
input:disabled ~ .#{$ns}-control-indicator {
|
|
155
|
+
background: $button-background-color-disabled;
|
|
156
|
+
box-shadow: none;
|
|
157
|
+
cursor: not-allowed;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
input:focus ~ .#{$ns}-control-indicator {
|
|
161
|
+
@include focus-outline();
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// right-aligned indicator is glued to the right side of the container
|
|
165
|
+
&.#{$ns}-align-right .#{$ns}-control-indicator {
|
|
166
|
+
float: right;
|
|
167
|
+
margin-left: $control-indicator-spacing;
|
|
168
|
+
margin-top: 1px;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
&.#{$ns}-large {
|
|
172
|
+
@include indicator-position($control-indicator-size-large);
|
|
173
|
+
// larger text
|
|
174
|
+
font-size: $pt-font-size-large;
|
|
175
|
+
|
|
176
|
+
.#{$ns}-control-indicator {
|
|
177
|
+
// em-based sizing
|
|
178
|
+
font-size: $control-indicator-size-large;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
&.#{$ns}-align-right .#{$ns}-control-indicator {
|
|
182
|
+
margin-top: 0;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/*
|
|
187
|
+
Checkbox
|
|
188
|
+
|
|
189
|
+
Markup:
|
|
190
|
+
<label class="#{$ns}-control #{$ns}-checkbox {{.modifier}}">
|
|
191
|
+
<input type="checkbox" {{:modifier}} />
|
|
192
|
+
<span class="#{$ns}-control-indicator"></span>
|
|
193
|
+
Checkbox
|
|
194
|
+
</label>
|
|
195
|
+
|
|
196
|
+
:checked - Checked
|
|
197
|
+
:disabled - Disabled. Also add <code>.#{$ns}-disabled</code> to <code>.#{$ns}-control</code> to change text color (not shown below).
|
|
198
|
+
:indeterminate - Indeterminate. Note that this style can only be achieved via JavaScript
|
|
199
|
+
<code>input.indeterminate = true</code>.
|
|
200
|
+
.#{$ns}-align-right - Right-aligned indicator
|
|
201
|
+
.#{$ns}-large - Large
|
|
202
|
+
|
|
203
|
+
Styleguide checkbox
|
|
204
|
+
*/
|
|
205
|
+
|
|
206
|
+
&.#{$ns}-checkbox {
|
|
207
|
+
@mixin indicator-inline-icon($icon) {
|
|
208
|
+
&::before {
|
|
209
|
+
// embed SVG icon image as backgroud-image above gradient.
|
|
210
|
+
// the SVG image content is inlined into the CSS, so use this sparingly.
|
|
211
|
+
background-image: svg-icon("16px/#{$icon}.svg", (path: (fill: $white)));
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// make :indeterminate look like :checked _for Checkbox only_
|
|
216
|
+
@include control-checked-colors(":indeterminate");
|
|
217
|
+
|
|
218
|
+
.#{$ns}-control-indicator {
|
|
219
|
+
border-radius: $pt-border-radius;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
input:checked ~ .#{$ns}-control-indicator {
|
|
223
|
+
@include indicator-inline-icon("small-tick");
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
input:indeterminate ~ .#{$ns}-control-indicator {
|
|
227
|
+
@include indicator-inline-icon("small-minus");
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/*
|
|
232
|
+
Radio
|
|
233
|
+
|
|
234
|
+
Markup:
|
|
235
|
+
<label class="#{$ns}-control #{$ns}-radio {{.modifier}}">
|
|
236
|
+
<input type="radio" name="docs-radio-regular" {{:modifier}} />
|
|
237
|
+
<span class="#{$ns}-control-indicator"></span>
|
|
238
|
+
Radio
|
|
239
|
+
</label>
|
|
240
|
+
|
|
241
|
+
:checked - Selected
|
|
242
|
+
:disabled - Disabled. Also add <code>.#{$ns}-disabled</code> to <code>.#{$ns}-control</code> to change text color (not shown below).
|
|
243
|
+
.#{$ns}-align-right - Right-aligned indicator
|
|
244
|
+
.#{$ns}-large - Large
|
|
245
|
+
|
|
246
|
+
Styleguide radio
|
|
247
|
+
*/
|
|
248
|
+
|
|
249
|
+
&.#{$ns}-radio {
|
|
250
|
+
.#{$ns}-control-indicator {
|
|
251
|
+
border-radius: 50%;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
input:checked ~ .#{$ns}-control-indicator::before {
|
|
255
|
+
background-image: radial-gradient($white, $white 28%, transparent 32%);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
input:checked:disabled ~ .#{$ns}-control-indicator::before {
|
|
259
|
+
opacity: 0.5;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
input:focus ~ .#{$ns}-control-indicator {
|
|
263
|
+
-moz-outline-radius: $control-indicator-size;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/*
|
|
268
|
+
Switch
|
|
269
|
+
|
|
270
|
+
Markup:
|
|
271
|
+
<label class="#{$ns}-control #{$ns}-switch {{.modifier}}">
|
|
272
|
+
<input type="checkbox" {{:modifier}} />
|
|
273
|
+
<span class="#{$ns}-control-indicator"></span>
|
|
274
|
+
Switch
|
|
275
|
+
</label>
|
|
276
|
+
|
|
277
|
+
:checked - Selected
|
|
278
|
+
:disabled - Disabled. Also add <code>.#{$ns}-disabled</code> to <code>.#{$ns}-control</code> to change text color (not shown below).
|
|
279
|
+
.#{$ns}-align-right - Right-aligned indicator
|
|
280
|
+
.#{$ns}-large - Large
|
|
281
|
+
|
|
282
|
+
Styleguide switch
|
|
283
|
+
*/
|
|
284
|
+
|
|
285
|
+
// stylelint-disable-next-line order/order
|
|
286
|
+
$switch-width: 1.75em !default;
|
|
287
|
+
$switch-indicator-margin: 2px !default;
|
|
288
|
+
$switch-indicator-size: calc(1em - #{$switch-indicator-margin * 2});
|
|
289
|
+
|
|
290
|
+
$switch-indicator-child-height: 1em;
|
|
291
|
+
$switch-indicator-child-outside-margin: 0.5em;
|
|
292
|
+
$switch-indicator-child-inside-margin: 1.2em;
|
|
293
|
+
|
|
294
|
+
$switch-indicator-text-font-size: 0.7em;
|
|
295
|
+
|
|
296
|
+
$switch-background-color: rgba($gray4, 0.5) !default;
|
|
297
|
+
$switch-background-color-hover: rgba($gray2, 0.5) !default;
|
|
298
|
+
$switch-background-color-active: rgba($gray1, 0.5) !default;
|
|
299
|
+
$switch-background-color-disabled: $button-background-color-disabled !default;
|
|
300
|
+
$switch-checked-background-color: $control-checked-background-color !default;
|
|
301
|
+
$switch-checked-background-color-hover: $control-checked-background-color-hover !default;
|
|
302
|
+
$switch-checked-background-color-active: $control-checked-background-color-active !default;
|
|
303
|
+
$switch-checked-background-color-disabled: rgba($blue3, 0.5) !default;
|
|
304
|
+
|
|
305
|
+
$dark-switch-background-color: rgba($black, 0.5) !default;
|
|
306
|
+
$dark-switch-background-color-hover: rgba($black, 0.7) !default;
|
|
307
|
+
$dark-switch-background-color-active: rgba($black, 0.9) !default;
|
|
308
|
+
$dark-switch-background-color-disabled: $dark-button-background-color-disabled !default;
|
|
309
|
+
$dark-switch-checked-background-color: $control-checked-background-color !default;
|
|
310
|
+
$dark-switch-checked-background-color-hover: $control-checked-background-color-hover !default;
|
|
311
|
+
$dark-switch-checked-background-color-active: $control-checked-background-color-active !default;
|
|
312
|
+
$dark-switch-checked-background-color-disabled: rgba($blue1, 0.5) !default;
|
|
313
|
+
|
|
314
|
+
$switch-indicator-background-color: $white !default;
|
|
315
|
+
$switch-indicator-background-color-disabled: rgba($white, 0.8) !default;
|
|
316
|
+
$dark-switch-indicator-background-color: $dark-gray5 !default;
|
|
317
|
+
$dark-switch-indicator-background-color-disabled: rgba($black, 0.4) !default;
|
|
318
|
+
|
|
319
|
+
&.#{$ns}-switch {
|
|
320
|
+
@mixin indicator-colors(
|
|
321
|
+
$selector,
|
|
322
|
+
$color,
|
|
323
|
+
$hover-color,
|
|
324
|
+
$active-color,
|
|
325
|
+
$disabled-color,
|
|
326
|
+
$disabled-indicator-color
|
|
327
|
+
) {
|
|
328
|
+
input#{$selector} ~ .#{$ns}-control-indicator {
|
|
329
|
+
background: $color;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
&:hover input#{$selector} ~ .#{$ns}-control-indicator {
|
|
333
|
+
background: $hover-color;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
input#{$selector}:not(:disabled):active ~ .#{$ns}-control-indicator {
|
|
337
|
+
background: $active-color;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
input#{$selector}:disabled ~ .#{$ns}-control-indicator {
|
|
341
|
+
background: $disabled-color;
|
|
342
|
+
|
|
343
|
+
&::before {
|
|
344
|
+
background: $disabled-indicator-color;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
@include indicator-colors(
|
|
350
|
+
"",
|
|
351
|
+
$switch-background-color,
|
|
352
|
+
$switch-background-color-hover,
|
|
353
|
+
$switch-background-color-active,
|
|
354
|
+
$switch-background-color-disabled,
|
|
355
|
+
$switch-indicator-background-color-disabled
|
|
356
|
+
);
|
|
357
|
+
@include indicator-colors(
|
|
358
|
+
":checked",
|
|
359
|
+
$switch-checked-background-color,
|
|
360
|
+
$switch-checked-background-color-hover,
|
|
361
|
+
$switch-checked-background-color-active,
|
|
362
|
+
$switch-checked-background-color-disabled,
|
|
363
|
+
$switch-indicator-background-color-disabled
|
|
364
|
+
);
|
|
365
|
+
// convert em variable to px value
|
|
366
|
+
@include indicator-position(math.div($switch-width, 1em) * $control-indicator-size);
|
|
367
|
+
|
|
368
|
+
.#{$ns}-control-indicator {
|
|
369
|
+
border: none;
|
|
370
|
+
border-radius: $switch-width;
|
|
371
|
+
// override default button styles, never have a box-shadow here.
|
|
372
|
+
// stylelint-disable-next-line declaration-no-important
|
|
373
|
+
box-shadow: none !important;
|
|
374
|
+
min-width: $switch-width;
|
|
375
|
+
transition: background-color $pt-transition-duration $pt-transition-ease;
|
|
376
|
+
width: auto;
|
|
377
|
+
|
|
378
|
+
&::before {
|
|
379
|
+
background: $switch-indicator-background-color;
|
|
380
|
+
border-radius: 50%;
|
|
381
|
+
box-shadow: $button-box-shadow-overlay;
|
|
382
|
+
height: $switch-indicator-size;
|
|
383
|
+
left: 0;
|
|
384
|
+
margin: $switch-indicator-margin;
|
|
385
|
+
position: absolute;
|
|
386
|
+
transition: left $pt-transition-duration $pt-transition-ease;
|
|
387
|
+
width: $switch-indicator-size;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
input:checked ~ .#{$ns}-control-indicator::before {
|
|
392
|
+
// 1em is size of indicator
|
|
393
|
+
left: calc(100% - 1em);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
&.#{$ns}-large {
|
|
397
|
+
@include indicator-position(math.div($switch-width, 1em) * $control-indicator-size-large);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
.#{$ns}-dark & {
|
|
401
|
+
@include indicator-colors(
|
|
402
|
+
"",
|
|
403
|
+
$dark-switch-background-color,
|
|
404
|
+
$dark-switch-background-color-hover,
|
|
405
|
+
$dark-switch-background-color-active,
|
|
406
|
+
$dark-switch-background-color-disabled,
|
|
407
|
+
$dark-switch-indicator-background-color-disabled
|
|
408
|
+
);
|
|
409
|
+
@include indicator-colors(
|
|
410
|
+
":checked",
|
|
411
|
+
$dark-switch-checked-background-color,
|
|
412
|
+
$dark-switch-checked-background-color-hover,
|
|
413
|
+
$dark-switch-checked-background-color-active,
|
|
414
|
+
$dark-switch-checked-background-color-disabled,
|
|
415
|
+
$dark-switch-indicator-background-color-disabled
|
|
416
|
+
);
|
|
417
|
+
|
|
418
|
+
.#{$ns}-control-indicator::before {
|
|
419
|
+
background: $dark-switch-indicator-background-color;
|
|
420
|
+
box-shadow: $dark-button-box-shadow;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
input:checked ~ .#{$ns}-control-indicator::before {
|
|
424
|
+
// inset shadow so it forms a dark line instead of blurring into the blue
|
|
425
|
+
box-shadow: inset $dark-button-box-shadow;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
.#{$ns}-switch-inner-text {
|
|
430
|
+
font-size: $switch-indicator-text-font-size;
|
|
431
|
+
text-align: center;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
.#{$ns}-control-indicator-child {
|
|
435
|
+
&:first-child {
|
|
436
|
+
line-height: 0;
|
|
437
|
+
margin-left: $switch-indicator-child-outside-margin;
|
|
438
|
+
margin-right: $switch-indicator-child-inside-margin;
|
|
439
|
+
visibility: hidden;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
&:last-child {
|
|
443
|
+
line-height: $switch-indicator-child-height;
|
|
444
|
+
margin-left: $switch-indicator-child-inside-margin;
|
|
445
|
+
margin-right: $switch-indicator-child-outside-margin;
|
|
446
|
+
visibility: visible;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
input:checked ~ .#{$ns}-control-indicator .#{$ns}-control-indicator-child {
|
|
451
|
+
&:first-child {
|
|
452
|
+
line-height: $switch-indicator-child-height;
|
|
453
|
+
visibility: visible;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
&:last-child {
|
|
457
|
+
line-height: 0;
|
|
458
|
+
visibility: hidden;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
.#{$ns}-dark & {
|
|
464
|
+
color: $pt-dark-text-color;
|
|
465
|
+
|
|
466
|
+
&.#{$ns}-disabled {
|
|
467
|
+
color: $pt-dark-text-color-disabled;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
.#{$ns}-control-indicator {
|
|
471
|
+
background-color: $dark-control-background-color;
|
|
472
|
+
background-image: $dark-button-gradient;
|
|
473
|
+
box-shadow: $dark-button-box-shadow;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
&:hover .#{$ns}-control-indicator {
|
|
477
|
+
background-color: $dark-control-background-color-hover;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
input:not(:disabled):active ~ .#{$ns}-control-indicator {
|
|
481
|
+
background: $dark-control-background-color-active;
|
|
482
|
+
box-shadow: $dark-button-box-shadow-active;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
input:disabled ~ .#{$ns}-control-indicator {
|
|
486
|
+
background: $dark-button-background-color-disabled;
|
|
487
|
+
box-shadow: none;
|
|
488
|
+
cursor: not-allowed;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
&.#{$ns}-checkbox input:disabled {
|
|
492
|
+
&:checked,
|
|
493
|
+
&:indeterminate {
|
|
494
|
+
~ .#{$ns}-control-indicator {
|
|
495
|
+
color: $dark-button-color-disabled;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
/*
|
|
502
|
+
Inline labels
|
|
503
|
+
|
|
504
|
+
Markup:
|
|
505
|
+
<div>
|
|
506
|
+
<label class="#{$ns}-label">A group of related options</label>
|
|
507
|
+
<label class="#{$ns}-control #{$ns}-checkbox #{$ns}-inline">
|
|
508
|
+
<input type="checkbox" />
|
|
509
|
+
<span class="#{$ns}-control-indicator"></span>
|
|
510
|
+
First
|
|
511
|
+
</label>
|
|
512
|
+
<label class="#{$ns}-control #{$ns}-checkbox #{$ns}-inline">
|
|
513
|
+
<input type="checkbox" />
|
|
514
|
+
<span class="#{$ns}-control-indicator"></span>
|
|
515
|
+
Second
|
|
516
|
+
</label>
|
|
517
|
+
<label class="#{$ns}-control #{$ns}-checkbox #{$ns}-inline">
|
|
518
|
+
<input type="checkbox" />
|
|
519
|
+
<span class="#{$ns}-control-indicator"></span>
|
|
520
|
+
Third
|
|
521
|
+
</label>
|
|
522
|
+
</div>
|
|
523
|
+
|
|
524
|
+
Styleguide checkbox-inline
|
|
525
|
+
*/
|
|
526
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
// Copyright 2016 Palantir Technologies, Inc. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License, Version 2.0.
|
|
3
|
+
|
|
4
|
+
@import "../../common/variables";
|
|
5
|
+
@import "../button/common";
|
|
6
|
+
@import "../../common/mixins";
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
File input
|
|
10
|
+
|
|
11
|
+
Markup:
|
|
12
|
+
<label class="#{$ns}-file-input {{.modifier}}">
|
|
13
|
+
<input type="file" {{:modifier}}/>
|
|
14
|
+
<span class="#{$ns}-file-upload-input">Choose file...</span>
|
|
15
|
+
</label>
|
|
16
|
+
|
|
17
|
+
:disabled - Disabled
|
|
18
|
+
.#{$ns}-large - Larger size
|
|
19
|
+
.#{$ns}-fill - Take up full width of parent element
|
|
20
|
+
.#{$ns}-file-input-has-selection - User has made a selection
|
|
21
|
+
|
|
22
|
+
Styleguide file-input
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
$file-input-button-width: $pt-grid-size * 7 !default;
|
|
26
|
+
$file-input-button-width-large: $pt-grid-size * 8.5 !default;
|
|
27
|
+
$file-input-button-padding: ($pt-input-height - $pt-button-height-small) * 0.5 !default;
|
|
28
|
+
$file-input-button-padding-large: ($pt-input-height-large - $pt-button-height) * 0.5 !default;
|
|
29
|
+
|
|
30
|
+
.#{$ns}-file-input {
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
display: inline-block;
|
|
33
|
+
height: $pt-input-height;
|
|
34
|
+
position: relative;
|
|
35
|
+
|
|
36
|
+
input {
|
|
37
|
+
margin: 0;
|
|
38
|
+
min-width: $pt-grid-size * 20;
|
|
39
|
+
opacity: 0;
|
|
40
|
+
|
|
41
|
+
// unlike other form controls that directly style native elements,
|
|
42
|
+
// pt-file-input wraps and hides the native element for better control over
|
|
43
|
+
// visual styles. to disable, we need to disable the hidden child input, not
|
|
44
|
+
// the surrounding wrapper. @see https://github.com/palantir/blueprint/issues/689
|
|
45
|
+
// for gory details.
|
|
46
|
+
&:disabled + .#{$ns}-file-upload-input,
|
|
47
|
+
&.#{$ns}-disabled + .#{$ns}-file-upload-input {
|
|
48
|
+
@include pt-input-disabled();
|
|
49
|
+
|
|
50
|
+
&::after {
|
|
51
|
+
@include pt-button-disabled();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.#{$ns}-dark & {
|
|
55
|
+
@include pt-dark-input-disabled();
|
|
56
|
+
|
|
57
|
+
&::after {
|
|
58
|
+
@include pt-dark-button-disabled();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&.#{$ns}-file-input-has-selection {
|
|
65
|
+
.#{$ns}-file-upload-input {
|
|
66
|
+
color: $pt-text-color;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.#{$ns}-dark & .#{$ns}-file-upload-input {
|
|
70
|
+
color: $pt-dark-text-color;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&.#{$ns}-fill {
|
|
75
|
+
width: 100%;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&.#{$ns}-large,
|
|
79
|
+
.#{$ns}-large & {
|
|
80
|
+
height: $pt-input-height-large;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.#{$ns}-file-upload-input-custom-text::after {
|
|
84
|
+
content: attr(#{$ns}-button-text);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.#{$ns}-file-upload-input {
|
|
89
|
+
@include pt-input();
|
|
90
|
+
@include overflow-ellipsis();
|
|
91
|
+
color: $pt-text-color-disabled;
|
|
92
|
+
left: 0;
|
|
93
|
+
padding-right: $file-input-button-width + $input-padding-horizontal;
|
|
94
|
+
position: absolute;
|
|
95
|
+
right: 0;
|
|
96
|
+
top: 0;
|
|
97
|
+
user-select: none;
|
|
98
|
+
|
|
99
|
+
&::after {
|
|
100
|
+
@include pt-button();
|
|
101
|
+
@include pt-button-height($pt-button-height-small);
|
|
102
|
+
@include overflow-ellipsis();
|
|
103
|
+
border-radius: $pt-border-radius;
|
|
104
|
+
content: "Browse";
|
|
105
|
+
line-height: $pt-button-height-small;
|
|
106
|
+
margin: $file-input-button-padding;
|
|
107
|
+
position: absolute;
|
|
108
|
+
right: 0;
|
|
109
|
+
text-align: center;
|
|
110
|
+
top: 0;
|
|
111
|
+
width: $file-input-button-width;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
&:hover::after {
|
|
115
|
+
@include pt-button-hover();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&:active::after {
|
|
119
|
+
@include pt-button-active();
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.#{$ns}-large & {
|
|
123
|
+
@include pt-input-large();
|
|
124
|
+
padding-right: $file-input-button-width-large + $input-padding-horizontal;
|
|
125
|
+
|
|
126
|
+
&::after {
|
|
127
|
+
@include pt-button-height($pt-button-height);
|
|
128
|
+
line-height: $pt-button-height;
|
|
129
|
+
margin: $file-input-button-padding-large;
|
|
130
|
+
width: $file-input-button-width-large;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.#{$ns}-dark & {
|
|
135
|
+
@include pt-dark-input();
|
|
136
|
+
color: $pt-dark-text-color-disabled;
|
|
137
|
+
|
|
138
|
+
&::after {
|
|
139
|
+
@include pt-dark-button();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
&:hover::after {
|
|
143
|
+
@include pt-dark-button-hover();
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
&:active::after {
|
|
147
|
+
@include pt-dark-button-active();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// hack to force the button shadow to display since
|
|
153
|
+
// it doesn't render correct via the `pt-button` mixin
|
|
154
|
+
/* stylelint-disable-next-line no-duplicate-selectors */
|
|
155
|
+
.#{$ns}-file-upload-input::after { box-shadow: $button-box-shadow; }
|