plutonium 0.27.0 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/app/assets/plutonium.css +2 -2
  4. data/app/assets/plutonium.js +13 -3
  5. data/app/assets/plutonium.js.map +3 -3
  6. data/app/assets/plutonium.min.js +1 -1
  7. data/app/assets/plutonium.min.js.map +2 -2
  8. data/app/views/resource/_resource_details.rabl +44 -1
  9. data/app/views/resource/index.rabl +44 -1
  10. data/app/views/resource/show.rabl +44 -1
  11. data/docs/guide/theming.md +431 -0
  12. data/lib/plutonium/core/controller.rb +5 -0
  13. data/lib/plutonium/interaction/response/redirect.rb +8 -0
  14. data/lib/plutonium/resource/controller.rb +7 -3
  15. data/lib/plutonium/resource/controllers/crud_actions.rb +1 -0
  16. data/lib/plutonium/ui/action_button.rb +11 -5
  17. data/lib/plutonium/ui/block.rb +4 -1
  18. data/lib/plutonium/ui/breadcrumbs.rb +10 -8
  19. data/lib/plutonium/ui/color_mode_selector.rb +2 -2
  20. data/lib/plutonium/ui/component/behaviour.rb +8 -0
  21. data/lib/plutonium/ui/component/kit.rb +1 -1
  22. data/lib/plutonium/ui/component/theme.rb +47 -0
  23. data/lib/plutonium/ui/display/components/attachment.rb +2 -2
  24. data/lib/plutonium/ui/display/theme.rb +16 -16
  25. data/lib/plutonium/ui/empty_card.rb +5 -2
  26. data/lib/plutonium/ui/form/components/key_value_store.rb +11 -11
  27. data/lib/plutonium/ui/form/components/secure_association.rb +2 -2
  28. data/lib/plutonium/ui/form/components/uppy.rb +5 -5
  29. data/lib/plutonium/ui/form/concerns/renders_nested_resource_fields.rb +5 -5
  30. data/lib/plutonium/ui/form/query.rb +11 -11
  31. data/lib/plutonium/ui/form/resource.rb +2 -2
  32. data/lib/plutonium/ui/form/theme.rb +17 -17
  33. data/lib/plutonium/ui/layout/base.rb +2 -2
  34. data/lib/plutonium/ui/layout/header.rb +10 -7
  35. data/lib/plutonium/ui/layout/rodauth_layout.rb +5 -5
  36. data/lib/plutonium/ui/layout/sidebar.rb +2 -2
  37. data/lib/plutonium/ui/nav_grid_menu.rb +6 -6
  38. data/lib/plutonium/ui/nav_user.rb +8 -7
  39. data/lib/plutonium/ui/page/interactive_action.rb +4 -4
  40. data/lib/plutonium/ui/page_header.rb +7 -4
  41. data/lib/plutonium/ui/panel.rb +3 -3
  42. data/lib/plutonium/ui/sidebar_menu.rb +12 -12
  43. data/lib/plutonium/ui/skeleton_table.rb +8 -8
  44. data/lib/plutonium/ui/tab_list.rb +5 -3
  45. data/lib/plutonium/ui/table/components/attachment.rb +2 -2
  46. data/lib/plutonium/ui/table/components/pagy_info.rb +3 -3
  47. data/lib/plutonium/ui/table/components/pagy_pagination.rb +3 -3
  48. data/lib/plutonium/ui/table/components/scopes_bar.rb +14 -14
  49. data/lib/plutonium/ui/table/display_theme.rb +3 -3
  50. data/lib/plutonium/ui/table/resource.rb +2 -2
  51. data/lib/plutonium/ui/table/theme.rb +13 -13
  52. data/lib/plutonium/version.rb +1 -1
  53. data/lib/tasks/release.rake +45 -5
  54. data/package.json +1 -1
  55. data/src/css/core.css +2 -2
  56. data/src/css/easymde.css +8 -8
  57. data/src/css/intl_tel_input.css +7 -7
  58. data/src/css/slim_select.css +5 -5
  59. data/src/js/controllers/color_mode_controller.js +19 -3
  60. data/tailwind.options.js +75 -47
  61. metadata +4 -2
@@ -41,7 +41,7 @@ module Plutonium
41
41
  # @return [void]
42
42
  def view_template
