protos 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +262 -70
- data/examples/list.rb +34 -0
- data/lib/protos/accordion/item.rb +6 -4
- data/lib/protos/accordion.rb +5 -0
- data/lib/protos/alert/actions.rb +2 -0
- data/lib/protos/alert/icon.rb +3 -0
- data/lib/protos/alert.rb +4 -0
- data/lib/protos/attributes.rb +8 -0
- data/lib/protos/avatar.rb +3 -0
- data/lib/protos/breadcrumbs/crumb.rb +2 -0
- data/lib/protos/breadcrumbs.rb +3 -0
- data/lib/protos/card/actions.rb +2 -0
- data/lib/protos/card/body.rb +2 -0
- data/lib/protos/card/image.rb +4 -0
- data/lib/protos/card/title.rb +2 -0
- data/lib/protos/card.rb +3 -0
- data/lib/protos/carousel/actions.rb +2 -0
- data/lib/protos/carousel/item.rb +2 -0
- data/lib/protos/carousel.rb +4 -0
- data/lib/protos/chat_bubble/content.rb +3 -0
- data/lib/protos/chat_bubble/footer.rb +2 -0
- data/lib/protos/chat_bubble/header.rb +3 -0
- data/lib/protos/chat_bubble/image.rb +3 -0
- data/lib/protos/chat_bubble.rb +5 -0
- data/lib/protos/collapse/content.rb +3 -0
- data/lib/protos/collapse/title.rb +3 -0
- data/lib/protos/collapse.rb +4 -0
- data/lib/protos/combobox.rb +5 -1
- data/lib/protos/command/dialog.rb +9 -1
- data/lib/protos/command/empty.rb +3 -0
- data/lib/protos/command/group.rb +4 -0
- data/lib/protos/command/input.rb +2 -0
- data/lib/protos/command/item.rb +2 -0
- data/lib/protos/command/list.rb +8 -0
- data/lib/protos/command/title.rb +3 -0
- data/lib/protos/command/trigger.rb +2 -0
- data/lib/protos/command.rb +5 -1
- data/lib/protos/component.rb +21 -9
- data/lib/protos/drawer/content.rb +3 -0
- data/lib/protos/drawer/side.rb +8 -1
- data/lib/protos/drawer/trigger.rb +3 -0
- data/lib/protos/drawer.rb +6 -1
- data/lib/protos/dropdown/item.rb +2 -0
- data/lib/protos/dropdown/menu.rb +4 -0
- data/lib/protos/dropdown/trigger.rb +2 -0
- data/lib/protos/dropdown.rb +8 -0
- data/lib/protos/engine.rb +3 -0
- data/lib/protos/hero/content.rb +3 -0
- data/lib/protos/hero/overlay.rb +4 -0
- data/lib/protos/hero.rb +4 -0
- data/lib/protos/list/item.rb +4 -0
- data/lib/protos/list.rb +3 -0
- data/lib/protos/modal/close_button.rb +2 -0
- data/lib/protos/modal/dialog.rb +9 -1
- data/lib/protos/modal/trigger.rb +2 -0
- data/lib/protos/modal.rb +3 -0
- data/lib/protos/popover/content.rb +5 -0
- data/lib/protos/popover/trigger.rb +3 -0
- data/lib/protos/popover.rb +8 -1
- data/lib/protos/stats/actions.rb +2 -0
- data/lib/protos/stats/description.rb +2 -0
- data/lib/protos/stats/figure.rb +2 -0
- data/lib/protos/stats/stat.rb +2 -0
- data/lib/protos/stats/title.rb +2 -0
- data/lib/protos/stats/value.rb +2 -0
- data/lib/protos/stats.rb +3 -0
- data/lib/protos/swap/off.rb +2 -0
- data/lib/protos/swap/on.rb +2 -0
- data/lib/protos/swap.rb +7 -2
- data/lib/protos/table/body.rb +2 -0
- data/lib/protos/table/caption.rb +2 -0
- data/lib/protos/table/cell.rb +2 -0
- data/lib/protos/table/footer.rb +2 -0
- data/lib/protos/table/head.rb +2 -0
- data/lib/protos/table/header.rb +3 -0
- data/lib/protos/table/row.rb +2 -0
- data/lib/protos/table.rb +32 -1
- data/lib/protos/tabs/tab.rb +2 -0
- data/lib/protos/tabs.rb +3 -0
- data/lib/protos/theme.rb +5 -0
- data/lib/protos/timeline/center.rb +3 -0
- data/lib/protos/timeline/item.rb +4 -0
- data/lib/protos/timeline/left.rb +3 -0
- data/lib/protos/timeline/right.rb +3 -0
- data/lib/protos/timeline.rb +3 -0
- data/lib/protos/toast/close_button.rb +2 -0
- data/lib/protos/toast.rb +32 -8
- data/lib/protos/token_list.rb +7 -1
- data/lib/protos/typography/heading.rb +3 -0
- data/lib/protos/typography/inline_link.rb +2 -0
- data/lib/protos/typography/paragraph.rb +2 -0
- data/lib/protos/typography.rb +3 -0
- data/lib/protos/version.rb +1 -1
- metadata +3 -2
data/lib/protos/swap.rb
CHANGED
@@ -2,9 +2,13 @@
|
|
2
2
|
|
3
3
|
module Protos
|
4
4
|
class Swap < Component
|
5
|
+
# DOCS: The swap component is a checkbox that can be toggled on and off to
|
6
|
+
# display different content.
|
7
|
+
# https://daisyui.com/components/swap/
|
8
|
+
|
5
9
|
def template
|
6
10
|
label(**attrs) do
|
7
|
-
input(type: :checkbox)
|
11
|
+
input(type: :checkbox, class: css[:input])
|
8
12
|
yield if block_given?
|
9
13
|
end
|
10
14
|
end
|
@@ -21,7 +25,8 @@ module Protos
|
|
21
25
|
|
22
26
|
def theme
|
23
27
|
{
|
24
|
-
container: tokens("swap")
|
28
|
+
container: tokens("swap"),
|
29
|
+
input: tokens("hidden")
|
25
30
|
}
|
26
31
|
end
|
27
32
|
end
|
data/lib/protos/table/body.rb
CHANGED
data/lib/protos/table/caption.rb
CHANGED
data/lib/protos/table/cell.rb
CHANGED
data/lib/protos/table/footer.rb
CHANGED
data/lib/protos/table/head.rb
CHANGED
data/lib/protos/table/header.rb
CHANGED
data/lib/protos/table/row.rb
CHANGED
data/lib/protos/table.rb
CHANGED
@@ -2,6 +2,22 @@
|
|
2
2
|
|
3
3
|
module Protos
|
4
4
|
class Table < Component
|
5
|
+
# DOCS: A table component
|
6
|
+
# https://daisyui.com/components/table/
|
7
|
+
|
8
|
+
option :pin_rows, default: -> { false }, type: Types::Bool
|
9
|
+
option :pin_columns, default: -> { false }, type: Types::Bool
|
10
|
+
option :striped, default: -> { false }, type: Types::Bool
|
11
|
+
option :size,
|
12
|
+
default: -> { :md },
|
13
|
+
reader: false,
|
14
|
+
type: Types::Coercible::Symbol.enum(
|
15
|
+
:xs,
|
16
|
+
:sm,
|
17
|
+
:md,
|
18
|
+
:lg
|
19
|
+
)
|
20
|
+
|
5
21
|
def template(&block)
|
6
22
|
div(**attrs) do
|
7
23
|
table(class: css[:table], &block)
|
@@ -38,10 +54,25 @@ module Protos
|
|
38
54
|
|
39
55
|
private
|
40
56
|
|
57
|
+
def size
|
58
|
+
{
|
59
|
+
xs: "table-xs",
|
60
|
+
sm: "table-sm",
|
61
|
+
md: "table-md",
|
62
|
+
lg: "table-lg"
|
63
|
+
}.fetch(@size)
|
64
|
+
end
|
65
|
+
|
41
66
|
def theme
|
42
67
|
{
|
43
68
|
container: tokens("w-full", "overflow-x-auto"),
|
44
|
-
table: tokens(
|
69
|
+
table: tokens(
|
70
|
+
"table",
|
71
|
+
size,
|
72
|
+
pin_rows: "table-pin-rows",
|
73
|
+
pin_columns: "table-pin-columns",
|
74
|
+
striped: "table-striped"
|
75
|
+
)
|
45
76
|
}
|
46
77
|
end
|
47
78
|
end
|
data/lib/protos/tabs/tab.rb
CHANGED
data/lib/protos/tabs.rb
CHANGED
data/lib/protos/theme.rb
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
module Protos
|
4
4
|
class Theme
|
5
|
+
# DOCS: A class that holds data for a theme. This class is used to safely
|
6
|
+
# merge in user supplied css classes into a default theme.
|
7
|
+
# This is the object that is returned by `css` and used to set slots for
|
8
|
+
# a component style.
|
9
|
+
|
5
10
|
def initialize(theme = {}, **kwargs)
|
6
11
|
@theme = theme.merge(kwargs)
|
7
12
|
end
|
data/lib/protos/timeline/item.rb
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
module Protos
|
4
4
|
class Timeline
|
5
5
|
class Item < Component
|
6
|
+
# DOCS: The item of a timeline. Usually containing a center, left and
|
7
|
+
# right and depending on its position in the list, an hr at the beginning
|
8
|
+
# or end.
|
9
|
+
|
6
10
|
def template(&block)
|
7
11
|
li(**attrs, &block)
|
8
12
|
end
|
data/lib/protos/timeline/left.rb
CHANGED
data/lib/protos/timeline.rb
CHANGED
data/lib/protos/toast.rb
CHANGED
@@ -2,16 +2,26 @@
|
|
2
2
|
|
3
3
|
module Protos
|
4
4
|
class Toast < Component
|
5
|
+
# DOCS: A toast component that can be used to display messages to the user
|
6
|
+
# that popup at a fixed position on the screen.
|
7
|
+
# https://daisyui.com/components/toast/
|
8
|
+
|
5
9
|
Positions = Types::Symbol.enum(
|
6
|
-
:
|
7
|
-
:
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
11
|
-
:
|
10
|
+
:top_start,
|
11
|
+
:top_center,
|
12
|
+
:top_end,
|
13
|
+
:middle_start,
|
14
|
+
:middle_center,
|
15
|
+
:middle_end,
|
16
|
+
:bottom_start,
|
17
|
+
:bottom_center,
|
18
|
+
:bottom_end
|
12
19
|
)
|
13
20
|
|
14
|
-
option :position,
|
21
|
+
option :position,
|
22
|
+
type: Positions,
|
23
|
+
default: -> { :bottom_end },
|
24
|
+
reader: false
|
15
25
|
|
16
26
|
def template(&block)
|
17
27
|
dialog(**attrs, &block)
|
@@ -29,11 +39,25 @@ module Protos
|
|
29
39
|
}
|
30
40
|
end
|
31
41
|
|
42
|
+
def position
|
43
|
+
{
|
44
|
+
top_start: "toast-start toast-top",
|
45
|
+
top_center: "toast-center toast-top",
|
46
|
+
top_end: "toast-end toast-top",
|
47
|
+
middle_start: "toast-start toast-middle",
|
48
|
+
middle_center: "toast-center toast-middle",
|
49
|
+
middle_end: "toast-end toast-middle",
|
50
|
+
bottom_start: "toast-start toast-bottom",
|
51
|
+
bottom_center: "toast-center toast-bottom",
|
52
|
+
bottom_end: "toast-end toast-bottom"
|
53
|
+
}.fetch(@position)
|
54
|
+
end
|
55
|
+
|
32
56
|
def theme
|
33
57
|
{
|
34
58
|
container: tokens(
|
35
59
|
"toast",
|
36
|
-
|
60
|
+
position,
|
37
61
|
"[&:not([open])]:hidden",
|
38
62
|
"bg-transparent"
|
39
63
|
)
|
data/lib/protos/token_list.rb
CHANGED
@@ -2,12 +2,18 @@
|
|
2
2
|
|
3
3
|
module Protos
|
4
4
|
class TokenList
|
5
|
+
# DOCS: A list of utility tokens that can handle parsing and merging sets of
|
6
|
+
# tokens together safely. It uses TailwindMerge to merge the tokens together
|
7
|
+
# while accounting for their conflicts.
|
8
|
+
|
5
9
|
def self.parse(input)
|
6
10
|
case input
|
7
11
|
when String then new(input.split)
|
8
12
|
when Array then new(input)
|
9
13
|
when TokenList then input
|
10
|
-
|
14
|
+
when NilClass then new
|
15
|
+
else raise ArgumentError,
|
16
|
+
"Invalid input for #{self.class.name}: #{input.inspect}"
|
11
17
|
end
|
12
18
|
end
|
13
19
|
|
@@ -3,6 +3,9 @@
|
|
3
3
|
module Protos
|
4
4
|
module Typography
|
5
5
|
class Heading < Protos::Component
|
6
|
+
# DOCS: A heading component that encapsulates all heading levels by their
|
7
|
+
# size and level.
|
8
|
+
|
6
9
|
SizeTypes = Types::Coercible::Symbol.enum(:xs, :sm, :md, :lg, :xl)
|
7
10
|
LevelTypes = Types::Integer.enum(1, 2, 3, 4, 5, 6)
|
8
11
|
|
data/lib/protos/typography.rb
CHANGED
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.2.
|
4
|
+
version: 0.2.2
|
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-03-
|
11
|
+
date: 2024-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-core
|
@@ -93,6 +93,7 @@ files:
|
|
93
93
|
- LICENSE.txt
|
94
94
|
- README.md
|
95
95
|
- Rakefile
|
96
|
+
- examples/list.rb
|
96
97
|
- examples/navbar.rb
|
97
98
|
- lib/protos.rb
|
98
99
|
- lib/protos/accordion.rb
|