protos 0.4.3 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/protos/accordion/item.rb +7 -7
- data/lib/protos/accordion.rb +14 -4
- data/lib/protos/alert/actions.rb +6 -0
- data/lib/protos/breadcrumbs.rb +6 -0
- data/lib/protos/collapse/title.rb +6 -5
- data/lib/protos/collapse.rb +15 -4
- data/lib/protos/command/input.rb +1 -1
- data/lib/protos/command/title.rb +1 -1
- data/lib/protos/drawer/side.rb +6 -2
- data/lib/protos/drawer/trigger.rb +2 -2
- data/lib/protos/drawer.rb +13 -4
- data/lib/protos/popover/trigger.rb +3 -2
- data/lib/protos/swap.rb +7 -1
- data/lib/protos/tabs/tab.rb +3 -14
- data/lib/protos/toast/close_button.rb +1 -0
- data/lib/protos/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 875e55f36d03988e78d0e6834e840094b089ee1e755c003b6483a07a503bfbf4
|
4
|
+
data.tar.gz: 6b0bdbfc22451928316c73dd931cdeebe3e47cf20c596b3d5318b3145f51b5bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62c59568bcf8631d3d9c40de57ddb6b1df2f92183c0e9aa92e8be6b0da7d6e325e440a869eda3f1fd0cb93f651f9db8598a9914cc89b6454a1cda7f5a04517fc
|
7
|
+
data.tar.gz: 2ef45fba8e402133e4345fa91186713dc864e11d737bf3200548340cf7ed3d115e08b406b6d5c98eab8d568d4178b37d1b5e43fa13569dcc873fda6a8f338be9
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.5.0] - 2024-08-27
|
4
|
+
|
5
|
+
- Fixes all accessibility violations according to Axe Core
|
6
|
+
- Reduces responsibility of Tabs to only be a tablist, no tab panels
|
7
|
+
- Fixes passing ID to popovers, dropdowns, drawers, etc to not override the
|
8
|
+
input ID
|
9
|
+
- Changes trigger on popover to be a button instead of a div
|
10
|
+
|
3
11
|
## [0.4.3] - 2024-08-14
|
4
12
|
|
5
13
|
- Removes unneeded auto-loading in Rails which fixes collisions with `protos-markdown`
|
@@ -5,16 +5,16 @@ module Protos
|
|
5
5
|
class Item < Component
|
6
6
|
# DOCS: An accorion is just a collapse with radio buttons.
|
7
7
|
|
8
|
-
option :
|
8
|
+
option :input_id, type: Types::String | Types::Integer
|
9
9
|
|
10
10
|
def view_template(&block)
|
11
11
|
li(**attrs) do
|
12
|
-
render Collapse.new(
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
render Collapse.new(
|
13
|
+
theme: collapse_theme,
|
14
|
+
input_id: @input_id.to_s,
|
15
|
+
input_type: :radio,
|
16
|
+
&block
|
17
|
+
)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
data/lib/protos/accordion.rb
CHANGED
@@ -7,20 +7,30 @@ module Protos
|
|
7
7
|
# to be open at the same time, use the collapse component.
|
8
8
|
# https://daisyui.com/components/accordion/
|
9
9
|
|
10
|
-
option :id, default: -> { "collapse-#{SecureRandom.hex(4)}" }
|
11
|
-
|
12
10
|
def view_template(&)
|
13
11
|
ul(**attrs, &)
|
14
12
|
end
|
15
13
|
|
16
|
-
def item(*,
|
14
|
+
def item(*, input_id: nil, **, &)
|
15
|
+
self.current_input_id = input_id
|
16
|
+
|
17
|
+
render Item.new(*, input_id: current_input_id, **, &)
|
18
|
+
end
|
17
19
|
|
18
20
|
def content(...) = render Collapse::Content.new(...)
|
19
21
|
|
20
|
-
def title(*, **, &)
|
22
|
+
def title(*, **, &)
|
23
|
+
render Collapse::Title.new(*, input_id: current_input_id, **, &)
|
24
|
+
end
|
21
25
|
|
22
26
|
private
|
23
27
|
|
28
|
+
attr_reader :current_input_id
|
29
|
+
|
30
|
+
def current_input_id=(value)
|
31
|
+
@current_input_id = value || "collapse-#{SecureRandom.hex(4)}"
|
32
|
+
end
|
33
|
+
|
24
34
|
def theme
|
25
35
|
{
|
26
36
|
container: "join join-vertical"
|
data/lib/protos/alert/actions.rb
CHANGED
data/lib/protos/breadcrumbs.rb
CHANGED
@@ -5,14 +5,15 @@ module Protos
|
|
5
5
|
class Title < Component
|
6
6
|
# DOCS: The title of a collapse. This is the content that is always
|
7
7
|
# visible and is used to toggle the collapse.
|
8
|
-
|
9
|
-
|
8
|
+
|
9
|
+
option :input_id,
|
10
|
+
type: Types::String | Types::Integer | Types::Nil,
|
10
11
|
reader: false,
|
11
|
-
default: -> {
|
12
|
+
default: -> { }
|
12
13
|
|
13
14
|
def view_template(&)
|
14
|
-
if @
|
15
|
-
label(for: @
|
15
|
+
if @input_id
|
16
|
+
label(for: @input_id.to_s, **attrs, &)
|
16
17
|
else
|
17
18
|
div(**attrs, &)
|
18
19
|
end
|
data/lib/protos/collapse.rb
CHANGED
@@ -6,19 +6,30 @@ module Protos
|
|
6
6
|
# is visible at all times, and the content is only visible when expanded.
|
7
7
|
# https://daisyui.com/components/collapse/
|
8
8
|
|
9
|
-
option :
|
10
|
-
option :
|
9
|
+
option :input_type, default: -> { :checkbox }, reader: false
|
10
|
+
option :input_id,
|
11
|
+
reader: false,
|
11
12
|
default: -> { "collapse-#{SecureRandom.hex(4)}" },
|
12
13
|
type: Types::String
|
13
14
|
|
14
15
|
def view_template
|
15
16
|
div(**attrs) do
|
16
|
-
|
17
|
+
if @input_type
|
18
|
+
input(
|
19
|
+
type: @input_type,
|
20
|
+
id: @input_id,
|
21
|
+
name: @input_id,
|
22
|
+
autocomplete: :off,
|
23
|
+
# form: "" prevents the radio button from being submitted if its
|
24
|
+
# within a form
|
25
|
+
form: ""
|
26
|
+
)
|
27
|
+
end
|
17
28
|
yield if block_given?
|
18
29
|
end
|
19
30
|
end
|
20
31
|
|
21
|
-
def title(*, **, &) = render Title.new(*,
|
32
|
+
def title(*, **, &) = render Title.new(*, input_id: @input_id, **, &)
|
22
33
|
|
23
34
|
def content(...) = render Content.new(...)
|
24
35
|
|
data/lib/protos/command/input.rb
CHANGED
data/lib/protos/command/title.rb
CHANGED
data/lib/protos/drawer/side.rb
CHANGED
@@ -6,11 +6,15 @@ module Protos
|
|
6
6
|
# DOCS: The content that will be shown when you open the drawer using the
|
7
7
|
# trigger. This would be hidden until triggered.
|
8
8
|
|
9
|
-
option :
|
9
|
+
option :input_id, reader: false, type: Types::String
|
10
10
|
|
11
11
|
def view_template
|
12
12
|
aside(**attrs) do
|
13
|
-
label(
|
13
|
+
label(
|
14
|
+
for: @input_id,
|
15
|
+
aria_label: "close sidebar",
|
16
|
+
class: css[:toggle]
|
17
|
+
)
|
14
18
|
yield if block_given?
|
15
19
|
end
|
16
20
|
end
|
@@ -6,10 +6,10 @@ module Protos
|
|
6
6
|
# DOCS: The trigger for a drawer. When this is clicked the side will open
|
7
7
|
# and overlap the main content with a darker overlay.
|
8
8
|
|
9
|
-
option :
|
9
|
+
option :input_id, reader: false, type: Types::String
|
10
10
|
|
11
11
|
def view_template(&)
|
12
|
-
label(for:
|
12
|
+
label(for: @input_id, **attrs, &)
|
13
13
|
end
|
14
14
|
|
15
15
|
private
|
data/lib/protos/drawer.rb
CHANGED
@@ -7,20 +7,29 @@ module Protos
|
|
7
7
|
# trigger is clicked.
|
8
8
|
# https://daisyui.com/components/drawer/
|
9
9
|
|
10
|
-
option :id,
|
10
|
+
option :id,
|
11
|
+
reader: false,
|
12
|
+
type: Types::Coercible::String,
|
13
|
+
default: -> { "drawer-#{SecureRandom.hex(4)}" }
|
11
14
|
|
12
15
|
def view_template
|
13
16
|
div(**attrs) do
|
14
|
-
input(
|
17
|
+
input(
|
18
|
+
id: @id,
|
19
|
+
type: :checkbox,
|
20
|
+
class: css[:toggle],
|
21
|
+
autocomplete: :off,
|
22
|
+
form: ""
|
23
|
+
)
|
15
24
|
yield if block_given?
|
16
25
|
end
|
17
26
|
end
|
18
27
|
|
19
28
|
def content(...) = render Content.new(...)
|
20
29
|
|
21
|
-
def side(*, **, &) = render Side.new(*, id
|
30
|
+
def side(*, **, &) = render Side.new(*, input_id: @id, **, &)
|
22
31
|
|
23
|
-
def trigger(*, **, &) = render Trigger.new(*, id
|
32
|
+
def trigger(*, **, &) = render Trigger.new(*, input_id: @id, **, &)
|
24
33
|
|
25
34
|
private
|
26
35
|
|
@@ -7,7 +7,7 @@ module Protos
|
|
7
7
|
# or click on to show the popover.
|
8
8
|
|
9
9
|
def view_template(&)
|
10
|
-
|
10
|
+
button(**attrs, &)
|
11
11
|
end
|
12
12
|
|
13
13
|
private
|
@@ -15,7 +15,8 @@ module Protos
|
|
15
15
|
def default_attrs
|
16
16
|
{
|
17
17
|
data: { "protos--popover-target": "trigger" },
|
18
|
-
tabindex: 0
|
18
|
+
tabindex: 0,
|
19
|
+
type: :button
|
19
20
|
}
|
20
21
|
end
|
21
22
|
end
|
data/lib/protos/swap.rb
CHANGED
@@ -8,7 +8,13 @@ module Protos
|
|
8
8
|
|
9
9
|
def view_template
|
10
10
|
label(**attrs) do
|
11
|
-
input(
|
11
|
+
input(
|
12
|
+
type: :checkbox,
|
13
|
+
class: css[:input],
|
14
|
+
autocomplete: :off,
|
15
|
+
form: "",
|
16
|
+
aria_label: "swap"
|
17
|
+
)
|
12
18
|
yield if block_given?
|
13
19
|
end
|
14
20
|
end
|
data/lib/protos/tabs/tab.rb
CHANGED
@@ -5,35 +5,24 @@ module Protos
|
|
5
5
|
class Tab < Component
|
6
6
|
# DOCS: A single tab in a tabs component
|
7
7
|
|
8
|
-
option :id
|
9
|
-
option :label
|
10
8
|
option :active, default: -> { false }
|
11
9
|
option :disabled, default: -> { false }
|
12
10
|
|
13
11
|
def view_template(&)
|
14
|
-
|
15
|
-
type: :radio,
|
16
|
-
class: css[:input],
|
17
|
-
name: id,
|
18
|
-
role: :tab,
|
19
|
-
aria_label: label,
|
20
|
-
autocomplete: :off
|
21
|
-
)
|
22
|
-
div(**attrs, &)
|
12
|
+
button(**attrs, disabled:, &)
|
23
13
|
end
|
24
14
|
|
25
15
|
private
|
26
16
|
|
27
17
|
def default_attrs
|
28
18
|
{
|
29
|
-
role: :
|
19
|
+
role: :tab
|
30
20
|
}
|
31
21
|
end
|
32
22
|
|
33
23
|
def theme
|
34
24
|
{
|
35
|
-
container:
|
36
|
-
input: tokens(
|
25
|
+
container: tokens(
|
37
26
|
"tab",
|
38
27
|
disabled: "tab-disabled",
|
39
28
|
active: "tab-active"
|
data/lib/protos/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nolan J Tait
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-core
|
@@ -220,7 +220,7 @@ requirements:
|
|
220
220
|
- tailwindcss
|
221
221
|
- daisyui
|
222
222
|
- protos-stimulus
|
223
|
-
rubygems_version: 3.5.
|
223
|
+
rubygems_version: 3.5.18
|
224
224
|
signing_key:
|
225
225
|
specification_version: 4
|
226
226
|
summary: A UI component library built with phlex and daisyui
|