innoq-ui-components 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e9eaaac4837558420ad1cfef85a9897ba005224ad68017128e0f33475012af12
4
+ data.tar.gz: bde213cda510475b42b80dfd59154bcdd481e2fe8ef6cc34d7288bafda8d58d4
5
+ SHA512:
6
+ metadata.gz: 33a4264d0065263c3fe099fe7b656f377270fec6710c1913cd3e3b0e61f04cf5de8364dd5ba7c0267036472a4ebd68b46ecef64c4de7173457611e2c28ccdf75
7
+ data.tar.gz: bf3bcf825469df6bf6f87f9e6e6aa3ec304dbd57335a6d80e62835129a16545db4d9820f4b870cedb506299caf46f1484426e3758f86c9a3a28c21b79a864344
@@ -0,0 +1,33 @@
1
+ # Example Project for Software Architecture Summit
2
+
3
+ Example project for [our talk at Software Architecture
4
+ Summit](https://software-architecture-summit.de/softwarearchitektur/moderne-frontend-entwicklung/).
5
+ The main objective is to show component-based development. We will also show
6
+ some of our favorite tools:
7
+
8
+ * complate
9
+ * faucet
10
+ * aiur
11
+ * eslint
12
+ * stylelint
13
+ * prettier
14
+ * tabelle
15
+ * Custom Elements
16
+
17
+ ## Setup
18
+
19
+ [Install Node.js](https://nodejs.org/en/download/)
20
+
21
+ In this directory run:
22
+
23
+ ```
24
+ npm i
25
+ ```
26
+
27
+ Now you need to run:
28
+
29
+ ```
30
+ npm start
31
+ ```
32
+
33
+ Visit http://localhost:3000 to visit the app, and http://localhost:4001 to visit the pattern library.
@@ -0,0 +1,27 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Innoq::Ui::Components'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ require 'bundler/gem_tasks'
18
+
19
+ require 'rake/testtask'
20
+
21
+ Rake::TestTask.new(:test) do |t|
22
+ t.libs << 'test'
23
+ t.pattern = 'test/**/*_test.rb'
24
+ t.verbose = false
25
+ end
26
+
27
+ task default: :test
@@ -0,0 +1,8 @@
1
+ module ComponentHelper
2
+
3
+ def amount_tag(amount, currency:, locale: I18n.locale)
4
+ content_tag :span, amount, class: 'amount', data: {currency: currency}
5
+ end
6
+
7
+ end
8
+
@@ -0,0 +1,5 @@
1
+ module ComponentHelper
2
+ def button_group_tag(*args, &block)
3
+ content_tag :div, class: 'button-group', &block
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module ComponentHelper
2
+ def icon_tag(symbol)
3
+ content_tag :span, '', class: "icon icon-#{symbol}", role: 'presentation'
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ module ComponentHelper
2
+
3
+ def main_layout_tag(*args, &block)
4
+ content_tag :main, class: 'main-layout', &block
5
+ end
6
+
7
+ end
8
+
@@ -0,0 +1,36 @@
1
+ # require '../icon/rails_helper', __file__
2
+
3
+ module ComponentHelper
4
+
5
+ def navbar_layout_tag(*args, &block)
6
+ content_tag :div, class: 'navbar-layout', &block
7
+ end
8
+
9
+ def navbar_tag(*args, &block)
10
+ content_tag :nav, class: 'navbar', &block
11
+ end
12
+
13
+ def secondary_navbar_tag(*args, &block)
14
+ content_tag :nav, class: 'secondary-navbar', &block
15
+ end
16
+
17
+ # NOTE: this differs in nearly all conceivable ways from the JSX version.
18
+ def navbar_item_tag(href, current: false, symbol:, label:, &block)
19
+ link_to href, class: "navbar-item #{'current' if current}" do
20
+ raw <<~EOS
21
+ <div class="symbol">#{icon_tag symbol}</div>
22
+ <div class="label">#{label}</div>
23
+ EOS
24
+ end
25
+ end
26
+
27
+ # NOTE: this differs in nearly all conceivable ways from the JSX version.
28
+ def navbar_brand_tag(href, symbol:, label:, &block)
29
+ link_to href, class: 'navbar-item brand' do
30
+ raw <<~EOS
31
+ <div class="symbol">#{icon_tag symbol}</div>
32
+ <div class="label">#{label}</div>
33
+ EOS
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,7 @@
1
+ module ComponentHelper
2
+
3
+ def page_category_tag(name, &block)
4
+ content_tag :div, name, class: 'page-category', &block
5
+ end
6
+ end
7
+
@@ -0,0 +1,13 @@
1
+ module ComponentHelper
2
+
3
+ def progress_bar_tag(value:, max:, modifier: nil)
4
+ label = yield if block_given?
5
+ label ||= value / max unless max == 0
6
+ label ||= '0'
7
+
8
+ label_tag class: "progress-bar #{modifier}" do
9
+ content_tag :progress, label, value: value, max: max
10
+ end
11
+ end
12
+
13
+ end
@@ -0,0 +1,8 @@
1
+ module ComponentHelper
2
+
3
+ def squishable_tag(label, short, squish_at: nil)
4
+ squish = squish_at || "#{label.length}ch"
5
+
6
+ content_tag :span, label, class: 'squishable', 'aria-label': label, data: {short: short}, style: "--squish-at: #{squish}"
7
+ end
8
+ end
@@ -0,0 +1,14 @@
1
+
2
+ module ComponentHelper
3
+ def tabelle_toggler_tag(expanded, label_expand:, label_collapse:)
4
+ button_tag is: 'tabelle-toggler', hidden: true, 'aria-expanded': (expanded ? 'true' : 'false') do
5
+ content_tag :span, class: 'expand', title: label_expand do
6
+ content_tag :span, label_expand, class: 'sr-only'
7
+ end
8
+
9
+ content_tag :span, class: 'collapse', title: label_collapse do
10
+ content_tag :span, label_collapse, class: 'sr-only'
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,45 @@
1
+ # require '../squishable/rails_helper', __file__
2
+
3
+ module ComponentHelper
4
+
5
+ # TODO: I18n for labels
6
+ def tabelle_arrows_tag(name, label, sorted)
7
+ raw <<~EOS
8
+ <input class="tabelle-arrow" id="#{name}_asc" type="radio" name="sort" value="#{name}_asc" checked=#{sorted == 'asc'} />
9
+ <label class="tabelle-arrow--asc" for="#{name}_asc">
10
+ <span class="sr-only">Sort #{label} Ascending</span>
11
+ </label>
12
+
13
+ <input class="tabelle-arrow" id="#{name}_desc" type="radio" name="sort" value="#{name}_desc" checked=#{sorted == 'desc'} />
14
+ <label class="tabelle-arrow--desc" for="#{name}_desc">
15
+ <span class="sr-only">Sort #{label} Descending</span>
16
+ </label>
17
+ EOS
18
+ end
19
+
20
+ # TODO: I18n for labels
21
+ def tabelle_filter_tag(name, label, value)
22
+ text_field name, class: 'tabelle-input', value: value, 'aria-label': "Filter #{label}"
23
+ end
24
+
25
+ def tabelle_header_tag(name, label:, short_label: nil, value: nil, sorted: false)
26
+ header = short_label ? squishable_tag(label, short_label) : label
27
+
28
+ raw <<~EOS
29
+ <th scope="col" role="columnheader" aria-label=#{label}>
30
+ <div class="tabelle-header">
31
+ <span class="header #{'truncatable' if short_label}" id="#{name}_group" aria-hidden="true">#{raw header}</span>
32
+ #{raw tabelle_arrows_tag name, label, sorted}
33
+ #{raw tabelle_filter_tag name, label, value}
34
+ </div>
35
+ </th>
36
+ EOS
37
+ end
38
+
39
+ def tabelle_tag(id: 'TabelleId', action:, &block)
40
+ content_tag 'ta-belle', id: id, 'change-uri': true do
41
+ form_tag method: :get, url: action, &block
42
+ end
43
+ end
44
+ end
45
+
@@ -0,0 +1,32 @@
1
+ # require "../tabelle-toggler/rails_helper", __file__
2
+
3
+ module ComponentHelper
4
+ def thead_tag(*args, &block)
5
+ content_tag :thead, role: 'rowgroup', &block
6
+ end
7
+
8
+ def tbody_tag(*args, &block)
9
+ content_tag :tbody, role: 'rowgroup', &block
10
+ end
11
+
12
+ def tr_tag(*args, &block)
13
+ content_tag :tr, role: 'row', &block
14
+ end
15
+
16
+ def td_tag(column:, modifier: nil, &block)
17
+ content_tag :td, role: 'cell', class: modifier, data: {column: column}, &block
18
+ end
19
+
20
+ def collapser_th_tag(label, *args)
21
+ content_tag :th, class: 'table-toggler-cell', scope: 'col', role: 'columnheader' do
22
+ content_tag :span, label, class: 'sr-only'
23
+ end
24
+ end
25
+
26
+ def collapser_td_tag(expanded, label_expand:, label_collapse:)
27
+ content_tag :td, class: 'table-toggler-cell', role: 'cell' do
28
+ tabelle_toggler_tag expanded, label_expand: label_expand, label_collapse: label_collapse
29
+ end
30
+ end
31
+
32
+ end
@@ -0,0 +1,8 @@
1
+ module ComponentHelper
2
+
3
+ def table_tag(responsive: false, &block)
4
+ content_tag :table, class: "table #{'table-responsive' if responsive}", role: 'table', &block
5
+ end
6
+
7
+ end
8
+
@@ -0,0 +1,3 @@
1
+ module ComponentHelper
2
+
3
+ end
@@ -0,0 +1,9 @@
1
+ require "innoq/ui/components/railtie"
2
+
3
+ module Innoq
4
+ module Ui
5
+ module Components
6
+ # Your code goes here...
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,19 @@
1
+ $:.push File.expand_path("../../../../app", __dir__)
2
+
3
+ %w(amount button-group icon main-layout page-category navbar progress-bar squishable tabelle tabelle-toggler table table-responsive).each do |component|
4
+ # puts "Trying to load component #{component}"
5
+ require "components/#{component}/rails_helper"
6
+ end
7
+
8
+ puts "loaded all components."
9
+
10
+ module Innoq
11
+ module Ui
12
+ module Components
13
+ module Helper
14
+
15
+ end
16
+ end
17
+ end
18
+ end
19
+
@@ -0,0 +1,8 @@
1
+ module Innoq
2
+ module Ui
3
+ module Components
4
+ class Railtie < ::Rails::Railtie
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ module Innoq
2
+ module Ui
3
+ module Components
4
+ VERSION = '0.1.0'
5
+ end
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: innoq-ui-components
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Willem van Kerkhof
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-03-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 5.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 5.0.0
27
+ description: innoQ UI components for use in internal applications
28
+ email:
29
+ - wvk@innoq.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - README.md
35
+ - Rakefile
36
+ - app/components/amount/rails_helper.rb
37
+ - app/components/button-group/rails_helper.rb
38
+ - app/components/icon/rails_helper.rb
39
+ - app/components/main-layout/rails_helper.rb
40
+ - app/components/navbar/rails_helper.rb
41
+ - app/components/page-category/rails_helper.rb
42
+ - app/components/progress-bar/rails_helper.rb
43
+ - app/components/squishable/rails_helper.rb
44
+ - app/components/tabelle-toggler/rails_helper.rb
45
+ - app/components/tabelle/rails_helper.rb
46
+ - app/components/table-responsive/rails_helper.rb
47
+ - app/components/table/rails_helper.rb
48
+ - app/helpers/component_helper.rb
49
+ - lib/innoq/ui/components.rb
50
+ - lib/innoq/ui/components/helper.rb
51
+ - lib/innoq/ui/components/railtie.rb
52
+ - lib/innoq/ui/components/version.rb
53
+ homepage: https://innoq.com
54
+ licenses:
55
+ - MIT
56
+ metadata: {}
57
+ post_install_message:
58
+ rdoc_options: []
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubyforge_project:
73
+ rubygems_version: 2.7.7
74
+ signing_key:
75
+ specification_version: 4
76
+ summary: Collection of innoQ UI components
77
+ test_files: []