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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: adca3d7c87bf516fc8f0e4d46eaab53f413939422d69d764333c4567c4cb851c
4
- data.tar.gz: 229d5bad01930a081e3ed1350ef7c4aff21f00c00aa30603f0e63f6dc062d324
3
+ metadata.gz: 56ed44988417d6630c5a19c81f9b5ebe5a5f746bc50bceaf367bfae211ccf2c5
4
+ data.tar.gz: 13dccf96cf57029453d93fed7be5caf5c24e3433d0c0533e29121c0e6afbc6a7
5
5
  SHA512:
6
- metadata.gz: 66ad9faf08d8102a80cd968b8866dc7969d8e96698ba34a1498cabaadac92cd8cf04e0e1720574bd199d2b45a73c664737ad1e834499a5cd9edd28cb7314ca00
7
- data.tar.gz: 6877453a2cc1440568b5aa85e34b47597dfbeca1a1de7ba01b121ea79a500bcabb24d99aae9499bfaecc4e8e279cb6e4c53c424ef09d2b3d16ba333e85b18175
6
+ metadata.gz: ca51c73c4400d20071e4b68e4a65b6578e8cbf2f750f107e9d982d490aab21b1d717c84220784462c0225ec34c5935fcd75ec3991a1b2a06b05a1bc7d6f2b6d3
7
+ data.tar.gz: 5d1f047793d156fb8d71ebb9898bb567692550432e25eaac7bfa6affa8d28aec5269d3e8f2f73c5c3b2ca29dc62f80878756a539943dc1d93892d71e3c776426
@@ -1501,6 +1501,9 @@
1501
1501
  .py-4 {
1502
1502
  padding-block: calc(var(--spacing) * 4);
1503
1503
  }
1504
+ .py-5 {
1505
+ padding-block: calc(var(--spacing) * 5);
1506
+ }
1504
1507
  .py-6 {
1505
1508
  padding-block: calc(var(--spacing) * 6);
1506
1509
  }
@@ -14,6 +14,13 @@ module OkonomiUiKit
14
14
  self.class.name.demodulize.underscore
15
15
  end
16
16
 
17
+ def variant_style(*args)
18
+ tw_merge(
19
+ styles.dig(*args[1..-1]),
20
+ styles.dig(*args)
21
+ )
22
+ end
23
+
17
24
  def style(*args)
18
25
  styles.dig(*args)
19
26
  end
@@ -16,7 +16,7 @@ module OkonomiUiKit
16
16
 
17
17
  register_styles :default do
18
18
  {
19
- root: "flex flex-col gap-8 p-8"
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.page_section(options, &block)
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
@@ -16,7 +16,7 @@ module OkonomiUiKit
16
16
 
17
17
  register_styles :default do
18
18
  {
19
- root: "flex flex-col gap-2",
19
+ root: "flex flex-col gap-2 p-4",
20
20
  row: "flex w-full justify-between items-center",
21
21
  actions: "mt-4 flex md:ml-4 md:mt-0 gap-2"
22
22
  }
@@ -1,19 +1,15 @@
1
1
  module OkonomiUiKit
2
2
  module Components
3
- class PageSection < OkonomiUiKit::Component
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
- classes = tw_merge(
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, options: options.merge(class: classes), &block)
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
- attribute_list: "divide-y divide-gray-100",
28
- attribute_row: "py-6 sm:grid sm:grid-cols-3 sm:gap-4",
29
- attribute_label: "text-sm font-medium text-gray-900",
30
- attribute_value: "mt-1 text-sm/6 text-gray-700 sm:col-span-2 sm:mt-0"
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
- def initialize(template, component)
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.style(:title))
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.style(:subtitle))
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.style(:actions)) do
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 = if @attributes.any?
69
- # If attributes were added, wrap them in dl
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.style(:header)) do
77
+ tag.div(class: @component.variant_style(variant, :header)) do
107
78
  if @actions_content
108
- tag.div(class: @component.style(:header_with_actions)) do
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
@@ -0,0 +1,3 @@
1
+ <%= content_tag "div", class: component.style(:root) do %>
2
+ <%= yield %>
3
+ <% end %>
@@ -0,0 +1,4 @@
1
+ <%= content_tag :div, class: component.variant_style(variant, :root) do %>
2
+ <% yield(builder) if block_given? %>
3
+ <%= builder.render_content %>
4
+ <% end %>
@@ -1,3 +1,3 @@
1
1
  module OkonomiUiKit
2
- VERSION = "0.1.13"
2
+ VERSION = "0.1.15"
3
3
  end
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.13
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-07 00:00:00.000000000 Z
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
@@ -1,4 +0,0 @@
1
- <div class="<%= options[:class] %>">
2
- <% yield(builder) if block_given? %>
3
- <%= builder.render_content %>
4
- </div>