stimulus_plumbers 0.4.11 → 0.4.13
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 +19 -0
- data/app/assets/javascripts/stimulus-plumbers/controllers.manifest.json +31 -9
- data/app/assets/javascripts/stimulus-plumbers/index.es.js +87 -96
- data/app/assets/javascripts/stimulus-plumbers/index.es.js.map +1 -1
- data/app/assets/javascripts/stimulus-plumbers/index.umd.js +1 -1
- data/app/assets/javascripts/stimulus-plumbers/index.umd.js.map +1 -1
- data/config/locales/en.yml +1 -0
- data/docs/architecture.md +1 -1
- data/docs/component/form.md +42 -20
- data/docs/component/icon.md +9 -9
- data/docs/guide.md +2 -1
- data/lib/stimulus_plumbers/components/button/icon_layout.rb +34 -0
- data/lib/stimulus_plumbers/components/button.rb +2 -23
- data/lib/stimulus_plumbers/components/card.rb +1 -1
- data/lib/stimulus_plumbers/components/combobox/builder.rb +52 -14
- data/lib/stimulus_plumbers/components/combobox/date.rb +35 -9
- data/lib/stimulus_plumbers/components/combobox/dropdown.rb +22 -6
- data/lib/stimulus_plumbers/components/combobox/time.rb +18 -5
- data/lib/stimulus_plumbers/components/combobox/trigger.rb +1 -1
- data/lib/stimulus_plumbers/components/combobox/typeahead.rb +23 -8
- data/lib/stimulus_plumbers/components/icon.rb +5 -3
- data/lib/stimulus_plumbers/components/indicator.rb +3 -1
- data/lib/stimulus_plumbers/components/link.rb +1 -1
- data/lib/stimulus_plumbers/components/list/item.rb +1 -1
- data/lib/stimulus_plumbers/components/ordered_list/item.rb +2 -2
- data/lib/stimulus_plumbers/components/popover.rb +7 -3
- data/lib/stimulus_plumbers/components/progress_bar.rb +3 -1
- data/lib/stimulus_plumbers/components/progress_meter.rb +3 -1
- data/lib/stimulus_plumbers/components/progress_ring.rb +4 -2
- data/lib/stimulus_plumbers/components/timeline/event.rb +5 -3
- data/lib/stimulus_plumbers/form/field.rb +4 -2
- data/lib/stimulus_plumbers/form/fields/inputs/code.rb +93 -32
- data/lib/stimulus_plumbers/form/fields/inputs/credit_card.rb +61 -33
- data/lib/stimulus_plumbers/form/fields/inputs/password.rb +37 -12
- data/lib/stimulus_plumbers/form/fields/inputs/search.rb +1 -1
- data/lib/stimulus_plumbers/form/fields/inputs/submit.rb +52 -7
- data/lib/stimulus_plumbers/generators/css_entrypoint.rb +10 -0
- data/lib/stimulus_plumbers/helpers/icon_helper.rb +2 -2
- data/lib/stimulus_plumbers/plumber/dispatcher.rb +14 -12
- data/lib/stimulus_plumbers/plumber/slots.rb +8 -8
- data/lib/stimulus_plumbers/themes/schema.rb +4 -0
- data/lib/stimulus_plumbers/version.rb +1 -1
- data/lib/stimulus_plumbers.rb +1 -0
- data/vendor/ARIA.md +3 -2
- data/vendor/component/manifest.json +8 -1
- data/vendor/controller/docs/input-formatter.md +18 -39
- data/vendor/controller/docs/input-revealable.md +65 -0
- data/vendor/controller/manifest.json +31 -9
- metadata +3 -1
data/config/locales/en.yml
CHANGED
data/docs/architecture.md
CHANGED
|
@@ -26,6 +26,6 @@ Validation ranges for theme schema params live under `lib/stimulus_plumbers/them
|
|
|
26
26
|
|
|
27
27
|
`Button#build_button` and `Link#build_content` always wrap non-nil text/block content in `<span>`. When content is nil and no block is given (icon-only), no `<span>` is rendered.
|
|
28
28
|
|
|
29
|
-
The active theme uses `:has(> span)` / `:not(:has(> span))` CSS to distinguish icon-only from text buttons without any Ruby flag.
|
|
29
|
+
The active theme uses `:has(> span)` / `:not(:has(> span))` CSS to distinguish icon-only from text buttons without any Ruby flag. Submit buttons with visually hidden text additionally use `:has(> span[data-sp-label-hidden])` so they retain the icon-only square layout while keeping an accessible name.
|
|
30
30
|
|
|
31
31
|
**Do not change this contract** without updating `stimulus-plumbers-tailwind`'s `Button::LAYOUT` and `Link::BUTTON` constants accordingly. See [tailwind architecture doc](../../stimulus-plumbers-tailwind/docs/architecture.md#icon-only-square-pattern).
|
data/docs/component/form.md
CHANGED
|
@@ -52,9 +52,28 @@ Special options on native helpers:
|
|
|
52
52
|
|
|
53
53
|
| Helper | Option | Effect |
|
|
54
54
|
| ---------------- | ------------------ | ------------------------------------------------------------------ |
|
|
55
|
-
| `password_field` | `revealable: true` | Wraps input in an `input-
|
|
55
|
+
| `password_field` | `revealable: true` | Wraps input in an `input-revealable` controller |
|
|
56
56
|
| `search_field` | `clearable: true` | Wraps input in an `input-clearable` controller with a clear button |
|
|
57
57
|
|
|
58
|
+
### f.submit
|
|
59
|
+
|
|
60
|
+
`f.submit` renders a themed `<button type="submit">` without a field wrapper.
|
|
61
|
+
|
|
62
|
+
```erb
|
|
63
|
+
<%= f.submit "Save" %>
|
|
64
|
+
<%= f.submit "Save", icon_leading: "save" %>
|
|
65
|
+
<%= f.submit "Continue", icon_trailing: "arrow-right" %>
|
|
66
|
+
<%= f.submit "Save", icon_leading: "save", hide_label: true %>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
| Option | Description |
|
|
70
|
+
| ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
71
|
+
| `type:` / `variant:` | Button theme type and variant. |
|
|
72
|
+
| `icon_leading:` / `icon_trailing:` | Decorative icon name placed before or after the submit text. |
|
|
73
|
+
| `hide_label: true` | Visually hides the button's own text span while keeping it available to screen readers. This differs from `Form::Field#hide_label`, which hides an associated `<label>` element. |
|
|
74
|
+
|
|
75
|
+
Submit buttons need an accessible name: pass non-blank text, or an `aria` label such as `aria: { label: "Save changes" }`.
|
|
76
|
+
|
|
58
77
|
---
|
|
59
78
|
|
|
60
79
|
## Level 2 — Full-field helpers
|
|
@@ -141,31 +160,34 @@ Use `f.select` for a native `<select>`.
|
|
|
141
160
|
|
|
142
161
|
Use `f.search_field` for a native `<input type="search">`.
|
|
143
162
|
|
|
144
|
-
**Password** (`as: :password`) — reveal-toggle wrapper backed by `input-
|
|
163
|
+
**Password** (`as: :password`) — reveal-toggle wrapper backed by `input-revealable`.
|
|
145
164
|
|
|
146
|
-
| Option
|
|
147
|
-
|
|
|
148
|
-
| `revealable`
|
|
165
|
+
| Option | Values | Default | Description |
|
|
166
|
+
| -------------- | ------- | -------------------- | ------------------------------------------- |
|
|
167
|
+
| `revealable` | Boolean | `false` | Adds a show/hide toggle button on the input |
|
|
168
|
+
| `autocomplete` | String | `"current-password"` | Native autocomplete value |
|
|
149
169
|
|
|
150
170
|
Use `f.password_field` for a plain `<input type="password">` (also accepts `revealable:`).
|
|
151
171
|
|
|
152
172
|
**Code** (`as: :code`) — character-cell entry backed by `input-formatter` and the `character-cells` plumber. The native input remains the accessible control; cells are decorative.
|
|
153
173
|
|
|
154
|
-
| Option | Values | Default | Description
|
|
155
|
-
| -------------- | ---------------------------------------- | ---------------------- |
|
|
156
|
-
| `length` | positive Integer | required | Number of cells and input maximum length
|
|
157
|
-
| `charset` | `:digits` / `:letters` / `:alphanumeric` | `:digits` | Allowed code characters
|
|
158
|
-
| `groups` | Array of positive Integers | `[]` | Visual cell groups; must add up to `length`
|
|
159
|
-
| `
|
|
160
|
-
| `
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
|
166
|
-
|
|
|
167
|
-
| `
|
|
168
|
-
| `
|
|
174
|
+
| Option | Values | Default | Description |
|
|
175
|
+
| -------------- | ---------------------------------------- | ---------------------- | -------------------------------------------------------- |
|
|
176
|
+
| `length` | positive Integer | required | Number of cells and input maximum length |
|
|
177
|
+
| `charset` | `:digits` / `:letters` / `:alphanumeric` | `:digits` | Allowed code characters |
|
|
178
|
+
| `groups` | Array of positive Integers | `[]` | Visual cell groups; must add up to `length` |
|
|
179
|
+
| `separator` | String / `nil` | `nil` | Character between groups; `nil` shows the break as a gap |
|
|
180
|
+
| `autocomplete` | String | `"one-time-code"` | Native autocomplete value |
|
|
181
|
+
| `inputmode` | String | `"numeric"` for digits | Native input mode |
|
|
182
|
+
|
|
183
|
+
**Credit card** (`as: :credit_card`) — grouped card-number entry backed by `input-formatter` and the `character-cells` plumber (grouped mode). Renders one cell per group; their sum sets `maxlength`.
|
|
184
|
+
|
|
185
|
+
| Option | Values | Default | Description |
|
|
186
|
+
| -------------- | -------------------------- | -------------- | ------------------------------------------------------------ |
|
|
187
|
+
| `groups` | Array of positive Integers | `[4, 4, 4, 4]` | Cell groups — one cell per group; their sum sets `maxlength` |
|
|
188
|
+
| `separator` | String / `nil` | `nil` | Character between cells; `nil` renders none |
|
|
189
|
+
| `autocomplete` | String | `"cc-number"` | Native autocomplete value |
|
|
190
|
+
| `inputmode` | String | `"numeric"` | Native input mode |
|
|
169
191
|
|
|
170
192
|
Character-cell fields do not support `floating:` labels.
|
|
171
193
|
|
data/docs/component/icon.md
CHANGED
|
@@ -7,17 +7,17 @@ Rails helper for rendering a named icon from the active theme's icon registry.
|
|
|
7
7
|
### `sp_icon`
|
|
8
8
|
|
|
9
9
|
```erb
|
|
10
|
-
<%= sp_icon
|
|
11
|
-
<%= sp_icon
|
|
12
|
-
<%= sp_icon
|
|
13
|
-
<%= sp_icon
|
|
10
|
+
<%= sp_icon "check" %>
|
|
11
|
+
<%= sp_icon "spinner", aria: { label: "Loading" }, role: "img" %>
|
|
12
|
+
<%= sp_icon "unknown-icon" %>
|
|
13
|
+
<%= sp_icon "check", size: :sm %>
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
| Option | Default | Description
|
|
17
|
-
| ---------------- | ---------- |
|
|
18
|
-
| `name` | (required) | Icon name — looked up in the theme registry
|
|
19
|
-
| `size` | `:lg` | `:sm` \| `:md` \| `:lg` — theme-resolved size class
|
|
20
|
-
| `**html_options` | — | Forwarded to the root element
|
|
16
|
+
| Option | Default | Description |
|
|
17
|
+
| ---------------- | ---------- | ---------------------------------------------------------------------- |
|
|
18
|
+
| `name` | (required) | Positional (1st argument). Icon name — looked up in the theme registry |
|
|
19
|
+
| `size` | `:lg` | `:sm` \| `:md` \| `:lg` — theme-resolved size class |
|
|
20
|
+
| `**html_options` | — | Forwarded to the root element |
|
|
21
21
|
|
|
22
22
|
---
|
|
23
23
|
|
data/docs/guide.md
CHANGED
|
@@ -12,7 +12,8 @@ Use `StimulusPlumbers::Form::Builder` (set `config.action_view.default_form_buil
|
|
|
12
12
|
- **Level 1.** Native helper overrides (`f.text_field`, `f.select`, `f.check_box`, ...) render
|
|
13
13
|
only the themed input element — use when you control the surrounding markup.
|
|
14
14
|
|
|
15
|
-
Submit with `f.submit` (themed button
|
|
15
|
+
Submit with `f.submit` (themed button; supports `icon_leading:`/`icon_trailing:` and
|
|
16
|
+
`hide_label:` for an icon-only button — see [docs/component/form.md](component/form.md)).
|
|
16
17
|
|
|
17
18
|
## Building views
|
|
18
19
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module StimulusPlumbers
|
|
4
|
+
module Components
|
|
5
|
+
class Button < Plumber::Base
|
|
6
|
+
module IconLayout
|
|
7
|
+
private
|
|
8
|
+
|
|
9
|
+
def build_layout(slots, &block)
|
|
10
|
+
@template.safe_join(
|
|
11
|
+
[
|
|
12
|
+
render_icon_slot(slots, :icon_leading),
|
|
13
|
+
@template.capture(&block),
|
|
14
|
+
render_icon_slot(slots, :icon_trailing)
|
|
15
|
+
]
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def render_icon_slot(slots, name)
|
|
20
|
+
slots.resolve(name) do |value|
|
|
21
|
+
next value unless Components::Icon.icon_name?(value)
|
|
22
|
+
|
|
23
|
+
Components::Icon.new(@template).render(
|
|
24
|
+
value,
|
|
25
|
+
size: :sm,
|
|
26
|
+
classes: theme.resolve(:button_icon).fetch(:classes, ""),
|
|
27
|
+
aria: { hidden: "true" }
|
|
28
|
+
)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
module StimulusPlumbers
|
|
4
4
|
module Components
|
|
5
5
|
class Button < Plumber::Base
|
|
6
|
+
include IconLayout
|
|
7
|
+
|
|
6
8
|
def render(content = nil, icon_leading: nil, icon_trailing: nil, **kwargs, &block)
|
|
7
9
|
slots = Button::Slots.new(template)
|
|
8
10
|
slots.with_icon_leading(icon_leading) if icon_leading
|
|
@@ -34,29 +36,6 @@ module StimulusPlumbers
|
|
|
34
36
|
template.content_tag(:span, content)
|
|
35
37
|
end
|
|
36
38
|
end
|
|
37
|
-
|
|
38
|
-
def build_layout(slots, &block)
|
|
39
|
-
template.safe_join(
|
|
40
|
-
[
|
|
41
|
-
render_icon_slot(slots, :icon_leading),
|
|
42
|
-
template.capture(&block),
|
|
43
|
-
render_icon_slot(slots, :icon_trailing)
|
|
44
|
-
]
|
|
45
|
-
)
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def render_icon_slot(slots, name)
|
|
49
|
-
slots.resolve(name) do |value|
|
|
50
|
-
next value unless Components::Icon.icon_name?(value)
|
|
51
|
-
|
|
52
|
-
Components::Icon.new(template).render(
|
|
53
|
-
name: value,
|
|
54
|
-
size: :sm,
|
|
55
|
-
classes: theme.resolve(:button_icon).fetch(:classes, ""),
|
|
56
|
-
aria: { hidden: "true" }
|
|
57
|
-
)
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
39
|
end
|
|
61
40
|
end
|
|
62
41
|
end
|
|
@@ -49,7 +49,7 @@ module StimulusPlumbers
|
|
|
49
49
|
return value unless value.is_a?(Symbol) || (value.is_a?(String) && !value.html_safe?)
|
|
50
50
|
|
|
51
51
|
Components::Icon.new(template).render(
|
|
52
|
-
|
|
52
|
+
value,
|
|
53
53
|
classes: theme.resolve(:card_icon).fetch(:classes, ""),
|
|
54
54
|
aria: { hidden: "true" }
|
|
55
55
|
)
|
|
@@ -6,15 +6,37 @@ module StimulusPlumbers
|
|
|
6
6
|
# Yielded to `Combobox#render`: selects a variant renderer, then exposes its
|
|
7
7
|
# `metadata` (trigger/wrapper wiring) and renders its panel body.
|
|
8
8
|
class Builder < Plumber::Slots
|
|
9
|
-
def dropdown(**options)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
def dropdown(**options)
|
|
10
|
+
select(Dropdown, options)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def typeahead(**options)
|
|
14
|
+
select(Typeahead, options)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def date(**options)
|
|
18
|
+
select(Date, options)
|
|
19
|
+
end
|
|
13
20
|
|
|
14
|
-
def
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
def time(**options)
|
|
22
|
+
select(Time, options)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def selected?
|
|
26
|
+
@slots.key?(:variant)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def renderer
|
|
30
|
+
selection&.fetch(:renderer)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def options
|
|
34
|
+
selection ? selection[:options] : {}
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def metadata
|
|
38
|
+
renderer ? renderer::Metadata : DefaultMetadata
|
|
39
|
+
end
|
|
18
40
|
|
|
19
41
|
def render_panel(template, panel_attrs:)
|
|
20
42
|
renderer&.new(template)&.render(panel_attrs: panel_attrs, **options)
|
|
@@ -24,11 +46,25 @@ module StimulusPlumbers
|
|
|
24
46
|
module DefaultMetadata
|
|
25
47
|
module_function
|
|
26
48
|
|
|
27
|
-
def haspopup
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def
|
|
49
|
+
def haspopup
|
|
50
|
+
"dialog"
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def popup_id_for(panel_id)
|
|
54
|
+
panel_id
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def trigger_icon
|
|
58
|
+
nil
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def trigger_options
|
|
62
|
+
{}
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def stimulus_data(_panel_id, _options)
|
|
66
|
+
{}
|
|
67
|
+
end
|
|
32
68
|
end
|
|
33
69
|
|
|
34
70
|
private
|
|
@@ -38,7 +74,9 @@ module StimulusPlumbers
|
|
|
38
74
|
nil
|
|
39
75
|
end
|
|
40
76
|
|
|
41
|
-
def selection
|
|
77
|
+
def selection
|
|
78
|
+
resolve(:variant)
|
|
79
|
+
end
|
|
42
80
|
end
|
|
43
81
|
end
|
|
44
82
|
end
|
|
@@ -16,21 +16,47 @@ module StimulusPlumbers
|
|
|
16
16
|
"#{STIMULUS_CONTROLLER}:selected->#{Components::Popover::STIMULUS_CONTROLLER}#closeOnSelect"
|
|
17
17
|
].join(" ").freeze
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
class << self
|
|
20
|
+
def month_id_for(panel_id)
|
|
21
|
+
[panel_id, "calendar_month"].compact.join("_")
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def year_id_for(panel_id)
|
|
25
|
+
[panel_id, "calendar_year"].compact.join("_")
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def decade_id_for(panel_id)
|
|
29
|
+
[panel_id, "calendar_decade"].compact.join("_")
|
|
30
|
+
end
|
|
31
|
+
end
|
|
22
32
|
|
|
23
33
|
module Metadata
|
|
24
34
|
module_function
|
|
25
35
|
|
|
26
|
-
def haspopup
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def
|
|
36
|
+
def haspopup
|
|
37
|
+
"dialog"
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def popup_id_for(panel_id)
|
|
41
|
+
panel_id
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def trigger_icon
|
|
45
|
+
"calendar"
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def trigger_options
|
|
49
|
+
{}
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def stimulus_data(_panel_id, _options)
|
|
53
|
+
{ input_formatter_format_value: "date" }
|
|
54
|
+
end
|
|
31
55
|
end
|
|
32
56
|
|
|
33
|
-
def render(...)
|
|
57
|
+
def render(...)
|
|
58
|
+
render_date(...)
|
|
59
|
+
end
|
|
34
60
|
|
|
35
61
|
private
|
|
36
62
|
|
|
@@ -15,14 +15,30 @@ module StimulusPlumbers
|
|
|
15
15
|
module Metadata
|
|
16
16
|
module_function
|
|
17
17
|
|
|
18
|
-
def haspopup
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def
|
|
18
|
+
def haspopup
|
|
19
|
+
"listbox"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def popup_id_for(panel_id)
|
|
23
|
+
panel_id
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def trigger_icon
|
|
27
|
+
"chevron-down"
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def trigger_options
|
|
31
|
+
{}
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def stimulus_data(_panel_id, _options)
|
|
35
|
+
{}
|
|
36
|
+
end
|
|
23
37
|
end
|
|
24
38
|
|
|
25
|
-
def render(...)
|
|
39
|
+
def render(...)
|
|
40
|
+
render_dropdown(...)
|
|
41
|
+
end
|
|
26
42
|
|
|
27
43
|
private
|
|
28
44
|
|
|
@@ -13,10 +13,21 @@ module StimulusPlumbers
|
|
|
13
13
|
module Metadata
|
|
14
14
|
module_function
|
|
15
15
|
|
|
16
|
-
def haspopup
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
def haspopup
|
|
17
|
+
"dialog"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def popup_id_for(panel_id)
|
|
21
|
+
panel_id
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def trigger_icon
|
|
25
|
+
"clock"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def trigger_options
|
|
29
|
+
{}
|
|
30
|
+
end
|
|
20
31
|
|
|
21
32
|
def stimulus_data(_panel_id, options)
|
|
22
33
|
{
|
|
@@ -26,7 +37,9 @@ module StimulusPlumbers
|
|
|
26
37
|
end
|
|
27
38
|
end
|
|
28
39
|
|
|
29
|
-
def render(...)
|
|
40
|
+
def render(...)
|
|
41
|
+
render_time(...)
|
|
42
|
+
end
|
|
30
43
|
|
|
31
44
|
private
|
|
32
45
|
|
|
@@ -4,17 +4,30 @@ module StimulusPlumbers
|
|
|
4
4
|
module Components
|
|
5
5
|
class Combobox
|
|
6
6
|
class Typeahead < Plumber::Base
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
class << self
|
|
8
|
+
def listbox_id_for(panel_id)
|
|
9
|
+
[panel_id, "listbox"].compact.join("_")
|
|
10
|
+
end
|
|
9
11
|
end
|
|
10
12
|
|
|
11
13
|
module Metadata
|
|
12
14
|
module_function
|
|
13
15
|
|
|
14
|
-
def haspopup
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
def haspopup
|
|
17
|
+
"listbox"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def popup_id_for(panel_id)
|
|
21
|
+
Typeahead.listbox_id_for(panel_id)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def trigger_icon
|
|
25
|
+
nil
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def trigger_options
|
|
29
|
+
{ readonly: false, aria: { autocomplete: "list" } }
|
|
30
|
+
end
|
|
18
31
|
|
|
19
32
|
def stimulus_data(panel_id, _options)
|
|
20
33
|
{
|
|
@@ -24,7 +37,9 @@ module StimulusPlumbers
|
|
|
24
37
|
end
|
|
25
38
|
end
|
|
26
39
|
|
|
27
|
-
def render(...)
|
|
40
|
+
def render(...)
|
|
41
|
+
render_typeahead(...)
|
|
42
|
+
end
|
|
28
43
|
|
|
29
44
|
private
|
|
30
45
|
|
|
@@ -74,7 +89,7 @@ module StimulusPlumbers
|
|
|
74
89
|
)
|
|
75
90
|
) do
|
|
76
91
|
Components::Icon.new(template).render(
|
|
77
|
-
|
|
92
|
+
"spinner",
|
|
78
93
|
size: :md,
|
|
79
94
|
classes: theme.resolve(:combobox_typeahead_loading_icon).fetch(:classes, ""),
|
|
80
95
|
aria: { hidden: "true" }
|
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
module StimulusPlumbers
|
|
4
4
|
module Components
|
|
5
5
|
class Icon < Plumber::Base
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
class << self
|
|
7
|
+
def icon_name?(value)
|
|
8
|
+
value.is_a?(Symbol) || (value.is_a?(String) && !value.html_safe?)
|
|
9
|
+
end
|
|
8
10
|
end
|
|
9
11
|
|
|
10
|
-
def render(name
|
|
12
|
+
def render(name, size: :lg, **kwargs)
|
|
11
13
|
html_options = merge_html_options(
|
|
12
14
|
theme.resolve(:icon, size: size),
|
|
13
15
|
kwargs
|
|
@@ -85,7 +85,7 @@ module StimulusPlumbers
|
|
|
85
85
|
next value unless Components::Icon.icon_name?(value)
|
|
86
86
|
|
|
87
87
|
Components::Icon.new(template).render(
|
|
88
|
-
|
|
88
|
+
value,
|
|
89
89
|
size: :sm,
|
|
90
90
|
classes: theme.resolve(:ordered_list_item_handle).fetch(:classes, ""),
|
|
91
91
|
aria: { hidden: "true" }
|
|
@@ -95,7 +95,7 @@ module StimulusPlumbers
|
|
|
95
95
|
|
|
96
96
|
def default_handle_icon
|
|
97
97
|
Components::Icon.new(template).render(
|
|
98
|
-
|
|
98
|
+
"grip-vertical",
|
|
99
99
|
size: :sm,
|
|
100
100
|
classes: theme.resolve(:ordered_list_item_handle).fetch(:classes, ""),
|
|
101
101
|
aria: { hidden: "true" }
|
|
@@ -5,11 +5,15 @@ module StimulusPlumbers
|
|
|
5
5
|
class Popover < Plumber::Base
|
|
6
6
|
STIMULUS_CONTROLLER = "popover"
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
class << self
|
|
9
|
+
def panel_id_for(trigger_id)
|
|
10
|
+
[trigger_id, "popover"].compact.join("_")
|
|
11
|
+
end
|
|
10
12
|
end
|
|
11
13
|
|
|
12
|
-
def render(...)
|
|
14
|
+
def render(...)
|
|
15
|
+
render_popover(...)
|
|
16
|
+
end
|
|
13
17
|
|
|
14
18
|
def build(panel_id: nil, &block)
|
|
15
19
|
@panel_id = panel_id || self.class.panel_id_for(template.sp_dom_id)
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
module StimulusPlumbers
|
|
4
4
|
module Components
|
|
5
5
|
class ProgressRing < Plumber::Base
|
|
6
|
-
def render(...)
|
|
6
|
+
def render(...)
|
|
7
|
+
render_ring(...)
|
|
8
|
+
end
|
|
7
9
|
|
|
8
10
|
private
|
|
9
11
|
|
|
@@ -14,7 +16,7 @@ module StimulusPlumbers
|
|
|
14
16
|
stimulus_data(value: value, min: min, max: max, indeterminate: indeterminate),
|
|
15
17
|
{ role: "progressbar", aria: progress_aria(value: value, min: min, max: max, indeterminate: indeterminate) }
|
|
16
18
|
)
|
|
17
|
-
Components::Icon.new(template).render(
|
|
19
|
+
Components::Icon.new(template).render("progress-ring", **icon_options)
|
|
18
20
|
end
|
|
19
21
|
|
|
20
22
|
def progress_aria(value:, min:, max:, indeterminate:)
|