plutonium 0.16.0 → 0.16.3
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.js +405 -495
- data/app/assets/plutonium.js.map +4 -4
- data/app/assets/plutonium.min.js +44 -44
- data/app/assets/plutonium.min.js.map +4 -4
- data/lib/generators/pu/core/assets/assets_generator.rb +1 -1
- data/lib/plutonium/ui/display/theme.rb +1 -0
- data/lib/plutonium/ui/form/base.rb +6 -1
- data/lib/plutonium/ui/form/components/intl_tel_input.rb +24 -0
- data/lib/plutonium/ui/form/theme.rb +6 -1
- data/lib/plutonium/ui/layout/base.rb +11 -0
- data/lib/plutonium/ui/table/display_theme.rb +1 -0
- data/lib/plutonium/version.rb +1 -1
- data/package-lock.json +20 -7
- data/package.json +3 -2
- data/src/js/controllers/easymde_controller.js +3 -3
- data/src/js/controllers/flatpickr_controller.js +3 -3
- data/src/js/controllers/intl_tel_input_controller.js +39 -0
- data/src/js/controllers/register_controllers.js +2 -0
- data/src/js/controllers/slim_select_controller.js +3 -3
- metadata +4 -2
@@ -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 flowbite-typography postcss-cli cssnano"
|
32
|
+
run "yarn add @radioactive-labs/plutonium flowbite @tailwindcss/forms @tailwindcss/typography flowbite-typography postcss-cli cssnano marked"
|
33
33
|
end
|
34
34
|
|
35
35
|
def configure_application
|
@@ -18,6 +18,7 @@ module Plutonium
|
|
18
18
|
color: "flex items-center text-md text-gray-900 dark:text-white mb-1 whitespace-pre-line",
|
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
|
+
phone: "flex items-center text-md text-primary-600 dark:text-primary-500 mb-1 whitespace-pre-line",
|
21
22
|
json: "text-sm text-gray-900 dark:text-white mb-1 whitespace-pre font-mono shadow-inner p-4",
|
22
23
|
prefixed_icon: "w-8 h-8 mr-2",
|
23
24
|
markdown: "format dark:format-invert format-primary"
|
@@ -30,8 +30,13 @@ module Plutonium
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def flatpickr_tag(**, &)
|
33
|
-
create_component(
|
33
|
+
create_component(Components::Flatpickr, :flatpickr, **, &)
|
34
34
|
end
|
35
|
+
|
36
|
+
def int_tel_input_tag(**, &)
|
37
|
+
create_component(Components::IntlTelInput, :int_tel_input, **, &)
|
38
|
+
end
|
39
|
+
alias_method :phone_tag, :int_tel_input_tag
|
35
40
|
end
|
36
41
|
|
37
42
|
private
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Plutonium
|
4
|
+
module UI
|
5
|
+
module Form
|
6
|
+
module Components
|
7
|
+
class IntlTelInput < Phlexi::Form::Components::Input
|
8
|
+
def view_template
|
9
|
+
div(data_controller: "intl-tel-input") {
|
10
|
+
super
|
11
|
+
}
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def build_input_attributes
|
17
|
+
super
|
18
|
+
attributes[:data_intl_tel_input_target] = tokens(attributes[:data_intl_tel_input_target], :input)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -42,7 +42,12 @@ module Plutonium
|
|
42
42
|
flatpickr: :input,
|
43
43
|
valid_flatpickr: :valid_input,
|
44
44
|
invalid_flatpickr: :invalid_input,
|
45
|
-
neutral_flatpickr: :neutral_input
|
45
|
+
neutral_flatpickr: :neutral_input,
|
46
|
+
# int_tel_input
|
47
|
+
int_tel_input: :input,
|
48
|
+
valid_int_tel_input: :valid_input,
|
49
|
+
invalid_int_tel_input: :invalid_input,
|
50
|
+
neutral_int_tel_input: :neutral_input
|
46
51
|
})
|
47
52
|
end
|
48
53
|
end
|
@@ -132,6 +132,12 @@ module Plutonium
|
|
132
132
|
integrity: "sha384-RkASv+6KfBMW9eknReJIJ6b3UnjKOKC5bOUaNgIY778NFbQ8MtWq9Lr/khUgqtTt",
|
133
133
|
crossorigin: "anonymous"
|
134
134
|
)
|
135
|
+
link(
|
136
|
+
rel: "stylesheet",
|
137
|
+
href: "https://cdn.jsdelivr.net/npm/intl-tel-input@24.8.1/build/css/intlTelInput.min.css",
|
138
|
+
integrity: "sha384-oE0RVGDyNw9goP8V3wYWC9+3GYojVc/LhhKmLT9J5k+L+oGHPa1gRF3FomvOCOFs",
|
139
|
+
crossorigin: "anonymous"
|
140
|
+
)
|
135
141
|
end
|
136
142
|
|
137
143
|
def render_scripts
|
@@ -157,6 +163,11 @@ module Plutonium
|
|
157
163
|
integrity: "sha384-5JqMv4L/Xa0hfvtF06qboNdhvuYXUku9ZrhZh3bSk8VXF0A/RuSLHpLsSV9Zqhl6",
|
158
164
|
crossorigin: "anonymous"
|
159
165
|
)
|
166
|
+
script(
|
167
|
+
src: "https://cdn.jsdelivr.net/npm/intl-tel-input@24.8.1/build/js/intlTelInput.min.js",
|
168
|
+
integrity: "sha384-oCoRbvnGGnM56vTrLX0f7cgRy2aqLchemkQhvfBT7J+b6km6CSuWz/89IpPnTq9j",
|
169
|
+
crossorigin: "anonymous"
|
170
|
+
)
|
160
171
|
end
|
161
172
|
|
162
173
|
def render_body_scripts
|
@@ -12,6 +12,7 @@ module Plutonium
|
|
12
12
|
color: "flex items-center",
|
13
13
|
color_indicator: "w-10 h-10 rounded-full mr-2",
|
14
14
|
email: "flex items-center text-primary-600 dark:text-primary-500 whitespace-nowrap",
|
15
|
+
phone: "flex items-center text-primary-600 dark:text-primary-500 whitespace-nowrap",
|
15
16
|
json: " whitespace-pre font-mono shadow-inner p-4"
|
16
17
|
})
|
17
18
|
end
|
data/lib/plutonium/version.rb
CHANGED
data/package-lock.json
CHANGED
@@ -1,19 +1,20 @@
|
|
1
1
|
{
|
2
2
|
"name": "@radioactive-labs/plutonium",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.16",
|
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.16",
|
10
10
|
"license": "MIT",
|
11
11
|
"dependencies": {
|
12
12
|
"@hotwired/stimulus": "^3.2.2",
|
13
13
|
"@hotwired/turbo": "^8.0.4",
|
14
14
|
"dompurify": "^3.2.2",
|
15
15
|
"flowbite": "^2.3.0",
|
16
|
-
"lodash.debounce": "^4.0.8"
|
16
|
+
"lodash.debounce": "^4.0.8",
|
17
|
+
"marked": "^15.0.3"
|
17
18
|
},
|
18
19
|
"devDependencies": {
|
19
20
|
"@tailwindcss/forms": "^0.5.7",
|
@@ -4514,10 +4515,9 @@
|
|
4514
4515
|
"license": "MIT"
|
4515
4516
|
},
|
4516
4517
|
"node_modules/marked": {
|
4517
|
-
"version": "
|
4518
|
-
"resolved": "https://registry.npmjs.org/marked/-/marked-
|
4519
|
-
"integrity": "sha512-
|
4520
|
-
"dev": true,
|
4518
|
+
"version": "15.0.3",
|
4519
|
+
"resolved": "https://registry.npmjs.org/marked/-/marked-15.0.3.tgz",
|
4520
|
+
"integrity": "sha512-Ai0cepvl2NHnTcO9jYDtcOEtVBNVYR31XnEA3BndO7f5As1wzpcOceSUM8FDkNLJNIODcLpDTWay/qQhqbuMvg==",
|
4521
4521
|
"license": "MIT",
|
4522
4522
|
"bin": {
|
4523
4523
|
"marked": "bin/marked.js"
|
@@ -4600,6 +4600,19 @@
|
|
4600
4600
|
"dev": true,
|
4601
4601
|
"license": "(MPL-2.0 OR Apache-2.0)"
|
4602
4602
|
},
|
4603
|
+
"node_modules/mermaid/node_modules/marked": {
|
4604
|
+
"version": "13.0.3",
|
4605
|
+
"resolved": "https://registry.npmjs.org/marked/-/marked-13.0.3.tgz",
|
4606
|
+
"integrity": "sha512-rqRix3/TWzE9rIoFGIn8JmsVfhiuC8VIQ8IdX5TfzmeBucdY05/0UlzKaw0eVtpcN/OdVFpBk7CjKGo9iHJ/zA==",
|
4607
|
+
"dev": true,
|
4608
|
+
"license": "MIT",
|
4609
|
+
"bin": {
|
4610
|
+
"marked": "bin/marked.js"
|
4611
|
+
},
|
4612
|
+
"engines": {
|
4613
|
+
"node": ">= 18"
|
4614
|
+
}
|
4615
|
+
},
|
4603
4616
|
"node_modules/micromark-util-character": {
|
4604
4617
|
"version": "2.1.0",
|
4605
4618
|
"resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.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.17",
|
4
4
|
"description": "Core assets for the Plutonium gem",
|
5
5
|
"type": "module",
|
6
6
|
"main": "src/js/core.js",
|
@@ -22,7 +22,8 @@
|
|
22
22
|
"@hotwired/turbo": "^8.0.4",
|
23
23
|
"dompurify": "^3.2.2",
|
24
24
|
"flowbite": "^2.3.0",
|
25
|
-
"lodash.debounce": "^4.0.8"
|
25
|
+
"lodash.debounce": "^4.0.8",
|
26
|
+
"marked": "^15.0.3"
|
26
27
|
},
|
27
28
|
"devDependencies": {
|
28
29
|
"@tailwindcss/forms": "^0.5.7",
|
@@ -6,13 +6,13 @@ import { marked } from 'marked';
|
|
6
6
|
export default class extends Controller {
|
7
7
|
connect() {
|
8
8
|
console.log(`easymde connected: ${this.element}`)
|
9
|
-
|
9
|
+
this.easyMDE = new EasyMDE(this.#buildOptions())
|
10
10
|
this.element.setAttribute("data-action", "turbo:morph-element->easymde#reconnect")
|
11
11
|
}
|
12
12
|
|
13
13
|
disconnect() {
|
14
|
-
|
15
|
-
|
14
|
+
this.easyMDE.toTextArea()
|
15
|
+
this.easyMDE = null
|
16
16
|
}
|
17
17
|
|
18
18
|
reconnect() {
|
@@ -4,13 +4,13 @@ import { Controller } from "@hotwired/stimulus"
|
|
4
4
|
export default class extends Controller {
|
5
5
|
connect() {
|
6
6
|
console.log(`flatpickr connected: ${this.element}`)
|
7
|
-
|
7
|
+
this.picker = new flatpickr(this.element, this.#buildOptions())
|
8
8
|
this.element.setAttribute("data-action", "turbo:morph-element->flatpickr#reconnect")
|
9
9
|
}
|
10
10
|
|
11
11
|
disconnect() {
|
12
|
-
|
13
|
-
|
12
|
+
this.picker.destroy()
|
13
|
+
this.picker = null
|
14
14
|
}
|
15
15
|
|
16
16
|
reconnect() {
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
2
|
+
|
3
|
+
// Connects to data-controller="intl-tel-input"
|
4
|
+
export default class extends Controller {
|
5
|
+
static targets = ["input"]
|
6
|
+
|
7
|
+
connect() {
|
8
|
+
console.log(`intl-tel-input connected: ${this.element}`)
|
9
|
+
}
|
10
|
+
|
11
|
+
disconnect() {
|
12
|
+
this.inputTargetDisconnected()
|
13
|
+
}
|
14
|
+
|
15
|
+
inputTargetConnected() {
|
16
|
+
if (!this.hasInputTarget) return;
|
17
|
+
|
18
|
+
this.iti = window.intlTelInput(this.inputTarget, this.#buildOptions())
|
19
|
+
this.inputTarget.setAttribute("data-action", "turbo:morph-element->intl-tel-input#reconnect")
|
20
|
+
}
|
21
|
+
|
22
|
+
inputTargetDisconnected() {
|
23
|
+
if (this.iti) this.iti.destroy()
|
24
|
+
this.iti = null
|
25
|
+
}
|
26
|
+
|
27
|
+
reconnect() {
|
28
|
+
this.inputTargetDisconnected()
|
29
|
+
this.inputTargetConnected()
|
30
|
+
}
|
31
|
+
|
32
|
+
#buildOptions() {
|
33
|
+
return {
|
34
|
+
strictMode: true,
|
35
|
+
hiddenInput: () => ({ phone: this.inputTarget.attributes.name.value }),
|
36
|
+
loadUtilsOnInit: "https://cdn.jsdelivr.net/npm/intl-tel-input@24.8.1/build/js/utils.js",
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
@@ -24,6 +24,7 @@ import ColorModeController from "./color_mode_controller.js"
|
|
24
24
|
import EasyMDEController from "./easymde_controller.js"
|
25
25
|
import SlimSelectController from "./slim_select_controller.js"
|
26
26
|
import FlatpickrController from "./flatpickr_controller.js"
|
27
|
+
import IntlTelInputController from "./intl_tel_input_controller.js"
|
27
28
|
|
28
29
|
export default function (application) {
|
29
30
|
// Register controllers here
|
@@ -52,4 +53,5 @@ export default function (application) {
|
|
52
53
|
application.register("easymde", EasyMDEController)
|
53
54
|
application.register("slim-select", SlimSelectController)
|
54
55
|
application.register("flatpickr", FlatpickrController)
|
56
|
+
application.register("intl-tel-input", IntlTelInputController)
|
55
57
|
}
|
@@ -4,15 +4,15 @@ import { Controller } from "@hotwired/stimulus"
|
|
4
4
|
export default class extends Controller {
|
5
5
|
connect() {
|
6
6
|
console.log(`slim-select connected: ${this.element}`)
|
7
|
-
|
7
|
+
this.slimSelect = new SlimSelect({
|
8
8
|
select: this.element
|
9
9
|
})
|
10
10
|
this.element.setAttribute("data-action", "turbo:morph-element->slim-select#reconnect")
|
11
11
|
}
|
12
12
|
|
13
13
|
disconnect() {
|
14
|
-
|
15
|
-
|
14
|
+
this.slimSelect.destroy()
|
15
|
+
this.slimSelect = null
|
16
16
|
}
|
17
17
|
|
18
18
|
reconnect() {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plutonium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.16.
|
4
|
+
version: 0.16.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Froelich
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zeitwerk
|
@@ -1412,6 +1412,7 @@ files:
|
|
1412
1412
|
- lib/plutonium/ui/form/components/easymde.rb
|
1413
1413
|
- lib/plutonium/ui/form/components/flatpickr.rb
|
1414
1414
|
- lib/plutonium/ui/form/components/has_many.rb
|
1415
|
+
- lib/plutonium/ui/form/components/intl_tel_input.rb
|
1415
1416
|
- lib/plutonium/ui/form/concerns/renders_nested_resource_fields.rb
|
1416
1417
|
- lib/plutonium/ui/form/interaction.rb
|
1417
1418
|
- lib/plutonium/ui/form/options/inferred_types.rb
|
@@ -1470,6 +1471,7 @@ files:
|
|
1470
1471
|
- src/js/controllers/has_many_panel_controller.js
|
1471
1472
|
- src/js/controllers/header_controller.js
|
1472
1473
|
- src/js/controllers/interactive_action_form_controller.js
|
1474
|
+
- src/js/controllers/intl_tel_input_controller.js
|
1473
1475
|
- src/js/controllers/nav_grid_menu_controller.js
|
1474
1476
|
- src/js/controllers/nav_grid_menu_item_controller.js
|
1475
1477
|
- src/js/controllers/nav_user_controller.js
|