kiso 0.2.2.pre → 0.4.0.pre

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.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +35 -1
  3. data/README.md +16 -3
  4. data/app/assets/tailwind/kiso/dialog.css +46 -0
  5. data/app/assets/tailwind/kiso/engine.css +6 -3
  6. data/app/assets/tailwind/kiso/input-otp.css +17 -0
  7. data/app/assets/tailwind/kiso/palettes/blue.css +65 -0
  8. data/app/assets/tailwind/kiso/palettes/green.css +65 -0
  9. data/app/assets/tailwind/kiso/palettes/orange.css +65 -0
  10. data/app/assets/tailwind/kiso/palettes/violet.css +65 -0
  11. data/app/assets/tailwind/kiso/palettes/zinc.css +65 -0
  12. data/app/assets/tailwind/kiso/slider.css +27 -0
  13. data/app/helpers/kiso/app_component_helper.rb +53 -0
  14. data/app/helpers/kiso/component_helper.rb +110 -24
  15. data/app/helpers/kiso/ui_context_helper.rb +59 -0
  16. data/app/javascript/controllers/kiso/alert_controller.js +33 -0
  17. data/app/javascript/controllers/kiso/dialog_controller.js +140 -0
  18. data/app/javascript/controllers/kiso/index.js +6 -0
  19. data/app/javascript/controllers/kiso/slider_controller.js +276 -0
  20. data/app/views/kiso/components/_alert.html.erb +19 -3
  21. data/app/views/kiso/components/_alert_dialog.html.erb +28 -0
  22. data/app/views/kiso/components/_app.html.erb +7 -0
  23. data/app/views/kiso/components/_aspect_ratio.html.erb +8 -0
  24. data/app/views/kiso/components/_avatar.html.erb +3 -3
  25. data/app/views/kiso/components/_breadcrumb.html.erb +1 -1
  26. data/app/views/kiso/components/_button.html.erb +31 -17
  27. data/app/views/kiso/components/_color_mode_button.html.erb +1 -1
  28. data/app/views/kiso/components/_color_mode_select.html.erb +4 -4
  29. data/app/views/kiso/components/_container.html.erb +7 -0
  30. data/app/views/kiso/components/_dashboard_sidebar.html.erb +1 -1
  31. data/app/views/kiso/components/_dialog.html.erb +11 -0
  32. data/app/views/kiso/components/_footer.html.erb +7 -0
  33. data/app/views/kiso/components/_header.html.erb +7 -0
  34. data/app/views/kiso/components/_main.html.erb +7 -0
  35. data/app/views/kiso/components/_page.html.erb +7 -0
  36. data/app/views/kiso/components/_page_body.html.erb +7 -0
  37. data/app/views/kiso/components/_page_card.html.erb +40 -0
  38. data/app/views/kiso/components/_page_grid.html.erb +7 -0
  39. data/app/views/kiso/components/_page_header.html.erb +38 -0
  40. data/app/views/kiso/components/_page_section.html.erb +11 -0
  41. data/app/views/kiso/components/_pagination.html.erb +1 -1
  42. data/app/views/kiso/components/_select_native.html.erb +3 -3
  43. data/app/views/kiso/components/_skeleton.html.erb +5 -0
  44. data/app/views/kiso/components/_slider.html.erb +42 -0
  45. data/app/views/kiso/components/_switch.html.erb +2 -2
  46. data/app/views/kiso/components/alert/_actions.html.erb +7 -0
  47. data/app/views/kiso/components/alert_dialog/_action.html.erb +8 -0
  48. data/app/views/kiso/components/alert_dialog/_cancel.html.erb +8 -0
  49. data/app/views/kiso/components/alert_dialog/_description.html.erb +8 -0
  50. data/app/views/kiso/components/alert_dialog/_footer.html.erb +7 -0
  51. data/app/views/kiso/components/alert_dialog/_header.html.erb +7 -0
  52. data/app/views/kiso/components/alert_dialog/_media.html.erb +7 -0
  53. data/app/views/kiso/components/alert_dialog/_title.html.erb +8 -0
  54. data/app/views/kiso/components/breadcrumb/_ellipsis.html.erb +1 -1
  55. data/app/views/kiso/components/combobox/_input.html.erb +1 -1
  56. data/app/views/kiso/components/combobox/_item.html.erb +2 -2
  57. data/app/views/kiso/components/combobox/_list.html.erb +2 -1
  58. data/app/views/kiso/components/command/_group.html.erb +2 -2
  59. data/app/views/kiso/components/command/_input.html.erb +3 -2
  60. data/app/views/kiso/components/command/_list.html.erb +2 -1
  61. data/app/views/kiso/components/dashboard_navbar/_toggle.html.erb +1 -1
  62. data/app/views/kiso/components/dashboard_sidebar/_collapse.html.erb +1 -1
  63. data/app/views/kiso/components/dashboard_sidebar/_toggle.html.erb +1 -1
  64. data/app/views/kiso/components/dialog/_body.html.erb +7 -0
  65. data/app/views/kiso/components/dialog/_close.html.erb +10 -0
  66. data/app/views/kiso/components/dialog/_description.html.erb +7 -0
  67. data/app/views/kiso/components/dialog/_footer.html.erb +7 -0
  68. data/app/views/kiso/components/dialog/_header.html.erb +7 -0
  69. data/app/views/kiso/components/dialog/_title.html.erb +7 -0
  70. data/app/views/kiso/components/empty/_actions.html.erb +7 -0
  71. data/app/views/kiso/components/nav/_item.html.erb +2 -2
  72. data/app/views/kiso/components/nav/_section.html.erb +5 -5
  73. data/app/views/kiso/components/page/_center.html.erb +7 -0
  74. data/app/views/kiso/components/page/_left.html.erb +7 -0
  75. data/app/views/kiso/components/page/_right.html.erb +7 -0
  76. data/app/views/kiso/components/page_card/_body.html.erb +7 -0
  77. data/app/views/kiso/components/page_card/_description.html.erb +7 -0
  78. data/app/views/kiso/components/page_card/_footer.html.erb +7 -0
  79. data/app/views/kiso/components/page_card/_header.html.erb +7 -0
  80. data/app/views/kiso/components/page_card/_icon.html.erb +7 -0
  81. data/app/views/kiso/components/page_card/_title.html.erb +7 -0
  82. data/app/views/kiso/components/page_header/_description.html.erb +7 -0
  83. data/app/views/kiso/components/page_header/_headline.html.erb +7 -0
  84. data/app/views/kiso/components/page_header/_links.html.erb +7 -0
  85. data/app/views/kiso/components/page_header/_title.html.erb +7 -0
  86. data/app/views/kiso/components/page_section/_body.html.erb +7 -0
  87. data/app/views/kiso/components/page_section/_description.html.erb +7 -0
  88. data/app/views/kiso/components/page_section/_header.html.erb +7 -0
  89. data/app/views/kiso/components/page_section/_headline.html.erb +7 -0
  90. data/app/views/kiso/components/page_section/_links.html.erb +7 -0
  91. data/app/views/kiso/components/page_section/_title.html.erb +7 -0
  92. data/app/views/kiso/components/page_section/_wrapper.html.erb +7 -0
  93. data/app/views/kiso/components/pagination/_ellipsis.html.erb +1 -1
  94. data/app/views/kiso/components/pagination/_next.html.erb +2 -2
  95. data/app/views/kiso/components/pagination/_previous.html.erb +2 -2
  96. data/app/views/kiso/components/select/_item.html.erb +2 -2
  97. data/config/locales/en.yml +33 -0
  98. data/lib/generators/kiso/component/USAGE +35 -0
  99. data/lib/generators/kiso/component/component_generator.rb +104 -0
  100. data/lib/generators/kiso/component/templates/partial.html.erb.tt +7 -0
  101. data/lib/generators/kiso/component/templates/sub_part_partial.html.erb.tt +7 -0
  102. data/lib/generators/kiso/component/templates/sub_part_theme.rb.tt +21 -0
  103. data/lib/generators/kiso/component/templates/theme.rb.tt +21 -0
  104. data/lib/kiso/configuration.rb +40 -0
  105. data/lib/kiso/engine.rb +105 -1
  106. data/lib/kiso/presets/rounded.rb +136 -0
  107. data/lib/kiso/presets/sharp.rb +178 -0
  108. data/lib/kiso/presets.rb +49 -0
  109. data/lib/kiso/theme_overrides.rb +5 -1
  110. data/lib/kiso/themes/alert.rb +24 -11
  111. data/lib/kiso/themes/alert_dialog.rb +78 -0
  112. data/lib/kiso/themes/aspect_ratio.rb +16 -0
  113. data/lib/kiso/themes/dashboard.rb +3 -3
  114. data/lib/kiso/themes/dialog.rb +57 -0
  115. data/lib/kiso/themes/empty.rb +6 -1
  116. data/lib/kiso/themes/input_otp.rb +2 -2
  117. data/lib/kiso/themes/layout.rb +69 -0
  118. data/lib/kiso/themes/page.rb +295 -0
  119. data/lib/kiso/themes/skeleton.rb +16 -0
  120. data/lib/kiso/themes/slider.rb +53 -0
  121. data/lib/kiso/version.rb +1 -1
  122. data/lib/kiso.rb +11 -0
  123. metadata +89 -1
