rails-active-ui 0.3.4 → 0.3.6

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,666 @@
1
+ # ------------------------------------------------------------------
2
+ # Accordion
3
+ # ------------------------------------------------------------------
4
+ Header(size: :h3) { text "Accordion" }
5
+ text "Collapsible content sections."
6
+
7
+ Segment {
8
+ Accordion {
9
+ concat tag.div(class: "title active") {
10
+ safe_join([tag.i(class: "dropdown icon"), "What is a dog?"])
11
+ }
12
+ concat tag.div(class: "content active") {
13
+ tag.p("A dog is a type of domesticated animal. Known for its loyalty and faithfulness.")
14
+ }
15
+ concat tag.div(class: "title") {
16
+ safe_join([tag.i(class: "dropdown icon"), "What kinds of dogs are there?"])
17
+ }
18
+ concat tag.div(class: "content") {
19
+ tag.p("There are many breeds of dogs. Each breed varies in size and temperament.")
20
+ }
21
+ concat tag.div(class: "title") {
22
+ safe_join([tag.i(class: "dropdown icon"), "How do you acquire a dog?"])
23
+ }
24
+ concat tag.div(class: "content") {
25
+ tag.p("Three common ways: adopt from a shelter, find a breeder, or visit a pet store.")
26
+ }
27
+ }
28
+ }
29
+
30
+ Segment(secondary: true) {
31
+ concat tag.pre { tag.code(
32
+ 'Accordion(styled: true, fluid: true) {
33
+ concat tag.div(class: "title active") {
34
+ safe_join([tag.i(class: "dropdown icon"), "What is a dog?"])
35
+ }
36
+ concat tag.div(class: "content active") {
37
+ tag.p("A dog is a type of domesticated animal.")
38
+ }
39
+ concat tag.div(class: "title") {
40
+ safe_join([tag.i(class: "dropdown icon"), "What kinds of dogs are there?"])
41
+ }
42
+ concat tag.div(class: "content") {
43
+ tag.p("There are many breeds of dogs.")
44
+ }
45
+ }'
46
+ )}
47
+ }
48
+
49
+ Divider(hidden: true)
50
+
51
+ # ------------------------------------------------------------------
52
+ # Calendar
53
+ # ------------------------------------------------------------------
54
+ Header(size: :h3) { text "Calendar" }
55
+ text "A date/time picker powered by Fomantic UI calendar module."
56
+
57
+ Segment {
58
+ Calendar(type: "date", name: "example_date") {
59
+ concat tag.div(class: "ui input left icon") {
60
+ safe_join([
61
+ tag.i(class: "calendar icon"),
62
+ tag.input(type: "text", placeholder: "Pick a date")
63
+ ])
64
+ }
65
+ }
66
+ }
67
+
68
+ Segment(secondary: true) {
69
+ concat tag.pre { tag.code(
70
+ 'Calendar(type: "date", name: "example_date") {
71
+ concat tag.div(class: "ui input left icon") {
72
+ safe_join([
73
+ tag.i(class: "calendar icon"),
74
+ tag.input(type: "text", placeholder: "Pick a date")
75
+ ])
76
+ }
77
+ }'
78
+ )}
79
+ }
80
+
81
+ Divider(hidden: true)
82
+
83
+ # ------------------------------------------------------------------
84
+ # Checkbox
85
+ # ------------------------------------------------------------------
86
+ Header(size: :h3) { text "Checkbox" }
87
+ text "Styled checkboxes and toggles."
88
+
89
+ Segment {
90
+ VStack(spacing: 12) {
91
+ Checkbox(label_text: "Accept terms and conditions", name: "terms")
92
+ Checkbox(type: "toggle", label_text: "Enable notifications", name: "notifications")
93
+ Checkbox(type: "slider", label_text: "Dark mode", name: "dark_mode")
94
+ Checkbox(label_text: "Checked by default", name: "checked", checked: true)
95
+ Checkbox(label_text: "Disabled option", name: "disabled", disabled: true)
96
+ }
97
+ }
98
+
99
+ Segment(secondary: true) {
100
+ concat tag.pre { tag.code(
101
+ 'Checkbox(label_text: "Accept terms and conditions", name: "terms")
102
+ Checkbox(type: "toggle", label_text: "Enable notifications", name: "notifications")
103
+ Checkbox(type: "slider", label_text: "Dark mode", name: "dark_mode")
104
+ Checkbox(label_text: "Checked by default", name: "checked", checked: true)
105
+ Checkbox(label_text: "Disabled option", name: "disabled", disabled: true)'
106
+ )}
107
+ }
108
+
109
+ Divider(hidden: true)
110
+
111
+ # ------------------------------------------------------------------
112
+ # Dimmer
113
+ # ------------------------------------------------------------------
114
+ Header(size: :h3) { text "Dimmer" }
115
+ text "Dims content to focus attention or indicate loading."
116
+
117
+ Segment {
118
+ concat tag.div(class: "ui segment", style: "min-height: 100px;") {
119
+ capture {
120
+ Dimmer(active: true) {
121
+ concat tag.div(class: "content") {
122
+ tag.div(class: "center") {
123
+ capture {
124
+ Header(size: :h2, inverted: true, icon: "heart") { text "Dimmed!" }
125
+ }
126
+ }
127
+ }
128
+ }
129
+ text "This content is behind the dimmer."
130
+ }
131
+ }
132
+ }
133
+
134
+ Segment(secondary: true) {
135
+ concat tag.pre { tag.code(
136
+ 'Dimmer(active: true) {
137
+ concat tag.div(class: "content") {
138
+ tag.div(class: "center") {
139
+ capture {
140
+ Header(size: :h2, inverted: true, icon: "heart") { text "Dimmed!" }
141
+ }
142
+ }
143
+ }
144
+ }'
145
+ )}
146
+ }
147
+
148
+ Divider(hidden: true)
149
+
150
+ # ------------------------------------------------------------------
151
+ # Dropdown
152
+ # ------------------------------------------------------------------
153
+ Header(size: :h3) { text "Dropdown" }
154
+ text "A selection dropdown with search, multiple, and other options."
155
+
156
+ Segment {
157
+ VStack(spacing: 12) {
158
+ Dropdown(selection: true, placeholder: "Select a country", name: "country") {
159
+ concat tag.div(class: "default text") { "Select a country" }
160
+ concat tag.i(class: "dropdown icon")
161
+ concat tag.div(class: "menu") {
162
+ capture {
163
+ concat tag.div(class: "item", "data-value": "us") {
164
+ safe_join([tag.i(class: "us flag"), "United States"])
165
+ }
166
+ concat tag.div(class: "item", "data-value": "gb") {
167
+ safe_join([tag.i(class: "gb flag"), "United Kingdom"])
168
+ }
169
+ concat tag.div(class: "item", "data-value": "de") {
170
+ safe_join([tag.i(class: "de flag"), "Germany"])
171
+ }
172
+ }
173
+ }
174
+ }
175
+
176
+ Dropdown(selection: true, search: true, placeholder: "Search languages", name: "language") {
177
+ concat tag.div(class: "default text") { "Search languages" }
178
+ concat tag.i(class: "dropdown icon")
179
+ concat tag.div(class: "menu") {
180
+ capture {
181
+ concat tag.div(class: "item", "data-value": "ruby") { "Ruby" }
182
+ concat tag.div(class: "item", "data-value": "python") { "Python" }
183
+ concat tag.div(class: "item", "data-value": "javascript") { "JavaScript" }
184
+ concat tag.div(class: "item", "data-value": "go") { "Go" }
185
+ }
186
+ }
187
+ }
188
+ }
189
+ }
190
+
191
+ Segment(secondary: true) {
192
+ concat tag.pre { tag.code(
193
+ 'Dropdown(selection: true, placeholder: "Select a country", name: "country") {
194
+ concat tag.div(class: "default text") { "Select a country" }
195
+ concat tag.i(class: "dropdown icon")
196
+ concat tag.div(class: "menu") {
197
+ capture {
198
+ concat tag.div(class: "item", "data-value": "us") {
199
+ safe_join([tag.i(class: "us flag"), "United States"])
200
+ }
201
+ concat tag.div(class: "item", "data-value": "gb") {
202
+ safe_join([tag.i(class: "gb flag"), "United Kingdom"])
203
+ }
204
+ }
205
+ }
206
+ }'
207
+ )}
208
+ }
209
+
210
+ Divider(hidden: true)
211
+
212
+ # ------------------------------------------------------------------
213
+ # Embed
214
+ # ------------------------------------------------------------------
215
+ Header(size: :h3) { text "Embed" }
216
+ text "Embed external content like videos from YouTube or Vimeo."
217
+
218
+ Segment {
219
+ Embed(source: "youtube", embed_id: "pfdu_gTry8E", placeholder: "https://fomantic-ui.com/images/image-16by9.png")
220
+ }
221
+
222
+ Segment(secondary: true) {
223
+ concat tag.pre { tag.code(
224
+ 'Embed(source: "youtube", embed_id: "pfdu_gTry8E", placeholder: "https://fomantic-ui.com/images/image-16by9.png")'
225
+ )}
226
+ }
227
+
228
+ Divider(hidden: true)
229
+
230
+ # ------------------------------------------------------------------
231
+ # Flyout
232
+ # ------------------------------------------------------------------
233
+ Header(size: :h3) { text "Flyout" }
234
+ text "A slide-out panel from the edge of the screen."
235
+
236
+ Segment {
237
+ Flyout(direction: "right") { |c|
238
+ c.header { text "Flyout Title" }
239
+ c.content { text "This is the flyout content panel." }
240
+ c.actions {
241
+ Button(color: :green) { text "Approve" }
242
+ Button { text "Cancel" }
243
+ }
244
+ }
245
+ text "Flyout is rendered but hidden by default. Trigger via JS: $(\".ui.flyout\").flyout(\"show\")"
246
+ }
247
+
248
+ Segment(secondary: true) {
249
+ concat tag.pre { tag.code(
250
+ 'Flyout(direction: "right") { |c|
251
+ c.header { text "Flyout Title" }
252
+ c.content { text "This is the flyout content panel." }
253
+ c.actions {
254
+ Button(color: :green) { text "Approve" }
255
+ Button { text "Cancel" }
256
+ }
257
+ }'
258
+ )}
259
+ }
260
+
261
+ Divider(hidden: true)
262
+
263
+ # ------------------------------------------------------------------
264
+ # Modal
265
+ # ------------------------------------------------------------------
266
+ Header(size: :h3) { text "Modal" }
267
+ text "A modal dialog for focused user interaction."
268
+
269
+ Segment {
270
+ Modal(size: :small) { |c|
271
+ c.header { text "Confirm Action" }
272
+ c.content { text "Are you sure you want to proceed with this action?" }
273
+ c.actions {
274
+ Button(color: :green) { text "Yes" }
275
+ Button(color: :red) { text "No" }
276
+ }
277
+ }
278
+ text "Modal is rendered hidden. Trigger via JS: $(\".ui.modal\").modal(\"show\")"
279
+ }
280
+
281
+ Segment(secondary: true) {
282
+ concat tag.pre { tag.code(
283
+ 'Modal(size: :small) { |c|
284
+ c.header { text "Confirm Action" }
285
+ c.content { text "Are you sure you want to proceed with this action?" }
286
+ c.actions {
287
+ Button(color: :green) { text "Yes" }
288
+ Button(color: :red) { text "No" }
289
+ }
290
+ }'
291
+ )}
292
+ }
293
+
294
+ Divider(hidden: true)
295
+
296
+ # ------------------------------------------------------------------
297
+ # Nag
298
+ # ------------------------------------------------------------------
299
+ Header(size: :h3) { text "Nag" }
300
+ text "A dismissable notification bar, typically at the top of a page."
301
+
302
+ Segment {
303
+ Nag(fixed: true) {
304
+ text "We use cookies to ensure you get the best experience. "
305
+ concat tag.a("Learn more", href: "#", style: "color: white; text-decoration: underline;")
306
+ Icon(name: "close")
307
+ }
308
+ }
309
+
310
+ Segment(secondary: true) {
311
+ concat tag.pre { tag.code(
312
+ 'Nag(fixed: true) {
313
+ text "We use cookies to ensure you get the best experience. "
314
+ concat tag.a("Learn more", href: "#")
315
+ Icon(name: "close")
316
+ }'
317
+ )}
318
+ }
319
+
320
+ Divider(hidden: true)
321
+
322
+ # ------------------------------------------------------------------
323
+ # Popup
324
+ # ------------------------------------------------------------------
325
+ Header(size: :h3) { text "Popup" }
326
+ text "A popup tooltip displayed on hover or click."
327
+
328
+ Segment {
329
+ HStack(spacing: 16) {
330
+ Popup(content: "This is a popup tooltip", position: "top center") {
331
+ Button(color: :blue) { text "Hover me" }
332
+ }
333
+
334
+ Popup(title: "Info", content: "Additional details here", position: "bottom center") {
335
+ Icon(name: "info circle", size: :large, color: :teal, link: true)
336
+ }
337
+ }
338
+ }
339
+
340
+ Segment(secondary: true) {
341
+ concat tag.pre { tag.code(
342
+ 'Popup(content: "This is a popup tooltip", position: "top center") {
343
+ Button(color: :blue) { text "Hover me" }
344
+ }
345
+
346
+ Popup(title: "Info", content: "Additional details here", position: "bottom center") {
347
+ Icon(name: "info circle", size: :large, color: :teal, link: true)
348
+ }'
349
+ )}
350
+ }
351
+
352
+ Divider(hidden: true)
353
+
354
+ # ------------------------------------------------------------------
355
+ # Progress
356
+ # ------------------------------------------------------------------
357
+ Header(size: :h3) { text "Progress" }
358
+ text "A progress bar indicating completion status."
359
+
360
+ Segment {
361
+ VStack(spacing: 16) {
362
+ Progress(value: 75, total: 100, color: :blue, size: :medium, active: true) { |c|
363
+ c.bar {
364
+ concat tag.div(class: "progress")
365
+ }
366
+ c.label { text "75% Complete" }
367
+ }
368
+
369
+ Progress(value: 30, total: 100, color: :green, indicating: true) { |c|
370
+ c.bar {
371
+ concat tag.div(class: "progress")
372
+ }
373
+ c.label { text "Uploading files..." }
374
+ }
375
+
376
+ Progress(value: 100, total: 100, color: :green) { |c|
377
+ c.bar {
378
+ concat tag.div(class: "progress")
379
+ }
380
+ c.label { text "Done!" }
381
+ }
382
+ }
383
+ }
384
+
385
+ Segment(secondary: true) {
386
+ concat tag.pre { tag.code(
387
+ 'Progress(value: 75, total: 100, color: :blue, size: :medium, active: true) { |c|
388
+ c.bar {
389
+ concat tag.div(class: "progress")
390
+ }
391
+ c.label { text "75% Complete" }
392
+ }
393
+
394
+ Progress(value: 30, total: 100, color: :green, indicating: true) { |c|
395
+ c.bar { concat tag.div(class: "progress") }
396
+ c.label { text "Uploading files..." }
397
+ }'
398
+ )}
399
+ }
400
+
401
+ Divider(hidden: true)
402
+
403
+ # ------------------------------------------------------------------
404
+ # Slider
405
+ # ------------------------------------------------------------------
406
+ Header(size: :h3) { text "Slider" }
407
+ text "A draggable slider input control."
408
+
409
+ Segment {
410
+ VStack(spacing: 16) {
411
+ Slider(min: 0, max: 100, value: 40, name: "volume")
412
+ Slider(min: 0, max: 10, value: 5, labeled: true, color: :blue, name: "rating")
413
+ }
414
+ }
415
+
416
+ Segment(secondary: true) {
417
+ concat tag.pre { tag.code(
418
+ 'Slider(min: 0, max: 100, value: 40, name: "volume")
419
+ Slider(min: 0, max: 10, value: 5, labeled: true, color: :blue, name: "rating")'
420
+ )}
421
+ }
422
+
423
+ Divider(hidden: true)
424
+
425
+ # ------------------------------------------------------------------
426
+ # Rating
427
+ # ------------------------------------------------------------------
428
+ Header(size: :h3) { text "Rating" }
429
+ text "A star or heart rating input."
430
+
431
+ Segment {
432
+ HStack(spacing: 24) {
433
+ VStack(spacing: 4) {
434
+ text "Stars:"
435
+ Rating(max_rating: 5, rating: 3, icon: "star", size: :huge)
436
+ }
437
+ VStack(spacing: 4) {
438
+ text "Hearts:"
439
+ Rating(max_rating: 5, rating: 4, icon: "heart", size: :huge)
440
+ }
441
+ VStack(spacing: 4) {
442
+ text "Disabled:"
443
+ Rating(max_rating: 5, rating: 2, disabled: true, size: :large)
444
+ }
445
+ }
446
+ }
447
+
448
+ Segment(secondary: true) {
449
+ concat tag.pre { tag.code(
450
+ 'Rating(max_rating: 5, rating: 3, icon: "star", size: :huge)
451
+ Rating(max_rating: 5, rating: 4, icon: "heart", size: :huge)
452
+ Rating(max_rating: 5, rating: 2, disabled: true, size: :large)'
453
+ )}
454
+ }
455
+
456
+ Divider(hidden: true)
457
+
458
+ # ------------------------------------------------------------------
459
+ # Search
460
+ # ------------------------------------------------------------------
461
+ Header(size: :h3) { text "Search" }
462
+ text "A search input with autocomplete support."
463
+
464
+ Segment {
465
+ Search(placeholder: "Search for something...", fluid: true, name: "query")
466
+ }
467
+
468
+ Segment(secondary: true) {
469
+ concat tag.pre { tag.code(
470
+ 'Search(placeholder: "Search for something...", fluid: true, name: "query")'
471
+ )}
472
+ }
473
+
474
+ Divider(hidden: true)
475
+
476
+ # ------------------------------------------------------------------
477
+ # Shape
478
+ # ------------------------------------------------------------------
479
+ Header(size: :h3) { text "Shape" }
480
+ text "Animated shape that flips or rotates between content sides."
481
+
482
+ Segment {
483
+ Shape(type: "cube") {
484
+ concat tag.div(class: "sides") {
485
+ capture {
486
+ concat tag.div(class: "side active") {
487
+ capture {
488
+ Segment(inverted: true, color: :blue) { text "Side 1" }
489
+ }
490
+ }
491
+ concat tag.div(class: "side") {
492
+ capture {
493
+ Segment(inverted: true, color: :green) { text "Side 2" }
494
+ }
495
+ }
496
+ }
497
+ }
498
+ }
499
+ }
500
+
501
+ Segment(secondary: true) {
502
+ concat tag.pre { tag.code(
503
+ 'Shape(type: "cube") {
504
+ concat tag.div(class: "sides") {
505
+ capture {
506
+ concat tag.div(class: "side active") {
507
+ capture { Segment(inverted: true, color: :blue) { text "Side 1" } }
508
+ }
509
+ concat tag.div(class: "side") {
510
+ capture { Segment(inverted: true, color: :green) { text "Side 2" } }
511
+ }
512
+ }
513
+ }
514
+ }'
515
+ )}
516
+ }
517
+
518
+ Divider(hidden: true)
519
+
520
+ # ------------------------------------------------------------------
521
+ # Sidebar
522
+ # ------------------------------------------------------------------
523
+ Header(size: :h3) { text "Sidebar" }
524
+ text "A slide-out sidebar menu."
525
+
526
+ Segment {
527
+ Sidebar(direction: "left", width: "thin") {
528
+ MenuItem(href: "#") {
529
+ Icon(name: "home")
530
+ text "Home"
531
+ }
532
+ MenuItem(href: "#") {
533
+ Icon(name: "gamepad")
534
+ text "Games"
535
+ }
536
+ MenuItem(href: "#") {
537
+ Icon(name: "camera")
538
+ text "Channels"
539
+ }
540
+ }
541
+ text "Sidebar is rendered hidden. Trigger via JS: $(\".ui.sidebar\").sidebar(\"toggle\")"
542
+ }
543
+
544
+ Segment(secondary: true) {
545
+ concat tag.pre { tag.code(
546
+ 'Sidebar(direction: "left", width: "thin") {
547
+ MenuItem(href: "#") {
548
+ Icon(name: "home")
549
+ text "Home"
550
+ }
551
+ MenuItem(href: "#") {
552
+ Icon(name: "gamepad")
553
+ text "Games"
554
+ }
555
+ }'
556
+ )}
557
+ }
558
+
559
+ Divider(hidden: true)
560
+
561
+ # ------------------------------------------------------------------
562
+ # Sticky
563
+ # ------------------------------------------------------------------
564
+ Header(size: :h3) { text "Sticky" }
565
+ text "Content that sticks to the viewport while scrolling within a context."
566
+
567
+ Segment {
568
+ Sticky(offset: 10) {
569
+ Segment(compact: true) { text "This content can stick on scroll." }
570
+ }
571
+ }
572
+
573
+ Segment(secondary: true) {
574
+ concat tag.pre { tag.code(
575
+ 'Sticky(offset: 10) {
576
+ Segment(compact: true) { text "This content can stick on scroll." }
577
+ }'
578
+ )}
579
+ }
580
+
581
+ Divider(hidden: true)
582
+
583
+ # ------------------------------------------------------------------
584
+ # Tab
585
+ # ------------------------------------------------------------------
586
+ Header(size: :h3) { text "Tab" }
587
+ text "Tab content panels used with a menu for switching views."
588
+
589
+ Segment {
590
+ Menu(pointing: true, secondary: true) {
591
+ MenuItem(active: true) {
592
+ concat tag.a("data-tab": "tab-1") { "Tab 1" }
593
+ }
594
+ MenuItem {
595
+ concat tag.a("data-tab": "tab-2") { "Tab 2" }
596
+ }
597
+ }
598
+ Tab(active: true, path: "tab-1") {
599
+ text "Content for Tab 1"
600
+ }
601
+ Tab(path: "tab-2") {
602
+ text "Content for Tab 2"
603
+ }
604
+ }
605
+
606
+ Segment(secondary: true) {
607
+ concat tag.pre { tag.code(
608
+ 'Menu(pointing: true, secondary: true) {
609
+ MenuItem(active: true) {
610
+ concat tag.a("data-tab": "tab-1") { "Tab 1" }
611
+ }
612
+ MenuItem {
613
+ concat tag.a("data-tab": "tab-2") { "Tab 2" }
614
+ }
615
+ }
616
+ Tab(active: true, path: "tab-1") {
617
+ text "Content for Tab 1"
618
+ }
619
+ Tab(path: "tab-2") {
620
+ text "Content for Tab 2"
621
+ }'
622
+ )}
623
+ }
624
+
625
+ Divider(hidden: true)
626
+
627
+ # ------------------------------------------------------------------
628
+ # Toast
629
+ # ------------------------------------------------------------------
630
+ Header(size: :h3) { text "Toast" }
631
+ text "A temporary notification message."
632
+
633
+ Segment {
634
+ Toast(title: "Success", message: "Your changes have been saved.", type: "success", display_time: 5000, position: "top right")
635
+ Toast(title: "Info", message: "New version available.", type: "info", compact: true, position: "top right")
636
+ text "Toast notifications appear automatically on page load. Configure display_time and position."
637
+ }
638
+
639
+ Segment(secondary: true) {
640
+ concat tag.pre { tag.code(
641
+ 'Toast(title: "Success", message: "Your changes have been saved.", type: "success", display_time: 5000, position: "top right")
642
+ Toast(title: "Info", message: "New version available.", type: "info", compact: true, position: "top right")'
643
+ )}
644
+ }
645
+
646
+ Divider(hidden: true)
647
+
648
+ # ------------------------------------------------------------------
649
+ # Transition
650
+ # ------------------------------------------------------------------
651
+ Header(size: :h3) { text "Transition" }
652
+ text "Adds CSS transition animations to content."
653
+
654
+ Segment {
655
+ Transition(animation: "fade", duration: 500, visible: true) {
656
+ Segment(compact: true) { text "This content has a fade transition." }
657
+ }
658
+ }
659
+
660
+ Segment(secondary: true) {
661
+ concat tag.pre { tag.code(
662
+ 'Transition(animation: "fade", duration: 500, visible: true) {
663
+ Segment(compact: true) { text "This content has a fade transition." }
664
+ }'
665
+ )}
666
+ }