nfg_ui 0.10.15.1 → 0.11.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 581c5af7a9dc0ceca8203d5218db98150a39c4dde8e853d93d995475b61de7f1
4
- data.tar.gz: f2b1f8cf195dd7c415932045498d733fd942f48b0f3294fa0513399213a5bbfc
3
+ metadata.gz: 332c555dc58cfd23c4c1620eb247a089e617bce9c4d9425eb134c8294d60b781
4
+ data.tar.gz: 11f734c4d7f450be761e0566b66dd7a5921eaffe64c095f75fc28d00ddd85ea5
5
5
  SHA512:
6
- metadata.gz: 28395e9fe6f2b11fbd3c75a11587c26369c1e237749756183b64721c6f692192310c495b126581066fa43df2c8a749ef727833d6b1087f3a68648495b9ff81b2
7
- data.tar.gz: 79540a95e3942655fae6d3c611c7bf0d1281fb0cb728d7b8a782254eaea19763ebb122b859bda203ea9e93bfef2920d4e9d36fe4000be8099e16d32a3f2391e6
6
+ metadata.gz: 5e211f554ab72b7147ccf0185b945fe347d955ede629a1599b225434d5d31a9c969db0844a43afa230705937ae9c2280f47f5780d2251dee7e57fce57c8b4de8
7
+ data.tar.gz: 22c1f6878558390dcccd8f9ed61f4125141ebf27a3ffe79747895821a705af1b3f008682b2a4726567a2f29b1c76a2003017049474640800ea9d6a1956affb2e
data/README.md CHANGED
@@ -88,6 +88,46 @@ Examples:
88
88
  = ui.nfg :icon, 'trash', class: 'mr-1', text: 'Delete Row'