@@ -1,8 +1,24 @@
1
- <%# locals: (color: :primary, variant: :soft, css_classes: "", **component_options) %>
1
+ <%# locals: (icon: nil, color: :primary, variant: :soft, close: false, ui: {}, css_classes: "", **component_options) %>
2
2
  <%= content_tag :div,
3
3
  role: :alert,
4
4
  class: Kiso::Themes::Alert.render(color: color, variant: variant, class: css_classes),
5
- data: kiso_prepare_options(component_options, slot: "alert"),
5
+ data: kiso_prepare_options(component_options, slot: "alert",
6
+ **({ controller: "kiso--alert" } if close)),
6
7
  **component_options do %>
7
- <%= yield %>
8
+ <% if icon %>
9
+ <%= kiso_icon(icon, class: "size-4 translate-y-0.5 text-current #{ui[:icon]}") %>
10
+ <% end %>
11
+ <%= content_tag :div,
12
+ class: Kiso::Themes::AlertWrapper.render(class: ui[:wrapper]),
13
+ data: { slot: "alert-wrapper" } do %>
14
+ <%= yield %>
15
+ <% end %>
16
+ <% if close %>
17
+ <%= tag.button type: "button",
18
+ class: Kiso::Themes::AlertClose.render(class: ui[:close]),
19
+ data: { slot: "alert-close", action: "click->kiso--alert#close" },
20
+ aria: { label: t("kiso.alert.dismiss") } do %>
21
+ <%= kiso_component_icon(:x, class: "size-4") %>
22
+ <% end %>
23
+ <% end %>
8
24
  <% end %>
