kiso 0.3.0.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -1
- data/README.md +16 -3
- data/app/assets/tailwind/kiso/engine.css +4 -3
- data/app/assets/tailwind/kiso/palettes/blue.css +65 -0
- data/app/assets/tailwind/kiso/palettes/green.css +65 -0
- data/app/assets/tailwind/kiso/palettes/orange.css +65 -0
- data/app/assets/tailwind/kiso/palettes/violet.css +65 -0
- data/app/assets/tailwind/kiso/palettes/zinc.css +65 -0
- data/app/helpers/kiso/app_component_helper.rb +53 -0
- data/app/helpers/kiso/component_helper.rb +110 -24
- data/app/helpers/kiso/ui_context_helper.rb +59 -0
- data/app/javascript/controllers/kiso/alert_controller.js +33 -0
- data/app/javascript/controllers/kiso/index.js +3 -0
- data/app/views/kiso/components/_alert.html.erb +19 -3
- data/app/views/kiso/components/_alert_dialog.html.erb +2 -2
- data/app/views/kiso/components/_app.html.erb +7 -0
- data/app/views/kiso/components/_avatar.html.erb +3 -3
- data/app/views/kiso/components/_breadcrumb.html.erb +1 -1
- data/app/views/kiso/components/_color_mode_button.html.erb +1 -1
- data/app/views/kiso/components/_color_mode_select.html.erb +4 -4
- data/app/views/kiso/components/_container.html.erb +7 -0
- data/app/views/kiso/components/_dashboard_sidebar.html.erb +1 -1
- data/app/views/kiso/components/_dialog.html.erb +2 -2
- data/app/views/kiso/components/_footer.html.erb +7 -0
- data/app/views/kiso/components/_header.html.erb +7 -0
- data/app/views/kiso/components/_main.html.erb +7 -0
- data/app/views/kiso/components/_page.html.erb +7 -0
- data/app/views/kiso/components/_page_body.html.erb +7 -0
- data/app/views/kiso/components/_page_card.html.erb +40 -0
- data/app/views/kiso/components/_page_grid.html.erb +7 -0
- data/app/views/kiso/components/_page_header.html.erb +38 -0
- data/app/views/kiso/components/_page_section.html.erb +11 -0
- data/app/views/kiso/components/_pagination.html.erb +1 -1
- data/app/views/kiso/components/_select_native.html.erb +3 -3
- data/app/views/kiso/components/_skeleton.html.erb +5 -0
- data/app/views/kiso/components/_slider.html.erb +4 -4
- data/app/views/kiso/components/_switch.html.erb +2 -2
- data/app/views/kiso/components/alert/_actions.html.erb +7 -0
- data/app/views/kiso/components/breadcrumb/_ellipsis.html.erb +1 -1
- data/app/views/kiso/components/combobox/_input.html.erb +1 -1
- data/app/views/kiso/components/combobox/_item.html.erb +2 -2
- data/app/views/kiso/components/combobox/_list.html.erb +2 -1
- data/app/views/kiso/components/command/_group.html.erb +2 -2
- data/app/views/kiso/components/command/_input.html.erb +3 -2
- data/app/views/kiso/components/command/_list.html.erb +2 -1
- data/app/views/kiso/components/dashboard_navbar/_toggle.html.erb +1 -1
- data/app/views/kiso/components/dashboard_sidebar/_collapse.html.erb +1 -1
- data/app/views/kiso/components/dashboard_sidebar/_toggle.html.erb +1 -1
- data/app/views/kiso/components/dialog/_close.html.erb +1 -1
- data/app/views/kiso/components/nav/_item.html.erb +2 -2
- data/app/views/kiso/components/nav/_section.html.erb +5 -5
- data/app/views/kiso/components/page/_center.html.erb +7 -0
- data/app/views/kiso/components/page/_left.html.erb +7 -0
- data/app/views/kiso/components/page/_right.html.erb +7 -0
- data/app/views/kiso/components/page_card/_body.html.erb +7 -0
- data/app/views/kiso/components/page_card/_description.html.erb +7 -0
- data/app/views/kiso/components/page_card/_footer.html.erb +7 -0
- data/app/views/kiso/components/page_card/_header.html.erb +7 -0
- data/app/views/kiso/components/page_card/_icon.html.erb +7 -0
- data/app/views/kiso/components/page_card/_title.html.erb +7 -0
- data/app/views/kiso/components/page_header/_description.html.erb +7 -0
- data/app/views/kiso/components/page_header/_headline.html.erb +7 -0
- data/app/views/kiso/components/page_header/_links.html.erb +7 -0
- data/app/views/kiso/components/page_header/_title.html.erb +7 -0
- data/app/views/kiso/components/page_section/_body.html.erb +7 -0
- data/app/views/kiso/components/page_section/_description.html.erb +7 -0
- data/app/views/kiso/components/page_section/_header.html.erb +7 -0
- data/app/views/kiso/components/page_section/_headline.html.erb +7 -0
- data/app/views/kiso/components/page_section/_links.html.erb +7 -0
- data/app/views/kiso/components/page_section/_title.html.erb +7 -0
- data/app/views/kiso/components/page_section/_wrapper.html.erb +7 -0
- data/app/views/kiso/components/pagination/_ellipsis.html.erb +1 -1
- data/app/views/kiso/components/pagination/_next.html.erb +2 -2
- data/app/views/kiso/components/pagination/_previous.html.erb +2 -2
- data/app/views/kiso/components/select/_item.html.erb +2 -2
- data/config/locales/en.yml +33 -0
- data/lib/generators/kiso/component/USAGE +35 -0
- data/lib/generators/kiso/component/component_generator.rb +104 -0
- data/lib/generators/kiso/component/templates/partial.html.erb.tt +7 -0
- data/lib/generators/kiso/component/templates/sub_part_partial.html.erb.tt +7 -0
- data/lib/generators/kiso/component/templates/sub_part_theme.rb.tt +21 -0
- data/lib/generators/kiso/component/templates/theme.rb.tt +21 -0
- data/lib/kiso/configuration.rb +40 -0
- data/lib/kiso/engine.rb +105 -1
- data/lib/kiso/presets/rounded.rb +136 -0
- data/lib/kiso/presets/sharp.rb +178 -0
- data/lib/kiso/presets.rb +49 -0
- data/lib/kiso/theme_overrides.rb +5 -1
- data/lib/kiso/themes/alert.rb +24 -11
- data/lib/kiso/themes/dashboard.rb +1 -1
- data/lib/kiso/themes/layout.rb +69 -0
- data/lib/kiso/themes/page.rb +295 -0
- data/lib/kiso/themes/skeleton.rb +16 -0
- data/lib/kiso/version.rb +1 -1
- data/lib/kiso.rb +7 -0
- metadata +63 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Kiso
|
|
4
|
+
# Manages a request-scoped context stack for per-slot +ui:+ overrides.
|
|
5
|
+
#
|
|
6
|
+
# This is ERB's equivalent of Vue's provide/inject pattern. When a parent
|
|
7
|
+
# component is rendered with +ui:+, the hash is pushed onto a stack.
|
|
8
|
+
# Sub-parts rendered inside the parent's block read their slot override
|
|
9
|
+
# from the stack automatically.
|
|
10
|
+
#
|
|
11
|
+
# Thread-safe because Rails creates a fresh view context (and therefore
|
|
12
|
+
# fresh instance variables) per request.
|
|
13
|
+
#
|
|
14
|
+
# @example How the stack flows
|
|
15
|
+
# # Parent pushes:
|
|
16
|
+
# kiso_push_ui_context(:card, { header: "p-8", title: "text-xl" })
|
|
17
|
+
#
|
|
18
|
+
# # Sub-part reads:
|
|
19
|
+
# kiso_current_ui(:card) #=> { header: "p-8", title: "text-xl" }
|
|
20
|
+
#
|
|
21
|
+
# # After parent renders:
|
|
22
|
+
# kiso_pop_ui_context(:card)
|
|
23
|
+
#
|
|
24
|
+
# @see ComponentHelper#kui
|
|
25
|
+
module UiContextHelper
|
|
26
|
+
# Push a ui hash onto the context stack for a component.
|
|
27
|
+
#
|
|
28
|
+
# @param component [Symbol] the component name (e.g. +:card+)
|
|
29
|
+
# @param ui [Hash{Symbol => String}] slot-name to class-string mapping
|
|
30
|
+
# @return [void]
|
|
31
|
+
def kiso_push_ui_context(component, ui)
|
|
32
|
+
kiso_ui_stack[component] ||= []
|
|
33
|
+
kiso_ui_stack[component].push(ui || {})
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Pop the most recent ui hash for a component.
|
|
37
|
+
#
|
|
38
|
+
# @param component [Symbol] the component name
|
|
39
|
+
# @return [Hash, nil] the popped ui hash
|
|
40
|
+
def kiso_pop_ui_context(component)
|
|
41
|
+
kiso_ui_stack[component]&.pop
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Read the current ui hash for a component (top of stack).
|
|
45
|
+
#
|
|
46
|
+
# @param component [Symbol] the component name
|
|
47
|
+
# @return [Hash{Symbol => String}] the current ui overrides, or empty hash
|
|
48
|
+
def kiso_current_ui(component)
|
|
49
|
+
kiso_ui_stack.dig(component, -1) || {}
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
private
|
|
53
|
+
|
|
54
|
+
# @return [Hash{Symbol => Array<Hash>}] per-component stacks
|
|
55
|
+
def kiso_ui_stack
|
|
56
|
+
@kiso_ui_stack ||= {}
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Alert controller. Handles dismissing an alert by removing it from the DOM.
|
|
5
|
+
*
|
|
6
|
+
* Attach to the alert root element with `data-controller="kiso--alert"`.
|
|
7
|
+
* The close button dispatches the `close` action on click.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <div data-controller="kiso--alert" data-slot="alert" role="alert">
|
|
11
|
+
* <div data-slot="alert-wrapper">
|
|
12
|
+
* <div data-slot="alert-title">Heads up!</div>
|
|
13
|
+
* <div data-slot="alert-description">You can dismiss this alert.</div>
|
|
14
|
+
* </div>
|
|
15
|
+
* <button data-action="click->kiso--alert#close" data-slot="alert-close">
|
|
16
|
+
* <svg>...</svg>
|
|
17
|
+
* </button>
|
|
18
|
+
* </div>
|
|
19
|
+
*
|
|
20
|
+
* @fires kiso--alert:close - Dispatched before the alert is removed from the DOM
|
|
21
|
+
*/
|
|
22
|
+
export default class extends Controller {
|
|
23
|
+
/**
|
|
24
|
+
* Dismisses the alert. Dispatches a `close` event and removes the element.
|
|
25
|
+
* The event can be cancelled with `event.preventDefault()` to prevent removal.
|
|
26
|
+
*/
|
|
27
|
+
close() {
|
|
28
|
+
const event = this.dispatch("close", { cancelable: true })
|
|
29
|
+
if (!event.defaultPrevented) {
|
|
30
|
+
this.element.remove()
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import KisoAlertController from "./alert_controller.js"
|
|
1
2
|
import KisoComboboxController from "./combobox_controller.js"
|
|
2
3
|
import KisoCommandController from "./command_controller.js"
|
|
3
4
|
import KisoCommandDialogController from "./command_dialog_controller.js"
|
|
@@ -13,6 +14,7 @@ import KisoToggleGroupController from "./toggle_group_controller.js"
|
|
|
13
14
|
|
|
14
15
|
const KisoUi = {
|
|
15
16
|
start(application) {
|
|
17
|
+
application.register("kiso--alert", KisoAlertController)
|
|
16
18
|
application.register("kiso--combobox", KisoComboboxController)
|
|
17
19
|
application.register("kiso--command", KisoCommandController)
|
|
18
20
|
application.register("kiso--command-dialog", KisoCommandDialogController)
|
|
@@ -30,6 +32,7 @@ const KisoUi = {
|
|
|
30
32
|
|
|
31
33
|
export default KisoUi
|
|
32
34
|
export {
|
|
35
|
+
KisoAlertController,
|
|
33
36
|
KisoComboboxController,
|
|
34
37
|
KisoCommandController,
|
|
35
38
|
KisoCommandDialogController,
|
|
@@ -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
|
-
|
|
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 %>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<%# locals: (open: false, size: :default, css_classes: "", **component_options) %>
|
|
1
|
+
<%# locals: (open: false, size: :default, ui: {}, css_classes: "", **component_options) %>
|
|
2
2
|
<%
|
|
3
3
|
# Store the dialog id on the view context so child sub-part partials
|
|
4
4
|
# (_title, _description) can auto-generate matching aria-labelledby /
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
kiso__dialog_open_value: (open ? true : nil),
|
|
21
21
|
kiso__dialog_dismissable_value: false),
|
|
22
22
|
**component_options do %>
|
|
23
|
-
<div class="<%= Kiso::Themes::AlertDialogContent.render(size: size) %>"
|
|
23
|
+
<div class="<%= Kiso::Themes::AlertDialogContent.render(size: size, class: ui[:content]) %>"
|
|
24
24
|
data-slot="alert-dialog-content"
|
|
25
25
|
data-size="<%= size %>">
|
|
26
26
|
<%= yield %>
|
|
@@ -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 %>
|
|
@@ -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: "
|
|
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: "
|
|
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") %>
|
|
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") %>
|
|
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") %>
|
|
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: "
|
|
6
|
+
aria: { label: t("kiso.dashboard_sidebar.label") },
|
|
7
7
|
**component_options do %>
|
|
8
8
|
<div data-slot="dashboard-sidebar-inner">
|
|
9
9
|
<%= yield %>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
<%# locals: (open: false, css_classes: "", **component_options) %>
|
|
1
|
+
<%# locals: (open: false, ui: {}, css_classes: "", **component_options) %>
|
|
2
2
|
<%= content_tag :dialog,
|
|
3
3
|
class: Kiso::Themes::Dialog.render(class: css_classes),
|
|
4
4
|
data: kiso_prepare_options(component_options, slot: "dialog",
|
|
5
5
|
controller: "kiso--dialog",
|
|
6
6
|
kiso__dialog_open_value: (open ? true : nil)),
|
|
7
7
|
**component_options do %>
|
|
8
|
-
<div class="<%= Kiso::Themes::DialogContent.render %>" data-slot="dialog-content">
|
|
8
|
+
<div class="<%= Kiso::Themes::DialogContent.render(class: ui[:content]) %>" data-slot="dialog-content">
|
|
9
9
|
<%= yield %>
|
|
10
10
|
</div>
|
|
11
11
|
<% 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,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) %>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<%# locals: (min: 0, max: 100, step: 1, value: nil, name: nil, id: nil, disabled: false, size: :md, aria_label: nil, css_classes: "", **component_options) %>
|
|
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
2
|
<% slider_value = value || min %>
|
|
3
3
|
<% percent = ((slider_value.to_f - min) / (max - min) * 100).clamp(0, 100) %>
|
|
4
4
|
<%= content_tag :div,
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
class: "sr-only",
|
|
23
23
|
data: { kiso__slider_target: "input" }) %>
|
|
24
24
|
<%= tag.div(
|
|
25
|
-
class: Kiso::Themes::SliderTrack.render(size: size),
|
|
25
|
+
class: Kiso::Themes::SliderTrack.render(size: size, class: ui[:track]),
|
|
26
26
|
data: { slot: "slider-track", kiso__slider_target: "track" }) do %>
|
|
27
27
|
<%= tag.div(
|
|
28
|
-
class: Kiso::Themes::SliderRange.render,
|
|
28
|
+
class: Kiso::Themes::SliderRange.render(class: ui[:range]),
|
|
29
29
|
style: "width: #{percent}%",
|
|
30
30
|
data: { slot: "slider-range", kiso__slider_target: "range" }) %>
|
|
31
31
|
<% end %>
|
|
32
32
|
<%= tag.div(
|
|
33
|
-
class: Kiso::Themes::SliderThumb.render(size: size),
|
|
33
|
+
class: Kiso::Themes::SliderThumb.render(size: size, class: ui[:thumb]),
|
|
34
34
|
role: :slider,
|
|
35
35
|
tabindex: (disabled ? "-1" : "0"),
|
|
36
36
|
aria: { valuemin: min, valuemax: max, valuenow: slider_value,
|
|
@@ -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 %>
|
|
@@ -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"
|
|
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: "
|
|
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:
|
|
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:
|
|
2
|
-
|
|
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:
|
|
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: "
|
|
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) %>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
data: kiso_prepare_options(component_options, slot: "dashboard-sidebar-collapse",
|
|
5
5
|
kiso__sidebar_target: "trigger",
|
|
6
6
|
action: "click->kiso--sidebar#toggle"),
|
|
7
|
-
aria: { label: "
|
|
7
|
+
aria: { label: t("kiso.dashboard_sidebar.collapse"), expanded: "false", controls: "dashboard-sidebar" },
|
|
8
8
|
type: "button",
|
|
9
9
|
**component_options do %>
|
|
10
10
|
<span data-slot="collapse-icon-open"><%= kiso_component_icon(:panel_left_close) %></span>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
data: kiso_prepare_options(component_options, slot: "dashboard-sidebar-toggle",
|
|
5
5
|
kiso__sidebar_target: "trigger",
|
|
6
6
|
action: "click->kiso--sidebar#toggle"),
|
|
7
|
-
aria: { label: "
|
|
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) %>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<%# locals: (href: "#", icon: nil, badge: nil, active: false, css_classes: "", **component_options) %>
|
|
1
|
+
<%# locals: (href: "#", icon: nil, badge: nil, active: false, ui: {}, css_classes: "", **component_options) %>
|
|
2
2
|
<%= content_tag :a,
|
|
3
3
|
href: href,
|
|
4
4
|
class: Kiso::Themes::NavItem.render(class: css_classes),
|
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
<% end %>
|
|
11
11
|
<span data-slot="nav-item-label" class="truncate"><%= yield %></span>
|
|
12
12
|
<% if badge %>
|
|
13
|
-
<span data-slot="nav-item-badge" class="<%= Kiso::Themes::NavItemBadge.render %>"><%= badge %></span>
|
|
13
|
+
<span data-slot="nav-item-badge" class="<%= Kiso::Themes::NavItemBadge.render(class: ui[:badge]) %>"><%= badge %></span>
|
|
14
14
|
<% end %>
|
|
15
15
|
<% end %>
|