keystone_ui 0.11.1 → 0.12.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/app/components/keystone/ui/alert_component.rb +13 -18
- data/app/components/keystone/ui/badge_component.rb +8 -9
- data/app/components/keystone/ui/card_component.rb +11 -10
- data/app/components/keystone/ui/page_component.rb +12 -11
- data/app/components/keystone/ui/page_header_component.html.erb +1 -1
- data/app/components/keystone/ui/page_header_component.rb +10 -5
- data/app/components/keystone/ui/section_component.html.erb +1 -1
- data/app/components/keystone/ui/section_component.rb +12 -7
- data/lib/keystone_ui/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1ba08014c8024c4d2be934c04bf5986fabf96067a28816c89b27a68593865878
|
|
4
|
+
data.tar.gz: 22c8e2fe139a1cb802d7c7e694f54aa95f627f2a8eb0808f9ec65db78a5762ab
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8115ce638bb73b100305498b251d5ce6a8d4993d82587061f74dfe24f04f5c039f5bfc33158661daf8d6e305e8c9b866c78ef70102be03e1a7da892b02170ffe
|
|
7
|
+
data.tar.gz: 7f92473cf68ce1eda055362700d86ac278844b4825763ea7b304dad3ddc0d2a2661b1572b8808a9d5043b36fafaf3518ebb00908b04f01f09910d9c74d08ce70
|
|
@@ -3,35 +3,30 @@
|
|
|
3
3
|
module Keystone
|
|
4
4
|
module Ui
|
|
5
5
|
class AlertComponent < ViewComponent::Base
|
|
6
|
-
BASE_CLASSES = "rounded-md p-4"
|
|
7
|
-
|
|
8
6
|
TYPE_CLASSES = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
info: "ks-alert-info",
|
|
8
|
+
success: "ks-alert-success",
|
|
9
|
+
warning: "ks-alert-warning",
|
|
10
|
+
error: "ks-alert-error"
|
|
12
11
|
}.freeze
|
|
13
12
|
|
|
14
|
-
OUTER_CLASSES = "
|
|
15
|
-
INNER_CLASSES = "
|
|
16
|
-
TITLE_CLASSES = "
|
|
17
|
-
MESSAGE_CLASSES = "
|
|
18
|
-
MESSAGE_WITH_TITLE_CLASSES = "
|
|
19
|
-
DISMISS_CLASSES = "
|
|
13
|
+
OUTER_CLASSES = "ks-alert-body"
|
|
14
|
+
INNER_CLASSES = "ks-alert-content"
|
|
15
|
+
TITLE_CLASSES = "ks-alert-title"
|
|
16
|
+
MESSAGE_CLASSES = "ks-alert-message"
|
|
17
|
+
MESSAGE_WITH_TITLE_CLASSES = "ks-alert-message-titled"
|
|
18
|
+
DISMISS_CLASSES = "ks-alert-dismiss"
|
|
20
19
|
|
|
21
|
-
def initialize(message:, type: :info, title: nil, dismissible: false)
|
|
20
|
+
def initialize(message:, type: :info, title: nil, dismissible: false, class: nil)
|
|
22
21
|
@message = message
|
|
23
22
|
@type = type
|
|
24
23
|
@title = title
|
|
25
24
|
@dismissible = dismissible
|
|
25
|
+
@extra_classes = binding.local_variable_get(:class)
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def classes
|
|
29
|
-
|
|
30
|
-
"bg-accent-50 text-accent-800 dark:bg-accent-900/30 dark:text-accent-300"
|
|
31
|
-
else
|
|
32
|
-
TYPE_CLASSES.fetch(@type)
|
|
33
|
-
end
|
|
34
|
-
"#{BASE_CLASSES} #{type_css}"
|
|
29
|
+
[ "ks-alert", TYPE_CLASSES.fetch(@type), @extra_classes ].compact.join(" ")
|
|
35
30
|
end
|
|
36
31
|
|
|
37
32
|
def message_text
|
|
@@ -3,25 +3,24 @@
|
|
|
3
3
|
module Keystone
|
|
4
4
|
module Ui
|
|
5
5
|
class BadgeComponent < ViewComponent::Base
|
|
6
|
-
BASE_CLASSES = "inline-flex items-center rounded-full px-2 py-1 text-xs font-medium"
|
|
7
|
-
|
|
8
6
|
VARIANT_CLASSES = {
|
|
9
|
-
neutral: "
|
|
10
|
-
success: "
|
|
11
|
-
danger: "
|
|
12
|
-
warning: "
|
|
13
|
-
info: "
|
|
7
|
+
neutral: "ks-badge-neutral",
|
|
8
|
+
success: "ks-badge-success",
|
|
9
|
+
danger: "ks-badge-danger",
|
|
10
|
+
warning: "ks-badge-warning",
|
|
11
|
+
info: "ks-badge-info"
|
|
14
12
|
}.freeze
|
|
15
13
|
|
|
16
14
|
attr_reader :label
|
|
17
15
|
|
|
18
|
-
def initialize(label:, variant: :neutral)
|
|
16
|
+
def initialize(label:, variant: :neutral, class: nil)
|
|
19
17
|
@label = label
|
|
20
18
|
@variant = variant
|
|
19
|
+
@extra_classes = binding.local_variable_get(:class)
|
|
21
20
|
end
|
|
22
21
|
|
|
23
22
|
def classes
|
|
24
|
-
"
|
|
23
|
+
[ "ks-badge", VARIANT_CLASSES.fetch(@variant), @extra_classes ].compact.join(" ")
|
|
25
24
|
end
|
|
26
25
|
end
|
|
27
26
|
end
|
|
@@ -3,30 +3,31 @@
|
|
|
3
3
|
module Keystone
|
|
4
4
|
module Ui
|
|
5
5
|
class CardComponent < ViewComponent::Base
|
|
6
|
-
CARD_CLASSES = "
|
|
7
|
-
CARD_EDGE_CLASSES = "
|
|
8
|
-
BODY_CLASSES = "
|
|
9
|
-
CTA_CLASSES = "
|
|
10
|
-
TITLE_CLASSES = "
|
|
11
|
-
SUMMARY_CLASSES = "
|
|
12
|
-
|
|
6
|
+
CARD_CLASSES = "ks-card"
|
|
7
|
+
CARD_EDGE_CLASSES = "ks-card-edge"
|
|
8
|
+
BODY_CLASSES = "ks-card-body"
|
|
9
|
+
CTA_CLASSES = "ks-card-cta"
|
|
10
|
+
TITLE_CLASSES = "ks-card-title"
|
|
11
|
+
SUMMARY_CLASSES = "ks-card-summary"
|
|
12
|
+
LINK_CLASSES = "ks-card-link"
|
|
13
13
|
|
|
14
|
-
def initialize(title:, summary:, link:, cta: "Read more", edge_to_edge: false)
|
|
14
|
+
def initialize(title:, summary:, link:, cta: "Read more", edge_to_edge: false, class: nil)
|
|
15
15
|
@title = title
|
|
16
16
|
@summary = summary
|
|
17
17
|
@link = link
|
|
18
18
|
@cta = cta
|
|
19
19
|
@edge_to_edge = edge_to_edge
|
|
20
|
+
@extra_classes = binding.local_variable_get(:class)
|
|
20
21
|
end
|
|
21
22
|
|
|
22
23
|
def link_classes
|
|
23
|
-
|
|
24
|
+
LINK_CLASSES
|
|
24
25
|
end
|
|
25
26
|
|
|
26
27
|
private
|
|
27
28
|
|
|
28
29
|
def card_classes
|
|
29
|
-
@edge_to_edge ? CARD_EDGE_CLASSES : CARD_CLASSES
|
|
30
|
+
[ @edge_to_edge ? CARD_EDGE_CLASSES : CARD_CLASSES, @extra_classes ].compact.join(" ")
|
|
30
31
|
end
|
|
31
32
|
end
|
|
32
33
|
end
|
|
@@ -4,26 +4,27 @@ module Keystone
|
|
|
4
4
|
module Ui
|
|
5
5
|
class PageComponent < ViewComponent::Base
|
|
6
6
|
MAX_WIDTH_CLASSES = {
|
|
7
|
-
sm: "
|
|
8
|
-
md: "
|
|
9
|
-
lg: "
|
|
10
|
-
xl: "
|
|
7
|
+
sm: "ks-page-sm",
|
|
8
|
+
md: "ks-page-md",
|
|
9
|
+
lg: "ks-page-lg",
|
|
10
|
+
xl: "ks-page-xl",
|
|
11
11
|
full: ""
|
|
12
12
|
}.freeze
|
|
13
13
|
|
|
14
|
-
PADDING_CLASSES = "
|
|
14
|
+
PADDING_CLASSES = "ks-page"
|
|
15
15
|
|
|
16
16
|
TOP_OFFSET_CLASSES = {
|
|
17
|
-
sm: "
|
|
18
|
-
md: "
|
|
19
|
-
lg: "
|
|
20
|
-
xl: "
|
|
17
|
+
sm: "ks-page-offset-sm",
|
|
18
|
+
md: "ks-page-offset-md",
|
|
19
|
+
lg: "ks-page-offset-lg",
|
|
20
|
+
xl: "ks-page-offset-xl"
|
|
21
21
|
}.freeze
|
|
22
22
|
|
|
23
|
-
def initialize(max_width: :full, padding: :standard, top_offset: nil)
|
|
23
|
+
def initialize(max_width: :full, padding: :standard, top_offset: nil, class: nil)
|
|
24
24
|
@max_width = max_width
|
|
25
25
|
@padding = padding
|
|
26
26
|
@top_offset = top_offset
|
|
27
|
+
@extra_classes = binding.local_variable_get(:class)
|
|
27
28
|
end
|
|
28
29
|
|
|
29
30
|
def classes
|
|
@@ -32,7 +33,7 @@ module Keystone
|
|
|
32
33
|
tokens << TOP_OFFSET_CLASSES.fetch(@top_offset) if @top_offset
|
|
33
34
|
width_class = MAX_WIDTH_CLASSES.fetch(@max_width)
|
|
34
35
|
tokens << width_class unless width_class.empty?
|
|
35
|
-
tokens <<
|
|
36
|
+
tokens << @extra_classes if @extra_classes
|
|
36
37
|
tokens.join(" ")
|
|
37
38
|
end
|
|
38
39
|
end
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<% content_for :mobile_action_url, action_url %>
|
|
3
3
|
<% content_for :mobile_action_label, action_label %>
|
|
4
4
|
<% end %>
|
|
5
|
-
<div class="<%=
|
|
5
|
+
<div class="<%= wrapper_classes %>">
|
|
6
6
|
<div>
|
|
7
7
|
<h1 class="<%= TITLE_CLASSES %>"><%= @title %></h1>
|
|
8
8
|
<% if subtitle? %>
|
|
@@ -3,19 +3,24 @@
|
|
|
3
3
|
module Keystone
|
|
4
4
|
module Ui
|
|
5
5
|
class PageHeaderComponent < ViewComponent::Base
|
|
6
|
-
WRAPPER_CLASSES = "
|
|
7
|
-
TITLE_CLASSES = "
|
|
8
|
-
SUBTITLE_CLASSES = "
|
|
9
|
-
ACTIONS_CLASSES = "page-header-actions
|
|
6
|
+
WRAPPER_CLASSES = "ks-page-header"
|
|
7
|
+
TITLE_CLASSES = "ks-page-header-title"
|
|
8
|
+
SUBTITLE_CLASSES = "ks-page-header-subtitle"
|
|
9
|
+
ACTIONS_CLASSES = "page-header-actions ks-page-header-actions"
|
|
10
10
|
|
|
11
11
|
attr_reader :title, :action_url, :action_label
|
|
12
12
|
|
|
13
|
-
def initialize(title:, subtitle: nil, action_url: nil, action_label: "Add new")
|
|
13
|
+
def initialize(title:, subtitle: nil, action_url: nil, action_label: "Add new", class: nil)
|
|
14
14
|
@title = title
|
|
15
15
|
@subtitle = subtitle
|
|
16
16
|
@action_url = action_url
|
|
17
17
|
@action_label = action_label
|
|
18
18
|
@action_block = nil
|
|
19
|
+
@extra_classes = binding.local_variable_get(:class)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def wrapper_classes
|
|
23
|
+
[ WRAPPER_CLASSES, @extra_classes ].compact.join(" ")
|
|
19
24
|
end
|
|
20
25
|
|
|
21
26
|
def before_render
|
|
@@ -3,25 +3,30 @@
|
|
|
3
3
|
module Keystone
|
|
4
4
|
module Ui
|
|
5
5
|
class SectionComponent < ViewComponent::Base
|
|
6
|
-
SPACING_CLASSES = { sm: "
|
|
7
|
-
HEADER_CLASSES = "
|
|
8
|
-
TITLE_CLASSES = "
|
|
9
|
-
SUBTITLE_CLASSES = "
|
|
10
|
-
|
|
6
|
+
SPACING_CLASSES = { sm: "ks-section-sm", md: "ks-section-md", lg: "ks-section-lg" }.freeze
|
|
7
|
+
HEADER_CLASSES = "ks-section-header"
|
|
8
|
+
TITLE_CLASSES = "ks-section-title"
|
|
9
|
+
SUBTITLE_CLASSES = "ks-section-subtitle"
|
|
10
|
+
ACTION_CLASSES = "ks-section-action"
|
|
11
11
|
|
|
12
|
-
def initialize(title: nil, subtitle: nil, action: nil, spacing: :md)
|
|
12
|
+
def initialize(title: nil, subtitle: nil, action: nil, spacing: :md, class: nil)
|
|
13
13
|
@title = title
|
|
14
14
|
@subtitle = subtitle
|
|
15
15
|
@action = action
|
|
16
16
|
@spacing = spacing
|
|
17
|
+
@extra_classes = binding.local_variable_get(:class)
|
|
17
18
|
end
|
|
18
19
|
|
|
19
20
|
def spacing_class
|
|
20
21
|
SPACING_CLASSES.fetch(@spacing)
|
|
21
22
|
end
|
|
22
23
|
|
|
24
|
+
def classes
|
|
25
|
+
[ spacing_class, @extra_classes ].compact.join(" ")
|
|
26
|
+
end
|
|
27
|
+
|
|
23
28
|
def action_classes
|
|
24
|
-
|
|
29
|
+
ACTION_CLASSES
|
|
25
30
|
end
|
|
26
31
|
|
|
27
32
|
def header?
|
data/lib/keystone_ui/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: keystone_ui
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.12.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tyler Schneider
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.
|
|
19
|
+
version: 0.2.0
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 0.
|
|
26
|
+
version: 0.2.0
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: view_component
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|