nitro_kit 0.5.2 → 0.7.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/app/components/nitro_kit/accordion.rb +35 -29
- data/app/components/nitro_kit/alert.rb +8 -4
- data/app/components/nitro_kit/avatar.rb +4 -2
- data/app/components/nitro_kit/avatar_stack.rb +23 -0
- data/app/components/nitro_kit/badge.rb +48 -4
- data/app/components/nitro_kit/button.rb +8 -2
- data/app/components/nitro_kit/card.rb +20 -10
- data/app/components/nitro_kit/checkbox.rb +23 -12
- data/app/components/nitro_kit/checkbox_group.rb +8 -4
- data/app/components/nitro_kit/combobox.rb +11 -2
- data/app/components/nitro_kit/component.rb +48 -23
- data/app/components/nitro_kit/dialog.rb +61 -38
- data/app/components/nitro_kit/dropdown.rb +70 -49
- data/app/components/nitro_kit/field.rb +103 -65
- data/app/components/nitro_kit/fieldset.rb +13 -6
- data/app/components/nitro_kit/form_builder.rb +27 -8
- data/app/components/nitro_kit/icon.rb +3 -2
- data/app/components/nitro_kit/input.rb +1 -1
- data/app/components/nitro_kit/pagination.rb +42 -34
- data/app/components/nitro_kit/radio_button.rb +33 -18
- data/app/components/nitro_kit/radio_button_group.rb +20 -16
- data/app/components/nitro_kit/select.rb +10 -8
- data/app/components/nitro_kit/table.rb +38 -11
- data/app/components/nitro_kit/tabs.rb +47 -41
- data/app/components/nitro_kit/textarea.rb +6 -2
- data/app/components/nitro_kit/toast.rb +26 -3
- data/app/components/nitro_kit/tooltip.rb +13 -11
- data/app/helpers/nitro_kit/accordion_helper.rb +1 -1
- data/app/helpers/nitro_kit/alert_helper.rb +1 -1
- data/app/helpers/nitro_kit/avatar_helper.rb +5 -1
- data/app/helpers/nitro_kit/badge_helper.rb +1 -1
- data/app/helpers/nitro_kit/button_group_helper.rb +1 -1
- data/app/helpers/nitro_kit/button_helper.rb +3 -3
- data/app/helpers/nitro_kit/card_helper.rb +1 -1
- data/app/helpers/nitro_kit/checkbox_helper.rb +25 -2
- data/app/helpers/nitro_kit/combobox_helper.rb +1 -1
- data/app/helpers/nitro_kit/datepicker_helper.rb +1 -1
- data/app/helpers/nitro_kit/dialog_helper.rb +1 -1
- data/app/helpers/nitro_kit/dropdown_helper.rb +1 -1
- data/app/helpers/nitro_kit/field_group_helper.rb +1 -1
- data/app/helpers/nitro_kit/field_helper.rb +1 -1
- data/app/helpers/nitro_kit/fieldset_helper.rb +1 -1
- data/app/helpers/nitro_kit/icon_helper.rb +1 -1
- data/app/helpers/nitro_kit/input_helper.rb +1 -1
- data/app/helpers/nitro_kit/label_helper.rb +1 -1
- data/app/helpers/nitro_kit/pagination_helper.rb +1 -1
- data/app/helpers/nitro_kit/radio_button_helper.rb +2 -2
- data/app/helpers/nitro_kit/select_helper.rb +1 -1
- data/app/helpers/nitro_kit/switch_helper.rb +1 -1
- data/app/helpers/nitro_kit/table_helper.rb +1 -1
- data/app/helpers/nitro_kit/tabs_helper.rb +1 -1
- data/app/helpers/nitro_kit/textarea_helper.rb +1 -1
- data/app/helpers/nitro_kit/toast_helper.rb +2 -13
- data/app/helpers/nitro_kit/tooltip_helper.rb +1 -1
- data/lib/nitro_kit/version.rb +1 -1
- metadata +6 -6
- data/MIT-LICENSE +0 -20
@@ -17,54 +17,62 @@ module NitroKit
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def prev(text = nil, **attrs, &block)
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
20
|
+
builder do
|
21
|
+
page_link(**mattr(attrs, aria: {label: "Previous page"})) do
|
22
|
+
if text || block_given?
|
23
|
+
text_or_block(text, &block)
|
24
|
+
else
|
25
|
+
render(Icon.new("arrow-left"))
|
26
|
+
plain("Previous")
|
27
|
+
end
|
26
28
|
end
|
27
29
|
end
|
28
30
|
end
|
29
31
|
|
30
32
|
def next(text = nil, **attrs, &block)
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
builder do
|
34
|
+
page_link(**mattr(attrs, aria: {label: "Next page"})) do
|
35
|
+
if text || block_given?
|
36
|
+
text_or_block(text, &block)
|
37
|
+
else
|
38
|
+
plain("Next")
|
39
|
+
render(Icon.new("arrow-right"))
|
40
|
+
end
|
37
41
|
end
|
38
42
|
end
|
39
43
|
end
|
40
44
|
|
41
45
|
def page(text = nil, current: false, **attrs, &block)
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
46
|
+
builder do
|
47
|
+
page_link(
|
48
|
+
**mattr(
|
49
|
+
attrs,
|
50
|
+
aria: {
|
51
|
+
current: current ? "page" : nil
|
52
|
+
},
|
53
|
+
disabled: current,
|
54
|
+
class: [page_class, current && "bg-zinc-200/50 dark:bg-zinc-800/50"]
|
55
|
+
)
|
56
|
+
) do
|
57
|
+
text_or_block(text, &block)
|
58
|
+
end
|
53
59
|
end
|
54
60
|
end
|
55
61
|
|
56
62
|
def ellipsis(**attrs)
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
63
|
+
builder do
|
64
|
+
render(
|
65
|
+
Button.new(
|
66
|
+
**mattr(
|
67
|
+
attrs,
|
68
|
+
variant: :ghost,
|
69
|
+
disabled: true,
|
70
|
+
class: page_class
|
71
|
+
)
|
64
72
|
)
|
65
|
-
)
|
66
|
-
|
67
|
-
|
73
|
+
) do
|
74
|
+
"…"
|
75
|
+
end
|
68
76
|
end
|
69
77
|
end
|
70
78
|
|
@@ -88,7 +96,7 @@ module NitroKit
|
|
88
96
|
end
|
89
97
|
|
90
98
|
def link_class
|
91
|
-
"inline-flex items-center justify-center rounded-md border font-medium h-9 px-3 gap-2 border-transparent aria-disabled:text-muted-
|
99
|
+
"inline-flex items-center justify-center rounded-md border font-medium h-9 px-3 gap-2 border-transparent aria-disabled:text-muted-content [&>svg]:size-4"
|
92
100
|
end
|
93
101
|
|
94
102
|
def page_class
|
@@ -2,34 +2,27 @@
|
|
2
2
|
|
3
3
|
module NitroKit
|
4
4
|
class RadioButton < Component
|
5
|
-
def initialize(label: nil, **attrs)
|
5
|
+
def initialize(label: nil, id: nil, wrapper: {}, size: :md, **attrs)
|
6
6
|
@label = label
|
7
|
-
@id = id || SecureRandom.hex(4)
|
8
|
-
|
9
|
-
@
|
7
|
+
@id = id || "nk--" + SecureRandom.hex(4)
|
8
|
+
@size = size
|
9
|
+
@wrapper = wrapper
|
10
10
|
|
11
11
|
super(
|
12
12
|
attrs,
|
13
|
-
type: "radio",
|
14
13
|
id: @id,
|
15
|
-
|
16
|
-
|
17
|
-
"[&[aria-checked='true']]:bg-primary",
|
18
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
19
|
-
]
|
14
|
+
type: "radio",
|
15
|
+
class: input_class
|
20
16
|
)
|
21
17
|
end
|
22
18
|
|
23
19
|
alias :html_label :label
|
24
20
|
|
25
|
-
attr_reader
|
26
|
-
:id,
|
27
|
-
:label
|
28
|
-
)
|
21
|
+
attr_reader :id, :label, :size, :wrapper
|
29
22
|
|
30
23
|
def view_template
|
31
|
-
div(
|
32
|
-
html_label(class: "inline-grid *:[grid-area:1/1] place-items-center") do
|
24
|
+
div(**mattr(wrapper, class: wrapper_class)) do
|
25
|
+
html_label(class: merge_class("inline-grid *:[grid-area:1/1] shrink-0 place-items-center", size_class)) do
|
33
26
|
input(**attrs)
|
34
27
|
dot
|
35
28
|
end
|
@@ -47,8 +40,7 @@ module NitroKit
|
|
47
40
|
def dot
|
48
41
|
svg(
|
49
42
|
class: merge_class(
|
50
|
-
"
|
51
|
-
"size-2.5 text-primay opacity-0 pointer-events-none",
|
43
|
+
"text-primary opacity-0 pointer-events-none",
|
52
44
|
"peer-checked:opacity-100"
|
53
45
|
),
|
54
46
|
viewbox: "0 0 20 20",
|
@@ -58,5 +50,28 @@ module NitroKit
|
|
58
50
|
svg.circle(cx: 10, cy: 10, r: 10)
|
59
51
|
end
|
60
52
|
end
|
53
|
+
|
54
|
+
def wrapper_class
|
55
|
+
"inline-flex items-center gap-2"
|
56
|
+
end
|
57
|
+
|
58
|
+
def input_class
|
59
|
+
[
|
60
|
+
"peer appearance-none shadow-sm rounded-full border text-foreground bg-background",
|
61
|
+
"[&[aria-checked='true']]:bg-primary",
|
62
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
63
|
+
]
|
64
|
+
end
|
65
|
+
|
66
|
+
def size_class
|
67
|
+
case size
|
68
|
+
when :md
|
69
|
+
"[&>input]:size-5 [&>svg]:size-2.5"
|
70
|
+
when :lg
|
71
|
+
"[&>input]:size-7 [&>svg]:size-3.5"
|
72
|
+
else
|
73
|
+
raise ArgumentError, "Unknown size `#{size}'"
|
74
|
+
end
|
75
|
+
end
|
61
76
|
end
|
62
77
|
end
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
module NitroKit
|
4
4
|
class RadioButtonGroup < Component
|
5
|
-
def initialize(
|
6
|
-
@options = options
|
5
|
+
def initialize(options_arg = nil, options: [], name: nil, value: nil, **attrs)
|
6
|
+
@options = options_arg || options
|
7
7
|
|
8
8
|
@name = name
|
9
9
|
@group_value = value
|
@@ -28,25 +28,29 @@ module NitroKit
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def title(text = nil, **attrs, &block)
|
31
|
-
|
32
|
-
|
31
|
+
builder do
|
32
|
+
render(Label.new(**attrs)) do
|
33
|
+
text_or_block(text, &block)
|
34
|
+
end
|
33
35
|
end
|
34
36
|
end
|
35
37
|
|
36
38
|
def item(text = nil, value_as_arg = nil, value: nil, **attrs, &block)
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
39
|
+
builder do
|
40
|
+
value ||= value_as_arg
|
41
|
+
|
42
|
+
render(
|
43
|
+
RadioButton.new(
|
44
|
+
**mattr(
|
45
|
+
attrs,
|
46
|
+
name: attrs.fetch(:name, name),
|
47
|
+
value:,
|
48
|
+
checked: group_value.presence == value
|
49
|
+
)
|
46
50
|
)
|
47
|
-
)
|
48
|
-
|
49
|
-
|
51
|
+
) do
|
52
|
+
text_or_block(text, &block)
|
53
|
+
end
|
50
54
|
end
|
51
55
|
end
|
52
56
|
end
|
@@ -4,7 +4,7 @@ module NitroKit
|
|
4
4
|
class Select < Component
|
5
5
|
def initialize(options = nil, value: nil, include_empty: false, prompt: nil, index: nil, **attrs)
|
6
6
|
@options = options
|
7
|
-
@value = value
|
7
|
+
@value = value.to_s
|
8
8
|
@include_empty = include_empty
|
9
9
|
@prompt = prompt
|
10
10
|
@index = index
|
@@ -31,13 +31,15 @@ module NitroKit
|
|
31
31
|
alias :html_option :option
|
32
32
|
|
33
33
|
def option(key_or_value = nil, value = nil, **attrs, &block)
|
34
|
-
|
34
|
+
builder do
|
35
|
+
value ||= key_or_value
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
html_option(value:, selected: @value == value.to_s, **attrs) do
|
38
|
+
if block_given?
|
39
|
+
yield
|
40
|
+
else
|
41
|
+
key_or_value
|
42
|
+
end
|
41
43
|
end
|
42
44
|
end
|
43
45
|
end
|
@@ -58,7 +60,7 @@ module NitroKit
|
|
58
60
|
|
59
61
|
def chevron_icon
|
60
62
|
svg(
|
61
|
-
class: "size-4 self-center place-self-end mr-1.5 text-muted-
|
63
|
+
class: "size-4 self-center place-self-end mr-1.5 text-muted-content pointer-events-none group-hover/select:text-foreground",
|
62
64
|
viewbox: "0 0 24 24",
|
63
65
|
fill: "none",
|
64
66
|
stroke: "currentColor",
|
@@ -10,7 +10,7 @@ module NitroKit
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def view_template
|
13
|
-
div(class: "
|
13
|
+
div(class: "w-full overflow-x-scroll") do
|
14
14
|
table(**attrs) do
|
15
15
|
yield
|
16
16
|
end
|
@@ -24,33 +24,60 @@ module NitroKit
|
|
24
24
|
alias :html_td :td
|
25
25
|
|
26
26
|
def thead(**attrs)
|
27
|
-
|
27
|
+
builder do
|
28
|
+
html_thead(**attrs) { yield }
|
29
|
+
end
|
28
30
|
end
|
29
31
|
|
30
32
|
def tbody(**attrs)
|
31
|
-
|
33
|
+
builder do
|
34
|
+
html_tbody(**mattr(attrs, class: "[&_tr:last-child]:border-0")) { yield }
|
35
|
+
end
|
32
36
|
end
|
33
37
|
|
34
38
|
def tr(**attrs)
|
35
|
-
|
39
|
+
builder do
|
40
|
+
html_tr(**mattr(attrs, class: "border-b")) { yield }
|
41
|
+
end
|
36
42
|
end
|
37
43
|
|
38
|
-
def th(text = nil, **attrs, &block)
|
39
|
-
|
40
|
-
|
44
|
+
def th(text = nil, align: :left, **attrs, &block)
|
45
|
+
builder do
|
46
|
+
html_th(**mattr(attrs, class: [header_cell_classes, cell_classes, align_classes(align), "font-medium"])) do
|
47
|
+
text_or_block(text, &block)
|
48
|
+
end
|
41
49
|
end
|
42
50
|
end
|
43
51
|
|
44
|
-
def td(text = nil, **attrs, &block)
|
45
|
-
|
46
|
-
|
52
|
+
def td(text = nil, align: nil, **attrs, &block)
|
53
|
+
builder do
|
54
|
+
html_td(**mattr(attrs, class: [cell_classes, align_classes(align)])) do
|
55
|
+
text_or_block(text, &block)
|
56
|
+
end
|
47
57
|
end
|
48
58
|
end
|
49
59
|
|
50
60
|
private
|
51
61
|
|
62
|
+
def header_cell_classes
|
63
|
+
""
|
64
|
+
end
|
65
|
+
|
52
66
|
def cell_classes
|
53
|
-
"py-
|
67
|
+
"whitespace-nowrap py-2 min-h-10 px-2"
|
68
|
+
end
|
69
|
+
|
70
|
+
def align_classes(align = nil)
|
71
|
+
case align
|
72
|
+
when :left
|
73
|
+
"text-left"
|
74
|
+
when :center
|
75
|
+
"text-center"
|
76
|
+
when :right
|
77
|
+
"text-right"
|
78
|
+
else
|
79
|
+
nil
|
80
|
+
end
|
54
81
|
end
|
55
82
|
end
|
56
83
|
end
|
@@ -22,54 +22,60 @@ module NitroKit
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def tabs(**attrs)
|
25
|
-
|
26
|
-
|
25
|
+
builder do
|
26
|
+
div(**mattr, role: "tabtabs", class: tabs_class) do
|
27
|
+
yield
|
28
|
+
end
|
27
29
|
end
|
28
30
|
end
|
29
31
|
|
30
32
|
def tab(key, text = nil, **attrs, &block)
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
33
|
+
builder do
|
34
|
+
button(
|
35
|
+
**mattr(
|
36
|
+
attrs,
|
37
|
+
aria: {
|
38
|
+
selected: (default == key).to_s,
|
39
|
+
controls: tab_id(key, :panel)
|
40
|
+
},
|
41
|
+
class: tab_class,
|
42
|
+
data: {
|
43
|
+
action: "nk--tabs#setActiveTab keydown.left->nk--tabs#prevTab keydown.right->nk--tabs#nextTab",
|
44
|
+
key:,
|
45
|
+
nk__tabs_key_param: key,
|
46
|
+
nk__tabs_target: "tab"
|
47
|
+
},
|
48
|
+
id: tab_id(key, :tab),
|
49
|
+
role: "tab",
|
50
|
+
tabindex: default == key ? 0 : -1
|
51
|
+
)
|
52
|
+
) do
|
53
|
+
text_or_block(text, &block)
|
54
|
+
end
|
51
55
|
end
|
52
56
|
end
|
53
57
|
|
54
58
|
def panel(key, **attrs)
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
59
|
+
builder do
|
60
|
+
div(
|
61
|
+
**mattr(
|
62
|
+
attrs,
|
63
|
+
aria: {
|
64
|
+
hidden: (default != key).to_s,
|
65
|
+
labelledby: tab_id(key, :tab)
|
66
|
+
},
|
67
|
+
class: panel_class,
|
68
|
+
data: {
|
69
|
+
key:,
|
70
|
+
nk__tabs_target: "panel"
|
71
|
+
},
|
72
|
+
id: tab_id(key, :panel),
|
73
|
+
name: key,
|
74
|
+
role: "tabpanel"
|
75
|
+
)
|
76
|
+
) do
|
77
|
+
yield
|
78
|
+
end
|
73
79
|
end
|
74
80
|
end
|
75
81
|
|
@@ -88,7 +94,7 @@ module NitroKit
|
|
88
94
|
end
|
89
95
|
|
90
96
|
def tab_class
|
91
|
-
"border-b-2 border-transparent hover:border-primary focus-visible:border-primary cursor-pointer text-muted-
|
97
|
+
"border-b-2 border-transparent hover:border-primary focus-visible:border-primary cursor-pointer text-muted-content aria-[selected=true]:text-foreground font-medium aria-[selected=true]:border-primary -mb-px px-2"
|
92
98
|
end
|
93
99
|
|
94
100
|
def panel_class
|
@@ -2,15 +2,19 @@
|
|
2
2
|
|
3
3
|
module NitroKit
|
4
4
|
class Textarea < Component
|
5
|
-
def initialize(**attrs)
|
5
|
+
def initialize(value: nil, **attrs)
|
6
|
+
@value = value
|
7
|
+
|
6
8
|
super(
|
7
9
|
attrs,
|
8
10
|
class: default_class
|
9
11
|
)
|
10
12
|
end
|
11
13
|
|
14
|
+
attr_reader :value
|
15
|
+
|
12
16
|
def view_template
|
13
|
-
textarea(**attrs)
|
17
|
+
textarea(**attrs) { plain(value) }
|
14
18
|
end
|
15
19
|
|
16
20
|
private
|
@@ -2,6 +2,25 @@
|
|
2
2
|
|
3
3
|
module NitroKit
|
4
4
|
class Toast < Component
|
5
|
+
class FlashMessages < Component
|
6
|
+
def initialize(flash)
|
7
|
+
@flash = flash
|
8
|
+
end
|
9
|
+
|
10
|
+
attr_reader :flash
|
11
|
+
|
12
|
+
def view_template
|
13
|
+
flash.each do |severity, message|
|
14
|
+
render(
|
15
|
+
Toast::Item.new(
|
16
|
+
description: message,
|
17
|
+
variant: severity.to_sym == :alert ? :error : :default
|
18
|
+
)
|
19
|
+
)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
5
24
|
class Item < Component
|
6
25
|
VARIANTS = %i[default warning error success]
|
7
26
|
|
@@ -86,12 +105,16 @@ module NitroKit
|
|
86
105
|
end
|
87
106
|
|
88
107
|
def item(title: nil, description: nil, **attrs, &block)
|
89
|
-
|
108
|
+
builder do
|
109
|
+
render(Item.new(title:, description:, **attrs), &block)
|
110
|
+
end
|
90
111
|
end
|
91
112
|
|
92
113
|
def flash_sink
|
93
|
-
|
94
|
-
|
114
|
+
builder do
|
115
|
+
div(id: "nk--toast-sink", data: {nk__toast_target: "sink"}, hidden: true) do
|
116
|
+
render(FlashMessages.new(view_context.flash))
|
117
|
+
end
|
95
118
|
end
|
96
119
|
end
|
97
120
|
|
@@ -26,17 +26,19 @@ module NitroKit
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def content(text = nil, **attrs, &block)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
29
|
+
builder do
|
30
|
+
div(
|
31
|
+
**mattr(
|
32
|
+
attrs,
|
33
|
+
class: tooltip_class,
|
34
|
+
data: {
|
35
|
+
state: "closed",
|
36
|
+
nk__tooltip_target: "content"
|
37
|
+
}
|
38
|
+
)
|
39
|
+
) do
|
40
|
+
text_or_block(text, &block)
|
41
|
+
end
|
40
42
|
end
|
41
43
|
end
|
42
44
|
|
@@ -3,7 +3,11 @@
|
|
3
3
|
module NitroKit
|
4
4
|
module AvatarHelper
|
5
5
|
def nk_avatar(src = nil, **attrs, &block)
|
6
|
-
render(Avatar.
|
6
|
+
render(Avatar.from_template(src, **attrs), &block)
|
7
|
+
end
|
8
|
+
|
9
|
+
def nk_avatar_stack(**attrs, &block)
|
10
|
+
render(AvatarStack.from_template(**attrs), &block)
|
7
11
|
end
|
8
12
|
end
|
9
13
|
end
|
@@ -5,7 +5,7 @@ module NitroKit
|
|
5
5
|
include Variants
|
6
6
|
|
7
7
|
def nk_button(text = nil, **attrs, &block)
|
8
|
-
render(NitroKit::Button.
|
8
|
+
render(NitroKit::Button.from_template(text, **attrs), &block)
|
9
9
|
end
|
10
10
|
|
11
11
|
automatic_variants(Button::VARIANTS, :nk_button)
|
@@ -37,13 +37,13 @@ module NitroKit
|
|
37
37
|
|
38
38
|
href = attrs[:href] || url_target(text, options)
|
39
39
|
|
40
|
-
render(NitroKit::Button.
|
40
|
+
render(NitroKit::Button.from_template(text, **attrs, href:), &block)
|
41
41
|
end
|
42
42
|
|
43
43
|
automatic_variants(Button::VARIANTS, :nk_button_link_to)
|
44
44
|
|
45
45
|
def nk_button_group(**attrs, &block)
|
46
|
-
render(ButtonGroup.
|
46
|
+
render(ButtonGroup.from_template(**attrs), &block)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|