organism-ui 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3065e937e87ba2c40e0b8a30d1c57402330b7c4452faea8d6220e7188906d2fd
4
+ data.tar.gz: 30cee7eb57cc13b3002c328465c215040e9dbff0e8a86d915005200c46305352
5
+ SHA512:
6
+ metadata.gz: 2c314d87dc4192fd479015a1b6ae10ad238bb4e5a22b19c5d7a9fb5d31d6b16bd801dff97dbd26743b5931159dd6a3f92e88e3f3116d66a1860451c31bfda36a
7
+ data.tar.gz: db8edc5cc1a98bb8deb6da1eae88b000d14211d561a47492d221eacbfd474e773e3ea267b71861d523db95b11739fa52ae0c7e83c87b3bce530a462e53ec0dcf
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2020 Nolan Tait
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # Ui
2
+ Short description and motivation.
3
+
4
+ ## Usage
5
+ How to use my plugin.
6
+
7
+ ## Installation
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'ui'
12
+ ```
13
+
14
+ And then execute:
15
+ ```bash
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+ ```bash
21
+ $ gem install ui
22
+ ```
23
+
24
+ ## Contributing
25
+ Contribution directions go here.
26
+
27
+ ## License
28
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,35 @@
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 = 'Ui'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+ load 'rails/tasks/statistics.rake'
21
+
22
+ require 'bundler/gem_tasks'
23
+
24
+ Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rake')].each {|f| load f }
25
+
26
+ require 'rspec/core'
27
+
28
+ require 'rspec/core/rake_task'
29
+
30
+ desc "Run all specs in spec directory (excluding plugin specs)"
31
+
32
+ RSpec::Core::RakeTask.new(:spec => 'app:db:test:prepare')
33
+
34
+
35
+ task :default => :spec
@@ -0,0 +1 @@
1
+ //= link_directory ../stylesheets/ui .css
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,7 @@
1
+ module Ui
2
+ class ApplicationController < ::ApplicationController
3
+ layout 'application'
4
+
5
+ protect_from_forgery with: :exception
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ module Ui
2
+ class StyleGuideController < ApplicationController
3
+ protect_from_forgery with: :exception
4
+
5
+ def show
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,4 @@
1
+ module Ui
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1 @@
1
+ alert('hello')
@@ -0,0 +1,4 @@
1
+ module Ui
2
+ class ApplicationJob < ActiveJob::Base
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ module Ui
2
+ class ApplicationMailer < ActionMailer::Base
3
+ default from: 'from@example.com'
4
+ layout 'mailer'
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module Ui
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
@@ -0,0 +1,1035 @@
1
+ <div class="style-guide-container">
2
+ <aside class="style-guide-sidebar">
3
+ <section>
4
+ <header>
5
+ <h5><a href="#buttons">Buttons</a></h5>
6
+ </header>
7
+ <nav>
8
+ <%= link_to 'Type', '#type' %>
9
+ </nav>
10
+ </section>
11
+ </aside>
12
+
13
+ <article class="style-guide">
14
+ <article class="style-guide__section" id="buttons">
15
+ <header>
16
+ <h1>Buttons</h1>
17
+ </header>
18
+
19
+ <section class="style-guide__example" id="type">
20
+ <header>
21
+ <h2>Type</h2>
22
+ </header>
23
+
24
+ <%= cell(
25
+ Ui::Buttons::Primary,
26
+ 'Primary Button',
27
+ path: '/'
28
+ ) %>
29
+ <%= cell(
30
+ Ui::Buttons::Secondary,
31
+ 'Secondary Button',
32
+ path: '/'
33
+ ) %>
34
+ <%= cell(
35
+ Ui::Buttons::Tertiary,
36
+ 'Tertiary Button',
37
+ path: '/'
38
+ ) %>
39
+ </section>
40
+
41
+ <section class="style-guide__example">
42
+ <header>
43
+ <h2>Icons</h2>
44
+ </header>
45
+
46
+ <%= cell(
47
+ Ui::Buttons::Primary,
48
+ 'Primary Button',
49
+ path: '/'
50
+ ).call(:new) %>
51
+ <%= cell(
52
+ Ui::Buttons::Secondary,
53
+ 'Secondary Button',
54
+ path: '/'
55
+ ).call(:edit) %>
56
+ <%= cell(
57
+ Ui::Buttons::Tertiary,
58
+ 'Tertiary Button',
59
+ path: '/'
60
+ ).call(:destroy) %>
61
+ </section>
62
+
63
+ <section class="style-guide__example">
64
+ <header>
65
+ <h2>Sizes</h2>
66
+ </header>
67
+
68
+ <%= cell(
69
+ Ui::Buttons::Primary,
70
+ 'Large Button',
71
+ path: '/'
72
+ ).call(:new) %>
73
+ <%= cell(
74
+ Ui::Buttons::Secondary,
75
+ 'Small Button',
76
+ path: '/',
77
+ style: 'button--small'
78
+ ).call(:edit) %>
79
+ </section>
80
+
81
+ <section class="style-guide__example">
82
+ <header>
83
+ <h2>Disabled</h2>
84
+ </header>
85
+
86
+ <%= cell(
87
+ Ui::Buttons::Primary,
88
+ 'Primary Disabled',
89
+ path: '/',
90
+ disabled: true
91
+ ).call(:new) %>
92
+ <%= cell(
93
+ Ui::Buttons::Secondary,
94
+ 'Secondary Disabled',
95
+ path: '/',
96
+ disabled: true
97
+ ).call(:edit) %>
98
+ <%= cell(
99
+ Ui::Buttons::Tertiary,
100
+ 'Tertiary Disabled',
101
+ path: '/',
102
+ disabled: true
103
+ ).call(:edit) %>
104
+ </section>
105
+ </article>
106
+
107
+ <article class="style-guide__section" id="typography">
108
+ <header>
109
+ <h1>Typography</h1>
110
+ </header>
111
+
112
+ <section class="style-guide__example" id="type">
113
+ <header>
114
+ <h2>Sizes</h2>
115
+ </header>
116
+
117
+ <div class="space-y-4">
118
+ <div class="font-bold space-y-4">
119
+ <h1>h1. Tait Ventures</h1>
120
+ <h2>h2. Tait Ventures</h2>
121
+ <h3>h3. Tait Ventures</h3>
122
+ <h4>h4. Tait Ventures</h4>
123
+ <h5>h5. Tait Ventures</h5>
124
+ </div>
125
+ <p>p. Tait Ventures</p>
126
+ <small>small. Tait Ventures</small>
127
+ </div>
128
+ </section>
129
+ </article>
130
+
131
+ <article class="style-guide__section" id="breadcrumbs">
132
+ <header>
133
+ <h1>Breadcrumbs</h1>
134
+ </header>
135
+
136
+ <section class="style-guide__example" id="type">
137
+ <header>
138
+ <h2>Basic</h2>
139
+ </header>
140
+
141
+ <div class="space-y-4">
142
+ <%= cell(
143
+ Ui::Breadcrumbs,
144
+ [
145
+ Ui::Breadcrumbs::Crumb.new(name: 'Home', icon: 'fas fa-home'),
146
+ Ui::Breadcrumbs::Crumb.new(name: 'Application Center',),
147
+ Ui::Breadcrumbs::Crumb.new(name: 'Application List'),
148
+ Ui::Breadcrumbs::Crumb.new(name: 'An Application', current: true)
149
+ ]
150
+ ) %>
151
+
152
+ <%= cell(
153
+ Ui::Breadcrumbs,
154
+ [
155
+ Ui::Breadcrumbs::Crumb.new(name: 'Home', icon: 'fas fa-home'),
156
+ Ui::Breadcrumbs::Crumb.new(name: 'Application Center',),
157
+ Ui::Breadcrumbs::Crumb.new(name: 'Application List'),
158
+ Ui::Breadcrumbs::Crumb.new(name: 'An Application', current: true)
159
+ ],
160
+ delimiter: content_tag(:span, '/', class: 'breadcrumb-delimiter')
161
+ ) %>
162
+ </div>
163
+ </section>
164
+ </article>
165
+
166
+ <article class="style-guide__section" id="breadcrumbs">
167
+ <header>
168
+ <h1>Page Header</h1>
169
+ </header>
170
+
171
+ <section class="style-guide__example" id="type">
172
+ <header>
173
+ <h2>Basic</h2>
174
+ </header>
175
+
176
+ <div class="space-y-4">
177
+ <%= cell(
178
+ Ui::PageHeader,
179
+ 'Title',
180
+ subheading: 'This is a subtitle',
181
+ back: '#'
182
+ ) %>
183
+ </div>
184
+ </section>
185
+
186
+ <section class="style-guide__example" id="type">
187
+ <header>
188
+ <h2>Breadcrumbs</h2>
189
+ </header>
190
+
191
+ <div class="space-y-4">
192
+ <%= cell(
193
+ Ui::PageHeader,
194
+ 'Title',
195
+ subheading: 'This is a subtitle',
196
+ back: '#',
197
+ breadcrumbs: cell(
198
+ Ui::Breadcrumbs,
199
+ [
200
+ Ui::Breadcrumbs::Crumb.new(
201
+ name: 'First level',
202
+ ),
203
+ Ui::Breadcrumbs::Crumb.new(
204
+ name: 'Second level',
205
+ ),
206
+ Ui::Breadcrumbs::Crumb.new(
207
+ name: 'Third level',
208
+ current: true
209
+ )
210
+ ]
211
+ ),
212
+ ) %>
213
+ </div>
214
+ </section>
215
+
216
+ <section class="style-guide__example" id="type">
217
+ <header>
218
+ <h2>Actions</h2>
219
+ </header>
220
+
221
+ <div class="space-y-4">
222
+ <%= cell(
223
+ Ui::PageHeader,
224
+ 'Title',
225
+ subheading: 'This is a subtitle',
226
+ back: '#',
227
+ actions: [
228
+ ->(_) {
229
+ cell(
230
+ Ui::Buttons::Primary,
231
+ 'Primary',
232
+ path: '#',
233
+ size: :small,
234
+ icon: 'fas fa-bullseye'
235
+ )
236
+ },
237
+ ->(_) {
238
+ cell(
239
+ Ui::Buttons::Secondary,
240
+ 'Operation',
241
+ path: '#',
242
+ size: :small
243
+ )
244
+ }
245
+ ]
246
+ ) %>
247
+ </div>
248
+ </section>
249
+
250
+ <section class="style-guide__example" id="type">
251
+ <header>
252
+ <h2>Extra Content</h2>
253
+ </header>
254
+
255
+ <div class="space-y-4">
256
+ <%= cell(
257
+ Ui::PageHeader,
258
+ 'Title',
259
+ subheading: 'This is a subtitle',
260
+ back: '#',
261
+ ).() do
262
+ content_tag(:section) do
263
+ content_tag(:p, 'This is some extra content.') +
264
+ content_tag(:p, 'You can put anything you want here.')
265
+ end
266
+ end %>
267
+ </div>
268
+ </section>
269
+ </article>
270
+
271
+ <article class="style-guide__section" id="breadcrumbs">
272
+ <header>
273
+ <h1>Dropdowns</h1>
274
+ </header>
275
+
276
+ <section class="style-guide__example" id="type">
277
+ <header>
278
+ <h2>Clickable</h2>
279
+ </header>
280
+
281
+ <div class="space-y-4">
282
+ <%= cell(
283
+ Ui::Dropdown,
284
+ cell(
285
+ Ui::Menu,
286
+ [
287
+ content_tag(:p, 'Item 1'),
288
+ content_tag(:p, 'Item 2'),
289
+ [
290
+ content_tag(:p, 'Submenu'),
291
+ [
292
+ content_tag(:p, 'Submenu item 1'),
293
+ [
294
+ content_tag(:p, 'Submenu item 2'),
295
+ [
296
+ content_tag(:p, 'Sub submenu item 1'),
297
+ ]
298
+ ]
299
+ ]
300
+ ]
301
+ ],
302
+ header: 'Items',
303
+ style: 'w-64'
304
+ ).(),
305
+ mode: 'click'
306
+ ).() do
307
+ cell(
308
+ Ui::Buttons::Primary,
309
+ 'Click me',
310
+ icon: 'fas fa-caret-down',
311
+ ).()
312
+ end %>
313
+ </div>
314
+ </section>
315
+
316
+ <section class="style-guide__example" id="type">
317
+ <header>
318
+ <h2>Hoverable</h2>
319
+ </header>
320
+
321
+ <div class="space-y-4">
322
+ <%= cell(
323
+ Ui::Dropdown,
324
+ cell(
325
+ Ui::Menu,
326
+ [
327
+ content_tag(:p, 'Item 1'),
328
+ content_tag(:p, 'Item 2')
329
+ ]
330
+ ).(),
331
+ mode: 'hover'
332
+ ).() do
333
+ cell(
334
+ Ui::Buttons::Primary,
335
+ 'Hover me',
336
+ icon: 'fas fa-caret-down',
337
+ ).()
338
+ end %>
339
+ </div>
340
+ </section>
341
+ </article>
342
+
343
+ <article class="style-guide__section" id="breadcrumbs">
344
+ <header>
345
+ <h1>Pagination</h1>
346
+ </header>
347
+
348
+ <section class="style-guide__example" id="type">
349
+ <header>
350
+ <h2>Basic</h2>
351
+ </header>
352
+
353
+ <div class="space-y-4">
354
+ <%= cell(
355
+ Ui::Pagination,
356
+ (1..100).map do |i|
357
+ "/links?page=#{i}"
358
+ end,
359
+ current_path: '/links?page=1',
360
+ window_size: 5
361
+ ) %>
362
+ </div>
363
+ </section>
364
+ </article>
365
+
366
+ <article class="style-guide__section" id="breadcrumbs">
367
+ <header>
368
+ <h1>Steps</h1>
369
+ </header>
370
+
371
+ <section class="style-guide__example" id="type">
372
+ <header>
373
+ <h2>Horizontal</h2>
374
+ </header>
375
+
376
+ <div class="space-y-4">
377
+ <%= cell(
378
+ Ui::Steps,
379
+ [
380
+ {
381
+ title: 'First step',
382
+ status: 'finished',
383
+ icon: 'fas fa-home',
384
+ description: 'My second step description'
385
+ },
386
+ {
387
+ title: 'Second step',
388
+ subtitle: 'ETA 5 minutes',
389
+ status: 'processing',
390
+ description: 'My second step description'
391
+ },
392
+ {
393
+ title: 'Last step',
394
+ status: 'waiting',
395
+ },
396
+ ],
397
+ current_step: 1
398
+ ) %>
399
+ </div>
400
+ </section>
401
+
402
+ <section class="style-guide__example" id="type">
403
+ <header>
404
+ <h2>Vertical</h2>
405
+ </header>
406
+
407
+ <div class="space-y-4">
408
+ <%= cell(
409
+ Ui::Steps,
410
+ [
411
+ {
412
+ title: 'Wake up',
413
+ status: 'finished',
414
+ icon: 'fas fa-home',
415
+ description: 'You finished the first step'
416
+ },
417
+ {
418
+ title: 'Get money',
419
+ subtitle: 'Error',
420
+ status: 'error',
421
+ description: 'Something has caused an error'
422
+ },
423
+ {
424
+ title: 'Go to sleep',
425
+ status: 'waiting',
426
+ },
427
+ ],
428
+ current_step: 1,
429
+ direction: 'vertical'
430
+ ) %>
431
+ </div>
432
+ </section>
433
+
434
+ </article>
435
+
436
+ <article class="style-guide__section" id="breadcrumbs">
437
+ <header>
438
+ <h1>Wizard</h1>
439
+ </header>
440
+
441
+ <section class="style-guide__example" id="type">
442
+ <header>
443
+ <h2>Basic</h2>
444
+ </header>
445
+
446
+ <div class="space-y-4">
447
+ <%= cell(
448
+ Ui::Wizard,
449
+ [
450
+ {
451
+ title: 'First step',
452
+ status: 'finished',
453
+ icon: 'fas fa-home',
454
+ description: 'My second step description',
455
+ content: content_tag(:p, 'First content')
456
+ },
457
+ {
458
+ title: 'Second step',
459
+ subtitle: 'ETA 5 minutes',
460
+ status: 'processing',
461
+ description: 'My second step description',
462
+ content: content_tag(:p, 'Second content')
463
+ },
464
+ {
465
+ title: 'Last step',
466
+ status: 'waiting',
467
+ content: content_tag(:p, 'Last content')
468
+ },
469
+ ],
470
+ current_step: 1,
471
+ finish: cell(
472
+ Ui::Buttons::Primary,
473
+ 'Finish',
474
+ icon: 'fas fa-bullseye',
475
+ path: '#'
476
+ )
477
+ ) %>
478
+ </div>
479
+ </section>
480
+ </article>
481
+
482
+ <article class="style-guide__section" id="breadcrumbs">
483
+ <header>
484
+ <h1>Cards</h1>
485
+ </header>
486
+
487
+ <section class="style-guide__example" id="type">
488
+ <header>
489
+ <h2>Basic</h2>
490
+ </header>
491
+
492
+ <div class="space-y-4">
493
+ <%= cell(
494
+ Ui::Card,
495
+ 'Some card',
496
+ extra: link_to('More', '#', class: 'text-primary'),
497
+ style: 'w-96'
498
+ ).() do
499
+ content_tag(:p, 'With some content')
500
+ end %>
501
+ </div>
502
+ </section>
503
+
504
+ <section class="style-guide__example" id="type">
505
+ <header>
506
+ <h2>Extras</h2>
507
+ </header>
508
+
509
+ <div class="space-y-4">
510
+ <%= cell(
511
+ Ui::Card,
512
+ nil,
513
+ cover: 'https://images.unsplash.com/photo-1615068501918-9d862e1908df?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=634&q=80',
514
+ style: 'w-96',
515
+ actions: [
516
+ ->(_) {
517
+ cell(
518
+ Ui::Buttons::Tertiary,
519
+ nil,
520
+ icon: 'fas fa-plus',
521
+ path: '#'
522
+ )
523
+ },
524
+ ->(_) {
525
+ cell(
526
+ Ui::Buttons::Tertiary,
527
+ nil,
528
+ icon: 'fas fa-edit',
529
+ path: '#'
530
+ )
531
+ },
532
+ ->(_) {
533
+ cell(
534
+ Ui::Buttons::Tertiary,
535
+ nil,
536
+ icon: 'fas fa-ellipsis-h',
537
+ path: '#'
538
+ )
539
+ },
540
+ ]
541
+ ).() do
542
+ content_tag(:div, class: 'space-y-2') do
543
+ content_tag(:p, 'Some card title', class: 'text-lg') +
544
+ content_tag(:p, 'Some card description')
545
+ end
546
+ end %>
547
+ </div>
548
+ </section>
549
+ </article>
550
+
551
+ <article class="style-guide__section" id="breadcrumbs">
552
+ <header>
553
+ <h1>Descriptive Lists</h1>
554
+ </header>
555
+
556
+ <section class="style-guide__example" id="type">
557
+ <header>
558
+ <h2>Basic</h2>
559
+ </header>
560
+
561
+ <div class="space-y-4">
562
+ <%= cell(
563
+ Ui::DescriptiveList,
564
+ [
565
+ ["Name", "John Doe"],
566
+ ["Phone number", "778-212-2322"],
567
+ ["Street address", "1233 Fake Street"],
568
+ ["Status", ->() { content_tag(:i, nil, class: 'fas fa-ellipsis-h') }],
569
+ ["Income", "$2,300/month"],
570
+ ["Goal", "Stack paper"],
571
+ ],
572
+ title: 'Horizontal orientation',
573
+ direction: 'horizontal',
574
+ ).() %>
575
+ </div>
576
+ </section>
577
+
578
+ <section class="style-guide__example" id="type">
579
+ <header>
580
+ <h2>Vertical</h2>
581
+ </header>
582
+
583
+ <div class="space-y-4">
584
+ <%= cell(
585
+ Ui::DescriptiveList,
586
+ [
587
+ ["Name", "John Doe"],
588
+ ["Phone number", "778-212-2322"],
589
+ ["Street address", "1233 Fake Street"],
590
+ ["Status", ->() { content_tag(:i, nil, class: 'fas fa-ellipsis-h') }],
591
+ ["Income", "$2,300/month"],
592
+ ["Goal", "Stack paper"],
593
+ ],
594
+ title: 'Vertical orientation',
595
+ direction: 'vertical',
596
+ actions: [
597
+ ->(_) {
598
+ cell(
599
+ Ui::Buttons::Primary,
600
+ 'Edit',
601
+ path: '#',
602
+ size: :small
603
+ ).call(:edit)
604
+ }
605
+ ]
606
+ ).() %>
607
+ </div>
608
+ </section>
609
+ </article>
610
+
611
+ <article class="style-guide__section" id="breadcrumbs">
612
+ <header>
613
+ <h1>Lists</h1>
614
+ </header>
615
+
616
+ <section class="style-guide__example" id="type">
617
+ <header>
618
+ <h2>Basic</h2>
619
+ </header>
620
+
621
+ <div class="space-y-4">
622
+ <%= cell(
623
+ Ui::List,
624
+ [
625
+ "Item 1",
626
+ "Item 2",
627
+ "Item 3",
628
+ "Item 4"
629
+ ],
630
+ header: 'My list title',
631
+ footer: 'My list footer',
632
+ ).() %>
633
+ </div>
634
+ </section>
635
+
636
+ <section class="style-guide__example" id="type">
637
+ <header>
638
+ <h2>Custom Renderable</h2>
639
+ </header>
640
+
641
+ <div class="space-y-4">
642
+ <%= cell(
643
+ Ui::List,
644
+ [
645
+ "Item 1",
646
+ "Item 2",
647
+ "Item 3",
648
+ "Item 4"
649
+ ],
650
+ header: 'My list title',
651
+ footer: content_tag(
652
+ :div,
653
+ cell(
654
+ Ui::Pagination,
655
+ [
656
+ '/links',
657
+ '/links?page=2',
658
+ '/links?page=3',
659
+ '/links?page=4'
660
+ ],
661
+ current_path: '/links?page=2'
662
+ ),
663
+ class: 'ml-auto'
664
+ ),
665
+ style: "border",
666
+ actions: [
667
+ ->(_) {
668
+ cell(
669
+ Ui::Buttons::Primary,
670
+ 'Start',
671
+ path: '#',
672
+ icon: 'fas fa-bullseye',
673
+ size: :small
674
+ ).()
675
+ }
676
+ ],
677
+ renderable: ->(item) {
678
+ content_tag(
679
+ :div,
680
+ [
681
+ content_tag(:p, item),
682
+ content_tag(
683
+ :nav,
684
+ cell(
685
+ Ui::Buttons::Tertiary,
686
+ 'Edit',
687
+ path: '#',
688
+ size: :small
689
+ ).call(:edit)
690
+ )
691
+ ].join(' ').html_safe,
692
+ class: 'flex flex-row justify-between items-center p-4'
693
+ )
694
+ }
695
+ ).() %>
696
+ </div>
697
+ </section>
698
+ </article>
699
+
700
+ <article class="style-guide__section" id="breadcrumbs">
701
+ <header>
702
+ <h1>Tables</h1>
703
+ </header>
704
+
705
+ <section class="style-guide__example" id="type">
706
+ <header>
707
+ <h2>Basic</h2>
708
+ </header>
709
+
710
+ <div class="space-y-4">
711
+ <%= cell(
712
+ Ui::Table,
713
+ [
714
+ "Data 1",
715
+ "Data 2",
716
+ "Data 3",
717
+ ],
718
+ columns: [
719
+ ["Column 1", ->(data) { data } ],
720
+ ["Column 2", ->(data) { "Column 2 data" } ],
721
+ ["Column 3", ->(data) { "Column 3 data" } ],
722
+ ["Actions", ->(data) { cell(Ui::Buttons::Tertiary, 'More')} ],
723
+ ],
724
+ header: 'My title',
725
+ style: 'my-style'
726
+ ).() %>
727
+ </div>
728
+ </section>
729
+
730
+ <section class="style-guide__example" id="type">
731
+ <header>
732
+ <h2>Selectable</h2>
733
+ </header>
734
+
735
+ <div class="space-y-8">
736
+ <%= cell(
737
+ Ui::Table,
738
+ [
739
+ "Data 1",
740
+ "Data 2",
741
+ "Data 3",
742
+ ],
743
+ columns: [
744
+ ["Column 1", ->(data) { data } ],
745
+ ["Column 2", ->(data) { "Column 2 data" } ],
746
+ ["Column 3", ->(data) { "Column 3 data" } ],
747
+ ["Actions", ->(data) { cell(Ui::Buttons::Tertiary, 'More')} ],
748
+ ],
749
+ header: 'Multi select',
750
+ style: 'my-style',
751
+ features: {
752
+ selectable: {
753
+ multiple: true
754
+ }
755
+ }
756
+ ).() %>
757
+
758
+ <%= cell(
759
+ Ui::Table,
760
+ [
761
+ "Data 1",
762
+ "Data 2",
763
+ "Data 3",
764
+ ],
765
+ columns: [
766
+ ["Column 1", ->(data) { data } ],
767
+ ["Column 2", ->(data) { "Column 2 data" } ],
768
+ ["Column 3", ->(data) { "Column 3 data" } ],
769
+ ["Actions", ->(data) { cell(Ui::Buttons::Tertiary, 'More')} ],
770
+ ],
771
+ header: 'Single select',
772
+ style: 'my-style',
773
+ features: {
774
+ selectable: {
775
+ multiple: false
776
+ }
777
+ }
778
+ ).() %>
779
+ </div>
780
+ </section>
781
+
782
+ <section class="style-guide__example" id="type">
783
+ <header>
784
+ <h2>Sortable</h2>
785
+ </header>
786
+
787
+ <div class="space-y-8">
788
+ <%= cell(
789
+ Ui::Table,
790
+ [
791
+ "Data 1",
792
+ "Data 2",
793
+ "Data 3",
794
+ ],
795
+ columns: [
796
+ ["Column 1", ->(data) { data } ],
797
+ ["Column 2", ->(data) { "Column 2 data" } ],
798
+ ["Column 3", ->(data) { "Column 3 data" } ],
799
+ ["Actions", ->(data) { cell(Ui::Buttons::Tertiary, 'More')} ],
800
+ ],
801
+ header: 'Multi select',
802
+ style: 'my-style',
803
+ features: {
804
+ selectable: {
805
+ multiple: true,
806
+ },
807
+ sortable: {
808
+ input_name: 'object[position]',
809
+ update_url: '#',
810
+ handle: 'fas fa-bars'
811
+ }
812
+ }
813
+ ).() %>
814
+ </div>
815
+ </section>
816
+ </article>
817
+
818
+ <article class="style-guide__section" id="breadcrumbs">
819
+ <header>
820
+ <h1>Empty</h1>
821
+ </header>
822
+
823
+ <section class="style-guide__example" id="type">
824
+ <header>
825
+ <h2>Basic</h2>
826
+ </header>
827
+
828
+ <div class="space-y-4">
829
+ <%= cell(
830
+ Ui::Empty,
831
+ nil,
832
+ caption: 'My title',
833
+ ).() %>
834
+ </div>
835
+ </section>
836
+
837
+ <section class="style-guide__example" id="type">
838
+ <header>
839
+ <h2>Image</h2>
840
+ </header>
841
+
842
+ <div class="space-y-4">
843
+ <%= cell(
844
+ Ui::Empty,
845
+ nil,
846
+ caption: content_tag(:p, 'My title', class: 'text-lg'),
847
+ image: 'https://upload.wikimedia.org/wikipedia/commons/f/f3/Hubble_Ultra_Deep_Field_part_d.jpg',
848
+ ).() %>
849
+ </div>
850
+ </section>
851
+
852
+ <section class="style-guide__example" id="type">
853
+ <header>
854
+ <h2>Action</h2>
855
+ </header>
856
+
857
+ <div class="space-y-4">
858
+ <%= cell(
859
+ Ui::Empty,
860
+ nil,
861
+ caption: content_tag(:p, 'My title', class: 'text-lg'),
862
+ icon: 'fas fa-inbox fa-5x text-gray-400',
863
+ actions: [
864
+ ->(_) {
865
+ cell(
866
+ Ui::Buttons::Primary,
867
+ 'Click me'
868
+ ).()
869
+ }
870
+ ]
871
+ ).() %>
872
+ </div>
873
+ </section>
874
+
875
+ <section class="style-guide__example" id="type">
876
+ <header>
877
+ <h2>Table</h2>
878
+ </header>
879
+
880
+ <div class="space-y-4">
881
+ <%= cell(
882
+ Ui::Table,
883
+ [],
884
+ columns: [
885
+ ["Column 1", ->(data) { data } ],
886
+ ["Column 2", ->(data) { "Column 2 data" } ],
887
+ ["Column 3", ->(data) { "Column 3 data" } ],
888
+ ["Actions", ->(data) { cell(Ui::Buttons::Tertiary, 'More')} ],
889
+ ],
890
+ ).() %>
891
+ </div>
892
+ </section>
893
+
894
+ <section class="style-guide__example" id="type">
895
+ <header>
896
+ <h2>List</h2>
897
+ </header>
898
+
899
+ <div class="space-y-4">
900
+ <%= cell(
901
+ Ui::List,
902
+ [],
903
+ header: 'My list',
904
+ footer: 'My list footer',
905
+ ).() %>
906
+ </div>
907
+ </section>
908
+ </article>
909
+
910
+ <article class="style-guide__section" id="breadcrumbs">
911
+ <header>
912
+ <h1>Collapse</h1>
913
+ </header>
914
+
915
+ <section class="style-guide__example" id="type">
916
+ <header>
917
+ <h2>Basic</h2>
918
+ </header>
919
+
920
+ <div class="space-y-4">
921
+ <%= cell(
922
+ Ui::Collapse,
923
+ [
924
+ ["Panel #1", "Chaos theory is a branch of mathematics focusing on the study of chaos — dynamical systems whose apparently random states of disorder and irregularities are actually governed by underlying patterns and deterministic laws that are highly sensitive to initial conditions."],
925
+ ["Panel #2", "Chaos theory is a branch of mathematics focusing on the study of chaos — dynamical systems whose apparently random states of disorder and irregularities are actually governed by underlying patterns and deterministic laws that are highly sensitive to initial conditions."]
926
+ ],
927
+ style: 'my-style'
928
+ ).() %>
929
+ </div>
930
+ </section>
931
+ </article>
932
+
933
+ <article class="style-guide__section" id="breadcrumbs">
934
+ <header>
935
+ <h1>Tooltip</h1>
936
+ </header>
937
+
938
+ <section class="style-guide__example" id="type">
939
+ <header>
940
+ <h2>Hover</h2>
941
+ </header>
942
+
943
+ <div class="space-y-4">
944
+ <%= cell(
945
+ Ui::Buttons::Primary,
946
+ 'Hover me',
947
+ layout: Ui::Tooltip,
948
+ context: {
949
+ tooltip: {
950
+ content: ->() { content_tag(:p, 'This is an example of a tooltip.') },
951
+ header: ->() { content_tag(:p, 'Tooltip header', class: 'whitespace-nowrap') },
952
+ }
953
+ }
954
+ ).() %>
955
+ </div>
956
+ </section>
957
+
958
+ <section class="style-guide__example" id="type">
959
+ <header>
960
+ <h2>Click</h2>
961
+ </header>
962
+
963
+ <div class="space-y-4">
964
+ <%= cell(
965
+ Ui::Buttons::Primary,
966
+ 'Click me',
967
+ layout: Ui::Tooltip,
968
+ context: {
969
+ tooltip: {
970
+ content: ->() { content_tag(:p, 'This is an example of a tooltip.') },
971
+ header: ->() { content_tag(:p, 'Tooltip header', class: 'whitespace-nowrap') },
972
+ mode: 'click'
973
+ }
974
+ }
975
+ ).() %>
976
+ </div>
977
+ </section>
978
+ </article>
979
+
980
+ <article class="style-guide__section" id="breadcrumbs">
981
+ <header>
982
+ <h1>Notifications</h1>
983
+ </header>
984
+
985
+ <section class="style-guide__example relative" id="type">
986
+ <header>
987
+ <h2>Basic</h2>
988
+ </header>
989
+
990
+ <div class="space-y-4">
991
+ <%= cell(
992
+ Ui::Notification,
993
+ content_tag(
994
+ :header,
995
+ content_tag(:h3, 'My title', class: 'font-bold') +
996
+ content_tag(:p, 'This is a notification with some text', class: 'text-gray-500'),
997
+ class: 'space-y-2'
998
+ ),
999
+ ).() %>
1000
+ </div>
1001
+ </section>
1002
+
1003
+
1004
+ <section class="style-guide__example relative" id="type">
1005
+ <header>
1006
+ <h2>Actions</h2>
1007
+ </header>
1008
+
1009
+ <div class="space-y-4">
1010
+ <%= cell(
1011
+ Ui::Notification,
1012
+ content_tag(
1013
+ :header,
1014
+ content_tag(:h3, 'My title', class: 'font-bold') +
1015
+ content_tag(:p, 'This is a notification with some text', class: 'text-gray-500'),
1016
+ class: 'space-y-2'
1017
+ ),
1018
+ icon: 'fas fa-check-circle fa-lg text-green-500',
1019
+ actions: [
1020
+ ->(_) {
1021
+ cell(
1022
+ Ui::Buttons::Primary,
1023
+ 'Do something',
1024
+ size: :small,
1025
+ icon: 'fas fa-bullseye'
1026
+ )
1027
+ }
1028
+ ]
1029
+ ).() %>
1030
+ </div>
1031
+ </section>
1032
+ </article>
1033
+
1034
+ </article>
1035
+ </div>