tungsten 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/tungsten/_form_helpers.js +21 -0
- data/app/assets/javascripts/tungsten/code.js +20 -0
- data/app/assets/javascripts/tungsten/tungsten.js +4 -20
- data/app/assets/stylesheets/tungsten/_code-color.scss +0 -0
- data/app/assets/stylesheets/tungsten/_colors.yml +68 -4
- data/app/assets/stylesheets/tungsten/_index.scss +5 -0
- data/app/assets/stylesheets/tungsten/code/_codemirror.scss +56 -0
- data/app/assets/stylesheets/tungsten/code/_color.scss +58 -0
- data/app/assets/stylesheets/tungsten/code/_highlighted.scss +64 -0
- data/app/assets/stylesheets/tungsten/code/_index.scss +3 -0
- data/app/assets/stylesheets/tungsten/core/_buttons.scss +144 -0
- data/app/assets/stylesheets/tungsten/core/_cards.scss +90 -0
- data/app/assets/stylesheets/tungsten/core/_colors.scss +20 -0
- data/app/assets/stylesheets/tungsten/core/_globals.scss +172 -0
- data/app/assets/stylesheets/tungsten/core/_grid.scss +164 -0
- data/app/assets/stylesheets/tungsten/core/_index.scss +7 -13
- data/app/assets/stylesheets/tungsten/core/_layout.scss +47 -0
- data/app/assets/stylesheets/tungsten/core/_text.scss +219 -0
- data/app/assets/stylesheets/tungsten/form/_base.scss +235 -0
- data/app/assets/stylesheets/tungsten/form/_check-radio.scss +154 -0
- data/app/assets/stylesheets/tungsten/form/_check-switch.scss +104 -0
- data/app/assets/stylesheets/tungsten/form/_index.scss +4 -0
- data/app/assets/stylesheets/tungsten/form/_label-placeholder.scss +98 -0
- data/app/assets/stylesheets/tungsten/tungsten.scss +1 -3
- data/app/helpers/tungsten/card_helper.rb +76 -0
- data/app/helpers/tungsten/deployments_helper.rb +59 -0
- data/app/helpers/tungsten/form_helper.rb +509 -0
- data/app/helpers/tungsten/layout_helper.rb +7 -0
- data/app/helpers/tungsten/toggle_nav_helper.rb +84 -0
- data/app/views/layouts/tungsten/default.html.slim +47 -0
- data/app/views/shared/tungsten/_defs.html.slim +6 -0
- data/app/views/shared/tungsten/_footer.html.slim +2 -0
- data/app/views/shared/tungsten/_header.html.slim +2 -0
- data/config/data/deployments.yml +110 -0
- data/lib/tungsten.rb +26 -2
- data/lib/tungsten/helper.rb +4 -0
- data/lib/tungsten/version.rb +1 -1
- data/public/{tungsten-0.1.0.js → code-0.1.1.js} +43 -69
- data/public/code-0.1.1.js.gz +0 -0
- data/public/code-0.1.1.map.json +1 -0
- data/public/tungsten-0.1.1.css +1523 -0
- data/public/tungsten-0.1.1.css.gz +0 -0
- data/public/tungsten-0.1.1.js +79 -0
- data/public/tungsten-0.1.1.js.gz +0 -0
- data/public/tungsten-0.1.1.map.json +1 -0
- metadata +120 -16
- data/app/helpers/tungsten/application_helper.rb +0 -4
- data/app/views/layouts/tungsten/default.html.erb +0 -17
- data/public/tungsten-0.1.0.css +0 -17
- data/public/tungsten-0.1.0.css.gz +0 -0
- data/public/tungsten-0.1.0.js.gz +0 -0
- data/public/tungsten-0.1.0.map.json +0 -1
@@ -0,0 +1,154 @@
|
|
1
|
+
label.tick-box {
|
2
|
+
flex-direction: row;
|
3
|
+
align-items: center;
|
4
|
+
|
5
|
+
// Bounce a little :)
|
6
|
+
*, *:after, *:before {
|
7
|
+
transition-timing-function: cubic-bezier( 0.175, 0.885, 0.320, 1.275 );
|
8
|
+
}
|
9
|
+
|
10
|
+
// Radios & checkboxes
|
11
|
+
input {
|
12
|
+
|
13
|
+
// Element styled to replace checkbox or radio button
|
14
|
+
+ .tick {
|
15
|
+
width: 20px;
|
16
|
+
height: 20px;
|
17
|
+
margin: 0 8px 0 0;
|
18
|
+
background: $white;
|
19
|
+
transition-property: box-shadow;
|
20
|
+
box-shadow: input-shadow(), $empty-shadow inset;
|
21
|
+
}
|
22
|
+
|
23
|
+
@include input-active {
|
24
|
+
border: none;
|
25
|
+
|
26
|
+
+ .tick { box-shadow: input-shadow( $gray-08 ), $empty-shadow inset; }
|
27
|
+
}
|
28
|
+
|
29
|
+
&:disabled {
|
30
|
+
pointer-events: none;
|
31
|
+
cursor: default;
|
32
|
+
color: $gray-05;
|
33
|
+
|
34
|
+
+ .tick {
|
35
|
+
box-shadow: 0 0 0 1px $gray-06 inset;
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
input[type=radio] {
|
41
|
+
|
42
|
+
// Unchecked
|
43
|
+
+ .tick {
|
44
|
+
border-radius: 50%;
|
45
|
+
position: relative;
|
46
|
+
|
47
|
+
&:before, &:after {
|
48
|
+
content: '';
|
49
|
+
background-color: white;
|
50
|
+
position: absolute;
|
51
|
+
left: 0;
|
52
|
+
top: 0;
|
53
|
+
height: 100%;
|
54
|
+
width: 100%;
|
55
|
+
border-radius: 50%;
|
56
|
+
box-shadow: 0 0 0 transparent;
|
57
|
+
transform: scale(0);
|
58
|
+
transition-property: box-shadow, transform;
|
59
|
+
}
|
60
|
+
|
61
|
+
&:before { background-color: $gray-06; }
|
62
|
+
}
|
63
|
+
|
64
|
+
// Checked
|
65
|
+
&:checked + .tick {
|
66
|
+
box-shadow: input-shadow( darken($blue-03, 3) ), 0 0 0 8px $blue-03 inset;
|
67
|
+
|
68
|
+
&:after {
|
69
|
+
box-shadow: 0 1px 0 2px darken($blue-03, 15);
|
70
|
+
transform: scale(.35);
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
// Hover, focus, active
|
75
|
+
@include input-active {
|
76
|
+
|
77
|
+
// Active Unchecked
|
78
|
+
+ .tick {
|
79
|
+
&:before { transform: scale(.35); }
|
80
|
+
&:after { transform: scale(0); }
|
81
|
+
}
|
82
|
+
|
83
|
+
// Active Checked
|
84
|
+
&:checked + .tick {
|
85
|
+
box-shadow: input-shadow( darken($blue-03, 15) ), 0 0 0 8px darken( $blue-03, 5 ) inset;
|
86
|
+
|
87
|
+
&:before { transform: scale(0); }
|
88
|
+
&:after { transform: scale(.35); }
|
89
|
+
}
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
// Checkboxes
|
94
|
+
input[type=checkbox] {
|
95
|
+
|
96
|
+
// Unchecked
|
97
|
+
+ .tick {
|
98
|
+
border-radius: $radius;
|
99
|
+
position: relative;
|
100
|
+
|
101
|
+
&:before, &:after {
|
102
|
+
content: '';
|
103
|
+
position: absolute;
|
104
|
+
left: -4px;
|
105
|
+
top: 0px;
|
106
|
+
width: 140%;
|
107
|
+
height: 70%;
|
108
|
+
margin: 10% 0 0 0;
|
109
|
+
border: solid $white;
|
110
|
+
border-width: 0 0 6px 6px;
|
111
|
+
transition-property: transform, border-color;
|
112
|
+
transform: scale(0) rotate(-50deg);
|
113
|
+
}
|
114
|
+
}
|
115
|
+
|
116
|
+
// Checked
|
117
|
+
&:checked + .tick {
|
118
|
+
box-shadow: input-shadow( darken($blue-03, 3) ), 0 0 0 10px $blue-03 inset;
|
119
|
+
|
120
|
+
&:after, &:before {
|
121
|
+
transform: scale(.5) rotate(-50deg);
|
122
|
+
}
|
123
|
+
|
124
|
+
&:before {
|
125
|
+
top: 1px;
|
126
|
+
opacity: 1;
|
127
|
+
border-color: darken( $blue-03, 10 );
|
128
|
+
}
|
129
|
+
}
|
130
|
+
|
131
|
+
// Hover, focus, active
|
132
|
+
@include input-active {
|
133
|
+
|
134
|
+
// Active Uncheked
|
135
|
+
+ .tick:before {
|
136
|
+
border-color: $gray-06;
|
137
|
+
transform: scale(.4) rotate(-50deg);
|
138
|
+
}
|
139
|
+
|
140
|
+
// Active Checked
|
141
|
+
&:checked + .tick {
|
142
|
+
box-shadow: input-shadow( darken($blue-03, 15) ), 0 0 0 10px darken( $blue-03, 5 ) inset;
|
143
|
+
|
144
|
+
&:before {
|
145
|
+
top: 1px;
|
146
|
+
opacity: 1;
|
147
|
+
transform: scale(.5) rotate(-50deg);
|
148
|
+
border-color: darken( $blue-03, 10 );
|
149
|
+
}
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}
|
153
|
+
}
|
154
|
+
|
@@ -0,0 +1,104 @@
|
|
1
|
+
.check-switch {
|
2
|
+
$width: 70px;
|
3
|
+
$height: 24px;
|
4
|
+
$tick-width: $width/2 - 2;
|
5
|
+
flex-direction: row; align-items: center;
|
6
|
+
|
7
|
+
.label-text {
|
8
|
+
margin-right: 10px;
|
9
|
+
padding-bottom: 0;
|
10
|
+
line-height: 1.5em;
|
11
|
+
}
|
12
|
+
|
13
|
+
input {
|
14
|
+
opacity: 0;
|
15
|
+
position: absolute;
|
16
|
+
}
|
17
|
+
|
18
|
+
&-label {
|
19
|
+
position: absolute;
|
20
|
+
color: transparent;
|
21
|
+
font-size: 0;
|
22
|
+
}
|
23
|
+
|
24
|
+
&-panel {
|
25
|
+
width: $width;
|
26
|
+
height: $height;
|
27
|
+
background: $white;
|
28
|
+
position: relative;
|
29
|
+
|
30
|
+
border-radius: $radius + 2;
|
31
|
+
transition-property: box-shadow, border-color;
|
32
|
+
box-shadow: $input-shadow;
|
33
|
+
}
|
34
|
+
|
35
|
+
&-tick {
|
36
|
+
width: $tick-width;
|
37
|
+
height: $height - 4;
|
38
|
+
background: rgba(#000, .08);
|
39
|
+
position: absolute;
|
40
|
+
bottom: 2px;
|
41
|
+
left: 2px;
|
42
|
+
border-radius: $radius;
|
43
|
+
transition-property: box-shadow, background-color, transform;
|
44
|
+
transform: translate3d( 0, 0, 0 );
|
45
|
+
box-shadow: input-shadow();
|
46
|
+
font-weight: 500;
|
47
|
+
|
48
|
+
&:before {
|
49
|
+
content: "ON";
|
50
|
+
left: 0;
|
51
|
+
opacity: 0;
|
52
|
+
color: $blue-04;
|
53
|
+
}
|
54
|
+
&:after {
|
55
|
+
content: "OFF";
|
56
|
+
right: -100%;
|
57
|
+
opacity: 1;
|
58
|
+
color: $gray-08;
|
59
|
+
}
|
60
|
+
&:before, &:after {
|
61
|
+
display: block;
|
62
|
+
font-size: 12px;
|
63
|
+
line-height: $height - 2;
|
64
|
+
position: absolute;
|
65
|
+
width: 100%;
|
66
|
+
text-align: center;
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
input {
|
71
|
+
@include input-active {
|
72
|
+
~ .check-switch-panel {
|
73
|
+
box-shadow: input-shadow($gray-08);
|
74
|
+
.check-switch-tick {
|
75
|
+
box-shadow: input-shadow( rgba($blue-04, .5) );
|
76
|
+
background-color: rgba($blue-04, .2);
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
input:checked + &-panel &-tick {
|
83
|
+
background-color: $blue-04;
|
84
|
+
box-shadow: input-shadow( darken($blue-04, 10) );
|
85
|
+
transform: translate3d( $tick-width , 0, 0 );
|
86
|
+
|
87
|
+
&:before,
|
88
|
+
&:after {
|
89
|
+
transform: translate3d( -$tick-width , 0, 0 );
|
90
|
+
}
|
91
|
+
|
92
|
+
&:before { opacity: 1; }
|
93
|
+
&:after { opacity: 0; }
|
94
|
+
}
|
95
|
+
|
96
|
+
input:checked {
|
97
|
+
@include input-active {
|
98
|
+
+ .check-switch-panel .check-switch-tick {
|
99
|
+
box-shadow: input-shadow( darken($blue-04, 10) );
|
100
|
+
background-color: lighten($blue-04, 5);
|
101
|
+
}
|
102
|
+
}
|
103
|
+
}
|
104
|
+
}
|
@@ -0,0 +1,98 @@
|
|
1
|
+
@mixin label-placeholder {
|
2
|
+
// Scoped variables
|
3
|
+
$font-size: 16px;
|
4
|
+
$padding-x: 12px;
|
5
|
+
$padding-y: 9px;
|
6
|
+
$distance-y: -23px;
|
7
|
+
$distance-x: 0;
|
8
|
+
$scale: .875;
|
9
|
+
$height: 50px;
|
10
|
+
$duration: .2s;
|
11
|
+
|
12
|
+
// Input labels
|
13
|
+
label.placeholder-label {
|
14
|
+
|
15
|
+
padding-top: 0;
|
16
|
+
line-height: 2em;
|
17
|
+
background: $white;
|
18
|
+
font-size: $font-size;
|
19
|
+
|
20
|
+
// Nested text-based inputs
|
21
|
+
> input,
|
22
|
+
> textarea {
|
23
|
+
margin-top: 5px;
|
24
|
+
}
|
25
|
+
|
26
|
+
// Hide input placeholder text
|
27
|
+
::placeholder {
|
28
|
+
opacity: 0;
|
29
|
+
color: transparent;
|
30
|
+
}
|
31
|
+
|
32
|
+
// Default active color
|
33
|
+
:not(.valid):not(.invalid) > {
|
34
|
+
textarea, input {
|
35
|
+
&:focus + span,
|
36
|
+
&:active + span {
|
37
|
+
color: $gray-08;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
// Inputs
|
43
|
+
textarea, input {
|
44
|
+
z-index: 1;
|
45
|
+
margin: 0;
|
46
|
+
font-size: inherit;
|
47
|
+
background: transparent;
|
48
|
+
padding: $padding-y $padding-x;
|
49
|
+
|
50
|
+
// Move labels out of the way on focus and empty
|
51
|
+
&:focus + .placeholder-label-text,
|
52
|
+
&:not(.empty) + .placeholder-label-text, {
|
53
|
+
z-index: 2;
|
54
|
+
transform: translate3d($distance-x, $distance-y, 0) scale($scale);
|
55
|
+
color: darken($gray-08, 10);
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
&.valid, &.invalid {
|
60
|
+
textarea, input {
|
61
|
+
+ .placeholder-label-text {
|
62
|
+
color: inherit;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
input {
|
68
|
+
line-height: inherit;
|
69
|
+
}
|
70
|
+
textarea {
|
71
|
+
padding-top: $padding-y + 4;
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
// Faux-placeholder labels
|
76
|
+
.placeholder-label-text {
|
77
|
+
pointer-events: none;
|
78
|
+
font-size: inherit;
|
79
|
+
line-height: 1.2em;
|
80
|
+
position: absolute;
|
81
|
+
top: $padding-y + 5px;
|
82
|
+
left: $padding-x;
|
83
|
+
padding: 1px 0 0 1px;
|
84
|
+
transform-origin: left top 0;
|
85
|
+
will-change: transform;
|
86
|
+
-webkit-filter: blur(0);
|
87
|
+
backface-visibility: hidden;
|
88
|
+
-webkit-font-smoothing: subpixel-antialiased;
|
89
|
+
color: $gray-06;
|
90
|
+
transform: translate3d(0, 0, 0) scale(1);
|
91
|
+
transition-property: color, transform;
|
92
|
+
background: $white;
|
93
|
+
box-shadow: -6px 0 $white, 6px 0 $white;
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
@include label-placeholder;
|
98
|
+
|
@@ -0,0 +1,76 @@
|
|
1
|
+
module Tungsten
|
2
|
+
module CardHelper
|
3
|
+
class Section < Tungsten::Helper
|
4
|
+
|
5
|
+
def initialize( title=nil )
|
6
|
+
@title = title
|
7
|
+
@children = { cards: [] }
|
8
|
+
|
9
|
+
heading( title ) if title
|
10
|
+
end
|
11
|
+
|
12
|
+
def display( body )
|
13
|
+
content_tag( :section, class: 'section' ) {
|
14
|
+
concat info
|
15
|
+
concat content_tag(:div, class: 'section-content') { body }
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
def add_card(card)
|
20
|
+
@children[cards].push card
|
21
|
+
end
|
22
|
+
|
23
|
+
def heading( text = nil, &block )
|
24
|
+
@children[:heading] = get_tag(:header, :h2, text, { class: 'section-heading' }, &block )
|
25
|
+
nil
|
26
|
+
end
|
27
|
+
|
28
|
+
def description( text = nil, &block )
|
29
|
+
@children[:description] = get_tag(:div, :p, text, { class: 'section-description' }, &block )
|
30
|
+
nil
|
31
|
+
end
|
32
|
+
|
33
|
+
def card( text = nil, &block )
|
34
|
+
content_tag(:section, class: 'section-card') {
|
35
|
+
concat title( text ) if text
|
36
|
+
concat capture(&block).html_safe
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
def title( text, options={} )
|
41
|
+
content_tag(:header, class: "card-title #{options[:class]}") {
|
42
|
+
content_tag(:h2) { text }
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
def content(options={}, &block )
|
47
|
+
content_tag(:section, class: "card-section #{options[:class]}", &block)
|
48
|
+
end
|
49
|
+
|
50
|
+
def footer( options={}, &block )
|
51
|
+
content_tag(:footer, class: "card-footer #{options[:class]}", &block)
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def get_tag( tag, wrapper, text, options, &block )
|
57
|
+
text = if block_given?
|
58
|
+
capture(&block).html_safe
|
59
|
+
else
|
60
|
+
content_tag(wrapper){ text }
|
61
|
+
end
|
62
|
+
|
63
|
+
content_tag(tag, options ) { text }
|
64
|
+
end
|
65
|
+
|
66
|
+
def info
|
67
|
+
if @children[:heading]
|
68
|
+
content_tag(:div, class: 'section-info') {
|
69
|
+
concat @children[:heading]
|
70
|
+
concat @children[:description]
|
71
|
+
}
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|