fleetio_spark 1.1.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/spark/components/_index.scss +1 -0
  3. data/app/assets/stylesheets/spark/components/app/_header.scss +1 -5
  4. data/app/assets/stylesheets/spark/components/nav/_tabs.scss +3 -13
  5. data/app/assets/stylesheets/spark/components/structure/_block.scss +1 -5
  6. data/app/assets/stylesheets/spark/components/structure/_card.scss +6 -3
  7. data/app/assets/stylesheets/spark/components/structure/_table.scss +165 -0
  8. data/app/assets/stylesheets/spark/core/_mixins.scss +14 -0
  9. data/app/assets/stylesheets/spark/core/_text.scss +8 -0
  10. data/app/assets/stylesheets/spark/core/_vars.scss +6 -0
  11. data/app/components/spark/card.html.slim +4 -3
  12. data/app/components/spark/card.rb +13 -2
  13. data/app/components/spark/checklist/item.rb +0 -1
  14. data/app/components/spark/grid/column.rb +1 -5
  15. data/app/components/spark/table/cell.html.slim +1 -0
  16. data/app/components/spark/table/cell.rb +30 -0
  17. data/app/components/spark/table/detail.rb +19 -0
  18. data/app/components/spark/table/object.html.slim +5 -0
  19. data/app/components/spark/table/object.rb +29 -0
  20. data/app/components/spark/table/row.html.slim +4 -0
  21. data/app/components/spark/table/row.rb +32 -0
  22. data/app/components/spark/table.html.slim +15 -0
  23. data/app/components/spark/table.rb +23 -0
  24. data/lib/fleetio_spark/version.rb +1 -1
  25. data/public/{code-1.1.2.js → code-1.2.0.js} +1 -1
  26. data/public/{code-1.1.2.js.gz → code-1.2.0.js.gz} +0 -0
  27. data/public/{code-1.1.2.js.map → code-1.2.0.js.map} +1 -1
  28. data/public/spark-1.2.0.css +1 -0
  29. data/public/spark-1.2.0.css.gz +0 -0
  30. data/public/{spark-1.1.2.js → spark-1.2.0.js} +1 -1
  31. data/public/{spark-1.1.2.js.gz → spark-1.2.0.js.gz} +0 -0
  32. data/public/{spark-1.1.2.js.map → spark-1.2.0.js.map} +1 -1
  33. metadata +36 -15
  34. data/app/components/spark/toolbar.rb +0 -10
  35. data/public/code-1.1.0.js +0 -15417
  36. data/public/spark-1.1.0.js +0 -5750
  37. data/public/spark-1.1.2.css +0 -1
  38. data/public/spark-1.1.2.css.gz +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e004d6de667f1feec14d7d0a19be03067c5568b568490f27a6dc9882bc351be8
4
- data.tar.gz: c66e87d404474a0894f66676e85def933ff094679175c087cc33afc72a524942
3
+ metadata.gz: ac3ce4d5887911648b62eca73dac54a5bc03a9315ff2878b6b587494237c60a9
4
+ data.tar.gz: a3ce38b4893c54df7e9a9f89f587b215015efe0acf18501b42cea30aeb4e39a6
5
5
  SHA512:
6
- metadata.gz: c3bfbd6f25492a9068ed858fa4383019f5e44ac7ba71ffb8e5de201629a7e7d56f2ca88be38e33f70749b732943ab3651d0b121f31919fd777b574dce9e45a24
7
- data.tar.gz: b604ba201842568d014b2b1732d58c43b97706067cab5721d0269b1173dd54d6146197e067e93610fb980dee8317a58800b633bdd6aed9fd5c6ce56ebf4f0e9e
6
+ metadata.gz: 1df661bb4274f5aa84c584fb5c68b5ef04b786d98e9a02d5bca02f56af5eb35741f5110821eede45cb64dfddee6a69a7ef76fb18e31c8743293d47021afad779
7
+ data.tar.gz: a5f113d846cb00d52294d99b08221b45ef93ba4bd28d109a521621ffc70fd6e709d194621add18779b5aa30e137d62d6f6ac6f68bc0a57fcd4e3218082e6cb7e
@@ -25,6 +25,7 @@
25
25
  @import "structure/sticky_panel";