@@ -0,0 +1,28 @@
1
+ <%# locals: (open: false, size: :default, ui: {}, css_classes: "", **component_options) %>
2
+ <%
3
+ # Store the dialog id on the view context so child sub-part partials
4
+ # (_title, _description) can auto-generate matching aria-labelledby /
5
+ # aria-describedby id attributes without requiring the caller to pass
6
+ # the id through each nested kui() call.
7
+ @_kiso_alert_dialog_id = component_options[:id]
8
+ aria = {}
9
+ if @_kiso_alert_dialog_id
10
+ aria[:labelledby] = "#{@_kiso_alert_dialog_id}-title"
11
+ aria[:describedby] = "#{@_kiso_alert_dialog_id}-description"
12
+ end
13
+ %>
14
+ <%= content_tag :dialog,
15
+ class: Kiso::Themes::AlertDialog.render(class: css_classes),
16
+ role: "alertdialog",
17
+ aria: aria,
18
+ data: kiso_prepare_options(component_options, slot: "alert-dialog",
19
+ controller: "kiso--dialog",
20
+ kiso__dialog_open_value: (open ? true : nil),
21
+ kiso__dialog_dismissable_value: false),
22
+ **component_options do %>
23
+ <div class="<%= Kiso::Themes::AlertDialogContent.render(size: size, class: ui[:content]) %>"
24
+ data-slot="alert-dialog-content"
25
+ data-size="<%= size %>">
26
+ <%= yield %>
27
+ </div>
28
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <%# locals: (css_classes: "", **component_options) %>
2
+ <%= content_tag :div,
3
+ class: Kiso::Themes::App.render(class: css_classes),
4
+ data: kiso_prepare_options(component_options, slot: "app"),
5
+ **component_options do %>
6
+ <%= yield %>
7
+ <% end %>
@@ -0,0 +1,8 @@
1
+ <%# locals: (ratio: 16.0/9, css_classes: "", **component_options) %>
2
+ <%= content_tag :div,
3
+ style: "aspect-ratio: #{ratio}",
4
+ class: Kiso::Themes::AspectRatio.render(class: css_classes),
5
+ data: kiso_prepare_options(component_options, slot: "aspect-ratio"),
6
+ **component_options do %>
7
+ <%= yield %>
8
+ <% end %>
@@ -1,4 +1,4 @@
1
- <%# locals: (src: nil, alt: "", text: nil, size: :md, css_classes: "", **component_options) %>
1
+ <%# locals: (src: nil, alt: "", text: nil, size: :md, ui: {}, css_classes: "", **component_options) %>
2
2
  <%= content_tag :span,
3
3
  class: Kiso::Themes::Avatar.render(size: size, class: css_classes),
4
4
  data: kiso_prepare_options(component_options, slot: "avatar", size: size),
@@ -8,14 +8,14 @@
8
8
  <%= content %>
9
9
  <% else %>
10
10
  <% if text.present? %>
11
- <%= tag.span class: Kiso::Themes::AvatarFallback.render(size: size),
11
+ <%= tag.span class: Kiso::Themes::AvatarFallback.render(size: size, class: ui[:fallback]),
12
12
  data: { slot: "avatar-fallback" } do %>
13
13
  <%= text %>
14
14
  <% end %>
15
15
  <% end %>
16
16
  <% if src.present? %>
17
17
  <%= tag.img src: src, alt: alt,
18
- class: Kiso::Themes::AvatarImage.render,
18
+ class: Kiso::Themes::AvatarImage.render(class: ui[:image]),
19
19
  data: { slot: "avatar-image" },
20
20
  onerror: "this.style.display='none'" %>
21
21
  <% end %>
@@ -1,7 +1,7 @@
1
1
  <%# locals: (css_classes: "", **component_options) %>
2
2
  <%= content_tag :nav,
3
3
  class: Kiso::Themes::Breadcrumb.render(class: css_classes),
4
- aria: { label: "breadcrumb" },
4
+ aria: { label: t("kiso.breadcrumb.label") },
5
5
  data: kiso_prepare_options(component_options, slot: "breadcrumb"),
6
6
  **component_options do %>
7
7
  <%= yield %>
@@ -1,19 +1,33 @@
1
1
  <%# locals: (color: :primary, variant: :solid, size: :md, block: false,
