protos 0.2.3 → 0.3.0

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.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +56 -60
  3. data/examples/list.rb +1 -1
  4. data/examples/navbar.rb +1 -1
  5. data/lib/protos/accordion/item.rb +2 -2
  6. data/lib/protos/accordion.rb +1 -1
  7. data/lib/protos/alert/actions.rb +1 -1
  8. data/lib/protos/alert/icon.rb +1 -1
  9. data/lib/protos/alert.rb +1 -1
  10. data/lib/protos/avatar.rb +1 -1
  11. data/lib/protos/breadcrumbs/crumb.rb +1 -1
  12. data/lib/protos/breadcrumbs.rb +1 -1
  13. data/lib/protos/card/actions.rb +1 -1
  14. data/lib/protos/card/body.rb +1 -1
  15. data/lib/protos/card/image.rb +1 -1
  16. data/lib/protos/card/title.rb +1 -1
  17. data/lib/protos/card.rb +1 -1
  18. data/lib/protos/carousel/actions.rb +1 -1
  19. data/lib/protos/carousel/item.rb +1 -1
  20. data/lib/protos/carousel.rb +1 -1
  21. data/lib/protos/chat_bubble/content.rb +1 -1
  22. data/lib/protos/chat_bubble/footer.rb +1 -1
  23. data/lib/protos/chat_bubble/header.rb +1 -1
  24. data/lib/protos/chat_bubble/image.rb +1 -1
  25. data/lib/protos/chat_bubble.rb +1 -1
  26. data/lib/protos/collapse/content.rb +1 -1
  27. data/lib/protos/collapse/title.rb +1 -1
  28. data/lib/protos/collapse.rb +2 -2
  29. data/lib/protos/command/dialog.rb +1 -1
  30. data/lib/protos/command/empty.rb +1 -1
  31. data/lib/protos/command/group.rb +1 -1
  32. data/lib/protos/command/input.rb +3 -2
  33. data/lib/protos/command/item.rb +1 -1
  34. data/lib/protos/command/list.rb +1 -1
  35. data/lib/protos/command/title.rb +1 -1
  36. data/lib/protos/command/trigger.rb +1 -1
  37. data/lib/protos/command.rb +1 -1
  38. data/lib/protos/drawer/content.rb +1 -1
  39. data/lib/protos/drawer/side.rb +1 -1
  40. data/lib/protos/drawer/trigger.rb +1 -1
  41. data/lib/protos/drawer.rb +2 -2
  42. data/lib/protos/dropdown/item.rb +1 -1
  43. data/lib/protos/dropdown/menu.rb +1 -1
  44. data/lib/protos/hero/content.rb +1 -1
  45. data/lib/protos/hero/overlay.rb +1 -1
  46. data/lib/protos/hero.rb +1 -1
  47. data/lib/protos/list/item.rb +1 -1
  48. data/lib/protos/list.rb +1 -1
  49. data/lib/protos/modal/close_button.rb +1 -1
  50. data/lib/protos/modal/dialog.rb +1 -1
  51. data/lib/protos/modal/trigger.rb +1 -1
  52. data/lib/protos/modal.rb +1 -1
  53. data/lib/protos/popover/content.rb +1 -1
  54. data/lib/protos/popover/trigger.rb +1 -1
  55. data/lib/protos/popover.rb +1 -1
  56. data/lib/protos/stats/actions.rb +1 -1
  57. data/lib/protos/stats/description.rb +1 -1
  58. data/lib/protos/stats/figure.rb +1 -1
  59. data/lib/protos/stats/stat.rb +1 -1
  60. data/lib/protos/stats/title.rb +1 -1
  61. data/lib/protos/stats/value.rb +1 -1
  62. data/lib/protos/stats.rb +1 -1
  63. data/lib/protos/swap/off.rb +1 -1
  64. data/lib/protos/swap/on.rb +1 -1
  65. data/lib/protos/swap.rb +3 -4
  66. data/lib/protos/table/body.rb +1 -1
  67. data/lib/protos/table/caption.rb +1 -1
  68. data/lib/protos/table/cell.rb +1 -1
  69. data/lib/protos/table/footer.rb +1 -1
  70. data/lib/protos/table/head.rb +1 -1
  71. data/lib/protos/table/header.rb +1 -1
  72. data/lib/protos/table/row.rb +1 -1
  73. data/lib/protos/table.rb +1 -1
  74. data/lib/protos/tabs/tab.rb +3 -2
  75. data/lib/protos/tabs.rb +1 -1
  76. data/lib/protos/timeline/center.rb +1 -1
  77. data/lib/protos/timeline/item.rb +1 -1
  78. data/lib/protos/timeline/left.rb +1 -1
  79. data/lib/protos/timeline/right.rb +1 -1
  80. data/lib/protos/timeline.rb +1 -1
  81. data/lib/protos/toast/close_button.rb +1 -1
  82. data/lib/protos/toast.rb +1 -1
  83. data/lib/protos/typography/heading.rb +1 -1
  84. data/lib/protos/typography/inline_link.rb +1 -1
  85. data/lib/protos/typography/paragraph.rb +1 -1
  86. data/lib/protos/version.rb +1 -1
  87. data/protos.gemspec +1 -1
  88. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 939a00cb6d422dc749d734683f4eceedf4c1857f21ab770dae704a99e06cdf8a
