tramway 1.1.1.1 → 1.1.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: d030fadb4001f3f0b6f7d0f357bd51600fa7d215fc33e7b04c4b2425e107cd85
4
- data.tar.gz: b17e4b7498a18dc9521645db93cd506a4f0d835bc34d933142d292efd0fb3603
3
+ metadata.gz: ea59bb13e40c79e864a729304ee65244445e7efa0dd7c65ef8b40486e12f2abd
4
+ data.tar.gz: 6604d77cbb0be931d3771581427fd94e7ab6291fb8d2cfc41fc1799fb7568743
5
5
  SHA512:
6
- metadata.gz: 1c37c218ca13fc270e0d37cb37aeaf21c074724c75e1c2aa2a294c67e0e9ba59a16c0f6fd4f6711a092f07530e13c354bccd0d56c13064db5941f8accd88418f
7
- data.tar.gz: 19816173a9590f08e477840a2cb2f822dabdbd8a2f9ef9f3304f9e5c02cbb01ce2fbdefd0b10a18bdf44cd97b0f4df68db8414bae374213a598e413a6d308323
6
+ metadata.gz: 54a593799cf75505bd41c90d12f5690b9acd4f594db1f50490831b061741579ae33bf9594f4421b6a8f6456292eb2a210b46b392540a86122c48dffeac724ca2
7
+ data.tar.gz: 32f655b1853dcfe7b9f2031f4170df164c51b505971a4c9154189598509af7a5ab4c70deaf2ead1a74f5f905df1cc1d59bc38965a1faf3abb4a87e9c2efb05c6
data/README.md CHANGED
@@ -819,6 +819,14 @@ Tramway ships with helpers for common UI patterns built on top of Tailwind compo
819
819
  <%= tramway_button path: user_path(user), text: 'View profile', color: :emerald, data: { turbo: false } %>
820
820
  ```
821
821
 
822
+ * `tramway_badge` renders a Tailwind-styled badge with the provided `text`. Pass a semantic `type` (for example, `:success` or
823
+ `:danger`) to use the built-in color mappings, or supply a custom Tailwind color family with `color:`. When you opt into a
824
+ custom color, ensure the corresponding background utilities are available in your Tailwind safelist.
825
+
826
+ ```erb
827
+ <%= tramway_badge text: 'Active', type: :success %>
828
+ ```
829
+
822
830
  * `tramway_back_button` renders a standardized "Back" link.
823
831
 
824
832
  ```erb
@@ -849,6 +857,7 @@ Tramway provides `tramway_form_for` helper that renders Tailwind-styled forms by
849
857
  <%= f.email_field :email %>
850
858
  <%= f.password_field :password %>
851
859
  <%= f.select :role, [:admin, :user] %>
860
+ <%= f.date_field :birth_date %>
852
861
  <%= f.multiselect :permissions, [['Create User', 'create_user'], ['Update user', 'update_user']] %>
853
862
  <%= f.file_field :file %>
854
863
  <%= f.submit 'Create User' %>
@@ -863,6 +872,7 @@ Available form helpers:
863
872
  * password_field
864
873
  * file_field
865
874
  * select
875
+ * date_field
866
876
  * multiselect ([Stimulus-based](https://github.com/Purple-Magic/tramway#stimulus-based-inputs))
867
877
  * submit
868
878
 
@@ -49,6 +49,10 @@ module Tailwinds
49
49
  ), &)
50
50
  end
51
51
 
52
+ def date_field(attribute, **, &)
53
+ common_field(:date_field, :date_field, attribute, **, &)
54
+ end
55
+
52
56
  def file_field(attribute, **options, &)
53
57
  sanitized_options = sanitize_options(options)
54
58
  input = super(attribute, **sanitized_options.merge(class: :hidden))
