tramway 2.0.1.1 → 2.0.3
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 +4 -4
- data/README.md +38 -13
- data/app/components/tailwinds/button_component.rb +2 -2
- data/app/components/tailwinds/flash_component.html.haml +23 -0
- data/app/components/tailwinds/flash_component.rb +11 -0
- data/app/views/tramway/layouts/application.html.haml +3 -29
- data/lib/tramway/helpers/views_helper.rb +4 -0
- data/lib/tramway/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5565893c9153d2914e800609426fe0be62fe9c46163c80e4964cdf427c4178f4
|
|
4
|
+
data.tar.gz: 374172adbeaf55a926859c54c21ef78d2d9d56fbbe84af44544bd0a3cd1de5c3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7061fae419485630e856be9422f9b495ecb6316f367c7341f019bb360782e13d4993e7324eedac1eed9f51b440a56b33cbb0bbc53f8f2955ef7d90312ae3bcdd
|
|
7
|
+
data.tar.gz: 02d84eabc379ea00eb75b2f6750dd928d5eabe088d71dfe5442598253e1afc1fa11bb2cf7a3cec789cc56f76daa3edde66c2eca559ba39d38a73faceb25bd919
|
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: :hope
|
|
721
|
+
= tramway_flash text: 'Double check your data', type: :greed, class: 'mt-2', data: { turbo: 'false' }
|
|
722
|
+
```
|
|
723
|
+
|
|
724
|
+
```erb
|
|
725
|
+
<%# ERB example %>
|
|
726
|
+
<%= tramway_flash text: flash[:alert], type: :rage %>
|
|
727
|
+
<%= tramway_flash text: 'Saved!', type: :will, data: { controller: 'dismissible' } %>
|
|
728
|
+
```
|
|
729
|
+
|
|
730
|
+
Use the `type` argument is compatible to [Lantern Color Palette](https://github.com/TrinityMonsters/tramway/blob/main/README.md#lantern-color-palette) 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
|
|
@@ -795,19 +817,7 @@ Tramway ships with helpers for common UI patterns built on top of Tailwind compo
|
|
|
795
817
|
options: { data: { controller: 'submit-once' } } %>
|
|
796
818
|
```
|
|
797
819
|
|
|
798
|
-
The `type` option maps semantic intent to
|
|
799
|
-
|
|
800
|
-
| Type | Color |
|
|
801
|
-
| ---- | ----- |
|
|
802
|
-
| `default`, `life` | Gray |
|
|
803
|
-
| `primary`, `hope` | Blue |
|
|
804
|
-
| `secondary` | Zinc |
|
|
805
|
-
| `success`, `will` | Green |
|
|
806
|
-
| `warning`, `greed` | Orange |
|
|
807
|
-
| `danger`, `rage` | Red |
|
|
808
|
-
| `love` | Violet |
|
|
809
|
-
| `compassion` | Indigo |
|
|
810
|
-
| `fear` | Yellow |
|
|
820
|
+
The `type` option maps semantic intent to [Lantern Color Palette](https://github.com/TrinityMonsters/tramway/blob/main/README.md#lantern-color-palette).
|
|
811
821
|
|
|
812
822
|
If none of the predefined semantic types fit your needs, you can supply a Tailwind color family directly using the `color`
|
|
813
823
|
option—for example: `color: :gray`. When you pass a custom color ensure the corresponding utility classes exist in your
|
|
@@ -1028,6 +1038,20 @@ Tramway.configure do |config|
|
|
|
1028
1038
|
end
|
|
1029
1039
|
```
|
|
1030
1040
|
|
|
1041
|
+
## Lantern Color Palette
|
|
1042
|
+
|
|
1043
|
+
| Type | Color |
|
|
1044
|
+
| ---- | ----- |
|
|
1045
|
+
| `default`, `life` | Gray |
|
|
1046
|
+
| `primary`, `hope` | Blue |
|
|
1047
|
+
| `secondary` | Zinc |
|
|
1048
|
+
| `success`, `will` | Green |
|
|
1049
|
+
| `warning`, `greed` | Orange |
|
|
1050
|
+
| `danger`, `rage` | Red |
|
|
1051
|
+
| `love` | Violet |
|
|
1052
|
+
| `compassion` | Indigo |
|
|
1053
|
+
| `fear` | Yellow |
|
|
1054
|
+
|
|
1031
1055
|
## Articles
|
|
1032
1056
|
* [Tramway on Rails](https://kalashnikovisme.medium.com/tramway-on-rails-32158c35ed68)
|
|
1033
1057
|
* [Tramway is the way to deal with little things for Rails developers](https://medium.com/@kalashnikovisme/tramway-is-the-way-to-deal-with-little-things-for-rails-developers-4f502172a18c)
|
|
@@ -1035,6 +1059,7 @@ end
|
|
|
1035
1059
|
* [Behave as ActiveRecord. Why do we want objects to be AR lookalikes?](https://kalashnikovisme.medium.com/behave-as-activerecord-why-do-we-want-objects-to-be-ar-lookalikes-d494d692e1d3)
|
|
1036
1060
|
* [Decorating associations in Rails with Tramway](https://kalashnikovisme.medium.com/decorating-associations-in-rails-with-tramway-b46a28392f9e)
|
|
1037
1061
|
* [Easy-to-use Tailwind-styled multi-select built with Stimulus](https://medium.com/@kalashnikovisme/easy-to-use-tailwind-styled-multi-select-built-with-stimulus-b3daa9e307aa)
|
|
1062
|
+
* [Lantern Color Palette]([https://github.com/TrinityMonsters/tramway/blob/main/README.md#lantern-color-palette](https://kalashnikovisme.medium.com/lantern-buttons-in-rails-ff61688fd8e3?postPublishedType=repub))
|
|
1038
1063
|
|
|
1039
1064
|
## Contributing
|
|
1040
1065
|
|
|
@@ -31,8 +31,8 @@ module Tailwinds
|
|
|
31
31
|
|
|
32
32
|
def default_classes
|
|
33
33
|
[
|
|
34
|
-
'btn', 'btn-primary', 'font-bold', 'rounded-sm', 'flex', 'flex-row', 'whitespace-nowrap',
|
|
35
|
-
options[:class].to_s
|
|
34
|
+
'btn', 'btn-primary', 'flex', 'flex-row', 'font-bold', 'rounded-sm', 'flex', 'flex-row', 'whitespace-nowrap',
|
|
35
|
+
'items-center', 'space-x-1', size_classes.to_s, options[:class].to_s
|
|
36
36
|
]
|
|
37
37
|
end
|
|
38
38
|
|
|
@@ -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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
data/lib/tramway/version.rb
CHANGED
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.
|
|
4
|
+
version: 2.0.3
|
|
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-
|
|
12
|
+
date: 2025-12-20 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
|