4
- data.tar.gz: 60525463c5531256d9cac2139791b112c477b746a8ed2a643d29856fe548517a
3
+ metadata.gz: 5fe048d407665dc19039444171da359495565d7b94d1787c444c4e8e8c5fe191
4
+ data.tar.gz: fda1eea822602572a8a28be104b8e60b533d429745d4ef616be8c7f14bf9e53e
5
5
  SHA512:
6
- metadata.gz: '094affdf956f0ff06aba676408ee34d20e6af8ed5ac92afa04576bbc52b83499e491bfd74c3b27c281d20f32fcada8dbad27ec2fbedcb79cb519e9e0a318d2e7'
7
- data.tar.gz: 953db1b5c57a9202a3f87e0a3ac8e32ed226f48c85588b7d1041559fd8a0749952c76619cc85eb075717b697623bb1dc045cf0dcc9c23370c1622e67c460d993
6
+ metadata.gz: e4859a4076a79386043b18ad71735b9b372c9120a0f3a8a816d1020174152b19ed2a030172ef01e7240ec26d28dce73070ce478ed440e15526eabde03f500067
7
+ data.tar.gz: 2ac30388a8534552f10cb32bc68b9f7786bd14caf1eab69d8f15c6a310a08d92b27eeb1a97896a60df18cd6e489c30f179706fd72ac0eca7072f435d05ebad9e
data/README.md CHANGED
@@ -25,11 +25,11 @@ Other Phlex based UI libraries worth checking out:
25
25
  A protos component follows some conventions that make them easy to work with as
26
26
  components in your app.
27
27
 
28
- Every UI component library will have a tension between being too general or
29
- narrow to be useful. Making components that look good out of the box can make
30
- them hard to customize.
28
+ Every UI component library will have a tension between being too general to fit
29
+ in your app or too narrow to be useful. Making components that look good out of
30
+ the box can make them hard to customize.
31
31
 
32
- We try and resolve this tensions by making the components have a minimal style
32
+ We try and resolve this tension by making these components have a minimal style
33
33
  that can be easily overridden using some ergonomic conventions.
34
34
 
35
35
  There are 3 core conventions:
@@ -40,7 +40,12 @@ There are 3 core conventions:
40
40
  ### Slots and themes
41
41
 
42
42
  Components are styled with `css` slots that are filled with values from
43
- a `theme`:
43
+ a `theme`.
44
+
45
+ You define a theme for your component by defining a `#theme` method that returns
46
+ a hash. This hash will be merged with any theme provided when rendering your
47
+ component. This allows you to easily override styles for your components
48
+ depending on their context.
44
49
 
45
50
  ```ruby
46
51
  class List < Protos::Component
@@ -53,31 +58,8 @@ class List < Protos::Component
53
58
 
54
59
  def theme
55
60
  {
56
- list: tokens("space-y-4"),
57
- item: tokens("font-bold", "text-2xl")
58
- }
59
- end
60
- end
61
- ```
62
-
63
- Here we are using conditional `tokens` from Phlex but you can also use
64
- simple strings.
65
-
66
- If you want to change the method we define our default theme you can override the
67
- `theme_method` on the class:
68
-
69
- ```ruby
70
- class List < Protos::Component
71
- theme_method :custom_theme
72
-
73
- # ...
74
-
75
- private
76
-
77
- def custom_theme
78
- {
79
- list: tokens("space-y-4"),
80
- item: tokens("font-bold", "text-2xl")
61
+ list: tokens("space-y-4"), # We can use `#tokens` from phlex (recommended)
62
+ item: "font-bold text-2xl" # Or just plain old strings
81
63
  }
82
64
  end
83
65
  end
@@ -137,14 +119,36 @@ The new `css[:item]` slot would be:
137
119
  <li class="font-bold">Item 1</li>
