tramway 2.0.1.1 → 2.0.2

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: 3bd6eb6d708a8b3f4ce6b23fa65dbef402851081a090a14b7ca2d01d14694b6d
4
- data.tar.gz: 8dcab579e2dbf2a9a21178d710ec43edfd40a006d4a54755bd885eab71c7dd64
3
+ metadata.gz: c421d98b7d6e5ceac1042c02b4d96f0f4fb5fac9851660f4776af8d9a4f47ae1
4
+ data.tar.gz: 707231fa0d49e2fa0e8e0d21679e2b7f30368285dd43cc9b09c0fa2b179e3f08
5
5
  SHA512:
6
- metadata.gz: d79da51f2ba0157b7dd94a52e59a2fd379166dc0397a72375f42b24513f6e78d2a7b93b4d36d1ca2d1f4fd328d7beea5de021a98c40e335c0f0b76e6ef85ac03
7
- data.tar.gz: ae2a74273a7812c6b5c7e0bd80487fd61f22d1d6cc082d1117d328d4d279b28b5b90ba8008583463c1c702d86fa618de05c3abb3cec87fcc71cc2e5982abe18a
6
+ metadata.gz: c4aa0f111d82f5005fdef3a7d0f57ec9f1cb8255a9fa01aeb376e598711ab86619449bbee9f73c047dd5038bdfabf26287a34f763da55cb099da2db0968f2ebf
7
+ data.tar.gz: 2ff65fcefa12c47d50a5a1fdb83a04372faa8c036679df8ca7511703f8533f780f385d55ab6d4940870c2fe2b5c01df0f902a7f609b3a77515ec7c02035f2bf9
data/README.md CHANGED
@@ -13,6 +13,7 @@ Unite Ruby on Rails brilliance. Streamline development with Tramway.
13
13
  * [Tramway Decorators](https://github.com/Purple-Magic/tramway#tramway-decorators)
14
14
  * [Tramway Form](https://github.com/Purple-Magic/tramway#tramway-form)
15
15
  * [Tramway Navbar](https://github.com/Purple-Magic/tramway#tramway-navbar)
16
+ * [Tramway Flash](https://github.com/Purple-Magic/tramway#tramway-flash)
16
17
  * [Tramway Table Component](https://github.com/Purple-Magic/tramway#tramway-table-component)
17
18
  * [Tailwind-styled forms](https://github.com/Purple-Magic/tramway#tailwind-styled-forms)
18
19
  * [Stimulus-based inputs](https://github.com/Purple-Magic/tramway#stimulus-based-inputs)
@@ -708,6 +709,27 @@ tramway_navbar title: 'Purple Magic' do |nav|
708
709
  end
709
710
  ```
710
711
 
712
+ ### Tramway Flash
713
+
714
+ `tramway_flash` renders the Tailwind-styled flash component that Tramway uses in its layouts. Pass the flash text and type, and
715
+ the helper will resolve the proper Tailwind color (for example `:success` -> green, `:warning` -> orange). You can also provide
716
+ custom HTML options directly (e.g., `class:`, `data:`) and they will be merged into the flash container.
717
+
718
+ ```haml
719
+ -# Haml example
720
+ = tramway_flash text: flash[:notice], type: :success
721
+ = tramway_flash text: 'Double check your data', type: :warning, class: 'mt-2', data: { turbo: 'false' }
722
+ ```
723
+
724
+ ```erb
725
+ <%# ERB example %>
726
+ <%= tramway_flash text: flash[:alert], type: :danger %>
727
+ <%= tramway_flash text: 'Saved!', type: :success, data: { controller: 'dismissible' } %>
728
+ ```
729
+
730
+ Use the `type` argument for semantic colors (`:success`, `:warning`, `:danger`, and more) or provide a `color:` keyword to set
731
+ the Tailwind color family explicitly.
732
+
711
733
  ### Tramway Table Component
712
734
 
713
735
  Tramway provides a responsive, tailwind-styled table with light and dark themes. Use the `tramway_table`, `tramway_row`, and
@@ -0,0 +1,23 @@
1
+ :css
2
+ @keyframes fadeout {
3
+ 0% {
4
+ opacity: 1;
5
+ }
6
+
7
+ 80% {
8
+ opacity: 1;
9
+ }
10
+
11
+ 100% {
12
+ opacity: 0;
13
+ }
14
+ }
15
+
16
+ .flash {
17
+ animation: fadeout 2.7s ease-out forwards;
18
+ }
19
+
20
+ .fixed.top-4.right-4.z-50.space-y-2{ **options }
21
+ .flash.opacity-100.text-white.px-4.py-2.rounded.shadow{ class: "bg-#{resolved_color}-700" }
22
+ .text-xl.font-bold
23
+ = text
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tailwinds
4
+ # Description: A Tailwinds flash message component for displaying notifications.
5
+ class FlashComponent < Tailwinds::BaseComponent
6
+ option :text
7
+ option :type, optional: true, default: -> {}
8
+ option :color, optional: true, default: -> {}
9
+ option :options, optional: true, default: -> { {} }
10
+ end
11
+ end
@@ -19,39 +19,13 @@
19
19
  / Includes all stylesheet files in app/assets/stylesheets
20
20
  = stylesheet_link_tag "tailwind", "data-turbo-track": "reload"
21
21
 
22
- :css
23
- @keyframes fadeout {
24
- 0% {
25
- opacity: 1;
26
- }
27
-
28
- 80% {
29
- opacity: 1;
30
- }
31
-
32
- 100% {
33
- opacity: 0;
34
- }
35
- }
36
-
37
- .flash {
38
- animation: fadeout 2.7s ease-out forwards;
39
- }
40
-
41
22
  %body.bg-gray-100.dark:bg-gray-900.text-gray-900.dark:text-white
42
23
  = tramway_navbar title: 'Tramway'
43
24
 
44
25
  - if flash.any?
45
- #flash-container.fixed.top-4.right-4.z-50.space-y-2
46
- - if flash[:notice]
47
- .flash.opacity-100.bg-green-700.text-white.px-4.py-2.rounded.shadow
48
- .text-xl.font-bold
49
- = flash[:notice]
50
-
51
- - if flash[:alert]
52
- .flash.opacity-100.bg-yellow-700.text-black.px-4.py-2.rounded.shadow
53
- .text-xl.font-bold
54
- = flash[:alert]
26
+ = tramway_flash text: flash[:notice].presence || flash[:alert],
27
+ type: flash[:notice].present? ? :will : :rage,
28
+ id: 'flash-container'
55
29
 
56
30
  .container.mx-auto.p-4.flex.align-center.justify-center
57
31
  = yield
@@ -67,6 +67,10 @@ module Tramway
67
67
  def tramway_title(text: nil, &)
68
68
  component 'tailwinds/title', text:, &
69
69
  end
70
+
71
+ def tramway_flash(text:, type:, **options)
72
+ component 'tailwinds/flash', text:, type:, options:
73
+ end
70
74
  end
71
75
  end
72
76
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tramway
4
- VERSION = '2.0.1.1'
4
+ VERSION = '2.0.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - kalashnikovisme
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-12-07 00:00:00.000000000 Z
12
+ date: 2025-12-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: anyway_config
@@ -152,6 +152,8 @@ files:
152
152
  - app/components/tailwinds/button_component.rb
153
153
  - app/components/tailwinds/containers/narrow_component.html.haml
154
154
  - app/components/tailwinds/containers/narrow_component.rb
155
+ - app/components/tailwinds/flash_component.html.haml
156
+ - app/components/tailwinds/flash_component.rb
155
157
  - app/components/tailwinds/form/builder.rb
156
158
  - app/components/tailwinds/form/date_field_component.html.haml
157
159
  - app/components/tailwinds/form/date_field_component.rb