protos 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +12 -0
  4. data/CHANGELOG.md +5 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +150 -0
  7. data/Rakefile +12 -0
  8. data/examples/navbar.rb +43 -0
  9. data/lib/protos/accordion/item.rb +33 -0
  10. data/lib/protos/accordion.rb +34 -0
  11. data/lib/protos/alert/actions.rb +19 -0
  12. data/lib/protos/alert/icon.rb +19 -0
  13. data/lib/protos/alert.rb +46 -0
  14. data/lib/protos/attributes.rb +42 -0
  15. data/lib/protos/avatar.rb +71 -0
  16. data/lib/protos/card/actions.rb +19 -0
  17. data/lib/protos/card/body.rb +19 -0
  18. data/lib/protos/card/image.rb +11 -0
  19. data/lib/protos/card/title.rb +19 -0
  20. data/lib/protos/card.rb +55 -0
  21. data/lib/protos/collapse/content.rb +19 -0
  22. data/lib/protos/collapse/title.rb +19 -0
  23. data/lib/protos/collapse.rb +31 -0
  24. data/lib/protos/combobox.rb +53 -0
  25. data/lib/protos/command/dialog.rb +32 -0
  26. data/lib/protos/command/empty.rb +25 -0
  27. data/lib/protos/command/group.rb +13 -0
  28. data/lib/protos/command/input.rb +44 -0
  29. data/lib/protos/command/item.rb +19 -0
  30. data/lib/protos/command/list.rb +19 -0
  31. data/lib/protos/command/title.rb +19 -0
  32. data/lib/protos/command/trigger.rb +19 -0
  33. data/lib/protos/command.rb +49 -0
  34. data/lib/protos/component.rb +79 -0
  35. data/lib/protos/drawer/content.rb +19 -0
  36. data/lib/protos/drawer/side.rb +25 -0
  37. data/lib/protos/drawer/trigger.rb +21 -0
  38. data/lib/protos/drawer.rb +35 -0
  39. data/lib/protos/dropdown/item.rb +11 -0
  40. data/lib/protos/dropdown/menu.rb +25 -0
  41. data/lib/protos/dropdown/trigger.rb +11 -0
  42. data/lib/protos/dropdown.rb +59 -0
  43. data/lib/protos/engine.rb +7 -0
  44. data/lib/protos/list/item.rb +22 -0
  45. data/lib/protos/list.rb +30 -0
  46. data/lib/protos/modal/close_button.rb +16 -0
  47. data/lib/protos/modal/dialog.rb +30 -0
  48. data/lib/protos/modal/trigger.rb +19 -0
  49. data/lib/protos/modal.rb +31 -0
  50. data/lib/protos/popover/content.rb +19 -0
  51. data/lib/protos/popover/trigger.rb +11 -0
  52. data/lib/protos/popover.rb +54 -0
  53. data/lib/protos/table/body.rb +11 -0
  54. data/lib/protos/table/caption.rb +19 -0
  55. data/lib/protos/table/cell.rb +11 -0
  56. data/lib/protos/table/footer.rb +11 -0
  57. data/lib/protos/table/head.rb +11 -0
  58. data/lib/protos/table/header.rb +11 -0
  59. data/lib/protos/table/row.rb +11 -0
  60. data/lib/protos/table.rb +48 -0
  61. data/lib/protos/theme.rb +76 -0
  62. data/lib/protos/timeline/center.rb +19 -0
  63. data/lib/protos/timeline/item.rb +11 -0
  64. data/lib/protos/timeline/left.rb +19 -0
  65. data/lib/protos/timeline/right.rb +19 -0
  66. data/lib/protos/timeline.rb +38 -0
  67. data/lib/protos/token_list.rb +41 -0
  68. data/lib/protos/types.rb +32 -0
  69. data/lib/protos/typography/heading.rb +44 -0
  70. data/lib/protos/typography/inline_link.rb +24 -0
  71. data/lib/protos/typography/paragraph.rb +22 -0
  72. data/lib/protos/typography.rb +29 -0
  73. data/lib/protos/version.rb +5 -0
  74. data/lib/protos.rb +94 -0
  75. data/protos.gemspec +45 -0
  76. metadata +180 -0
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Protos
4
+ module Typography
5
+ class Paragraph < Component
6
+ def template(&block)
7
+ p(**attrs, &block)
8
+ end
9
+
10
+ private
11
+
12
+ def theme
13
+ {
14
+ container: tokens(
15
+ "leading-relaxed",
16
+ "[&:not(:first-child)]:mt-sm"
17
+ )
18
+ }
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Protos
4
+ module Typography
5
+ def h1(**options, &block)
6
+ render(Heading.new(level: 1, size: :xl, **options), &block)
7
+ end
8
+
9
+ def h2(**options, &block)
10
+ render(Heading.new(level: 2, size: :lg, **options), &block)
11
+ end
12
+
13
+ def h3(**options, &block)
14
+ render(Heading.new(level: 3, size: :md, **options), &block)
15
+ end
16
+
17
+ def h4(**options, &block)
18
+ render(Heading.new(level: 4, size: :sm, **options), &block)
19
+ end
20
+
21
+ def p(**options, &block)
22
+ render(Paragraph.new(**options), &block)
23
+ end
24
+
25
+ def inline_a(**options, &block)
26
+ render(InlineLink.new(**options), &block)
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Protos
4
+ VERSION = "0.1.0"
5
+ end
data/lib/protos.rb ADDED
@@ -0,0 +1,94 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "dry-types"
4
+ require "dry-initializer"
5
+ require "phlex"
6
+
7
+ module Protos
8
+ class Error < StandardError; end
9
+
10
+ if defined?(Rails)
11
+ require_relative "protos/engine"
12
+ else
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/card"
31
+ require_relative "protos/card/body"
32
+ require_relative "protos/card/title"
33
+ require_relative "protos/card/actions"
34
+ require_relative "protos/card/image"
35
+
36
+ require_relative "protos/collapse"
37
+ require_relative "protos/collapse/title"
38
+ require_relative "protos/collapse/content"
39
+
40
+ require_relative "protos/combobox"
41
+
42
+ require_relative "protos/command"
43
+ require_relative "protos/command/input"
44
+ require_relative "protos/command/dialog"
45
+ require_relative "protos/command/group"
46
+ require_relative "protos/command/list"
47
+ require_relative "protos/command/trigger"
48
+ require_relative "protos/command/title"
49
+ require_relative "protos/command/item"
50
+ require_relative "protos/command/empty"
51
+
52
+ require_relative "protos/drawer"
53
+ require_relative "protos/drawer/side"
54
+ require_relative "protos/drawer/trigger"
55
+ require_relative "protos/drawer/content"
56
+
57
+ require_relative "protos/dropdown"
58
+ require_relative "protos/dropdown/item"
59
+ require_relative "protos/dropdown/menu"
60
+ require_relative "protos/dropdown/trigger"
61
+
62
+ require_relative "protos/list"
63
+ require_relative "protos/list/item"
64
+
65
+ require_relative "protos/modal"
66
+ require_relative "protos/modal/close_button"
67
+ require_relative "protos/modal/dialog"
68
+ require_relative "protos/modal/trigger"
69
+
70
+ require_relative "protos/popover"
71
+ require_relative "protos/popover/trigger"
72
+ require_relative "protos/popover/content"
73
+
74
+ require_relative "protos/table"
75
+ require_relative "protos/table/caption"
76
+ require_relative "protos/table/header"
77
+ require_relative "protos/table/head"
78
+ require_relative "protos/table/body"
79
+ require_relative "protos/table/footer"
80
+ require_relative "protos/table/row"
81
+ require_relative "protos/table/cell"
82
+
83
+ require_relative "protos/timeline"
84
+ require_relative "protos/timeline/item"
85
+ require_relative "protos/timeline/left"
86
+ require_relative "protos/timeline/center"
87
+ require_relative "protos/timeline/right"
88
+
89
+ require_relative "protos/typography"
90
+ require_relative "protos/typography/heading"
91
+ require_relative "protos/typography/paragraph"
92
+ require_relative "protos/typography/inline_link"
93
+ end
94
+ end
data/protos.gemspec ADDED
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/protos/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "protos"
7
+ spec.version = Protos::VERSION
8
+ spec.authors = ["Nolan J Tait"]
9
+ spec.email = ["nolanjtait@gmail.com"]
10
+
11
+ spec.summary = "A UI component library built with phlex and daisyui"
12
+ spec.description = "A UI component library built with phlex and daisyui"
13
+ spec.homepage = "https://github.com/inhouse-work/protos"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 3.1"
16
+ spec.requirements << "tailwindcss"
17
+ spec.requirements << "daisyui"
18
+ spec.requirements << "protos-stimulus"
19
+
20
+ spec.metadata["homepage_uri"] = spec.homepage
21
+ spec.metadata["source_code_uri"] = spec.homepage
22
+ spec.metadata["changelog_uri"] = spec.homepage
23
+
24
+ # Specify which files should be added to the gem when it is released. The `git
25
+ # ls-files -z` loads the files in the RubyGem that have been added into git.
26
+ spec.files = Dir.chdir(__dir__) do
27
+ `git ls-files -z`.split("\x0").reject do |f|
28
+ (File.expand_path(f) == __FILE__) ||
29
+ f.start_with?(*%w[bin/ test/ spec/ features/ .git appveyor Gemfile])
30
+ end
31
+ end
32
+ spec.bindir = "exe"
33
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
34
+ spec.require_paths = ["lib"]
35
+
36
+ # Uncomment to register a new dependency of your gem
37
+ spec.add_dependency "dry-core", "~> 1.0"
38
+ spec.add_dependency "dry-initializer", "~> 3.1"
39
+ spec.add_dependency "dry-types", "~> 1.7"
40
+ spec.add_dependency "phlex", "~> 1.9"
41
+
42
+ # For more information and examples about making a new gem, check out our
43
+ # guide at: https://bundler.io/guides/creating_gem.html
44
+ spec.metadata["rubygems_mfa_required"] = "true"
45
+ end
metadata ADDED
@@ -0,0 +1,180 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: protos
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Nolan J Tait
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2024-03-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dry-core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: dry-initializer
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: dry-types
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: phlex
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.9'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.9'
69
+ description: A UI component library built with phlex and daisyui
70
+ email:
71
+ - nolanjtait@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".rspec"
77
+ - ".rubocop.yml"
78
+ - CHANGELOG.md
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - examples/navbar.rb
83
+ - lib/protos.rb
84
+ - lib/protos/accordion.rb
85
+ - lib/protos/accordion/item.rb
86
+ - lib/protos/alert.rb
87
+ - lib/protos/alert/actions.rb
88
+ - lib/protos/alert/icon.rb
89
+ - lib/protos/attributes.rb
90
+ - lib/protos/avatar.rb
91
+ - lib/protos/card.rb
92
+ - lib/protos/card/actions.rb
93
+ - lib/protos/card/body.rb
94
+ - lib/protos/card/image.rb
95
+ - lib/protos/card/title.rb
96
+ - lib/protos/collapse.rb
97
+ - lib/protos/collapse/content.rb
98
+ - lib/protos/collapse/title.rb
99
+ - lib/protos/combobox.rb
100
+ - lib/protos/command.rb
101
+ - lib/protos/command/dialog.rb
102
+ - lib/protos/command/empty.rb
103
+ - lib/protos/command/group.rb
104
+ - lib/protos/command/input.rb
105
+ - lib/protos/command/item.rb
106
+ - lib/protos/command/list.rb
107
+ - lib/protos/command/title.rb
108
+ - lib/protos/command/trigger.rb
109
+ - lib/protos/component.rb
110
+ - lib/protos/drawer.rb
111
+ - lib/protos/drawer/content.rb
112
+ - lib/protos/drawer/side.rb
113
+ - lib/protos/drawer/trigger.rb
114
+ - lib/protos/dropdown.rb
115
+ - lib/protos/dropdown/item.rb
116
+ - lib/protos/dropdown/menu.rb
117
+ - lib/protos/dropdown/trigger.rb
118
+ - lib/protos/engine.rb
119
+ - lib/protos/list.rb
120
+ - lib/protos/list/item.rb
121
+ - lib/protos/modal.rb
122
+ - lib/protos/modal/close_button.rb
123
+ - lib/protos/modal/dialog.rb
124
+ - lib/protos/modal/trigger.rb
125
+ - lib/protos/popover.rb
126
+ - lib/protos/popover/content.rb
127
+ - lib/protos/popover/trigger.rb
128
+ - lib/protos/table.rb
129
+ - lib/protos/table/body.rb
130
+ - lib/protos/table/caption.rb
131
+ - lib/protos/table/cell.rb
132
+ - lib/protos/table/footer.rb
133
+ - lib/protos/table/head.rb
134
+ - lib/protos/table/header.rb
135
+ - lib/protos/table/row.rb
136
+ - lib/protos/theme.rb
137
+ - lib/protos/timeline.rb
138
+ - lib/protos/timeline/center.rb
139
+ - lib/protos/timeline/item.rb
140
+ - lib/protos/timeline/left.rb
141
+ - lib/protos/timeline/right.rb
142
+ - lib/protos/token_list.rb
143
+ - lib/protos/types.rb
144
+ - lib/protos/typography.rb
145
+ - lib/protos/typography/heading.rb
146
+ - lib/protos/typography/inline_link.rb
147
+ - lib/protos/typography/paragraph.rb
148
+ - lib/protos/version.rb
149
+ - protos.gemspec
150
+ homepage: https://github.com/inhouse-work/protos
151
+ licenses:
152
+ - MIT
153
+ metadata:
154
+ homepage_uri: https://github.com/inhouse-work/protos
155
+ source_code_uri: https://github.com/inhouse-work/protos
156
+ changelog_uri: https://github.com/inhouse-work/protos
157
+ rubygems_mfa_required: 'true'
158
+ post_install_message:
159
+ rdoc_options: []
160
+ require_paths:
161
+ - lib
162
+ required_ruby_version: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '3.1'
167
+ required_rubygems_version: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - ">="
170
+ - !ruby/object:Gem::Version
171
+ version: '0'
172
+ requirements:
173
+ - tailwindcss
174
+ - daisyui
175
+ - protos-stimulus
176
+ rubygems_version: 3.5.3
177
+ signing_key:
178
+ specification_version: 4
179
+ summary: A UI component library built with phlex and daisyui
180
+ test_files: []