anchor_view_components 0.43.0 → 0.44.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 +4 -4
- data/CHANGELOG.md +9 -0
- data/app/components/anchor/autocomplete/results_component.html.erb +2 -3
- data/app/components/anchor/autocomplete/results_component.rb +2 -2
- data/app/components/anchor/banner_component.rb +4 -6
- data/app/components/anchor/button_component.rb +0 -7
- data/app/components/anchor/component.rb +1 -1
- data/app/components/anchor/dialog_component.html.erb +1 -0
- data/app/components/anchor/dialog_controller.ts +8 -0
- data/app/components/anchor/link_component.rb +1 -1
- data/app/components/anchor/page/footer_component.html.erb +2 -1
- data/app/components/anchor/page/footer_component.rb +8 -0
- data/lib/anchor/view_components/version.rb +1 -1
- data/lib/cops/anchor/avoid_implicit_super.rb +23 -0
- data/previews/anchor/dialog_component_preview/with_form.html.erb +21 -0
- data/previews/anchor/dialog_component_preview.rb +2 -0
- data/previews/anchor/page_component_preview/with_supporting_text_and_buttons.html.erb +24 -0
- data/previews/anchor/page_component_preview.rb +2 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b272707b7b7780690e4bd12712dfae937b8fd30e97cc4eaf9ab86b15a83a9122
|
4
|
+
data.tar.gz: ef9c2b7c05ccbbc0e24ef552da216c0e502e6d57d83c1b5101c53b5e665912cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f0273735e483b4b93949b639ac1c76191fda722709efd043908bee522f853a9ae500d57a127b32bdab5f65232a3769755a98fce1cce4e082038d998f149c324
|
7
|
+
data.tar.gz: e27c29a51d263e4d55ec537515d18215ed280fc6f19df997cb9d4733c6ebc60c6495b80fd4679882b77e3cbea629249ed1f0284665453e8e01288179773308d7
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.44.0
|
4
|
+
|
5
|
+
### Minor Changes
|
6
|
+
|
7
|
+
- a9e927c: Removed the deprecated `tag` parameter from the Button component.
|
8
|
+
- 3f6ff7b: When a dialog is closed, any inner form error messages will be removed.
|
9
|
+
- e2941f0: Added a `supporting_text` slot to the `Page::Footer` component, which renders
|
10
|
+
text next to the buttons.
|
11
|
+
|
3
12
|
## 0.43.0
|
4
13
|
|
5
14
|
### Minor Changes
|
@@ -1,9 +1,8 @@
|
|
1
1
|
<% results.each do |result| %>
|
2
2
|
<%= tag.li(
|
3
|
-
**merge_options(
|
4
|
-
{ data: result.data },
|
3
|
+
**merge_options(wrapper_options,
|
5
4
|
class: "list-group-item",
|
6
|
-
data:
|
5
|
+
data: result.data.merge(autocomplete_value: result.value),
|
7
6
|
role: "option",
|
8
7
|
)
|
9
8
|
) do %>
|
@@ -34,13 +34,11 @@ module Anchor
|
|
34
34
|
warning: "text-warning",
|
35
35
|
}.freeze
|
36
36
|
|
37
|
-
def initialize(**kwargs)
|
38
|
-
@icon = ICON_MAPPINGS[
|
39
|
-
|
40
|
-
@icon_variant = ICON_VARIANT_MAPPINGS[kwargs[:variant]] ||
|
41
|
-
ICON_VARIANT_MAPPINGS[VARIANT_DEFAULT]
|
37
|
+
def initialize(variant: VARIANT_DEFAULT, **kwargs)
|
38
|
+
@icon = ICON_MAPPINGS[variant]
|
39
|
+
@icon_variant = ICON_VARIANT_MAPPINGS[variant]
|
42
40
|
|
43
|
-
super
|
41
|
+
super(variant:, **kwargs)
|
44
42
|
end
|
45
43
|
|
46
44
|
private
|
@@ -35,7 +35,6 @@ module Anchor
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def initialize(
|
38
|
-
tag: nil,
|
39
38
|
type: TYPE_DEFAULT,
|
40
39
|
size: SIZE_DEFAULT,
|
41
40
|
href: nil,
|
@@ -43,12 +42,6 @@ module Anchor
|
|
43
42
|
full_width: false,
|
44
43
|
**kwargs
|
45
44
|
)
|
46
|
-
if tag
|
47
|
-
ActiveSupport::Deprecation.warn(
|
48
|
-
"`tag` is now set automatically and should no longer be used."
|
49
|
-
)
|
50
|
-
end
|
51
|
-
|
52
45
|
@type = fetch_or_fallback(TYPE_OPTIONS, type, TYPE_DEFAULT)
|
53
46
|
@size = SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size,
|
54
47
|
SIZE_DEFAULT)]
|
@@ -8,4 +8,12 @@ export default class extends Controller<HTMLDialogElement> {
|
|
8
8
|
close(): void {
|
9
9
|
this.element.close();
|
10
10
|
}
|
11
|
+
|
12
|
+
reset(): void {
|
13
|
+
this.#resetErrorMessages();
|
14
|
+
}
|
15
|
+
|
16
|
+
#resetErrorMessages(): void {
|
17
|
+
this.element.querySelectorAll("[data-error='true']").forEach((element) => element.remove());
|
18
|
+
}
|
11
19
|
}
|
@@ -1,10 +1,11 @@
|
|
1
1
|
<%= tag.footer(**merge_options(wrapper_options,
|
2
2
|
class: class_names(
|
3
3
|
Anchor::PageComponent::HORIZONTAL_PADDING_CLASS,
|
4
|
-
"py-5 flex justify-end gap-4 border-t bg-white border-subdued sticky bottom-0",
|
4
|
+
"py-5 flex items-center justify-end gap-4 border-t bg-white border-subdued sticky bottom-0",
|
5
5
|
),
|
6
6
|
data: { testid: "page-footer" }),
|
7
7
|
) do %>
|
8
|
+
<%= supporting_text %>
|
8
9
|
<%= delete_button unless done_button? %>
|
9
10
|
<%= cancel_button unless done_button? %>
|
10
11
|
<%= save_button unless done_button? %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Anchor
|
2
|
+
class AvoidImplicitSuper < RuboCop::Cop::Cop
|
3
|
+
MSG = "Avoid implicit `super` calls. Prefer `super(**kwargs)`, " \
|
4
|
+
"`super()`, or a mix of explicit/implicit arguments, e.g. " \
|
5
|
+
"`super(id:, title:, **kwargs)`.".freeze
|
6
|
+
|
7
|
+
def_node_matcher :initialize_with_implicit_super?, <<~PATTERN
|
8
|
+
(def :initialize _ (begin ... $`zsuper ...))
|
9
|
+
PATTERN
|
10
|
+
|
11
|
+
def on_def(node)
|
12
|
+
return unless (zsuper = initialize_with_implicit_super?(node))
|
13
|
+
|
14
|
+
add_offense(zsuper, message:)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def message
|
20
|
+
MSG
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<% invalid_user = FakeUser.new(name: "").tap(&:validate) %>
|
2
|
+
|
3
|
+
<%= anchor_dialog(
|
4
|
+
id: "my-dialog",
|
5
|
+
title: "Dialog Title",
|
6
|
+
) do |dialog| %>
|
7
|
+
<% dialog.with_show_button_content("Open dialog") %>
|
8
|
+
|
9
|
+
<% dialog.with_body do %>
|
10
|
+
<%= anchor_form_with(model: invalid_user, url: false, id: 'a-form') do |form| %>
|
11
|
+
<%= form.label(:name) %>
|
12
|
+
<%= form.text_field(:name, required: true) %>
|
13
|
+
<%= form.error_message_for(:name) %>
|
14
|
+
<% end %>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<% dialog.with_footer do %>
|
18
|
+
<%= anchor_button("Cancel", data: { action: "dialog#close" }) %>
|
19
|
+
<%= anchor_button("Save", variant: :primary, type: :submit, form: 'a-form') %>
|
20
|
+
<% end %>
|
21
|
+
<% end %>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<%= anchor_page do |page| %>
|
2
|
+
<% page.with_header do |header| %>
|
3
|
+
<% header.with_breadcrumbs do |breadcrumbs| %>
|
4
|
+
<% breadcrumbs.with_item(href: "#").with_content("Breadcrumb 1") %>
|
5
|
+
<% breadcrumbs.with_item(href: "").with_content("Breadcrumb 2") %>
|
6
|
+
<% end %>
|
7
|
+
<% header.with_title("Page title") %>
|
8
|
+
<% end %>
|
9
|
+
<% page.with_body do |body| %>
|
10
|
+
<%= anchor_form_with(url: false, id: "form") do |form| %>
|
11
|
+
<%= tag.div class: "max-w-sm" do %>
|
12
|
+
<%= form.label :name, "Name" %>
|
13
|
+
<%= form.text_field(
|
14
|
+
:name,
|
15
|
+
) %>
|
16
|
+
<% end %>
|
17
|
+
<% end %>
|
18
|
+
<% end %>
|
19
|
+
<% page.with_footer do |footer| %>
|
20
|
+
<% footer.with_cancel_button(href: "#") %>
|
21
|
+
<% footer.with_save_button(form: "form") %>
|
22
|
+
<% footer.with_supporting_text("Optional text") %>
|
23
|
+
<% end %>
|
24
|
+
<% end %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anchor_view_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.44.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Buoy Software
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -191,6 +191,7 @@ files:
|
|
191
191
|
- lib/anchor/view_components/svg_resolver.rb
|
192
192
|
- lib/anchor/view_components/version.rb
|
193
193
|
- lib/anchor_view_components.rb
|
194
|
+
- lib/cops/anchor/avoid_implicit_super.rb
|
194
195
|
- previews/anchor/action_menu_component_preview.rb
|
195
196
|
- previews/anchor/action_menu_component_preview/autoplacement.html.erb
|
196
197
|
- previews/anchor/action_menu_component_preview/custom_trigger.html.erb
|
@@ -209,6 +210,7 @@ files:
|
|
209
210
|
- previews/anchor/dialog_component_preview/positioned_right.html.erb
|
210
211
|
- previews/anchor/dialog_component_preview/with_custom_show_button.html.erb
|
211
212
|
- previews/anchor/dialog_component_preview/with_footer.html.erb
|
213
|
+
- previews/anchor/dialog_component_preview/with_form.html.erb
|
212
214
|
- previews/anchor/filter_component_preview.rb
|
213
215
|
- previews/anchor/forms_preview.rb
|
214
216
|
- previews/anchor/icon_component_preview.rb
|
@@ -223,6 +225,7 @@ files:
|
|
223
225
|
- previews/anchor/page_component_preview/with_done_button.html.erb
|
224
226
|
- previews/anchor/page_component_preview/with_page_header_custom_content.html.erb
|
225
227
|
- previews/anchor/page_component_preview/with_search.html.erb
|
228
|
+
- previews/anchor/page_component_preview/with_supporting_text_and_buttons.html.erb
|
226
229
|
- previews/anchor/panel_component_preview.rb
|
227
230
|
- previews/anchor/panel_component_preview/with_banner.html.erb
|
228
231
|
- previews/anchor/preview.rb
|