stimulus-password-strength 0.1.8 → 0.2.0

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: 787fe4298029dcee2caeb7017f855898db05922601132037d26b8a7b22538694
4
- data.tar.gz: a1eb04050ff77b58dc236c85ac2056744e2b4a082a48475d56060747a9123cf1
3
+ metadata.gz: e076bf216c6fa63a6dd532f6bad5752ac31ee45b683b55eb49d49a195a562fc8
4
+ data.tar.gz: 56e4e5731a05785411f46886423930bcea82447429849ae2995bbaa4facc50d7
5
5
  SHA512:
6
- metadata.gz: af929a1bef9d1d660a12008e05f31242a1ac09b02e947ea64a551d9aec002a91aaf28d3db02b8050c4d1d5a74e1de968a2e1123fffa4966916fa062016df14f9
7
- data.tar.gz: 4e9d6016040a619edf04ada7473f8e78c9404abc3f0aff2aa468ef8376caeb730ad3d7c9f984cb1531709990ba4e10f70be077a6f8049c7d9354b58d47a12a07
6
+ metadata.gz: 6e12645fbe9707b15b0a9d465fb4afa838f17b22b8e9b14f3d58a141e8613fe5942d730998fb88263016719ad041de9d947da1f62d81aa36103cfd8bcd35cf17
7
+ data.tar.gz: 5674b82638a142bee431e74eefad4f40969f8f268d72a30e9403a4dc3dfbb0f8804f86273456e31f43a6ea5bd5968598783f890177bdc64d3e4213b491cdcc15
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.9
4
+
5
+ - removed positional Tailwind utilities from the default `toggle_class` so the show/hide icon no longer gets a second vertical translation on host apps that also use the inline `toggle_style`
6
+ - removed default layout utility classes from the label row, status row, requirements row, and strength bar wrappers so layout mechanics now live in `*_style` only
7
+ - documented that `toggle_class` should stay visual only and must not reintroduce `absolute`, `right-*`, `top-1/2`, or `-translate-y-1/2`
8
+ - documented that other row and bar `*_class` settings should also stay visual-only
9
+ - refreshed the installer template to reflect the new toggle customization contract
10
+
3
11
  ## 0.1.8
4
12
 
5
13
  - moved the field wrapper and label row layout into inline style defaults so critical flex/position behavior no longer depends on host-app utility classes
data/README.md CHANGED
@@ -116,8 +116,9 @@ StimulusPasswordStrength.configure do |config|
116
116
  config.input_class = "w-full rounded-md border px-3 py-2 pr-16"
117
117
  config.wrapper_style = "position: relative;"
118
118
  config.toggle_style = "position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%);"
119
+ config.toggle_class = "cursor-pointer text-xs font-medium text-gray-500 hover:text-gray-700"
119
120
  config.text_style = "width: 5.5rem; text-align: right; white-space: nowrap;"
120
- config.status_row_class = "flex min-h-5 flex-row-reverse items-center justify-start gap-2"
121
+ config.status_row_class = ""
121
122
  config.requirements_style = "min-height: 1rem;"
122
123
  config.requirement_pending_style = "color: #6b7280;"
123
124
  config.requirement_met_style = "color: #047857;"
@@ -145,6 +146,8 @@ The gem now treats critical layout as component mechanics, not host-app theme:
145
146
 
146
147
  If you override these settings, preserve the same mechanics and keep right-side padding on the input (`pr-16` or equivalent) so typed text does not collide with the toggle.
147
148
 
149
+ Do not put layout or positional utility classes into `toggle_class`, `status_row_class`, `requirements_class`, `label_row_class`, or `bar_track_class`. Mechanics already live in the corresponding `*_style` settings. Keep classes visual only.
150
+
148
151
  ## Post-Install Checklist
149
152
 
150
153
  1. Signup: weak password -> backend validation still works.
@@ -14,6 +14,14 @@
14
14
  data-password-strength-fair-text-color="<%= text_colors[:fair] %>"
15
15
  data-password-strength-good-text-color="<%= text_colors[:good] %>"
16
16
  data-password-strength-strong-text-color="<%= text_colors[:strong] %>">
17
+ <div data-password-strength-target="statusRow" class="<%= status_row_class %>" style="<%= status_row_style %>; visibility: hidden;">
18
+ <div data-password-strength-target="strengthTrack" class="<%= bar_track_class %>" style="<%= bar_track_style %>">
19
+ <div data-password-strength-target="strengthBar" class="<%= bar_base_class %>" style="<%= bar_style %>; width: 0%"></div>
20
+ </div>
21
+
22
+ <p data-password-strength-target="strengthText" class="<%= text_base_class %>" style="<%= text_style %>" aria-live="polite"></p>
23
+ </div>
24
+
17
25
  <% if label.present? %>
18
26
  <div class="<%= label_row_class %>" style="<%= label_row_style %>">
19
27
  <%= form.label attribute, label, class: label_class %>
@@ -40,14 +48,6 @@
40
48
  <% end %>
41
49
  </div>
42
50
  </div>
43
-
44
- <div data-password-strength-target="statusRow" class="<%= status_row_class %>" style="<%= status_row_style %>; visibility: hidden;">
45
- <div data-password-strength-target="strengthTrack" class="<%= bar_track_class %>" style="<%= bar_track_style %>">
46
- <div data-password-strength-target="strengthBar" class="<%= bar_base_class %>" style="<%= bar_style %>; width: 0%"></div>
47
- </div>
48
-
49
- <p data-password-strength-target="strengthText" class="<%= text_base_class %>" style="<%= text_style %>" aria-live="polite"></p>
50
- </div>
51
51
  <% else %>
