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,11 +17,34 @@ module NitroKit
|
|
17
17
|
|
18
18
|
# TODO: multiple, unchecked hidden field
|
19
19
|
|
20
|
-
render(Checkbox.
|
20
|
+
render(Checkbox.from_template(name:, label:, value: compat_checked_value, checked:, **attrs))
|
21
21
|
end
|
22
22
|
|
23
|
+
def nk_checkbox_tag(name, *args)
|
24
|
+
if args.length >= 4
|
25
|
+
raise ArgumentError, "wrong number of arguments (given #{args.length + 1}, expected 1..4)"
|
26
|
+
end
|
27
|
+
|
28
|
+
options = args.extract_options!
|
29
|
+
value, checked = args.empty? ? ["1", false] : [*args, false]
|
30
|
+
attrs = {
|
31
|
+
type: "checkbox",
|
32
|
+
name: name,
|
33
|
+
id: sanitize_to_id(name),
|
34
|
+
value: value
|
35
|
+
}.update(
|
36
|
+
options.symbolize_keys
|
37
|
+
)
|
38
|
+
|
39
|
+
attrs[:checked] = "checked" if checked
|
40
|
+
|
41
|
+
render(Checkbox.from_template(name:, **attrs))
|
42
|
+
end
|
43
|
+
|
44
|
+
alias :nk_check_box_tag :nk_checkbox_tag
|
45
|
+
|
23
46
|
def nk_checkbox_group(**attrs, &block)
|
24
|
-
render(CheckboxGroup.
|
47
|
+
render(CheckboxGroup.from_template(**attrs), &block)
|
25
48
|
end
|
26
49
|
end
|
27
50
|
end
|
@@ -13,11 +13,11 @@ module NitroKit
|
|
13
13
|
name = field_name(compat_object_name, compat_method)
|
14
14
|
value = compat_tag_value || attrs[:value]
|
15
15
|
|
16
|
-
render(RadioButton.
|
16
|
+
render(RadioButton.from_template(label:, name:, value:, **attrs))
|
17
17
|
end
|
18
18
|
|
19
19
|
def nk_radio_button_group(**attrs, &block)
|
20
|
-
render(RadioButtonGroup.
|
20
|
+
render(RadioButtonGroup.from_template(**attrs), &block)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -18,7 +18,7 @@ module NitroKit
|
|
18
18
|
|
19
19
|
# TODO: support index
|
20
20
|
|
21
|
-
render(Select.
|
21
|
+
render(Select.from_template(options, value:, include_blank:, prompt:, **compat_options, **attrs), &block)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module NitroKit
|
4
4
|
module ToastHelper
|
5
5
|
def nk_toast(**attrs, &block)
|
6
|
-
render(Toast.
|
6
|
+
render(Toast.from_template(**attrs), &block)
|
7
7
|
end
|
8
8
|
|
9
9
|
def nk_toast_action(title: nil, description: nil, event: nil)
|
@@ -15,18 +15,7 @@ module NitroKit
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def nk_toast_flash_messages
|
18
|
-
|
19
|
-
flash.each do |severity, message|
|
20
|
-
concat(
|
21
|
-
render(
|
22
|
-
Toast::Item.new(
|
23
|
-
description: message,
|
24
|
-
variant: severity.to_sym == :alert ? :error : :default
|
25
|
-
)
|
26
|
-
)
|
27
|
-
)
|
28
|
-
end
|
29
|
-
end
|
18
|
+
render(Toast::FlashMessages.from_template(flash))
|
30
19
|
end
|
31
20
|
|
32
21
|
def nk_toast_turbo_stream_refresh
|
data/lib/nitro_kit/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nitro_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikkel Malmberg
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rails
|
@@ -43,14 +43,14 @@ dependencies:
|
|
43
43
|
requirements:
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 2.
|
46
|
+
version: 2.1.0
|
47
47
|
type: :runtime
|
48
48
|
prerelease: false
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 2.
|
53
|
+
version: 2.1.0
|
54
54
|
description: WIP, not usable yet
|
55
55
|
email:
|
56
56
|
- mikkel@brnbw.com
|
@@ -58,12 +58,12 @@ executables: []
|
|
58
58
|
extensions: []
|
59
59
|
extra_rdoc_files: []
|
60
60
|
files:
|
61
|
-
- MIT-LICENSE
|
62
61
|
- README.md
|
63
62
|
- Rakefile
|
64
63
|
- app/components/nitro_kit/accordion.rb
|
65
64
|
- app/components/nitro_kit/alert.rb
|
66
65
|
- app/components/nitro_kit/avatar.rb
|
66
|
+
- app/components/nitro_kit/avatar_stack.rb
|
67
67
|
- app/components/nitro_kit/badge.rb
|
68
68
|
- app/components/nitro_kit/button.rb
|
69
69
|
- app/components/nitro_kit/button_group.rb
|
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
157
|
- !ruby/object:Gem::Version
|
158
158
|
version: '0'
|
159
159
|
requirements: []
|
160
|
-
rubygems_version: 3.6.
|
160
|
+
rubygems_version: 3.6.9
|
161
161
|
specification_version: 4
|
162
162
|
summary: WIP, not usable yet
|
163
163
|
test_files: []
|
data/MIT-LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright Mikkel Malmberg
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|