organism-ui 0.2.1

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 (78) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +28 -0
  4. data/Rakefile +35 -0
  5. data/app/assets/config/ui_manifest.js +1 -0
  6. data/app/assets/stylesheets/ui/application.css +15 -0
  7. data/app/controllers/ui/application_controller.rb +7 -0
  8. data/app/controllers/ui/style_guide_controller.rb +8 -0
  9. data/app/helpers/ui/application_helper.rb +4 -0
  10. data/app/javascript/ui/application.js +1 -0
  11. data/app/jobs/ui/application_job.rb +4 -0
  12. data/app/mailers/ui/application_mailer.rb +6 -0
  13. data/app/models/ui/application_record.rb +5 -0
  14. data/app/views/ui/style_guide/show.html.erb +1035 -0
  15. data/config/routes.rb +3 -0
  16. data/lib/tasks/ui_tasks.rake +4 -0
  17. data/lib/ui.rb +64 -0
  18. data/lib/ui/actionable.rb +19 -0
  19. data/lib/ui/breadcrumbs.rb +31 -0
  20. data/lib/ui/breadcrumbs/breadcrumb.rb +36 -0
  21. data/lib/ui/breadcrumbs/crumb.rb +15 -0
  22. data/lib/ui/buttons/base.rb +146 -0
  23. data/lib/ui/buttons/primary.rb +11 -0
  24. data/lib/ui/buttons/secondary.rb +11 -0
  25. data/lib/ui/buttons/tertiary.rb +11 -0
  26. data/lib/ui/card.rb +36 -0
  27. data/lib/ui/card/show.erb +16 -0
  28. data/lib/ui/collapse.rb +24 -0
  29. data/lib/ui/collapse/panel.rb +37 -0
  30. data/lib/ui/collapse/panel/show.erb +16 -0
  31. data/lib/ui/component.rb +23 -0
  32. data/lib/ui/descriptive_list.rb +50 -0
  33. data/lib/ui/descriptive_list/item.rb +24 -0
  34. data/lib/ui/descriptive_list/show.erb +7 -0
  35. data/lib/ui/dropdown.rb +22 -0
  36. data/lib/ui/dropdown/show.erb +13 -0
  37. data/lib/ui/empty.rb +36 -0
  38. data/lib/ui/empty/show.erb +11 -0
  39. data/lib/ui/engine.rb +13 -0
  40. data/lib/ui/list.rb +77 -0
  41. data/lib/ui/list/item.rb +9 -0
  42. data/lib/ui/list/show.erb +5 -0
  43. data/lib/ui/menu.rb +29 -0
  44. data/lib/ui/menu/callable.rb +11 -0
  45. data/lib/ui/menu/item.rb +39 -0
  46. data/lib/ui/menu/show.erb +4 -0
  47. data/lib/ui/menu/submenu.rb +55 -0
  48. data/lib/ui/notification.rb +37 -0
  49. data/lib/ui/notification/show.erb +19 -0
  50. data/lib/ui/page_header.rb +29 -0
  51. data/lib/ui/page_header/show.erb +18 -0
  52. data/lib/ui/pagination.rb +105 -0
  53. data/lib/ui/pagination/page_link.rb +24 -0
  54. data/lib/ui/pagination/show.erb +11 -0
  55. data/lib/ui/pagination/window.rb +85 -0
  56. data/lib/ui/step.rb +57 -0
  57. data/lib/ui/step/show.erb +13 -0
  58. data/lib/ui/steps.rb +67 -0
  59. data/lib/ui/steps/show.erb +5 -0
  60. data/lib/ui/stylable.rb +21 -0
  61. data/lib/ui/table.rb +162 -0
  62. data/lib/ui/table/header.rb +20 -0
  63. data/lib/ui/table/row.rb +25 -0
  64. data/lib/ui/table/select.rb +16 -0
  65. data/lib/ui/table/select/many.rb +38 -0
  66. data/lib/ui/table/select/one.rb +38 -0
  67. data/lib/ui/table/select_all.rb +36 -0
  68. data/lib/ui/table/show.erb +5 -0
  69. data/lib/ui/table/sort.rb +19 -0
  70. data/lib/ui/tooltip.rb +35 -0
  71. data/lib/ui/tooltip/show.erb +14 -0
  72. data/lib/ui/types.rb +7 -0
  73. data/lib/ui/value.rb +4 -0
  74. data/lib/ui/version.rb +3 -0
  75. data/lib/ui/wizard.rb +87 -0
  76. data/lib/ui/wizard/content.rb +20 -0
  77. data/lib/ui/wizard/show.erb +10 -0
  78. metadata +265 -0
