atomic_view 0.1.16 → 0.1.17
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 60e24ea14905c39463895bf65986134967d2d43ca813e0bf2694ac2624675bb7
|
|
4
|
+
data.tar.gz: 4776e9b26a08dcc0ef789bc94e1a1ee7067226bce0a02674516b1bfb9f3e8a73
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a8c0c0b283c93b31c668e5c5354940031caf143e017486cb4634b4d7dc458dfec76cd3721ecf1ba8dd389f3dbad7dde6f8c557acd5f879b5a254bfc130f8bf06
|
|
7
|
+
data.tar.gz: dfefa8a1cda45ae904771d27c02cb9d106323cdd5a9db8aab3876e8d4fd684d070f473fe39a27a2aa9c9238cd663298cf46af2bbe47d23b23b41c028e1e78331
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<%= link_to(href, html_options) do %>
|
|
2
|
+
<%= content %>
|
|
3
|
+
<% if keybinds.present? %>
|
|
4
|
+
<span class="inline-flex items-center gap-0.5">
|
|
5
|
+
<% keybinds.each do |key| %>
|
|
6
|
+
<%= render(AtomicView::Components::KbdComponent.new) { key } %>
|
|
7
|
+
<% end %>
|
|
8
|
+
</span>
|
|
9
|
+
<% end %>
|
|
10
|
+
<% end %>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module AtomicView
|
|
4
|
+
module Components
|
|
5
|
+
# Link
|
|
6
|
+
#
|
|
7
|
+
# A button-styled anchor tag -- shares ButtonComponent's variants
|
|
8
|
+
# (`primary`, `secondary`, `destructive`, `muted`, `link`, `outline`) via
|
|
9
|
+
# the same ButtonVariants concern, so a navigational action (e.g. "New
|
|
10
|
+
# record") can sit next to real buttons without looking out of place.
|
|
11
|
+
#
|
|
12
|
+
# `keybinds:`, when given (a single key, or an array for a chord --
|
|
13
|
+
# same convention as `CommandPaletteComponent::RowComponent#hint`),
|
|
14
|
+
# renders a KbdComponent per key after the content, as a visual hint.
|
|
15
|
+
# Wiring the actual keydown-to-click behavior is left to the host app
|
|
16
|
+
# (e.g. a Stimulus controller on the anchor).
|
|
17
|
+
class LinkComponent < AtomicView::Component
|
|
18
|
+
include AtomicView::Components::Concerns::ButtonVariants
|
|
19
|
+
|
|
20
|
+
attr_reader :href, :variant, :keybinds
|
|
21
|
+
|
|
22
|
+
def initialize(href, variant: :primary, keybinds: nil, **options)
|
|
23
|
+
super()
|
|
24
|
+
@href = href
|
|
25
|
+
@variant = variant
|
|
26
|
+
@keybinds = Array(keybinds)
|
|
27
|
+
@options = options
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def html_options
|
|
31
|
+
@options.except(:class).merge(class: html_class)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def html_class
|
|
35
|
+
class_names(base_classes, variant_classes, @options[:class])
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
data/lib/atomic_view/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: atomic_view
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.17
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Joel Warrington
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-09-
|
|
11
|
+
date: 2026-09-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: zeitwerk
|
|
@@ -202,6 +202,8 @@ files:
|
|
|
202
202
|
- lib/atomic_view/components/grouped_collection_select_component.rb
|
|
203
203
|
- lib/atomic_view/components/kbd_component.rb
|
|
204
204
|
- lib/atomic_view/components/label_component.rb
|
|
205
|
+
- lib/atomic_view/components/link_component.html.erb
|
|
206
|
+
- lib/atomic_view/components/link_component.rb
|
|
205
207
|
- lib/atomic_view/components/modal_component.html.erb
|
|
206
208
|
- lib/atomic_view/components/modal_component.rb
|
|
207
209
|
- lib/atomic_view/components/month_field_component.rb
|