tungsten 0.1.57 → 0.1.58

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/tungsten/_icons.js +1 -1
  3. data/app/assets/javascripts/tungsten/enhancements/flash-messages.js +2 -2
  4. data/app/assets/javascripts/tungsten/enhancements/form-diff.js +92 -0
  5. data/app/assets/javascripts/tungsten/enhancements/form-reset.js +14 -0
  6. data/app/assets/javascripts/tungsten/{_form-helpers.js → enhancements/form-submit-helpers.js} +1 -19
  7. data/app/assets/javascripts/tungsten/enhancements/input-change.js +38 -0
  8. data/app/assets/javascripts/tungsten/enhancements/input-number-only.js +19 -0
  9. data/app/assets/javascripts/tungsten/enhancements/input-reset-value.js +51 -0
  10. data/app/assets/javascripts/tungsten/enhancements/input-unit.js +58 -0
  11. data/app/assets/javascripts/tungsten/enhancements/link-here.js +11 -0
  12. data/app/assets/javascripts/tungsten/enhancements/{text-helpers.js → textarea-expand.js} +4 -12
  13. data/app/assets/javascripts/tungsten/{enhancements → modules}/clipboard.js +0 -0
  14. data/app/assets/javascripts/tungsten/{enhancements → modules}/notify.js +0 -0
  15. data/app/assets/javascripts/tungsten/modules/unit-converter.js +53 -0
  16. data/app/assets/javascripts/tungsten/tungsten.js +11 -4
  17. data/app/assets/stylesheets/tungsten/components/_cards.scss +1 -0
  18. data/app/assets/stylesheets/tungsten/components/_copy-input.scss +22 -6
  19. data/app/assets/stylesheets/tungsten/components/_notices.scss +1 -1
  20. data/app/assets/stylesheets/tungsten/components/_progress-bar.scss +2 -2
  21. data/app/assets/stylesheets/tungsten/components/_toggle-nav.scss +1 -1
  22. data/app/assets/stylesheets/tungsten/components/_tooltip.scss +24 -7
  23. data/app/assets/stylesheets/tungsten/core/_sections.scss +7 -2
  24. data/app/assets/stylesheets/tungsten/form/_base.scss +48 -8
  25. data/app/assets/stylesheets/tungsten/form/_defaulted-inputs.scss +48 -0
  26. data/app/assets/stylesheets/tungsten/form/_form-diff.scss +96 -0
  27. data/app/assets/stylesheets/tungsten/form/_index.scss +3 -0
  28. data/app/assets/stylesheets/tungsten/form/_label-placeholder.scss +3 -3
  29. data/app/assets/stylesheets/tungsten/form/_unit-select.scss +40 -0
  30. data/app/assets/stylesheets/tungsten/form/_validation.scss +2 -2
  31. data/app/helpers/tungsten/button_helper.rb +6 -1
  32. data/app/helpers/tungsten/content_helper.rb +4 -0
  33. data/app/helpers/tungsten/form_helper.rb +75 -113
  34. data/app/helpers/tungsten/section_helper.rb +7 -1
  35. data/lib/tungsten/version.rb +1 -1
  36. data/public/code-0.1.58.js +101 -0
  37. data/public/code-0.1.58.js.gz +0 -0
  38. data/public/code-0.1.58.map.json +1 -0
  39. data/public/{tungsten-0.1.57.css → tungsten-0.1.58.css} +270 -62
  40. data/public/tungsten-0.1.58.css.gz +0 -0
  41. data/public/tungsten-0.1.58.js +125 -0
  42. data/public/tungsten-0.1.58.js.gz +0 -0
  43. data/public/tungsten-0.1.58.map.json +1 -0
  44. metadata +25 -14
  45. data/public/code-0.1.57.js +0 -95
  46. data/public/code-0.1.57.js.gz +0 -0
  47. data/public/code-0.1.57.map.json +0 -1
  48. data/public/tungsten-0.1.57.css.gz +0 -0
  49. data/public/tungsten-0.1.57.js +0 -103
  50. data/public/tungsten-0.1.57.js.gz +0 -0
  51. data/public/tungsten-0.1.57.map.json +0 -1
@@ -8,17 +8,24 @@ var toggler = require( 'compose-toggler' )
8
8
  var formUp = require( 'compose-form-up' )
9
9
  var dialog = require( 'compose-dialog' )
10
10
  var ajax = require( 'superagent' )
11
- var clipboard = require( './enhancements/clipboard' )
12
- var notify = require( './enhancements/notify' )
11
+ var clipboard = require( './modules/clipboard' )
12
+ var notify = require( './modules/notify' )
13
13
  var event = toolbox.event
14
14
 
15
15
  event.scroll.disablePointer() // disable pointer events on scroll for performance (to avoid extra repaints)
16
16
  clipboard();