@@ -0,0 +1,8 @@
1
+ .mb-4
2
+ - if @label
3
+ = component('tailwinds/form/label', for: @for) do
4
+ = @label
5
+ - base_classes = 'w-full bg-white border border-gray-300 rounded focus:outline-none focus:border-red-500 '
6
+ - base_classes += 'dark:bg-gray-800 dark:border-gray-600 dark:text-white dark:focus:border-red-400 dark:placeholder-white'
7
+ - classes = "#{size_class(:text_input)} #{base_classes}"
8
+ = @input.call @attribute, **@options.merge(class: classes), value: @value
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tailwinds
4
+ module Form
5
+ # Tailwind-styled date field
6
+ class DateFieldComponent < TailwindComponent
7
+ end
8
+ end
9
+ end
@@ -1,2 +1,2 @@
1
- .div-table-cell.px-6.py-4.font-medium.text-gray-900.dark:text-white.text-xs.sm:text-base
1
+ .div-table-cell.md:block.first:block.hidden.px-6.py-4.font-medium.text-gray-900.dark:text-white.text-base
2
2
  = content
@@ -1,7 +1,7 @@
1
- .div-table-row.grid.text-white.text-small.gap-4.bg-purple-700.dark:bg-gray-700.dark:text-gray-400{ class: "grid-cols-#{columns_count}", aria: { label: "Table Header" }, role: "row" }
1
+ .div-table-row.grid.text-white.text-small.gap-4.bg-purple-700.dark:bg-gray-700.dark:text-gray-400.grid-cols-1{ class: "md:grid-cols-#{columns_count}", aria: { label: "Table Header" }, role: "row" }
2
2
  - if headers.any?
3
3
  - headers.each do |header|
4
- .div-table-cell.py-4.px-6
4
+ .div-table-cell.py-4.px-6.first:block.hidden.md:block
5
5
  = header
6
6
  - else
7
7
  = content
@@ -25,7 +25,7 @@ module Tailwinds
25
25
  def desktop_row_classes(cells_count)
26
26
  [
27
27
  'div-table-row', 'grid', 'gap-4', 'bg-white', 'border-b', 'last:border-b-0', 'dark:bg-gray-800',
28
- 'dark:border-gray-700', "grid-cols-#{cells_count}"
28
+ 'dark:border-gray-700', "md:grid-cols-#{cells_count}", 'grid-cols-1'
29
29
  ].join(' ')
30
30
  end
31
31
 
@@ -1,5 +1,6 @@
1
1
  = helpers.component 'tailwinds/table/row/preview'
2
2
 
3
3
  - width_class = options[:class]&.include?('w-') ? '' : 'w-full'
4
+
4
5
  .div-table.text-left.rtl:text-right.text-gray-500.dark:text-gray-400{ class: "#{options[:class]} #{width_class}", **options.except(:class) }
5
6
  = content
@@ -11,6 +11,8 @@ module.exports = {
11
11
  'div-table-cell',
12
12
  'sm:text-base',
13
13
  'last:border-b-0',
14
+ 'md:block',
15
+ 'first:block',
14
16
 
15
17
  // === Visibility and typography helpers ===
16
18
  'hidden',
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tramway
4
- VERSION = '1.1.1.1'
4
+ VERSION = '1.1.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: 1.1.1.1
4
+ version: 1.1.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-11-27 00:00:00.000000000 Z
12
+ date: 2025-12-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: anyway_config
@@ -153,6 +153,8 @@ files:
153
153
  - app/components/tailwinds/containers/narrow_component.html.haml
154
154
  - app/components/tailwinds/containers/narrow_component.rb
155
155
  - app/components/tailwinds/form/builder.rb
156
+ - app/components/tailwinds/form/date_field_component.html.haml
157
+ - app/components/tailwinds/form/date_field_component.rb
156
158
  - app/components/tailwinds/form/file_field_component.html.haml
157
159
  - app/components/tailwinds/form/file_field_component.rb
158
160
  - app/components/tailwinds/form/label_component.html.haml