powerpagestoolkit 2.5.303 → 2.5.402
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/README.md +10 -3
- package/dist/DOMNodeReference.d.ts +37 -41
- package/dist/bundle.css +1 -0
- package/dist/bundle.js +71 -53
- package/dist/createInfoElement.d.ts +7 -1
- package/package.json +1 -4
package/README.md
CHANGED
|
@@ -140,11 +140,18 @@ node.enable();
|
|
|
140
140
|
```typescript
|
|
141
141
|
// LABEL AND INFO OPERATIONS
|
|
142
142
|
const label = node.getLabel();
|
|
143
|
-
node.appendToLabel(infoElement);
|
|
144
143
|
// appends a tooltip to the label associated with the element targeted by 'this'
|
|
145
|
-
node.addLabelTooltip(
|
|
144
|
+
node.addLabelTooltip(
|
|
145
|
+
"Helper text",
|
|
146
|
+
/* Optionally pass in css styles to customize the tooltip icon*/
|
|
147
|
+
{ color: "orange", fontSize: "30px" }
|
|
148
|
+
);
|
|
146
149
|
// appends a tooltip directly to the element targeted by 'this'
|
|
147
|
-
node.addTooltip(
|
|
150
|
+
node.addTooltip(
|
|
151
|
+
"Inline helper",
|
|
152
|
+
/* Optionally pass in css styles to customize the tooltip icon*/
|
|
153
|
+
{ color: "orange", fontSize: "30px" }
|
|
154
|
+
);
|
|
148
155
|
```
|
|
149
156
|
|
|
150
157
|
### DataVerse API
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const _init: unique symbol;
|
|
2
|
-
|
|
2
|
+
export default class DOMNodeReference {
|
|
3
3
|
target: HTMLElement | string;
|
|
4
4
|
private isLoaded;
|
|
5
5
|
private defaultDisplay;
|
|
@@ -65,77 +65,77 @@ export declare const _init: unique symbol;
|
|
|
65
65
|
/**
|
|
66
66
|
* Sets up an event listener based on the specified event type, executing the specified
|
|
67
67
|
* event handler
|
|
68
|
-
* @param
|
|
69
|
-
* @param
|
|
70
|
-
* specified event occurs
|
|
71
|
-
* @returns - Instance of this
|
|
68
|
+
* @param eventType - The DOM event to watch for
|
|
69
|
+
* @param eventHandler - The callback function that runs when the
|
|
70
|
+
* specified event occurs.
|
|
71
|
+
* @returns - Instance of this [provides option to method chain]
|
|
72
72
|
*/
|
|
73
73
|
on(eventType: string, eventHandler: (e: Event) => void): DOMNodeReference;
|
|
74
74
|
/**
|
|
75
75
|
* Hides the element by setting its display style to "none".
|
|
76
|
-
* @returns - Instance of this
|
|
76
|
+
* @returns - Instance of this [provides option to method chain]
|
|
77
77
|
*/
|
|
78
78
|
hide(): DOMNodeReference;
|
|
79
79
|
/**
|
|
80
80
|
* Shows the element by restoring its default display style.
|
|
81
|
-
* @returns - Instance of this
|
|
81
|
+
* @returns - Instance of this [provides option to method chain]
|
|
82
82
|
*/
|
|
83
83
|
show(): DOMNodeReference;
|
|
84
84
|
/**
|
|
85
85
|
*
|
|
86
86
|
* @param {function(instance: DOMNodeReference): boolean | boolean} shouldShow - Either a function that returns true or false,
|
|
87
87
|
* or a natural boolean to determine the visibility of this
|
|
88
|
-
* @returns - Instance of this
|
|
88
|
+
* @returns - Instance of this [provides option to method chain]
|
|
89
89
|
*/
|
|
90
90
|
toggleVisibility(shouldShow: ((instance: DOMNodeReference) => boolean) | boolean): DOMNodeReference;
|
|
91
91
|
/**
|
|
92
92
|
* Sets the value of the HTML element.
|
|
93
|
-
* @param
|
|
93
|
+
* @param value - The value to set for the HTML element.
|
|
94
94
|
* for parents of boolean radios, pass true or false as value, or
|
|
95
95
|
* an expression returning a boolean
|
|
96
|
-
* @returns - Instance of this
|
|
96
|
+
* @returns - Instance of this [provides option to method chain]
|
|
97
97
|
*/
|
|
98
98
|
setValue(value: (() => any) | any): DOMNodeReference;
|
|
99
99
|
/**
|
|
100
100
|
* Disables the element so that users cannot input any data
|
|
101
|
-
* @returns - Instance of this
|
|
101
|
+
* @returns - Instance of this [provides option to method chain]
|
|
102
102
|
*/
|
|
103
103
|
disable(): DOMNodeReference;
|
|
104
104
|
/**
|
|
105
105
|
* Clears all values and states of the element.
|
|
106
106
|
* Handles different input types appropriately.
|
|
107
107
|
*
|
|
108
|
-
* @returns
|
|
109
|
-
* @throws
|
|
108
|
+
* @returns - Instance of this [provides option to method chain]
|
|
109
|
+
* @throws If clearing values fails
|
|
110
110
|
*/
|
|
111
111
|
clearValues(): Promise<DOMNodeReference>;
|
|
112
112
|
/**
|
|
113
113
|
* Enables the element so that users can input data
|
|
114
|
-
* @returns - Instance of this
|
|
114
|
+
* @returns - Instance of this [provides option to method chain]
|
|
115
115
|
*/
|
|
116
116
|
enable(): DOMNodeReference;
|
|
117
117
|
/**
|
|
118
118
|
*
|
|
119
|
-
* @param
|
|
120
|
-
* @returns - Instance of this
|
|
119
|
+
* @param elements - The elements to prepend to the element targeted by this.
|
|
120
|
+
* @returns - Instance of this [provides option to method chain]
|
|
121
121
|
*/
|
|
122
122
|
prepend(...elements: HTMLElement[]): DOMNodeReference;
|
|
123
123
|
/**
|
|
124
124
|
* Appends child elements to the HTML element.
|
|
125
|
-
* @param
|
|
126
|
-
* @returns - Instance of this
|
|
125
|
+
* @param elements - The elements to append to the element targeted by this.
|
|
126
|
+
* @returns - Instance of this [provides option to method chain]
|
|
127
127
|
*/
|
|
128
128
|
append(...elements: HTMLElement[]): DOMNodeReference;
|
|
129
129
|
/**
|
|
130
130
|
* Inserts elements before the HTML element.
|
|
131
|
-
* @param
|
|
132
|
-
* @returns - Instance of this
|
|
131
|
+
* @param elements - The elements to insert before the HTML element.
|
|
132
|
+
* @returns - Instance of this [provides option to method chain]
|
|
133
133
|
*/
|
|
134
134
|
before(...elements: HTMLElement[]): DOMNodeReference;
|
|
135
135
|
/**
|
|
136
136
|
* Inserts elements after the HTML element.
|
|
137
|
-
* @param
|
|
138
|
-
* @returns - Instance of this
|
|
137
|
+
* @param elements - The elements to insert after the HTML element.
|
|
138
|
+
* @returns - Instance of this [provides option to method chain]
|
|
139
139
|
*/
|
|
140
140
|
after(...elements: HTMLElement[]): DOMNodeReference;
|
|
141
141
|
/**
|
|
@@ -143,44 +143,40 @@ export declare const _init: unique symbol;
|
|
|
143
143
|
* @returns {HTMLElement} The label element associated with this element.
|
|
144
144
|
*/
|
|
145
145
|
getLabel(): HTMLElement | null;
|
|
146
|
-
/**
|
|
147
|
-
* Appends child elements to the label associated with the HTML element.
|
|
148
|
-
* @param {...HTMLElement} elements - The elements to append to the label.
|
|
149
|
-
* @returns - Instance of this
|
|
150
|
-
*/
|
|
151
|
-
appendToLabel(...elements: HTMLElement[]): DOMNodeReference;
|
|
152
146
|
/**
|
|
153
147
|
* Adds a tooltip with specified text to the label associated with the HTML element.
|
|
154
|
-
* @param
|
|
155
|
-
* @
|
|
148
|
+
* @param text - The text to display in the tooltip.
|
|
149
|
+
* @param containerStyle - Optional object with CSS Styles to apply to the container of the info element
|
|
150
|
+
* @returns - Instance of this [provides option to method chain]
|
|
156
151
|
*/
|
|
157
|
-
addLabelTooltip(text: string): DOMNodeReference;
|
|
152
|
+
addLabelTooltip(text: string, containerStyle?: Partial<CSSStyleDeclaration>): DOMNodeReference;
|
|
158
153
|
/**
|
|
159
154
|
* Adds a tooltip with the specified text to the element
|
|
160
|
-
* @param
|
|
161
|
-
* @
|
|
155
|
+
* @param text - The text to display in the tooltip
|
|
156
|
+
* @param containerStyle - Optional object with CSS Styles to apply to the container of the info element
|
|
157
|
+
* @returns - Instance of this [provides option to method chain]
|
|
162
158
|
*/
|
|
163
|
-
addTooltip(text: string): DOMNodeReference;
|
|
159
|
+
addTooltip(text: string, containerStyle?: Partial<CSSStyleDeclaration>): DOMNodeReference;
|
|
164
160
|
/**
|
|
165
161
|
* Sets the inner HTML content of the HTML element.
|
|
166
162
|
* @param {string} string - The text to set as the inner HTML of the element.
|
|
167
|
-
* @returns - Instance of this
|
|
163
|
+
* @returns - Instance of this [provides option to method chain]
|
|
168
164
|
*/
|
|
169
165
|
setInnerHTML(string: string): this;
|
|
170
166
|
/**
|
|
171
167
|
* Removes this element from the DOM
|
|
172
|
-
* @returns - Instance of this
|
|
168
|
+
* @returns - Instance of this [provides option to method chain]
|
|
173
169
|
*/
|
|
174
170
|
remove(): this;
|
|
175
171
|
/**
|
|
176
172
|
*
|
|
177
173
|
* @param {Partial<CSSStyleDeclaration} options and object containing the styles you want to set : {key: value} e.g.: {'display': 'block'}
|
|
178
|
-
* @returns - Instance of this
|
|
174
|
+
* @returns - Instance of this [provides option to method chain]
|
|
179
175
|
*/
|
|
180
176
|
setStyle(options: Partial<CSSStyleDeclaration>): this;
|
|
181
177
|
/**
|
|
182
178
|
* Unchecks both the yes and no radio buttons if they exist.
|
|
183
|
-
* @returns - Instance of this
|
|
179
|
+
* @returns - Instance of this [provides option to method chain]
|
|
184
180
|
*/
|
|
185
181
|
uncheckRadios(): DOMNodeReference;
|
|
186
182
|
/**
|
|
@@ -194,7 +190,7 @@ export declare const _init: unique symbol;
|
|
|
194
190
|
* registered on each to toggle the visibility of the target element based on the `condition` and the visibility of
|
|
195
191
|
* the target node.
|
|
196
192
|
* @throws {ConditionalRenderingError} When there's an error in setting up conditional rendering
|
|
197
|
-
* @returns {DOMNodeReference} - Instance of this
|
|
193
|
+
* @returns {DOMNodeReference} - Instance of this [provides option to method chain]
|
|
198
194
|
*/
|
|
199
195
|
configureConditionalRendering(condition: () => boolean, dependencies?: Array<DOMNodeReference>): DOMNodeReference;
|
|
200
196
|
/**
|
|
@@ -204,7 +200,7 @@ export declare const _init: unique symbol;
|
|
|
204
200
|
* @param {() => boolean} isValid - Function validating field input
|
|
205
201
|
* @param {string} fieldDisplayName - Display name for error messages
|
|
206
202
|
* @param {Array<DOMNodeReference>} dependencies - Fields that trigger requirement/validation updates
|
|
207
|
-
* @returns {DOMNodeReference} Instance of this
|
|
203
|
+
* @returns {DOMNodeReference} Instance of this
|
|
208
204
|
* @throws {ValidationConfigError} If validation setup fails
|
|
209
205
|
*/
|
|
210
206
|
configureValidationAndRequirements(isRequired: () => boolean, isValid: () => boolean, fieldDisplayName: string, dependencies: Array<DOMNodeReference>): DOMNodeReference;
|
|
@@ -218,7 +214,7 @@ export declare const _init: unique symbol;
|
|
|
218
214
|
*
|
|
219
215
|
* @param {Function | boolean} isRequired - Determines whether the field should be marked as required.
|
|
220
216
|
* If true, the "required-field" class is added to the label; if false, it is removed.
|
|
221
|
-
* @returns - Instance of this
|
|
217
|
+
* @returns - Instance of this [provides option to method chain]
|
|
222
218
|
*/
|
|
223
219
|
setRequiredLevel(isRequired: (() => boolean) | boolean): DOMNodeReference;
|
|
224
220
|
/**
|
package/dist/bundle.css
CHANGED
package/dist/bundle.js
CHANGED
|
@@ -136,7 +136,17 @@ function waitFor(target) {
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
// src/createInfoElement.ts
|
|
139
|
-
function CreateInfoEl(titleString) {
|
|
139
|
+
function CreateInfoEl(titleString, containerStyle) {
|
|
140
|
+
if (typeof titleString !== "string") {
|
|
141
|
+
throw new Error(
|
|
142
|
+
`argument "titleString" must be of type "string". Received: "${typeof titleString}"`
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
if (containerStyle && typeof containerStyle !== "object") {
|
|
146
|
+
throw new Error(
|
|
147
|
+
`argument "containerStyle" must be of type "object". Received: "${typeof containerStyle}"`
|
|
148
|
+
);
|
|
149
|
+
}
|
|
140
150
|
const span = document.createElement("span");
|
|
141
151
|
span.classList.add("info-icon");
|
|
142
152
|
const icon = document.createElement("i");
|
|
@@ -148,6 +158,9 @@ function CreateInfoEl(titleString) {
|
|
|
148
158
|
flyoutContent.classList.add("flyout-content");
|
|
149
159
|
span.appendChild(icon);
|
|
150
160
|
span.appendChild(flyoutContent);
|
|
161
|
+
if (containerStyle) {
|
|
162
|
+
Object.assign(icon.style, containerStyle);
|
|
163
|
+
}
|
|
151
164
|
const positionFlyout = () => {
|
|
152
165
|
flyoutContent.style.display = "block";
|
|
153
166
|
const flyoutRect = flyoutContent.getBoundingClientRect();
|
|
@@ -161,9 +174,14 @@ function CreateInfoEl(titleString) {
|
|
|
161
174
|
flyoutContent.style.left = `calc(50% + ${overflowAmount}px)`;
|
|
162
175
|
}
|
|
163
176
|
};
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
177
|
+
span.addEventListener("mouseenter", () => {
|
|
178
|
+
positionFlyout();
|
|
179
|
+
});
|
|
180
|
+
span.addEventListener("mouseleave", (event) => {
|
|
181
|
+
const relatedTarget = event.relatedTarget;
|
|
182
|
+
if (!span.contains(relatedTarget)) {
|
|
183
|
+
flyoutContent.style.display = "none";
|
|
184
|
+
}
|
|
167
185
|
});
|
|
168
186
|
icon.addEventListener("touchstart", (event) => {
|
|
169
187
|
event.preventDefault();
|
|
@@ -360,18 +378,28 @@ var DOMNodeReference = class _DOMNodeReference {
|
|
|
360
378
|
/**
|
|
361
379
|
* Sets up an event listener based on the specified event type, executing the specified
|
|
362
380
|
* event handler
|
|
363
|
-
* @param
|
|
364
|
-
* @param
|
|
365
|
-
* specified event occurs
|
|
366
|
-
* @returns - Instance of this
|
|
381
|
+
* @param eventType - The DOM event to watch for
|
|
382
|
+
* @param eventHandler - The callback function that runs when the
|
|
383
|
+
* specified event occurs.
|
|
384
|
+
* @returns - Instance of this [provides option to method chain]
|
|
367
385
|
*/
|
|
368
386
|
on(eventType, eventHandler) {
|
|
387
|
+
if (typeof eventType !== "string") {
|
|
388
|
+
throw new Error(
|
|
389
|
+
`Argument "eventType" must be of type "string". Received: ${typeof eventType}`
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
if (typeof eventHandler !== "function") {
|
|
393
|
+
throw new Error(
|
|
394
|
+
`Argument "eventHandler" must be a Function. Received: ${typeof eventHandler}`
|
|
395
|
+
);
|
|
396
|
+
}
|
|
369
397
|
this.element.addEventListener(eventType, eventHandler.bind(this));
|
|
370
398
|
return this;
|
|
371
399
|
}
|
|
372
400
|
/**
|
|
373
401
|
* Hides the element by setting its display style to "none".
|
|
374
|
-
* @returns - Instance of this
|
|
402
|
+
* @returns - Instance of this [provides option to method chain]
|
|
375
403
|
*/
|
|
376
404
|
hide() {
|
|
377
405
|
this.visibilityController.style.display = "none";
|
|
@@ -379,7 +407,7 @@ var DOMNodeReference = class _DOMNodeReference {
|
|
|
379
407
|
}
|
|
380
408
|
/**
|
|
381
409
|
* Shows the element by restoring its default display style.
|
|
382
|
-
* @returns - Instance of this
|
|
410
|
+
* @returns - Instance of this [provides option to method chain]
|
|
383
411
|
*/
|
|
384
412
|
show() {
|
|
385
413
|
this.visibilityController.style.display = this.defaultDisplay;
|
|
@@ -389,7 +417,7 @@ var DOMNodeReference = class _DOMNodeReference {
|
|
|
389
417
|
*
|
|
390
418
|
* @param {function(instance: DOMNodeReference): boolean | boolean} shouldShow - Either a function that returns true or false,
|
|
391
419
|
* or a natural boolean to determine the visibility of this
|
|
392
|
-
* @returns - Instance of this
|
|
420
|
+
* @returns - Instance of this [provides option to method chain]
|
|
393
421
|
*/
|
|
394
422
|
toggleVisibility(shouldShow) {
|
|
395
423
|
if (shouldShow instanceof Function) {
|
|
@@ -401,10 +429,10 @@ var DOMNodeReference = class _DOMNodeReference {
|
|
|
401
429
|
}
|
|
402
430
|
/**
|
|
403
431
|
* Sets the value of the HTML element.
|
|
404
|
-
* @param
|
|
432
|
+
* @param value - The value to set for the HTML element.
|
|
405
433
|
* for parents of boolean radios, pass true or false as value, or
|
|
406
434
|
* an expression returning a boolean
|
|
407
|
-
* @returns - Instance of this
|
|
435
|
+
* @returns - Instance of this [provides option to method chain]
|
|
408
436
|
*/
|
|
409
437
|
setValue(value) {
|
|
410
438
|
if (value instanceof Function) {
|
|
@@ -420,7 +448,7 @@ var DOMNodeReference = class _DOMNodeReference {
|
|
|
420
448
|
}
|
|
421
449
|
/**
|
|
422
450
|
* Disables the element so that users cannot input any data
|
|
423
|
-
* @returns - Instance of this
|
|
451
|
+
* @returns - Instance of this [provides option to method chain]
|
|
424
452
|
*/
|
|
425
453
|
disable() {
|
|
426
454
|
try {
|
|
@@ -436,8 +464,8 @@ var DOMNodeReference = class _DOMNodeReference {
|
|
|
436
464
|
* Clears all values and states of the element.
|
|
437
465
|
* Handles different input types appropriately.
|
|
438
466
|
*
|
|
439
|
-
* @returns
|
|
440
|
-
* @throws
|
|
467
|
+
* @returns - Instance of this [provides option to method chain]
|
|
468
|
+
* @throws If clearing values fails
|
|
441
469
|
*/
|
|
442
470
|
async clearValues() {
|
|
443
471
|
try {
|
|
@@ -503,7 +531,7 @@ var DOMNodeReference = class _DOMNodeReference {
|
|
|
503
531
|
}
|
|
504
532
|
/**
|
|
505
533
|
* Enables the element so that users can input data
|
|
506
|
-
* @returns - Instance of this
|
|
534
|
+
* @returns - Instance of this [provides option to method chain]
|
|
507
535
|
*/
|
|
508
536
|
enable() {
|
|
509
537
|
try {
|
|
@@ -517,8 +545,8 @@ var DOMNodeReference = class _DOMNodeReference {
|
|
|
517
545
|
}
|
|
518
546
|
/**
|
|
519
547
|
*
|
|
520
|
-
* @param
|
|
521
|
-
* @returns - Instance of this
|
|
548
|
+
* @param elements - The elements to prepend to the element targeted by this.
|
|
549
|
+
* @returns - Instance of this [provides option to method chain]
|
|
522
550
|
*/
|
|
523
551
|
prepend(...elements) {
|
|
524
552
|
this.element.prepend(...elements);
|
|
@@ -526,8 +554,8 @@ var DOMNodeReference = class _DOMNodeReference {
|
|
|
526
554
|
}
|
|
527
555
|
/**
|
|
528
556
|
* Appends child elements to the HTML element.
|
|
529
|
-
* @param
|
|
530
|
-
* @returns - Instance of this
|
|
557
|
+
* @param elements - The elements to append to the element targeted by this.
|
|
558
|
+
* @returns - Instance of this [provides option to method chain]
|
|
531
559
|
*/
|
|
532
560
|
append(...elements) {
|
|
533
561
|
this.element.append(...elements);
|
|
@@ -535,8 +563,8 @@ var DOMNodeReference = class _DOMNodeReference {
|
|
|
535
563
|
}
|
|
536
564
|
/**
|
|
537
565
|
* Inserts elements before the HTML element.
|
|
538
|
-
* @param
|
|
539
|
-
* @returns - Instance of this
|
|
566
|
+
* @param elements - The elements to insert before the HTML element.
|
|
567
|
+
* @returns - Instance of this [provides option to method chain]
|
|
540
568
|
*/
|
|
541
569
|
before(...elements) {
|
|
542
570
|
this.element.before(...elements);
|
|
@@ -544,8 +572,8 @@ var DOMNodeReference = class _DOMNodeReference {
|
|
|
544
572
|
}
|
|
545
573
|
/**
|
|
546
574
|
* Inserts elements after the HTML element.
|
|
547
|
-
* @param
|
|
548
|
-
* @returns - Instance of this
|
|
575
|
+
* @param elements - The elements to insert after the HTML element.
|
|
576
|
+
* @returns - Instance of this [provides option to method chain]
|
|
549
577
|
*/
|
|
550
578
|
after(...elements) {
|
|
551
579
|
this.element.after(...elements);
|
|
@@ -558,40 +586,30 @@ var DOMNodeReference = class _DOMNodeReference {
|
|
|
558
586
|
getLabel() {
|
|
559
587
|
return document.querySelector(`#${this.element.id}_label`) || null;
|
|
560
588
|
}
|
|
561
|
-
/**
|
|
562
|
-
* Appends child elements to the label associated with the HTML element.
|
|
563
|
-
* @param {...HTMLElement} elements - The elements to append to the label.
|
|
564
|
-
* @returns - Instance of this
|
|
565
|
-
*/
|
|
566
|
-
appendToLabel(...elements) {
|
|
567
|
-
const label = this.getLabel();
|
|
568
|
-
if (label) {
|
|
569
|
-
label.append(" ", ...elements);
|
|
570
|
-
}
|
|
571
|
-
return this;
|
|
572
|
-
}
|
|
573
589
|
/**
|
|
574
590
|
* Adds a tooltip with specified text to the label associated with the HTML element.
|
|
575
|
-
* @param
|
|
576
|
-
* @
|
|
591
|
+
* @param text - The text to display in the tooltip.
|
|
592
|
+
* @param containerStyle - Optional object with CSS Styles to apply to the container of the info element
|
|
593
|
+
* @returns - Instance of this [provides option to method chain]
|
|
577
594
|
*/
|
|
578
|
-
addLabelTooltip(text) {
|
|
579
|
-
this.
|
|
595
|
+
addLabelTooltip(text, containerStyle) {
|
|
596
|
+
this.getLabel()?.append(CreateInfoEl(text, containerStyle || void 0));
|
|
580
597
|
return this;
|
|
581
598
|
}
|
|
582
599
|
/**
|
|
583
600
|
* Adds a tooltip with the specified text to the element
|
|
584
|
-
* @param
|
|
585
|
-
* @
|
|
601
|
+
* @param text - The text to display in the tooltip
|
|
602
|
+
* @param containerStyle - Optional object with CSS Styles to apply to the container of the info element
|
|
603
|
+
* @returns - Instance of this [provides option to method chain]
|
|
586
604
|
*/
|
|
587
|
-
addTooltip(text) {
|
|
588
|
-
this.append(CreateInfoEl(text));
|
|
605
|
+
addTooltip(text, containerStyle) {
|
|
606
|
+
this.append(CreateInfoEl(text, containerStyle || void 0));
|
|
589
607
|
return this;
|
|
590
608
|
}
|
|
591
609
|
/**
|
|
592
610
|
* Sets the inner HTML content of the HTML element.
|
|
593
611
|
* @param {string} string - The text to set as the inner HTML of the element.
|
|
594
|
-
* @returns - Instance of this
|
|
612
|
+
* @returns - Instance of this [provides option to method chain]
|
|
595
613
|
*/
|
|
596
614
|
setInnerHTML(string) {
|
|
597
615
|
this.element.innerHTML = string;
|
|
@@ -599,7 +617,7 @@ var DOMNodeReference = class _DOMNodeReference {
|
|
|
599
617
|
}
|
|
600
618
|
/**
|
|
601
619
|
* Removes this element from the DOM
|
|
602
|
-
* @returns - Instance of this
|
|
620
|
+
* @returns - Instance of this [provides option to method chain]
|
|
603
621
|
*/
|
|
604
622
|
remove() {
|
|
605
623
|
this.element.remove();
|
|
@@ -608,7 +626,7 @@ var DOMNodeReference = class _DOMNodeReference {
|
|
|
608
626
|
/**
|
|
609
627
|
*
|
|
610
628
|
* @param {Partial<CSSStyleDeclaration} options and object containing the styles you want to set : {key: value} e.g.: {'display': 'block'}
|
|
611
|
-
* @returns - Instance of this
|
|
629
|
+
* @returns - Instance of this [provides option to method chain]
|
|
612
630
|
*/
|
|
613
631
|
setStyle(options) {
|
|
614
632
|
if (Object.prototype.toString.call(options) !== "[object Object]") {
|
|
@@ -623,7 +641,7 @@ var DOMNodeReference = class _DOMNodeReference {
|
|
|
623
641
|
}
|
|
624
642
|
/**
|
|
625
643
|
* Unchecks both the yes and no radio buttons if they exist.
|
|
626
|
-
* @returns - Instance of this
|
|
644
|
+
* @returns - Instance of this [provides option to method chain]
|
|
627
645
|
*/
|
|
628
646
|
uncheckRadios() {
|
|
629
647
|
if (this.yesRadio && this.noRadio) {
|
|
@@ -647,7 +665,7 @@ var DOMNodeReference = class _DOMNodeReference {
|
|
|
647
665
|
* registered on each to toggle the visibility of the target element based on the `condition` and the visibility of
|
|
648
666
|
* the target node.
|
|
649
667
|
* @throws {ConditionalRenderingError} When there's an error in setting up conditional rendering
|
|
650
|
-
* @returns {DOMNodeReference} - Instance of this
|
|
668
|
+
* @returns {DOMNodeReference} - Instance of this [provides option to method chain]
|
|
651
669
|
*/
|
|
652
670
|
configureConditionalRendering(condition, dependencies) {
|
|
653
671
|
try {
|
|
@@ -710,7 +728,7 @@ var DOMNodeReference = class _DOMNodeReference {
|
|
|
710
728
|
* @param {() => boolean} isValid - Function validating field input
|
|
711
729
|
* @param {string} fieldDisplayName - Display name for error messages
|
|
712
730
|
* @param {Array<DOMNodeReference>} dependencies - Fields that trigger requirement/validation updates
|
|
713
|
-
* @returns {DOMNodeReference} Instance of this
|
|
731
|
+
* @returns {DOMNodeReference} Instance of this
|
|
714
732
|
* @throws {ValidationConfigError} If validation setup fails
|
|
715
733
|
*/
|
|
716
734
|
configureValidationAndRequirements(isRequired, isValid, fieldDisplayName, dependencies) {
|
|
@@ -793,7 +811,7 @@ var DOMNodeReference = class _DOMNodeReference {
|
|
|
793
811
|
*
|
|
794
812
|
* @param {Function | boolean} isRequired - Determines whether the field should be marked as required.
|
|
795
813
|
* If true, the "required-field" class is added to the label; if false, it is removed.
|
|
796
|
-
* @returns - Instance of this
|
|
814
|
+
* @returns - Instance of this [provides option to method chain]
|
|
797
815
|
*/
|
|
798
816
|
setRequiredLevel(isRequired) {
|
|
799
817
|
if (isRequired instanceof Function) {
|
|
@@ -883,7 +901,7 @@ export {
|
|
|
883
901
|
|
|
884
902
|
(function() {
|
|
885
903
|
const style = document.createElement('style');
|
|
886
|
-
style.textContent = "/* src/style.css */\n.info-icon {\n position: relative;\n display: inline-block;\n}\n.info-icon .fa-info-circle {\n cursor: pointer;\n}\n.info-icon .flyout-content {\n max-width: calc(100vw - 20px);\n display: none;\n position: absolute;\n left: 50%;\n transform: translateX(-50%);\n background-color: #f9f9f9;\n padding: 10px;\n border: 1px solid #ddd;\n z-index: 1;\n min-width: 200px;\n box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);\n border-radius: 4px;\n}\n@media (max-width: 600px) {\n .info-icon .flyout-content {\n max-width: 95vw;\n padding: 12px;\n font-size: 0.9em;\n display: block;\n right: auto;\n }\n}\n.required-field::after {\n content: \" *\" !important;\n color: #f00 !important;\n}\n";
|
|
904
|
+
style.textContent = "/* src/style.css */\n.info-icon {\n position: relative;\n display: inline-block;\n}\n.info-icon .fa-info-circle {\n cursor: pointer;\n}\n.info-icon .flyout-content {\n max-width: calc(100vw - 20px);\n display: none;\n position: absolute;\n left: 50%;\n transform: translateX(-50%);\n color: #000;\n background-color: #f9f9f9;\n padding: 10px;\n border: 1px solid #ddd;\n z-index: 1;\n min-width: 200px;\n box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);\n border-radius: 4px;\n}\n@media (max-width: 600px) {\n .info-icon .flyout-content {\n max-width: 95vw;\n padding: 12px;\n font-size: 0.9em;\n display: block;\n right: auto;\n }\n}\n.required-field::after {\n content: \" *\" !important;\n color: #f00 !important;\n}\n";
|
|
887
905
|
document.head.appendChild(style);
|
|
888
906
|
})();
|
|
889
907
|
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {string} titleString The text to display in the tooltip flyout content
|
|
4
|
+
* @param containerStyle Optional CSS styles to apply to the info icon
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
export default function CreateInfoEl(titleString: string, containerStyle?: Partial<CSSStyleDeclaration>): HTMLSpanElement;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "powerpagestoolkit",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.402",
|
|
4
4
|
"description": "Reference, manipulate, and engage with Power Pages sites through the nodes in the DOM; use a variety of custom methods that allow customizing your power pages site quicker and easier. ",
|
|
5
5
|
"main": "./dist/bundle.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -72,8 +72,5 @@
|
|
|
72
72
|
"./style.css": {
|
|
73
73
|
"import": "./dist/bundle.css"
|
|
74
74
|
}
|
|
75
|
-
},
|
|
76
|
-
"dependencies": {
|
|
77
|
-
"powerpagestoolkit": "^2.3.4"
|
|
78
75
|
}
|
|
79
76
|
}
|