protos 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +262 -70
  3. data/examples/list.rb +34 -0
  4. data/lib/protos/accordion/item.rb +6 -4
  5. data/lib/protos/accordion.rb +5 -0
  6. data/lib/protos/alert/actions.rb +2 -0
  7. data/lib/protos/alert/icon.rb +3 -0
  8. data/lib/protos/alert.rb +4 -0
  9. data/lib/protos/attributes.rb +8 -0
  10. data/lib/protos/avatar.rb +3 -0
  11. data/lib/protos/breadcrumbs/crumb.rb +2 -0
  12. data/lib/protos/breadcrumbs.rb +3 -0
  13. data/lib/protos/card/actions.rb +2 -0
  14. data/lib/protos/card/body.rb +2 -0
  15. data/lib/protos/card/image.rb +4 -0
  16. data/lib/protos/card/title.rb +2 -0
  17. data/lib/protos/card.rb +3 -0
  18. data/lib/protos/carousel/actions.rb +2 -0
  19. data/lib/protos/carousel/item.rb +2 -0
  20. data/lib/protos/carousel.rb +4 -0
  21. data/lib/protos/chat_bubble/content.rb +3 -0
  22. data/lib/protos/chat_bubble/footer.rb +2 -0
  23. data/lib/protos/chat_bubble/header.rb +3 -0
  24. data/lib/protos/chat_bubble/image.rb +3 -0
  25. data/lib/protos/chat_bubble.rb +5 -0
  26. data/lib/protos/collapse/content.rb +3 -0
  27. data/lib/protos/collapse/title.rb +3 -0
  28. data/lib/protos/collapse.rb +4 -0
  29. data/lib/protos/combobox.rb +4 -0
  30. data/lib/protos/command/dialog.rb +9 -1
  31. data/lib/protos/command/empty.rb +3 -0
  32. data/lib/protos/command/group.rb +4 -0
  33. data/lib/protos/command/input.rb +2 -0
  34. data/lib/protos/command/item.rb +2 -0
  35. data/lib/protos/command/list.rb +2 -0
  36. data/lib/protos/command/title.rb +3 -0
  37. data/lib/protos/command/trigger.rb +2 -0
  38. data/lib/protos/command.rb +4 -0
  39. data/lib/protos/component.rb +21 -9
  40. data/lib/protos/drawer/content.rb +3 -0
  41. data/lib/protos/drawer/side.rb +8 -1
  42. data/lib/protos/drawer/trigger.rb +3 -0
  43. data/lib/protos/drawer.rb +6 -1
  44. data/lib/protos/dropdown/item.rb +2 -0
  45. data/lib/protos/dropdown/menu.rb +4 -0
  46. data/lib/protos/dropdown/trigger.rb +2 -0
  47. data/lib/protos/dropdown.rb +8 -0
  48. data/lib/protos/engine.rb +3 -0
  49. data/lib/protos/hero/content.rb +3 -0
  50. data/lib/protos/hero/overlay.rb +4 -0
  51. data/lib/protos/hero.rb +4 -0
  52. data/lib/protos/list/item.rb +4 -0
  53. data/lib/protos/list.rb +3 -0
  54. data/lib/protos/modal/close_button.rb +2 -0
  55. data/lib/protos/modal/dialog.rb +9 -1
  56. data/lib/protos/modal/trigger.rb +2 -0
  57. data/lib/protos/modal.rb +3 -0
  58. data/lib/protos/popover/content.rb +5 -0
  59. data/lib/protos/popover/trigger.rb +3 -0
  60. data/lib/protos/popover.rb +8 -1
  61. data/lib/protos/stats/actions.rb +2 -0
  62. data/lib/protos/stats/description.rb +2 -0
  63. data/lib/protos/stats/figure.rb +2 -0
  64. data/lib/protos/stats/stat.rb +2 -0
  65. data/lib/protos/stats/title.rb +2 -0
  66. data/lib/protos/stats/value.rb +2 -0
  67. data/lib/protos/stats.rb +3 -0
  68. data/lib/protos/swap/off.rb +2 -0
  69. data/lib/protos/swap/on.rb +2 -0
  70. data/lib/protos/swap.rb +4 -0
  71. data/lib/protos/table/body.rb +2 -0
  72. data/lib/protos/table/caption.rb +2 -0
  73. data/lib/protos/table/cell.rb +2 -0
  74. data/lib/protos/table/footer.rb +2 -0
  75. data/lib/protos/table/head.rb +2 -0
  76. data/lib/protos/table/header.rb +3 -0
  77. data/lib/protos/table/row.rb +2 -0
  78. data/lib/protos/table.rb +3 -0
  79. data/lib/protos/tabs/tab.rb +2 -0
  80. data/lib/protos/tabs.rb +3 -0
  81. data/lib/protos/theme.rb +5 -0
  82. data/lib/protos/timeline/center.rb +3 -0
  83. data/lib/protos/timeline/item.rb +4 -0
  84. data/lib/protos/timeline/left.rb +3 -0
  85. data/lib/protos/timeline/right.rb +3 -0
  86. data/lib/protos/timeline.rb +3 -0
  87. data/lib/protos/toast/close_button.rb +2 -0
  88. data/lib/protos/toast.rb +4 -0
  89. data/lib/protos/token_list.rb +7 -1
  90. data/lib/protos/typography/heading.rb +3 -0
  91. data/lib/protos/typography/inline_link.rb +2 -0
  92. data/lib/protos/typography/paragraph.rb +2 -0
  93. data/lib/protos/typography.rb +3 -0
  94. data/lib/protos/version.rb +1 -1
  95. metadata +3 -2
