@radioactive-labs/plutonium 0.4.6 → 0.4.9
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/flatpickr.css +797 -0
- package/src/css/plutonium.css +1 -0
- package/src/css/slim_select.css +37 -0
- package/src/dist/css/plutonium.css +2 -2
- package/src/dist/js/plutonium.js +162 -14
- package/src/dist/js/plutonium.js.map +3 -3
- package/src/dist/js/plutonium.min.js +32 -32
- package/src/dist/js/plutonium.min.js.map +3 -3
- package/src/js/controllers/attachment_input_controller.js +2 -1
- package/src/js/controllers/flatpickr_controller.js +25 -14
- package/src/js/controllers/remote_modal_controller.js +24 -17
- package/src/js/controllers/slim_select_controller.js +201 -8
package/src/dist/js/plutonium.js
CHANGED
|
@@ -11629,7 +11629,7 @@
|
|
|
11629
11629
|
}
|
|
11630
11630
|
|
|
11631
11631
|
// node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js
|
|
11632
|
-
function
|
|
11632
|
+
function getComputedStyle2(element) {
|
|
11633
11633
|
return getWindow(element).getComputedStyle(element);
|
|
11634
11634
|
}
|
|
11635
11635
|
|
|
@@ -11666,7 +11666,7 @@
|
|
|
11666
11666
|
// node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js
|
|
11667
11667
|
function getTrueOffsetParent(element) {
|
|
11668
11668
|
if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
|
|
11669
|
-
|
|
11669
|
+
getComputedStyle2(element).position === "fixed") {
|
|
11670
11670
|
return null;
|
|
11671
11671
|
}
|
|
11672
11672
|
return element.offsetParent;
|
|
@@ -11675,7 +11675,7 @@
|
|
|
11675
11675
|
var isFirefox = /firefox/i.test(getUAString());
|
|
11676
11676
|
var isIE = /Trident/i.test(getUAString());
|
|
11677
11677
|
if (isIE && isHTMLElement(element)) {
|
|
11678
|
-
var elementCss =
|
|
11678
|
+
var elementCss = getComputedStyle2(element);
|
|
11679
11679
|
if (elementCss.position === "fixed") {
|
|
11680
11680
|
return null;
|
|
11681
11681
|
}
|
|
@@ -11685,7 +11685,7 @@
|
|
|
11685
11685
|
currentNode = currentNode.host;
|
|
11686
11686
|
}
|
|
11687
11687
|
while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
|
|
11688
|
-
var css =
|
|
11688
|
+
var css = getComputedStyle2(currentNode);
|
|
11689
11689
|
if (css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || ["transform", "perspective"].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === "filter" || isFirefox && css.filter && css.filter !== "none") {
|
|
11690
11690
|
return currentNode;
|
|
11691
11691
|
} else {
|
|
@@ -11697,10 +11697,10 @@
|
|
|
11697
11697
|
function getOffsetParent(element) {
|
|
11698
11698
|
var window2 = getWindow(element);
|
|
11699
11699
|
var offsetParent = getTrueOffsetParent(element);
|
|
11700
|
-
while (offsetParent && isTableElement(offsetParent) &&
|
|
11700
|
+
while (offsetParent && isTableElement(offsetParent) && getComputedStyle2(offsetParent).position === "static") {
|
|
11701
11701
|
offsetParent = getTrueOffsetParent(offsetParent);
|
|
11702
11702
|
}
|
|
11703
|
-
if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" &&
|
|
11703
|
+
if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle2(offsetParent).position === "static")) {
|
|
11704
11704
|
return window2;
|
|
11705
11705
|
}
|
|
11706
11706
|
return offsetParent || getContainingBlock(element) || window2;
|
|
@@ -11849,7 +11849,7 @@
|
|
|
11849
11849
|
var widthProp = "clientWidth";
|
|
11850
11850
|
if (offsetParent === getWindow(popper2)) {
|
|
11851
11851
|
offsetParent = getDocumentElement(popper2);
|
|
11852
|
-
if (
|
|
11852
|
+
if (getComputedStyle2(offsetParent).position !== "static" && position === "absolute") {
|
|
11853
11853
|
heightProp = "scrollHeight";
|
|
11854
11854
|
widthProp = "scrollWidth";
|
|
11855
11855
|
}
|
|
@@ -12045,7 +12045,7 @@
|
|
|
12045
12045
|
var height = max(html3.scrollHeight, html3.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
|
12046
12046
|
var x3 = -winScroll.scrollLeft + getWindowScrollBarX(element);
|
|
12047
12047
|
var y4 = -winScroll.scrollTop;
|
|
12048
|
-
if (
|
|
12048
|
+
if (getComputedStyle2(body || html3).direction === "rtl") {
|
|
12049
12049
|
x3 += max(html3.clientWidth, body ? body.clientWidth : 0) - width;
|
|
12050
12050
|
}
|
|
12051
12051
|
return {
|
|
@@ -12058,7 +12058,7 @@
|
|
|
12058
12058
|
|
|
12059
12059
|
// node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js
|
|
12060
12060
|
function isScrollParent(element) {
|
|
12061
|
-
var _getComputedStyle =
|
|
12061
|
+
var _getComputedStyle = getComputedStyle2(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
|
|
12062
12062
|
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
|
|
12063
12063
|
}
|
|
12064
12064
|
|
|
@@ -12118,7 +12118,7 @@
|
|
|
12118
12118
|
}
|
|
12119
12119
|
function getClippingParents(element) {
|
|
12120
12120
|
var clippingParents2 = listScrollParents(getParentNode(element));
|
|
12121
|
-
var canEscapeClipping = ["absolute", "fixed"].indexOf(
|
|
12121
|
+
var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle2(element).position) >= 0;
|
|
12122
12122
|
var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
|
|
12123
12123
|
if (!isElement(clipperElement)) {
|
|
12124
12124
|
return [];
|
|
@@ -16333,16 +16333,152 @@ ${text2}</tr>
|
|
|
16333
16333
|
// src/js/controllers/slim_select_controller.js
|
|
16334
16334
|
var slim_select_controller_default = class extends Controller {
|
|
16335
16335
|
connect() {
|
|
16336
|
+
const settings = {};
|
|
16337
|
+
const modal = document.querySelector('[data-controller="remote-modal"]');
|
|
16338
|
+
if (modal) {
|
|
16339
|
+
this.dropdownContainer = document.createElement("div");
|
|
16340
|
+
this.dropdownContainer.className = "ss-dropdown-container";
|
|
16341
|
+
const selectWrapper = this.element.parentNode;
|
|
16342
|
+
const originalPosition = getComputedStyle(selectWrapper).position;
|
|
16343
|
+
if (originalPosition === "static") {
|
|
16344
|
+
selectWrapper.style.position = "relative";
|
|
16345
|
+
this.modifiedSelectWrapper = selectWrapper;
|
|
16346
|
+
}
|
|
16347
|
+
this.element.parentNode.insertBefore(
|
|
16348
|
+
this.dropdownContainer,
|
|
16349
|
+
this.element.nextSibling
|
|
16350
|
+
);
|
|
16351
|
+
settings.contentLocation = this.dropdownContainer;
|
|
16352
|
+
settings.contentPosition = "absolute";
|
|
16353
|
+
settings.openPosition = "auto";
|
|
16354
|
+
}
|
|
16336
16355
|
this.slimSelect = new SlimSelect({
|
|
16337
|
-
select: this.element
|
|
16356
|
+
select: this.element,
|
|
16357
|
+
settings
|
|
16338
16358
|
});
|
|
16339
|
-
this.
|
|
16359
|
+
this.handleDropdownPosition();
|
|
16360
|
+
this.boundHandleDropdownOpen = this.handleDropdownOpen.bind(this);
|
|
16361
|
+
this.boundHandleDropdownClose = this.handleDropdownClose.bind(this);
|
|
16362
|
+
this.element.addEventListener("ss:open", this.boundHandleDropdownOpen);
|
|
16363
|
+
this.element.addEventListener("ss:close", this.boundHandleDropdownClose);
|
|
16364
|
+
this.setupAriaObserver();
|
|
16365
|
+
this.element.setAttribute(
|
|
16366
|
+
"data-action",
|
|
16367
|
+
"turbo:morph-element->slim-select#reconnect"
|
|
16368
|
+
);
|
|
16369
|
+
}
|
|
16370
|
+
handleDropdownPosition() {
|
|
16371
|
+
if (this.dropdownContainer) {
|
|
16372
|
+
const repositionDropdown = () => {
|
|
16373
|
+
const selectRect = this.element.getBoundingClientRect();
|
|
16374
|
+
const spaceBelow = window.innerHeight - selectRect.bottom;
|
|
16375
|
+
const spaceAbove = selectRect.top;
|
|
16376
|
+
if (spaceBelow < 200 && spaceAbove > spaceBelow) {
|
|
16377
|
+
this.dropdownContainer.style.top = "auto";
|
|
16378
|
+
this.dropdownContainer.style.bottom = "100%";
|
|
16379
|
+
this.dropdownContainer.style.borderRadius = "0.375rem 0.375rem 0 0";
|
|
16380
|
+
} else {
|
|
16381
|
+
this.dropdownContainer.style.bottom = "auto";
|
|
16382
|
+
this.dropdownContainer.style.borderRadius = "0 0 0.375rem 0.375rem";
|
|
16383
|
+
}
|
|
16384
|
+
};
|
|
16385
|
+
setTimeout(repositionDropdown, 0);
|
|
16386
|
+
window.addEventListener("resize", repositionDropdown);
|
|
16387
|
+
window.addEventListener("scroll", repositionDropdown);
|
|
16388
|
+
this.repositionDropdown = repositionDropdown;
|
|
16389
|
+
}
|
|
16390
|
+
}
|
|
16391
|
+
handleDropdownOpen() {
|
|
16392
|
+
if (this.dropdownContainer) {
|
|
16393
|
+
this.dropdownContainer.style.height = "auto";
|
|
16394
|
+
this.dropdownContainer.style.overflow = "visible";
|
|
16395
|
+
this.dropdownContainer.classList.add("ss-active");
|
|
16396
|
+
const allContainers = document.querySelectorAll(".ss-dropdown-container");
|
|
16397
|
+
allContainers.forEach((container) => {
|
|
16398
|
+
if (container !== this.dropdownContainer) {
|
|
16399
|
+
container.style.zIndex = "9999";
|
|
16400
|
+
}
|
|
16401
|
+
});
|
|
16402
|
+
this.dropdownContainer.style.zIndex = "10000";
|
|
16403
|
+
}
|
|
16404
|
+
}
|
|
16405
|
+
handleDropdownClose() {
|
|
16406
|
+
if (this.dropdownContainer) {
|
|
16407
|
+
this.dropdownContainer.classList.remove("ss-active");
|
|
16408
|
+
}
|
|
16409
|
+
}
|
|
16410
|
+
setupAriaObserver() {
|
|
16411
|
+
if (this.element) {
|
|
16412
|
+
this.ariaObserver = new MutationObserver((mutations) => {
|
|
16413
|
+
mutations.forEach((mutation) => {
|
|
16414
|
+
if (mutation.attributeName === "aria-expanded") {
|
|
16415
|
+
const expanded = mutation.target.getAttribute("aria-expanded") === "true";
|
|
16416
|
+
if (expanded) {
|
|
16417
|
+
this.handleDropdownOpen();
|
|
16418
|
+
} else {
|
|
16419
|
+
this.handleDropdownClose();
|
|
16420
|
+
}
|
|
16421
|
+
}
|
|
16422
|
+
});
|
|
16423
|
+
});
|
|
16424
|
+
const possibleTargets = [
|
|
16425
|
+
this.element,
|
|
16426
|
+
this.element.parentNode.querySelector(".ss-main"),
|
|
16427
|
+
this.element.parentNode.querySelector("[aria-expanded]")
|
|
16428
|
+
];
|
|
16429
|
+
const target = possibleTargets.find(
|
|
16430
|
+
(el) => el && el.hasAttribute && el.hasAttribute("aria-expanded")
|
|
16431
|
+
);
|
|
16432
|
+
if (target) {
|
|
16433
|
+
this.ariaObserver.observe(target, {
|
|
16434
|
+
attributes: true,
|
|
16435
|
+
attributeFilter: ["aria-expanded"]
|
|
16436
|
+
});
|
|
16437
|
+
const expanded = target.getAttribute("aria-expanded") === "true";
|
|
16438
|
+
if (expanded) {
|
|
16439
|
+
this.handleDropdownOpen();
|
|
16440
|
+
} else {
|
|
16441
|
+
this.handleDropdownClose();
|
|
16442
|
+
}
|
|
16443
|
+
}
|
|
16444
|
+
}
|
|
16340
16445
|
}
|
|
16341
16446
|
disconnect() {
|
|
16447
|
+
if (this.element) {
|
|
16448
|
+
if (this.boundHandleDropdownOpen) {
|
|
16449
|
+
this.element.removeEventListener(
|
|
16450
|
+
"ss:open",
|
|
16451
|
+
this.boundHandleDropdownOpen
|
|
16452
|
+
);
|
|
16453
|
+
}
|
|
16454
|
+
if (this.boundHandleDropdownClose) {
|
|
16455
|
+
this.element.removeEventListener(
|
|
16456
|
+
"ss:close",
|
|
16457
|
+
this.boundHandleDropdownClose
|
|
16458
|
+
);
|
|
16459
|
+
}
|
|
16460
|
+
}
|
|
16461
|
+
if (this.ariaObserver) {
|
|
16462
|
+
this.ariaObserver.disconnect();
|
|
16463
|
+
this.ariaObserver = null;
|
|
16464
|
+
}
|
|
16342
16465
|
if (this.slimSelect) {
|
|
16343
16466
|
this.slimSelect.destroy();
|
|
16344
16467
|
this.slimSelect = null;
|
|
16345
16468
|
}
|
|
16469
|
+
if (this.repositionDropdown) {
|
|
16470
|
+
window.removeEventListener("resize", this.repositionDropdown);
|
|
16471
|
+
window.removeEventListener("scroll", this.repositionDropdown);
|
|
16472
|
+
this.repositionDropdown = null;
|
|
16473
|
+
}
|
|
16474
|
+
if (this.dropdownContainer && this.dropdownContainer.parentNode) {
|
|
16475
|
+
this.dropdownContainer.parentNode.removeChild(this.dropdownContainer);
|
|
16476
|
+
this.dropdownContainer = null;
|
|
16477
|
+
}
|
|
16478
|
+
if (this.modifiedSelectWrapper) {
|
|
16479
|
+
this.modifiedSelectWrapper.style.position = "";
|
|
16480
|
+
this.modifiedSelectWrapper = null;
|
|
16481
|
+
}
|
|
16346
16482
|
}
|
|
16347
16483
|
reconnect() {
|
|
16348
16484
|
this.disconnect();
|
|
@@ -16353,8 +16489,12 @@ ${text2}</tr>
|
|
|
16353
16489
|
// src/js/controllers/flatpickr_controller.js
|
|
16354
16490
|
var flatpickr_controller_default = class extends Controller {
|
|
16355
16491
|
connect() {
|
|
16492
|
+
this.modal = document.querySelector("[data-controller=remote-modal]");
|
|
16356
16493
|
this.picker = new flatpickr(this.element, this.#buildOptions());
|
|
16357
|
-
this.element.setAttribute(
|
|
16494
|
+
this.element.setAttribute(
|
|
16495
|
+
"data-action",
|
|
16496
|
+
"turbo:morph-element->flatpickr#reconnect"
|
|
16497
|
+
);
|
|
16358
16498
|
}
|
|
16359
16499
|
disconnect() {
|
|
16360
16500
|
if (this.picker) {
|
|
@@ -16374,6 +16514,9 @@ ${text2}</tr>
|
|
|
16374
16514
|
options2.enableTime = true;
|
|
16375
16515
|
options2.noCalendar = true;
|
|
16376
16516
|
}
|
|
16517
|
+
if (this.modal) {
|
|
16518
|
+
options2.appendTo = this.modal;
|
|
16519
|
+
}
|
|
16377
16520
|
return options2;
|
|
16378
16521
|
}
|
|
16379
16522
|
};
|
|
@@ -29161,6 +29304,7 @@ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e4.byteLength}`), e4.tif
|
|
|
29161
29304
|
var attachment_input_controller_default = class extends Controller {
|
|
29162
29305
|
static values = {
|
|
29163
29306
|
identifier: String,
|
|
29307
|
+
endpoint: String,
|
|
29164
29308
|
maxFileSize: { type: Number, default: null },
|
|
29165
29309
|
minFileSize: { type: Number, default: null },
|
|
29166
29310
|
maxTotalSize: { type: Number, default: null },
|
|
@@ -29205,7 +29349,7 @@ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e4.byteLength}`), e4.tif
|
|
|
29205
29349
|
}
|
|
29206
29350
|
#configureUploader() {
|
|
29207
29351
|
this.uppy.use(XHRUpload, {
|
|
29208
|
-
endpoint:
|
|
29352
|
+
endpoint: this.endpointValue
|
|
29209
29353
|
// path to the upload endpoint
|
|
29210
29354
|
});
|
|
29211
29355
|
}
|
|
@@ -29531,6 +29675,10 @@ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e4.byteLength}`), e4.tif
|
|
|
29531
29675
|
this.element.showModal();
|
|
29532
29676
|
this.element.addEventListener("close", this.handleClose.bind(this));
|
|
29533
29677
|
}
|
|
29678
|
+
close() {
|
|
29679
|
+
this.element.close();
|
|
29680
|
+
window.scrollTo(0, this.originalScrollPosition);
|
|
29681
|
+
}
|
|
29534
29682
|
disconnect() {
|
|
29535
29683
|
this.element.removeEventListener("close", this.handleClose);
|
|
29536
29684
|
}
|