kiso 0.5.2.pre → 0.6.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/app/assets/tailwind/kiso/button.css +12 -3
- data/app/assets/tailwind/kiso/checkbox.css +13 -2
- data/app/assets/tailwind/kiso/color-mode.css +15 -3
- data/app/assets/tailwind/kiso/dashboard.css +97 -44
- data/app/assets/tailwind/kiso/dialog.css +39 -5
- data/app/assets/tailwind/kiso/engine.css +117 -34
- data/app/assets/tailwind/kiso/input-otp.css +24 -4
- data/app/assets/tailwind/kiso/palettes/blue.css +14 -5
- data/app/assets/tailwind/kiso/palettes/green.css +9 -5
- data/app/assets/tailwind/kiso/palettes/orange.css +9 -5
- data/app/assets/tailwind/kiso/palettes/violet.css +9 -5
- data/app/assets/tailwind/kiso/palettes/zinc.css +11 -7
- data/app/assets/tailwind/kiso/radio-group.css +11 -4
- data/app/assets/tailwind/kiso/slider.css +25 -6
- data/app/assets/tailwind/kiso/tooltip.css +37 -11
- data/app/helpers/kiso/app_component_helper.rb +83 -34
- data/app/helpers/kiso/component_helper.rb +227 -70
- data/app/helpers/kiso/icon_helper.rb +101 -39
- data/app/helpers/kiso/theme_helper.rb +50 -9
- data/app/helpers/kiso/ui_context_helper.rb +87 -35
- data/app/javascript/controllers/kiso/combobox_controller.js +10 -2
- data/app/javascript/controllers/kiso/command_controller.js +2 -0
- data/app/javascript/controllers/kiso/command_dialog_controller.js +4 -0
- data/app/javascript/controllers/kiso/dialog_controller.js +6 -1
- data/app/javascript/controllers/kiso/dialog_trigger_controller.js +1 -1
- data/app/javascript/controllers/kiso/dropdown_menu_controller.js +23 -5
- data/app/javascript/controllers/kiso/index.js +25 -0
- data/app/javascript/controllers/kiso/input_otp_controller.js +5 -3
- data/app/javascript/controllers/kiso/popover_controller.js +18 -4
- data/app/javascript/controllers/kiso/select_controller.js +10 -2
- data/app/javascript/controllers/kiso/sidebar_controller.js +26 -4
- data/app/javascript/controllers/kiso/slider_controller.js +3 -3
- data/app/javascript/controllers/kiso/theme_controller.js +2 -1
- data/app/javascript/controllers/kiso/toggle_controller.js +2 -0
- data/app/javascript/controllers/kiso/toggle_group_controller.js +3 -0
- data/app/javascript/controllers/kiso/tooltip_controller.js +3 -0
- data/app/javascript/kiso/utils/focusable.js +14 -0
- data/app/javascript/kiso/utils/highlight.js +15 -1
- data/app/views/kiso/components/_alert.html.erb +2 -0
- data/app/views/kiso/components/_alert_dialog.html.erb +5 -2
- data/app/views/kiso/components/_app.html.erb +2 -0
- data/app/views/kiso/components/_aspect_ratio.html.erb +1 -0
- data/app/views/kiso/components/_avatar.html.erb +6 -2
- data/app/views/kiso/components/_button.html.erb +3 -0
- data/app/views/kiso/components/_checkbox.html.erb +1 -0
- data/app/views/kiso/components/_color_mode_button.html.erb +2 -0
- data/app/views/kiso/components/_color_mode_select.html.erb +2 -0
- data/app/views/kiso/components/_combobox.html.erb +3 -0
- data/app/views/kiso/components/_command.html.erb +2 -0
- data/app/views/kiso/components/_dashboard_group.html.erb +4 -0
- data/app/views/kiso/components/_dashboard_navbar.html.erb +2 -0
- data/app/views/kiso/components/_dashboard_panel.html.erb +1 -0
- data/app/views/kiso/components/_dashboard_sidebar.html.erb +2 -0
- data/app/views/kiso/components/_dashboard_toolbar.html.erb +2 -0
- data/app/views/kiso/components/_dialog.html.erb +3 -0
- data/app/views/kiso/components/_dropdown_menu.html.erb +2 -0
- data/app/views/kiso/components/_empty.html.erb +2 -0
- data/app/views/kiso/components/_field.html.erb +2 -0
- data/app/views/kiso/components/_field_group.html.erb +1 -0
- data/app/views/kiso/components/_field_set.html.erb +1 -0
- data/app/views/kiso/components/_input_group.html.erb +1 -0
- data/app/views/kiso/components/_input_otp.html.erb +3 -0
- data/app/views/kiso/components/_nav.html.erb +2 -0
- data/app/views/kiso/components/_page_card.html.erb +3 -0
- data/app/views/kiso/components/_page_header.html.erb +3 -0
- data/app/views/kiso/components/_page_section.html.erb +2 -0
- data/app/views/kiso/components/_pagination.html.erb +2 -0
- data/app/views/kiso/components/_popover.html.erb +3 -0
- data/app/views/kiso/components/_select.html.erb +3 -0
- data/app/views/kiso/components/_select_native.html.erb +2 -0
- data/app/views/kiso/components/_separator.html.erb +2 -0
- data/app/views/kiso/components/_skeleton.html.erb +1 -0
- data/app/views/kiso/components/_slider.html.erb +4 -0
- data/app/views/kiso/components/_spinner.html.erb +2 -0
- data/app/views/kiso/components/_stats_card.html.erb +2 -0
- data/app/views/kiso/components/_stats_grid.html.erb +1 -0
- data/app/views/kiso/components/_switch.html.erb +2 -0
- data/app/views/kiso/components/_table.html.erb +2 -0
- data/app/views/kiso/components/_textarea.html.erb +3 -0
- data/app/views/kiso/components/_toggle.html.erb +2 -0
- data/app/views/kiso/components/_toggle_group.html.erb +2 -0
- data/app/views/kiso/components/_tooltip.html.erb +3 -0
- data/app/views/kiso/components/alert_dialog/_action.html.erb +1 -0
- data/app/views/kiso/components/alert_dialog/_cancel.html.erb +1 -0
- data/app/views/kiso/components/alert_dialog/_description.html.erb +1 -0
- data/app/views/kiso/components/alert_dialog/_title.html.erb +1 -0
- data/app/views/kiso/components/avatar/_image.html.erb +1 -0
- data/app/views/kiso/components/breadcrumb/_separator.html.erb +3 -0
- data/app/views/kiso/components/combobox/_chips.html.erb +3 -0
- data/app/views/kiso/components/command/_dialog.html.erb +2 -0
- data/app/views/kiso/components/dashboard_sidebar/_collapse.html.erb +2 -0
- data/app/views/kiso/components/dialog/_close.html.erb +1 -0
- data/app/views/kiso/components/field/_error.html.erb +4 -0
- data/app/views/kiso/components/field/_label.html.erb +2 -0
- data/app/views/kiso/components/field/_separator.html.erb +3 -0
- data/app/views/kiso/components/input_otp/_separator.html.erb +2 -0
- data/app/views/kiso/components/input_otp/_slot.html.erb +2 -0
- data/app/views/kiso/components/nav/_section.html.erb +4 -0
- data/app/views/kiso/components/tooltip/_content.html.erb +2 -0
- data/lib/generators/kiso/install/USAGE +23 -0
- data/lib/generators/kiso/install/install_generator.rb +91 -0
- data/lib/generators/kiso/install/templates/design_system.md.tt +190 -0
- data/lib/generators/kiso/install/templates/initializer.rb.tt +40 -0
- data/lib/kiso/cli/make.rb +6 -3
- data/lib/kiso/cli.rb +10 -0
- data/lib/kiso/color_utils.rb +31 -8
- data/lib/kiso/configuration.rb +11 -0
- data/lib/kiso/engine.rb +9 -2
- data/lib/kiso/propshaft_tailwind_stub_filter.rb +9 -2
- data/lib/kiso/themes/avatar.rb +40 -6
- data/lib/kiso/themes/badge.rb +5 -1
- data/lib/kiso/themes/color_mode_button.rb +11 -0
- data/lib/kiso/themes/color_mode_select.rb +7 -0
- data/lib/kiso/themes/dashboard.rb +28 -0
- data/lib/kiso/themes/dropdown_menu.rb +2 -2
- data/lib/kiso/themes/input_otp.rb +6 -3
- data/lib/kiso/themes/nav.rb +17 -0
- data/lib/kiso/themes/pagination.rb +9 -4
- data/lib/kiso/themes/shared.rb +27 -7
- data/lib/kiso/version.rb +5 -2
- metadata +5 -1
data/lib/kiso/engine.rb
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Kiso
|
|
2
4
|
# Rails engine that integrates Kiso into host applications.
|
|
3
5
|
#
|
|
4
6
|
# Registers initializers for:
|
|
7
|
+
# - i18n locale loading
|
|
5
8
|
# - ClassVariants merger (TailwindMerge for class deduplication)
|
|
6
9
|
# - Global theme overrides ({ThemeOverrides})
|
|
7
|
-
# - View helpers (
|
|
10
|
+
# - View helpers (+kui()+, +appui()+, +kiso_icon()+, +kiso_theme_script()+)
|
|
8
11
|
# - Importmap and asset pipeline paths
|
|
12
|
+
# - Propshaft tailwind stub filtering
|
|
13
|
+
# - Theme hot-reloading in development
|
|
14
|
+
# - App theme loading from +app/themes/+
|
|
9
15
|
# - Lookbook preview path registration
|
|
10
16
|
class Engine < ::Rails::Engine
|
|
11
17
|
isolate_namespace Kiso
|
|
@@ -36,7 +42,8 @@ module Kiso
|
|
|
36
42
|
Kiso::ThemeOverrides.apply!
|
|
37
43
|
end
|
|
38
44
|
|
|
39
|
-
# Makes {
|
|
45
|
+
# Makes all Kiso view helpers available: {UiContextHelper}, {ComponentHelper},
|
|
46
|
+
# {AppComponentHelper}, {IconHelper}, and {ThemeHelper}.
|
|
40
47
|
initializer "kiso.helpers" do
|
|
41
48
|
ActiveSupport.on_load(:action_view) do
|
|
42
49
|
include Kiso::UiContextHelper
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Kiso
|
|
2
4
|
# Filters tailwindcss-rails engine CSS stubs from Propshaft's :app stylesheet
|
|
3
|
-
# resolution. Prepended onto Propshaft::Helper by the engine initializer.
|
|
5
|
+
# resolution. Prepended onto +Propshaft::Helper+ by the engine initializer.
|
|
4
6
|
#
|
|
5
|
-
# Engine stubs have logical paths like "tailwind/kiso.css"
|
|
7
|
+
# Engine stubs have logical paths like "tailwind/kiso.css" -- always under the
|
|
6
8
|
# "tailwind/" prefix. The compiled output is "tailwind.css" (no slash) and
|
|
7
9
|
# passes through unaffected.
|
|
10
|
+
#
|
|
11
|
+
# @see Engine the initializer that prepends this module
|
|
8
12
|
module PropshaftTailwindStubFilter
|
|
13
|
+
# Filters out Tailwind engine stubs from the list of app stylesheet paths.
|
|
14
|
+
#
|
|
15
|
+
# @return [Array<String>] stylesheet logical paths with engine stubs removed
|
|
9
16
|
def app_stylesheets_paths
|
|
10
17
|
super.reject { |path| path.start_with?("tailwind/") }
|
|
11
18
|
end
|
data/lib/kiso/themes/avatar.rb
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
module Kiso
|
|
2
2
|
module Themes
|
|
3
|
+
# User avatar with image, fallback initials, optional status badge,
|
|
4
|
+
# and group layout.
|
|
5
|
+
#
|
|
6
|
+
# Supports automatic contrast text color for initials via
|
|
7
|
+
# {ColorUtils.contrast_text_color} in the partial.
|
|
8
|
+
#
|
|
9
|
+
# @example
|
|
10
|
+
# Avatar.render(size: :md)
|
|
11
|
+
#
|
|
12
|
+
# Variants:
|
|
13
|
+
# - +size+ -- :xs, :sm, :md (default), :lg, :xl, :2xl
|
|
14
|
+
#
|
|
15
|
+
# Sub-parts: {AvatarImage}, {AvatarFallback}, {AvatarBadge},
|
|
16
|
+
# {AvatarGroup}, {AvatarGroupCount}
|
|
3
17
|
Avatar = ClassVariants.build(
|
|
4
18
|
base: "group/avatar relative flex shrink-0 rounded-full select-none items-center justify-center bg-muted",
|
|
5
19
|
variants: {
|
|
@@ -7,16 +21,23 @@ module Kiso
|
|
|
7
21
|
xs: "size-5",
|
|
8
22
|
sm: "size-6",
|
|
9
23
|
md: "size-8",
|
|
10
|
-
lg: "size-10"
|
|
24
|
+
lg: "size-10",
|
|
25
|
+
xl: "size-16",
|
|
26
|
+
"2xl": "size-20"
|
|
11
27
|
}
|
|
12
28
|
},
|
|
13
29
|
defaults: {size: :md}
|
|
14
30
|
)
|
|
15
31
|
|
|
32
|
+
# The +<img>+ element, absolutely positioned to fill the avatar circle.
|
|
16
33
|
AvatarImage = ClassVariants.build(
|
|
17
34
|
base: "absolute inset-0 aspect-square size-full rounded-full object-cover"
|
|
18
35
|
)
|
|
19
36
|
|
|
37
|
+
# Initials or icon shown when no image is provided.
|
|
38
|
+
#
|
|
39
|
+
# Variants:
|
|
40
|
+
# - +size+ -- :xs, :sm, :md (default), :lg, :xl, :2xl (controls font size)
|
|
20
41
|
AvatarFallback = ClassVariants.build(
|
|
21
42
|
base: "flex size-full items-center justify-center rounded-full bg-muted text-muted-foreground font-medium",
|
|
22
43
|
variants: {
|
|
@@ -24,35 +45,48 @@ module Kiso
|
|
|
24
45
|
xs: "text-[10px]",
|
|
25
46
|
sm: "text-xs",
|
|
26
47
|
md: "text-sm",
|
|
27
|
-
lg: "text-base"
|
|
48
|
+
lg: "text-base",
|
|
49
|
+
xl: "text-2xl",
|
|
50
|
+
"2xl": "text-3xl"
|
|
28
51
|
}
|
|
29
52
|
},
|
|
30
53
|
defaults: {size: :md}
|
|
31
54
|
)
|
|
32
55
|
|
|
56
|
+
# Status indicator dot positioned at the bottom-right corner.
|
|
57
|
+
# Size adapts to the parent avatar via +group-data-[size=*]+ selectors.
|
|
33
58
|
AvatarBadge = ClassVariants.build(
|
|
34
59
|
base: "bg-primary text-primary-foreground ring-background absolute right-0 bottom-0 z-10 " \
|
|
35
60
|
"inline-flex items-center justify-center rounded-full ring-2 select-none " \
|
|
36
61
|
"group-data-[size=xs]/avatar:size-1.5 group-data-[size=xs]/avatar:[&>svg]:hidden " \
|
|
37
62
|
"group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden " \
|
|
38
63
|
"group-data-[size=md]/avatar:size-2.5 group-data-[size=md]/avatar:[&>svg]:size-2 " \
|
|
39
|
-
"group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2"
|
|
64
|
+
"group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2 " \
|
|
65
|
+
"group-data-[size=xl]/avatar:size-4 group-data-[size=xl]/avatar:[&>svg]:size-3 " \
|
|
66
|
+
"group-data-[size=2xl]/avatar:size-5 group-data-[size=2xl]/avatar:[&>svg]:size-3.5"
|
|
40
67
|
)
|
|
41
68
|
|
|
69
|
+
# Overlapping row of avatars with negative spacing.
|
|
42
70
|
AvatarGroup = ClassVariants.build(
|
|
43
71
|
base: "*:data-[slot=avatar]:ring-background group/avatar-group flex -space-x-2 " \
|
|
44
72
|
"*:data-[slot=avatar]:ring-2"
|
|
45
73
|
)
|
|
46
74
|
|
|
75
|
+
# "+N" overflow indicator at the end of an {AvatarGroup}.
|
|
47
76
|
AvatarGroupCount = ClassVariants.build(
|
|
48
77
|
base: "bg-muted text-muted-foreground ring-background relative flex size-8 shrink-0 " \
|
|
49
78
|
"items-center justify-center rounded-full text-sm ring-2 " \
|
|
50
79
|
"group-has-data-[size=xs]/avatar-group:size-5 " \
|
|
51
|
-
"group-has-data-[size=lg]/avatar-group:size-10 " \
|
|
52
80
|
"group-has-data-[size=sm]/avatar-group:size-6 " \
|
|
53
|
-
"
|
|
81
|
+
"group-has-data-[size=lg]/avatar-group:size-10 " \
|
|
82
|
+
"group-has-data-[size=xl]/avatar-group:size-16 " \
|
|
83
|
+
"group-has-data-[size=2xl]/avatar-group:size-20 " \
|
|
84
|
+
"[&>svg]:size-4 " \
|
|
54
85
|
"group-has-data-[size=xs]/avatar-group:[&>svg]:size-2.5 " \
|
|
55
|
-
"group-has-data-[size=sm]/avatar-group:[&>svg]:size-3"
|
|
86
|
+
"group-has-data-[size=sm]/avatar-group:[&>svg]:size-3 " \
|
|
87
|
+
"group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 " \
|
|
88
|
+
"group-has-data-[size=xl]/avatar-group:[&>svg]:size-6 " \
|
|
89
|
+
"group-has-data-[size=2xl]/avatar-group:[&>svg]:size-7"
|
|
56
90
|
)
|
|
57
91
|
end
|
|
58
92
|
end
|
data/lib/kiso/themes/badge.rb
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
module Kiso
|
|
2
2
|
module Themes
|
|
3
|
-
#
|
|
3
|
+
# The seven semantic colors shared by all colored components.
|
|
4
|
+
# Used by compound variant definitions in Badge, Alert, Button, Checkbox,
|
|
5
|
+
# RadioGroup, Switch, and others.
|
|
6
|
+
#
|
|
7
|
+
# @return [Array<Symbol>]
|
|
4
8
|
COLORS = %i[primary secondary success info warning error neutral].freeze
|
|
5
9
|
|
|
6
10
|
# Inline badge for status labels, counts, and tags.
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
module Kiso
|
|
2
2
|
module Themes
|
|
3
|
+
# Light/dark mode toggle button with sun and moon icons.
|
|
4
|
+
#
|
|
5
|
+
# Uses the +kiso--theme+ Stimulus controller to cycle between
|
|
6
|
+
# light and dark modes. Icon visibility is controlled via CSS
|
|
7
|
+
# (see +color-mode-button.css+).
|
|
8
|
+
#
|
|
9
|
+
# @example
|
|
10
|
+
# ColorModeButton.render(size: :md)
|
|
11
|
+
#
|
|
12
|
+
# Variants:
|
|
13
|
+
# - +size+ -- :sm, :md (default), :lg
|
|
3
14
|
ColorModeButton = ClassVariants.build(
|
|
4
15
|
base: "inline-flex items-center justify-center rounded-md text-foreground/50 hover:text-foreground hover:bg-accent transition-colors duration-150 shrink-0 cursor-pointer",
|
|
5
16
|
variants: {
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
module Kiso
|
|
2
2
|
module Themes
|
|
3
|
+
# Dropdown select for choosing between Light, Dark, and System color modes.
|
|
4
|
+
#
|
|
5
|
+
# Wraps a {SelectNative} element with the +kiso--theme+ Stimulus controller.
|
|
6
|
+
# No variants -- styling is handled by the inner select component.
|
|
7
|
+
#
|
|
8
|
+
# @example
|
|
9
|
+
# ColorModeSelect.render
|
|
3
10
|
ColorModeSelect = ClassVariants.build(
|
|
4
11
|
base: ""
|
|
5
12
|
)
|
|
@@ -1,49 +1,77 @@
|
|
|
1
1
|
module Kiso
|
|
2
2
|
module Themes
|
|
3
|
+
# Dashboard layout system -- composable components for admin/app shells.
|
|
4
|
+
#
|
|
5
|
+
# The dashboard uses CSS Grid for layout with a sidebar, navbar, and
|
|
6
|
+
# main content panel. CSS mechanics (grid tracks, sidebar animation,
|
|
7
|
+
# mobile overlay) live in +dashboard.css+ using +[data-slot]+ selectors.
|
|
8
|
+
# Sidebar state is persisted via cookies.
|
|
9
|
+
#
|
|
10
|
+
# @example
|
|
11
|
+
# DashboardGroup.render
|
|
12
|
+
#
|
|
13
|
+
# Sub-parts: {DashboardNavbar}, {DashboardNavbarToggle}, {DashboardSidebar},
|
|
14
|
+
# {DashboardPanel}, {DashboardSidebarHeader}, {DashboardSidebarFooter},
|
|
15
|
+
# {DashboardSidebarToggle}, {DashboardSidebarCollapse}, {DashboardToolbar},
|
|
16
|
+
# {DashboardToolbarLeft}, {DashboardToolbarRight}
|
|
17
|
+
|
|
18
|
+
# Root grid container spanning the full viewport height.
|
|
3
19
|
DashboardGroup = ClassVariants.build(
|
|
4
20
|
base: "grid h-dvh overflow-hidden bg-background text-foreground antialiased"
|
|
5
21
|
)
|
|
6
22
|
|
|
23
|
+
# Top navigation bar with border-bottom separator.
|
|
7
24
|
DashboardNavbar = ClassVariants.build(
|
|
8
25
|
base: "flex items-center gap-3 px-4 border-b border-border bg-background shrink-0 z-(--z-topbar)"
|
|
9
26
|
)
|
|
10
27
|
|
|
28
|
+
# Icon button inside the navbar (e.g., sidebar toggle, color mode).
|
|
11
29
|
DashboardNavbarToggle = ClassVariants.build(
|
|
12
30
|
base: "flex items-center justify-center w-8 h-8 rounded-md text-foreground/50 hover:text-foreground hover:bg-accent transition-colors duration-150 shrink-0 [&>svg]:size-4"
|
|
13
31
|
)
|
|
14
32
|
|
|
33
|
+
# Collapsible side panel for navigation. Width and animation
|
|
34
|
+
# controlled by CSS custom properties in +dashboard.css+.
|
|
15
35
|
DashboardSidebar = ClassVariants.build(
|
|
16
36
|
base: "overflow-hidden"
|
|
17
37
|
)
|
|
18
38
|
|
|
39
|
+
# Scrollable main content area beside the sidebar.
|
|
19
40
|
DashboardPanel = ClassVariants.build(
|
|
20
41
|
base: "min-w-0 overflow-y-auto bg-background"
|
|
21
42
|
)
|
|
22
43
|
|
|
44
|
+
# Top section of the sidebar (e.g., logo, search).
|
|
23
45
|
DashboardSidebarHeader = ClassVariants.build(
|
|
24
46
|
base: "shrink-0 flex flex-col gap-2 p-2"
|
|
25
47
|
)
|
|
26
48
|
|
|
49
|
+
# Bottom section of the sidebar (e.g., user menu).
|
|
27
50
|
DashboardSidebarFooter = ClassVariants.build(
|
|
28
51
|
base: "shrink-0 flex flex-col gap-2 p-2"
|
|
29
52
|
)
|
|
30
53
|
|
|
54
|
+
# Mobile-only button to open/close the sidebar overlay.
|
|
31
55
|
DashboardSidebarToggle = ClassVariants.build(
|
|
32
56
|
base: "lg:hidden flex items-center justify-center w-8 h-8 rounded-md text-foreground/50 hover:text-foreground hover:bg-accent transition-colors duration-150 shrink-0 cursor-pointer [&>svg]:size-4"
|
|
33
57
|
)
|
|
34
58
|
|
|
59
|
+
# Desktop-only button to collapse the sidebar to icon-only width.
|
|
35
60
|
DashboardSidebarCollapse = ClassVariants.build(
|
|
36
61
|
base: "hidden lg:flex items-center justify-center w-8 h-8 rounded-md text-foreground/50 hover:text-foreground hover:bg-accent transition-colors duration-150 shrink-0 cursor-pointer [&>svg]:size-4"
|
|
37
62
|
)
|
|
38
63
|
|
|
64
|
+
# Secondary toolbar below the navbar with left/right content slots.
|
|
39
65
|
DashboardToolbar = ClassVariants.build(
|
|
40
66
|
base: "shrink-0 flex items-center justify-between border-b border-border px-4 sm:px-6 gap-1.5 overflow-x-auto h-(--topbar-height)"
|
|
41
67
|
)
|
|
42
68
|
|
|
69
|
+
# Left-aligned content area within {DashboardToolbar}.
|
|
43
70
|
DashboardToolbarLeft = ClassVariants.build(
|
|
44
71
|
base: "flex items-center gap-1.5"
|
|
45
72
|
)
|
|
46
73
|
|
|
74
|
+
# Right-aligned content area within {DashboardToolbar}.
|
|
47
75
|
DashboardToolbarRight = ClassVariants.build(
|
|
48
76
|
base: "flex items-center gap-1.5"
|
|
49
77
|
)
|
|
@@ -21,7 +21,7 @@ module Kiso
|
|
|
21
21
|
|
|
22
22
|
# The dropdown panel containing menu items.
|
|
23
23
|
DropdownMenuContent = ClassVariants.build(
|
|
24
|
-
base: "bg-background text-foreground z-50 min-w-32 " \
|
|
24
|
+
base: "bg-background text-foreground z-50 min-w-32 whitespace-nowrap " \
|
|
25
25
|
"overflow-x-hidden overflow-y-auto rounded-md ring ring-inset ring-border p-1 shadow-md"
|
|
26
26
|
)
|
|
27
27
|
|
|
@@ -101,7 +101,7 @@ module Kiso
|
|
|
101
101
|
|
|
102
102
|
# Panel for nested sub-menu items (same as {DropdownMenuContent} but +shadow-lg+).
|
|
103
103
|
DropdownMenuSubContent = ClassVariants.build(
|
|
104
|
-
base: "bg-background text-foreground z-50 min-w-32 " \
|
|
104
|
+
base: "bg-background text-foreground z-50 min-w-32 whitespace-nowrap " \
|
|
105
105
|
"overflow-hidden rounded-md ring ring-inset ring-border p-1 shadow-lg"
|
|
106
106
|
)
|
|
107
107
|
end
|
|
@@ -9,16 +9,19 @@ module Kiso
|
|
|
9
9
|
base: "relative text-foreground flex items-center gap-2 has-disabled:opacity-50"
|
|
10
10
|
)
|
|
11
11
|
|
|
12
|
-
# Groups adjacent
|
|
12
|
+
# Groups adjacent {InputOtpSlot} elements visually (e.g., first 3 digits, last 3 digits).
|
|
13
13
|
InputOtpGroup = ClassVariants.build(
|
|
14
14
|
base: "flex items-center"
|
|
15
15
|
)
|
|
16
16
|
|
|
17
17
|
# Individual character display slot with connected borders.
|
|
18
|
-
# Content and active state managed by +kiso--input-otp+ controller.
|
|
18
|
+
# Content and active state managed by the +kiso--input-otp+ Stimulus controller.
|
|
19
19
|
#
|
|
20
20
|
# @example
|
|
21
21
|
# InputOtpSlot.render(size: :md)
|
|
22
|
+
#
|
|
23
|
+
# Variants:
|
|
24
|
+
# - +size+ -- :sm, :md (default), :lg
|
|
22
25
|
InputOtpSlot = ClassVariants.build(
|
|
23
26
|
base: "border-border relative flex items-center justify-center " \
|
|
24
27
|
"border -ml-px shadow-xs transition-all outline-none " \
|
|
@@ -38,7 +41,7 @@ module Kiso
|
|
|
38
41
|
defaults: {size: :md}
|
|
39
42
|
)
|
|
40
43
|
|
|
41
|
-
#
|
|
44
|
+
# Visual separator between {InputOtpGroup} elements (renders a minus icon by default).
|
|
42
45
|
InputOtpSeparator = ClassVariants.build(
|
|
43
46
|
base: "flex items-center text-muted-foreground [&>svg]:size-4"
|
|
44
47
|
)
|
data/lib/kiso/themes/nav.rb
CHANGED
|
@@ -1,25 +1,42 @@
|
|
|
1
1
|
module Kiso
|
|
2
2
|
module Themes
|
|
3
|
+
# Sidebar navigation menu with collapsible sections.
|
|
4
|
+
#
|
|
5
|
+
# Designed for use inside {DashboardSidebar}. Sections use native
|
|
6
|
+
# +<details>+ elements for expand/collapse without JavaScript.
|
|
7
|
+
#
|
|
8
|
+
# @example
|
|
9
|
+
# Nav.render
|
|
10
|
+
#
|
|
11
|
+
# Sub-parts: {NavSection}, {NavSectionTitle}, {NavSectionContent},
|
|
12
|
+
# {NavItem}, {NavItemBadge}
|
|
13
|
+
|
|
14
|
+
# Root navigation container.
|
|
3
15
|
Nav = ClassVariants.build(
|
|
4
16
|
base: "flex flex-col gap-2"
|
|
5
17
|
)
|
|
6
18
|
|
|
19
|
+
# Collapsible group of related navigation items.
|
|
7
20
|
NavSection = ClassVariants.build(
|
|
8
21
|
base: "relative flex w-full min-w-0 flex-col gap-1 p-2"
|
|
9
22
|
)
|
|
10
23
|
|
|
24
|
+
# Section heading that acts as the +<summary>+ toggle for a +<details>+ element.
|
|
11
25
|
NavSectionTitle = ClassVariants.build(
|
|
12
26
|
base: "flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-muted-foreground cursor-pointer select-none list-none [&::-webkit-details-marker]:hidden"
|
|
13
27
|
)
|
|
14
28
|
|
|
29
|
+
# Container for the list of {NavItem} elements inside a section.
|
|
15
30
|
NavSectionContent = ClassVariants.build(
|
|
16
31
|
base: "flex w-full min-w-0 flex-col gap-1 text-sm"
|
|
17
32
|
)
|
|
18
33
|
|
|
34
|
+
# Individual navigation link. Highlights via +data-[active=true]+.
|
|
19
35
|
NavItem = ClassVariants.build(
|
|
20
36
|
base: "group relative w-full flex items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm outline-hidden transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:ring-2 focus-visible:ring-ring data-[active=true]:bg-accent data-[active=true]:font-medium data-[active=true]:text-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0"
|
|
21
37
|
)
|
|
22
38
|
|
|
39
|
+
# Counter or status badge aligned to the right side of a {NavItem}.
|
|
23
40
|
NavItemBadge = ClassVariants.build(
|
|
24
41
|
base: "ms-auto pointer-events-none flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none"
|
|
25
42
|
)
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
module Kiso
|
|
2
2
|
module Themes
|
|
3
|
-
#
|
|
4
|
-
#
|
|
3
|
+
# Shared base classes for all pagination link-type elements.
|
|
4
|
+
# Matches shadcn's buttonVariants base (ghost/outline neutral).
|
|
5
|
+
#
|
|
6
|
+
# @return [String]
|
|
5
7
|
PAGINATION_LINK_BASE = "inline-flex items-center justify-center whitespace-nowrap rounded-md " \
|
|
6
8
|
"text-sm font-medium transition-all " \
|
|
7
9
|
"focus-visible:outline-2 focus-visible:outline-offset-2 " \
|
|
@@ -9,8 +11,11 @@ module Kiso
|
|
|
9
11
|
"aria-disabled:cursor-not-allowed aria-disabled:opacity-50 " \
|
|
10
12
|
"#{Shared::SVG_BASE}"
|
|
11
13
|
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
+
# Shared active/inactive variants for pagination links.
|
|
15
|
+
# +active: true+ renders outline neutral style (current page),
|
|
16
|
+
# +active: false+ renders ghost style (other pages).
|
|
17
|
+
#
|
|
18
|
+
# @return [Hash{Symbol => Hash}]
|
|
14
19
|
PAGINATION_ACTIVE_VARIANTS = {
|
|
15
20
|
active: {
|
|
16
21
|
true => "ring ring-inset text-foreground bg-background ring-accented " \
|
data/lib/kiso/themes/shared.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module Kiso
|
|
2
|
-
#
|
|
2
|
+
# Namespace for all Kiso component theme definitions.
|
|
3
3
|
#
|
|
4
4
|
# Each constant is a +ClassVariants+ instance that maps variant options
|
|
5
5
|
# to Tailwind CSS class strings. Call +.render+ with variant options to
|
|
@@ -22,25 +22,45 @@ module Kiso
|
|
|
22
22
|
# SelectSeparator with +pointer-events-none+) should remain inline to
|
|
23
23
|
# preserve shadcn fidelity.
|
|
24
24
|
module Shared
|
|
25
|
+
# SVG child element base classes: disables pointer events, prevents shrinking,
|
|
26
|
+
# and sets default icon size when not explicitly sized.
|
|
27
|
+
#
|
|
25
28
|
# Used by: Button, Toggle, ToggleGroupItem, SelectTrigger, SelectItem,
|
|
26
29
|
# ComboboxItem, CommandItem, DropdownMenuItem, DropdownMenuSubTrigger,
|
|
27
30
|
# DropdownMenuCheckboxItem, DropdownMenuRadioItem (via CHECKABLE_ITEM),
|
|
28
31
|
# PaginationLink/Previous/Next (via PAGINATION_LINK_BASE)
|
|
32
|
+
#
|
|
33
|
+
# @return [String]
|
|
29
34
|
SVG_BASE = "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
|
|
30
35
|
|
|
31
|
-
#
|
|
32
|
-
#
|
|
36
|
+
# Horizontal separator line for items in dropdown-style menus.
|
|
37
|
+
#
|
|
38
|
+
# Used by: ComboboxSeparator, DropdownMenuSeparator.
|
|
39
|
+
# CommandSeparator omits +my-1+, SelectSeparator adds +pointer-events-none+ --
|
|
40
|
+
# both per shadcn, so they remain inline.
|
|
41
|
+
#
|
|
42
|
+
# @return [String]
|
|
33
43
|
ITEM_SEPARATOR = "bg-border -mx-1 my-1 h-px"
|
|
34
44
|
|
|
35
|
-
#
|
|
36
|
-
#
|
|
45
|
+
# Non-interactive group heading in dropdown-style menus.
|
|
46
|
+
#
|
|
47
|
+
# Used by: ComboboxLabel, SelectLabel.
|
|
48
|
+
# CommandGroupHeading adds +font-medium+ per shadcn, so it remains inline.
|
|
49
|
+
#
|
|
50
|
+
# @return [String]
|
|
37
51
|
MENU_LABEL = "text-muted-foreground px-2 py-1.5 text-xs"
|
|
38
52
|
|
|
39
|
-
#
|
|
53
|
+
# Keyboard shortcut hint aligned to the right of a menu item.
|
|
54
|
+
#
|
|
55
|
+
# Used by: CommandShortcut, DropdownMenuShortcut.
|
|
56
|
+
#
|
|
57
|
+
# @return [String]
|
|
40
58
|
MENU_SHORTCUT = "text-muted-foreground ml-auto text-xs tracking-widest"
|
|
41
59
|
|
|
42
60
|
# Shared base for checkbox and radio items in DropdownMenu.
|
|
43
|
-
# These are structurally identical
|
|
61
|
+
# These are structurally identical -- same layout, same interactive states.
|
|
62
|
+
#
|
|
63
|
+
# @return [String]
|
|
44
64
|
CHECKABLE_ITEM = "relative flex cursor-default items-center gap-2 rounded-sm " \
|
|
45
65
|
"py-1.5 pr-2 pl-8 text-sm outline-none select-none " \
|
|
46
66
|
"data-[highlighted]:bg-elevated data-[highlighted]:text-foreground " \
|
data/lib/kiso/version.rb
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Kiso
|
|
4
|
-
#
|
|
5
|
-
|
|
4
|
+
# Current version of the Kiso gem, following semantic versioning.
|
|
5
|
+
# Updated by +bin/release+.
|
|
6
|
+
#
|
|
7
|
+
# @return [String]
|
|
8
|
+
VERSION = "0.6.0.pre"
|
|
6
9
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kiso
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0.pre
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Steve Clarke
|
|
@@ -337,6 +337,10 @@ files:
|
|
|
337
337
|
- lib/generators/kiso/component/templates/sub_part_partial.html.erb.tt
|
|
338
338
|
- lib/generators/kiso/component/templates/sub_part_theme.rb.tt
|
|
339
339
|
- lib/generators/kiso/component/templates/theme.rb.tt
|
|
340
|
+
- lib/generators/kiso/install/USAGE
|
|
341
|
+
- lib/generators/kiso/install/install_generator.rb
|
|
342
|
+
- lib/generators/kiso/install/templates/design_system.md.tt
|
|
343
|
+
- lib/generators/kiso/install/templates/initializer.rb.tt
|
|
340
344
|
- lib/kiso.rb
|
|
341
345
|
- lib/kiso/cli.rb
|
|
342
346
|
- lib/kiso/cli/base.rb
|