26
26
  @import "structure/card";
27
27
  @import "structure/widget_card";
28
+ @import "structure/table";
28
29
 
29
30
  @import "nav/item";
30
31
  @import "nav/tabs";
@@ -6,11 +6,7 @@
6
6
  line-height: $base-line-height;
7
7
  height: $app-header-height;
8
8
  position: absolute;
9
- padding: 0 $pad-base;
10
-
11
- @include at-least($width-base) {
12
- padding: 0 $pad-lg;
13
- }
9
+ @include layout-padded($vpad: 0);
14
10
 
15
11
  // When sidebar is present and visible
16
12
  // header should be the full width minus the sidebar width
@@ -32,13 +32,10 @@
32
32
  .nav-toggle {
33
33
  width: 100%;
34
34
  background: $fl-white;
35
- padding: $pad-xs $pad-base;
36
35
  display: none;
37
36
  margin: -1px 0 0;
38
37
 
39
- @include at-least($width-base) {
40
- padding: $pad-xs $pad-lg;
41
- }
38
+ @include layout-padded($vpad: $pad-xs);
42
39
 
43
40
  &-icon {
44
41
  margin-right: -$pad-base;
@@ -95,12 +92,9 @@
95
92
  }
96
93
 
97
94
  .nav-item {
98
- padding: 0 $pad-base;
99
95
  transition: padding $duration cubic-bezier(0.47, 0, 0.745, 0.715);
100
96
  border-bottom: 1px solid $fl-gray-100;
101
- @include at-least($width-base) {
102
- padding: 0 $pad-lg;
103
- }
97
+ @include layout-padded($vpad: 0);
104
98
  }
105
99
 
106
100
  // Hide all nav elements but the active one.
@@ -134,11 +128,7 @@
134
128
  }
135
129
 
