brainzlab-ui 0.1.0 → 0.1.1
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/LICENSE +7 -17
- data/README.md +92 -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 +504 -11
- data/app/assets/stylesheets/brainzlab_ui/dark-mode.css +317 -0
- data/app/assets/stylesheets/brainzlab_ui/tokens.css +170 -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/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 +15 -15
- data/lib/brainzlab-ui.rb +1 -1
- data/lib/brainzlab_ui.rb +1 -1
- metadata +3 -1
|
@@ -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,26 @@ 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 :Input,
|
|
23
|
-
autoload :Alert,
|
|
24
|
-
autoload :Avatar,
|
|
25
|
-
autoload :Table,
|
|
26
|
-
autoload :NavItem,
|
|
27
|
-
autoload :StatCard,
|
|
28
|
-
autoload :EmptyState,
|
|
29
|
-
autoload :Modal,
|
|
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
30
|
end
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
require_relative
|
|
33
|
+
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.1.
|
|
4
|
+
version: 0.1.1
|
|
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
|
|
@@ -119,6 +120,7 @@ metadata:
|
|
|
119
120
|
homepage_uri: https://github.com/brainzlab/brainzlab-ui
|
|
120
121
|
source_code_uri: https://github.com/brainzlab/brainzlab-ui
|
|
121
122
|
changelog_uri: https://github.com/brainzlab/brainzlab-ui/blob/main/CHANGELOG.md
|
|
123
|
+
rubygems_mfa_required: 'true'
|
|
122
124
|
rdoc_options: []
|
|
123
125
|
require_paths:
|
|
124
126
|
- lib
|