protos 0.5.0 → 0.7.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 +20 -0
- data/README.md +189 -76
- data/examples/list.rb +2 -2
- data/examples/navbar.rb +3 -8
- data/lib/protos/accordion/item.rb +4 -2
- data/lib/protos/accordion.rb +10 -11
- data/lib/protos/alert.rb +3 -0
- data/lib/protos/attributes.rb +1 -18
- data/lib/protos/avatar.rb +10 -10
- data/lib/protos/badge.rb +62 -0
- data/lib/protos/breadcrumbs.rb +2 -0
- data/lib/protos/card.rb +12 -7
- data/lib/protos/carousel.rb +13 -10
- data/lib/protos/chat_bubble/content.rb +12 -12
- data/lib/protos/chat_bubble.rb +11 -6
- data/lib/protos/collapse/title.rb +3 -3
- data/lib/protos/collapse.rb +10 -7
- data/lib/protos/combobox.rb +3 -3
- data/lib/protos/command/input.rb +4 -4
- data/lib/protos/command.rb +16 -2
- data/lib/protos/component.rb +3 -3
- data/lib/protos/drawer.rb +7 -3
- data/lib/protos/dropdown.rb +10 -6
- data/lib/protos/hero.rb +3 -0
- data/lib/protos/list.rb +2 -0
- data/lib/protos/mix.rb +39 -0
- data/lib/protos/modal/close_button.rb +8 -0
- data/lib/protos/modal/dialog.rb +4 -6
- data/lib/protos/modal.rb +6 -1
- data/lib/protos/popover.rb +24 -21
- data/lib/protos/stats.rb +7 -0
- data/lib/protos/steps.rb +5 -3
- data/lib/protos/swap.rb +3 -0
- data/lib/protos/table/caption.rb +3 -3
- data/lib/protos/table/cell.rb +3 -3
- data/lib/protos/table/head.rb +3 -3
- data/lib/protos/table.rb +21 -13
- data/lib/protos/tabs/tab.rb +4 -4
- data/lib/protos/tabs.rb +18 -16
- data/lib/protos/theme.rb +8 -7
- data/lib/protos/timeline.rb +8 -3
- data/lib/protos/toast.rb +5 -3
- data/lib/protos/typography/paragraph.rb +3 -3
- data/lib/protos/typography.rb +4 -0
- data/lib/protos/version.rb +1 -1
- data/lib/protos.rb +37 -120
- metadata +5 -7
- data/lib/protos/command/dialog.rb +0 -40
data/lib/protos/table/cell.rb
CHANGED
@@ -12,9 +12,9 @@ module Protos
|
|
12
12
|
}.freeze
|
13
13
|
|
14
14
|
option :align,
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
type: Types::Coercible::Symbol.enum(:left, :center, :right),
|
16
|
+
reader: false,
|
17
|
+
default: -> { :left }
|
18
18
|
|
19
19
|
def view_template(&)
|
20
20
|
td(**attrs, &)
|
data/lib/protos/table/head.rb
CHANGED
@@ -12,9 +12,9 @@ module Protos
|
|
12
12
|
}.freeze
|
13
13
|
|
14
14
|
option :align,
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
type: Types::Coercible::Symbol.enum(:left, :center, :right),
|
16
|
+
reader: false,
|
17
|
+
default: -> { :left }
|
18
18
|
|
19
19
|
def view_template(&)
|
20
20
|
th(**attrs, &)
|
data/lib/protos/table.rb
CHANGED
@@ -5,6 +5,14 @@ module Protos
|
|
5
5
|
# DOCS: A table component
|
6
6
|
# https://daisyui.com/components/table/
|
7
7
|
|
8
|
+
autoload :Caption, "protos/table/caption"
|
9
|
+
autoload :Header, "protos/table/header"
|
10
|
+
autoload :Head, "protos/table/head"
|
11
|
+
autoload :Body, "protos/table/body"
|
12
|
+
autoload :Footer, "protos/table/footer"
|
13
|
+
autoload :Row, "protos/table/row"
|
14
|
+
autoload :Cell, "protos/table/cell"
|
15
|
+
|
8
16
|
SIZES = {
|
9
17
|
xs: "table-xs",
|
10
18
|
sm: "table-sm",
|
@@ -16,14 +24,14 @@ module Protos
|
|
16
24
|
option :pin_columns, default: -> { false }, type: Types::Bool
|
17
25
|
option :striped, default: -> { false }, type: Types::Bool
|
18
26
|
option :size,
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
+
default: -> { :md },
|
28
|
+
reader: false,
|
29
|
+
type: Types::Coercible::Symbol.enum(
|
30
|
+
:xs,
|
31
|
+
:sm,
|
32
|
+
:md,
|
33
|
+
:lg
|
34
|
+
)
|
27
35
|
|
28
36
|
def view_template(&block)
|
29
37
|
div(**attrs) do
|
@@ -54,13 +62,13 @@ module Protos
|
|
54
62
|
def theme
|
55
63
|
{
|
56
64
|
container: "w-full overflow-x-auto",
|
57
|
-
table:
|
65
|
+
table: [
|
58
66
|
"table",
|
59
67
|
size,
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
68
|
+
("table-pin-rows" if pin_rows),
|
69
|
+
("table-pin-columns" if pin_columns),
|
70
|
+
("table-striped" if striped)
|
71
|
+
]
|
64
72
|
}
|
65
73
|
end
|
66
74
|
end
|
data/lib/protos/tabs/tab.rb
CHANGED
data/lib/protos/tabs.rb
CHANGED
@@ -5,6 +5,8 @@ module Protos
|
|
5
5
|
# DOCS: A component that contains many Protos::Tab components
|
6
6
|
# https://daisyui.com/components/tab/
|
7
7
|
|
8
|
+
autoload :Tab, "protos/tabs/tab"
|
9
|
+
|
8
10
|
SIZES = {
|
9
11
|
xs: "tabs-xs",
|
10
12
|
sm: "tabs-sm",
|
@@ -13,23 +15,23 @@ module Protos
|
|
13
15
|
}.freeze
|
14
16
|
|
15
17
|
option :type,
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
default: -> { :default },
|
19
|
+
reader: false,
|
20
|
+
type: Types::Coercible::Symbol.enum(
|
21
|
+
:default,
|
22
|
+
:boxed,
|
23
|
+
:bordered,
|
24
|
+
:lifted
|
25
|
+
)
|
24
26
|
option :size,
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
default: -> { :md },
|
28
|
+
reader: false,
|
29
|
+
type: Types::Coercible::Symbol.enum(
|
30
|
+
:xs,
|
31
|
+
:sm,
|
32
|
+
:md,
|
33
|
+
:lg
|
34
|
+
)
|
33
35
|
|
34
36
|
def view_template(&)
|
35
37
|
div(**attrs, &)
|
data/lib/protos/theme.rb
CHANGED
@@ -9,7 +9,7 @@ module Protos
|
|
9
9
|
|
10
10
|
class << self
|
11
11
|
def merger
|
12
|
-
@merger ||= TailwindMerge::Merger.new
|
12
|
+
@merger ||= TailwindMerge::Merger.new.freeze
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -25,14 +25,15 @@ module Protos
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
def [](
|
29
|
-
|
28
|
+
def [](*keys)
|
29
|
+
symbols, strings = keys.partition { |key| key.is_a?(Symbol) }
|
30
|
+
values = @theme.values_at(*symbols).join(" ")
|
31
|
+
values += " #{strings.join(" ")}" unless strings.empty?
|
30
32
|
|
31
|
-
|
32
|
-
return
|
33
|
-
return value unless @tailwind_merge
|
33
|
+
return nil if values.empty?
|
34
|
+
return values unless @tailwind_merge
|
34
35
|
|
35
|
-
self.class.merger.merge(
|
36
|
+
self.class.merger.merge(values)
|
36
37
|
end
|
37
38
|
|
38
39
|
def key?(key)
|
data/lib/protos/timeline.rb
CHANGED
@@ -5,6 +5,11 @@ module Protos
|
|
5
5
|
# DOCS: A timeline component
|
6
6
|
# https://daisyui.com/components/timeline/
|
7
7
|
|
8
|
+
autoload :Item, "protos/timeline/item"
|
9
|
+
autoload :Left, "protos/timeline/left"
|
10
|
+
autoload :Center, "protos/timeline/center"
|
11
|
+
autoload :Right, "protos/timeline/right"
|
12
|
+
|
8
13
|
option :vertical, type: Types::Bool, default: -> { false }
|
9
14
|
|
10
15
|
def view_template(&)
|
@@ -23,10 +28,10 @@ module Protos
|
|
23
28
|
|
24
29
|
def theme
|
25
30
|
{
|
26
|
-
container:
|
31
|
+
container: [
|
27
32
|
"timeline",
|
28
|
-
|
29
|
-
|
33
|
+
("timeline-vertical" if vertical)
|
34
|
+
]
|
30
35
|
}
|
31
36
|
end
|
32
37
|
end
|
data/lib/protos/toast.rb
CHANGED
@@ -6,6 +6,8 @@ module Protos
|
|
6
6
|
# that popup at a fixed position on the screen.
|
7
7
|
# https://daisyui.com/components/toast/
|
8
8
|
|
9
|
+
autoload :CloseButton, "protos/toast/close_button"
|
10
|
+
|
9
11
|
Positions = Types::Symbol.enum(
|
10
12
|
:top_start,
|
11
13
|
:top_center,
|
@@ -31,9 +33,9 @@ module Protos
|
|
31
33
|
}.freeze
|
32
34
|
|
33
35
|
option :position,
|
34
|
-
|
35
|
-
|
36
|
-
|
36
|
+
type: Positions,
|
37
|
+
default: -> { :bottom_end },
|
38
|
+
reader: false
|
37
39
|
|
38
40
|
def view_template(&)
|
39
41
|
dialog(**attrs, &)
|
data/lib/protos/typography.rb
CHANGED
@@ -5,6 +5,10 @@ module Protos
|
|
5
5
|
# DOCS: The core typography module that can be mixedin to override the
|
6
6
|
# default elements with custom elements.
|
7
7
|
|
8
|
+
autoload :Heading, "protos/typography/heading"
|
9
|
+
autoload :Paragraph, "protos/typography/paragraph"
|
10
|
+
autoload :InlineLink, "protos/typography/inline_link"
|
11
|
+
|
8
12
|
def h1(**, &)
|
9
13
|
render Heading.new(level: 1, size: :xl, **, &)
|
10
14
|
end
|
data/lib/protos/version.rb
CHANGED
data/lib/protos.rb
CHANGED
@@ -8,126 +8,43 @@ require "tailwind_merge"
|
|
8
8
|
|
9
9
|
module Protos
|
10
10
|
class Error < StandardError; end
|
11
|
-
end
|
12
|
-
|
13
|
-
require_relative "protos/version"
|
14
|
-
require_relative "protos/types"
|
15
|
-
require_relative "protos/token_list"
|
16
|
-
require_relative "protos/component"
|
17
|
-
require_relative "protos/theme"
|
18
|
-
require_relative "protos/attributes"
|
19
|
-
|
20
|
-
# Components
|
21
|
-
require_relative "protos/accordion"
|
22
|
-
require_relative "protos/accordion/item"
|
23
|
-
|
24
|
-
require_relative "protos/alert"
|
25
|
-
require_relative "protos/alert/actions"
|
26
|
-
require_relative "protos/alert/icon"
|
27
|
-
|
28
|
-
require_relative "protos/avatar"
|
29
|
-
|
30
|
-
require_relative "protos/breadcrumbs"
|
31
|
-
require_relative "protos/breadcrumbs/crumb"
|
32
|
-
|
33
|
-
require_relative "protos/card"
|
34
|
-
require_relative "protos/card/body"
|
35
|
-
require_relative "protos/card/title"
|
36
|
-
require_relative "protos/card/actions"
|
37
|
-
require_relative "protos/card/image"
|
38
|
-
|
39
|
-
require_relative "protos/carousel"
|
40
|
-
require_relative "protos/carousel/item"
|
41
|
-
require_relative "protos/carousel/actions"
|
42
|
-
|
43
|
-
require_relative "protos/chat_bubble"
|
44
|
-
require_relative "protos/chat_bubble/content"
|
45
|
-
require_relative "protos/chat_bubble/image"
|
46
|
-
require_relative "protos/chat_bubble/header"
|
47
|
-
require_relative "protos/chat_bubble/footer"
|
48
|
-
|
49
|
-
require_relative "protos/collapse"
|
50
|
-
require_relative "protos/collapse/title"
|
51
|
-
require_relative "protos/collapse/content"
|
52
|
-
|
53
|
-
require_relative "protos/command"
|
54
|
-
require_relative "protos/command/input"
|
55
|
-
require_relative "protos/command/dialog"
|
56
|
-
require_relative "protos/command/group"
|
57
|
-
require_relative "protos/command/list"
|
58
|
-
require_relative "protos/command/trigger"
|
59
|
-
require_relative "protos/command/title"
|
60
|
-
require_relative "protos/command/item"
|
61
|
-
require_relative "protos/command/empty"
|
62
|
-
|
63
|
-
require_relative "protos/drawer"
|
64
|
-
require_relative "protos/drawer/side"
|
65
|
-
require_relative "protos/drawer/trigger"
|
66
|
-
require_relative "protos/drawer/content"
|
67
|
-
|
68
|
-
require_relative "protos/hero"
|
69
|
-
require_relative "protos/hero/content"
|
70
|
-
require_relative "protos/hero/overlay"
|
71
11
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
require_relative "protos/table/cell"
|
110
|
-
|
111
|
-
require_relative "protos/toast"
|
112
|
-
require_relative "protos/toast/close_button"
|
113
|
-
|
114
|
-
require_relative "protos/timeline"
|
115
|
-
require_relative "protos/timeline/item"
|
116
|
-
require_relative "protos/timeline/left"
|
117
|
-
require_relative "protos/timeline/center"
|
118
|
-
require_relative "protos/timeline/right"
|
119
|
-
|
120
|
-
require_relative "protos/typography"
|
121
|
-
require_relative "protos/typography/heading"
|
122
|
-
require_relative "protos/typography/paragraph"
|
123
|
-
require_relative "protos/typography/inline_link"
|
124
|
-
|
125
|
-
# Dependent
|
126
|
-
require_relative "protos/dropdown"
|
127
|
-
require_relative "protos/dropdown/item"
|
128
|
-
require_relative "protos/dropdown/menu"
|
129
|
-
require_relative "protos/dropdown/trigger"
|
130
|
-
|
131
|
-
require_relative "protos/combobox"
|
12
|
+
autoload :Version, "protos/version"
|
13
|
+
autoload :Types, "protos/types"
|
14
|
+
autoload :TokenList, "protos/token_list"
|
15
|
+
autoload :Component, "protos/component"
|
16
|
+
autoload :Theme, "protos/theme"
|
17
|
+
autoload :Mix, "protos/mix"
|
18
|
+
autoload :Attributes, "protos/attributes"
|
19
|
+
|
20
|
+
# Components
|
21
|
+
autoload :Accordion, "protos/accordion"
|
22
|
+
autoload :Alert, "protos/alert"
|
23
|
+
autoload :Avatar, "protos/avatar"
|
24
|
+
autoload :Badge, "protos/badge"
|
25
|
+
autoload :Breadcrumbs, "protos/breadcrumbs"
|
26
|
+
autoload :Card, "protos/card"
|
27
|
+
autoload :Carousel, "protos/carousel"
|
28
|
+
autoload :ChatBubble, "protos/chat_bubble"
|
29
|
+
autoload :Collapse, "protos/collapse"
|
30
|
+
autoload :Command, "protos/command"
|
31
|
+
autoload :Drawer, "protos/drawer"
|
32
|
+
autoload :Hero, "protos/hero"
|
33
|
+
autoload :List, "protos/list"
|
34
|
+
autoload :Modal, "protos/modal"
|
35
|
+
autoload :Popover, "protos/popover"
|
36
|
+
autoload :Stats, "protos/stats"
|
37
|
+
autoload :Steps, "protos/steps"
|
38
|
+
autoload :Swap, "protos/swap"
|
39
|
+
autoload :Tabs, "protos/tabs"
|
40
|
+
autoload :Table, "protos/table"
|
41
|
+
autoload :Toast, "protos/toast"
|
42
|
+
autoload :Timeline, "protos/timeline"
|
43
|
+
autoload :Typography, "protos/typography"
|
44
|
+
|
45
|
+
# Dependent
|
46
|
+
autoload :Dropdown, "protos/dropdown"
|
47
|
+
autoload :Combobox, "protos/combobox"
|
48
|
+
end
|
132
49
|
|
133
50
|
require_relative "protos/engine" if defined?(Rails)
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nolan J Tait
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-01-13 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: dry-core
|
@@ -106,6 +105,7 @@ files:
|
|
106
105
|
- lib/protos/alert/icon.rb
|
107
106
|
- lib/protos/attributes.rb
|
108
107
|
- lib/protos/avatar.rb
|
108
|
+
- lib/protos/badge.rb
|
109
109
|
- lib/protos/breadcrumbs.rb
|
110
110
|
- lib/protos/breadcrumbs/crumb.rb
|
111
111
|
- lib/protos/card.rb
|
@@ -126,7 +126,6 @@ files:
|
|
126
126
|
- lib/protos/collapse/title.rb
|
127
127
|
- lib/protos/combobox.rb
|
128
128
|
- lib/protos/command.rb
|
129
|
-
- lib/protos/command/dialog.rb
|
130
129
|
- lib/protos/command/empty.rb
|
131
130
|
- lib/protos/command/group.rb
|
132
131
|
- lib/protos/command/input.rb
|
@@ -149,6 +148,7 @@ files:
|
|
149
148
|
- lib/protos/hero/overlay.rb
|
150
149
|
- lib/protos/list.rb
|
151
150
|
- lib/protos/list/item.rb
|
151
|
+
- lib/protos/mix.rb
|
152
152
|
- lib/protos/modal.rb
|
153
153
|
- lib/protos/modal/close_button.rb
|
154
154
|
- lib/protos/modal/dialog.rb
|
@@ -202,7 +202,6 @@ metadata:
|
|
202
202
|
source_code_uri: https://github.com/inhouse-work/protos
|
203
203
|
changelog_uri: https://github.com/inhouse-work/protos
|
204
204
|
rubygems_mfa_required: 'true'
|
205
|
-
post_install_message:
|
206
205
|
rdoc_options: []
|
207
206
|
require_paths:
|
208
207
|
- lib
|
@@ -220,8 +219,7 @@ requirements:
|
|
220
219
|
- tailwindcss
|
221
220
|
- daisyui
|
222
221
|
- protos-stimulus
|
223
|
-
rubygems_version: 3.
|
224
|
-
signing_key:
|
222
|
+
rubygems_version: 3.6.2
|
225
223
|
specification_version: 4
|
226
224
|
summary: A UI component library built with phlex and daisyui
|
227
225
|
test_files: []
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Protos
|
4
|
-
class Command
|
5
|
-
class Dialog < Component
|
6
|
-
# DOCS: The dialog for a command wraps the command content and provides a
|
7
|
-
# modal backdrop for the command when it is opened.
|
8
|
-
|
9
|
-
def view_template(&block)
|
10
|
-
dialog(**attrs) do
|
11
|
-
div(class: css[:modal], &block)
|
12
|
-
form(method: :dialog, class: css[:form]) do
|
13
|
-
button { "close" }
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
def default_attrs
|
21
|
-
{
|
22
|
-
data: { "protos--modal-target": "modal" }
|
23
|
-
}
|
24
|
-
end
|
25
|
-
|
26
|
-
def theme
|
27
|
-
{
|
28
|
-
container: %w[
|
29
|
-
modal
|
30
|
-
modal-bottom
|
31
|
-
backdrop-blur-sm
|
32
|
-
sm:modal-middle
|
33
|
-
],
|
34
|
-
modal: "modal-box p-0",
|
35
|
-
form: "modal-backdrop"
|
36
|
-
}
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|