@@ -0,0 +1,5 @@
1
+ <article class="<%= style %>">
2
+ <%= header %>
3
+ <%= table %>
4
+ <%= footer %>
5
+ </article>
@@ -0,0 +1,19 @@
1
+ module Ui
2
+ class Table < Component
3
+ class Sort < Component
4
+ def show
5
+ content_tag(
6
+ :div,
7
+ icon(handle_icon),
8
+ class: 'ui-sortable-handle',
9
+ )
10
+ end
11
+
12
+ private
13
+
14
+ def handle_icon
15
+ options.fetch(:handle, 'fas fa-bars')
16
+ end
17
+ end
18
+ end
19
+ end
data/lib/ui/tooltip.rb ADDED
@@ -0,0 +1,35 @@
1
+ module Ui
2
+ class Tooltip < Component
3
+ def show(&block)
4
+ render(&block)
5
+ end
6
+
7
+ private
8
+
9
+ def content
10
+ cell(
11
+ Ui::Card,
12
+ display(tooltip.fetch(:header, '')),
13
+ style: 'ui-tooltip-container'
14
+ ).() do
15
+ display(tooltip.fetch(:content, ''))
16
+ end
17
+ end
18
+
19
+ def display(content)
20
+ if content.is_a?(Proc)
21
+ content.call
22
+ else
23
+ content
24
+ end
25
+ end
26
+
27
+ def tooltip
28
+ context.fetch(:tooltip, {})
29
+ end
30
+
31
+ def mode
32
+ tooltip.fetch(:mode, 'hover')
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,14 @@
1
+ <div
2
+ class="ui-tooltip"
3
+ data-controller="tooltip"
4
+ data-tooltip-hidden-class="hidden"
5
+ data-tooltip-mode-value="<%= mode %>"
6
+ data-tooltip-expanded-value="false"
7
+ data-action="click->tooltip#toggle">
8
+
9
+ <%= yield %>
10
+
11
+ <div class="ui-tooltip__content" data-tooltip-target="content">
12
+ <%= content %>
13
+ </div>
14
+ </div>
data/lib/ui/types.rb ADDED
@@ -0,0 +1,7 @@
1
+ require 'dry-types'
2
+
3
+ module Ui
4
+ module Types
5
+ include Dry.Types()
6
+ end
7
+ end
data/lib/ui/value.rb ADDED
@@ -0,0 +1,4 @@
1
+ module Ui
2
+ class Value < Dry::Struct
3
+ end
4
+ end
data/lib/ui/version.rb ADDED
@@ -0,0 +1,3 @@
1
+ module Ui
2
+ VERSION = '0.2.1'
3
+ end
data/lib/ui/wizard.rb ADDED
@@ -0,0 +1,87 @@
1
+ module Ui
2
+ class Wizard < Component
3
+ class Step < Value
4
+ attribute :position, Types::Strict::Integer
5
+ attribute :content, Types::Strict::String
6
+ end
7
+
8
+ def show
9
+ render
10
+ end
11
+
12
+ private
13
+
14
+ def content
15
+ cell(
16
+ Ui::Wizard::Content,
17
+ collection: wizard_steps
18
+ )
19
+ end
20
+
21
+ def wizard_steps
22
+ model.map.with_index do |step, index|
23
+ Step.new(
24
+ position: index + 1,
25
+ content: step.fetch(:content, '')
26
+ )
27
+ end
28
+ end
29
+
30
+ def steps
31
+ cell(
32
+ Ui::Steps,
33
+ model,
34
+ current_step: current_step
35
+ )
36
+ end
37
+
38
+ def controls
39
+ content_tag(:nav, class: 'ui-wizard__controls') do
40
+ render_group([
41
+ next_button,
42
+ finish_button,
43
+ previous_button,
44
+ ])
45
+ end
46
+ end
47
+
48
+ def finish_button
49
+ content_tag(
50
+ :div,
51
+ options[:finish],
52
+ data: {
53
+ "wizard-target": "finish"
54
+ }
55
+ )
56
+ end
57
+
58
+ def previous_button
59
+ cell(
60
+ Ui::Buttons::Secondary,
61
+ 'Previous',
62
+ path: '#',
63
+ data: {
64
+ action: "click->wizard#previous",
65
+ "wizard-target": "previous"
66
+ }
67
+ )
68
+ end
69
+
70
+ def next_button
71
+ cell(
72
+ Ui::Buttons::Secondary,
73
+ 'Next',
74
+ path: '#',
75
+ id: 'next',
76
+ data: {
77
+ action: "click->wizard#next",
78
+ "wizard-target": "next"
79
+ }
80
+ )
81
+ end
82
+
83
+ def current_step
84
+ options.fetch(:current_step, 1)
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,20 @@
1
+ module Ui
2
+ class Wizard < Component
3
+ class Content < Component
4
+ property :content
5
+ property :position
6
+
7
+ def show
8
+ content_tag(
9
+ :section,
10
+ content,
11
+ class: 'ui-wizard__content',
12
+ data: {
13
+ position: position,
14
+ "wizard-target": "content"
15
+ }
16
+ )
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,10 @@
1
+ <article
2
+ data-controller="wizard"
3
+ data-wizard-hidden-class="hidden"
4
+ data-wizard-current-step-class="ui-step--current"
5
+ data-wizard-step-position-value="1"
6
+ class="ui-wizard">
7
+ <%= steps %>
8
+ <%= content %>
9
+ <%= controls %>
10
+ </article>
metadata ADDED
@@ -0,0 +1,265 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: organism-ui
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1
5
+ platform: ruby
6
+ authors:
7
+ - Nolan Tait
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-03-13 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: 6.0.3
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 6.0.3.1
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: 6.0.3
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 6.0.3.1
33
+ - !ruby/object:Gem::Dependency
34
+ name: dry-struct
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: 1.4.0
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: 1.4.0
47
+ - !ruby/object:Gem::Dependency
48
+ name: dry-types
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '1.5'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.5'
61
+ - !ruby/object:Gem::Dependency
62
+ name: trailblazer-cells
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: 0.0.3
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: 0.0.3
75
+ - !ruby/object:Gem::Dependency
76
+ name: cells-erb
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: 0.1.0
82
+ type: :runtime
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: 0.1.0
89
+ - !ruby/object:Gem::Dependency
90
+ name: cells-rails
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: 0.1.3
96
+ type: :runtime
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: 0.1.3
103
+ - !ruby/object:Gem::Dependency
104
+ name: rspec-rails
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "<"
108
+ - !ruby/object:Gem::Version
109
+ version: '5.0'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "<"
115
+ - !ruby/object:Gem::Version
116
+ version: '5.0'
117
+ - !ruby/object:Gem::Dependency
118
+ name: rspec-cells
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: 0.3.5
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: 0.3.5
131
+ - !ruby/object:Gem::Dependency
132
+ name: capybara
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: 3.35.3
138
+ type: :development
139
+ prerelease: false
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: 3.35.3
145
+ - !ruby/object:Gem::Dependency
146
+ name: byebug
147
+ requirement: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - "~>"
150
+ - !ruby/object:Gem::Version
151
+ version: 11.1.3
152
+ type: :development
153
+ prerelease: false
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - "~>"
157
+ - !ruby/object:Gem::Version
158
+ version: 11.1.3
159
+ description: A collection of ui components implemented in cells.
160
+ email:
161
+ - nolanjtait@gmail.com
162
+ executables: []
163
+ extensions: []
164
+ extra_rdoc_files: []
165
+ files:
166
+ - MIT-LICENSE
167
+ - README.md
168
+ - Rakefile
169
+ - app/assets/config/ui_manifest.js
170
+ - app/assets/stylesheets/ui/application.css
171
+ - app/controllers/ui/application_controller.rb
172
+ - app/controllers/ui/style_guide_controller.rb
173
+ - app/helpers/ui/application_helper.rb
174
+ - app/javascript/ui/application.js
175
+ - app/jobs/ui/application_job.rb
176
+ - app/mailers/ui/application_mailer.rb
177
+ - app/models/ui/application_record.rb
178
+ - app/views/ui/style_guide/show.html.erb
179
+ - config/routes.rb
180
+ - lib/tasks/ui_tasks.rake
181
+ - lib/ui.rb
182
+ - lib/ui/actionable.rb
183
+ - lib/ui/breadcrumbs.rb
184
+ - lib/ui/breadcrumbs/breadcrumb.rb
185
+ - lib/ui/breadcrumbs/crumb.rb
186
+ - lib/ui/buttons/base.rb
187
+ - lib/ui/buttons/primary.rb
188
+ - lib/ui/buttons/secondary.rb
189
+ - lib/ui/buttons/tertiary.rb
190
+ - lib/ui/card.rb
191
+ - lib/ui/card/show.erb
192
+ - lib/ui/collapse.rb
193
+ - lib/ui/collapse/panel.rb
194
+ - lib/ui/collapse/panel/show.erb
195
+ - lib/ui/component.rb
196
+ - lib/ui/descriptive_list.rb
197
+ - lib/ui/descriptive_list/item.rb
198
+ - lib/ui/descriptive_list/show.erb
199
+ - lib/ui/dropdown.rb
200
+ - lib/ui/dropdown/show.erb
201
+ - lib/ui/empty.rb
202
+ - lib/ui/empty/show.erb
203
+ - lib/ui/engine.rb
204
+ - lib/ui/list.rb
205
+ - lib/ui/list/item.rb
206
+ - lib/ui/list/show.erb
207
+ - lib/ui/menu.rb
208
+ - lib/ui/menu/callable.rb
209
+ - lib/ui/menu/item.rb
210
+ - lib/ui/menu/show.erb
211
+ - lib/ui/menu/submenu.rb
212
+ - lib/ui/notification.rb
213
+ - lib/ui/notification/show.erb
214
+ - lib/ui/page_header.rb
215
+ - lib/ui/page_header/show.erb
216
+ - lib/ui/pagination.rb
217
+ - lib/ui/pagination/page_link.rb
218
+ - lib/ui/pagination/show.erb
219
+ - lib/ui/pagination/window.rb
220
+ - lib/ui/step.rb
221
+ - lib/ui/step/show.erb
222
+ - lib/ui/steps.rb
223
+ - lib/ui/steps/show.erb
224
+ - lib/ui/stylable.rb
225
+ - lib/ui/table.rb
226
+ - lib/ui/table/header.rb
227
+ - lib/ui/table/row.rb
228
+ - lib/ui/table/select.rb
229
+ - lib/ui/table/select/many.rb
230
+ - lib/ui/table/select/one.rb
231
+ - lib/ui/table/select_all.rb
232
+ - lib/ui/table/show.erb
233
+ - lib/ui/table/sort.rb
234
+ - lib/ui/tooltip.rb
235
+ - lib/ui/tooltip/show.erb
236
+ - lib/ui/types.rb
237
+ - lib/ui/value.rb
238
+ - lib/ui/version.rb
239
+ - lib/ui/wizard.rb
240
+ - lib/ui/wizard/content.rb
241
+ - lib/ui/wizard/show.erb
242
+ homepage: https://github.com/nolantait/organism-ui
243
+ licenses:
244
+ - MIT
245
+ metadata: {}
246
+ post_install_message:
247
+ rdoc_options: []
248
+ require_paths:
249
+ - lib
250
+ required_ruby_version: !ruby/object:Gem::Requirement
251
+ requirements:
252
+ - - ">="
253
+ - !ruby/object:Gem::Version
254
+ version: '0'
255
+ required_rubygems_version: !ruby/object:Gem::Requirement
256
+ requirements:
257
+ - - ">="
258
+ - !ruby/object:Gem::Version
259
+ version: '0'
260
+ requirements: []
261
+ rubygems_version: 3.1.4
262
+ signing_key:
263
+ specification_version: 4
264
+ summary: A collection of ui components implemented in cells.
265
+ test_files: []