okonomi_ui_kit 0.1.13 → 0.1.15
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/assets/builds/okonomi_ui_kit/application.tailwind.css +3 -0
- data/app/helpers/okonomi_ui_kit/component.rb +7 -0
- data/app/helpers/okonomi_ui_kit/components/page.rb +8 -2
- data/app/helpers/okonomi_ui_kit/components/page_body.rb +15 -0
- data/app/helpers/okonomi_ui_kit/components/page_header.rb +1 -1
- data/app/helpers/okonomi_ui_kit/components/{page_section.rb → segment.rb} +20 -49
- data/app/views/okonomi/components/page_body/_page_body.html.erb +3 -0
- data/app/views/okonomi/components/segment/_segment.html.erb +4 -0
- data/lib/okonomi_ui_kit/version.rb +1 -1
- metadata +6 -4
- data/app/views/okonomi/components/page_section/_page_section.html.erb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56ed44988417d6630c5a19c81f9b5ebe5a5f746bc50bceaf367bfae211ccf2c5
|
4
|
+
data.tar.gz: 13dccf96cf57029453d93fed7be5caf5c24e3433d0c0533e29121c0e6afbc6a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca51c73c4400d20071e4b68e4a65b6578e8cbf2f750f107e9d982d490aab21b1d717c84220784462c0225ec34c5935fcd75ec3991a1b2a06b05a1bc7d6f2b6d3
|
7
|
+
data.tar.gz: 5d1f047793d156fb8d71ebb9898bb567692550432e25eaac7bfa6affa8d28aec5269d3e8f2f73c5c3b2ca29dc62f80878756a539943dc1d93892d71e3c776426
|
@@ -16,7 +16,7 @@ module OkonomiUiKit
|
|
16
16
|
|
17
17
|
register_styles :default do
|
18
18
|
{
|
19
|
-
root: "flex flex-col
|
19
|
+
root: "flex flex-col"
|
20
20
|
}
|
21
21
|
end
|
22
22
|
end
|
@@ -34,9 +34,15 @@ module OkonomiUiKit
|
|
34
34
|
@content_parts << @template.ui.page_header(options, &block)
|
35
35
|
nil
|
36
36
|
end
|
37
|
+
alias header page_header
|
38
|
+
|
39
|
+
def body(**options, &block)
|
40
|
+
@content_parts << @template.ui.page_body(options, &block)
|
41
|
+
nil
|
42
|
+
end
|
37
43
|
|
38
44
|
def section(**options, &block)
|
39
|
-
@content_parts << @template.ui.
|
45
|
+
@content_parts << @template.ui.segment(options, &block)
|
40
46
|
nil
|
41
47
|
end
|
42
48
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module OkonomiUiKit
|
2
|
+
module Components
|
3
|
+
class PageBody < OkonomiUiKit::Component
|
4
|
+
def render(options = {}, &block)
|
5
|
+
view.render(template_path, component: self, options:, &block)
|
6
|
+
end
|
7
|
+
|
8
|
+
register_styles :default do
|
9
|
+
{
|
10
|
+
root: "overflow-auto-y p-4"
|
11
|
+
}
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,19 +1,15 @@
|
|
1
1
|
module OkonomiUiKit
|
2
2
|
module Components
|
3
|
-
class
|
3
|
+
class Segment < OkonomiUiKit::Component
|
4
4
|
def render(options = {}, &block)
|
5
5
|
options = options.with_indifferent_access
|
6
6
|
title = options.delete(:title)
|
7
|
+
variant = options.delete(:variant) || :default
|
7
8
|
|
8
|
-
|
9
|
-
style(:root),
|
10
|
-
options.delete(:class)
|
11
|
-
)
|
12
|
-
|
13
|
-
builder = SectionBuilder.new(view, self)
|
9
|
+
builder = SectionBuilder.new(view, self, variant)
|
14
10
|
builder.title(title) if title
|
15
11
|
|
16
|
-
view.render(template_path, builder: builder,
|
12
|
+
view.render(template_path, builder: builder, component: self, variant: variant, &block)
|
17
13
|
end
|
18
14
|
|
19
15
|
register_styles :default do
|
@@ -24,10 +20,11 @@ module OkonomiUiKit
|
|
24
20
|
title: "text-base/7 font-semibold text-gray-900",
|
25
21
|
subtitle: "mt-1 max-w-2xl text-sm/6 text-gray-500",
|
26
22
|
actions: "mt-4 flex md:ml-4 md:mt-0",
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
23
|
+
variants: {
|
24
|
+
default: {
|
25
|
+
body: "px-4 py-5 sm:px-6"
|
26
|
+
}
|
27
|
+
}
|
31
28
|
}
|
32
29
|
end
|
33
30
|
end
|
@@ -36,7 +33,9 @@ module OkonomiUiKit
|
|
36
33
|
include ActionView::Helpers::TagHelper
|
37
34
|
include ActionView::Helpers::CaptureHelper
|
38
35
|
|
39
|
-
|
36
|
+
attr_reader :view, :component, :variant
|
37
|
+
|
38
|
+
def initialize(template, component, variant = :default)
|
40
39
|
@template = template
|
41
40
|
@component = component
|
42
41
|
@title_content = nil
|
@@ -44,18 +43,19 @@ module OkonomiUiKit
|
|
44
43
|
@actions_content = nil
|
45
44
|
@body_content = nil
|
46
45
|
@attributes = []
|
46
|
+
@variant = variant
|
47
47
|
end
|
48
48
|
|
49
49
|
def title(text, **options)
|
50
|
-
@title_content = tag.h3(text, class: @component.
|
50
|
+
@title_content = tag.h3(text, class: @component.variant_style(variant, :title))
|
51
51
|
end
|
52
52
|
|
53
53
|
def subtitle(text, **options)
|
54
|
-
@subtitle_content = tag.p(text, class: @component.
|
54
|
+
@subtitle_content = tag.p(text, class: @component.variant_style(variant, :subtitle))
|
55
55
|
end
|
56
56
|
|
57
57
|
def actions(&block)
|
58
|
-
@actions_content = tag.div(class: @component.
|
58
|
+
@actions_content = tag.div(class: @component.variant_style(variant, :actions)) do
|
59
59
|
capture(&block) if block_given?
|
60
60
|
end
|
61
61
|
end
|
@@ -65,47 +65,18 @@ module OkonomiUiKit
|
|
65
65
|
# Capture the content first to see if attributes were used
|
66
66
|
content = capture { yield(self) }
|
67
67
|
|
68
|
-
@body_content =
|
69
|
-
|
70
|
-
tag.div do
|
71
|
-
tag.dl(class: @component.style(:attribute_list)) do
|
72
|
-
@template.safe_join(@attributes)
|
73
|
-
end
|
74
|
-
end
|
75
|
-
else
|
76
|
-
# Otherwise, just return the captured content
|
77
|
-
tag.div do
|
78
|
-
content
|
79
|
-
end
|
68
|
+
@body_content = tag.div class: @component.variant_style(variant, :body) do
|
69
|
+
content
|
80
70
|
end
|
81
71
|
end
|
82
72
|
end
|
83
73
|
|
84
|
-
def attribute(label, value = nil, **options, &block)
|
85
|
-
content = if block_given?
|
86
|
-
capture(&block)
|
87
|
-
elsif value.respond_to?(:call)
|
88
|
-
value.call
|
89
|
-
else
|
90
|
-
value
|
91
|
-
end
|
92
|
-
|
93
|
-
attribute_html = tag.div(class: @component.style(:attribute_row)) do
|
94
|
-
dt_content = tag.dt(label, class: @component.style(:attribute_label))
|
95
|
-
dd_content = tag.dd(content, class: @component.style(:attribute_value))
|
96
|
-
|
97
|
-
dt_content + dd_content
|
98
|
-
end
|
99
|
-
|
100
|
-
@attributes << attribute_html
|
101
|
-
end
|
102
|
-
|
103
74
|
def render_header
|
104
75
|
return nil unless @title_content || @subtitle_content || @actions_content
|
105
76
|
|
106
|
-
tag.div(class: @component.
|
77
|
+
tag.div(class: @component.variant_style(variant, :header)) do
|
107
78
|
if @actions_content
|
108
|
-
tag.div(class: @component.
|
79
|
+
tag.div(class: @component.variant_style(variant, :header_with_actions)) do
|
109
80
|
title_section = tag.div do
|
110
81
|
content_parts = []
|
111
82
|
content_parts << @title_content if @title_content
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: okonomi_ui_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Okonomi GmbH
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-08-
|
11
|
+
date: 2025-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -1395,9 +1395,10 @@ files:
|
|
1395
1395
|
- app/helpers/okonomi_ui_kit/components/link_to.rb
|
1396
1396
|
- app/helpers/okonomi_ui_kit/components/navigation.rb
|
1397
1397
|
- app/helpers/okonomi_ui_kit/components/page.rb
|
1398
|
+
- app/helpers/okonomi_ui_kit/components/page_body.rb
|
1398
1399
|
- app/helpers/okonomi_ui_kit/components/page_header.rb
|
1399
|
-
- app/helpers/okonomi_ui_kit/components/page_section.rb
|
1400
1400
|
- app/helpers/okonomi_ui_kit/components/progress_bar.rb
|
1401
|
+
- app/helpers/okonomi_ui_kit/components/segment.rb
|
1401
1402
|
- app/helpers/okonomi_ui_kit/components/table.rb
|
1402
1403
|
- app/helpers/okonomi_ui_kit/components/typography.rb
|
1403
1404
|
- app/helpers/okonomi_ui_kit/config.rb
|
@@ -1433,9 +1434,10 @@ files:
|
|
1433
1434
|
- app/views/okonomi/components/navigation/_link.html.erb
|
1434
1435
|
- app/views/okonomi/components/navigation/_navigation.html.erb
|
1435
1436
|
- app/views/okonomi/components/page/_page.html.erb
|
1437
|
+
- app/views/okonomi/components/page_body/_page_body.html.erb
|
1436
1438
|
- app/views/okonomi/components/page_header/_page_header.html.erb
|
1437
|
-
- app/views/okonomi/components/page_section/_page_section.html.erb
|
1438
1439
|
- app/views/okonomi/components/progress_bar/_progress_bar.html.erb
|
1440
|
+
- app/views/okonomi/components/segment/_segment.html.erb
|
1439
1441
|
- app/views/okonomi/components/table/_table.html.erb
|
1440
1442
|
- app/views/okonomi/components/typography/_typography.html.erb
|
1441
1443
|
- app/views/okonomi/forms/tailwind/_checkbox_label.html.erb
|