43
43
  nav(
44
- class: "bg-white border-b border-gray-200 px-4 py-2.5 dark:bg-gray-800 dark:border-gray-700 fixed left-0 right-0 top-0 z-50",
44
+ class: tokens(theme_class(:header), "bg-surface border-b border-gray-200 px-md py-sm dark:bg-surface-dark dark:border-gray-700 fixed left-0 right-0 top-0 z-50"),
45
45
  data: {
46
46
  controller: "resource-header",
47
47
  resource_header_sidebar_outlet: "#sidebar-navigation"
@@ -59,7 +59,7 @@ module Plutonium
59
59
  # Renders the color mode toggle controls
60
60
  # @private
61
61
  def render_color_mode_controls
62
- div(class: "bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700") do
62
+ div(class: "bg-surface dark:bg-surface-dark border-gray-200 dark:border-gray-700") do
63
63
  render ColorModeSelector.new
64
64
  end
65
65
  end
@@ -80,10 +80,13 @@ module Plutonium
80
80
  button(
81
81
  data_action: "resource-header#toggleDrawer",
82
82
  aria_controls: "#sidebar-navigation",
83
- class: %(p-2 mr-2 text-gray-600 rounded-lg cursor-pointer lg:hidden hover:text-gray-900
84
- hover:bg-gray-100 focus:bg-gray-100 dark:focus:bg-gray-700 focus:ring-2
83
+ class: tokens(
84
+ theme_class(:header, element: :sidebar_toggle),
85
+ %(p-2 mr-sm text-gray-600 rounded-sm cursor-pointer lg:hidden hover:text-gray-900
86
+ hover:bg-interactive focus:bg-interactive dark:focus:bg-interactive-dark focus:ring-2
85
87
  focus:ring-gray-100 dark:focus:ring-gray-700 dark:text-gray-200
86
- dark:hover:bg-gray-700 dark:hover:text-white)
88
+ dark:hover:bg-interactive-dark dark:hover:text-white)
89
+ )
87
90
  ) do
88
91
  render_toggle_icons
89
92
  end
@@ -92,7 +95,7 @@ module Plutonium
92
95
  # Renders the brand section with logo and/or name
93
96
  # @private
94
97
  def render_brand
95
- a(href: root_path, class: "flex items-center space-x-2 md:min-w-60") do
98
+ a(href: root_path, class: "flex items-center space-x-sm md:min-w-60") do
96
99
  render brand_logo_slot if brand_logo_slot?
97
100
  if brand_name_slot?
98
101
  span(class: "self-center text-2xl font-semibold whitespace-nowrap dark:text-white hidden xs:block") do
@@ -119,7 +122,7 @@ module Plutonium
119
122
  # Renders the action buttons section
120
123
  # @private
121
124
  def render_actions
122
- div(class: "flex items-center space-x-2") do
125
+ div(class: "flex items-center space-x-sm") do
123
126
  render_color_mode_controls
124
127
 
125
128
  div(class: "flex items-center lg:order-2") do
@@ -11,14 +11,14 @@ module Plutonium
11
11
  end
12
12
 
13
13
  def main_attributes = mix(super, {
14
- class: "flex flex-col items-center justify-center gap-2 px-6 py-8 mx-auto lg:py-0"
14
+ class: "flex flex-col items-center justify-center gap-sm px-lg py-xl mx-auto lg:py-0"
15
15
  })
16
16
 
17
17
  def render_content(&)
18
18
  render_logo
19
19
 
20
- div(class: "w-full bg-white rounded-lg shadow dark:border md:mt-0 sm:max-w-md xl:p-0 dark:bg-gray-800 dark:border-gray-700") {
21
- div(class: "p-6 space-y-4 md:space-y-6 sm:p-8", &)
20
+ div(class: "w-full bg-surface rounded-sm shadow dark:border md:mt-0 sm:max-w-md xl:p-0 dark:bg-surface-dark dark:border-gray-700") {
21
+ div(class: "p-lg space-y-md md:space-y-lg sm:p-xl", &)
22
22
  }
23
23
 
24
24
  render_links
@@ -26,12 +26,12 @@ module Plutonium
26
26
 
27
27
  def render_logo
28
28
  link_to root_path, class: "flex items-center text-2xl font-semibold text-gray-900 dark:text-white mb-2" do
29
- helpers.resource_logo_tag classname: "w-24 h-24 mr-2 rounded-md"
29
+ helpers.resource_logo_tag classname: "w-24 h-24 mr-sm rounded"
30
30
  end
31
31
  end
32
32
 
33
33
  def render_links
34
- div(class: "mt-4 flex items-center font-medium text-secondary-600 dark:text-secondary-400 hover:underline") {
34
+ div(class: "mt-md flex items-center font-medium text-secondary-600 dark:text-secondary-400 hover:underline") {
35
35
  render Phlex::TablerIcons::Home2.new
36
36
  link_to "Home", root_path, class: "font-medium text-secondary-600 dark:text-secondary-400"
37
37
  }
@@ -26,7 +26,7 @@ module Plutonium
26
26
  data: {controller: "sidebar"},
27
27
  id: "sidebar-navigation",
28
28
  aria: {label: "Sidebar Navigation"},
29
- class: "fixed top-0 left-0 z-40 w-64 h-screen pt-14 transition-transform -translate-x-full lg:translate-x-0",
29
+ class: tokens(theme_class(:sidebar, element: :container), "fixed top-0 left-0 z-40 w-64 h-screen pt-14 transition-transform -translate-x-full lg:translate-x-0"),
30
30
  &
31
31
  )
32
32
  end
@@ -36,7 +36,7 @@ module Plutonium
36
36
  div(
37
37
  id: "sidebar-navigation-content",
38
38
  data: {turbo_permanent: true},
39
- class: "overflow-y-auto py-5 px-3 h-full bg-white border-r border-gray-200 dark:bg-gray-800 dark:border-gray-700",
39
+ class: tokens(theme_class(:sidebar, element: :content), "overflow-y-auto py-md px-sm h-full bg-surface border-r border-gray-200 dark:bg-surface-dark dark:border-gray-700"),
40
40
  &
41
41
  )
42
42
  end
@@ -32,7 +32,7 @@ module Plutonium
32
32
 
33
33
  def view_template
34
34
  a(
35
- class: "block p-4 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-600 group",
35
+ class: tokens(theme_class(:nav, variant: :grid, element: :item), "block p-md rounded-sm hover:bg-interactive dark:hover:bg-interactive-dark group"),
36
36
  href: @href
37
37
  ) do
38
38
  render @icon.new(
@@ -55,7 +55,7 @@ module Plutonium
55
55
  end
56
56
 
57
57
  def view_template
58
- div(data: {controller: "resource-drop-down"}) do
58
+ div(class: theme_class(:nav, variant: :grid), data: {controller: "resource-drop-down"}) do
59
59
  render_trigger_button
60
60
  render_dropdown_menu
61
61
  end
@@ -67,7 +67,7 @@ module Plutonium
67
67
  button(
68
68
  type: "button",
69
69
  data: {resource_drop_down_target: "trigger"},
70
- class: "p-2 text-gray-500 rounded-lg hover:text-gray-900 hover:bg-gray-100 dark:text-gray-200 dark:hover:text-white dark:hover:bg-gray-700 focus:ring-4 focus:ring-gray-300 dark:focus:ring-gray-600"
70
+ class: tokens(theme_class(:nav, variant: :grid, element: :trigger), "p-2 text-gray-500 rounded-sm hover:text-gray-900 hover:bg-interactive dark:text-gray-200 dark:hover:text-white dark:hover:bg-interactive-dark focus:ring-4 focus:ring-gray-300 dark:focus:ring-gray-600")
71
71
  ) do
72
72
  span(class: "sr-only") { "View #{@label}" }
73
73
  render @icon.new(class: "w-6 h-6")
@@ -76,14 +76,14 @@ module Plutonium
76
76
 
77
77
  def render_dropdown_menu
78
78
  div(
79
- class: "hidden overflow-hidden z-50 my-4 max-w-sm text-base list-none bg-white divide-y divide-gray-100 shadow-lg dark:bg-gray-700 dark:divide-gray-600 rounded-xl",
79
+ class: tokens(theme_class(:nav, variant: :grid, element: :dropdown), "hidden overflow-hidden z-50 my-md max-w-sm text-base list-none bg-surface divide-y divide-gray-100 shadow-lg dark:bg-elevated-dark dark:divide-gray-600 rounded"),
80
80
  data: {resource_drop_down_target: "menu"}
81
81
  ) do
82
82
  div(
83
- class: "block py-2 px-4 text-base font-medium text-center text-gray-700 bg-gray-50 dark:bg-gray-600 dark:text-gray-300"
83
+ class: "block py-sm px-md text-base font-medium text-center text-gray-700 bg-page dark:bg-gray-600 dark:text-gray-300"
84
84
  ) { @label }
85
85
 
86
- div(class: "grid grid-cols-3 gap-4 p-4") do
86
+ div(class: "grid grid-cols-3 gap-md p-md") do
87
87
  item_slots.each { |item| render item }
88
88
  end
89
89
  end
@@ -18,7 +18,8 @@ module Plutonium
18
18
  def view_template
19
19
  a(
20
20
  class: tokens(
21
- "flex justify-between items-center py-2 px-4 text-sm hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white",
21
+ theme_class(:nav_user, element: :link),
22
+ "flex justify-between items-center py-sm px-md text-sm hover:bg-interactive dark:hover:bg-interactive-dark dark:hover:text-white",
22
23
  @attributes.delete(:class)
23
24
  ),
24
25
  href: @href,
@@ -40,7 +41,7 @@ module Plutonium
40
41
 
41
42
  def view_template
42
43
  ul(
43
- class: "text-gray-700 dark:text-gray-300",
44
+ class: tokens(theme_class(:nav_user, element: :section), "text-gray-700 dark:text-gray-300"),
44
45
  aria: {labelledby: "user-nav-dropdown-toggle"}
45
46
  ) do
46
47
  link_slots.each do |link|
@@ -59,7 +60,7 @@ module Plutonium
59
60
  end
60
61
 
61
62
  def view_template
62
- div(data: {controller: "resource-drop-down"}) do
63
+ div(class: theme_class(:nav_user), data: {controller: "resource-drop-down"}) do
63
64
  render_trigger_button
64
65
  render_dropdown_menu
65
66
  end
@@ -78,7 +79,7 @@ module Plutonium
78
79
  def render_avatar_button
79
80
  button(
80
81
  type: "button",
81
- class: "flex mx-3 text-sm bg-gray-800 rounded-full md:mr-0 focus:ring-4 focus:ring-gray-300 dark:focus:ring-gray-600",
82
+ class: tokens(theme_class(:nav_user, element: :button), "flex mx-sm text-sm bg-gray-800 rounded-full md:mr-0 focus:ring-4 focus:ring-gray-300 dark:focus:ring-gray-600"),
82
83
  aria: {expanded: "false"},
83
84
  id: "user-nav-dropdown-toggle",
84
85
  data: {resource_drop_down_target: "trigger"}
@@ -91,7 +92,7 @@ module Plutonium
91
92
  def render_default_button
92
93
  button(
93
94
  type: "button",
94
- class: "flex mx-3 text-sm border border-gray-600 text-gray-500 hover:text-gray-900 hover:bg-gray-100 dark:text-gray-400 dark:hover:text-white dark:hover:bg-gray-700 rounded-full md:mr-0 focus:ring-4 focus:ring-gray-300 dark:focus:ring-gray-600",
95
+ class: tokens(theme_class(:nav_user, element: :button), "flex mx-sm text-sm border border-gray-600 text-gray-500 hover:text-gray-900 hover:bg-interactive dark:text-gray-400 dark:hover:text-white dark:hover:bg-interactive-dark rounded-full md:mr-0 focus:ring-4 focus:ring-gray-300 dark:focus:ring-gray-600"),
95
96
  aria: {expanded: "false"},
96
97
  id: "user-nav-dropdown-toggle",
97
98
  data: {resource_drop_down_target: "trigger"}
@@ -103,10 +104,10 @@ module Plutonium
103
104
 
104
105
  def render_dropdown_menu
105
106
  div(
106
- class: "hidden z-50 my-4 w-56 text-base list-none bg-white divide-y divide-gray-100 shadow dark:bg-gray-700 dark:divide-gray-600 rounded-xl",
107
+ class: tokens(theme_class(:nav_user, element: :menu), "hidden z-50 my-md w-56 text-base list-none bg-surface divide-y divide-gray-100 shadow dark:bg-elevated-dark dark:divide-gray-600 rounded"),
107
108
  data: {resource_drop_down_target: "menu"}
108
109
  ) do
109
- div(class: "py-3 px-4") do
110
+ div(class: "py-sm px-md") do
110
111
  if @name.present?
111
112
  span(class: "block text-sm font-semibold text-gray-900 dark:text-white") { @name }
112
113
  end
@@ -20,13 +20,13 @@ module Plutonium
20
20
  if helpers.current_turbo_frame == "remote_modal"
21
21
  dialog(
22
22
  closedby: "any",
23
- class: "rounded-md w-full max-w-3xl
24
- bg-white dark:bg-gray-800
23
+ class: "rounded w-full max-w-3xl
24
+ bg-surface dark:bg-surface-dark
25
25
  border border-gray-200 dark:border-gray-700
26
26
  shadow-lg dark:shadow-gray-900/20
27
27
  backdrop:bg-black/60 backdrop:backdrop-blur-sm
28
28
  top-auto md:top-1/2 md:-translate-y-1/2 left-1/2 -translate-x-1/2
29
- max-h-[80%] p-6
29
+ max-h-[80%] p-lg
30
30
  hidden open:flex flex-col
31
31
  relative opacity-0 open:opacity-100
32
32
  transition-opacity duration-300 ease-in-out",
@@ -35,7 +35,7 @@ module Plutonium
35
35
  # Close button
36
36
  button(
37
37
  type: "button",
38
- class: "absolute top-4 right-4 p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors duration-200",
38
+ class: "absolute top-4 right-4 p-sm text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors duration-200",
39
39
  data: {action: "remote-modal#close"},
40
40
  "aria-label": "Close dialog"
41
41
  ) do
@@ -8,7 +8,10 @@ module Plutonium
8
8
  end
9
9
 
10
10
  def view_template
11
- div(class: "sm:flex sm:space-y-0 sm:space-x-4 sm:flex-row items-center justify-between space-y-3 mb-6") {
11
+ div(class: tokens(
12
+ theme_class(:page, element: :header),
13
+ "sm:flex sm:space-y-0 sm:space-x-md sm:flex-row items-center justify-between space-y-sm mb-lg"
14
+ )) {
12
15
  div {
13
16
  phlexi_render(@title) {
14
17
  render_title @title
@@ -18,7 +21,7 @@ module Plutonium
18
21
  render_description @description
19
22
  }
20
23
  }
21
- div(class: "flex flex-row space-x-2") {
24
+ div(class: "flex flex-row space-x-sm") {
22
25
  render_actions
23
26
  }
24
27
  }
@@ -27,13 +30,13 @@ module Plutonium
27
30
  private
28
31
 
29
32
  def render_title(title)
30
- h2(class: "mb-2 text-3xl font-extrabold leading-none tracking-tight text-gray-900 md:text-4xl dark:text-white") {
33
+ h2(class: tokens(theme_class(:page, element: :header_title), "mb-2 text-3xl font-extrabold leading-none tracking-tight text-gray-900 md:text-4xl dark:text-white")) {
31
34
  title
32
35
  }
33
36
  end
34
37
 
35
38
  def render_description(description)
36
- p(class: "text-gray-500 dark:text-gray-400") {
39
+ p(class: tokens(theme_class(:page, element: :header_description), "text-gray-500 dark:text-gray-400")) {
37
40
  description
38
41
  }
39
42
  end
@@ -32,17 +32,17 @@ module Plutonium
32
32
  private
33
33
 
34
34
  def wrapped(&)
35
- div(class: "mt-6", &)
35
+ div(class: tokens(theme_class(:panel), "mt-lg"), &)
36
36
  end
37
37
 
38
38
  def render_toolbar
39
- div(class: %(flex justify-between items-center mb-4)) do
39
+ div(class: %(flex justify-between items-center mb-md)) do
40
40
  if @title
41
41
  h5(class: %(text-2xl font-bold tracking-tight text-gray-900 dark:text-white)) do
42
42
  @title
43
43
  end
44
44
  end
45
- div(class: "flex space-x-4") do
45
+ div(class: "flex space-x-md") do
46
46
  @items.each do |item|
47
47
  render item
48
48
  end
@@ -13,34 +13,34 @@ module Plutonium
13
13
  def self.theme
14
14
  super.merge({
15
15
  # Base container styles
16
- nav: "space-y-2 pb-6 mb-6",
17
- items_container: "space-y-2",
16
+ nav: "pu-sidebar-menu space-y-sm pb-lg mb-lg",
17
+ items_container: "pu-sidebar-menu-items space-y-sm",
18
18
 
19
19
  # Item wrapper styles
20
- item_wrapper: "w-full transition-colors duration-200 ease-in-out",
20
+ item_wrapper: "pu-sidebar-menu-item w-full transition-colors duration-200 ease-in-out",
21
21
  item_parent: nil,
22
22
 
23
23
  # Link and button base styles
24
- item_link: "flex items-center p-2 text-base font-normal text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700 group",
25
- item_span: "flex items-center p-2 w-full text-base font-normal text-gray-900 rounded-lg transition duration-75 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700",
24
+ item_link: "pu-sidebar-menu-link flex items-center p-sm text-base font-normal text-gray-900 rounded-sm dark:text-white hover:bg-interactive dark:hover:bg-interactive-dark group",
25
+ item_span: "pu-sidebar-menu-button flex items-center p-sm w-full text-base font-normal text-gray-900 rounded-sm transition duration-75 group hover:bg-interactive dark:text-white dark:hover:bg-interactive-dark",
26
26
 
27
27
  # Label and content styles
28
- item_label: ->(depth) { "flex-1 #{(depth > 0) ? "ml-9" : "ml-3"} text-left whitespace-nowrap" },
28
+ item_label: ->(depth) { "pu-sidebar-menu-label flex-1 #{(depth > 0) ? "ml-9" : "ml-sm"} text-left whitespace-nowrap" },
29
29
 
30
30
  # Badge styles
31
- leading_badge: "inline-flex justify-center items-center w-5 h-5 text-xs font-semibold rounded-full text-primary-800 bg-primary-100 dark:bg-primary-200 dark:text-primary-800",
32
- trailing_badge: "inline-flex justify-center items-center px-2 ml-3 text-sm font-medium text-gray-800 bg-gray-200 rounded-full dark:bg-gray-700 dark:text-gray-300",
31
+ leading_badge: "pu-sidebar-menu-badge-leading inline-flex justify-center items-center w-5 h-5 text-xs font-semibold rounded-full text-primary-800 bg-primary-100 dark:bg-primary-200 dark:text-primary-800",
32
+ trailing_badge: "pu-sidebar-menu-badge-trailing inline-flex justify-center items-center px-sm ml-sm text-sm font-medium text-gray-800 bg-elevated rounded-full dark:bg-elevated-dark dark:text-gray-300",
33
33
 
34
34
  # Icon styles
35
- icon_wrapper: "shrink-0 w-6 h-6 flex items-center justify-center",
36
- icon: "text-gray-400 transition duration-75 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white",
35
+ icon_wrapper: "pu-sidebar-menu-icon-wrapper shrink-0 w-6 h-6 flex items-center justify-center",
36
+ icon: "pu-sidebar-menu-icon text-gray-400 transition duration-75 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white",
37
37
 
38
38
  # Collapse icon styles
39
- collapse_icon: "w-6 h-6 ml-auto transition-transform duration-200",
39
+ collapse_icon: "pu-sidebar-menu-collapse-icon w-6 h-6 ml-auto transition-transform duration-200",
40
40
  collapse_icon_expanded: "transform rotate-180",
41
41
 
42
42
  # Submenu styles
43
- sub_items_container: "hidden py-2 space-y-2",
43
+ sub_items_container: "pu-sidebar-menu-sub-items hidden py-sm space-y-sm",
44
44
 
45
45
  # Due to how we use turbo frames, we can't set active states
46
46
  active: nil
@@ -5,21 +5,21 @@ module Plutonium
5
5
  div(
6
6
  role: "status",
7
7
  class:
8
- "p-4 space-y-4 border border-gray-200 divide-y divide-gray-200 rounded shadow motion-safe:animate-pulse dark:divide-gray-700 md:p-6 dark:border-gray-700"
8
+ "p-md space-y-md border border-gray-200 divide-y divide-gray-200 rounded shadow motion-safe:animate-pulse dark:divide-gray-700 md:p-lg dark:border-gray-700"
9
9
  ) do
10
10
  div(class: "flex items-center justify-between") do
11
11
  div do
12
- div(class: "h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5")
13
- div(class: "w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700")
12
+ div(class: "h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-sm")
13
+ div(class: "w-32 h-2 bg-elevated rounded-full dark:bg-elevated-dark")
14
14
  end
15
- div(class: "h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12")
15
+ div(class: "h-2.5 bg-gray-300 rounded-full dark:bg-elevated-dark w-12")
16
16
  end
17
- div(class: "flex items-center justify-between pt-4") do
17
+ div(class: "flex items-center justify-between pt-md") do
18
18
  div do
19
- div(class: "h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5")
20
- div(class: "w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700")
19
+ div(class: "h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-sm")
20
+ div(class: "w-32 h-2 bg-elevated rounded-full dark:bg-elevated-dark")
21
21
  end
22
- div(class: "h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12")
22
+ div(class: "h-2.5 bg-gray-300 rounded-full dark:bg-elevated-dark w-12")
23
23
  end
24
24
  span(class: "sr-only") { "Loading..." }
25
25
  end
@@ -20,19 +20,20 @@ module Plutonium
20
20
 
21
21
  def view_template
22
22
  div(
23
+ class: theme_class(:tab, element: :list),
23
24
  data_controller: "resource-tab-list",
24
25
  data_resource_tab_list_active_classes_value: "focus:outline-none text-primary-600 hover:text-primary-600 dark:text-primary-500 dark:hover:text-primary-500 border-primary-600 dark:border-primary-500",
25
26
  data_resource_tab_list_in_active_classes_value: "dark:border-transparent text-gray-500 hover:text-gray-600 dark:text-gray-400 border-gray-100 hover:border-gray-300 dark:border-gray-700 dark:hover:text-gray-300"
26
27
  ) do
27
- div(class: "mb-4 border-b border-gray-200 dark:border-gray-700") do
28
+ div(class: "mb-md border-b border-gray-200 dark:border-gray-700") do
28
29
  ul(
29
- class: "flex flex-wrap -mb-px text-sm font-medium text-center space-x-2",
30
+ class: "flex flex-wrap -mb-px text-sm font-medium text-center space-x-sm",
30
31
  role: "tablist"
31
32
  ) do
32
33
  @tabs.each do |tab|
33
34
  li(role: "presentation") do
34
35
  button(
35
- class: "inline-block p-4 border-b-2 rounded-t-lg",
36
+ class: tokens(theme_class(:tab, element: :button), "inline-block p-md border-b-2 rounded-t-lg"),
36
37
  id: "#{tab[:identifier]}-tab",
37
38
  type: "button",
38
39
  role: "tab",
@@ -54,6 +55,7 @@ module Plutonium
54
55
  div do
55
56
  @tabs.each do |tab|
56
57
  div(
58
+ class: theme_class(:tab, element: :panel),
57
59
  hidden: true,
58
60
  id: "#{tab[:identifier]}-tabpanel",
59
61
  role: "tabpanel",
@@ -19,7 +19,7 @@ module Plutonium
19
19
 
20
20
  def render_thumbnail(attachment)
21
21
  div(
22
- class: "w-24 h-24 bg-white border border-gray-200 rounded-lg shadow hover:bg-gray-100 dark:bg-gray-800 dark:border-gray-700 dark:hover:bg-gray-700 transition-all duration-300",
22
+ class: "w-24 h-24 bg-white border border-gray-200 rounded-sm shadow hover:bg-gray-100 dark:bg-gray-800 dark:border-gray-700 dark:hover:bg-gray-700 transition-all duration-300",
23
23
  data: {
24
24
  controller: "attachment-preview",
25
25
  attachment_preview_mime_type_value: attachment.content_type,
@@ -30,7 +30,7 @@ module Plutonium
30
30
  ) do
31
31
  a(
32
32
  href: attachment.url,
33
- class: "block aspect-square overflow-hidden rounded-lg",
33
+ class: "block aspect-square overflow-hidden rounded-sm",
34
34
  target: :blank,
35
35
  data: {
36
36
  attachment_preview_target: "thumbnailLink"
@@ -35,11 +35,11 @@ module Plutonium
35
35
 
36
36
  def per_page_selector
37
37
  div(
38
- class: "flex items-center space-x-2 mt-2 md:mt-0",
38
+ class: "flex items-center space-x-sm mt-sm md:mt-0",
39
39
  data_controller: "select-navigator"
40
40
  ) do
41
41
  id = "perPage#{SecureRandom.hex}"
42
- label(for: id, class: "mr-2") { "Per page" }
42
+ label(for: id, class: "mr-sm") { "Per page" }
43
43
  select(
44
44
  id: id, name: "items", class: select_classes,
45
45
  data_action: "change->select-navigator#navigate",
@@ -53,7 +53,7 @@ module Plutonium
53
53
  end
54
54
 
55
55
  def select_classes
56
- "bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 min-w-[5em]"
56
+ "bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-sm focus:ring-blue-500 focus:border-blue-500 block p-sm dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 min-w-[5em]"
57
57
  end
58
58
 
59
59
  def page_url(limit)
@@ -12,7 +12,7 @@ module Plutonium
12
12
  end
13
13
 
14
14
  def view_template
15
- nav(aria_label: "Page navigation", class: "flex justify-center mt-4") do
15
+ nav(aria_label: "Page navigation", class: "flex justify-center mt-md") do
16
16
  ul(class: "inline-flex -space-x-px text-sm") do
17
17
  prev_link
18
18
  page_links
@@ -79,14 +79,14 @@ module Plutonium
79
79
  end
80
80
 
81
81
  def link_classes(first = false, last = false)
82
- classes = ["flex", "items-center", "justify-center", "px-3", "h-8", "leading-tight", "text-gray-500", "bg-white", "border", "border-gray-300", "hover:bg-gray-100", "hover:text-gray-700", "dark:bg-gray-800", "dark:border-gray-700", "dark:text-gray-400", "dark:hover:bg-gray-700", "dark:hover:text-white"]
82
+ classes = ["flex", "items-center", "justify-center", "px-sm", "h-8", "leading-tight", "text-gray-500", "bg-white", "border", "border-gray-300", "hover:bg-gray-100", "hover:text-gray-700", "dark:bg-gray-800", "dark:border-gray-700", "dark:text-gray-400", "dark:hover:bg-gray-700", "dark:hover:text-white"]
83
83
  classes << "rounded-s-lg" if first
84
84
  classes << "rounded-e-lg" if last
85
85
  classes.join(" ")
86
86
  end
87
87
 
88
88
  def current_link_classes
89
- "flex items-center justify-center px-3 h-8 text-blue-600 border border-gray-300 bg-blue-50 hover:bg-blue-100 hover:text-blue-700 dark:border-gray-700 dark:bg-gray-700 dark:text-white cursor-not-allowed"
89
+ "flex items-center justify-center px-sm h-8 text-blue-600 border border-gray-300 bg-blue-50 hover:bg-blue-100 hover:text-blue-700 dark:border-gray-700 dark:bg-gray-700 dark:text-white cursor-not-allowed"
90
90
  end
91
91
 
92
92
  def disabled_link_classes(first = false, last = false)
@@ -10,24 +10,24 @@ module Plutonium
10
10
  def view_template
11
11
  div(
12
12
  class:
13
- # "flex flex-wrap justify-between items-center gap-4 p-4 bg-white border border-gray-200 rounded-lg dark:bg-gray-800 dark:border-gray-700 mb-4"
14
- "flex flex-wrap justify-between items-center gap-4 mb-4"
13
+ # "flex flex-wrap justify-between items-center gap-md p-md bg-white border border-gray-200 rounded-sm dark:bg-gray-800 dark:border-gray-700 mb-md"
14
+ "flex flex-wrap justify-between items-center gap-md mb-md"
15
15
  ) do
16
- div(class: "flex flex-wrap items-center gap-2") do
16
+ div(class: "flex flex-wrap items-center gap-sm") do
17
17
  name = "all"
18
18
  if current_scope.blank?
19
19
  a(
20
20
  id: "#{name}-scope",
21
21
  href: current_query_object.build_url(scope: nil),
22
22
  class:
23
- "px-4 py-2 text-sm font-medium text-white bg-primary-700 border border-primary-700 rounded-lg hover:bg-primary-800 focus:z-10 focus:ring-2 focus:ring-primary-700 focus:text-white dark:bg-primary-600 dark:border-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800"
23
+ "px-md py-sm text-sm font-medium text-white bg-primary-700 border border-primary-700 rounded-sm hover:bg-primary-800 focus:z-10 focus:ring-2 focus:ring-primary-700 focus:text-white dark:bg-primary-600 dark:border-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800"
24
24
  ) { name.humanize }
25
25
  else
26
26
  a(
27
27
  id: "#{name}-scope",
28
28
  href: current_query_object.build_url(scope: nil),
29
29
  class:
30
- "px-4 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-lg hover:bg-gray-100 hover:text-gray-700 focus:z-10 focus:ring-2 focus:ring-gray-300 focus:text-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700 dark:focus:ring-gray-700 dark:focus:text-white"
30
+ "px-md py-sm text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-sm hover:bg-gray-100 hover:text-gray-700 focus:z-10 focus:ring-2 focus:ring-gray-300 focus:text-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700 dark:focus:ring-gray-700 dark:focus:text-white"
31
31
  ) { name.humanize }
32
32
  end
33
33
 
@@ -37,26 +37,26 @@ module Plutonium
37
37
  id: "#{name}-scope",
38
38
  href: current_query_object.build_url(scope: name),
39
39
  class:
40
- "px-4 py-2 text-sm font-medium text-white bg-primary-700 border border-primary-700 rounded-lg hover:bg-primary-800 focus:z-10 focus:ring-2 focus:ring-primary-700 focus:text-white dark:bg-primary-600 dark:border-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800"
40
+ "px-md py-sm text-sm font-medium text-white bg-primary-700 border border-primary-700 rounded-sm hover:bg-primary-800 focus:z-10 focus:ring-2 focus:ring-primary-700 focus:text-white dark:bg-primary-600 dark:border-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800"
41
41
  ) { name.humanize }
42
42
  else
43
43
  a(
44
44
  id: "#{name}-scope",
45
45
  href: current_query_object.build_url(scope: name),
46
46
  class:
47
- "px-4 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-lg hover:bg-gray-100 hover:text-gray-700 focus:z-10 focus:ring-2 focus:ring-gray-300 focus:text-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700 dark:focus:ring-gray-700 dark:focus:text-white"
47
+ "px-md py-sm text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-sm hover:bg-gray-100 hover:text-gray-700 focus:z-10 focus:ring-2 focus:ring-gray-300 focus:text-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700 dark:focus:ring-gray-700 dark:focus:text-white"
48
48
  ) { name.humanize }
49
49
  end
50
50
  end
51
51
  end
52
52
 
53
- # div(class: "flex flex-wrap items-center gap-2") do
53
+ # div(class: "flex flex-wrap items-center gap-sm") do
54
54
  # button(
55
55
  # class:
56
- # "inline-flex items-center px-3 py-2 text-sm font-medium text-white bg-red-700 rounded-lg hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-800"
56
+ # "inline-flex items-center px-sm py-sm text-sm font-medium text-white bg-red-700 rounded-sm hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-800"
57
57
  # ) do
58
58
  # svg(
59
- # class: "w-4 h-4 mr-2",
59
+ # class: "w-4 h-4 mr-sm",
60
60
  # fill: "none",
61
61
  # stroke: "currentColor",
62
62
  # viewbox: "0 0 24 24",
@@ -74,10 +74,10 @@ module Plutonium
74
74
  # end
75
75
  # button(
76
76
  # class:
77
- # "inline-flex items-center px-3 py-2 text-sm font-medium text-white bg-yellow-700 rounded-lg hover:bg-yellow-800 focus:ring-4 focus:outline-none focus:ring-yellow-300 dark:bg-yellow-600 dark:hover:bg-yellow-700 dark:focus:ring-yellow-800"
77
+ # "inline-flex items-center px-sm py-sm text-sm font-medium text-white bg-yellow-700 rounded-sm hover:bg-yellow-800 focus:ring-4 focus:outline-none focus:ring-yellow-300 dark:bg-yellow-600 dark:hover:bg-yellow-700 dark:focus:ring-yellow-800"
78
78
  # ) do
79
79
  # svg(
80
- # class: "w-4 h-4 mr-2",
80
+ # class: "w-4 h-4 mr-sm",
81
81
  # fill: "none",
82
82
  # stroke: "currentColor",
83
83
  # viewbox: "0 0 24 24",
@@ -97,13 +97,13 @@ module Plutonium
97
97
  # id: "dropdownActionButton",
98
98
  # data_dropdown_toggle: "dropdownAction",
99
99
  # class:
100
- # "inline-flex items-center text-gray-500 bg-white border border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-4 focus:ring-gray-200 font-medium rounded-lg text-sm px-3 py-2 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:bg-gray-700 dark:hover:border-gray-600 dark:focus:ring-gray-700",
100
+ # "inline-flex items-center text-gray-500 bg-white border border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-4 focus:ring-gray-200 font-medium rounded-sm text-sm px-sm py-sm dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:bg-gray-700 dark:hover:border-gray-600 dark:focus:ring-gray-700",
101
101
  # type: "button"
102
102
  # ) do
103
103
  # span(class: "sr-only") { "Action button" }
104
104
  # plain " More Actions "
105
105
  # svg(
106
- # class: "w-2.5 h-2.5 ml-2.5",
106
+ # class: "w-2.5 h-2.5 ml-sm",
107
107
  # aria_hidden: "true",
108
108
  # xmlns: "http://www.w3.org/2000/svg",
109
109
  # fill: "none",
@@ -7,14 +7,14 @@ module Plutonium
7
7
  def self.theme
8
8
  super.merge({
9
9
  value_wrapper: "max-h-[150px] overflow-y-auto",
10
- prefixed_icon: "w-4 h-4 mr-1",
10
+ prefixed_icon: "w-4 h-4 mr-xs",
11
11
  link: "text-primary-600 dark:text-primary-500",
12
12
  color: "flex items-center",
13
- color_indicator: "w-10 h-10 rounded-full mr-2",
13
+ color_indicator: "w-10 h-10 rounded-full mr-sm",
14
14
  email: "flex items-center text-primary-600 dark:text-primary-500 whitespace-nowrap",
15
15
  phone: "flex items-center text-primary-600 dark:text-primary-500 whitespace-nowrap",
16
16
  json: " whitespace-pre font-mono shadow-inner p-4",
17
- attachment_value_wrapper: "flex flex-wrap gap-1"
17
+ attachment_value_wrapper: "flex flex-wrap gap-xs"
18
18
  })
19
19
  end
20
20
  end
@@ -91,7 +91,7 @@ module Plutonium
91
91
  record = wrapped_object.unwrapped
92
92
  policy = policy_for(record:)
93
93
 
94
- div(class: "flex space-x-2") do
94
+ div(class: "flex space-x-sm") do
95
95
  resource_definition.defined_actions
96
96
  .select { |k, a| a.collection_record_action? && policy.allowed_to?(:"#{k}?") }
97
97
  .values
@@ -105,7 +105,7 @@ module Plutonium
105
105
  end
106
106
 
107
107
  def render_footer
108
- div(class: "lg:sticky lg:dyna:static bottom-[-2px] mt-1 p-4 pb-6 w-full z-30 bg-gray-50 dark:bg-gray-900") {
108
+ div(class: tokens(theme_class(:table, element: :footer), "lg:sticky lg:dyna:static bottom-[-2px] mt-xs p-md pb-lg w-full z-30 bg-page dark:bg-page-dark")) {
109
109
  TableInfo(pagy_instance)
110
110
  TablePagination(pagy_instance)
111
111
  }