tungsten 0.1.19 → 0.1.20

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.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/tungsten/_icons.js +1 -1
  3. data/app/assets/javascripts/tungsten/enhancements/text-helpers.js +31 -0
  4. data/app/assets/javascripts/tungsten/tungsten.js +1 -0
  5. data/app/assets/stylesheets/tungsten/components/_toggle-nav.scss +1 -4
  6. data/app/assets/stylesheets/tungsten/components/_tooltip.scss +1 -3
  7. data/app/assets/stylesheets/tungsten/core/_animations.scss +1 -1
  8. data/app/assets/stylesheets/tungsten/core/_globals.scss +1 -1
  9. data/app/assets/stylesheets/tungsten/core/_grid.scss +8 -0
  10. data/app/assets/stylesheets/tungsten/core/_layout.scss +45 -0
  11. data/app/assets/stylesheets/tungsten/core/_sections.scss +1 -1
  12. data/app/assets/stylesheets/tungsten/form/_base.scss +2 -2
  13. data/app/assets/stylesheets/tungsten/form/_copy-input.scss +31 -0
  14. data/app/assets/stylesheets/tungsten/form/_index.scss +1 -0
  15. data/app/assets/stylesheets/tungsten/form/_label-placeholder.scss +3 -7
  16. data/app/assets/svgs/tungsten/copy.svg +1 -0
  17. data/app/assets/svgs/tungsten/logo.svg +1 -0
  18. data/app/helpers/tungsten/button_helper.rb +15 -3
  19. data/app/helpers/tungsten/deployments_helper.rb +4 -3
  20. data/app/helpers/tungsten/form_helper.rb +19 -2
  21. data/app/views/layouts/tungsten/default.html.slim +4 -1
  22. data/lib/tungsten/version.rb +1 -1
  23. data/public/{code-0.1.19.js → code-0.1.20.js} +1 -1
  24. data/public/{code-0.1.19.js.gz → code-0.1.20.js.gz} +0 -0
  25. data/public/{code-0.1.19.map.json → code-0.1.20.map.json} +0 -0
  26. data/public/{tungsten-0.1.19.css → tungsten-0.1.20.css} +103 -22
  27. data/public/tungsten-0.1.20.css.gz +0 -0
  28. data/public/{tungsten-0.1.19.js → tungsten-0.1.20.js} +44 -42
  29. data/public/tungsten-0.1.20.js.gz +0 -0
  30. data/public/tungsten-0.1.20.map.json +1 -0
  31. metadata +14 -10
  32. data/public/tungsten-0.1.19.css.gz +0 -0
  33. data/public/tungsten-0.1.19.js.gz +0 -0
  34. data/public/tungsten-0.1.19.map.json +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 120a1040b1300094e1c96b54d0517ff337d5cdd3
4
- data.tar.gz: 5a0e1faa1bec9ed897d66863bfd5c298818e554d
3
+ metadata.gz: 3ee12661632e5e680b97d10b8e53ac76a28b09ff
4
+ data.tar.gz: 9242ee825cd2fb7f3adcaf983e8376ce45bfea70
5
5
  SHA512:
6
- metadata.gz: 74c18f297122cc3a3b7e45a559d9b5cb74f03e75777885a57c74ff2d4ef68014d2acbd3ab171993e713a71d1a2c1e2a6cf77737651def11216bc63d2f5f144ba
7
- data.tar.gz: 25f3e7b80d374da31905cd96ea73ddb4a05548b91db9a414137f02150c98601d3a942feaa88910b3e7fa1552aa89540b7015debe6e4c3b284f6d7cc55289d5f0
6
+ metadata.gz: 7aee84b8ac48e4fd18b7becb907ab612e177172971f8781c7562019dc7441478262f1bffef14c27c0f5fa1f97b60384817ffafceebb69348bd8e3068f2ba0304
7
+ data.tar.gz: d5ad13b8dc2744fe0aa04d35703deeda232defe933a23d110d220a27be2823ff8621d901149c87ea998eb3af972d2a48ad41a0d50000aae0a5b3dcf8def2e8ae
@@ -2,7 +2,7 @@
2
2
 