@@ -3,6 +3,8 @@
3
3
  module Protos
4
4
  class ChatBubble
5
5
  class Footer < Component
6
+ # DOCS: The footer of a chat bubble
7
+
6
8
  def template(&block)
7
9
  div(**attrs, &block)
8
10
  end
@@ -3,6 +3,9 @@
3
3
  module Protos
4
4
  class ChatBubble
5
5
  class Header < Component
6
+ # DOCS: The header of a chat bubble. This is typically used to display the
7
+ # name of the user who sent the message.
8
+
6
9
  def template(&block)
7
10
  div(**attrs, &block)
8
11
  end
@@ -3,6 +3,9 @@
3
3
  module Protos
4
4
  class ChatBubble
5
5
  class Image < Component
6
+ # DOCS: An image within a chat bubble. This would typically be an avatar
7
+ # component.
8
+
6
9
  def template(&block)
7
10
  div(**attrs, &block)
8
11
  end
@@ -2,6 +2,11 @@
2
2
 
3
3
  module Protos
4
4
  class ChatBubble < Component
5
+ # DOCS: A chat bubble component that contains a message an possibly some
6
+ # metadata and an image. Each chat bubble would represent a single message
7
+ # in a larger chat history.
8
+ # https://daisyui.com/components/chat/
9
+
5
10
  option :align,
6
11
  default: -> { :start },
7
12
  reader: false,
@@ -3,6 +3,9 @@
3
3
  module Protos
4
4
  class Collapse
5
5
  class Content < Component
6
+ # DOCS: The content of a collapse. This would be hidden until the collapse
7
+ # is opened.
8
+
6
9
  def template(&block)
7
10
  div(**attrs, &block)
8
11
  end
@@ -3,6 +3,9 @@
3
3
  module Protos
4
4
  class Collapse
5
5
  class Title < Component
6
+ # DOCS: The title of a collapse. This is the content that is always
7
+ # visible and is used to toggle the collapse.
8
+
6
9
  def template(&block)
7
10
  div(**attrs, &block)
8
11
  end
@@ -2,6 +2,10 @@
2
2
 
3
3
  module Protos
4
4
  class Collapse < Component
5
+ # DOCS: A collapsible container that can be expanded or collapsed. The title
6
+ # is visible at all times, and the content is only visible when expanded.
7
+ # https://daisyui.com/components/collapse/
8
+
5
9
  def template(&block)
6
10
  div(**attrs, &block)
7
11
  end
@@ -2,6 +2,10 @@
2
2
 
3
3
  module Protos
4
4
  class Combobox < Popover
5
+ # DOCS: A combobox is a combination of a text input and a list of options.
6
+ # It makes selecting values from a large list easier by filtering the list.
7
+ # Comboboxes use popovers and command to create the list of options.
8
+
5
9
  option :trigger,
6
10
  default: -> { :click },
7
11
  reader: false,
@@ -3,6 +3,9 @@
3
3
  module Protos
4
4
  class Command
5
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
+
6
9
  def template(&block)
7
10
  dialog(**attrs) do
8
11
  div(class: css[:modal], &block)
@@ -22,7 +25,12 @@ module Protos
22
25
 
23
26
  def theme
