brainzlab-ui 0.1.0 → 0.2.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 +4 -4
- data/CHANGELOG.md +14 -0
- data/LICENSE +7 -17
- data/README.md +110 -14
- data/app/assets/stylesheets/brainzlab_ui/animations.css +11 -2
- data/app/assets/stylesheets/brainzlab_ui/base.css +3 -0
- data/app/assets/stylesheets/brainzlab_ui/components.css +556 -11
- data/app/assets/stylesheets/brainzlab_ui/dark-mode.css +317 -0
- data/app/assets/stylesheets/brainzlab_ui/tokens.css +221 -19
- data/app/assets/stylesheets/brainzlab_ui/utilities.css +319 -4
- data/lib/brainzlab/components/alert.rb +6 -6
- data/lib/brainzlab/components/avatar.rb +10 -9
- data/lib/brainzlab/components/badge.rb +7 -7
- data/lib/brainzlab/components/base.rb +2 -2
- data/lib/brainzlab/components/button.rb +8 -8
- data/lib/brainzlab/components/card.rb +6 -6
- data/lib/brainzlab/components/empty_state.rb +5 -11
- data/lib/brainzlab/components/input.rb +8 -8
- data/lib/brainzlab/components/maturity_badge.rb +32 -0
- data/lib/brainzlab/components/modal.rb +10 -10
- data/lib/brainzlab/components/nav_item.rb +3 -3
- data/lib/brainzlab/components/stat_card.rb +7 -9
- data/lib/brainzlab/components/table.rb +2 -2
- data/lib/brainzlab/ui/engine.rb +4 -4
- data/lib/brainzlab/ui/version.rb +1 -1
- data/lib/brainzlab/ui.rb +16 -15
- data/lib/brainzlab-ui.rb +1 -1
- data/lib/brainzlab_ui.rb +1 -1
- metadata +4 -1
|
@@ -4,10 +4,10 @@ module Brainzlab
|
|
|
4
4
|
module Components
|
|
5
5
|
class Modal < Base
|
|
6
6
|
SIZES = {
|
|
7
|
-
sm:
|
|
8
|
-
md:
|
|
9
|
-
lg:
|
|
10
|
-
xl:
|
|
7
|
+
sm: 'modal-sm',
|
|
8
|
+
md: 'modal-md',
|
|
9
|
+
lg: 'modal-lg',
|
|
10
|
+
xl: 'modal-xl'
|
|
11
11
|
}.freeze
|
|
12
12
|
|
|
13
13
|
def initialize(size: :md, **attrs)
|
|
@@ -16,14 +16,14 @@ module Brainzlab
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def view_template(&)
|
|
19
|
-
div(class:
|
|
20
|
-
div(class: modal_classes, role:
|
|
19
|
+
div(class: 'modal-overlay', data: { modal_target: 'overlay' })
|
|
20
|
+
div(class: modal_classes, role: 'dialog', **@attrs, &)
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
private
|
|
24
24
|
|
|
25
25
|
def modal_classes
|
|
26
|
-
classes(
|
|
26
|
+
classes('modal', SIZES[@size], @attrs[:class])
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
@@ -33,7 +33,7 @@ module Brainzlab
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def view_template(&)
|
|
36
|
-
div(class: classes(
|
|
36
|
+
div(class: classes('modal-header', @attrs[:class]), **@attrs.except(:class), &)
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
|
|
@@ -43,7 +43,7 @@ module Brainzlab
|
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
def view_template(&)
|
|
46
|
-
div(class: classes(
|
|
46
|
+
div(class: classes('modal-body', @attrs[:class]), **@attrs.except(:class), &)
|
|
47
47
|
end
|
|
48
48
|
end
|
|
49
49
|
|
|
@@ -53,7 +53,7 @@ module Brainzlab
|
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
def view_template(&)
|
|
56
|
-
div(class: classes(
|
|
56
|
+
div(class: classes('modal-footer', @attrs[:class]), **@attrs.except(:class), &)
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
end
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module Brainzlab
|
|
4
4
|
module Components
|
|
5
5
|
class NavItem < Base
|
|
6
|
-
def initialize(href:
|
|
6
|
+
def initialize(href: '#', active: false, **attrs)
|
|
7
7
|
@href = href
|
|
8
8
|
@active = active
|
|
9
9
|
@attrs = attrs
|
|
@@ -22,8 +22,8 @@ module Brainzlab
|
|
|
22
22
|
|
|
23
23
|
def nav_item_classes
|
|
24
24
|
classes(
|
|
25
|
-
|
|
26
|
-
@active ?
|
|
25
|
+
'nav-item',
|
|
26
|
+
@active ? 'active' : nil,
|
|
27
27
|
@attrs[:class]
|
|
28
28
|
)
|
|
29
29
|
end
|
|
@@ -12,12 +12,10 @@ module Brainzlab
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def view_template
|
|
15
|
-
div(class: classes(
|
|
16
|
-
div(class:
|
|
17
|
-
div(class:
|
|
18
|
-
if @change
|
|
19
|
-
span(class: change_classes) { @change }
|
|
20
|
-
end
|
|
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
|
+
span(class: change_classes) { @change } if @change
|
|
21
19
|
end
|
|
22
20
|
end
|
|
23
21
|
|
|
@@ -25,9 +23,9 @@ module Brainzlab
|
|
|
25
23
|
|
|
26
24
|
def change_classes
|
|
27
25
|
classes(
|
|
28
|
-
|
|
29
|
-
@change_type == :positive ?
|
|
30
|
-
@change_type == :negative ?
|
|
26
|
+
'stat-change',
|
|
27
|
+
@change_type == :positive ? 'stat-change-positive' : nil,
|
|
28
|
+
@change_type == :negative ? 'stat-change-negative' : nil
|
|
31
29
|
)
|
|
32
30
|
end
|
|
33
31
|
end
|
|
@@ -8,8 +8,8 @@ module Brainzlab
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def view_template(&)
|
|
11
|
-
div(class:
|
|
12
|
-
table(class: classes(
|
|
11
|
+
div(class: 'table-wrapper') do
|
|
12
|
+
table(class: classes('table', @attrs[:class]), **@attrs.except(:class), &)
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
end
|
data/lib/brainzlab/ui/engine.rb
CHANGED
|
@@ -5,12 +5,12 @@ module Brainzlab
|
|
|
5
5
|
class Engine < ::Rails::Engine
|
|
6
6
|
isolate_namespace Brainzlab::UI
|
|
7
7
|
|
|
8
|
-
initializer
|
|
8
|
+
initializer 'brainzlab_ui.assets' do |app|
|
|
9
9
|
# Add stylesheets to the asset pipeline
|
|
10
|
-
app.config.assets.paths << root.join(
|
|
10
|
+
app.config.assets.paths << root.join('app/assets/stylesheets')
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
initializer
|
|
13
|
+
initializer 'brainzlab_ui.phlex' do
|
|
14
14
|
# Ensure Phlex components are available
|
|
15
15
|
ActiveSupport.on_load(:action_view) do
|
|
16
16
|
include Phlex::Rails::HelperMacros if defined?(Phlex::Rails::HelperMacros)
|
|
@@ -19,7 +19,7 @@ module Brainzlab
|
|
|
19
19
|
|
|
20
20
|
config.to_prepare do
|
|
21
21
|
# Eager load components in development
|
|
22
|
-
Dir.glob(Brainzlab::UI.root.join(
|
|
22
|
+
Dir.glob(Brainzlab::UI.root.join('lib/brainzlab/components/*.rb')).each do |file|
|
|
23
23
|
require file
|
|
24
24
|
end
|
|
25
25
|
end
|
data/lib/brainzlab/ui/version.rb
CHANGED
data/lib/brainzlab/ui.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative
|
|
3
|
+
require_relative 'ui/version'
|
|
4
4
|
|
|
5
5
|
module Brainzlab
|
|
6
6
|
module UI
|
|
@@ -8,26 +8,27 @@ module Brainzlab
|
|
|
8
8
|
|
|
9
9
|
class << self
|
|
10
10
|
def root
|
|
11
|
-
@root ||= Pathname.new(File.expand_path(
|
|
11
|
+
@root ||= Pathname.new(File.expand_path('../..', __dir__))
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
# Shorthand for components
|
|
17
17
|
module Components
|
|
18
|
-
autoload :Base,
|
|
19
|
-
autoload :Button,
|
|
20
|
-
autoload :Card,
|
|
21
|
-
autoload :Badge,
|
|
22
|
-
autoload :
|
|
23
|
-
autoload :
|
|
24
|
-
autoload :
|
|
25
|
-
autoload :
|
|
26
|
-
autoload :
|
|
27
|
-
autoload :
|
|
28
|
-
autoload :
|
|
29
|
-
autoload :
|
|
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 :MaturityBadge, 'brainzlab/components/maturity_badge'
|
|
23
|
+
autoload :Input, 'brainzlab/components/input'
|
|
24
|
+
autoload :Alert, 'brainzlab/components/alert'
|
|
25
|
+
autoload :Avatar, 'brainzlab/components/avatar'
|
|
26
|
+
autoload :Table, 'brainzlab/components/table'
|
|
27
|
+
autoload :NavItem, 'brainzlab/components/nav_item'
|
|
28
|
+
autoload :StatCard, 'brainzlab/components/stat_card'
|
|
29
|
+
autoload :EmptyState, 'brainzlab/components/empty_state'
|
|
30
|
+
autoload :Modal, 'brainzlab/components/modal'
|
|
30
31
|
end
|
|
31
32
|
end
|
|
32
33
|
|
|
33
|
-
require_relative
|
|
34
|
+
require_relative 'ui/engine' if defined?(Rails::Engine)
|
data/lib/brainzlab-ui.rb
CHANGED
data/lib/brainzlab_ui.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: brainzlab-ui
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brainz Lab
|
|
@@ -93,6 +93,7 @@ files:
|
|
|
93
93
|
- app/assets/stylesheets/brainzlab_ui/animations.css
|
|
94
94
|
- app/assets/stylesheets/brainzlab_ui/base.css
|
|
95
95
|
- app/assets/stylesheets/brainzlab_ui/components.css
|
|
96
|
+
- app/assets/stylesheets/brainzlab_ui/dark-mode.css
|
|
96
97
|
- app/assets/stylesheets/brainzlab_ui/tokens.css
|
|
97
98
|
- app/assets/stylesheets/brainzlab_ui/utilities.css
|
|
98
99
|
- lib/brainzlab-ui.rb
|
|
@@ -104,6 +105,7 @@ files:
|
|
|
104
105
|
- lib/brainzlab/components/card.rb
|
|
105
106
|
- lib/brainzlab/components/empty_state.rb
|
|
106
107
|
- lib/brainzlab/components/input.rb
|
|
108
|
+
- lib/brainzlab/components/maturity_badge.rb
|
|
107
109
|
- lib/brainzlab/components/modal.rb
|
|
108
110
|
- lib/brainzlab/components/nav_item.rb
|
|
109
111
|
- lib/brainzlab/components/stat_card.rb
|
|
@@ -119,6 +121,7 @@ metadata:
|
|
|
119
121
|
homepage_uri: https://github.com/brainzlab/brainzlab-ui
|
|
120
122
|
source_code_uri: https://github.com/brainzlab/brainzlab-ui
|
|
121
123
|
changelog_uri: https://github.com/brainzlab/brainzlab-ui/blob/main/CHANGELOG.md
|
|
124
|
+
rubygems_mfa_required: 'true'
|
|
122
125
|
rdoc_options: []
|
|
123
126
|
require_paths:
|
|
124
127
|
- lib
|