138
120
  ```
139
121
 
122
+ If you want to change the method we define our default theme you can override the
123
+ `theme_method` on the class:
124
+
125
+ ```ruby
126
+ class List < Protos::Component
127
+ theme_method :custom_theme
128
+
129
+ # ...
130
+
131
+ private
132
+
133
+ def custom_theme
134
+ {
135
+ list: tokens("space-y-4"),
136
+ item: tokens("font-bold", "text-2xl")
137
+ }
138
+ end
139
+ end
140
+ ```
141
+
140
142
  ### Attrs and default attrs
141
143
 
142
144
  By convention, all components spread in an `attrs` hash on their outermost
143
145
  element of the component.
144
146
 
145
147
  By doing this we enable 2 main conveniences:
146
- 1. We can pass `class` when initializing the component
147
- 2. We can add default attributes that can be merged with defaults
148
+ 1. We can pass a `class` keyword when initializing the component which will be
149
+ merged safely into the `css[:container]` slot
150
+ 2. We can add default attributes that are safely merged with any provided to the
151
+ component when its being initialized
148
152
 
149
153
  ```ruby
150
154
  class List < Protos::Component
@@ -158,9 +162,7 @@ class List < Protos::Component
158
162
 
159
163
  def default_attrs
160
164
  {
161
- data: {
162
- controller: "list"
163
- }
165
+ data: { controller: "list" }
164
166
  }
165
167
  end
166
168
 
@@ -173,9 +175,24 @@ class List < Protos::Component
173
175
  end
174
176
  ```
175
177
 
176
- Attrs will by default merge `class` into the `css[:container]` slot so we
177
- changed that in our theme. We also added `default_attrs` and gave a controller.
178
- These could be any html options.
178
+ `#attrs` will by default merge the `class` keyword into the `css[:container]`
179
+ slot which we define in our theme.
180
+
181
+ Special html options will be safely merged. For examples, the component above
182
+ defines a list controller. If we passed our own controller into data when we
183
+ initialize, the component's data-controller attribute would be appended to:
184
+
185
+ ```ruby
186
+ render List.new(
187
+ data: { controller: "tooltip" }
188
+ )
189
+ ```
190
+
191
+ That would output both controllers to the DOM element:
192
+
193
+ ```html
194
+ <ul data-controller="list tooltip">
195
+ ```
179
196
 
180
197
  If we wanted to, just like for our theme we can change the method from
181
198
  `default_attrs` by defining the `default_attrs_method` on the class:
@@ -184,37 +201,16 @@ If we wanted to, just like for our theme we can change the method from
184
201
  class List < Protos::Component
185
202
  default_attrs_method :custom_attrs
186
203
 
187
- # ...
188
-
189
204
  private
190
205
 
191
206
  def custom_attrs
192
207
  {
193
- data: {
194
- controller: "list"
195
- }
208
+ data: { controller: "list" }
196
209
  }
197
210
  end
198
-
199
- # ...
200
211
  end