24
27
  {
25
- container: tokens("modal", "modal-bottom", "sm:modal-middle"),
28
+ container: tokens(
29
+ "modal",
30
+ "modal-bottom",
31
+ "backdrop-blur-sm",
32
+ "sm:modal-middle"
33
+ ),
26
34
  modal: tokens("modal-box", "p-0"),
27
35
  form: tokens("modal-backdrop")
28
36
  }
@@ -3,6 +3,9 @@
3
3
  module Protos
4
4
  class Command
5
5
  class Empty < Component
6
+ # DOCS: The empty component is displayed in the list when there are no
7
+ # matches in an input.
8
+
6
9
  def template(&block)
7
10
  li(**attrs, &block)
8
11
  end
@@ -3,6 +3,10 @@
3
3
  module Protos
4
4
  class Command
5
5
  class Group < Component
6
+ # DOCS: An optional group for holding a heading and a list of options.
7
+ # Items in the group will have a divider line on the left side and can
8
+ # optionally have a title.
9
+
6
10
  def template(&block)
7
11
  li(**attrs) do
8
12
  ul(class: css[:list], &block)
@@ -3,6 +3,8 @@
3
3
  module Protos
4
4
  class Command
5
5
  class Input < Component
6
+ # DOCS: The search input for the command palette
7
+
6
8
  option :placeholder,