2
- type: :button, href: nil, disabled: false,
3
- css_classes: "", **component_options) %>
4
- <% tag_name = href.present? ? :a : :button
5
- if tag_name == :a
6
- component_options[:href] = href
7
- component_options[:"aria-disabled"] = true if disabled
8
- else
9
- component_options[:type] = type
10
- component_options[:disabled] = true if disabled
11
- end %>
12
- <%= content_tag tag_name,
13
- class: Kiso::Themes::Button.render(
14
- color: color, variant: variant, size: size, block: block,
15
- class: css_classes),
16
- data: kiso_prepare_options(component_options, slot: "button"),
17
- **component_options do %>
18
- <%= yield %>
2
+ type: :button, href: nil, method: nil, disabled: false,
3
+ form: {}, css_classes: "", **component_options) %>
4
+ <%
5
+ css = Kiso::Themes::Button.render(
6
+ color: color, variant: variant, size: size, block: block, class: css_classes)
7
+ data = kiso_prepare_options(component_options, slot: "button")
8
+ use_button_to = href.present? && method.present? && method.to_s != "get"
9
+ %>
10
+ <% if use_button_to %>
11
+ <%= button_to href,
12
+ method: method,
13
+ class: css,
14
+ form_class: "contents",
15
+ data: data,
16
+ disabled: disabled || nil,
17
+ form: form.presence,
18
+ **component_options do %>
19
+ <%= yield %>
20
+ <% end %>
21
+ <% elsif href.present? %>
22
+ <% component_options[:href] = href
23
+ component_options[:"aria-disabled"] = true if disabled %>
24
+ <%= content_tag :a, class: css, data: data, **component_options do %>
25
+ <%= yield %>
26
+ <% end %>
27
+ <% else %>
28
+ <% component_options[:type] = type
29
+ component_options[:disabled] = true if disabled %>
30
+ <%= content_tag :button, class: css, data: data, **component_options do %>
31
+ <%= yield %>
32
+ <% end %>
19
33
  <% end %>
@@ -4,7 +4,7 @@
4
4
  data: kiso_prepare_options(component_options, slot: "color-mode-button",
5
5
  controller: "kiso--theme",
6
6
  action: "click->kiso--theme#toggle"),
7
- aria: { label: "Toggle color mode" },
7
+ aria: { label: t("kiso.color_mode_button.toggle") },
8
8
  type: "button",
9
9
  **component_options do %>
10
10
  <%# Light icon — visible in light mode, hidden in dark %>
@@ -7,17 +7,17 @@
7
7
  **component_options do %>
8
8
  <%= kui(:select) do %>
9
9
  <%= kui(:select, :trigger, size: size) do %>
10
- <%= kui(:select, :value, placeholder: "Theme") %>
10
+ <%= kui(:select, :value, placeholder: t("kiso.color_mode_select.theme")) %>
11
11
  <% end %>
12
12
  <%= kui(:select, :content) do %>
13
13
  <%= kui(:select, :item, value: "system") do %>
14
- <span class="inline-flex items-center gap-2"><%= kiso_component_icon(:monitor, class: "size-4 opacity-60") %> System</span>
14
+ <span class="inline-flex items-center gap-2"><%= kiso_component_icon(:monitor, class: "size-4 opacity-60") %> <%= t("kiso.color_mode_select.system") %></span>
15
15
  <% end %>
16
16
  <%= kui(:select, :item, value: "light") do %>
17
- <span class="inline-flex items-center gap-2"><%= kiso_component_icon(:sun, class: "size-4 opacity-60") %> Light</span>
17
+ <span class="inline-flex items-center gap-2"><%= kiso_component_icon(:sun, class: "size-4 opacity-60") %> <%= t("kiso.color_mode_select.light") %></span>
18
18
  <% end %>
19
19
  <%= kui(:select, :item, value: "dark") do %>
20
- <span class="inline-flex items-center gap-2"><%= kiso_component_icon(:moon, class: "size-4 opacity-60") %> Dark</span>
20
+ <span class="inline-flex items-center gap-2"><%= kiso_component_icon(:moon, class: "size-4 opacity-60") %> <%= t("kiso.color_mode_select.dark") %></span>
21
21
  <% end %>
22
22
  <% end %>
23
23
  <% end %>
@@ -0,0 +1,7 @@
1
+ <%# locals: (size: :default, css_classes: "", **component_options) %>
2
+ <%= content_tag :div,
3
+ class: Kiso::Themes::Container.render(size: size, class: css_classes),
4
+ data: kiso_prepare_options(component_options, slot: "container"),
5
+ **component_options do %>
6
+ <%= yield %>
7
+ <% end %>
@@ -3,7 +3,7 @@
3
3
  id: "dashboard-sidebar",
4
4
  class: Kiso::Themes::DashboardSidebar.render(class: css_classes),
5
5
  data: kiso_prepare_options(component_options, slot: "dashboard-sidebar"),
6
- aria: { label: "Sidebar navigation" },
6
+ aria: { label: t("kiso.dashboard_sidebar.label") },
7
7
  **component_options do %>
8
8
  <div data-slot="dashboard-sidebar-inner">
9
9
  <%= yield %>
