@marianmeres/stuic 1.97.0 → 1.99.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.
package/dist/actions/autogrow.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// actual worker
|
|
2
|
-
export function increaseHeightToScrollHeight(el, max = 0, min =
|
|
2
|
+
export function increaseHeightToScrollHeight(el, max = 0, min = 0) {
|
|
3
3
|
//
|
|
4
4
|
let h = max ? Math.min(max, el.scrollHeight) : el.scrollHeight;
|
|
5
5
|
h = Math.max(min, h);
|
|
@@ -10,7 +10,7 @@ export function increaseHeightToScrollHeight(el, max = 0, min = 16) {
|
|
|
10
10
|
}
|
|
11
11
|
// action wrap
|
|
12
12
|
export function autogrow(el, options = null) {
|
|
13
|
-
const { max, min, allowed } = { max: 250, min:
|
|
13
|
+
const { max, min, allowed } = { max: 250, min: 0, allowed: true, ...(options || {}) };
|
|
14
14
|
if (!allowed)
|
|
15
15
|
return;
|
|
16
16
|
const _doGrow = () => increaseHeightToScrollHeight(el, max, min);
|
|
@@ -34,6 +34,7 @@ export interface TooltipOptions {
|
|
|
34
34
|
touch?: Readable<number>;
|
|
35
35
|
trigger?: Readable<boolean>;
|
|
36
36
|
notifier?: Writable<boolean>;
|
|
37
|
+
getAppendChildTarget?: () => HTMLElement;
|
|
37
38
|
}
|
|
38
39
|
export declare const _TRANSITION_OPACITY_DUR = 150;
|
|
39
40
|
export declare function tooltip(node: HTMLElement, initialOptions?: string | Partial<TooltipOptions>): {
|
|
@@ -57,11 +57,11 @@ const TRIGGERS = {
|
|
|
57
57
|
// default TW value
|
|
58
58
|
export const _TRANSITION_OPACITY_DUR = 150;
|
|
59
59
|
const _ensureDiv = (div, opts, log) => {
|
|
60
|
-
log('_ensureDiv');
|
|
60
|
+
log('_ensureDiv', div);
|
|
61
61
|
if (!div) {
|
|
62
62
|
log('creating tooltip div...');
|
|
63
63
|
div = document.createElement('div');
|
|
64
|
-
document.body.appendChild(div);
|
|
64
|
+
(opts?.getAppendChildTarget?.() || document.body).appendChild(div);
|
|
65
65
|
}
|
|
66
66
|
else {
|
|
67
67
|
log('div exists... going to apply classes');
|
|
@@ -87,7 +87,7 @@ const _ensureArrow = (arrow, opts, log) => {
|
|
|
87
87
|
if (!arrow) {
|
|
88
88
|
log('creating tooltip arrow...');
|
|
89
89
|
arrow = document.createElement('div');
|
|
90
|
-
document.body.appendChild(arrow);
|
|
90
|
+
(opts?.getAppendChildTarget?.() || document.body).appendChild(arrow);
|
|
91
91
|
}
|
|
92
92
|
else {
|
|
93
93
|
log('arrow exists... going to apply classes');
|
|
@@ -142,7 +142,8 @@ $:
|
|
|
142
142
|
$:
|
|
143
143
|
_inputClass = twMerge(
|
|
144
144
|
"form-input",
|
|
145
|
-
|
|
145
|
+
type === "textarea" ? "min-h-16" : "",
|
|
146
|
+
_collectClasses("input")
|
|
146
147
|
);
|
|
147
148
|
$:
|
|
148
149
|
_validationMessageClass = twMerge(_collectClasses("validationMessage"));
|