7
9
  default: -> {
8
10
  "Type a command or search..."
@@ -3,6 +3,8 @@
3
3
  module Protos
4
4
  class Command
5
5
  class Item < Component
6
+ # DOCS: A single option within a command
7
+
6
8
  def template(&block)
7
9
  li(**attrs, &block)
8
10
  end
@@ -3,6 +3,8 @@
3
3
  module Protos
4
4
  class Command
5
5
  class List < Component
6
+ # DOCS: A list of commands. This can contain either items or groups.
7
+
6
8
  def template(&block)
7
9
  ul(**attrs, &block)
8
10
  end
@@ -3,6 +3,9 @@
3
3
  module Protos
4
4
  class Command
5
5
  class Title < Component
6
+ # DOCS: The title for a group of commands. This is expected to be used
7
+ # inside a Protos::Command::Group component.
8
+
6
9
  def template(&block)
7
10
  h2(**attrs, &block)
8
11
  end
@@ -3,6 +3,8 @@
3
3
  module Protos
4
4
  class Command
5
5
  class Trigger < Component
6
+ # DOCS: A trigger is a button that opens a command palette modal
7
+
6
8
  def template(&block)
7
9
  button(**attrs, &block)
8
10
  end
@@ -2,6 +2,10 @@
2
2
 
3
3
  module Protos
4
4
  class Command < Component
5
+ # DOCS: A command pallete component that can be used to trigger a modal with
6
+ # filterable list of commands. Command modals are by default closable by
7
+ # clicking the overlay rather than a specific close button.
8
+
5
9
  def template(&block)
6
10
  div(**attrs, &block)
7
11
  end
@@ -2,17 +2,23 @@
2
2
 
3
3
  module Protos
4
4
  class Component < Phlex::HTML
5
- # DOCS: Base component
5
+ # DOCS: Base component for all Protos::Components. You can inherit from this
6
+ # class to gain flexible components you can style from the outside using css
7
+ # slots, default attrs and themes.
8
+ #
9
+ # This component extends Dry::Initializer and Dry::Core::ClassAttributes to
10
+ # make configuring each class much easier. It also enables gathering up all
11
+ # undefined options and adding them to the html_options hash.
6
12
 
7
13
  extend Dry::Initializer
8
14
  extend Dry::Core::ClassAttributes
9
15
 
10
16
  # Define methods for css and attrs. Each is expected to return a hash
11
- defines :css_method, type: Types::Symbol
12
- defines :attrs_method, type: Types::Symbol
17
+ defines :theme_method, type: Types::Symbol
18
+ defines :default_attrs_method, type: Types::Symbol
13
19
 
14
- css_method :theme
15
- attrs_method :default_attrs
20
+ theme_method :theme
21
+ default_attrs_method :default_attrs
16
22
 
17
23
  # Theme can override the css hash and add additional styles
18
24
  option :theme, as: :theme_override, default: -> { {} }, reader: :private
@@ -53,8 +59,11 @@ module Protos
53
59
  end
54
60
 
55
61
  def build_attrs(...)
56
- defaults = if respond_to?(self.class.attrs_method, :include_private)
57
- send(self.class.attrs_method)
62
+ defaults = if respond_to?(
63
+ self.class.default_attrs_method,
64
+ :include_private
65
+ )
66
+ send(self.class.default_attrs_method)
58
67
  end
59
68
 
60
69
  Attributes
@@ -65,8 +74,11 @@ module Protos
65
74
  end
66
75
 
67
76
  def build_theme(...)
68
- component_style = if respond_to?(self.class.css_method, :include_private)
69
- send(self.class.css_method)
77
+ component_style = if respond_to?(
78
+ self.class.theme_method,
79
+ :include_private
80
+ )
81
+ send(self.class.theme_method)
70
82
  end
71
83
 
72
84
  Theme
@@ -3,6 +3,9 @@
3
3
  module Protos
4
4
  class Drawer
5
5
  class Content < Component
6
+ # DOCS: The content of a drawer. This would be visible at all times and
7
+ # represents the main content of your page.
8
+
6
9
  def template(&block)
7
10
  div(**attrs, &block)
8
11
  end
@@ -3,6 +3,9 @@
3
3
  module Protos
4
4
  class Drawer
5
5
  class Side < Component
6
+ # DOCS: The content that will be shown when you open the drawer using the
7
+ # trigger. This would be hidden until triggered.
8
+
6
9
  option :id, type: Types::Coercible::String
7
10
 
8
11
  def template
@@ -16,7 +19,11 @@ module Protos
16
19
 
17
20
  def theme
18
21
  {
19
- container: tokens("drawer-side", "z-20"),
22
+ container: tokens(
23
+ "drawer-side",
24
+ "z-20",
25
+ "peer-checked:backdrop-blur-sm"
26
+ ),
20
27
  toggle: tokens("drawer-overlay")
21
28
  }
22
29
  end
@@ -3,6 +3,9 @@
3
3
  module Protos
4
4
  class Drawer
5
5
  class Trigger < Component
6
+ # DOCS: The trigger for a drawer. When this is clicked the side will open
7
+ # and overlap the main content with a darker overlay.
8
+
6
9
  option :id, type: Types::Coercible::String
7
10
 
8
11
  def template(&block)
data/lib/protos/drawer.rb CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  module Protos
4
4
  class Drawer < Component
5
+ # DOCS: A drawer component that can be toggled via a trigger. The content of
6
+ # a drawer is displayed at all times and overlapped by the side when the
7
+ # trigger is clicked.
8
+ # https://daisyui.com/components/drawer/
9
+
5
10
  option :id, type: Types::Coercible::String
6
11
 
7
12
  def template
@@ -28,7 +33,7 @@ module Protos
28
33
  def theme
29
34
  {
30
35
  container: tokens("drawer"),
31
- toggle: tokens("drawer-toggle")
36
+ toggle: tokens("drawer-toggle", "peer")
32
37
  }
33
38
  end
34
39
  end
@@ -3,6 +3,8 @@
3
3
  module Protos
4
4
  class Dropdown
5
5
  class Item < Component
6
+ # DOCS: A single item within a dropdown
7
+
6
8
  def template(&block)
7
9
  li(**attrs, &block)
8
10
  end
@@ -3,6 +3,10 @@
3
3
  module Protos
4
4
  class Dropdown
5
5
  class Menu < Popover::Content
6
+ # DOCS: The container for items in a dropdown. This is a restyled
7
+ # Protos::Popover::Content component as the main functionality for
8
+ # dropdowns comes from there.
9
+
6
10
  def template(&block)
7
11
  template_tag(**template_attrs) do
8
12
  ul(**attrs, &block)
@@ -3,6 +3,8 @@
3
3
  module Protos
4
4
  class Dropdown
5
5
  class Trigger < Popover::Trigger
6
+ # DOCS: The trigger for a dropdown. This inherits from the trigger of
7
+ # a popover as the main functionality comes from there.
6
8
  end
7
9
  end
8
10
  end
@@ -2,6 +2,14 @@
2
2
 
3
3
  module Protos
4
4
  class Dropdown < Popover
5
+ # DOCS: A dropdown component is basically a popover with a specific list of
6
+ # items in a menu. It should be preferred to a popover when the content is
7
+ # a list of actions rather than some content in its own right.
8
+ #
9
+ # Dropdowns, and popovers in general, use tippy.js to position content
10
+ # rather than pure CSS for accessibility. The layout of pure CSS was too
11
+ # tricky to get right and we felt the dependency tradeoff was worthwhile.
12
+
5
13
  option :position,
6
14
  type: PositionTypes,
7
15
  default: -> { :bottom },
data/lib/protos/engine.rb CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  module Protos
4
4
  class Engine < ::Rails::Engine
5
+ # DOCS: This is the engine for the Protos gem. It allows autoloading the lib
6
+ # when used inside a Rails app.
7
+
5
8
  config.autoload_paths += Dir["#{config.root}/lib/"]
6
9
  end
7
10
  end
@@ -3,6 +3,9 @@
3
3
  module Protos
4
4
  class Hero
5
5
  class Content < Component
6
+ # DOCS: The content of a hero. This would be centered within the main
7
+ # component container.
8
+
6
9
  def template(&block)
7
10
  div(**attrs, &block)
8
11
  end
@@ -3,6 +3,10 @@
3
3
  module Protos
4
4
  class Hero
5
5
  class Overlay < Component
6
+ # DOCS: The overlay of a hero. This would be used with images to reduce
7
+ # their opacity through the opacity of the overlay. This can be useful to
8
+ # make text readable on noisy images.
9
+
6
10
  def template(&block)
7
11
  div(**attrs, &block)
8
12
  end
data/lib/protos/hero.rb CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  module Protos
4
4
  class Hero < Component
5
+ # DOCS: A hero component for a page. It will center the content an
6
+ # optionally layout an image for a responsive layout.
7
+ # https://daisyui.com/components/hero/
8
+
5
9
  def template(&block)
6
10
  div(**attrs, &block)
7
11
  end
@@ -3,6 +3,10 @@
3
3
  module Protos
4
4
  class List
5
5
  class Item < Component
6
+ # DOCS: A single item within a list. Items are joined so that borders will
7
+ # work for list items, including border radius. E.g. only the first and
8
+ # last items will have border radius on the top and bottom.
9
+
6
10
  def template(&block)
7
11
  li(**attrs, &block)
8
12
  end
data/lib/protos/list.rb CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  module Protos
4
4
  class List < Component
5
+ # DOCS: A list of items that are joined together for easier styling with
6
+ # borders, border radius, etc.
7
+
5
8
  option :ordered, Types::Bool, default: -> { false }, reader: false
6
9
 
7
10
  def template(&block)
@@ -3,6 +3,8 @@
3
3
  module Protos
4
4
  class Modal
5
5
  class CloseButton < Component
6
+ # DOCS: A close button for a modal
7
+
6
8
  def template(&block)
7
9
  form(method: :dialog, class: css[:form]) do
8
10
  button(
@@ -3,6 +3,9 @@
3
3
  module Protos
4
4
  class Modal
5
5
  class Dialog < Component
6
+ # DOCS: A modal dialog. This is the place for the main content of the
7
+ # modal that will be displayed when the trigger is clicked.
8
+
6
9
  def template(&block)
7
10
  dialog(**attrs) do
8
11
  div(class: css[:modal], &block)
@@ -13,7 +16,12 @@ module Protos
13
16
 
14
17
  def theme
15
18
  {
16
- container: tokens("modal", "modal-bottom", "sm:modal-middle"),
19
+ container: tokens(
20
+ "modal",
21
+ "modal-bottom",
22
+ "backdrop-blur-sm",
23
+ "sm:modal-middle"
24
+ ),
17
25
  modal: tokens("modal-box", "flex", "flex-col", "gap-xs")
18
26
  }
19
27
  end
@@ -3,6 +3,8 @@
3
3
  module Protos
4
4
  class Modal
5
5
  class Trigger < Component
6
+ # DOCS: A trigger is a button that opens a modal
7
+
6
8
  def template(&block)
7
9
  button(**attrs, &block)
8
10
  end
data/lib/protos/modal.rb CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  module Protos
4
4
  class Modal < Protos::Component
5
+ # DOCS: A modal component that can be triggered by a button or a link and
6
+ # will open a fullscreen modal, usually with a close button.
7
+
5
8
  def template(&block)
6
9
  div(**attrs, class: css[:container], &block)
7
10
  end
@@ -3,6 +3,11 @@
3
3
  module Protos
4
4
  class Popover
5
5
  class Content < Component
6
+ # DOCS: The content of a popover. We use a <template> element that is
7
+ # added to the DOM by tippy.js to handle the position of the content.
8
+ # This means content in here will not be available in system tests that
9
+ # use rack_test.
10
+
6
11
  def template(&block)
7
12
  template_tag(**template_attrs) do
8
13
  div(**attrs, &block)
@@ -3,6 +3,9 @@
3
3
  module Protos
4
4
  class Popover
5
5
  class Trigger < Component
6
+ # DOCS: The trigger of a popover. This is the element that you would hover
7
+ # or click on to show the popover.
8
+
6
9
  def template(&block)
7
10
  div(**attrs, &block)
8
11
  end
@@ -3,7 +3,14 @@
3
3
  module Protos
4
4
  class Popover < Component
5
5
  # DOCS: Like a dropdown, but instead of a list of menu items, its just
6
- # a rendered block
6
+ # a rendered block. The popover is triggered by a button or link.
7
+ #
8
+ # Dropdowns, and popovers in general, use tippy.js to position content
9
+ # rather than pure CSS for accessibility. The layout of pure CSS was too
10
+ # tricky to get right and we felt the dependency tradeoff was worthwhile.
11
+ #
12
+ # Tippy.js options can be passed in via the `options` attribute or, more
13
+ # conveniently by the typed options listed below.
7
14
 
8
15
  PositionTypes = Types::Coercible::Symbol.enum(
9
16
  :top,
@@ -3,6 +3,8 @@
3
3
  module Protos
4
4
  class Stats
5
5
  class Actions < Component
6
+ # DOCS: A container for the actions (e.g. buttons) for a group of stats
7
+
6
8
  def template(&block)
7
9
  div(**attrs, &block)
8
10
  end
@@ -3,6 +3,8 @@
3
3
  module Protos
4
4
  class Stats
5
5
  class Description < Component
6
+ # DOCS: A description for a group of stats
7
+
6
8
  def template(&block)
7
9
  div(**attrs, &block)
8
10
  end
@@ -3,6 +3,8 @@
3
3
  module Protos
4
4
  class Stats
5
5
  class Figure < Component
6
+ # DOCS: A figure for a single stat
7
+
6
8
  def template(&block)
7
9
  div(**attrs, &block)
8
10
  end
@@ -3,6 +3,8 @@
3
3
  module Protos
4
4
  class Stats
5
5
  class Stat < Component
6
+ # DOCS: A single stat container
7
+
6
8
  def template(&block)
7
9
  div(**attrs, &block)
8
10
  end
@@ -3,6 +3,8 @@
3
3
  module Protos
4
4
  class Stats
5
5
  class Title < Component
6
+ # DOCS: A title for a group of stats
7
+
6
8
  def template(&block)
7
9
  div(**attrs, &block)
8
10
  end
@@ -3,6 +3,8 @@
3
3
  module Protos
4
4
  class Stats
5
5
  class Value < Component
6
+ # DOCS: A value for a single stat
7
+
6
8
  def template(&block)
7
9
  div(**attrs, &block)
8
10
  end
data/lib/protos/stats.rb CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  module Protos
4
4
  class Stats < Component
5
+ # DOCS: Stats component that contains a collection of stats
6
+ # https://daisyui.com/components/stat/
7
+
5
8
  def template(&block)
6
9
  div(**attrs, &block)
7
10
  end
@@ -3,6 +3,8 @@
3
3
  module Protos
4
4
  class Swap
5
5
  class Off < Component
6
+ # DOCS: The off state for a swap component. This is the default state.
7
+
6
8
  def template(&block)
7
9
  div(**attrs, &block)
8
10
  end
@@ -3,6 +3,8 @@
3
3
  module Protos
4
4
  class Swap
5
5
  class On < Component
6
+ # DOCS: The on state for a swap component. This is the active state.
7
+
6
8
  def template(&block)
7
9
  div(**attrs, &block)
8
10
  end
data/lib/protos/swap.rb CHANGED
@@ -2,6 +2,10 @@
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
11
  input(type: :checkbox, class: css[:input])
@@ -3,6 +3,8 @@
3
3
  module Protos
4
4
  class Table
5
5
  class Body < Component
6
+ # DOCS: The body of a table
7
+
6
8
  def template(&block)
7
9
  tbody(**attrs, &block)
8
10
  end
@@ -3,6 +3,8 @@
3
3
  module Protos
4
4
  class Table
5
5
  class Caption < Component
6
+ # DOCS: The caption of a table
7
+
6
8
  def template(&block)
7
9
  caption(**attrs, &block)
8
10
  end