52
52
  <% if requirements.any? %>
53
53
  <div class="<%= requirements_class %>" style="<%= requirements_style %>">
@@ -68,17 +68,9 @@
68
68
  <% end %>
69
69
  </div>
70
70
  <% end %>
71
-
72
- <div data-password-strength-target="statusRow" class="<%= status_row_class %>" style="<%= status_row_style %>; visibility: hidden;">
73
- <div data-password-strength-target="strengthTrack" class="<%= bar_track_class %>" style="<%= bar_track_style %>">
74
- <div data-password-strength-target="strengthBar" class="<%= bar_base_class %>" style="<%= bar_style %>; width: 0%"></div>
75
- </div>
76
-
77
- <p data-password-strength-target="strengthText" class="<%= text_base_class %>" style="<%= text_style %>" aria-live="polite"></p>
78
- </div>
79
71
  <% end %>
80
72
 
81
- <div class="relative" style="<%= wrapper_style %>">
73
+ <div style="<%= wrapper_style %>">
82
74
  <%= form.password_field attribute,
83
75
  required: required,
84
76
  autocomplete: autocomplete,
@@ -3,9 +3,10 @@
3
3
  StimulusPasswordStrength.configure do |config|
4
4
  # Example customization:
5
5
  # config.input_class = "w-full rounded-md border px-3 py-2 pr-16"
6
- # config.text_style = "min-width: 2.5rem; text-align: right; white-space: nowrap;"
7
- # config.status_row_class = "flex min-h-5 items-center gap-2"
8
- # config.status_row_style = "min-height: 1rem;"
6
+ # config.toggle_class = "cursor-pointer text-xs font-medium text-gray-500 hover:text-gray-700"
7
+ # config.status_row_class = ""
8
+ # config.text_style = "display: inline-block; width: 5.5rem; text-align: right; white-space: nowrap;"
9
+ # config.status_row_style = "display: flex; flex-direction: row-reverse; align-items: center; justify-content: flex-start; gap: 0.5rem; min-height: 1rem;"
9
10
  # config.requirements_style = "min-height: 1rem;"
10
11
  # config.requirement_pending_style = "color: #6b7280;"
11
12
  # config.requirement_met_style = "color: #047857;"
@@ -33,24 +33,24 @@ module StimulusPasswordStrength
33
33
 
34
34
  def initialize
35
35
  @container_class = "space-y-1"
36
- @label_row_class = "flex items-end justify-between gap-3"
36
+ @label_row_class = ""
37
37
  @label_row_style = "display: flex; justify-content: space-between; align-items: flex-end; gap: 0.75rem;"
38
38
  @label_class = "block text-sm font-medium text-gray-700"
39
- @header_aux_class = "flex justify-end"
39
+ @header_aux_class = ""
40
40
  @header_aux_style = "display: flex; justify-content: flex-end; align-items: center;"
41
- @status_row_class = "flex min-h-5 flex-row-reverse items-center justify-start gap-2"
41
+ @status_row_class = ""
42
42
  @status_row_style = "display: flex; flex-direction: row-reverse; align-items: center; justify-content: flex-start; gap: 0.5rem; min-height: 1rem;"
43
- @requirements_class = "flex justify-end gap-2"
43
+ @requirements_class = ""
44
44
  @requirements_style = "display: flex; justify-content: flex-end; align-items: center; gap: 0.5rem; min-height: 1rem;"
45
45
  @requirement_class = "text-xs text-right leading-tight"
46
46
  @requirement_style = "font-size: 0.75rem; line-height: 1rem; text-align: right;"
47
47
  @wrapper_style = "position: relative;"
48
48
  @input_class = "w-full rounded-xl border border-gray-300 px-4 py-3 pr-16 shadow-sm focus:border-blue-500 focus:ring-2 focus:ring-blue-200"
49
- @toggle_class = "absolute right-3 top-1/2 -translate-y-1/2 cursor-pointer text-xs font-medium text-gray-500 hover:text-gray-700"
49
+ @toggle_class = "cursor-pointer text-xs font-medium text-gray-500 hover:text-gray-700"
50
50
  @toggle_style = "position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; background: transparent; line-height: 0; z-index: 1;"
51
- @bar_track_class = "h-1.5 w-20 overflow-hidden rounded-full bg-gray-100"
51
+ @bar_track_class = ""
52
52
  @bar_track_style = "height: 0.375rem; width: 5rem; overflow: hidden; border-radius: 9999px; background-color: #e5e7eb; visibility: hidden; flex-shrink: 0;"
53
- @bar_base_class = "h-full rounded-full transition-all duration-300"
53
+ @bar_base_class = ""
54
54
  @bar_style = "display: block; height: 100%; border-radius: 9999px; visibility: hidden; transition: width 300ms ease, background-color 300ms ease;"
55
55
  @text_base_class = "text-xs"
56
56
  @text_style = "display: inline-block; width: 5.5rem; text-align: right; white-space: nowrap;"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StimulusPasswordStrength
4
- VERSION = "0.1.8"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stimulus-password-strength
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justyna Wojtczak