okonomi_ui_kit 0.1.7 → 0.1.8

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.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: okonomi_ui_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Okonomi GmbH
@@ -1357,21 +1357,24 @@ files:
1357
1357
  - app/controllers/okonomi_ui_kit/application_controller.rb
1358
1358
  - app/helpers/okonomi_ui_kit/application_helper.rb
1359
1359
  - app/helpers/okonomi_ui_kit/attribute_section_helper.rb
1360
- - app/helpers/okonomi_ui_kit/breadcrumbs_helper.rb
1361
1360
  - app/helpers/okonomi_ui_kit/component.rb
1362
1361
  - app/helpers/okonomi_ui_kit/components/alert.rb
1363
1362
  - app/helpers/okonomi_ui_kit/components/badge.rb
1363
+ - app/helpers/okonomi_ui_kit/components/breadcrumbs.rb
1364
+ - app/helpers/okonomi_ui_kit/components/button_base.rb
1365
+ - app/helpers/okonomi_ui_kit/components/button_tag.rb
1364
1366
  - app/helpers/okonomi_ui_kit/components/button_to.rb
1365
1367
  - app/helpers/okonomi_ui_kit/components/code.rb
1368
+ - app/helpers/okonomi_ui_kit/components/icon.rb
1366
1369
  - app/helpers/okonomi_ui_kit/components/link_to.rb
1367
1370
  - app/helpers/okonomi_ui_kit/components/page.rb
1368
1371
  - app/helpers/okonomi_ui_kit/components/table.rb
1369
1372
  - app/helpers/okonomi_ui_kit/components/typography.rb
1370
1373
  - app/helpers/okonomi_ui_kit/config.rb
1371
1374
  - app/helpers/okonomi_ui_kit/form_builder.rb
1372
- - app/helpers/okonomi_ui_kit/icon_helper.rb
1373
1375
  - app/helpers/okonomi_ui_kit/navigation_helper.rb
1374
1376
  - app/helpers/okonomi_ui_kit/svg_icons.rb
1377
+ - app/helpers/okonomi_ui_kit/t_w_merge.rb
1375
1378
  - app/helpers/okonomi_ui_kit/theme.rb
1376
1379
  - app/helpers/okonomi_ui_kit/theme_helper.rb
1377
1380
  - app/helpers/okonomi_ui_kit/ui_helper.rb
@@ -1389,7 +1392,9 @@ files:
1389
1392
  - app/views/layouts/okonomi_ui_kit/application.html.erb
1390
1393
  - app/views/okonomi/attribute_sections/_section.html.erb
1391
1394
  - app/views/okonomi/components/alert/_alert.html.erb
1395
+ - app/views/okonomi/components/breadcrumbs/_breadcrumbs.html.erb
1392
1396
  - app/views/okonomi/components/code/_code.html.erb
1397
+ - app/views/okonomi/components/icon/_icon.html.erb
1393
1398
  - app/views/okonomi/components/page/_page.html.erb
1394
1399
  - app/views/okonomi/components/table/_table.html.erb
1395
1400
  - app/views/okonomi/components/typography/_typography.html.erb
@@ -1,60 +0,0 @@
1
- module OkonomiUiKit
2
- module BreadcrumbsHelper
3
- def breadcrumbs
4
- content_tag(:nav, class: "flex", aria: { label: "Breadcrumb" }) do
5
- content_tag(:ol, class: "flex items-center space-x-4", role: "list") do
6
- builder = BreadcrumbBuilder.new(self)
7
- yield builder
8
- safe_join(builder.items)
9
- end
10
- end
11
- end
12
-
13
- class BreadcrumbBuilder
14
- attr_reader :items
15
-
16
- def initialize(view)
17
- @view = view
18
- @items = []
19
- @first = true
20
- end
21
-
22
- def link(label, url, icon: nil, current: false)
23
- if @first
24
- @items << @view.content_tag(:li) do
25
- @view.content_tag(:div) do
26
- if icon.present?
27
- @view.link_to(url, class: "text-gray-400 hover:text-gray-500") do
28
- @view.svg_icon(icon, class: "size-5") + @view.content_tag(:span, label, class: "sr-only")
29
- end
30
- else
31
- @view.content_tag(:div, class: "flex items-center") do
32
- @view.link_to(label, url, class: breadcrumb_classes(current, first: true), aria: (current ? { current: "page" } : {}))
33
- end
34
- end
35
- end
36
- end
37
- @first = false
38
- else
39
- @items << @view.content_tag(:li) do
40
- @view.content_tag(:div, class: "flex items-center") do
41
- chevron + @view.link_to(label, url, class: breadcrumb_classes(current), aria: (current ? { current: "page" } : {}))
42
- end
43
- end
44
- end
45
- end
46
-
47
- private
48
-
49
- def chevron
50
- @view.svg_icon("heroicons/solid/chevron-right", class: "size-5 shrink-0 text-gray-400")
51
- end
52
-
53
- def breadcrumb_classes(current, first: false)
54
- base = "text-sm font-medium"
55
- base = "#{base} ml-4" unless first
56
- current ? "#{base} text-gray-500" : "#{base} text-gray-500 hover:text-gray-700"
57
- end
58
- end
59
- end
60
- end
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module OkonomiUiKit
4
- module IconHelper
5
- def icon_tag(icon, variant = :outlined, options = {})
6
- if icon.is_a?(Icon)
7
- doc = Nokogiri::HTML::DocumentFragment.parse icon.send(:"content_#{variant}")
8
- svg = doc.at_css 'svg'
9
-
10
- svg['class'] = options[:class] if options[:class].present?
11
- svg['style'] = options[:style] if options[:style].present?
12
-
13
- svg['width'] = options[:width] if options[:width].present?
14
- svg['height'] = options[:height] if options[:height].present?
15
-
16
- raw doc
17
- else
18
- svg_icon(icon, options)
19
- end
20
- end
21
-
22
- def svg_icon(name, options = {})
23
- if OkonomiUiKit::SvgIcons.exist?(name)
24
- doc = Nokogiri::HTML::DocumentFragment.parse OkonomiUiKit::SvgIcons.read(name)
25
- svg = doc.at_css 'svg'
26
-
27
- svg['class'] = options[:class] if options[:class].present?
28
- svg['style'] = options[:style] if options[:style].present?
29
-
30
- svg['width'] = options[:width] if options[:width].present?
31
- svg['height'] = options[:height] if options[:height].present?
32
- else
33
- doc = "<!-- SVG #{name} not found -->"
34
- end
35
-
36
- raw doc
37
- end
38
- end
39
- end