201
212
  ```
202
213
 
203
- Now we get some additional convenience:
204
-
205
- ```ruby
206
- render List.new(
207
- class: "my-lg",
208
- data: { controller: "confetti" }
209
- )
210
- ```
211
-
212
- This would merge our `data` and `class` safely into the attributes:
213
-
214
- ```html
215
- <ul data-controller="list confetti" class="space-y-4 my-lg">
216
- ```
217
-
218
214
  ### Params and options
219
215
 
220
216
  Components extend
data/examples/list.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require "protos"
2
2
 
3
3
  class List < Protos::Component
4
- def template
4
+ def view_template
5
5
  ul(**attrs) do
6
6
  li(class: css[:item]) { "Item 1" }
7
7
  li(class: css[:item]) { "Item 2" }
data/examples/navbar.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  require_relative "../lib/protos"
4
4
 
5
5
  class Navbar < Protos::Component
6
- def template
6
+ def view_template
7
7
  header(**attrs) do
8
8
  h1(class: css[:heading]) { "Hello world" }
9
9
  h2(class: css[:subtitle]) { "With a subtitle" }
@@ -7,12 +7,12 @@ module Protos
7
7
 
8
8
  option :id, type: Types::Coercible::String
9
9
 
10
- def template(&block)
10
+ def view_template(&block)
11
11
  li(**attrs) do
12
12
  render collapse_component do
13
13
  # form: "" prevents the radio button from being submitted if its
14
14
  # within a form
15
- input(type: :radio, name: id, form: "")
15
+ input(type: :radio, name: id, form: "", autocomplete: :off)
16
16
  yield if block
17
17
  end
18
18
  end
@@ -10,7 +10,7 @@ module Protos
10
10
  option :id,
11
11
  default: -> { "collapse-#{SecureRandom.hex(4)}" }
12
12
 
13
- def template(&block)
13
+ def view_template(&block)
14
14
  ul(**attrs, &block)
15
15
  end
16
16
 
@@ -5,7 +5,7 @@ module Protos
5
5
  class Actions < Component
6
6
  # DOCS: Area for actions (e.g buttons) within an alert
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  nav(**attrs, &block)
10
10
  end
11
11
 
@@ -6,7 +6,7 @@ module Protos
6
6
  # DOCS: Icon for the alert, usually showing at the top left corner aligned
7
7
  # to the text
8
8
 
9
- def template(&block)
9
+ def view_template(&block)
10
10
  div(**attrs, &block)
11
11
  end
12
12
 
data/lib/protos/alert.rb CHANGED
@@ -15,7 +15,7 @@ module Protos
15
15
 
16
16
  option :type, type: AlertTypes, default: -> { :info }, reader: :private
17
17
 
18
- def template(&block)
18
+ def view_template(&block)
19
19
  div(**attrs, &block)
20
20
  end
21
21
 
data/lib/protos/avatar.rb CHANGED
@@ -17,7 +17,7 @@ module Protos
17
17
  default: -> { :none },
18
18
  reader: false
19
19
 
20
- def template(&block)
20
+ def view_template(&block)
21
21
  div(**attrs) do
22
22
  div(class: css[:figure], &block)
23
23
  end
@@ -5,7 +5,7 @@ module Protos
5
5
  class Crumb < Component
6
6
  # DOCS: A crumb is a single item within a breadcrumb
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  li(**attrs, &block)
10
10
  end
11
11
  end
@@ -5,7 +5,7 @@ module Protos
5
5
  # DOCS: A list of breadcrumbs (e.g links) for navigation
6
6
  # https://daisyui.com/components/breadcrumbs/
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  nav(**attrs) do
10
10
  ul(class: css[:list], &block)
11
11
  end
@@ -5,7 +5,7 @@ module Protos
5
5
  class Actions < Component
6
6
  # DOCS: Area for actions (e.g buttons) within a card
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  nav(**attrs, &block)
10
10
  end
11
11
 
@@ -5,7 +5,7 @@ module Protos
5
5
  class Body < Component
6
6
  # DOCS: The main content area of a card
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  div(**attrs, &block)
10
10
  end
11
11
 
@@ -7,7 +7,7 @@ module Protos
7
7
  # on daisyui which will style the <figure> tag depending on whether
8
8
  # image-overlay is present on the card.
9
9
 
10
- def template(&block)
10
+ def view_template(&block)
11
11
  figure(**attrs, &block)
12
12
  end
13
13
  end
@@ -5,7 +5,7 @@ module Protos
5
5
  class Title < Component
6
6
  # DOCS: The title of a card
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  div(**attrs, &block)
10
10
  end
11
11
 
data/lib/protos/card.rb CHANGED
@@ -14,7 +14,7 @@ module Protos
14
14
  default: -> { :default },
15
15
  reader: false
16
16
 
17
- def template(&block)
17
+ def view_template(&block)
18
18
  article(**attrs, &block)
19
19
  end
20
20
 
@@ -5,7 +5,7 @@ module Protos
5
5
  class Actions < Component
6
6
  # DOCS: Area for actions (e.g buttons) within a carousel
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  div(**attrs, &block)
10
10
  end
11
11
 
@@ -5,7 +5,7 @@ module Protos
5
5
  class Item < Component
6
6
  # DOCS: A single item within a carousel
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  div(**attrs, &block)
10
10
  end
11
11
 
@@ -16,7 +16,7 @@ module Protos
16
16
  :end
17
17
  )
18
18
 
19
- def template(&block)
19
+ def view_template(&block)
20
20
  div(**attrs, &block)
21
21
  end
22
22
 
@@ -20,7 +20,7 @@ module Protos
20
20
  :error
21
21
  )
22
22
 
23
- def template(&block)
23
+ def view_template(&block)
24
24
  div(**attrs, &block)
25
25
  end
26
26
 
@@ -5,7 +5,7 @@ module Protos
5
5
  class Footer < Component
6
6
  # DOCS: The footer of a chat bubble
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  div(**attrs, &block)
10
10
  end
11
11
 
@@ -6,7 +6,7 @@ module Protos
6
6
  # DOCS: The header of a chat bubble. This is typically used to display the
7
7
  # name of the user who sent the message.
8
8
 
9
- def template(&block)
9
+ def view_template(&block)
10
10
  div(**attrs, &block)
11
11
  end
12
12
 
@@ -6,7 +6,7 @@ module Protos
6
6
  # DOCS: An image within a chat bubble. This would typically be an avatar
7
7
  # component.
8
8
 
9
- def template(&block)
9
+ def view_template(&block)
10
10
  div(**attrs, &block)
11
11
  end
12
12
 
@@ -15,7 +15,7 @@ module Protos
15
15
  :end
16
16
  )
17
17
 
18
- def template(&block)
18
+ def view_template(&block)
19
19
  div(**attrs, &block)
20
20
  end
21
21
 
@@ -6,7 +6,7 @@ module Protos
6
6
  # DOCS: The content of a collapse. This would be hidden until the collapse
7
7
  # is opened.
8
8
 
9
- def template(&block)
9
+ def view_template(&block)
10
10
  div(**attrs, &block)
11
11
  end
12
12
 
@@ -10,7 +10,7 @@ module Protos
10
10
  reader: false,
11
11
  default: -> { "" }
12
12
 
13
- def template(&block)
13
+ def view_template(&block)
14
14
  if @id.size.positive?
15
15
  label(for: @id, **attrs, &block)
16
16
  else
@@ -11,9 +11,9 @@ module Protos
11
11
  default: -> { "collapse-#{SecureRandom.hex(4)}" },
12
12
  type: Types::String
13
13
 
14
- def template
14
+ def view_template
15
15
  div(**attrs) do
16
- input(type: "checkbox", id:) if @checkbox
16
+ input(type: "checkbox", id:, autocomplete: :off) if @checkbox
17
17
  yield if block_given?
18
18
  end
19
19
  end
@@ -6,7 +6,7 @@ module Protos
6
6
  # DOCS: The dialog for a command wraps the command content and provides a
7
7
  # modal backdrop for the command when it is opened.
8
8
 
9
- def template(&block)
9
+ def view_template(&block)
10
10
  dialog(**attrs) do
11
11
  div(class: css[:modal], &block)
12
12
  form(method: :dialog, class: css[:form]) do
@@ -6,7 +6,7 @@ module Protos
6
6
  # DOCS: The empty component is displayed in the list when there are no
7
7
  # matches in an input.
8
8
 
9
- def template(&block)
9
+ def view_template(&block)
10
10
  li(**attrs, &block)
11
11
  end
12
12
 
@@ -7,7 +7,7 @@ module Protos
7
7
  # Items in the group will have a divider line on the left side and can
8
8
  # optionally have a title.
9
9
 
10
- def template(&block)
10
+ def view_template(&block)
11
11
  li(**attrs) do
12
12
  ul(class: css[:list], &block)
13
13
  end
@@ -11,7 +11,7 @@ module Protos
11
11
  },
12
12
  reader: :private
13
13
 
14
- def template(&block)
14
+ def view_template(&block)
15
15
  div(**attrs) do
16
16
  label(class: css[:label]) do
17
17
  div(class: css[:icon], &block) if block
@@ -19,7 +19,8 @@ module Protos
19
19
  type: :text,
20
20
  data: { action: "protos--command#filter" },
21
21
  class: css[:input],
22
- placeholder:
22
+ placeholder:,
23
+ autocomplete: :off
23
24
  )
24
25
  end
25
26
  end
@@ -5,7 +5,7 @@ module Protos
5
5
  class Item < Component
6
6
  # DOCS: A single option within a command
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  li(**attrs, &block)
10
10
  end
11
11
 
@@ -5,7 +5,7 @@ module Protos
5
5
  class List < Component
6
6
  # DOCS: A list of commands. This can contain either items or groups.
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  ul(**attrs, &block)
10
10
  end
11
11
 
@@ -6,7 +6,7 @@ module Protos
6
6
  # DOCS: The title for a group of commands. This is expected to be used
7
7
  # inside a Protos::Command::Group component.
8
8
 
9
- def template(&block)
9
+ def view_template(&block)
10
10
  h2(**attrs, &block)
11
11
  end
12
12
 
@@ -5,7 +5,7 @@ module Protos
5
5
  class Trigger < Component
6
6
  # DOCS: A trigger is a button that opens a command palette modal
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  button(**attrs, &block)
10
10
  end
11
11
 
@@ -6,7 +6,7 @@ module Protos
6
6
  # filterable list of commands. Command modals are by default closable by
7
7
  # clicking the overlay rather than a specific close button.
8
8
 
9
- def template(&block)
9
+ def view_template(&block)
10
10
  div(**attrs, &block)
11
11
  end
12
12
 
@@ -6,7 +6,7 @@ module Protos
6
6
  # DOCS: The content of a drawer. This would be visible at all times and
7
7
  # represents the main content of your page.
8
8
 
9
- def template(&block)
9
+ def view_template(&block)
10
10
  div(**attrs, &block)
11
11
  end
12
12
 
@@ -8,7 +8,7 @@ module Protos
8
8
 
9
9
  option :id, type: Types::Coercible::String
10
10
 
11
- def template
11
+ def view_template
12
12
  aside(**attrs) do
13
13
  label(for: id, aria_label: "close sidebar", class: css[:toggle])
14
14
  yield if block_given?
@@ -8,7 +8,7 @@ module Protos
8
8
 
9
9
  option :id, type: Types::Coercible::String
10
10
 
11
- def template(&block)
11
+ def view_template(&block)
12
12
  label(for: id, **attrs, &block)
13
13
  end
14
14
 
data/lib/protos/drawer.rb CHANGED
@@ -9,9 +9,9 @@ module Protos
9
9
 
10
10
  option :id, type: Types::Coercible::String
11
11
 
12
- def template
12
+ def view_template
13
13
  div(**attrs) do
14
- input(id:, type: :checkbox, class: css[:toggle])
14
+ input(id:, type: :checkbox, class: css[:toggle], autocomplete: :off)
15
15
  yield if block_given?
16
16
  end
17
17
  end
@@ -5,7 +5,7 @@ module Protos
5
5
  class Item < Component
6
6
  # DOCS: A single item within a dropdown
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  li(**attrs, &block)
10
10
  end
11
11
  end
@@ -7,7 +7,7 @@ module Protos
7
7
  # Protos::Popover::Content component as the main functionality for
8
8
  # dropdowns comes from there.
9
9
 
10
- def template(&block)
10
+ def view_template(&block)
11
11
  template_tag(**template_attrs) do
12
12
  ul(**attrs, &block)
13
13
  end
@@ -6,7 +6,7 @@ module Protos
6
6
  # DOCS: The content of a hero. This would be centered within the main
7
7
  # component container.
8
8
 
9
- def template(&block)
9
+ def view_template(&block)
10
10
  div(**attrs, &block)
11
11
  end
12
12
 
@@ -7,7 +7,7 @@ module Protos
7
7
  # their opacity through the opacity of the overlay. This can be useful to
8
8
  # make text readable on noisy images.
9
9
 
10
- def template(&block)
10
+ def view_template(&block)
11
11
  div(**attrs, &block)
12
12
  end
13
13
 
data/lib/protos/hero.rb CHANGED
@@ -6,7 +6,7 @@ module Protos
6
6
  # optionally layout an image for a responsive layout.
7
7
  # https://daisyui.com/components/hero/
8
8
 
9
- def template(&block)
9
+ def view_template(&block)
10
10
  div(**attrs, &block)
11
11
  end
12
12
 
@@ -7,7 +7,7 @@ module Protos
7
7
  # work for list items, including border radius. E.g. only the first and
8
8
  # last items will have border radius on the top and bottom.
9
9
 
10
- def template(&block)
10
+ def view_template(&block)
11
11
  li(**attrs, &block)
12
12
  end
13
13
 
data/lib/protos/list.rb CHANGED
@@ -7,7 +7,7 @@ module Protos
7
7
 
8
8
  option :ordered, Types::Bool, default: -> { false }, reader: false
9
9
 
10
- def template(&block)
10
+ def view_template(&block)
11
11
  send(element, **attrs, &block)
12
12
  end
13
13
 
@@ -5,7 +5,7 @@ module Protos
5
5
  class CloseButton < Component
6
6
  # DOCS: A close button for a modal
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  form(method: :dialog, class: css[:form]) do
10
10
  button(
11
11
  **attrs,
@@ -6,7 +6,7 @@ module Protos
6
6
  # DOCS: A modal dialog. This is the place for the main content of the
7
7
  # modal that will be displayed when the trigger is clicked.
8
8
 
9
- def template(&block)
9
+ def view_template(&block)
10
10
  dialog(**attrs) do
11
11
  div(class: css[:modal], &block)
12
12
  end
@@ -5,7 +5,7 @@ module Protos
5
5
  class Trigger < Component
6
6
  # DOCS: A trigger is a button that opens a modal
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  button(**attrs, &block)
10
10
  end
11
11
 
data/lib/protos/modal.rb CHANGED
@@ -5,7 +5,7 @@ module Protos
5
5
  # DOCS: A modal component that can be triggered by a button or a link and
6
6
  # will open a fullscreen modal, usually with a close button.
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  div(**attrs, class: css[:container], &block)
10
10
  end
11
11
 
@@ -8,7 +8,7 @@ module Protos
8
8
  # This means content in here will not be available in system tests that
9
9
  # use rack_test.
10
10
 
11
- def template(&block)
11
+ def view_template(&block)
12
12
  template_tag(**template_attrs) do
13
13
  div(**attrs, &block)
14
14
  end
@@ -6,7 +6,7 @@ module Protos
6
6
  # DOCS: The trigger of a popover. This is the element that you would hover
7
7
  # or click on to show the popover.
8
8
 
9
- def template(&block)
9
+ def view_template(&block)
10
10
  div(**attrs, &block)
11
11
  end
12
12
 
@@ -80,7 +80,7 @@ module Protos
80
80
  reader: false,
81
81
  type: TriggerTypes | Types::Array.of(TriggerTypes)
82
82
 
83
- def template(&block)
83
+ def view_template(&block)
84
84
  div(**attrs, &block)
85
85
  end
86
86
 
@@ -5,7 +5,7 @@ module Protos
5
5
  class Actions < Component
6
6
  # DOCS: A container for the actions (e.g. buttons) for a group of stats
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  div(**attrs, &block)
10
10
  end
11
11
 
@@ -5,7 +5,7 @@ module Protos
5
5
  class Description < Component
6
6
  # DOCS: A description for a group of stats
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  div(**attrs, &block)
10
10
  end
11
11
 
@@ -5,7 +5,7 @@ module Protos
5
5
  class Figure < Component
6
6
  # DOCS: A figure for a single stat
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  div(**attrs, &block)
10
10
  end
11
11
 
@@ -5,7 +5,7 @@ module Protos
5
5
  class Stat < Component
6
6
  # DOCS: A single stat container
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  div(**attrs, &block)
10
10
  end
11
11
 
@@ -5,7 +5,7 @@ module Protos
5
5
  class Title < Component
6
6
  # DOCS: A title for a group of stats
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  div(**attrs, &block)
10
10
  end
11
11
 
@@ -5,7 +5,7 @@ module Protos
5
5
  class Value < Component
6
6
  # DOCS: A value for a single stat
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  div(**attrs, &block)
10
10
  end
11
11
 
data/lib/protos/stats.rb CHANGED
@@ -5,7 +5,7 @@ module Protos
5
5
  # DOCS: Stats component that contains a collection of stats
6
6
  # https://daisyui.com/components/stat/
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  div(**attrs, &block)
10
10
  end
11
11
 
@@ -5,7 +5,7 @@ module Protos
5
5
  class Off < Component
6
6
  # DOCS: The off state for a swap component. This is the default state.
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  div(**attrs, &block)
10
10
  end
11
11
 
@@ -5,7 +5,7 @@ module Protos
5
5
  class On < Component
6
6
  # DOCS: The on state for a swap component. This is the active state.
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  div(**attrs, &block)
10
10
  end
11
11
 
data/lib/protos/swap.rb CHANGED
@@ -6,9 +6,9 @@ module Protos
6
6
  # display different content.
7
7
  # https://daisyui.com/components/swap/
8
8
 
9
- def template
9
+ def view_template
10
10
  label(**attrs) do
11
- input(type: :checkbox, class: css[:input])
11
+ input(type: :checkbox, class: css[:input], autocomplete: :off)
12
12
  yield if block_given?
13
13
  end
14
14
  end
@@ -25,8 +25,7 @@ module Protos
25
25
 
26
26
  def theme
27
27
  {
28
- container: tokens("swap"),
29
- input: tokens("hidden")
28
+ container: tokens("swap")
30
29
  }
31
30
  end
32
31
  end
@@ -5,7 +5,7 @@ module Protos
5
5
  class Body < Component
6
6
  # DOCS: The body of a table
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  tbody(**attrs, &block)
10
10
  end
11
11
  end
@@ -5,7 +5,7 @@ module Protos
5
5
  class Caption < Component
6
6
  # DOCS: The caption of a table
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  caption(**attrs, &block)
10
10
  end
11
11
 
@@ -11,7 +11,7 @@ module Protos
11
11
  :left
12
12
  }
13
13
 
14
- def template(&block)
14
+ def view_template(&block)
15
15
  td(**attrs, &block)
16
16
  end
17
17
 
@@ -5,7 +5,7 @@ module Protos
5
5
  class Footer < Component
6
6
  # DOCS: The footer of a table
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  tfoot(**attrs, &block)
10
10
  end
11
11
  end
@@ -11,7 +11,7 @@ module Protos
11
11
  :left
12
12
  }
13
13
 
14
- def template(&block)
14
+ def view_template(&block)
15
15
  th(**attrs, &block)
16
16
  end
17
17
 
@@ -6,7 +6,7 @@ module Protos
6
6
  # DOCS: The header of a table that contains many Protos::Table::Head
7
7
  # components
8
8
 
9
- def template(&block)
9
+ def view_template(&block)
10
10
  thead(**attrs, &block)
11
11
  end
12
12
  end
@@ -5,7 +5,7 @@ module Protos
5
5
  class Row < Component
6
6
  # DOCS: The row of a table
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  tr(**attrs, &block)
10
10
  end
11
11
  end
data/lib/protos/table.rb CHANGED
@@ -18,7 +18,7 @@ module Protos
18
18
  :lg
19
19
  )
20
20
 
21
- def template(&block)
21
+ def view_template(&block)
22
22
  div(**attrs) do
23
23
  table(class: css[:table], &block)
24
24
  end
@@ -10,13 +10,14 @@ module Protos
10
10
  option :active, default: -> { false }
11
11
  option :disabled, default: -> { false }
12
12
 
13
- def template(&block)
13
+ def view_template(&block)
14
14
  input(
15
15
  type: :radio,
16
16
  class: css[:input],
17
17
  name: id,
18
18
  role: :tab,
19
- aria_label: label
19
+ aria_label: label,
20
+ autocomplete: :off
20
21
  )
21
22
  div(**attrs, &block)
22
23
  end
data/lib/protos/tabs.rb CHANGED
@@ -24,7 +24,7 @@ module Protos
24
24
  :lg
25
25
  )
26
26
 
27
- def template(&block)
27
+ def view_template(&block)
28
28
  div(**attrs, &block)
29
29
  end
30
30
 
@@ -6,7 +6,7 @@ module Protos
6
6
  # DOCS: The center of a timeline. This would usually be an icon or
7
7
  # something small that shows a point on the timeline.
8
8
 
9
- def template(&block)
9
+ def view_template(&block)
10
10
  div(**attrs, &block)
11
11
  end
12
12
 
@@ -7,7 +7,7 @@ module Protos
7
7
  # right and depending on its position in the list, an hr at the beginning
8
8
  # or end.
9
9
 
10
- def template(&block)
10
+ def view_template(&block)
11
11
  li(**attrs, &block)
12
12
  end
13
13
  end
@@ -6,7 +6,7 @@ module Protos
6
6
  # DOCS: Content on the left (on daisyui "start") side of a timeline.
7
7
  # We chose not to use start/end because of the keywork conflict with ruby.
8
8
 
9
- def template(&block)
9
+ def view_template(&block)
10
10
  div(**attrs, &block)
11
11
  end
12
12
 
@@ -6,7 +6,7 @@ module Protos
6
6
  # DOCS: Content on the right (on daisyui "end") side of a timeline.
7
7
  # We chose not to use start/end because of the keywork conflict with ruby.
8
8
 
9
- def template(&block)
9
+ def view_template(&block)
10
10
  div(**attrs, &block)
11
11
  end
12
12
 
@@ -7,7 +7,7 @@ module Protos
7
7
 
8
8
  option :vertical, type: Types::Bool, default: -> { false }
9
9
 
10
- def template(&block)
10
+ def view_template(&block)
11
11
  ul(**attrs, &block)
12
12
  end
13
13
 
@@ -5,7 +5,7 @@ module Protos
5
5
  class CloseButton < Component
6
6
  # DOCS: A close button for a toast
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  form(method: :dialog, class: css[:form]) do
10
10
  button(
11
11
  autofocus: true,
data/lib/protos/toast.rb CHANGED
@@ -23,7 +23,7 @@ module Protos
23
23
  default: -> { :bottom_end },
24
24
  reader: false
25
25
 
26
- def template(&block)
26
+ def view_template(&block)
27
27
  dialog(**attrs, &block)
28
28
  end
29
29
 
@@ -12,7 +12,7 @@ module Protos
12
12
  option :size, type: SizeTypes, default: -> { "md" }, reader: false
13
13
  option :level, type: LevelTypes, default: -> { 1 }, reader: false
14
14
 
15
- def template(&block)
15
+ def view_template(&block)
16
16
  send(element, **attrs, &block)
17
17
  end
18
18
 
@@ -5,7 +5,7 @@ module Protos
5
5
  class InlineLink < Component
6
6
  # DOCS: A link that is styled to be inline with text
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  a(**attrs, &block)
10
10
  end
11
11
 
@@ -5,7 +5,7 @@ module Protos
5
5
  class Paragraph < Component
6
6
  # DOCS: A paragraph of text
7
7
 
8
- def template(&block)
8
+ def view_template(&block)
9
9
  p(**attrs, &block)
10
10
  end
11
11
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Protos
4
- VERSION = "0.2.3"
4
+ VERSION = "0.3.0"
5
5
  end
data/protos.gemspec CHANGED
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
37
37
  spec.add_dependency "dry-core", "~> 1.0"
38
38
  spec.add_dependency "dry-initializer", "~> 3.1"
39
39
  spec.add_dependency "dry-types", "~> 1.7"
40
- spec.add_dependency "phlex", "~> 1.9"
40
+ spec.add_dependency "phlex", "~> 1.10"
41
41
  spec.add_dependency "tailwind_merge", "~> 0.10"
42
42
 
43
43
  # For more information and examples about making a new gem, check out our
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.3
4
+ version: 0.3.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-03-14 00:00:00.000000000 Z
11
+ date: 2024-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-core
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.9'
61
+ version: '1.10'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.9'
68
+ version: '1.10'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: tailwind_merge
71
71
  requirement: !ruby/object:Gem::Requirement