plutonium 0.15.19 → 0.15.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/plutonium.css +1 -1
- data/app/assets/plutonium.js +28 -0
- data/app/assets/plutonium.js.map +3 -3
- data/app/assets/plutonium.min.js +5 -5
- data/app/assets/plutonium.min.js.map +4 -4
- data/docs/guide/getting-started/resources.md +1 -1
- data/lib/generators/pu/core/assets/assets_generator.rb +2 -2
- data/lib/plutonium/resource/controllers/queryable.rb +1 -1
- data/lib/plutonium/resource/query_object.rb +3 -2
- data/lib/plutonium/ui/display/base.rb +4 -0
- data/lib/plutonium/ui/display/component/markdown.rb +23 -0
- data/lib/plutonium/ui/display/theme.rb +2 -1
- data/lib/plutonium/ui/form/base.rb +15 -0
- data/lib/plutonium/ui/form/components/easymde.rb +17 -0
- data/lib/plutonium/ui/form/options/inferred_types.rb +23 -0
- data/lib/plutonium/ui/layout/base.rb +20 -0
- data/lib/plutonium/ui/table/resource.rb +4 -1
- data/lib/plutonium/version.rb +1 -1
- data/package-lock.json +15 -2
- data/package.json +2 -1
- data/src/css/easymde.css +2 -2
- data/src/css/plutonium.css +1 -0
- data/src/css/slim_select.css +297 -0
- data/src/js/controllers/easymde_controller.js +14 -0
- data/src/js/controllers/register_controllers.js +4 -0
- data/src/js/controllers/slim_select_controller.js +16 -0
- data/tailwind.options.js +46 -2
- metadata +22 -2
@@ -85,7 +85,7 @@ class BlogDefinition < Plutonium::Resource::Definition
|
|
85
85
|
# Customize how fields are displayed
|
86
86
|
display :title, class: "col-span-full"
|
87
87
|
display :content, class: "col-span-full" do |f|
|
88
|
-
f.text_tag class: "
|
88
|
+
f.text_tag class: "format dark:format-invert"
|
89
89
|
end
|
90
90
|
|
91
91
|
# Custom column display in tables
|
@@ -29,7 +29,7 @@ module Pu
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def install_dependencies
|
32
|
-
run "yarn add @radioactive-labs/plutonium flowbite @tailwindcss/forms @tailwindcss/typography postcss-cli cssnano"
|
32
|
+
run "yarn add @radioactive-labs/plutonium flowbite @tailwindcss/forms @tailwindcss/typography flowbite-typography postcss-cli cssnano"
|
33
33
|
end
|
34
34
|
|
35
35
|
def configure_application
|
@@ -51,7 +51,7 @@ module Pu
|
|
51
51
|
|
52
52
|
def import_styles
|
53
53
|
prepend_to_file "app/assets/stylesheets/application.tailwind.css",
|
54
|
-
"@import \"gem:plutonium/src/css/plutonium.css\";\n"
|
54
|
+
"@import \"gem:plutonium/src/css/plutonium.css\";\n\n"
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
@@ -15,7 +15,7 @@ module Plutonium
|
|
15
15
|
|
16
16
|
def current_query_object
|
17
17
|
@current_query_object ||=
|
18
|
-
Plutonium::Resource::QueryObject.new(resource_class, raw_resource_query_params) do |query_object|
|
18
|
+
Plutonium::Resource::QueryObject.new(resource_class, raw_resource_query_params, request.path) do |query_object|
|
19
19
|
if current_definition.search_definition
|
20
20
|
query_object.define_search proc { |scope, search:|
|
21
21
|
current_definition.search_definition.call(scope, search)
|
@@ -7,9 +7,10 @@ module Plutonium
|
|
7
7
|
#
|
8
8
|
# @param resource_class [Object] The resource class.
|
9
9
|
# @param params [Hash] The parameters for initialization.
|
10
|
-
def initialize(resource_class, params, &)
|
10
|
+
def initialize(resource_class, params, request_path, &)
|
11
11
|
@resource_class = resource_class
|
12
12
|
@params = params
|
13
|
+
@request_path = request_path
|
13
14
|
|
14
15
|
define_standard_queries
|
15
16
|
yield self if block_given?
|
@@ -74,7 +75,7 @@ module Plutonium
|
|
74
75
|
|
75
76
|
q.merge! params.slice(*filter_definitions.keys)
|
76
77
|
query_params = deep_compact({q: q}).to_param
|
77
|
-
"?#{query_params}"
|
78
|
+
"#{@request_path}?#{query_params}"
|
78
79
|
end
|
79
80
|
|
80
81
|
# Applies the defined filters and sorts to the given scope.
|
@@ -10,6 +10,10 @@ module Plutonium
|
|
10
10
|
def association_tag(**, &)
|
11
11
|
create_component(Plutonium::UI::Display::Component::Association, :association, **, &)
|
12
12
|
end
|
13
|
+
|
14
|
+
def markdown_tag(**, &)
|
15
|
+
create_component(Plutonium::UI::Display::Component::Markdown, :markdown, **, &)
|
16
|
+
end
|
13
17
|
end
|
14
18
|
|
15
19
|
private
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "redcarpet"
|
4
|
+
|
5
|
+
module Plutonium
|
6
|
+
module UI
|
7
|
+
module Display
|
8
|
+
module Component
|
9
|
+
class Markdown < Phlexi::Display::Components::Base
|
10
|
+
include Phlexi::Display::Components::Concerns::DisplaysValue
|
11
|
+
|
12
|
+
RENDERER = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true)
|
13
|
+
|
14
|
+
def render_value(value)
|
15
|
+
article(**attributes) do
|
16
|
+
unsafe_raw RENDERER.render(value)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -19,7 +19,8 @@ module Plutonium
|
|
19
19
|
color_indicator: "w-10 h-10 rounded-full mr-2", # max-h-fit
|
20
20
|
email: "flex items-center text-md text-primary-600 dark:text-primary-500 mb-1 whitespace-pre-line",
|
21
21
|
json: "text-sm text-gray-900 dark:text-white mb-1 whitespace-pre font-mono shadow-inner p-4",
|
22
|
-
prefixed_icon: "w-8 h-8 mr-2"
|
22
|
+
prefixed_icon: "w-8 h-8 mr-2",
|
23
|
+
markdown: "format dark:format-invert format-primary"
|
23
24
|
})
|
24
25
|
end
|
25
26
|
end
|
@@ -6,6 +6,21 @@ module Plutonium
|
|
6
6
|
class Base < Phlexi::Form::Base
|
7
7
|
include Plutonium::UI::Component::Behaviour
|
8
8
|
|
9
|
+
class Builder < Builder
|
10
|
+
include Plutonium::UI::Form::Options::InferredTypes
|
11
|
+
|
12
|
+
def easymde_tag(**, &)
|
13
|
+
create_component(Plutonium::UI::Form::Components::Easymde, :easymde, **, &)
|
14
|
+
end
|
15
|
+
alias_method :markdown_tag, :easymde_tag
|
16
|
+
|
17
|
+
alias_method :basic_select_tag, :select_tag
|
18
|
+
def slim_select_tag(**, &)
|
19
|
+
basic_select_tag(**, data_controller: "slim-select", class!: "", &)
|
20
|
+
end
|
21
|
+
alias_method :select_tag, :slim_select_tag
|
22
|
+
end
|
23
|
+
|
9
24
|
private
|
10
25
|
|
11
26
|
def render_actions
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Plutonium
|
4
|
+
module UI
|
5
|
+
module Form
|
6
|
+
module Components
|
7
|
+
class Easymde < Phlexi::Form::Components::Base
|
8
|
+
include Phlexi::Form::Components::Concerns::HandlesInput
|
9
|
+
|
10
|
+
def view_template
|
11
|
+
textarea(**attributes, data_controller: "easymde") { field.dom.value }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Plutonium
|
4
|
+
module UI
|
5
|
+
module Form
|
6
|
+
module Options
|
7
|
+
module InferredTypes
|
8
|
+
private
|
9
|
+
|
10
|
+
def infer_field_component
|
11
|
+
component = super
|
12
|
+
case component
|
13
|
+
when :select
|
14
|
+
:slim_select
|
15
|
+
else
|
16
|
+
component
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -119,15 +119,35 @@ module Plutonium
|
|
119
119
|
end
|
120
120
|
|
121
121
|
def render_styles
|
122
|
+
render_external_styles
|
123
|
+
|
122
124
|
url = resource_asset_url_for(:css, resource_stylesheet_asset)
|
123
125
|
stylesheet_link_tag(url, "data-turbo-track": "reload")
|
124
126
|
end
|
125
127
|
|
128
|
+
def render_external_styles
|
129
|
+
end
|
130
|
+
|
126
131
|
def render_scripts
|
132
|
+
render_external_scripts
|
133
|
+
|
127
134
|
url = resource_asset_url_for(:js, resource_script_asset)
|
128
135
|
javascript_include_tag(url, "data-turbo-track": "reload", type: "module")
|
129
136
|
end
|
130
137
|
|
138
|
+
def render_external_scripts
|
139
|
+
script(
|
140
|
+
src: "https://cdn.jsdelivr.net/npm/easymde@2.18.0/dist/easymde.min.js",
|
141
|
+
integrity: "sha384-KtB38COewxfrhJxoN2d+olxJAeT08LF8cVZ6DQ8Poqu89zIptqO6zAXoIxpGNWYE",
|
142
|
+
crossorigin: "anonymous"
|
143
|
+
)
|
144
|
+
script(
|
145
|
+
src: "https://cdn.jsdelivr.net/npm/slim-select@2.10.0/dist/slimselect.umd.min.js",
|
146
|
+
integrity: "sha384-WKsmo+vSs0gqrT+es6wFEojVFn4P0kNaHpHTIkn84iHY8T4rF2V2McZeSbLPLlHy",
|
147
|
+
crossorigin: "anonymous"
|
148
|
+
)
|
149
|
+
end
|
150
|
+
|
131
151
|
def render_body_scripts
|
132
152
|
end
|
133
153
|
end
|
@@ -66,7 +66,10 @@ module Plutonium
|
|
66
66
|
field_options = resource_definition.defined_fields[name] ? resource_definition.defined_fields[name][:options].dup : {}
|
67
67
|
field_options = field_options.merge(**column_display_options.slice(:align))
|
68
68
|
# field_options[:align] = align_field_to if align_field_to
|
69
|
-
table.column name,
|
69
|
+
table.column name,
|
70
|
+
**field_options,
|
71
|
+
sort_params: current_query_object.sort_params_for(name),
|
72
|
+
&display_tag_block
|
70
73
|
end
|
71
74
|
|
72
75
|
table.actions do |wrapped_object|
|
data/lib/plutonium/version.rb
CHANGED
data/package-lock.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "@radioactive-labs/plutonium",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.11",
|
4
4
|
"lockfileVersion": 3,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "@radioactive-labs/plutonium",
|
9
|
-
"version": "0.1.
|
9
|
+
"version": "0.1.11",
|
10
10
|
"license": "MIT",
|
11
11
|
"dependencies": {
|
12
12
|
"@hotwired/stimulus": "^3.2.2",
|
@@ -22,6 +22,7 @@
|
|
22
22
|
"cssnano": "^7.0.2",
|
23
23
|
"esbuild": "^0.20.1",
|
24
24
|
"esbuild-plugin-manifest": "^1.0.3",
|
25
|
+
"flowbite-typography": "^1.0.5",
|
25
26
|
"mermaid": "^11.4.0",
|
26
27
|
"postcss": "^8.4.35",
|
27
28
|
"postcss-cli": "^11.0.0",
|
@@ -3930,6 +3931,18 @@
|
|
3930
3931
|
"mini-svg-data-uri": "^1.4.3"
|
3931
3932
|
}
|
3932
3933
|
},
|
3934
|
+
"node_modules/flowbite-typography": {
|
3935
|
+
"version": "1.0.5",
|
3936
|
+
"resolved": "https://registry.npmjs.org/flowbite-typography/-/flowbite-typography-1.0.5.tgz",
|
3937
|
+
"integrity": "sha512-IqTwOYgGZkXTK/5ngx3A9oQwgOqnRyUKUfIiB+w6xDmiD8z3cKDIgYfFpHIMKbLVfg+QmJIPqEEPrGZbAwVT6g==",
|
3938
|
+
"dev": true,
|
3939
|
+
"license": "MIT",
|
3940
|
+
"dependencies": {
|
3941
|
+
"lodash.castarray": "^4.4.0",
|
3942
|
+
"lodash.isplainobject": "^4.0.6",
|
3943
|
+
"lodash.merge": "^4.6.2"
|
3944
|
+
}
|
3945
|
+
},
|
3933
3946
|
"node_modules/focus-trap": {
|
3934
3947
|
"version": "7.6.0",
|
3935
3948
|
"resolved": "https://registry.npmjs.org/focus-trap/-/focus-trap-7.6.0.tgz",
|
data/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@radioactive-labs/plutonium",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.11",
|
4
4
|
"description": "Core assets for the Plutonium gem",
|
5
5
|
"type": "module",
|
6
6
|
"main": "src/js/core.js",
|
@@ -31,6 +31,7 @@
|
|
31
31
|
"cssnano": "^7.0.2",
|
32
32
|
"esbuild": "^0.20.1",
|
33
33
|
"esbuild-plugin-manifest": "^1.0.3",
|
34
|
+
"flowbite-typography": "^1.0.5",
|
34
35
|
"mermaid": "^11.4.0",
|
35
36
|
"postcss": "^8.4.35",
|
36
37
|
"postcss-cli": "^11.0.0",
|
data/src/css/easymde.css
CHANGED
@@ -233,11 +233,11 @@
|
|
233
233
|
|
234
234
|
/* Preview */
|
235
235
|
.editor-preview {
|
236
|
-
@apply p-2.5 bg-gray-50 dark:bg-gray-900
|
236
|
+
@apply p-2.5 bg-gray-50 dark:bg-gray-900 format dark:format-invert format-primary max-w-none;
|
237
237
|
}
|
238
238
|
|
239
239
|
.editor-preview-side {
|
240
|
-
@apply fixed bottom-0 w-1/2 top-[50px] right-0 z-50 overflow-auto hidden box-border border border-gray-300 dark:border-gray-600 break-words
|
240
|
+
@apply fixed bottom-0 w-1/2 top-[50px] right-0 z-50 overflow-auto hidden box-border border border-gray-300 dark:border-gray-600 break-words format dark:format-invert format-primary max-w-none;
|
241
241
|
}
|
242
242
|
|
243
243
|
.editor-preview-active-side {
|
data/src/css/plutonium.css
CHANGED
@@ -0,0 +1,297 @@
|
|
1
|
+
@layer components {
|
2
|
+
:root {
|
3
|
+
--ss-primary-color: theme('colors.primary.500');
|
4
|
+
--ss-bg-color: theme('colors.white');
|
5
|
+
--ss-font-color: theme('colors.gray.900');
|
6
|
+
--ss-font-placeholder-color: theme('colors.gray.500');
|
7
|
+
--ss-disabled-color: theme('colors.gray.100');
|
8
|
+
--ss-border-color: theme('colors.gray.300');
|
9
|
+
--ss-highlight-color: theme('colors.yellow.200');
|
10
|
+
--ss-success-color: theme('colors.green.500');
|
11
|
+
--ss-error-color: theme('colors.red.500');
|
12
|
+
--ss-focus-color: theme('colors.primary.500');
|
13
|
+
}
|
14
|
+
|
15
|
+
.dark {
|
16
|
+
--ss-primary-color: theme('colors.primary.400');
|
17
|
+
--ss-bg-color: theme('colors.gray.700');
|
18
|
+
--ss-font-color: theme('colors.white');
|
19
|
+
--ss-font-placeholder-color: theme('colors.gray.400');
|
20
|
+
--ss-disabled-color: theme('colors.gray.800');
|
21
|
+
--ss-border-color: theme('colors.gray.600');
|
22
|
+
--ss-highlight-color: theme('colors.yellow.300');
|
23
|
+
--ss-success-color: theme('colors.green.400');
|
24
|
+
--ss-error-color: theme('colors.red.400');
|
25
|
+
--ss-focus-color: theme('colors.primary.400');
|
26
|
+
}
|
27
|
+
|
28
|
+
@keyframes ss-valueIn {
|
29
|
+
0% {
|
30
|
+
@apply scale-0 opacity-0;
|
31
|
+
}
|
32
|
+
|
33
|
+
100% {
|
34
|
+
@apply scale-100 opacity-100;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
@keyframes ss-valueOut {
|
39
|
+
0% {
|
40
|
+
@apply scale-100 opacity-100;
|
41
|
+
}
|
42
|
+
|
43
|
+
100% {
|
44
|
+
@apply scale-0 opacity-0;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
.ss-hide {
|
49
|
+
@apply hidden !important;
|
50
|
+
}
|
51
|
+
|
52
|
+
.ss-main {
|
53
|
+
@apply flex flex-row relative select-none w-full p-2 border rounded-md shadow-sm font-medium text-sm border-gray-300 bg-white text-gray-900 dark:bg-gray-700 dark:border-gray-600 dark:text-white focus:ring-primary-500 focus:border-primary-500 focus:outline-none cursor-pointer transition-colors duration-200 overflow-hidden;
|
54
|
+
}
|
55
|
+
|
56
|
+
.ss-main:focus {
|
57
|
+
@apply ring-1 ring-primary-500 border-primary-500;
|
58
|
+
}
|
59
|
+
|
60
|
+
.ss-main.ss-disabled {
|
61
|
+
@apply cursor-not-allowed bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400;
|
62
|
+
}
|
63
|
+
|
64
|
+
.ss-main.ss-open-above {
|
65
|
+
@apply rounded-b-md rounded-t-none;
|
66
|
+
}
|
67
|
+
|
68
|
+
.ss-main.ss-open-below {
|
69
|
+
@apply rounded-t-md rounded-b-none;
|
70
|
+
}
|
71
|
+
|
72
|
+
.ss-main .ss-values {
|
73
|
+
@apply inline-flex flex-wrap gap-[5px] flex-1;
|
74
|
+
}
|
75
|
+
|
76
|
+
.ss-main .ss-values .ss-placeholder {
|
77
|
+
@apply flex p-0 m-0 leading-normal items-center w-full text-gray-500 dark:text-gray-400 overflow-hidden truncate whitespace-nowrap;
|
78
|
+
}
|
79
|
+
|
80
|
+
.ss-main .ss-values .ss-max {
|
81
|
+
@apply flex select-none items-center w-fit text-xs text-white dark:text-gray-900 leading-normal p-[3px_5px] bg-primary-500 rounded-md;
|
82
|
+
}
|
83
|
+
|
84
|
+
.ss-main .ss-values .ss-single {
|
85
|
+
@apply flex m-0;
|
86
|
+
}
|
87
|
+
|
88
|
+
.ss-main .ss-values .ss-value {
|
89
|
+
@apply flex select-none items-center w-fit bg-primary-500 rounded-md;
|
90
|
+
animation: ss-valueIn 0.2s ease-out forwards;
|
91
|
+
}
|
92
|
+
|
93
|
+
.ss-main .ss-values .ss-value.ss-value-out {
|
94
|
+
animation: ss-valueOut 0.2s ease-out forwards;
|
95
|
+
}
|
96
|
+
|
97
|
+
.ss-main .ss-values .ss-value .ss-value-text {
|
98
|
+
@apply text-xs text-white dark:text-gray-900 leading-normal p-[3px_5px];
|
99
|
+
}
|
100
|
+
|
101
|
+
.ss-main .ss-values .ss-value .ss-value-delete {
|
102
|
+
@apply flex items-center h-[7px] w-[7px] p-[3px_5px] cursor-pointer border-l border-solid border-white dark:border-gray-900 box-content;
|
103
|
+
}
|
104
|
+
|
105
|
+
.ss-main .ss-values .ss-value .ss-value-delete svg {
|
106
|
+
@apply h-[7px] w-[7px];
|
107
|
+
}
|
108
|
+
|
109
|
+
.ss-main .ss-values .ss-value .ss-value-delete svg path {
|
110
|
+
@apply fill-none stroke-white dark:stroke-gray-900;
|
111
|
+
stroke-width: 18;
|
112
|
+
stroke-linecap: round;
|
113
|
+
stroke-linejoin: round;
|
114
|
+
}
|
115
|
+
|
116
|
+
.ss-main .ss-deselect {
|
117
|
+
@apply flex-none flex items-center justify-center w-fit h-auto p-[0_5px];
|
118
|
+
}
|
119
|
+
|
120
|
+
.ss-main .ss-deselect svg {
|
121
|
+
@apply w-[8px] h-[8px];
|
122
|
+
}
|
123
|
+
|
124
|
+
.ss-main .ss-deselect svg path {
|
125
|
+
@apply fill-none stroke-gray-500 dark:stroke-gray-400;
|
126
|
+
stroke-width: 20;
|
127
|
+
stroke-linecap: round;
|
128
|
+
stroke-linejoin: round;
|
129
|
+
}
|
130
|
+
|
131
|
+
.ss-main .ss-arrow {
|
132
|
+
@apply flex-none flex items-center justify-end w-4 h-4 m-auto;
|
133
|
+
}
|
134
|
+
|
135
|
+
.ss-main .ss-arrow path {
|
136
|
+
@apply fill-none stroke-gray-500 dark:stroke-gray-400 transition-transform duration-200;
|
137
|
+
stroke-width: 2;
|
138
|
+
stroke-linecap: round;
|
139
|
+
stroke-linejoin: round;
|
140
|
+
}
|
141
|
+
|
142
|
+
.ss-content {
|
143
|
+
@apply absolute flex h-auto flex-col w-auto max-h-[300px] box-border border rounded-b-md shadow-lg border-gray-300 bg-white dark:bg-gray-700 dark:border-gray-600 transition-all duration-200 opacity-0 scale-y-0 origin-top overflow-hidden z-[10000];
|
144
|
+
}
|
145
|
+
|
146
|
+
.ss-content.ss-relative {
|
147
|
+
@apply relative h-full;
|
148
|
+
}
|
149
|
+
|
150
|
+
.ss-content.ss-fixed {
|
151
|
+
@apply fixed;
|
152
|
+
}
|
153
|
+
|
154
|
+
.ss-content.ss-open-above {
|
155
|
+
@apply flex-col-reverse opacity-100 scale-y-100 origin-bottom rounded-t-md;
|
156
|
+
}
|
157
|
+
|
158
|
+
.ss-content.ss-open-below {
|
159
|
+
@apply opacity-100 scale-y-100 origin-top rounded-b-md;
|
160
|
+
}
|
161
|
+
|
162
|
+
.ss-content .ss-search {
|
163
|
+
@apply flex-none flex flex-row p-2;
|
164
|
+
}
|
165
|
+
|
166
|
+
.ss-content .ss-search input {
|
167
|
+
@apply inline-flex text-base leading-normal flex-auto w-full min-w-0 p-2 m-0 border rounded-md shadow-sm font-medium text-sm border-gray-300 bg-gray-100 text-gray-900 placeholder-gray-400 dark:bg-gray-800 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white focus:ring-primary-500 focus:border-primary-500 focus:outline-none text-left box-border;
|
168
|
+
}
|
169
|
+
|
170
|
+
.ss-content .ss-search .ss-addable {
|
171
|
+
@apply inline-flex justify-center items-center cursor-pointer flex-none h-auto ml-2 border shadow-sm border-gray-300 dark:border-gray-600;
|
172
|
+
}
|
173
|
+
|
174
|
+
.ss-content .ss-search .ss-addable svg {
|
175
|
+
@apply flex items-center justify-end flex-none w-4 h-4 m-2;
|
176
|
+
}
|
177
|
+
|
178
|
+
.ss-content .ss-search .ss-addable svg path {
|
179
|
+
@apply fill-none stroke-gray-500 dark:stroke-gray-400;
|
180
|
+
stroke-width: 2;
|
181
|
+
stroke-linecap: round;
|
182
|
+
stroke-linejoin: round;
|
183
|
+
}
|
184
|
+
|
185
|
+
.ss-content .ss-list {
|
186
|
+
@apply flex-auto h-auto overflow-x-hidden overflow-y-auto;
|
187
|
+
}
|
188
|
+
|
189
|
+
.ss-content .ss-list .ss-error {
|
190
|
+
@apply text-red-500 dark:text-red-400 p-2;
|
191
|
+
}
|
192
|
+
|
193
|
+
.ss-content .ss-list .ss-searching {
|
194
|
+
@apply text-gray-900 dark:text-white p-2;
|
195
|
+
}
|
196
|
+
|
197
|
+
.ss-content .ss-list .ss-optgroup.ss-close .ss-option {
|
198
|
+
@apply hidden !important;
|
199
|
+
}
|
200
|
+
|
201
|
+
/* Update the specific no results style */
|
202
|
+
.ss-content .ss-list .ss-search {
|
203
|
+
@apply flex-none text-sm text-gray-500 dark:text-gray-400 p-2 font-medium;
|
204
|
+
}
|
205
|
+
|
206
|
+
/* The original search container styles should be scoped properly */
|
207
|
+
.ss-content>.ss-search {
|
208
|
+
@apply flex-none flex flex-row p-2;
|
209
|
+
}
|
210
|
+
|
211
|
+
.ss-content .ss-list .ss-optgroup .ss-optgroup-label {
|
212
|
+
@apply flex flex-row items-center justify-between p-2 bg-gray-50 dark:bg-gray-800;
|
213
|
+
}
|
214
|
+
|
215
|
+
.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-label-text {
|
216
|
+
@apply flex-auto font-bold text-gray-900 dark:text-white;
|
217
|
+
}
|
218
|
+
|
219
|
+
.ss-content .ss-list .ss-optgroup .ss-optgroup-label:has(.ss-arrow) {
|
220
|
+
@apply cursor-pointer;
|
221
|
+
}
|
222
|
+
|
223
|
+
.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions {
|
224
|
+
@apply flex-none flex flex-row items-center justify-center gap-2;
|
225
|
+
}
|
226
|
+
|
227
|
+
.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall {
|
228
|
+
@apply flex-none flex flex-row cursor-pointer hover:opacity-50;
|
229
|
+
}
|
230
|
+
|
231
|
+
.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall.ss-selected svg path {
|
232
|
+
@apply stroke-red-500 dark:stroke-red-400;
|
233
|
+
}
|
234
|
+
|
235
|
+
.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall span {
|
236
|
+
@apply flex-none flex items-center justify-center text-[60%] text-center pr-1;
|
237
|
+
}
|
238
|
+
|
239
|
+
.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall svg {
|
240
|
+
@apply flex-none w-[13px] h-[13px];
|
241
|
+
}
|
242
|
+
|
243
|
+
.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall svg path {
|
244
|
+
@apply fill-none stroke-green-500 dark:stroke-green-400;
|
245
|
+
stroke-linecap: round;
|
246
|
+
stroke-linejoin: round;
|
247
|
+
}
|
248
|
+
|
249
|
+
.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall svg:first-child {
|
250
|
+
stroke-width: 5;
|
251
|
+
}
|
252
|
+
|
253
|
+
.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-selectall svg:last-child {
|
254
|
+
stroke-width: 11;
|
255
|
+
}
|
256
|
+
|
257
|
+
.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-closable {
|
258
|
+
@apply flex-none flex flex-row cursor-pointer;
|
259
|
+
}
|
260
|
+
|
261
|
+
.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-closable .ss-arrow {
|
262
|
+
@apply flex-auto w-[10px] h-[10px];
|
263
|
+
}
|
264
|
+
|
265
|
+
.ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-actions .ss-closable .ss-arrow path {
|
266
|
+
@apply fill-none stroke-gray-500 dark:stroke-gray-400 transition-transform duration-200;
|
267
|
+
stroke-width: 2;
|
268
|
+
stroke-linecap: round;
|
269
|
+
stroke-linejoin: round;
|
270
|
+
}
|
271
|
+
|
272
|
+
.ss-content .ss-list .ss-optgroup .ss-option {
|
273
|
+
@apply p-2 pl-6;
|
274
|
+
}
|
275
|
+
|
276
|
+
.ss-content .ss-list .ss-option {
|
277
|
+
@apply block p-2 whitespace-normal text-gray-900 dark:text-white cursor-pointer select-none hover:bg-gray-100 dark:hover:bg-gray-600;
|
278
|
+
min-height: 0;
|
279
|
+
}
|
280
|
+
|
281
|
+
.ss-content .ss-list .ss-option:empty {
|
282
|
+
@apply hidden p-0 m-0;
|
283
|
+
}
|
284
|
+
|
285
|
+
.ss-content .ss-list .ss-option.ss-highlighted,
|
286
|
+
.ss-content .ss-list .ss-option:not(.ss-disabled).ss-selected {
|
287
|
+
@apply text-white dark:text-gray-900 bg-primary-500;
|
288
|
+
}
|
289
|
+
|
290
|
+
.ss-content .ss-list .ss-option.ss-disabled {
|
291
|
+
@apply cursor-not-allowed bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400;
|
292
|
+
}
|
293
|
+
|
294
|
+
.ss-content .ss-list .ss-option .ss-search-highlight {
|
295
|
+
@apply inline-block bg-yellow-200 dark:bg-yellow-300;
|
296
|
+
}
|
297
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
2
|
+
|
3
|
+
// Connects to data-controller="easymde"
|
4
|
+
export default class extends Controller {
|
5
|
+
connect() {
|
6
|
+
console.log(`easymde connected: ${this.element}`)
|
7
|
+
self.easyMDE = new EasyMDE({ element: this.element })
|
8
|
+
}
|
9
|
+
|
10
|
+
disconnect() {
|
11
|
+
self.easyMDE.toTextArea()
|
12
|
+
self.easyMDE = null
|
13
|
+
}
|
14
|
+
}
|
@@ -21,6 +21,8 @@ import ResourceCollapseController from "./resource_collapse_controller.js"
|
|
21
21
|
import ResourceDismissController from "./resource_dismiss_controller.js"
|
22
22
|
import FrameNavigatorController from "./frame_navigator_controller.js"
|
23
23
|
import ColorModeController from "./color_mode_controller.js"
|
24
|
+
import EasyMDEController from "./easymde_controller.js"
|
25
|
+
import SlimSelectController from "./slim_select_controller.js"
|
24
26
|
|
25
27
|
export default function (application) {
|
26
28
|
// Register controllers here
|
@@ -46,4 +48,6 @@ export default function (application) {
|
|
46
48
|
application.register("resource-dismiss", ResourceDismissController)
|
47
49
|
application.register("frame-navigator", FrameNavigatorController)
|
48
50
|
application.register("color-mode", ColorModeController)
|
51
|
+
application.register("easymde", EasyMDEController)
|
52
|
+
application.register("slim-select", SlimSelectController)
|
49
53
|
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
2
|
+
|
3
|
+
// Connects to data-controller="slim-select"
|
4
|
+
export default class extends Controller {
|
5
|
+
connect() {
|
6
|
+
console.log(`slim-select connected: ${this.element}`)
|
7
|
+
self.slimSelect = new SlimSelect({
|
8
|
+
select: this.element
|
9
|
+
})
|
10
|
+
}
|
11
|
+
|
12
|
+
disconnect() {
|
13
|
+
self.slimSelect.destroy()
|
14
|
+
self.slimSelect = null
|
15
|
+
}
|
16
|
+
}
|