17
17
 
18
18
  require( 'compose-slider' ) // Our slider (range input) component
19
- require( './_form-helpers' )
20
19
  require( './enhancements/flash-messages' )
21
- require( './enhancements/text-helpers' )
20
+ require( './enhancements/form-diff' )
21
+ require( './enhancements/form-reset' )
22
+ require( './enhancements/form-submit-helpers' )
23
+ require( './enhancements/input-change' )
24
+ require( './enhancements/input-number-only' )
25
+ require( './enhancements/input-reset-value' )
26
+ require( './enhancements/input-unit' )
27
+ require( './enhancements/link-here' )
28
+ require( './enhancements/textarea-expand' )
22
29
 
23
30
  event.change( timeToggle.timeago.setup )
24
31
 
@@ -121,6 +121,7 @@
121
121
 
122
122
  // Keep footer (or form if it wraps the footer)
123
123
  // nestled up against the card edges
124
+ &-footer,
124
125
  & > &-footer:last-child,
125
126
  & > *:last-child > &-footer:last-child,
126
127
  & > *:last-child > *:last-child > &-footer:last-child {
@@ -1,6 +1,4 @@
1
1
  .copy-input {
2
- position: relative;
3
- display: block;
4
2
  &:hover {
5
3
  z-index: 2;
6
4
  }
@@ -8,18 +6,32 @@
8
6
  .copy-button {
9
7
  right: 1px;
10
8
  top: 1px;
9
+ bottom: 1px;
11
10
  z-index: 1;
12
- padding: 10px 10px 4px 15px;
11
+ padding: 5px 10px 4px 15px;
12
+ border-radius: 0;
13
13
  svg {
14
14
  height: 20px;
15
15
  }
16
16
 
17
17
  &, &:hover, &:active, &:focus {
18
18
  transform: translate3d(0,0,0);
19
+ border-left: 1px solid rgba($gray-11, .2);
19
20
  position: absolute;
20
- border: none;
21
21
  box-shadow: none;
22
- background: linear-gradient( 60deg, rgba(#fff, 0), #fff 30%)
22
+ background: none;
23
+ }
24
+ }
25
+
26
+ &[data-input-type=textarea]{
27
+ textarea {
28
+ padding-right: 42px;
29
+ }
30
+ .copy-button {
31
+ &, &:hover, &:active, &:focus {
32
+ border: none;
33
+ bottom: initial;
34
+ }
23
35
  }
24
36
  }
25
37
 
@@ -27,7 +39,11 @@
27
39
  // Magic Number: Push absolute positioned copy-button
28
40
  // down to account for label on top
29
41
  .standard-label + .button-wrapper .copy-button {
30
- top: 1.75em;
42
+ top: 2.1em;
43
+ }
44
+
45
+ input {
46
+ padding-right: 55px;
31
47
  }
32
48
  }
33
49
 
@@ -1,6 +1,6 @@
1
1
  @mixin notice-colors ($text, $bg, $border) {
2
2
  color: $text;
3
- background: linear-gradient( top, lighten($bg, 2), darken($bg, 2));
3
+ background: linear-gradient( lighten($bg, 2), darken($bg, 2));
4
4
  border: 1px solid $border;
5
5
  }
6
6
  .notice {
@@ -44,9 +44,9 @@ $progress-bar-max-width: 450px;
44
44
  border-radius: 10px;
45
45
  position: relative;
46
46
  overflow: hidden;
47
- animation: expand-width 2s $timing;
47
+ animation: expand-width .75s $timing;
48
48
  box-shadow: 0 0 1px 1px rgba(#fff, .2) inset;
49
- transition: width 1.5s $timing, background-color .5s $timing;
49
+ transition: width 1.5s $timing, background-color .25s $timing;
50
50
 
51
51
  &:before {
52
52
  background-size: 50px 50px;
@@ -11,7 +11,7 @@
11
11
  &-label {
12
12
  box-shadow: $input-shadow;
13
13
  flex-grow: 0;
14
- padding: 4px 10px;
14
+ padding: 4px 10px 0px;
15
15
  background: $white;
16
16
  position: relative;
17
17
  cursor: pointer;
@@ -1,20 +1,35 @@
1
+ .has-tooltip {
2
+ &:before, &:after {
3
+ opacity: 0;
4
+ transition: none;
5
+ }
6
+ &:before { content: ""; }
7
+ &:after {
8
+ content: attr(aria-label);
9
+ font-size: 0;
10
+ }
11
+ &.copied {
12
+ &:after {
13
+ content: "Copied!";
14
+ font-size: 0;
15
+ }
16
+ }
17
+ }
1
18
  .has-tooltip:focus, .has-tooltip:hover {
2
19
  position: relative;
3
20
  z-index: 1;
4
21
  &:before, &:after {
5
- opacity: 0;
22
+ opacity: 1;
6
23
  position: absolute;
7
24
  left: 50%;
8
25
  transform: translate3d(-50%, 0, 0);
9
26
  z-index: 100000;
10
27
  pointer-events: none;
11
- animation: fade-in .1s ease-in;
28
+ animation: fade-in .2s ease-in;
12
29
  animation-fill-mode: forwards;
13
- animation-delay: .4s;
14
30
  }
15
31
  &:after {
16
32
  -webkit-font-smoothing: subpixel-antialiased;
17
- content: attr(aria-label);
18
33
  top: calc(100% + 6px);
19
34
  background-color: rgba(#000, 0.8);
20
35
  color: #fff;
@@ -31,15 +46,17 @@
31
46
  }
32
47
 
33
48
  &.copied {
34
- &:after { content: "Copied!"; }
49
+ &:after {
50
+ font-size: 10px;
51
+ }
35
52
  &:before, &:after {
36
- animation-delay: 0s;
53
+ animation: none;
37
54
  }
38
55
  &:after {
39
56
  background-color: rgba($green-02, .8);
40
57
  }
41
58
  &:before {
42
- @include triangle(up, rgba($green-02, .8), 6px);
59
+ border-bottom-color: rgba($green-02, .8);
43
60
  }
44
61
  }
45
62
  }
@@ -28,13 +28,18 @@
28
28
 
29
29
  &-title {
30
30
  flex: 1 0 240px;
31
- padding: 0 $card-padding 0;
31
+ padding: 0 $card-padding/2 0;
32
+ @include at-least($large-width) {
33
+ padding: 0 $card-padding 0;
34
+ }
32
35
  }
33
36
 
34
37
  &-heading {
35
38
  font-size: 18px;
36
39
  @include at-least($medium-width) {
37
- padding: $card-padding 0 0;
40
+ &:first-child {
41
+ padding: $card-padding 0 0;
42
+ }
38
43
  }
39
44
  }
40
45
 
@@ -1,9 +1,8 @@
1
1
  $text-inputs: 'textarea, input[type=url], input[type=tel], input[type=text], input[type=email], input[type=number], input[type=password], input[type=search]';
2
2
 
3
-
4
3
  @mixin input-active {
5
4
  &:focus,
6
- &:hover:not([disabled]),
5
+ //&:hover:not([disabled]),
7
6
  &:active {
8
7
  @content;
9
8
  }
@@ -58,17 +57,18 @@ textarea,
58
57
  width: 100%;
59
58
  padding: 9px 12px;
60
59
  border-radius: $radius;
61
- transition: box-shadow $duration;
60
+ transition: box-shadow, background-color;
61
+ transition-duration: $duration;
62
+ transition-timing-function: $timing;
62
63
  line-height: 1.8em;
64
+ background-color: $white;
63
65
 
64
66
  // Normal state
65
67
  box-shadow: $input-shadow;
66
68
 
67
69
  // Active state
68
- @include active {
69
- &:not([disabled]) {
70
- box-shadow: $focus-shadow;
71
- }
70
+ @include input-active {
71
+ box-shadow: $focus-shadow;
72
72
  }
73
73
 
74
74
  &:disabled:not([type="submit"]) {
@@ -138,9 +138,21 @@ label {
138
138
 
139
139
  .label-text {
140
140
  transition-property: box-shadow, color;
141
- padding-bottom: .2em;
141
+ transition-duration: $duration;
142
+ transition-timing-function: $timing;
143
+ padding-bottom: .4em;
144
+ font-size: 1.1em;
145
+ font-weight: 500;
146
+ }
147
+
148
+ .label-description {
149
+ color: $gray-09;
150
+ font-size: 12px;
151
+ line-height: 1.3em;
152
+ padding-bottom: .8em;
142
153
  }
143
154
  }
155
+
144
156
  label { *, *:before, *:after {
145
157
  transition-duration: $duration;
146
158
  transition-timing-function: $timing;
@@ -151,3 +163,31 @@ form.button_to {
151
163
  display: inline-flex;
152
164
  }
153
165
 
166
+ .requires-restart {
167
+ background-color: transparent;
168
+ box-shadow: 0 0 0 1px transparent;
169
+ transition: $duration background-color, $duration box-shadow;
170
+ padding: 6px;
171
+ margin: -6px!important;
172
+ position: relative;
173
+ vertical-align: top;
174
+ &-input-message {
175
+ font-size: .8em;
176
+ color: mix($red-01, $gray-10, 70);
177
+ opacity: 0;
178
+ transition: $duration opacity, $duration height;
179
+ overflow: hidden;
180
+ height: 0;
181
+ }
182
+ }
183
+
184
+ .requires-restart.input-changed {
185
+ background-color: rgba($red-01, 0.02);
186
+ box-shadow: 0 0 0 1px rgba($red-01, 0.3);
187
+ border-radius: 3px;
188
+ .requires-restart-input-message {
189
+ opacity: 1;
190
+ height: 1.5em;
191
+ margin-top: .3em;
192
+ }
193
+ }
@@ -0,0 +1,48 @@
1
+ label.defaulted:not(.remotely-invalid) {
2
+
3
+ input:not([type=range]), select:not([tabindex="-1"]), textarea {
4
+ -webkit-text-fill-color: currentColor;
5
+ box-shadow: input-shadow( $orange-01 );
6
+
7
+ @include input-active {
8
+ box-shadow: input-focus-shadow( $orange-01 );
9
+ background-color: rgba($yellow-01, .05);
10
+ }
11
+ }
12
+ input[type=range]:focus {
13
+ @include slider-thumb {
14
+ background: $orange-01;
15
+ box-shadow: 0 0 2px 2px $orange-01, rgba(#000, .4) 0 1px 1px inset;
16
+ }
17
+ }
18
+ .slider-label {
19
+ box-shadow: $orange-01 0 0 0 1px;
20
+ background-color: rgba($yellow-01, .05);
21
+ &:after {
22
+ border-right-color: mix($yellow-01, $white, 5);
23
+ }
24
+ &:before {
25
+ border-right-color: $orange-01;
26
+ }
27
+ }
28
+ }
29
+
30
+ .restore-default {
31
+ z-index: 100;
32
+ position: relative;
33
+ text-decoration: none;
34
+ font-size: .9em;
35
+ padding: .1em .2em 0;
36
+ display: inline-block;
37
+ color: $gray-08;
38
+ transition: none;
39
+
40
+ &:hover, &:focus {
41
+ color: $orange-01;
42
+ background-color: $gray-02;
43
+ border-radius: $radius;
44
+ }
45
+ span {
46
+ position: relative;
47
+ }
48
+ }
@@ -0,0 +1,96 @@
1
+ .form-diff {
2
+ &:not([data-status='diffs']) {
3
+ overflow: hidden;
4
+ display: none;
5
+ }
6
+
7
+ &-container {
8
+ animation: fade-in $timing $duration;
9
+ }
10
+
11
+ &-description, &-restart {
12
+ line-height: 1.3em;
13
+ margin: .8em 0;
14
+ }
15
+ }
16
+
17
+ .input-diffs {
18
+ width: 100%;
19
+ margin: 0;
20
+ }
21
+
22
+ .input-diff {
23
+ td { background-color: rgba($gray-01, .5); }
24
+
25
+ &-label {
26
+ font-weight: 500;
27
+ /*width: 100%;*/
28
+ }
29
+
30
+ &-value, &-initial {
31
+ padding-left: .2em;
32
+ padding-right: .2em;
33
+
34
+ span {
35
+ white-space: pre;
36
+ font-family: $mono-font;
37
+ display: inline-block;
38
+ padding: 0 .5em;
39
+ }
40
+ }
41
+
42
+ &-initial { text-align: right; }
43
+ &-initial span { background-color: #FCEFF0; }
44
+ &-value span { background-color: #EAFEEE; }
45
+
46
+ &-undo {
47
+ width: 1%;
48
+ button {
49
+ padding: 0 .5em;
50
+ color: inherit;
51
+ opacity: 0.4;
52
+ transition: opacity $timing $duration;
53
+ text-decoration: none;
54
+ border: none;
55
+ background: transparent;
56
+
57
+ &:hover, &:focus {
58
+ color: inherit;
59
+ opacity: 1;
60
+ }
61
+ }
62
+ }
63
+
64
+ // Arrows between values
65
+ &-marker {
66
+ padding-left: 0;
67
+ padding-right: 0;
68
+ width: 1%;
69
+ span {
70
+ transform: rotate(45deg);
71
+ position: relative;
72
+ display: inline-block;
73
+ height: 7px;
74
+ width: 7px;
75
+ border-top: 2px solid $gray-07;
76
+ border-right: 2px solid $gray-07;
77
+ margin: { right: .5em; left: .5em }
78
+
79
+ &:before {
80
+ content: "was changed to";
81
+ font-size: 0;
82
+ height: 0;
83
+ width: 0;
84
+ position: absolute;
85
+ }
86
+ &:after {
87
+ content: "";
88
+ position: absolute;
89
+ border-bottom: 2px solid $gray-07;
90
+ width: 8px;
91
+ height: 0px;
92
+ transform: rotate(-45deg) translateX(-2px);
93
+ }
94
+ }
95
+ }
96
+ }
@@ -5,3 +5,6 @@
5
5
  @import 'validation';
6
6
  @import 'slider';
7
7
  @import 'input-row';
8
+ @import 'unit-select';
9
+ @import 'defaulted-inputs';
10
+ @import 'form-diff';