89
89
  ```
90
90
 
91
+ ## Asset publishing
92
+
93
+ ### Depedency Installation
94
+
95
+ NFG UI assets are published for cross-site usage to a publicly-accessible AWS S3 bucket (`s3://nfg-ui/v#.##.#/`) using the AWS command-line interface:
96
+
97
+ 1. [Install the AWS command-line interface](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-mac.html#cliv2-mac-install-gui)
98
+ 2. Install AWS credentials provided by anyone on the team who has permissions to mint IAM users (such as Mike or Timothy). The credentials are sensitive and should be stored at `~/.aws/credentials`. See example below.
99
+ 3. (Optional but recommended) Install `~/.aws/config` per below to set a default region for S3 operations.
100
+
101
+ ```
102
+ # Example ~/.aws/credentials file
103
+
104
+ [default]
105
+ aws_access_key_id = ####################
106
+ aws_secret_access_key = ########################################
107
+
108
+ # Example ~/.aws/config
109
+ [default]
110
+ region = us-east-1
111
+ ```
112
+
113
+ 4. Use the following command to confirm successful installation:
114
+
115
+ ```
116
+ aws s3 ls --recursive s3://nfg-ui/
117
+ ```
118
+
119
+ ### Workflow
120
+
121
+ After `rake release` successfully completes, the `rake publish` task will run. This command wraps a separate `rake publish` task contained within the `/publisher` subdirectory.
122
+ `/publisher` contains a skeleton Rails app. The `rake publish` task contained within `/publisher` precompiles the assets that are part of the new `nfg_ui` release and uploads them to S3.
123
+
124
+ If necessary, `rake publish` can be invoked from within the `nfg_ui` parent directory, separately:
125
+
126
+ ```
127
+ rake publish # upload assets to S3; fails if files are already exist for the release
128
+ rake publish[override] # uploads assets to S3 without checking for existing files
129
+ ```
130
+
91
131
  #### Trait details
92
132
  Traits are designed to allow you to speedily build components, or pre-design complex components using meaningful symbols.
93
133
 
@@ -190,7 +230,6 @@ Groupings of elements to create rich interfaces. For example, an `:activity_feed
190
230
  * `:media`
191
231
  * `:modal`
192
232
  * `:navbar`
193
- * `:slat_list`
194
233
  * `:task_list`
195
234
  * *Tiles*
196
235
  * `:tile`
@@ -425,7 +464,6 @@ FOUNDATION_COMPONENT_NAMES = %i[color
425
464
  navbar
426
465
  navbar_nav
427
466
  page_header
428
- slat_list [tooltip]
429
467
  tab_content
430
468
  task_list
431
469
  tile [icon, tooltip]
data/Rakefile CHANGED
@@ -15,9 +15,35 @@ RDoc::Task.new(:rdoc) do |rdoc|
15
15
  end
16
16
 
17
17
  APP_RAKEFILE = File.expand_path("spec/test_app/Rakefile", __dir__)
18
- load 'rails/tasks/engine.rake'
19
-
20
18
 
19
+ load 'rails/tasks/engine.rake'
21
20
  load 'rails/tasks/statistics.rake'
22
21
 
23
22
  require 'bundler/gem_tasks'
23
+
24
+ desc <<~DESC
25
+ Publish precompiled assets to s3://nfg-ui. This task is automatically invoked after successful "rake release" and normally it should not be called directly.
26
+ Requires installation of AWS CLI: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html
27
+ Please see additional instructions in README.md.
28
+ DESC
29
+ task :publish, %i[override_flag] do |_, override_flag: nil|
30
+ require 'fileutils'
31
+
32
+ version = Bundler.load_gemspec("#{__dir__}/nfg_ui.gemspec").version
33
+ puts "Compiling and publishing NFG UI v#{version} assets"
34
+
35
+ subtask_args = version.to_s
36
+ subtask_args << ",#{override_flag}" if override_flag
37
+
38
+ Dir.chdir("#{__dir__}/publisher") do
39
+ Bundler.with_clean_env do
40
+ sh "RAILS_ENV=production bundle exec rake publish[#{subtask_args}]" do |ok, _|
41
+ puts 'unable to publish assets' unless ok
42
+ end
43
+ end
44
+ end
45
+ end
46
+
47
+ Rake::Task['release'].enhance do
48
+ Rake::Task['publish'].invoke # runs :publish task after successful release
49
+ end
@@ -1,3 +1,18 @@
1
+ // Slat and its child elements
2
+ .slat {
3
+ display: -ms-flexbox;
4
+ -ms-flex-direction: column;
5
+ -ms-flex-wrap: nowrap;
6
+
7
+ // Nowrap version -- used when the goal is to have all slat-item columns on the same line in smaller screens
8
+ &:not(.slats-nowrap) { // noting the :not() psuedo-class meaning all slats that don't have this class get these styles
9
+ .slat-body {
10
+ @include media-breakpoint-down(sm) { -ms-flex-direction: column; }
11
+ }
12
+ }
13
+ }
14
+
15
+
1
16
  // Slat and its child elements
2
17
  .slat {
3
18
  display: -ms-flexbox;
@@ -5,6 +20,8 @@
5
20
  -ms-flex-wrap: wrap;
6
21
  }
7
22
 
23
+
24
+ // Body Column
8
25
  .slat-body {
9
26
  display: -ms-flexbox;
10
27
  -ms-flex-direction: row;
@@ -12,35 +29,32 @@
12
29
  -ms-flex-positive: 1;
13
30
  -ms-flex-negative: 0;
14
31
  -ms-flex-preferred-size: 0;
32
+ }
15
33
 
16
- .slat-item {
17
- -ms-flex-positive: 1;
18
- -ms-flex-negative: 0;
19
- -ms-flex-preferred-size: 0;
20
- &:first-child {
21
- -ms-flex-positive: 2;
22
34
 
23
- // Sizing options
24
- &.slat-item-sm { -ms-flex-positive: 1; }
25
- &.slat-item-lg { -ms-flex-positive: 6; }
26
- }
27
- }
35
+ // Item Column
36
+ .slat-item {
37
+ -ms-flex-positive: 1;
38
+ -ms-flex-negative: 0;
39
+ -ms-flex-preferred-size: 0;
40
+ &.slat-item-md { -ms-flex-positive: 2; }
41
+ &.slat-item-lg { -ms-flex-positive: 3; }
42
+ &.slat-item-xl { -ms-flex-positive: 4; }
28
43
  }
29
44
 
45
+
46
+ // Action Column
30
47
  .slat-actions {
31
48
  -ms-flex-positive: 0;
32
49
  -ms-flex-negative: 0;
33
- -ms-flex-preferred-size: ($spacer * 1.5);
34
- min-width: ($spacer * 1.5);
35
- @include media-breakpoint-up(sm) {
36
- -ms-flex-preferred-size: ($spacer * 6);
37
- min-width: ($spacer * 6);
50
+ -ms-flex-preferred-size: ($spacer * 2.5);
51
+ min-width: ($spacer * 2.5);
52
+ @include media-breakpoint-up(md) {
53
+ -ms-flex-preferred-size: ($spacer * 5.5);
54
+ min-width: ($spacer * 5.5);
38
55
  }
39
-
40
-
41
- // Sizing options
42
- &.slat-actions-sm { -ms-flex-preferred-size: ($spacer * 1.5); }
43
- &.slat-actions-lg { -ms-flex-preferred-size: ($spacer * 12); }
56
+ .slat-actions-sm & { -ms-flex-preferred-size: ($spacer * 2.5); }
57
+ .slat-actions-lg & { -ms-flex-preferred-size: ($spacer * 5.5); }
44
58
  }
45
59
 
46
60
 
@@ -48,19 +62,3 @@
48
62
  .slat-header {
49
63
  .slat-body { -ms-flex-align: center; }
50
64
  }
51
-
52
-
53
- // Slat list layout
54
- .slat-list {
55
-
56
- // Non-breaked version -- used when the goal is to have all slat-item columns on the same line in smaller screens
57
- &:not(.slat-list-no-break) {
58
- .slat-item {
59
- &:first-child {
60
- @include media-breakpoint-down(sm) {
61
- -ms-flex-preferred-size: 100%;
62
- }
63
- }
64
- }
65
- }
66
- }
@@ -0,0 +1,11 @@
1
+ // Width and height based on viewport
2
+ @each $breakpoint in map-keys($grid-breakpoints) {
3
+ @include media-breakpoint-up($breakpoint) {
4
+ $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
5
+ @each $prop, $abbrev in (width: w, height: h) {
6
+ @each $size, $length in $sizes {
7
+ .#{$abbrev}#{$infix}-#{$size} { #{$prop}: $length !important; }
8
+ }
9
+ }
10
+ }
11
+ }
@@ -1,112 +1,142 @@
1
+ $slat-actions-sm-width: 36px;
2
+ $slat-actions-lg-width: 108px;
3
+
4
+
5
+ // Slat list layout
6
+ .slats {
7
+ display: flex;
8
+ flex-flow: column nowrap;
9
+
10
+ // Nowrap version -- used when the goal is to have all slat-item columns on the same line in smaller screens
11
+ :not(.slats-nowrap) { // noting the :not() psuedo-class meaning all slats that don't have this class get these styles
12
+ .slat-body {
13
+ @include media-breakpoint-down(sm) { flex-direction: column; }
14
+ }
15
+ .slat-item + .slat-item {
16
+ @include media-breakpoint-down(sm) { margin-top: $spacer; }
17
+ }
18
+ }
19
+ }
20
+
21
+
1
22
  // Slat and its child elements
2
23
  .slat {
3
24
  display: flex;
4
25
  flex-flow: row wrap;
26
+ padding-top: $spacer;
27
+ padding-bottom: $spacer;
28
+ + .slat { border-top: $border-width solid $border-color; }
29
+
30
+ // Sizing options
31
+ .slats-sm & {
32
+ padding-top: ($spacer * .5);
33
+ padding-bottom: ($spacer * .5);
34
+ }
35
+ .slats-lg & {
36
+ padding-top: ($spacer * 1.5);
37
+ padding-bottom: ($spacer * 1.5);
38
+ }
39
+
40
+ // Various states
41
+ &.ui-sortable-placeholder {
42
+ visibility: visible !important;
43
+ background: theme-color("light");
44
+ border: $border-width dashed $border-color;
45
+ + .slat { border-top: none; }
46
+ + &.ui-sortable-helper {
47
+ border-top-style: dashed;
48
+ + &.slat { border-top: none; }
49
+ }
50
+ }
51
+ &.ui-sortable-helper {
52
+ border-top: none;
53
+ opacity: .5;
54
+ border-top: none;
55
+ + &.ui-sortable-placeholder { border-top: $border-width dashed $border-color; }
56
+ }
5
57
  }
6
58
 
7
59
 
8
60
  // Body Column
9
61
  .slat-body {
10
62
  display: flex;
11
- flex-flow: row wrap;
63
+ flex-direction: row;
64
+ flex-wrap: wrap;
12
65
  flex: 1 0 0;
13
66
  margin-right: -($grid-gutter-width * .5);
14
67
  margin-left: -($grid-gutter-width * .5);
15
68
  width: 100%;
16
- .slat-item {
17
- flex: 1 0 0;
18
- padding-right: ($grid-gutter-width * .5);
19
- padding-left: ($grid-gutter-width * .5);
20
- width: 100%;
21
- max-width: 100%;
22
- min-height: 1px;
23
- &:first-child {
24
- flex-grow: 2;
25
-
26
- // Sizing options
27
- &.slat-item-sm { flex-grow: 1; }
28
- &.slat-item-lg { flex-grow: 6; }
29
- }
30
- }
69
+
70
+ // max-width needed for when text-truncate is on an element inside
71
+ @include media-breakpoint-down(sm) { max-width: calc(100% - #{$slat-actions-sm-width}); }
72
+ @include media-breakpoint-up(md) { max-width: calc(100% - #{$slat-actions-lg-width}); }
73
+ .slat-actions-sm & { max-width: calc(100% - #{$slat-actions-sm-width}); }
74
+ .slat-actions-lg & { max-width: calc(100% - #{$slat-actions-lg-width}); }
75
+ .slat-actions-none & { max-width: calc(100% + 24px); }
76
+ }
77
+
78
+
79
+ // Shared action and item column
80
+ .slat-item, .slat-actions {
81
+ padding-left: ($grid-gutter-width * .5);
82
+ min-width: 0px;
83
+ word-break: break-word;
84
+ white-space: normal;
85
+ }
86
+
87
+
88
+ // Item Column
89
+ .slat-item {
90
+ flex: 1 0 0;
91
+ padding-right: ($grid-gutter-width * .5);
92
+ width: 100%;
93
+ max-width: 100%;
94
+ &.slat-item-md { flex-grow: 2; }
95
+ &.slat-item-lg { flex-grow: 3; }
96
+ &.slat-item-xl { flex-grow: 4; }
31
97
  }
32
98
 
33
99
 
34
100
  // Action Column
35
101
  .slat-actions {
36
- padding-left: ($grid-gutter-width * .5);
37
- flex: 0 0 ($spacer * 1.5);
38
- width: auto;
39
- max-width: none;
102
+ flex-grow: 0;
103
+ flex-shrink: 0;
104
+ flex-basis: ($spacer * 2.5);
40
105
  text-align: right;
41
- @include media-breakpoint-up(sm) { flex-basis: ($spacer * 6); }
106
+ @include media-breakpoint-up(md) { flex-basis: ($spacer * 5.5); }
107
+ .slat-actions-sm & { flex-basis: ($spacer * 2.5); }
108
+ .slat-actions-lg & { flex-basis: ($spacer * 5.5); }
109
+ }
42
110
 
43
111
 
44
- // Sizing options
45
- &.slat-actions-sm { flex-basis: ($spacer * 1.5); }
46
- &.slat-actions-lg { flex-basis: ($spacer * 12); }
112
+ // Action dropdown text (ex: "Actions") used for default action dropdown behavior
113
+ .slat-actions-text {
114
+ @include media-breakpoint-down(sm) { display: none; }
115
+ @include media-breakpoint-up(md) {
116
+ display: inline-block;
117
+ margin-right: ($spacer * .25);
118
+ }
119
+ .slat-actions-lg & { // always show text on :lg slat-actions
120
+ display: inline-block;
121
+ margin-right: ($spacer * .25);
122
+ }
123
+ .slat-actions-sm & { display: none; } // always hide text on :sm slat-actions
124
+ + .fa.ml-1 { margin-left: 0 !important; } // hides default margin on icons in buttons on smaller device
47
125
  }
48
126
 
49
127
 
50
128
  // Slat header
51
129
  .slat-header {
52
130
  padding-bottom: ($spacer * .5);
131
+ border-bottom: $border-width solid $border-color;
132
+ .slat { padding: 0 !important; }
53
133
  .slat-body { align-items: center; }
54
- }
55
-
56
-
57
- // Slat list layout
58
- .slat-list {
59
- border-top: $border-width solid $border-color;
60
- .slat {
61
- padding-top: $spacer;
62
- padding-bottom: $spacer;
63
- + .slat { border-top: $border-width solid $border-color; }
64
-
65
-
66
- // Various states
67
- &.ui-sortable-placeholder {
68
- visibility: visible !important;
69
- background: theme-color("light");
70
- border: $border-width dashed $border-color;
71
- + .slat { border-top: none; }
72
- + &.ui-sortable-helper {
73
- border-top-style: dashed;
74
- + &.slat { border-top: none; }
75
- }
76
- }
77
- &.ui-sortable-helper {
78
- border-top: none;
79
- opacity: .5;
80
- border-top: none;
81
- + &.ui-sortable-placeholder { border-top: $border-width dashed $border-color; }
82
- }
83
- }
134
+ .slat-column-header { display: inline-block; }
84
135
 
85
-
86
- // Sizing options
87
- &.slat-list-sm {
88
- .slat {
89
- padding-top: ($spacer * .5);
90
- padding-bottom: ($spacer * .5);
91
- }
92
- }
93
- &.slat-list-lg {
94
- .slat {
95
- padding-top: ($spacer * 1.5);
96
- padding-bottom: ($spacer * 1.5);
97
- }
98
- }
136
+ }
99
137
 
100
138
 
101
- // Non-breaked version -- used when the goal is to have all slat-item columns on the same line in smaller screens
102
- &:not(.slat-list-no-break) {
103
- .slat-item {
104
- &:first-child {
105
- @include media-breakpoint-down(sm) {
106
- flex-basis: 100%;
107
- margin-bottom: $spacer;
108
- }
109
- }
110
- }
111
- }
139
+ // Slat column headers -- any .slat-column-header not in .slat-header displays none on larger devices
140
+ .slat-column-header {
141
+ @include media-breakpoint-up(md) { display: none; }
112
142
  }
@@ -6,7 +6,7 @@
6
6
  background-size: cover;
7
7
  @include media-breakpoint-down(md) {
8
8
  background-image: none !important;
9
- .card { box-shadow: none; }
9
+ .card { box-shadow: none !important; }
10
10
  .card-body { padding: 0; }
11
11
  }
12
12
  @include media-breakpoint-up(lg) { min-height: 500px; }
@@ -168,7 +168,6 @@ module NfgUi
168
168
  slat
169
169
  slat_actions
170
170
  slat_header
171
- slat_list
172
171
  slats
173
172
  steps
174
173
  tab_content
@@ -21,7 +21,7 @@ module NfgUi
21
21
  def render
22
22
  content_tag(as, html_options) do
23
23
  if image.present?
24
- image_tag image, alt: alt.presence
24
+ image_tag view_context.image_path(image), alt: alt.presence
25
25
  elsif body.present?
26
26
  content_tag(:span, (block_given? ? yield : body), class: body_css_class)
27
27
  end
@@ -24,13 +24,13 @@ module NfgUi
24
24
  end
25
25
 
26
26
  def render
27
- super do
27
+ content_tag(base_element, slat_item_html_options) do
28
28
  if slat_header
29
- concat(content_tag(:h6, slat_header, class: 'display-4'))
29
+ concat(content_tag(:h6, slat_header, class: 'display-4 slat-column-header'))
30
30
  end
31
31
  if heading
32
32
  if href
33
- concat(content_tag(:a, href: href) {
33
+ concat(content_tag(:a, href: view_context.url_for(href)) {
34
34
  NfgUi::Components::Foundations::Typeface.new({ subheading: heading }, view_context).render
35
35
  })
36
36
  else
@@ -46,11 +46,16 @@ module NfgUi
46
46
 
47
47
  private
48
48
 
49
- def css_classes
50
- [
51
- super,
52
- ('text-word-wrap' if size == :lg)
53
- ]
49
+ # Strip the href from html_options and pass it to the header
50
+ def slat_item_html_options
51
+ html_options.except(:href)
52
+ end
53
+
54
+ # :sm is the default size, and is not given
55
+ # a `slat-item-sm` class name.
56
+ # thus, reject :sm from resizable symbols.
57
+ def resized?
58
+ [:md, :lg, :xl].include?(size)
54
59
  end
55
60
 
56
61
  def non_html_attribute_options
@@ -28,38 +28,15 @@ module NfgUi
28
28
  options.fetch(:menu, true)
29
29
  end
30
30
 
31
- # Signal if this slat_action is being used
32
- # In the slat_header area of the Slats
33
- #
34
- # If so, this then customizes the output of the
35
- # SlatActions to ensure that the widths of the slat_header columns
36
- # is accurate and matches the width of the slats below.
37
- def slat_header
38
- options.fetch(:slat_header, false)
39
- end
40
-
41
- # Signals if this is a wide SlatActions.
42
- # This is a stylistic update which is used in situations like shopping carts where
43
- # you may only be providing a summary and have no actions or extra columns.
44
- #
45
- # Note: Further documentation is needed on this
46
- def wide
47
- options.fetch(:wide, true)
48
- end
49
-
50
31
  def render
51
32
  content_tag(:div, html_options) do
52
33
  if menu
53
- if slat_header
54
- content_tag(:h6, "&nbsp;".html_safe, class: 'display-4')
55
- else
56
- NfgUi::Components::Patterns::Dropdown.new({ }, view_context).render do
57
- capture do
58
- concat(NfgUi::Components::Elements::DropdownToggle.new({ **default_dropdown_toggle_options, body: ('Actions' if wide)}, view_context).render)
59
- concat(NfgUi::Components::Patterns::DropdownMenu.new({ traits: [:right] }, view_context).render {
60
- (block_given? ? yield : body)
61
- })
62
- end
34
+ NfgUi::Components::Patterns::Dropdown.new({ }, view_context).render do
35
+ capture do
36
+ concat(NfgUi::Components::Elements::DropdownToggle.new({ **default_dropdown_toggle_options, body: dropdown_toggle_body }, view_context).render)
37
+ concat(NfgUi::Components::Patterns::DropdownMenu.new({ traits: [:right] }, view_context).render {
38
+ (block_given? ? yield : body)
39
+ })
63
40
  end
64
41
  end
65
42
  else
@@ -76,15 +53,12 @@ module NfgUi
76
53
  { outlined: true, theme: :secondary }
77
54
  end
78
55
 
79
- def css_classes
80
- [
81
- super,
82
- ("#{component_css_class}-sm" unless wide)
83
- ].join(' ').squish
56
+ def dropdown_toggle_body
57
+ content_tag(:span, 'Actions', class: 'slat-actions-text')
84
58
  end
85
59
 
86
60
  def non_html_attribute_options
87
- super.push(:slat_header, :wide, :menu)
61
+ super.push(:menu)
88
62
  end
89
63
  end
90
64
  end
@@ -5,9 +5,69 @@ module NfgUi
5
5
  module Patterns
6
6
  # Main slats
7
7
  class Slats < NfgUi::Components::Base
8
+ include Bootstrap::Utilities::Sizable
9
+
10
+ include NfgUi::Components::Traits::Size
11
+ include NfgUi::Components::Traits::Slats
12
+
8
13
  def component_family
9
14
  :slats
10
15
  end
16
+
17
+ # When :nowrap is true,
18
+ # the slat-item columns will not break into rows
19
+ # regardless of responsive page width
20
+ #
21
+ # When false / not present
22
+ # slat item columns will break down into rows as expected in conventional
23
+ # responsivel webpage design.
24
+ def nowrap
25
+ options.fetch(:nowrap, false)
26
+ end
27
+
28
+ # Determine whether or not to accomodate a specific
29
+ # SlatActions size configuration
30
+ # by default, when slat_actions is not set
31
+ # it should have a nil presence
32
+ #
33
+ # Note:
34
+ # `nil` is different from the :none keyword
35
+ #
36
+ # Options:
37
+ # :sm - account for a small SlatAction (icon only)
38
+ # :lg - account for a large SlatAction (Text & Icon)
39
+ # :none - Do not account for a SlatAction
40
+ #
41
+ # Leaving `nil` for slat_actions will kick off
42
+ # default behavior for the Slats' SlatAction
43
+ # which is a combination of :lg (for large screen)
44
+ # and :sm for small screen (where the slat action flexes)
45
+ # across screen sizes hiding and showing its text
46
+ def slat_actions
47
+ options[:slat_actions] || nil
48
+ end
49
+
50
+ private
51
+
52
+ def css_classes
53
+ [
54
+ super,
55
+ ("#{component_css_class}-nowrap" if nowrap),
56
+ ("slat-actions-#{slat_actions}" if slat_actions_resized?)
57
+ ].join(' ').squish
58
+ end
59
+
60
+ # Only acceptable keywords are:
61
+ # :sm, :lg, and :none
62
+ # all other slat_action keywords are ignored
63
+ def slat_actions_resized?
64
+ [:sm, :lg, :none].include?(slat_actions)
65
+ end
66
+
67
+ def non_html_attribute_options
68
+ super.push(:slat_actions, :nowrap)
69
+ end
70
+
11
71
  end
12
72
  end
13
73
  end
@@ -29,6 +29,7 @@ module NfgUi
29
29
  Responsive
30
30
  Size
31
31
  Step
32
+ Slats
32
33
  SlatItem
33
34
  Table
34
35
  Theme
@@ -0,0 +1,26 @@
1
+ module NfgUi
2
+ module Components
3
+ module Traits
4
+ # Step traits
5
+ module Slats
6
+ TRAITS = %i[slat_actions_sm slat_actions_lg slat_actions_none nowrap].freeze
7
+
8
+ def nowrap_trait
9
+ options[:nowrap] = true
10
+ end
11
+
12
+ def slat_actions_sm_trait
13
+ options[:slat_actions] = :sm
14
+ end
15
+
16
+ def slat_actions_lg_trait
17
+ options[:slat_actions] = :lg
18
+ end
19
+
20
+ def slat_actions_none_trait
21
+ options[:slat_actions] = :none
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NfgUi
4
- VERSION = '0.10.15.1'
4
+ VERSION = '0.11.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nfg_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.15.1
4
+ version: 0.11.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Roehm
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-08-13 00:00:00.000000000 Z
12
+ date: 2020-10-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bootstrap
@@ -495,6 +495,7 @@ files:
495
495
  - app/assets/stylesheets/nfg_ui/network_for_good/core/nfg_theme/_nav.scss
496
496
  - app/assets/stylesheets/nfg_ui/network_for_good/core/nfg_theme/_progress.scss
497
497
  - app/assets/stylesheets/nfg_ui/network_for_good/core/nfg_theme/_reboot.scss
498
+ - app/assets/stylesheets/nfg_ui/network_for_good/core/nfg_theme/_sizing.scss
498
499
  - app/assets/stylesheets/nfg_ui/network_for_good/core/nfg_theme/_tooltip.scss
499
500
  - app/assets/stylesheets/nfg_ui/network_for_good/core/nfg_theme/_type.scss
500
501
  - app/assets/stylesheets/nfg_ui/network_for_good/core/nfg_theme/custom/_avatar.scss
@@ -717,7 +718,6 @@ files:
717
718
  - lib/nfg_ui/components/patterns/slat.rb
718
719
  - lib/nfg_ui/components/patterns/slat_actions.rb
719
720
  - lib/nfg_ui/components/patterns/slat_header.rb
720
- - lib/nfg_ui/components/patterns/slat_list.rb
721
721
  - lib/nfg_ui/components/patterns/slats.rb
722
722
  - lib/nfg_ui/components/patterns/steps.rb
723
723
  - lib/nfg_ui/components/patterns/tab_content.rb
@@ -751,6 +751,7 @@ files:
751
751
  - lib/nfg_ui/components/traits/responsive.rb
752
752
  - lib/nfg_ui/components/traits/size.rb
753
753
  - lib/nfg_ui/components/traits/slat_item.rb
754
+ - lib/nfg_ui/components/traits/slats.rb
754
755
  - lib/nfg_ui/components/traits/step.rb
755
756
  - lib/nfg_ui/components/traits/table.rb
756
757
  - lib/nfg_ui/components/traits/theme.rb
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module NfgUi
4
- module Components
5
- module Patterns
6
- # SlatList doc coming soon
7
- class SlatList < NfgUi::Components::Base
8
- include Bootstrap::Utilities::Sizable
9
-
10
- include NfgUi::Components::Traits::Size
11
-
12
- def component_family
13
- :slats
14
- end
15
- end
16
- end
17
- end
18
- end