@@ -0,0 +1,11 @@
1
+ <%# locals: (open: false, ui: {}, css_classes: "", **component_options) %>
2
+ <%= content_tag :dialog,
3
+ class: Kiso::Themes::Dialog.render(class: css_classes),
4
+ data: kiso_prepare_options(component_options, slot: "dialog",
5
+ controller: "kiso--dialog",
6
+ kiso__dialog_open_value: (open ? true : nil)),
7
+ **component_options do %>
8
+ <div class="<%= Kiso::Themes::DialogContent.render(class: ui[:content]) %>" data-slot="dialog-content">
9
+ <%= yield %>
10
+ </div>
11
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <%# locals: (css_classes: "", **component_options) %>
2
+ <%= content_tag :footer,
3
+ class: Kiso::Themes::Footer.render(class: css_classes),
4
+ data: kiso_prepare_options(component_options, slot: "footer"),
5
+ **component_options do %>
6
+ <%= yield %>
7
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <%# locals: (css_classes: "", **component_options) %>
2
+ <%= content_tag :header,
3
+ class: Kiso::Themes::Header.render(class: css_classes),
4
+ data: kiso_prepare_options(component_options, slot: "header"),
5
+ **component_options do %>
6
+ <%= yield %>
7
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <%# locals: (css_classes: "", **component_options) %>
2
+ <%= content_tag :main,
3
+ class: Kiso::Themes::Main.render(class: css_classes),
4
+ data: kiso_prepare_options(component_options, slot: "main"),
5
+ **component_options do %>
6
+ <%= yield %>
7
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <%# locals: (css_classes: "", **component_options) %>
2
+ <%= content_tag :div,
3
+ class: Kiso::Themes::Page.render(class: css_classes),
4
+ data: kiso_prepare_options(component_options, slot: "page"),
5
+ **component_options do %>
6
+ <%= yield %>
7
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <%# locals: (css_classes: "", **component_options) %>
2
+ <%= content_tag :div,
3
+ class: Kiso::Themes::PageBody.render(class: css_classes),
4
+ data: kiso_prepare_options(component_options, slot: "page-body"),
5
+ **component_options do %>
6
+ <%= yield %>
7
+ <% end %>
@@ -0,0 +1,40 @@
1
+ <%# locals: (variant: :outline, icon: nil, title: nil, description: nil, ui: {}, css_classes: "", **component_options) %>
2
+ <%= content_tag :div,
3
+ class: Kiso::Themes::PageCard.render(variant: variant, class: css_classes),
4
+ data: kiso_prepare_options(component_options, slot: "page-card"),
5
+ **component_options do %>
6
+ <%= content_tag :div,
7
+ class: Kiso::Themes::PageCardContainer.render(class: ui[:container]),
8
+ data: { slot: "page-card-container" } do %>
9
+ <%= content_tag :div,
10
+ class: Kiso::Themes::PageCardWrapper.render(class: ui[:wrapper]),
11
+ data: { slot: "page-card-wrapper" } do %>
12
+ <% content = capture { yield }.presence %>
13
+ <% if content %>
14
+ <%= content %>
15
+ <% else %>
16
+ <% if icon %>
17
+ <%= content_tag :div,
18
+ class: Kiso::Themes::PageCardIcon.render(class: ui[:icon]),
19
+ data: { slot: "page-card-icon" } do %>
20
+ <%= kiso_icon(icon) %>
21
+ <% end %>
22
+ <% end %>
23
+ <% if title %>
24
+ <%= content_tag :p,
25
+ class: Kiso::Themes::PageCardTitle.render(class: ui[:title]),
26
+ data: { slot: "page-card-title" } do %>
27
+ <%= title %>
28
+ <% end %>
29
+ <% end %>
30
+ <% if description %>
31
+ <%= content_tag :p,
32
+ class: Kiso::Themes::PageCardDescription.render(class: ui[:description]),
33
+ data: { slot: "page-card-description" } do %>
34
+ <%= description %>
35
+ <% end %>
36
+ <% end %>
37
+ <% end %>
38
+ <% end %>
39
+ <% end %>
40
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <%# locals: (css_classes: "", **component_options) %>
2
+ <%= content_tag :div,
3
+ class: Kiso::Themes::PageGrid.render(class: css_classes),
4
+ data: kiso_prepare_options(component_options, slot: "page-grid"),
5
+ **component_options do %>
6
+ <%= yield %>
7
+ <% end %>
@@ -0,0 +1,38 @@
1
+ <%# locals: (headline: nil, title: nil, description: nil, ui: {}, css_classes: "", **component_options) %>
2
+ <%= content_tag :div,
3
+ class: Kiso::Themes::PageHeader.render(class: css_classes),
4
+ data: kiso_prepare_options(component_options, slot: "page-header"),
5
+ **component_options do %>
6
+ <%= content_tag :div,
7
+ class: Kiso::Themes::PageHeaderWrapper.render(class: ui[:wrapper]),
8
+ data: { slot: "page-header-wrapper" } do %>
9
+ <% content = capture { yield }.presence %>
10
+ <% if content %>
11
+ <%= content %>
12
+ <% else %>
13
+ <div>
14
+ <% if headline %>
15
+ <%= content_tag :div,
16
+ class: Kiso::Themes::PageHeaderHeadline.render(class: ui[:headline]),
17
+ data: { slot: "page-header-headline" } do %>
18
+ <%= headline %>
19
+ <% end %>
20
+ <% end %>
21
+ <% if title %>
22
+ <%= content_tag :h1,
23
+ class: Kiso::Themes::PageHeaderTitle.render(class: ui[:title]),
24
+ data: { slot: "page-header-title" } do %>
25
+ <%= title %>
26
+ <% end %>
27
+ <% end %>
28
+ <% if description %>
29
+ <%= content_tag :p,
30
+ class: Kiso::Themes::PageHeaderDescription.render(class: ui[:description]),
31
+ data: { slot: "page-header-description" } do %>
32
+ <%= description %>
33
+ <% end %>
34
+ <% end %>
35
+ </div>
36
+ <% end %>
37
+ <% end %>
38
+ <% end %>
@@ -0,0 +1,11 @@
1
+ <%# locals: (orientation: :horizontal, ui: {}, css_classes: "", **component_options) %>
2
+ <%= content_tag :section,
3
+ class: Kiso::Themes::PageSection.render(orientation: orientation, class: css_classes),
4
+ data: kiso_prepare_options(component_options, slot: "page-section"),
5
+ **component_options do %>
6
+ <%= content_tag :div,
7
+ class: Kiso::Themes::PageSectionContainer.render(orientation: orientation, class: ui[:container]),
8
+ data: { slot: "page-section-container" } do %>
9
+ <%= yield %>
10
+ <% end %>
11
+ <% end %>
@@ -1,7 +1,7 @@
1
1
  <%# locals: (css_classes: "", **component_options) %>