3
3
  function embed() {
4
4
  if (!document.querySelector('#esvg-svg-icons')) {
5
- document.querySelector('body').insertAdjacentHTML('afterbegin', '<svg id="esvg-svg-icons" data-symbol-class="svg-symbol" data-prefix="svg" version="1.1" style="height:0;position:absolute"><symbol id="svg-deployment" data-name="deployment" viewBox="0 0 176 201" width="176" height="201" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path d="M88 5.985l82.272 47.5v95L88 195.985l-82.272-47.5v-95L88 5.985z"/></symbol></svg>')
5
+ document.querySelector('body').insertAdjacentHTML('afterbegin', '<svg id="esvg-svg-icons" data-symbol-class="svg-symbol" data-prefix="svg" version="1.1" style="height:0;position:absolute"><symbol id="svg-deployment" data-name="deployment" viewBox="0 0 176 201" width="176" height="201" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path d="M88 5.985l82.272 47.5v95L88 195.985l-82.272-47.5v-95L88 5.985z"/></symbol><symbol id="svg-copy" data-name="copy" viewBox="0 0 294 294" width="294" height="294" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path d="M0 136.96c0-28.877 23.444-52.32 52.32-52.32v89.854c0 37.036 30.07 67.105 67.105 67.105h89.854c0 28.875-23.445 52.32-52.32 52.32H52.32C23.444 293.92 0 270.474 0 241.6V136.96z" fill-opacity=".529"/><path d="M136.96 0c-28.877 0-52.32 23.444-52.32 52.32v104.64c0 28.875 23.443 52.32 52.32 52.32H241.6c28.875 0 52.32-23.445 52.32-52.32V52.32C293.92 23.444 270.474 0 241.6 0H136.96z"/></symbol><symbol id="svg-logo" data-name="logo" viewBox="0 0 256 256" width="256" height="256" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path d="M152.89 179.214l-49.78 28.74-53.332-30.792L0 148.42V86.838l53.333-30.792 49.777 28.74 49.777-28.74 53.333 30.792 49.78 28.74v61.584l-53.333 30.792-49.778-28.74zm3.137-6.374v-49.052l42.975 24.635.01 49.27-42.985-24.853zm-99.14.217v-49.27l43.126 24.77.01 49.566-43.135-25.066zM7.11 144.317v-49.27l42.668 24.635.002 49.27-42.67-24.635zm96-51.32l42.67 24.634-42.67 24.636-42.67-24.634 42.67-24.634zm99.557 0l42.668 24.634-42.668 24.636-42.67-24.634 42.67-24.634zM53.333 64.257l42.67 24.633-42.67 24.635-42.67-24.634 42.67-24.633zm99.554 0l42.67 24.633-42.67 24.635-42.67-24.634 42.67-24.633z"/><path d="M6.82 144.547l.023-50 93.295 53.877.04 50.06L6.82 144.547zm148.916 28.477l.14-49.667 43.428 24.894-.045 50.235-43.525-25.46z" fill-opacity=".349"/></symbol></svg>')
6
6
  }
7
7
  }
8
8
 
@@ -0,0 +1,31 @@
1
+ var toolbox = require( 'compose-toolbox' )
2
+
3
+ function autoSizeTextarea( textarea ) {
4
+ var parent = textarea.parentElement
5
+
6
+ if ( textarea.value == '' ) return
7
+ if ( parent.classList.contains('input-wrapper') ) {
8
+
9
+ parent.style.height = textarea.style.height
10
+ var offset = textarea.offsetHeight - textarea.clientHeight
11
+ textarea.style.height = 'auto'
12
+ var newHeight = ( textarea.scrollHeight + offset )
13
+ var maxHeight = window.innerHeight * .95
14
+
15
+ if ( newHeight < maxHeight )
16
+ textarea.style.height = newHeight + 'px'
17
+ else
18
+ textarea.style.height = maxHeight + 'px'
19
+
20
+ parent.style.height = 'auto'
21
+ }
22
+ }
23
+
24
+ toolbox.event.change(function(){
25
+ var textareas = document.querySelectorAll('textarea')
26
+ toolbox.event.delay( function(){ Array.prototype.forEach.call(textareas, autoSizeTextarea) } )
27
+ })
28
+
29
+ toolbox.event.on(document, 'keyup toggler:show', 'textarea', function(event){
30
+ autoSizeTextarea(event.currentTarget)
31
+ })
@@ -13,6 +13,7 @@ require( 'compose-slider' ) // Our slider (range input) component
13
13
  require( './_icons' ) // Import svg icons (from Esvg)
14
14
  require( './_form-helpers' )
15
15
  require( './enhancements/flash-messages' )
16
+ require( './enhancements/text-helpers' )
16
17
 
17
18
  // Public API object
