bullet_train-themes-tailwind_css 1.11.0 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 823a768afff4c96d22d8bd1d13f40c401d83079608ad8f2569e0813173825c51
4
- data.tar.gz: a7e1e61ddd2240ec73d15196c57a1a874711b6c36aa1bd743955b069e6ce57eb
3
+ metadata.gz: 1a15fa206944aec9822e546654e051d175b657cac4f74090cacb48589343f562
4
+ data.tar.gz: e923acbf3e314f4fa69f9f104c9d35a2b9c93753bd37082fabf90aae61eaf14f
5
5
  SHA512:
6
- metadata.gz: cbcaaf9eee02c9daa43cced5c0591f33371e02336a1115e36df1b27d1f348a80da08cc3db181920a4d2df58702b4cfc3c86ee26b67cd2168e4e29397f83d4fdd
7
- data.tar.gz: 96794af38e5b25f60ab8289f6435cff60b7e3841ddca6d305be18beb2985faea05ffd1e9b41adb2bc0355e3bf2d60996bf69c943812e25833e9239619ae81e1a
6
+ metadata.gz: b4408c8150127ea666b4522d0cda0fc7ae2e842ce2881432c923fe61c3fba45577d89545eb586d2e12ed05008f26dd7bb9ca638dae1f0be6a54b703a3a0cfa75
7
+ data.tar.gz: 01c0cdb3b0e37967010b43dfc83db8fad8e978291ceb007ae96441c0f1f735cd58f77017e95aafa535fe667fe0284648b9c927d4f3810c5926e0189b6d19bceb
@@ -4,19 +4,37 @@
4
4
  form ||= current_fields_form
5
5
 
6
6
  # TODO: All options and other_options below are written inline. Do we need these?
7
- # options ||= {}
7
+ options ||= {}
8
8
  # other_options ||= {}
9
+
10
+ country_html_options ||= {}
11
+ country_html_options[:data] ||= {}
12
+ address_one_options ||= {}
13
+ address_two_options ||= {}
14
+ city_options ||= {}
15
+ postal_code_options ||= {}
16
+ postal_code_options[:data] ||= {}
17
+ region_html_options ||= {}
18
+ region_html_options[:data] ||= {}
19
+
20
+ if options[:disabled].present?
21
+ country_html_options[:disabled] = options[:disabled]
22
+ address_one_options[:disabled] = options[:disabled]
23
+ address_two_options[:disabled] = options[:disabled]
24
+ city_options[:disabled] = options[:disabled]
25
+ postal_code_options[:disabled] = options[:disabled]
26
+ end
9
27
  %>
10
28
 
11
29
  <%= form.fields_for(method) do |address_form| %>
12
30
  <% with_field_settings form: address_form do %>
13
-
31
+
14
32
  <%= render 'shared/fields/super_select',
15
33
  method: :country_id,
16
34
  choices: populate_country_options,
17
- options: {include_blank: true},
35
+ options: {include_blank: true},
18
36
  other_options: {search: true, wrapper_class: "col-span-2"},
19
- html_options: {data: {}},
37
+ html_options: country_html_options,
20
38
  wrapper_options: {
21
39
  data: {
22
40
  'controller': "dependable",
@@ -25,24 +43,37 @@ form ||= current_fields_form
25
43
  }
26
44
  }
27
45
  %>
28
-
29
- <%= render 'shared/fields/text_field', method: :address_one %>
30
- <%= render 'shared/fields/text_field', method: :address_two %>
31
-
46
+
47
+ <%= render 'shared/fields/text_field', method: :address_one, options: address_one_options %>
48
+ <%= render 'shared/fields/text_field', method: :address_two, options: address_two_options %>
49
+
32
50
  <div class="grid grid-cols-1 gap-y gap-x sm:grid-cols-3">
33
51
  <div class="sm:col-span-1">
34
52
  <%= render 'shared/fields/text_field', method: :city,
53
+ options: city_options,
35
54
  other_options: {wrapper_class: "col-span-2 lg:col-span-1"}
36
55
  %>
37
56
  </div>
38
57
  <div class="sm:col-span-2">
39
- <%= render "shared/fields/dependent_fields_frame",
58
+ <%= render "shared/fields/dependent_fields_frame",
40
59
  id: address_form.field_id(:country, :dependent_fields),
41
60
  form: address_form,
42
61
  dependable_fields: [:country_id],
43
62
  html_options: { class: "block space-y-5" } do |dependent_fields_controller_name|
44
63
  %>
45
-
64
+ <%
65
+ # These have to be here instead of at the top of the file so that we have access
66
+ # to the address_form and dependent_fields_controller_name variables.
67
+ postal_code_options[:data]["#{dependent_fields_controller_name}-target"] ||= "field"
68
+ region_html_options[:data]["#{dependent_fields_controller_name}-target"] ||= "field"
69
+ region_html_options[:disabled] ||= address_form.object.country_id.nil?
70
+ # If the entire address field is disabled, we clobber the :disabled value that we
71
+ # calculate based on the country field. This makes it so that region will still be
72
+ # disabled even if the address field had been filled out previously.
73
+ if options[:disabled].present? && options[:disabled]
74
+ region_html_options[:disabled] = options[:disabled]
75
+ end
76
+ %>
46
77
  <div class="grid grid-cols-1 gap-y gap-x sm:grid-cols-2">
47
78
  <div class="sm:col-span-1">