2
2
  <%= content_tag :nav,
3
3
  role: "navigation",
4
- aria: {label: "pagination"},
4
+ aria: {label: t("kiso.pagination.label")},
5
5
  class: Kiso::Themes::Pagination.render(class: css_classes),
6
6
  data: kiso_prepare_options(component_options, slot: "pagination"),
7
7
  **component_options do %>
@@ -1,6 +1,6 @@
1
- <%# locals: (variant: :outline, size: :md, disabled: false, css_classes: "", **component_options) %>
1
+ <%# locals: (variant: :outline, size: :md, disabled: false, ui: {}, css_classes: "", **component_options) %>
2
2
  <%= content_tag :div,
3
- class: Kiso::Themes::SelectNativeWrapper.render,
3
+ class: Kiso::Themes::SelectNativeWrapper.render(class: ui[:wrapper]),
4
4
  data: {slot: "select-native-wrapper"} do %>
5
5
  <% component_options[:disabled] = true if disabled %>
6
6
  <%= tag.select(
@@ -8,7 +8,7 @@
8
8
  data: kiso_prepare_options(component_options, slot: "select-native"),
9
9
  **component_options) { yield } %>
10
10
  <%= content_tag :span,
11
- class: Kiso::Themes::SelectNativeIcon.render,
11
+ class: Kiso::Themes::SelectNativeIcon.render(class: ui[:icon]),
12
12
  aria: {hidden: true},
13
13
  data: {slot: "select-native-icon"} do %>
14
14
  <%= kiso_component_icon(:chevron_down) %>
@@ -0,0 +1,5 @@
1
+ <%# locals: (css_classes: "", **component_options) %>
2
+ <%= tag.div(
3
+ class: Kiso::Themes::Skeleton.render(class: css_classes),
4
+ data: kiso_prepare_options(component_options, slot: "skeleton"),
5
+ **component_options) %>
@@ -0,0 +1,42 @@
1
+ <%# locals: (min: 0, max: 100, step: 1, value: nil, name: nil, id: nil, disabled: false, size: :md, aria_label: nil, ui: {}, css_classes: "", **component_options) %>
2
+ <% slider_value = value || min %>
3
+ <% percent = ((slider_value.to_f - min) / (max - min) * 100).clamp(0, 100) %>
4
+ <%= content_tag :div,
5
+ class: Kiso::Themes::Slider.render(class: css_classes),
6
+ data: kiso_prepare_options(component_options, slot: "slider",
7
+ controller: "kiso--slider",
8
+ kiso__slider_min_value: min,
9
+ kiso__slider_max_value: max,
10
+ kiso__slider_step_value: step),
11
+ **component_options do %>
12
+ <%= tag.input(type: :range,
13
+ id: id,
14
+ name: name,
15
+ min: min,
16
+ max: max,
17
+ step: step,
18
+ value: slider_value,
19
+ disabled: disabled,
20
+ aria: { label: aria_label },
21
+ tabindex: "-1",
22
+ class: "sr-only",
23
+ data: { kiso__slider_target: "input" }) %>
24
+ <%= tag.div(
25
+ class: Kiso::Themes::SliderTrack.render(size: size, class: ui[:track]),
26
+ data: { slot: "slider-track", kiso__slider_target: "track" }) do %>
27
+ <%= tag.div(
28
+ class: Kiso::Themes::SliderRange.render(class: ui[:range]),
29
+ style: "width: #{percent}%",
30
+ data: { slot: "slider-range", kiso__slider_target: "range" }) %>
31
+ <% end %>
32
+ <%= tag.div(
33
+ class: Kiso::Themes::SliderThumb.render(size: size, class: ui[:thumb]),
34
+ role: :slider,
35
+ tabindex: (disabled ? "-1" : "0"),
36
+ aria: { valuemin: min, valuemax: max, valuenow: slider_value,
37
+ label: aria_label,
38
+ disabled: (disabled || nil) },
39
+ style: "position: absolute; left: #{percent}%",
40
+ data: { slot: "slider-thumb", kiso__slider_target: "thumb",
41
+ disabled: (disabled ? "true" : nil) }) %>
42
+ <% end %>
@@ -1,4 +1,4 @@
1
- <%# locals: (color: :primary, size: :md, checked: false, css_classes: "", **component_options) %>
1
+ <%# locals: (color: :primary, size: :md, checked: false, ui: {}, css_classes: "", **component_options) %>
2
2
  <% component_options[:type] = :checkbox