18
19
  window.Tungsten = module.exports = toolbox.merge( {
@@ -3,7 +3,7 @@
3
3
  justify-content: center;
4
4
  position: relative;
5
5
  z-index: 1;
6
- @include block-margin;
6
+ margin-bottom: -35px;
7
7
 
8
8
  &-label {
9
9
  box-shadow: $input-shadow;
@@ -38,6 +38,3 @@
38
38
  }
39
39
  }
40
40
  }
41
- .toggle-nav + .card-well {
42
- margin-top: -35px;
43
- }
@@ -19,7 +19,7 @@
19
19
  background-color: rgba(#000, 0.8);
20
20
  color: #fff;
21
21
  white-space: nowrap;
22
- font-size: 11px;
22
+ font-size: 10px;
23
23
  line-height: 1.5em;
24
24
  padding: 5px 8px;
25
25
  border-radius: $radius;
@@ -47,6 +47,4 @@
47
47
  @include triangle(up, rgba($green-02, .8), 6px);
48
48
  }
49
49
  }
50
-
51
50
  }
52
-
@@ -35,7 +35,7 @@
35
35
 
36
36
  @keyframes half-spin {
37
37
  0% {
38
- transform: rotate(-180deg);
38
+ transform: rotate(-180deg);
39
39
  }
40
40
  100% {
41
41
  transform: rotate(0deg);
@@ -80,7 +80,7 @@ $card-padding: 20px;
80
80
  $vertical-margin: 20px;
81
81
 
82
82
  // Inner content padding
83
- $content-padding: 40px;
83
+ $content-padding: 30px;
84
84
 
85
85
  // Main header height
86
86
  $header-height: 84px;
@@ -238,6 +238,14 @@ form [class*='columns'] {
238
238
  justify-items: flex-end;
239
239
  }
240
240
 
241
+ .push-right {
242
+ margin-left: auto;
243
+ }
244
+
245
+ .push-left {
246
+ margin-right: auto;
247
+ }
248
+
241
249
  /* ===================================== *
242
250
  * Breakpoints
243
251
  * ------------------------------------- */
@@ -15,6 +15,10 @@
15
15
  * Document
16
16
  * ------------------------------------- */
17
17
 
18
+ html {
19
+ background: $gray-02;
20
+ }
21
+
18
22
  body {
19
23
  display: flex;
20
24
  min-height: 100vh;
@@ -45,6 +49,47 @@ textarea {
45
49
  * Application
46
50
  * ------------------------------------- */
47
51
 
52
+ .application-banner {
53
+ background: $gray-10;
54
+ color: $white;
55
+ display: flex;
56
+ align-items: center;
57
+ padding: $content-padding * .5 $content-padding;
58
+
59
+ .svg-deployment {
60
+ margin-right: 20px;
61
+ }
62
+
63
+ @each $name, $colors in $gradients {
64
+ $start: nth($colors, 1);
65
+ $end: nth($colors, 2);
66
+
67
+ &.#{$name}-gradient-bg {
68
+ background: linear-gradient(135deg, #{$start}, #{$end}) left top/100% 100% no-repeat;
69
+ }
70
+ }
71
+
72
+ a {
73
+ transition: $duration;
74
+ text-decoration: none;
75
+ padding: .3em .6em;
76
+ border-radius: $radius;
77
+
78
+ &,
79
+ &:visited {
80
+ color: inherit;
81
+ background: transparent;
82
+ }
83
+
84
+ &:hover,
85
+ &:focus,
86
+ &:active {
87
+ color: inherit;
88
+ background: rgba($white, .2);
89
+ }
90
+ }
91
+ }
92
+
48
93
  .application-content {
49
94
  padding: $content-padding;
50
95
  }
@@ -17,7 +17,7 @@
17
17
 
18
18
  &-header {
19
19
  justify-content: space-between;
20
- @include block-margin;
20
+ // @include block-margin;
21
21
  }
22
22
 
23
23
  &-heading {
@@ -78,7 +78,6 @@ textarea,
78
78
  border: none;
79
79
  padding: 0;
80
80
  }
81
-
82
81
  }
83
82
 
84
83
  .input-wrapper {
@@ -102,9 +101,10 @@ select {
102
101
 
103
102
  // Confine resizing of textareas
104
103
  textarea {
104
+ line-height: 1.4em;
105
105
  display: block;
106
106
  resize: vertical;
107
- min-height: 75px;
107
+ max-height: 50vh;
108
108
  }
109
109
 
110
110
  ::placeholder {
@@ -0,0 +1,31 @@
1
+ .copy-input {
2
+ position: relative;
3
+
4
+ .copy-button {
5
+ right: 1px;
6
+ top: 10px;
7
+ z-index: 2;
8
+ padding: 4px 10px;
9
+
10
+ &, &:hover, &:active, &:focus {
11
+ transform: translate3d(0,0,0);
12
+ position: absolute;
13
+ border: none;
14
+ box-shadow: none;
15
+ background: linear-gradient( to right, rgba(#fff, .4), #fff 15%)
16
+ }
17
+ }
18
+ }
19
+
20
+ .copy-button {
21
+ svg {
22
+ opacity: .5;
23
+ transition: opacity ease .2s;
24
+ }
25
+ &:hover, &:focus {
26
+ svg { opacity: 1; }
27
+ }
28
+ &.copied {
29
+ svg { fill: $green-02; }
30
+ }
31
+ }
@@ -4,3 +4,4 @@
4
4
  @import 'check-switch';
5
5
  @import 'validation';
6
6
  @import 'slider';
7
+ @import 'copy-input';
@@ -21,7 +21,7 @@
21
21
 
22
22
  // Default active color
23
23
  label:not(.valid):not(.invalid) {
24
- textarea, input {
24
+ input {
25
25
  &:focus + span,
26
26
  &:active + span {
27
27
  color: $gray-08;
@@ -30,7 +30,7 @@
30
30
  }
31
31
 
32
32
  // Inputs
33
- textarea, input {
33
+ input {
34
34
  z-index: 1;
35
35
  margin: 0;
36
36
  font-size: inherit;
@@ -50,7 +50,7 @@
50
50
  }
51
51
 
52
52
  &.valid, &.invalid {
53
- textarea, input {
53
+ input {
54
54
  + .placeholder-label-text {
55
55
  color: inherit;
56
56
  }
@@ -60,10 +60,6 @@
60
60
  input {
61
61
  line-height: inherit;
62
62
  }
63
-
64
- textarea {
65
- padding-top: ($padding-y / 2) + 4;
66
- }
67
63
  }
68
64
 
69
65
  // Faux-placeholder labels
@@ -0,0 +1 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="100%" height="100%" viewBox="0 0 294 294" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;"><path d="M0,136.959c0,-28.876 23.444,-52.319 52.32,-52.319c0,0 0,89.854 0,89.854c0,37.036 30.069,67.105 67.105,67.105l89.854,0c0,28.876 -23.444,52.32 -52.32,52.32l-104.639,0c-28.876,0 -52.32,-23.444 -52.32,-52.32l0,-104.64Z" style="fill-opacity:0.529412;"/><path d="M136.959,0c-28.876,0 -52.319,23.444 -52.319,52.32l0,104.639c0,28.876 23.443,52.32 52.319,52.32l104.64,0c28.876,0 52.32,-23.444 52.32,-52.32l0,-104.639c0,-28.876 -23.444,-52.32 -52.32,-52.32l-104.64,0Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path d="M152.89 179.214l-49.78 28.74-53.332-30.792L0 148.42V86.838l53.333-30.792 49.777 28.74 49.777-28.74 53.333 30.792 49.78 28.74v61.584l-53.333 30.792-49.778-28.74zm3.137-6.374v-49.052l42.975 24.635.01 49.27-42.985-24.853zm-99.14.217v-49.27l43.126 24.77.01 49.566-43.135-25.066zM7.11 144.317v-49.27l42.668 24.635.002 49.27-42.67-24.635zm96-51.32l42.67 24.634-42.67 24.635-42.67-24.634 42.67-24.634zm99.557 0l42.668 24.634-42.668 24.635-42.67-24.634 42.67-24.634zM53.333 64.256l42.67 24.634-42.67 24.635-42.67-24.634 42.67-24.634zm99.554 0l42.67 24.634-42.67 24.635-42.67-24.634 42.67-24.634z"/><path d="M6.82 144.547l.023-50 93.295 53.877.04 50.06L6.82 144.547zM155.736 173.024l.14-49.667 43.428 24.894-.045 50.234-43.524-25.46z" fill-opacity=".349"/></svg>
@@ -63,14 +63,26 @@ module Tungsten
63
63
  button(text, options, &block)
64
64
  end
65
65
 
66
- def copy_button(text, target, options={}, &block)
66
+ def copy_button(target, text=nil, options={}, &block)
67
+
68
+ if text.is_a? Hash
69
+ options = text
70
+ text = nil
71
+ end
72
+
67
73
  options[:aria_label] ||= "Copy to clipboard"
68
- options[:class] = "#{options[:class]} has-tooltip".strip
74
+ options[:class] = "#{options[:class]} copy-button has-tooltip".strip
69
75
 
70
76
  options[:data] ||= {}
71
77
  options[:data][:copy_target] = target
72
78
 
73
- button(text, options, &block)
79
+ if text.nil?
80
+ button( text, options ) do
81
+ use_svg 'copy', width: '20px'
82
+ end
83
+ else
84
+ button(text, options, &block)
85
+ end
74
86
  end
75
87
 
76
88
  def button_classes(options)
@@ -6,14 +6,14 @@ module Tungsten
6
6
  if name.nil?
7
7
  deployments
8
8
  else
9
- deployment = deployments.find { |d|
9
+ deployment = deployments.find { |d|
10
10
  d[:name] =~ /#{name}/i || d[:slug] == name
11
11
  }
12
12
 
13
13
  if deployment.nil? && !Rails.env.production?
14
14
  raise %Q{No deployment type "#{name}" exists.}
15
15
  end
16
-
16
+
17
17
  deployment
18
18
  end
19
19
  end
@@ -44,7 +44,8 @@ module Tungsten
44
44
  options[:use][:class] = "deployment-icon-hex #{options[:use][:class]}".strip
45
45
 
46
46
  options[:color] ||= "#fff"
47
- options[:fill] ||= "url(##{data[:name].downcase}-gradient-bg)"
47
+ options[:fill] ||= "none"
48
+ # options[:fill] ||= "url(##{data[:name].downcase}-gradient-bg)"
48
49
  options[:content] ||= deployment_text(data[:short_name], options.delete(:text) || {})
49
50
 
50
51
  deployment_graphic.use(options).html_safe
@@ -1,5 +1,7 @@
1
1
  module Tungsten
2
2
  module FormHelper
3
+ include Tungsten::ButtonHelper
4
+
3
5
  INPUT_OPTIONS = {
4
6
  email: {
5
7
  type: "email",
@@ -364,6 +366,11 @@ module Tungsten
364
366
  value = nil
365
367
  end
366
368
 
369
+ if options.delete(:copy)
370
+ copy_class = "copy-input-#{SecureRandom.hex(8)}"
371
+ copy = copy_button ".#{copy_class}", icon: 'copy'
372
+ end
373
+
367
374
  options = (INPUT_OPTIONS[type]||{}).deep_merge options
368
375
  options[:type] ||= type
369
376
 
@@ -371,7 +378,7 @@ module Tungsten
371
378
  class: "#{label_class(options[:type])} #{options.delete(:class)}"
372
379
  }
373
380
 
374
- if placeholder = options[:placeholder]
381
+ if options[:type] != :textarea && placeholder = options[:placeholder]
375
382
  placeholder = content_tag(:span, class: 'placeholder-label-text') { placeholder }
376
383
  label_options[:class] += ' placeholder-label'
377
384
  end
@@ -380,9 +387,10 @@ module Tungsten
380
387
  label_text = content_tag(:span, class: 'label-text') { label_text }
381
388
  end
382
389
 
390
+ options[:class] = "#{options[:class]} #{copy_class}".strip if copy_class
383
391
  tag = base_tag(name, value, options, type, &block)
384
392
 
385
- content_tag(:label, label_options) {
393
+ label = content_tag(:label, label_options) {
386
394
  concat label_text
387
395
  if type == :select
388
396
  concat tag
@@ -395,6 +403,15 @@ module Tungsten
395
403
  end
396
404
  }
397
405
 
406
+ if copy
407
+ content_tag(:div, class: 'copy-input') {
408
+ concat label
409
+ concat copy
410
+ }
411
+ else
412
+ label
413
+ end
414
+
398
415
  end
399
416
 
400
417
  private
@@ -8,7 +8,10 @@ html
8
8
  = csrf_meta_tags
9
9
 
10
10
  / Page Meta
11
- title = Site.title
11
+ - if @page_title
12
+ title = "#{@page_title} - #{Site.title}"
13
+ - else
14
+ title = Site.title
12
15
  / Referrer
13
16
  meta name="referrer" content="origin"
14
17
 
@@ -1,3 +1,3 @@
1
1
  module Tungsten
2
- VERSION = "0.1.19"
2
+ VERSION = "0.1.20"
3
3
  end
@@ -89,4 +89,4 @@ function move(o){document.documentElement.scrollTop=o,document.body.parentNode.s
89
89
  });
90
90
 
91
91
 
92
- //# sourceMappingURL=/assets/tungsten/code-0.1.19.map.json
92
+ //# sourceMappingURL=/assets/tungsten/code-0.1.20.map.json