brainzlab-ui 0.1.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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +13 -0
- data/LICENSE +21 -0
- data/README.md +67 -0
- data/app/assets/stylesheets/brainzlab_ui/animations.css +171 -0
- data/app/assets/stylesheets/brainzlab_ui/base.css +23 -0
- data/app/assets/stylesheets/brainzlab_ui/components.css +496 -0
- data/app/assets/stylesheets/brainzlab_ui/tokens.css +121 -0
- data/app/assets/stylesheets/brainzlab_ui/utilities.css +262 -0
- data/lib/brainzlab/components/alert.rb +29 -0
- data/lib/brainzlab/components/avatar.rb +52 -0
- data/lib/brainzlab/components/badge.rb +31 -0
- data/lib/brainzlab/components/base.rb +15 -0
- data/lib/brainzlab/components/button.rb +50 -0
- data/lib/brainzlab/components/card.rb +58 -0
- data/lib/brainzlab/components/empty_state.rb +32 -0
- data/lib/brainzlab/components/input.rb +97 -0
- data/lib/brainzlab/components/modal.rb +60 -0
- data/lib/brainzlab/components/nav_item.rb +32 -0
- data/lib/brainzlab/components/stat_card.rb +35 -0
- data/lib/brainzlab/components/table.rb +67 -0
- data/lib/brainzlab/ui/engine.rb +28 -0
- data/lib/brainzlab/ui/version.rb +7 -0
- data/lib/brainzlab/ui.rb +33 -0
- data/lib/brainzlab-ui.rb +3 -0
- data/lib/brainzlab_ui.rb +3 -0
- metadata +139 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brainzlab
|
|
4
|
+
module Components
|
|
5
|
+
class NavItem < Base
|
|
6
|
+
def initialize(href: "#", active: false, **attrs)
|
|
7
|
+
@href = href
|
|
8
|
+
@active = active
|
|
9
|
+
@attrs = attrs
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def view_template(&)
|
|
13
|
+
a(
|
|
14
|
+
href: @href,
|
|
15
|
+
class: nav_item_classes,
|
|
16
|
+
**@attrs,
|
|
17
|
+
&
|
|
18
|
+
)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def nav_item_classes
|
|
24
|
+
classes(
|
|
25
|
+
"nav-item",
|
|
26
|
+
@active ? "active" : nil,
|
|
27
|
+
@attrs[:class]
|
|
28
|
+
)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brainzlab
|
|
4
|
+
module Components
|
|
5
|
+
class StatCard < Base
|
|
6
|
+
def initialize(label:, value:, change: nil, change_type: nil, **attrs)
|
|
7
|
+
@label = label
|
|
8
|
+
@value = value
|
|
9
|
+
@change = change
|
|
10
|
+
@change_type = change_type
|
|
11
|
+
@attrs = attrs
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def view_template
|
|
15
|
+
div(class: classes("stat-card", @attrs[:class]), **@attrs.except(:class)) do
|
|
16
|
+
div(class: "stat-label") { @label }
|
|
17
|
+
div(class: "stat-value") { @value }
|
|
18
|
+
if @change
|
|
19
|
+
span(class: change_classes) { @change }
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
def change_classes
|
|
27
|
+
classes(
|
|
28
|
+
"stat-change",
|
|
29
|
+
@change_type == :positive ? "stat-change-positive" : nil,
|
|
30
|
+
@change_type == :negative ? "stat-change-negative" : nil
|
|
31
|
+
)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brainzlab
|
|
4
|
+
module Components
|
|
5
|
+
class Table < Base
|
|
6
|
+
def initialize(**attrs)
|
|
7
|
+
@attrs = attrs
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def view_template(&)
|
|
11
|
+
div(class: "table-wrapper") do
|
|
12
|
+
table(class: classes("table", @attrs[:class]), **@attrs.except(:class), &)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class TableHeader < Base
|
|
18
|
+
def initialize(**attrs)
|
|
19
|
+
@attrs = attrs
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def view_template(&)
|
|
23
|
+
thead(**@attrs, &)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
class TableBody < Base
|
|
28
|
+
def initialize(**attrs)
|
|
29
|
+
@attrs = attrs
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def view_template(&)
|
|
33
|
+
tbody(**@attrs, &)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
class TableRow < Base
|
|
38
|
+
def initialize(**attrs)
|
|
39
|
+
@attrs = attrs
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def view_template(&)
|
|
43
|
+
tr(**@attrs, &)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
class TableHead < Base
|
|
48
|
+
def initialize(**attrs)
|
|
49
|
+
@attrs = attrs
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def view_template(&)
|
|
53
|
+
th(**@attrs, &)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
class TableCell < Base
|
|
58
|
+
def initialize(**attrs)
|
|
59
|
+
@attrs = attrs
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def view_template(&)
|
|
63
|
+
td(**@attrs, &)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Brainzlab
|
|
4
|
+
module UI
|
|
5
|
+
class Engine < ::Rails::Engine
|
|
6
|
+
isolate_namespace Brainzlab::UI
|
|
7
|
+
|
|
8
|
+
initializer "brainzlab_ui.assets" do |app|
|
|
9
|
+
# Add stylesheets to the asset pipeline
|
|
10
|
+
app.config.assets.paths << root.join("app/assets/stylesheets")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
initializer "brainzlab_ui.phlex" do
|
|
14
|
+
# Ensure Phlex components are available
|
|
15
|
+
ActiveSupport.on_load(:action_view) do
|
|
16
|
+
include Phlex::Rails::HelperMacros if defined?(Phlex::Rails::HelperMacros)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
config.to_prepare do
|
|
21
|
+
# Eager load components in development
|
|
22
|
+
Dir.glob(Brainzlab::UI.root.join("lib/brainzlab/components/*.rb")).each do |file|
|
|
23
|
+
require file
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
data/lib/brainzlab/ui.rb
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "ui/version"
|
|
4
|
+
|
|
5
|
+
module Brainzlab
|
|
6
|
+
module UI
|
|
7
|
+
class Error < StandardError; end
|
|
8
|
+
|
|
9
|
+
class << self
|
|
10
|
+
def root
|
|
11
|
+
@root ||= Pathname.new(File.expand_path("../..", __dir__))
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Shorthand for components
|
|
17
|
+
module Components
|
|
18
|
+
autoload :Base, "brainzlab/components/base"
|
|
19
|
+
autoload :Button, "brainzlab/components/button"
|
|
20
|
+
autoload :Card, "brainzlab/components/card"
|
|
21
|
+
autoload :Badge, "brainzlab/components/badge"
|
|
22
|
+
autoload :Input, "brainzlab/components/input"
|
|
23
|
+
autoload :Alert, "brainzlab/components/alert"
|
|
24
|
+
autoload :Avatar, "brainzlab/components/avatar"
|
|
25
|
+
autoload :Table, "brainzlab/components/table"
|
|
26
|
+
autoload :NavItem, "brainzlab/components/nav_item"
|
|
27
|
+
autoload :StatCard, "brainzlab/components/stat_card"
|
|
28
|
+
autoload :EmptyState, "brainzlab/components/empty_state"
|
|
29
|
+
autoload :Modal, "brainzlab/components/modal"
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
require_relative "ui/engine" if defined?(Rails::Engine)
|
data/lib/brainzlab-ui.rb
ADDED
data/lib/brainzlab_ui.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: brainzlab-ui
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Brainz Lab
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: phlex
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '2.0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '2.0'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: phlex-rails
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '2.0'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '2.0'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: rails
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '7.0'
|
|
47
|
+
type: :runtime
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '7.0'
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: rake
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - "~>"
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '13.0'
|
|
61
|
+
type: :development
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - "~>"
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '13.0'
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: rspec
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - "~>"
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '3.12'
|
|
75
|
+
type: :development
|
|
76
|
+
prerelease: false
|
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - "~>"
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '3.12'
|
|
82
|
+
description: Anthropic/Claude-inspired design system with Phlex components, Tailwind
|
|
83
|
+
CSS tokens, and reusable UI patterns.
|
|
84
|
+
email:
|
|
85
|
+
- team@brainzlab.ai
|
|
86
|
+
executables: []
|
|
87
|
+
extensions: []
|
|
88
|
+
extra_rdoc_files: []
|
|
89
|
+
files:
|
|
90
|
+
- CHANGELOG.md
|
|
91
|
+
- LICENSE
|
|
92
|
+
- README.md
|
|
93
|
+
- app/assets/stylesheets/brainzlab_ui/animations.css
|
|
94
|
+
- app/assets/stylesheets/brainzlab_ui/base.css
|
|
95
|
+
- app/assets/stylesheets/brainzlab_ui/components.css
|
|
96
|
+
- app/assets/stylesheets/brainzlab_ui/tokens.css
|
|
97
|
+
- app/assets/stylesheets/brainzlab_ui/utilities.css
|
|
98
|
+
- lib/brainzlab-ui.rb
|
|
99
|
+
- lib/brainzlab/components/alert.rb
|
|
100
|
+
- lib/brainzlab/components/avatar.rb
|
|
101
|
+
- lib/brainzlab/components/badge.rb
|
|
102
|
+
- lib/brainzlab/components/base.rb
|
|
103
|
+
- lib/brainzlab/components/button.rb
|
|
104
|
+
- lib/brainzlab/components/card.rb
|
|
105
|
+
- lib/brainzlab/components/empty_state.rb
|
|
106
|
+
- lib/brainzlab/components/input.rb
|
|
107
|
+
- lib/brainzlab/components/modal.rb
|
|
108
|
+
- lib/brainzlab/components/nav_item.rb
|
|
109
|
+
- lib/brainzlab/components/stat_card.rb
|
|
110
|
+
- lib/brainzlab/components/table.rb
|
|
111
|
+
- lib/brainzlab/ui.rb
|
|
112
|
+
- lib/brainzlab/ui/engine.rb
|
|
113
|
+
- lib/brainzlab/ui/version.rb
|
|
114
|
+
- lib/brainzlab_ui.rb
|
|
115
|
+
homepage: https://github.com/brainzlab/brainzlab-ui
|
|
116
|
+
licenses:
|
|
117
|
+
- MIT
|
|
118
|
+
metadata:
|
|
119
|
+
homepage_uri: https://github.com/brainzlab/brainzlab-ui
|
|
120
|
+
source_code_uri: https://github.com/brainzlab/brainzlab-ui
|
|
121
|
+
changelog_uri: https://github.com/brainzlab/brainzlab-ui/blob/main/CHANGELOG.md
|
|
122
|
+
rdoc_options: []
|
|
123
|
+
require_paths:
|
|
124
|
+
- lib
|
|
125
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
126
|
+
requirements:
|
|
127
|
+
- - ">="
|
|
128
|
+
- !ruby/object:Gem::Version
|
|
129
|
+
version: 3.2.0
|
|
130
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
|
+
requirements:
|
|
132
|
+
- - ">="
|
|
133
|
+
- !ruby/object:Gem::Version
|
|
134
|
+
version: '0'
|
|
135
|
+
requirements: []
|
|
136
|
+
rubygems_version: 3.6.9
|
|
137
|
+
specification_version: 4
|
|
138
|
+
summary: Unified design system for Brainz Lab products
|
|
139
|
+
test_files: []
|