stimulus_plumbers 0.2.2 → 0.2.8
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 +38 -0
- data/README.md +57 -41
- data/app/assets/javascripts/stimulus-plumbers/stimulus-plumbers-controllers.es.js +1628 -0
- data/app/assets/javascripts/stimulus-plumbers/stimulus-plumbers-controllers.umd.js +1 -0
- data/lib/stimulus_plumbers/components/combobox/autocomplete.rb +57 -0
- data/lib/stimulus_plumbers/components/combobox/date.rb +52 -0
- data/lib/stimulus_plumbers/components/combobox/dropdown.rb +41 -0
- data/lib/stimulus_plumbers/components/combobox/option.rb +27 -0
- data/lib/stimulus_plumbers/components/combobox/option_group.rb +52 -0
- data/lib/stimulus_plumbers/components/combobox/renderer.rb +78 -0
- data/lib/stimulus_plumbers/components/combobox/time.rb +103 -0
- data/lib/stimulus_plumbers/components/date_picker/navigation.rb +1 -1
- data/lib/stimulus_plumbers/components/plumber/html_options.rb +22 -3
- data/lib/stimulus_plumbers/components/time_picker/renderer.rb +38 -0
- data/lib/stimulus_plumbers/form/builder.rb +57 -12
- data/lib/stimulus_plumbers/form/field_component.rb +12 -10
- data/lib/stimulus_plumbers/form/fields/combobox.rb +41 -0
- data/lib/stimulus_plumbers/form/fields/password.rb +55 -0
- data/lib/stimulus_plumbers/form/fields/renderer.rb +1 -2
- data/lib/stimulus_plumbers/form/fields/search.rb +40 -0
- data/lib/stimulus_plumbers/form/fields/select.rb +8 -2
- data/lib/stimulus_plumbers/form/fields/text.rb +12 -4
- data/lib/stimulus_plumbers/helpers/combobox_helper.rb +74 -0
- data/lib/stimulus_plumbers/helpers.rb +2 -2
- data/lib/stimulus_plumbers/themes/{form.rb → base/form.rb} +6 -2
- data/lib/stimulus_plumbers/themes/base.rb +7 -7
- data/lib/stimulus_plumbers/themes/tailwind/form.rb +10 -6
- data/lib/stimulus_plumbers/version.rb +1 -1
- data/lib/stimulus_plumbers.rb +18 -1
- metadata +25 -15
- data/lib/stimulus_plumbers/components/date_picker/renderer.rb +0 -82
- data/lib/stimulus_plumbers/helpers/date_picker_helper.rb +0 -17
- /data/lib/stimulus_plumbers/themes/{action_list.rb → base/action_list.rb} +0 -0
- /data/lib/stimulus_plumbers/themes/{avatar.rb → base/avatar.rb} +0 -0
- /data/lib/stimulus_plumbers/themes/{button.rb → base/button.rb} +0 -0
- /data/lib/stimulus_plumbers/themes/{calendar.rb → base/calendar.rb} +0 -0
- /data/lib/stimulus_plumbers/themes/{card.rb → base/card.rb} +0 -0
- /data/lib/stimulus_plumbers/themes/{layout.rb → base/layout.rb} +0 -0
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: stimulus_plumbers
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryan Chang
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: railties
|
|
@@ -38,8 +37,11 @@ executables: []
|
|
|
38
37
|
extensions: []
|
|
39
38
|
extra_rdoc_files: []
|
|
40
39
|
files:
|
|
40
|
+
- CHANGELOG.md
|
|
41
41
|
- README.md
|
|
42
42
|
- app/assets/javascripts/stimulus-plumbers/.keep
|
|
43
|
+
- app/assets/javascripts/stimulus-plumbers/stimulus-plumbers-controllers.es.js
|
|
44
|
+
- app/assets/javascripts/stimulus-plumbers/stimulus-plumbers-controllers.umd.js
|
|
43
45
|
- app/assets/stylesheets/stimulus_plumbers/tokens.css
|
|
44
46
|
- lib/stimulus_plumbers.rb
|
|
45
47
|
- lib/stimulus_plumbers/components/action_list/renderer.rb
|
|
@@ -50,22 +52,32 @@ files:
|
|
|
50
52
|
- lib/stimulus_plumbers/components/calendar/month/turbo/renderer.rb
|
|
51
53
|
- lib/stimulus_plumbers/components/calendar/renderer.rb
|
|
52
54
|
- lib/stimulus_plumbers/components/card/renderer.rb
|
|
55
|
+
- lib/stimulus_plumbers/components/combobox/autocomplete.rb
|
|
56
|
+
- lib/stimulus_plumbers/components/combobox/date.rb
|
|
57
|
+
- lib/stimulus_plumbers/components/combobox/dropdown.rb
|
|
58
|
+
- lib/stimulus_plumbers/components/combobox/option.rb
|
|
59
|
+
- lib/stimulus_plumbers/components/combobox/option_group.rb
|
|
60
|
+
- lib/stimulus_plumbers/components/combobox/renderer.rb
|
|
61
|
+
- lib/stimulus_plumbers/components/combobox/time.rb
|
|
53
62
|
- lib/stimulus_plumbers/components/date_picker/navigation.rb
|
|
54
63
|
- lib/stimulus_plumbers/components/date_picker/navigator.rb
|
|
55
|
-
- lib/stimulus_plumbers/components/date_picker/renderer.rb
|
|
56
64
|
- lib/stimulus_plumbers/components/icon/renderer.rb
|
|
57
65
|
- lib/stimulus_plumbers/components/plumber/base.rb
|
|
58
66
|
- lib/stimulus_plumbers/components/plumber/dispatcher.rb
|
|
59
67
|
- lib/stimulus_plumbers/components/plumber/html_options.rb
|
|
60
68
|
- lib/stimulus_plumbers/components/plumber/renderer.rb
|
|
61
69
|
- lib/stimulus_plumbers/components/popover/renderer.rb
|
|
70
|
+
- lib/stimulus_plumbers/components/time_picker/renderer.rb
|
|
62
71
|
- lib/stimulus_plumbers/configuration.rb
|
|
63
72
|
- lib/stimulus_plumbers/engine.rb
|
|
64
73
|
- lib/stimulus_plumbers/form/builder.rb
|
|
65
74
|
- lib/stimulus_plumbers/form/field_component.rb
|
|
66
75
|
- lib/stimulus_plumbers/form/fields/choice.rb
|
|
76
|
+
- lib/stimulus_plumbers/form/fields/combobox.rb
|
|
67
77
|
- lib/stimulus_plumbers/form/fields/file.rb
|
|
78
|
+
- lib/stimulus_plumbers/form/fields/password.rb
|
|
68
79
|
- lib/stimulus_plumbers/form/fields/renderer.rb
|
|
80
|
+
- lib/stimulus_plumbers/form/fields/search.rb
|
|
69
81
|
- lib/stimulus_plumbers/form/fields/select.rb
|
|
70
82
|
- lib/stimulus_plumbers/form/fields/text.rb
|
|
71
83
|
- lib/stimulus_plumbers/form/fields/text_area.rb
|
|
@@ -76,18 +88,18 @@ files:
|
|
|
76
88
|
- lib/stimulus_plumbers/helpers/calendar_helper.rb
|
|
77
89
|
- lib/stimulus_plumbers/helpers/calendar_turbo_helper.rb
|
|
78
90
|
- lib/stimulus_plumbers/helpers/card_helper.rb
|
|
79
|
-
- lib/stimulus_plumbers/helpers/
|
|
91
|
+
- lib/stimulus_plumbers/helpers/combobox_helper.rb
|
|
80
92
|
- lib/stimulus_plumbers/helpers/plumber_helper.rb
|
|
81
93
|
- lib/stimulus_plumbers/helpers/popover_helper.rb
|
|
82
94
|
- lib/stimulus_plumbers/logger.rb
|
|
83
|
-
- lib/stimulus_plumbers/themes/action_list.rb
|
|
84
|
-
- lib/stimulus_plumbers/themes/avatar.rb
|
|
85
95
|
- lib/stimulus_plumbers/themes/base.rb
|
|
86
|
-
- lib/stimulus_plumbers/themes/
|
|
87
|
-
- lib/stimulus_plumbers/themes/
|
|
88
|
-
- lib/stimulus_plumbers/themes/
|
|
89
|
-
- lib/stimulus_plumbers/themes/
|
|
90
|
-
- lib/stimulus_plumbers/themes/
|
|
96
|
+
- lib/stimulus_plumbers/themes/base/action_list.rb
|
|
97
|
+
- lib/stimulus_plumbers/themes/base/avatar.rb
|
|
98
|
+
- lib/stimulus_plumbers/themes/base/button.rb
|
|
99
|
+
- lib/stimulus_plumbers/themes/base/calendar.rb
|
|
100
|
+
- lib/stimulus_plumbers/themes/base/card.rb
|
|
101
|
+
- lib/stimulus_plumbers/themes/base/form.rb
|
|
102
|
+
- lib/stimulus_plumbers/themes/base/layout.rb
|
|
91
103
|
- lib/stimulus_plumbers/themes/schema/ranges.rb
|
|
92
104
|
- lib/stimulus_plumbers/themes/tailwind/action_list.rb
|
|
93
105
|
- lib/stimulus_plumbers/themes/tailwind/avatar.rb
|
|
@@ -107,7 +119,6 @@ metadata:
|
|
|
107
119
|
changelog_uri: https://github.com/ryancyq/stimulus-plumbers/blob/main/CHANGELOG.md
|
|
108
120
|
homepage_uri: https://github.com/ryancyq/stimulus-plumbers
|
|
109
121
|
source_code_uri: https://github.com/ryancyq/stimulus-plumbers/tree/main/stimulus-plumbers-rails
|
|
110
|
-
post_install_message:
|
|
111
122
|
rdoc_options: []
|
|
112
123
|
require_paths:
|
|
113
124
|
- lib
|
|
@@ -122,8 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
122
133
|
- !ruby/object:Gem::Version
|
|
123
134
|
version: 3.2.0
|
|
124
135
|
requirements: []
|
|
125
|
-
rubygems_version: 3.
|
|
126
|
-
signing_key:
|
|
136
|
+
rubygems_version: 3.6.9
|
|
127
137
|
specification_version: 4
|
|
128
138
|
summary: Accessible ActionView components for Rails with Stimulus controllers
|
|
129
139
|
test_files: []
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module StimulusPlumbers
|
|
4
|
-
module Components
|
|
5
|
-
module DatePicker
|
|
6
|
-
class Renderer < Plumber::Base
|
|
7
|
-
STIMULUS_CONTROLLER = "datepicker"
|
|
8
|
-
POPOVER_CONTROLLER = "popover"
|
|
9
|
-
CALENDAR_CONTROLLER = Calendar::Renderer::OBSERVER_STIMULUS_CONTROLLER
|
|
10
|
-
CALENDAR_OUTLET = "#{STIMULUS_CONTROLLER}_#{Calendar::Renderer::STIMULUS_CONTROLLER}_outlet".freeze
|
|
11
|
-
STIMULUS_DATA = {
|
|
12
|
-
controller: "#{STIMULUS_CONTROLLER} #{POPOVER_CONTROLLER}",
|
|
13
|
-
action: "#{CALENDAR_CONTROLLER}:selected->#{STIMULUS_CONTROLLER}#selected " \
|
|
14
|
-
"#{CALENDAR_CONTROLLER}:selected->#{POPOVER_CONTROLLER}#hide"
|
|
15
|
-
}.freeze
|
|
16
|
-
|
|
17
|
-
def render(calendar_id: nil, calendar_dialog_id: nil, **kwargs)
|
|
18
|
-
data = calendar_id ? STIMULUS_DATA.merge(CALENDAR_OUTLET => "##{calendar_id}") : STIMULUS_DATA
|
|
19
|
-
html_options = merge_html_options(
|
|
20
|
-
{ classes: theme.resolve(:datepicker).fetch(:classes, ""), data: data },
|
|
21
|
-
kwargs
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
template.content_tag(:div, **html_options) do
|
|
25
|
-
template.safe_join([display_input(calendar_dialog_id), hidden_input, popover(calendar_id, calendar_dialog_id)])
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
private
|
|
30
|
-
|
|
31
|
-
def display_input(calendar_dialog_id)
|
|
32
|
-
template.tag.input(
|
|
33
|
-
type: "text",
|
|
34
|
-
role: "combobox",
|
|
35
|
-
aria: { label: "Date", haspopup: "dialog", controls: calendar_dialog_id },
|
|
36
|
-
data: {
|
|
37
|
-
"#{STIMULUS_CONTROLLER}_target": "display",
|
|
38
|
-
"#{POPOVER_CONTROLLER}_target": "activator",
|
|
39
|
-
action: [
|
|
40
|
-
"focus->#{POPOVER_CONTROLLER}#show",
|
|
41
|
-
"click->#{POPOVER_CONTROLLER}#show"
|
|
42
|
-
].join(" ")
|
|
43
|
-
}
|
|
44
|
-
)
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def hidden_input
|
|
48
|
-
template.tag.input(
|
|
49
|
-
type: "hidden",
|
|
50
|
-
data: { "#{STIMULUS_CONTROLLER}_target": "input" }
|
|
51
|
-
)
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
def popover(calendar_id, calendar_dialog_id)
|
|
55
|
-
template.content_tag(
|
|
56
|
-
:div,
|
|
57
|
-
id: calendar_dialog_id,
|
|
58
|
-
role: "dialog",
|
|
59
|
-
aria: { label: "Date picker" },
|
|
60
|
-
data: { "#{POPOVER_CONTROLLER}_target": "content" },
|
|
61
|
-
hidden: ""
|
|
62
|
-
) do
|
|
63
|
-
template.safe_join(
|
|
64
|
-
[
|
|
65
|
-
navigation(stimulus_controller: STIMULUS_CONTROLLER, step: "month"),
|
|
66
|
-
calendar_month(id: calendar_id)
|
|
67
|
-
]
|
|
68
|
-
)
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
def navigation(**kwargs)
|
|
73
|
-
Navigation.new(template).render(stimulus_controller: STIMULUS_CONTROLLER, step: "month", **kwargs)
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def calendar_month(**kwargs)
|
|
77
|
-
Calendar::Renderer.new(template).month(**kwargs)
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module StimulusPlumbers
|
|
4
|
-
module Helpers
|
|
5
|
-
module DatePickerHelper
|
|
6
|
-
def sp_date_picker_month(record = nil, attribute = nil, **html_options)
|
|
7
|
-
calendar_id = sp_dom_id(record, [attribute, "date"].filter(&:presence).join("_"))
|
|
8
|
-
calendar_dialog_id = "#{calendar_id}_dialog"
|
|
9
|
-
Components::DatePicker::Renderer.new(self).render(
|
|
10
|
-
calendar_id: calendar_id,
|
|
11
|
-
calendar_dialog_id: calendar_dialog_id,
|
|
12
|
-
**html_options
|
|
13
|
-
)
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|