@radioactive-labs/plutonium 0.1.15 → 0.1.16
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.
- package/package.json +1 -1
- package/src/css/slim_select.css +4 -4
- package/src/dist/css/plutonium.css +1 -1
- package/src/dist/js/plutonium.js +43 -9
- package/src/dist/js/plutonium.js.map +3 -3
- package/src/dist/js/plutonium.min.js +14 -14
- package/src/dist/js/plutonium.min.js.map +4 -4
- package/src/js/controllers/easymde_controller.js +3 -3
- package/src/js/controllers/flatpickr_controller.js +3 -3
- package/src/js/controllers/intl_tel_input_controller.js +39 -0
- package/src/js/controllers/register_controllers.js +2 -0
- package/src/js/controllers/slim_select_controller.js +3 -3
|
@@ -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() {
|