136
130
  .nav-item {
137
- padding: ($pad-base + 1) $pad-base;
138
-
139
- @include at-least($width-base) {
140
- padding: ($pad-base + 1) $pad-lg;
141
- }
131
+ @include layout-padded($vpad: $pad-base + 1);
142
132
 
143
133
  &:hover, &:focus {
144
134
  background-color: $fl-gray-50;
@@ -9,11 +9,7 @@
9
9
  }
10
10
 
11
11
  &.layout-padded {
12
- padding: 8px 8px;
13
-
14
- @include at-least($width-base) {
15
- padding: 8px 16px;
16
- }
12
+ @include layout-padded;
17
13
  }
18
14
 
19
15
  @each $label, $size in $gutter-sizes {
@@ -6,21 +6,24 @@
6
6
  background: $fl-white;
7
7
  border-radius: $radius-md;
8
8
  border-color: $fl-gray-100;
9
- padding-bottom: $pad-lg;
10
9
  box-shadow: $card-shadow;
10
+ width: 100%;
11
11
 
12
12
  &-content {
13
13
  font-size: $base-size;
14
- padding: $pad-md $pad-lg;
14
+
15
+ &.layout-padded {
16
+ @include layout-padded($pad-md);
17
+ }
15
18
  }
16
19
  }
17
20
 
18
21
  .spark-card-header {
19
- padding: $pad-md $pad-lg;
20
22
  font-size: 14px;
21
23
  font-weight: 600;
22
24
  display: flex;
23
25
  justify-content: space-between;
26
+ border-bottom: 1px solid $fl-gray-50;
24
27
 
25
28
  &-title {
26
29
  display: flex;
@@ -0,0 +1,165 @@
1
+ $cell-sizes: (
2
+ xs: 1%,
3
+ small: 10%,
4
+ base: 20%,
5
+ medium: 30%,
6
+ large: 40%,
7
+ xl: 50%,
8
+ max: 100%
9
+ );
10
+
11
+ .spark-table {
12
+ border-spacing: 0;
13
+ border-collapse: collapse;
14
+ font-size: 13px;
15
+ max-width: 100%;
16
+ width: 100%;
17
+
18
+ thead {
19
+ border-bottom: 1px solid $fl-gray-50;
20
+ }
21
+
22
+ &-subhead {
23
+ background: $fl-gray-25;
24
+ }
25
+
26
+ th,
27
+ td {
28
+ border: none;
29
+ border-top: 1px solid $fl-gray-50;
30
+ text-align: left;
31
+ vertical-align: top;
32
+ @include layout-padded($vpad: $pad-md);
33
+
34
+ &:not(:first-child) {
35
+ padding-left: $pad-base;
36
+ }
37
+ &:not(:last-child) {
38
+ padding-right: $pad-base;
39
+ }
40
+
41
+ @each $value in $align {
42
+ &[data-align="#{$value}"] {
43
+ text-align: $value;
44
+ }
45
+ }
46
+
47
+ @each $value in $v-align {
48
+ &[data-v-align="#{$value}"] {
49
+ vertical-align: $value;
50
+ }
51
+ }
52
+
53
+ &.nowrap {
54
+ white-space: nowrap;
55
+ }
56
+
57
+ @each $size-name, $size in $cell-sizes {
58
+ &[data-size="#{$size-name}"] {
59
+ width: $size;
60
+ }
61
+ }
62
+ }
63
+
64
+ th {
65
+ font-weight: 500;
66
+ }
67
+
68
+ thead,
69
+ tbody {
70
+ tr:first-child {
71
+ th,
72
+ td {
73
+ border-top: none;
74
+ }
75
+ }
76
+ }
77
+
78
+ tbody[data-link="row"] {
79
+ tr {
80
+ &:hover {
81
+ background-color: $fl-gray-25;
82
+ cursor: pointer;
83
+ }
84
+
85
+ &:first-child {
86
+ td:first-child {
87
+ border-top-left-radius: $radius-md;
88
+ }
89
+ &:last-child {
90
+ border-top-right-radius: $radius-md;
91
+ }
92
+ }
93
+
94
+ &:last-child {
95
+ td:first-child {
96
+ border-bottom-left-radius: $radius-md;
97
+ }
98
+ td:last-child {
99
+ border-bottom-right-radius: $radius-md;
100
+ }
101
+ }
102
+ }
103
+ }
104
+
105
+ thead ~ tbody[data-link="row"] {
106
+ tr:first-child {
107
+ td:first-child {
108
+ border-top-left-radius: 0;
109
+ }
110
+ td:last-child {
111
+ border-top-right-radius: 0;
112
+ }
113
+ }
114
+ }
115
+
116
+ // Need to revisit, supporting bootstrap attachment class
117
+ tbody {
118
+ .attachments {
119
+ span {
120
+ background-color: $fl-white;
121
+ display: inline-block;
122
+ border: 1px solid $fl-gray-100;
123
+ border-radius: $radius-base;
124
+ padding: 0 $pad-sm;
125
+ margin-top: 3px;
126
+ color: $fl-gray-600;
127
+ min-width: 30px;
128
+ text-align: center;
129
+
130
+ > i {
131
+ font-size: 12px;
132
+ }
133
+
134
+ + span {
135
+ margin-left: $pad-xs;
136
+ }
137
+ }
138
+ }
139
+ }
140
+
141
+ &-detail {
142
+ tbody {
143
+ tr {
144
+ th {
145
+ text-align: right;
146
+ width: 37%;
147
+ }
148
+ }
149
+ }
150
+ }
151
+ }
152
+
153
+ @include until($width-base) {
154
+ .spark-table-wrapper {
155
+ width: 100%;
156
+ overflow-x: auto;
157
+ overflow-y: hidden;
158
+
159
+ tbody {
160
+ td {
161
+ white-space: nowrap;
162
+ }
163
+ }
164
+ }
165
+ }
@@ -102,3 +102,17 @@
102
102
  margin-bottom: 0;
103
103
  }
104
104
  }
105
+
106
+ @mixin layout-padded($vpad: $pad-base) {
107
+ padding: $vpad;
108
+
109
+ @include responsive-padding;
110
+ }
111
+
112
+ @mixin responsive-padding {
113
+ padding: { left: $pad-base; right: $pad-base; }
114
+
115
+ @include at-least($width-base) {
116
+ padding: { left: $pad-lg; right: $pad-lg; }
117
+ }
118
+ }
@@ -2,3 +2,11 @@ body {
2
2
  font-family: $base-font;
3
3
  color: $base-text-color;
4
4
  }
5
+
6
+ a {
7
+ color: $link-color;
8
+
9
+ &:hover {
10
+ color: $link-hover-color;
11
+ }
12
+ }
@@ -99,3 +99,9 @@ $card-shadow: 0px 1px 2px -2px rgba(0,0,0,0.1),
99
99
 
100
100
  // Gutters
101
101
  $gutter-sizes : ['base', $pad-base], ['small', $pad-sm], ['medium', $pad-md], ['large', $pad-lg], ['xl', $pad-xl];
102
+
103
+ // Vertical Alignment
104
+ $v-align : top, middle, bottom;
105
+
106
+ // Text Alignment
107
+ $align : left, center, right;
@@ -2,6 +2,7 @@ div *tag_attrs
2
2
  - if header
3
3
  - header.classname.add("spark-card-header")
4
4
  = header.yield
5
- - if body
6
- .spark-card-content
7
- = body.yield
5
+ - if body.present?
6
+ - bodies.each do |body|
7
+ .spark-card-content *body.tag_attrs
8
+ = body.yield
@@ -1,9 +1,20 @@
1
1
  module Spark
2
2
  class Card < Spark::Component::Base
3
+ LAYOUT = %i[flush padded].freeze
3
4
 
4
- element :header, component: Spark::Block
5
+ element :header, component: Spark::Block do
6
+ attribute layout: :padded
7
+ end
8
+
9
+ element :body, multiple: true do
10
+ attribute layout: :padded
11
+ validates_attr :layout, choices: LAYOUT
5
12
 
6
- element :body
13
+ def initialize(*)
14
+ super
15
+ classname.add("layout-#{@layout}")
16
+ end
17
+ end
7
18
 
8
19
  def initialize(*)
9
20
  super
@@ -4,7 +4,6 @@ module Spark
4
4
  attribute :href, :target, :icon, :action_text, :text, completed: false
5
5
 
6
6
  validates_attr :href, presence: true
7
- validates_attr :icon, presence: true
8
7
  validates_attr :action_text, presence: true
9
8
  validates_attr :text, presence: true
10
9
  validates_attr :completed, inclusion: [true, false]
@@ -5,18 +5,14 @@ module Spark
5
5
  SPAN = [*(1..12), *SPAN_NAME.keys].freeze
6
6
  OFFSET = [*(1..11), *SPAN_NAME.keys].freeze
7
7
 
8
- attribute :span, :offset
8
+ data_attribute :span, :offset
9
9
 
10
10
  validates_attr :span, choices: SPAN, allow_nil: true
11
11
  validates_attr :offset, choices: OFFSET, allow_nil: true
12
12
 
13
13
  def initialize(*)
14
14
  super
15
- data.add span: span_name(@span) || 0
16
- data.add offset: span_name(@offset) if @offset
17
-
18
15
  classname.base = "spark-grid-column"
19
-
20
16
  end
21
17
 
22
18
  def span_name(size)
@@ -0,0 +1 @@
1
+ = content_tag(_name, content, tag_attrs)
@@ -0,0 +1,30 @@
1
+ module Spark
2
+ class Table
3
+ class Cell < Spark::Component::Base
4
+ SCOPE = %i[col row colgroup rowgroup]
5
+ SIZES = %i[xs small base medium large xl max]
6
+
7
+ attribute :rowlink_skip, :nowrap, :fit
8
+ tag_attribute :scope
9
+ data_attribute :align, :v_align, :size
10
+
11
+ attribute_default_group(fit: {
12
+ true: {
13
+ nowrap: true,
14
+ size: :xs
15
+ }
16
+ })
17
+
18
+ validates_attr :scope, choices: SCOPE, allow_nil: true
19
+ validates_attr :align, choices: Spark::Table::Row::ALIGN, allow_nil: true
20
+ validates_attr :v_align, choices: Spark::Table::Row::VALIGN, allow_nil: true
21
+ validates_attr :size, choices: SIZES, allow_nil: true
22
+
23
+ def initialize(*)
24
+ super
25
+ classname.add("nowrap") if @nowrap
26
+ classname.add("rowlink-skip") if @rowlink_skip
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,19 @@
1
+ module Spark
2
+ class Table
3
+ class Detail < Spark::Table
4
+ inherit_template
5
+ tag_attribute class: "spark-table-detail"
6
+
7
+ element :object, multiple: true, component: Spark::Table::Object do
8
+ def initialize(*)
9
+ super
10
+ _parent.rows << self
11
+ end
12
+ end
13
+
14
+ def initialize(*)
15
+ super
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,5 @@
1
+ tr *tag_attrs
2
+ th *title_attrs
3
+ = @title || title.yield
4
+ td *value_attrs
5
+ = value.present? ? value.yield : @content
@@ -0,0 +1,29 @@
1
+ module Spark
2
+ class Table
3
+ class Object < Spark::Component::Base
4
+ attribute :title
5
+
6
+ # Require attribute title unless title element was passed
7
+ validates_attr :title, presence: true, unless: -> { title.present? }
8
+
9
+ element :title
10
+ element :value
11
+
12
+ def initialize(*)
13
+ super
14
+ end
15
+
16
+ def title_attrs
17
+ obj = title.present? ? title.tag_attrs : TagAttr.new
18
+ obj.add scope: :row
19
+ obj.classname.add "spark-table-detail-title"
20
+ end
21
+
22
+ def value_attrs
23
+ obj = value.present? ? value.tag_attrs : TagAttr.new
24
+ obj.classname.add "spark-table-detail-value"
25
+ obj
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,4 @@
1
+ tr *tag_attrs
2
+ - tds.each do |td|
3
+ - td.tag_attrs.classname.add("rowlink-skip") if @rowlink_skip
4
+ = td.yield
@@ -0,0 +1,32 @@
1
+ module Spark
2
+ class Table
3
+ class Row < Spark::Component::Base
4
+ ALIGN = %i[left center right]
5
+ VALIGN = %i[top middle bottom]
6
+
7
+ attribute :align, :v_align, :nowrap
8
+
9
+ validates_attr :align, choices: ALIGN, allow_nil: true
10
+ validates_attr :v_align, choices: VALIGN, allow_nil: true
11
+
12
+ element :td, multiple: true, component: Spark::Table::Cell do
13
+ def initialize(*)
14
+ super
15
+ end
16
+ end
17
+
18
+ element :th, multiple: true, component: Spark::Table::Cell do
19
+ def initialize(*)
20
+ super
21
+ _parent.tds << self
22
+ end
23
+ end
24
+
25
+ def initialize(*)
26
+ super
27
+ set_element_attribute_default(:td, align: @align, v_align: @v_align, nowrap: @nowrap)
28
+ set_element_attribute_default(:th, align: @align, v_align: @v_align, nowrap: @nowrap)
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,15 @@
1
+ .spark-table-wrapper
2
+ table *tag_attrs
3
+ - if header
4
+ thead
5
+ = header.yield
6
+ - if rows.present?
7
+ - rowlink_data = @rowlink ? { data: { link: "row" }} : {}
8
+ tbody *rowlink_data
9
+ - rows.each do |row|
10
+ - if row._name == :row_partial
11
+ = row.yield
12
+ - elsif row._name == :subhead
13
+ td *row.tag_attrs colspan="100" = row.yield
14
+ - else
15
+ = row.yield
@@ -0,0 +1,23 @@
1
+ module Spark
2
+ class Table < Spark::Component::Base
3
+ THEME = %i[default detail].freeze
4
+ attribute :rowlink
5
+
6
+ element :header, component: Spark::Table::Row
7
+ element :row, multiple: true, component: Spark::Table::Row
8
+ element :subhead, multiple: true do
9
+ tag_attribute scope: :colgroup
10
+ def initialize(*)
11
+ super
12
+ _parent.rows << self
13
+ classname.add("spark-table-subhead")
14
+ end
15
+ end
16
+
17
+ def initialize(*)
18
+ super
19
+
20
+ classname.add("spark-table")
21
+ end
22
+ end
23
+ end
@@ -1,3 +1,3 @@
1
1
  module FleetioSpark
2
- VERSION = "1.1.2"
2
+ VERSION = "1.2.0"
3
3
  end