48
79
  <%= render 'shared/fields/super_select',
@@ -54,22 +85,13 @@ form ||= current_fields_form
54
85
  wrapper_class: "col-span-2 lg:col-span-1",
55
86
  label: admin_division_label_for(address_form)
56
87
  },
57
- html_options: {
58
- disabled: address_form.object.country_id.nil?,
59
- data: {
60
- "#{dependent_fields_controller_name}-target": "field"
61
- }
62
- }
88
+ html_options: region_html_options
63
89
  %>
64
90
  </div>
65
-
91
+
66
92
  <div class="sm:col-span-1">
67
93
  <%= render 'shared/fields/text_field', method: :postal_code,
68
- options: {
69
- data: {
70
- "#{dependent_fields_controller_name}-target": "field"
71
- }
72
- },
94
+ options: postal_code_options,
73
95
  other_options: {
74
96
  wrapper_class: "col-span-2 lg:col-span-1",
75
97
  label: postal_code_label_for(address_form)
@@ -77,7 +99,7 @@ form ||= current_fields_form
77
99
  %>
78
100
  </div>
79
101
  </div>
80
-
102
+
81
103
  <% end %>
82
104
  </div>
83
105
  </div>
@@ -40,11 +40,17 @@ end
40
40
  value = form.object.send(method)
41
41
 
42
42
  color_selected_classes = "ring-2 ring-offset-2"
43
+
44
+ input_classes = "rounded-md shadow-sm font-light font-mono text-sm focus:ring-blue focus:border-blue border-slate-300 w-48 dark:bg-slate-800 dark:border-slate-900"
45
+ if options[:disabled]
46
+ input_classes += " bg-slate-200 dark:bg-slate-700 hover:bg-slate-200 hover:dark:bg-slate-700"
47
+ stimulus_controller = ""
48
+ end
43
49
  %>
44
50
 
45
51
  <% content = render 'shared/fields/field', form: form, method: method, options: options, other_options: other_options do %>
46
52
  <% content_for :field do %>
47
- <div class="space-x-1"
53
+ <div class="space-x-1"
48
54
  data-controller="<%= stimulus_controller %>"
49
55
  data-<%= stimulus_controller %>-initial-color-value="<%= value %>"
50
56
  data-<%= stimulus_controller %>-color-selected-class="<%= color_selected_classes %>"
@@ -53,7 +59,13 @@ color_selected_classes = "ring-2 ring-offset-2"
53
59
  <div class="inline space-x-1" data-<%= stimulus_controller %>-target="colorOptions">
54
60
  <% color_picker_field_options.each do |color| %>
55
61
  <label class="btn-toggle btn-color-picker">
56
- <button type="button" class="button-color mb-1.5 dark:ring-offset-slate-700 <%= color == value ? color_selected_classes : '' %>" style="background-color: <%= color %>; --tw-ring-color: <%= color %>" data-action="<%= stimulus_controller %>#pickColor" data-<%= stimulus_controller %>-target="colorButton" data-color="<%= color %>">&nbsp;</button>
62
+ <button type="button"
63
+ class="button-color mb-1.5 dark:ring-offset-slate-700 <%= color == value ? color_selected_classes : '' %>"
64
+ style="background-color: <%= color %>; --tw-ring-color: <%= color %>"
65
+ data-action="<%= stimulus_controller %>#pickColor"
66
+ data-<%= stimulus_controller %>-target="colorButton"
67
+ data-color="<%= color %>"
68
+ <%= "disabled"if options[:disabled] %>>&nbsp;</button>
57
69
  </label>
58
70
  <% end %>
59
71
  </div>
@@ -61,7 +73,7 @@ color_selected_classes = "ring-2 ring-offset-2"
61
73
  <button type="button" class="button-color mr-1 dark:ring-offset-slate-700 <%= value.blank? || color_picker_field_options.include?(value) ? 'hidden' : color_selected_classes %>" data-action="<%= stimulus_controller %>#pickColor" data-<%= stimulus_controller %>-target="userSelectedColor colorButton" data-color="<%= value %>" style="background-color: <%= value %>; --tw-ring-color: <%= value %>">&nbsp;</button>
62
74
  </label>
63
75
  <span class="relative">
64
- <input type="text" disabled="disabled" class="rounded-md shadow-sm font-light font-mono text-sm focus:ring-blue focus:border-blue border-slate-300 w-48 dark:bg-slate-800 dark:border-slate-900" value="<%= value %>" data-<%= stimulus_controller %>-target="colorInput"/>
76
+ <input type="text" disabled="disabled" class="<%= input_classes %>" value="<%= value %>" data-<%= stimulus_controller %>-target="colorInput"/>
65
77
  <span class="absolute right-0">
66
78
  <button type="button" class="py-2 px-1 border border-transparent inline-flex items-center whitespace-nowrap rounded-md text-lg" data-action="<%= stimulus_controller %>#pickRandomColor">
67
79
  <i class="leading-5 ti ti-reload dark:text-blue-500"></i>
@@ -1,7 +1,7 @@
1
1
  module BulletTrain
2
2
  module Themes
3
3
  module TailwindCss
4
- VERSION = "1.11.0"
4
+ VERSION = "1.12.0"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train-themes-tailwind_css
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.0
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-25 00:00:00.000000000 Z
11
+ date: 2024-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: simplecov
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rails
29
43
  requirement: !ruby/object:Gem::Requirement