kiso 0.3.0.pre → 0.4.1.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 +30 -1
- data/README.md +16 -3
- data/app/assets/tailwind/kiso/engine.css +40 -28
- 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 +63 -0
- data/app/helpers/kiso/component_helper.rb +140 -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 +5 -0
- data/lib/generators/kiso/component/templates/sub_part_partial.html.erb.tt +5 -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 +109 -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 +78 -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
- data/lib/tasks/kiso.rake +36 -0
- metadata +64 -1
|
@@ -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 %>
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
<%# locals: (title: nil, open: true, collapsible: true, css_classes: "", **component_options) %>
|
|
1
|
+
<%# locals: (title: nil, open: true, collapsible: true, ui: {}, css_classes: "", **component_options) %>
|
|
2
2
|
<% if title && collapsible %>
|
|
3
3
|
<%= content_tag :details,
|
|
4
4
|
class: Kiso::Themes::NavSection.render(class: css_classes),
|
|
5
5
|
data: kiso_prepare_options(component_options, slot: "nav-section"),
|
|
6
6
|
open: open,
|
|
7
7
|
**component_options do %>
|
|
8
|
-
<summary class="<%= Kiso::Themes::NavSectionTitle.render %>" data-slot="nav-section-title">
|
|
8
|
+
<summary class="<%= Kiso::Themes::NavSectionTitle.render(class: ui[:title]) %>" data-slot="nav-section-title">
|
|
9
9
|
<span class="truncate"><%= title %></span>
|
|
10
10
|
<span class="ml-auto" data-slot="nav-section-chevron">
|
|
11
11
|
<%= kiso_component_icon(:chevron_down, class: "size-4") %>
|
|
12
12
|
</span>
|
|
13
13
|
</summary>
|
|
14
|
-
<div data-slot="nav-section-content" class="<%= Kiso::Themes::NavSectionContent.render %>">
|
|
14
|
+
<div data-slot="nav-section-content" class="<%= Kiso::Themes::NavSectionContent.render(class: ui[:content]) %>">
|
|
15
15
|
<%= yield %>
|
|
16
16
|
</div>
|
|
17
17
|
<% end %>
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
class: Kiso::Themes::NavSection.render(class: css_classes),
|
|
21
21
|
data: kiso_prepare_options(component_options, slot: "nav-section"),
|
|
22
22
|
**component_options do %>
|
|
23
|
-
<div class="<%= Kiso::Themes::NavSectionTitle.render %>" data-slot="nav-section-title">
|
|
23
|
+
<div class="<%= Kiso::Themes::NavSectionTitle.render(class: ui[:title]) %>" data-slot="nav-section-title">
|
|
24
24
|
<span class="truncate"><%= title %></span>
|
|
25
25
|
</div>
|
|
26
|
-
<div data-slot="nav-section-content" class="<%= Kiso::Themes::NavSectionContent.render %>">
|
|
26
|
+
<div data-slot="nav-section-content" class="<%= Kiso::Themes::NavSectionContent.render(class: ui[:content]) %>">
|
|
27
27
|
<%= yield %>
|
|
28
28
|
</div>
|
|
29
29
|
<% end %>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<%# locals: (css_classes: "", **component_options) %>
|
|
2
|
+
<%= content_tag :div,
|
|
3
|
+
class: Kiso::Themes::PageCardBody.render(class: css_classes),
|
|
4
|
+
data: kiso_prepare_options(component_options, slot: "page-card-body"),
|
|
5
|
+
**component_options do %>
|
|
6
|
+
<%= yield %>
|
|
7
|
+
<% end %>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<%# locals: (css_classes: "", **component_options) %>
|
|
2
|
+
<%= content_tag :p,
|
|
3
|
+
class: Kiso::Themes::PageCardDescription.render(class: css_classes),
|
|
4
|
+
data: kiso_prepare_options(component_options, slot: "page-card-description"),
|
|
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::PageCardFooter.render(class: css_classes),
|
|
4
|
+
data: kiso_prepare_options(component_options, slot: "page-card-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::PageCardHeader.render(class: css_classes),
|
|
4
|
+
data: kiso_prepare_options(component_options, slot: "page-card-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::PageCardIcon.render(class: css_classes),
|
|
4
|
+
data: kiso_prepare_options(component_options, slot: "page-card-icon"),
|
|
5
|
+
**component_options do %>
|
|
6
|
+
<%= yield %>
|
|
7
|
+
<% end %>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<%# locals: (css_classes: "", **component_options) %>
|
|
2
|
+
<%= content_tag :p,
|
|
3
|
+
class: Kiso::Themes::PageCardTitle.render(class: css_classes),
|
|
4
|
+
data: kiso_prepare_options(component_options, slot: "page-card-title"),
|
|
5
|
+
**component_options do %>
|
|
6
|
+
<%= yield %>
|
|
7
|
+
<% end %>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<%# locals: (css_classes: "", **component_options) %>
|
|
2
|
+
<%= content_tag :p,
|
|
3
|
+
class: Kiso::Themes::PageHeaderDescription.render(class: css_classes),
|
|
4
|
+
data: kiso_prepare_options(component_options, slot: "page-header-description"),
|
|
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::PageHeaderHeadline.render(class: css_classes),
|
|
4
|
+
data: kiso_prepare_options(component_options, slot: "page-header-headline"),
|
|
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::PageHeaderLinks.render(class: css_classes),
|
|
4
|
+
data: kiso_prepare_options(component_options, slot: "page-header-links"),
|
|
5
|
+
**component_options do %>
|
|
6
|
+
<%= yield %>
|
|
7
|
+
<% end %>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<%# locals: (css_classes: "", **component_options) %>
|
|
2
|
+
<%= content_tag :h1,
|
|
3
|
+
class: Kiso::Themes::PageHeaderTitle.render(class: css_classes),
|
|
4
|
+
data: kiso_prepare_options(component_options, slot: "page-header-title"),
|
|
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::PageSectionBody.render(class: css_classes),
|
|
4
|
+
data: kiso_prepare_options(component_options, slot: "page-section-body"),
|
|
5
|
+
**component_options do %>
|
|
6
|
+
<%= yield %>
|
|
7
|
+
<% end %>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<%# locals: (orientation: :horizontal, css_classes: "", **component_options) %>
|
|
2
|
+
<%= content_tag :p,
|
|
3
|
+
class: Kiso::Themes::PageSectionDescription.render(orientation: orientation, class: css_classes),
|
|
4
|
+
data: kiso_prepare_options(component_options, slot: "page-section-description"),
|
|
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::PageSectionHeader.render(class: css_classes),
|
|
4
|
+
data: kiso_prepare_options(component_options, slot: "page-section-header"),
|
|
5
|
+
**component_options do %>
|
|
6
|
+
<%= yield %>
|
|
7
|
+
<% end %>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<%# locals: (orientation: :horizontal, css_classes: "", **component_options) %>
|
|
2
|
+
<%= content_tag :div,
|
|
3
|
+
class: Kiso::Themes::PageSectionHeadline.render(orientation: orientation, class: css_classes),
|
|
4
|
+
data: kiso_prepare_options(component_options, slot: "page-section-headline"),
|
|
5
|
+
**component_options do %>
|
|
6
|
+
<%= yield %>
|
|
7
|
+
<% end %>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<%# locals: (orientation: :horizontal, css_classes: "", **component_options) %>
|
|
2
|
+
<%= content_tag :div,
|
|
3
|
+
class: Kiso::Themes::PageSectionLinks.render(orientation: orientation, class: css_classes),
|
|
4
|
+
data: kiso_prepare_options(component_options, slot: "page-section-links"),
|
|
5
|
+
**component_options do %>
|
|
6
|
+
<%= yield %>
|
|
7
|
+
<% end %>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<%# locals: (orientation: :horizontal, css_classes: "", **component_options) %>
|
|
2
|
+
<%= content_tag :h2,
|
|
3
|
+
class: Kiso::Themes::PageSectionTitle.render(orientation: orientation, class: css_classes),
|
|
4
|
+
data: kiso_prepare_options(component_options, slot: "page-section-title"),
|
|
5
|
+
**component_options do %>
|
|
6
|
+
<%= yield %>
|
|
7
|
+
<% end %>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<%# locals: (order: :first, css_classes: "", **component_options) %>
|
|
2
|
+
<%= content_tag :div,
|
|
3
|
+
class: Kiso::Themes::PageSectionWrapper.render(order: order, class: css_classes),
|
|
4
|
+
data: kiso_prepare_options(component_options, slot: "page-section-wrapper"),
|
|
5
|
+
**component_options do %>
|
|
6
|
+
<%= yield %>
|
|
7
|
+
<% end %>
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
data: kiso_prepare_options(component_options, slot: "pagination-ellipsis"),
|
|
6
6
|
**component_options do %>
|
|
7
7
|
<%= kiso_component_icon(:ellipsis, size: :sm) %>
|
|
8
|
-
<%= content_tag :span, "
|
|
8
|
+
<%= content_tag :span, t("kiso.pagination.more_pages"), class: "sr-only" %>
|
|
9
9
|
<% end %>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<%# locals: (href: "#", active: false, css_classes: "", **component_options) %>
|
|
2
|
-
<% aria_attrs = {label: "
|
|
2
|
+
<% aria_attrs = {label: t("kiso.pagination.next_page")}
|
|
3
3
|
aria_attrs[:current] = "page" if active %>
|
|
4
4
|
<%= content_tag :a,
|
|
5
5
|
href: href,
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
class: Kiso::Themes::PaginationNext.render(active: active, class: css_classes),
|
|
8
8
|
data: kiso_prepare_options(component_options, slot: "pagination-next"),
|
|
9
9
|
**component_options do %>
|
|
10
|
-
<%= content_tag :span, "
|
|
10
|
+
<%= content_tag :span, t("kiso.pagination.next"), class: "hidden sm:block" %>
|
|
11
11
|
<%= kiso_component_icon(:chevron_right) %>
|
|
12
12
|
<% end %>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<%# locals: (href: "#", active: false, css_classes: "", **component_options) %>
|
|
2
|
-
<% aria_attrs = {label: "
|
|
2
|
+
<% aria_attrs = {label: t("kiso.pagination.previous_page")}
|
|
3
3
|
aria_attrs[:current] = "page" if active %>
|
|
4
4
|
<%= content_tag :a,
|
|
5
5
|
href: href,
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
data: kiso_prepare_options(component_options, slot: "pagination-previous"),
|
|
9
9
|
**component_options do %>
|
|
10
10
|
<%= kiso_component_icon(:chevron_left) %>
|
|
11
|
-
<%= content_tag :span, "
|
|
11
|
+
<%= content_tag :span, t("kiso.pagination.previous"), class: "hidden sm:block" %>
|
|
12
12
|
<% end %>
|
|
@@ -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::SelectItem.render(class: css_classes),
|
|
4
4
|
role: "option",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
disabled: (disabled ? "true" : nil)),
|
|
11
11
|
aria: {selected: false, disabled: (disabled || nil)},
|
|
12
12
|
**component_options do %>
|
|
13
|
-
<%= tag.span class: Kiso::Themes::SelectItemIndicator.render,
|
|
13
|
+
<%= tag.span class: Kiso::Themes::SelectItemIndicator.render(class: ui[:indicator]),
|
|
14
14
|
data: { slot: "select-item-indicator", kiso__select_target: "indicator" },
|
|
15
15
|
hidden: true do %>
|
|
16
16
|
<%= kiso_component_icon(:check, class: "size-4") %>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
en:
|
|
2
|
+
kiso:
|
|
3
|
+
alert:
|
|
4
|
+
dismiss: "Dismiss"
|
|
5
|
+
breadcrumb:
|
|
6
|
+
label: "breadcrumb"
|
|
7
|
+
more: "More"
|
|
8
|
+
color_mode_button:
|
|
9
|
+
toggle: "Toggle color mode"
|
|
10
|
+
color_mode_select:
|
|
11
|
+
theme: "Theme"
|
|
12
|
+
system: "System"
|
|
13
|
+
light: "Light"
|
|
14
|
+
dark: "Dark"
|
|
15
|
+
combobox:
|
|
16
|
+
toggle: "Toggle"
|
|
17
|
+
options: "Options"
|
|
18
|
+
command:
|
|
19
|
+
search: "Search"
|
|
20
|
+
suggestions: "Suggestions"
|
|
21
|
+
dashboard_sidebar:
|
|
22
|
+
label: "Sidebar navigation"
|
|
23
|
+
toggle: "Toggle sidebar"
|
|
24
|
+
collapse: "Collapse sidebar"
|
|
25
|
+
dialog:
|
|
26
|
+
close: "Close"
|
|
27
|
+
pagination:
|
|
28
|
+
label: "pagination"
|
|
29
|
+
more_pages: "More pages"
|
|
30
|
+
next: "Next"
|
|
31
|
+
next_page: "Go to next page"
|
|
32
|
+
previous: "Previous"
|
|
33
|
+
previous_page: "Go to previous page"
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Description:
|
|
2
|
+
Scaffolds a component with a ClassVariants theme module and ERB partial.
|
|
3
|
+
Components are rendered using the appui() helper.
|
|
4
|
+
|
|
5
|
+
Theme files are placed in app/themes/<active_theme>/ (default: app/themes/default/).
|
|
6
|
+
The active theme is set via Kiso.config.app_theme.
|
|
7
|
+
|
|
8
|
+
Examples:
|
|
9
|
+
bin/rails generate kiso:component pricing_card
|
|
10
|
+
|
|
11
|
+
Creates:
|
|
12
|
+
app/themes/default/pricing_card.rb
|
|
13
|
+
app/views/components/_pricing_card.html.erb
|
|
14
|
+
|
|
15
|
+
bin/rails generate kiso:component pricing_card --sub-parts header footer
|
|
16
|
+
|
|
17
|
+
Creates:
|
|
18
|
+
app/themes/default/pricing_card.rb
|
|
19
|
+
app/themes/default/pricing_card_header.rb
|
|
20
|
+
app/themes/default/pricing_card_footer.rb
|
|
21
|
+
app/views/components/_pricing_card.html.erb
|
|
22
|
+
app/views/components/pricing_card/_header.html.erb
|
|
23
|
+
app/views/components/pricing_card/_footer.html.erb
|
|
24
|
+
|
|
25
|
+
bin/rails generate kiso:component pricing_card --theme modern
|
|
26
|
+
|
|
27
|
+
Creates theme files in app/themes/modern/ instead of app/themes/default/.
|
|
28
|
+
|
|
29
|
+
Usage:
|
|
30
|
+
appui(:pricing_card) { "Content" }
|
|
31
|
+
|
|
32
|
+
appui(:pricing_card) do
|
|
33
|
+
appui(:pricing_card, :header) { "Title" }
|
|
34
|
+
appui(:pricing_card, :footer) { "Actions" }
|
|
35
|
+
end
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Kiso
|
|
4
|
+
module Generators
|
|
5
|
+
# Scaffolds a component with a ClassVariants theme module and ERB partial.
|
|
6
|
+
#
|
|
7
|
+
# Theme files are placed in +app/themes/<active_theme>/+ (default:
|
|
8
|
+
# +app/themes/default/+). The active theme is configured via
|
|
9
|
+
# +Kiso.config.app_theme+. Components are rendered using the +appui()+
|
|
10
|
+
# helper.
|
|
11
|
+
#
|
|
12
|
+
# @example Basic usage
|
|
13
|
+
# bin/rails generate kiso:component pricing_card
|
|
14
|
+
#
|
|
15
|
+
# @example With sub-parts
|
|
16
|
+
# bin/rails generate kiso:component pricing_card --sub-parts header footer
|
|
17
|
+
#
|
|
18
|
+
# @example With a custom theme
|
|
19
|
+
# bin/rails generate kiso:component pricing_card --theme modern
|
|
20
|
+
class ComponentGenerator < Rails::Generators::NamedBase
|
|
21
|
+
source_root File.expand_path("templates", __dir__)
|
|
22
|
+
|
|
23
|
+
class_option :sub_parts,
|
|
24
|
+
type: :array,
|
|
25
|
+
default: [],
|
|
26
|
+
desc: "Sub-part names to generate (e.g. --sub-parts header footer)"
|
|
27
|
+
|
|
28
|
+
class_option :theme,
|
|
29
|
+
type: :string,
|
|
30
|
+
default: nil,
|
|
31
|
+
desc: "Theme directory name (defaults to Kiso.config.app_theme, usually :default)"
|
|
32
|
+
|
|
33
|
+
def create_theme_file
|
|
34
|
+
template "theme.rb.tt", File.join(theme_dir, component_path_dir, "#{file_name}.rb")
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def create_partial_file
|
|
38
|
+
template "partial.html.erb.tt",
|
|
39
|
+
File.join("app/views/components", component_path_dir, "_#{file_name}.html.erb")
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def create_sub_part_files
|
|
43
|
+
options[:sub_parts].each do |part|
|
|
44
|
+
@current_part = part
|
|
45
|
+
template "sub_part_theme.rb.tt",
|
|
46
|
+
File.join(theme_dir, component_path_dir, "#{file_name}_#{part}.rb")
|
|
47
|
+
template "sub_part_partial.html.erb.tt",
|
|
48
|
+
File.join("app/views/components", component_path_dir, file_name, "_#{part}.html.erb")
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
private
|
|
53
|
+
|
|
54
|
+
# @return [String] the current sub-part name being generated
|
|
55
|
+
attr_reader :current_part
|
|
56
|
+
|
|
57
|
+
# @return [String] the theme directory path (e.g. "app/themes/default")
|
|
58
|
+
def theme_dir
|
|
59
|
+
name = (options[:theme] || Kiso.config.app_theme).to_s
|
|
60
|
+
File.join("app/themes", name)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# @return [String] the component name in PascalCase (e.g. "PricingCard")
|
|
64
|
+
def class_name_without_namespace
|
|
65
|
+
file_name.camelize
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# @return [String] the kebab-case data-slot value (e.g. "pricing-card")
|
|
69
|
+
def slot_name
|
|
70
|
+
file_name.dasherize
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# @return [String] the kebab-case data-slot value for a sub-part (e.g. "pricing-card-header")
|
|
74
|
+
def sub_part_slot_name
|
|
75
|
+
"#{slot_name}-#{current_part.dasherize}"
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# @return [String] the PascalCase theme constant name for a sub-part (e.g. "PricingCardHeader")
|
|
79
|
+
def sub_part_class_name
|
|
80
|
+
"#{class_name_without_namespace}#{current_part.camelize}"
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# @return [Array<String>] namespace segments from the name argument
|
|
84
|
+
def component_class_path
|
|
85
|
+
regular_class_path
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# @return [String] namespace directory path (empty string for simple names)
|
|
89
|
+
def component_path_dir
|
|
90
|
+
component_class_path.join("/")
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# @return [String] full module nesting prefix (e.g. "Admin::" for admin/pricing_card)
|
|
94
|
+
def module_prefix
|
|
95
|
+
component_class_path.map(&:camelize).join("::")
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# @return [Boolean] whether the component has a namespace prefix (e.g. admin/pricing_card)
|
|
99
|
+
def has_namespace?
|
|
100
|
+
component_class_path.any?
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<%% # locals: (css_classes: "", **component_options) %>
|
|
2
|
+
<%%= appui_tag :div, theme: AppThemes::<%= has_namespace? ? "#{module_prefix}::" : "" %><%= class_name_without_namespace %>, slot: "<%= slot_name %>",
|
|
3
|
+
css_classes: css_classes, **component_options do %>
|
|
4
|
+
<%%= yield %>
|
|
5
|
+
<%% end %>
|