3
3
  component_options[:role] = :switch
4
4
  component_options[:checked] = true if checked %>
@@ -6,5 +6,5 @@
6
6
  class: Kiso::Themes::SwitchTrack.render(color: color, size: size, class: css_classes),
7
7
  data: kiso_prepare_options(component_options, slot: "switch")) do %>
8
8
  <%= tag.input(class: "peer sr-only", **component_options) %>
9
- <%= tag.span(class: Kiso::Themes::SwitchThumb.render(size: size)) %>
9
+ <%= tag.span(class: Kiso::Themes::SwitchThumb.render(size: size, class: ui[:thumb])) %>
10
10
  <% end %>
@@ -0,0 +1,7 @@
1
+ <%# locals: (css_classes: "", **component_options) %>
2
+ <%= content_tag :div,
3
+ class: Kiso::Themes::AlertActions.render(class: css_classes),
4
+ data: kiso_prepare_options(component_options, slot: "alert-actions"),
5
+ **component_options do %>
6
+ <%= yield %>
7
+ <% end %>
@@ -0,0 +1,8 @@
1
+ <%# locals: (color: :primary, variant: :solid, size: :md, css_classes: "", **component_options) %>
2
+ <%= tag.button type: "button",
3
+ class: Kiso::Themes::Button.render(color: color, variant: variant, size: size, class: css_classes),
4
+ data: kiso_prepare_options(component_options, slot: "alert-dialog-action",
5
+ action: "kiso--dialog#close"),
6
+ **component_options do %>
7
+ <%= yield %>
8
+ <% end %>
@@ -0,0 +1,8 @@
1
+ <%# locals: (color: :primary, variant: :outline, size: :md, css_classes: "", **component_options) %>
2
+ <%= tag.button type: "button",
3
+ class: Kiso::Themes::Button.render(color: color, variant: variant, size: size, class: css_classes),
4
+ data: kiso_prepare_options(component_options, slot: "alert-dialog-cancel",
5
+ action: "kiso--dialog#close"),
6
+ **component_options do %>
7
+ <%= yield %>
8
+ <% end %>
@@ -0,0 +1,8 @@
1
+ <%# locals: (css_classes: "", **component_options) %>
2
+ <% component_options[:id] = "#{@_kiso_alert_dialog_id}-description" if @_kiso_alert_dialog_id && !component_options.key?(:id) %>
3
+ <%= content_tag :p,
4
+ class: Kiso::Themes::AlertDialogDescription.render(class: css_classes),
5
+ data: kiso_prepare_options(component_options, slot: "alert-dialog-description"),
6
+ **component_options do %>
7
+ <%= yield %>
8
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <%# locals: (css_classes: "", **component_options) %>
2
+ <%= content_tag :div,
3
+ class: Kiso::Themes::AlertDialogFooter.render(class: css_classes),
4
+ data: kiso_prepare_options(component_options, slot: "alert-dialog-footer"),
5
+ **component_options do %>
6
+ <%= yield %>
7
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <%# locals: (css_classes: "", **component_options) %>
2
+ <%= content_tag :div,
3
+ class: Kiso::Themes::AlertDialogHeader.render(class: css_classes),
4
+ data: kiso_prepare_options(component_options, slot: "alert-dialog-header"),
5
+ **component_options do %>
6
+ <%= yield %>
7
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <%# locals: (css_classes: "", **component_options) %>
2
+ <%= content_tag :div,
3
+ class: Kiso::Themes::AlertDialogMedia.render(class: css_classes),
4
+ data: kiso_prepare_options(component_options, slot: "alert-dialog-media"),
5
+ **component_options do %>
6
+ <%= yield %>
7
+ <% end %>
@@ -0,0 +1,8 @@
1
+ <%# locals: (css_classes: "", **component_options) %>
2
+ <% component_options[:id] = "#{@_kiso_alert_dialog_id}-title" if @_kiso_alert_dialog_id && !component_options.key?(:id) %>
3
+ <%= content_tag :h2,
4
+ class: Kiso::Themes::AlertDialogTitle.render(class: css_classes),
5
+ data: kiso_prepare_options(component_options, slot: "alert-dialog-title"),
6
+ **component_options do %>
7
+ <%= yield %>
8
+ <% end %>
@@ -6,5 +6,5 @@
6
6
  data: kiso_prepare_options(component_options, slot: "breadcrumb-ellipsis"),
7
7
  **component_options do %>
8
8
  <%= kiso_component_icon(:ellipsis, class: "size-4") %>
9
- <span class="sr-only">More</span>
9
+ <span class="sr-only"><%= t("kiso.breadcrumb.more") %></span>
10
10
  <% end %>
@@ -14,7 +14,7 @@
14
14
  class: "flex size-6 items-center justify-center rounded-sm text-muted-foreground hover:text-foreground",
15
15
  disabled: (disabled || nil),
16
16
  tabindex: "-1",
17
- aria: { label: "Toggle" },
17
+ aria: { label: t("kiso.combobox.toggle") },
18
18
  data: { slot: "combobox-trigger", kiso__combobox_target: "trigger",
19
19
  action: "click->kiso--combobox#toggle" } do %>
20
20
  <%= kiso_component_icon(:chevron_down, class: "size-4 pointer-events-none") %>
@@ -1,4 +1,4 @@
1
- <%# locals: (value:, disabled: false, css_classes: "", **component_options) %>
1
+ <%# locals: (value:, disabled: false, ui: {}, css_classes: "", **component_options) %>
2
2
  <%= content_tag :div,
3
3
  class: Kiso::Themes::ComboboxItem.render(class: css_classes),
4
4
  role: "option",
@@ -11,7 +11,7 @@
11
11
  aria: {selected: false, disabled: (disabled || nil)},
12
12
  **component_options do %>
13
13
  <%= tag.span yield, data: { slot: "combobox-item-text" } %>
14
- <%= tag.span class: Kiso::Themes::ComboboxItemIndicator.render,
14
+ <%= tag.span class: Kiso::Themes::ComboboxItemIndicator.render(class: ui[:indicator]),
15
15
  data: { slot: "combobox-item-indicator", kiso__combobox_target: "indicator" },
16
16
  hidden: true do %>
17
17
  <%= kiso_component_icon(:check, class: "size-4") %>
@@ -1,4 +1,5 @@
1
- <%# locals: (label: "Options", css_classes: "", **component_options) %>
1
+ <%# locals: (label: nil, css_classes: "", **component_options) %>
2
+ <% label ||= t("kiso.combobox.options") %>
2
3
  <%= content_tag :div,
3
4
  class: Kiso::Themes::ComboboxList.render(class: css_classes),
4
5
  role: "listbox",
@@ -1,4 +1,4 @@
1
- <%# locals: (heading: nil, css_classes: "", **component_options) %>
1
+ <%# locals: (heading: nil, ui: {}, css_classes: "", **component_options) %>
2
2
  <%= content_tag :div,
3
3
  class: Kiso::Themes::CommandGroup.render(class: css_classes),
4
4
  role: "group",
@@ -6,7 +6,7 @@
6
6
  kiso__command_target: "group"),
7
7
  **component_options do %>
8
8
  <% if heading.present? %>
9
- <div class="<%= Kiso::Themes::CommandGroupHeading.render %>"
9
+ <div class="<%= Kiso::Themes::CommandGroupHeading.render(class: ui[:heading]) %>"
10
10
  data-slot="command-group-heading"
11
11
  role="presentation"><%= heading %></div>
12
12
  <% end %>
@@ -1,5 +1,6 @@
1
- <%# locals: (placeholder: nil, label: "Search", css_classes: "", **component_options) %>
2
- <div class="<%= Kiso::Themes::CommandInputWrapper.render %>"
1
+ <%# locals: (placeholder: nil, label: nil, ui: {}, css_classes: "", **component_options) %>
2
+ <% label ||= t("kiso.command.search") %>
3
+ <div class="<%= Kiso::Themes::CommandInputWrapper.render(class: ui[:wrapper]) %>"
3
4
  data-slot="command-input-wrapper">
4
5
  <%= kiso_component_icon(:search, class: "size-4 shrink-0 opacity-50") %>
5
6
  <%= tag.input(
@@ -1,4 +1,5 @@
1
- <%# locals: (label: "Suggestions", css_classes: "", **component_options) %>
1
+ <%# locals: (label: nil, css_classes: "", **component_options) %>
2
+ <% label ||= t("kiso.command.suggestions") %>
2
3
  <%= content_tag :div,
3
4
  class: Kiso::Themes::CommandList.render(class: css_classes),
4
5
  role: "listbox",
@@ -4,7 +4,7 @@
4
4
  data: kiso_prepare_options(component_options, slot: "dashboard-navbar-toggle",
5
5
  kiso__sidebar_target: "trigger",
6
6
  action: "click->kiso--sidebar#toggle"),
7
- aria: { label: "Toggle sidebar", expanded: "false", controls: "dashboard-sidebar" },
7
+ aria: { label: t("kiso.dashboard_sidebar.toggle"), expanded: "false", controls: "dashboard-sidebar" },
8
8
  type: "button",
9
9
  **component_options do %>
10
10
  <%= capture { yield }.presence || kiso_component_icon(:menu) %>