wulf.js 1.9.0 → 1.9.1
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 +75 -7
- package/changelog.md +21 -0
- package/dist/focus-trap.cjs.js +430 -0
- package/dist/focus-trap.cjs.js.map +7 -0
- package/dist/focus-trap.esm.js +407 -0
- package/dist/focus-trap.esm.js.map +7 -0
- package/dist/focus-trap.global.js +433 -0
- package/dist/focus-trap.global.js.map +7 -0
- package/dist/focus-trap.global.min.js +6 -0
- package/dist/focus-trap.global.min.js.map +7 -0
- package/dist/index.cjs.js +590 -8
- package/dist/index.cjs.js.map +3 -3
- package/dist/index.esm.js +590 -8
- package/dist/index.esm.js.map +3 -3
- package/dist/index.global.js +590 -8
- package/dist/index.global.js.map +3 -3
- package/dist/index.global.min.js +4 -1
- package/dist/index.global.min.js.map +4 -4
- package/dist/mask.cjs.js +106 -2
- package/dist/mask.cjs.js.map +3 -3
- package/dist/mask.esm.js +106 -2
- package/dist/mask.esm.js.map +3 -3
- package/dist/mask.global.js +106 -2
- package/dist/mask.global.js.map +3 -3
- package/dist/mask.global.min.js +4 -1
- package/dist/mask.global.min.js.map +4 -4
- package/dist/masonry.cjs.js +78 -3
- package/dist/masonry.cjs.js.map +3 -3
- package/dist/masonry.esm.js +78 -3
- package/dist/masonry.esm.js.map +3 -3
- package/dist/masonry.global.js +78 -3
- package/dist/masonry.global.js.map +3 -3
- package/dist/masonry.global.min.js +4 -1
- package/dist/masonry.global.min.js.map +4 -4
- package/dist/scroll.cjs.js +78 -3
- package/dist/scroll.cjs.js.map +3 -3
- package/dist/scroll.esm.js +78 -3
- package/dist/scroll.esm.js.map +3 -3
- package/dist/scroll.global.js +78 -3
- package/dist/scroll.global.js.map +3 -3
- package/dist/scroll.global.min.js +4 -1
- package/dist/scroll.global.min.js.map +4 -4
- package/dist/toast.cjs.js +91 -2
- package/dist/toast.cjs.js.map +3 -3
- package/dist/toast.esm.js +91 -2
- package/dist/toast.esm.js.map +3 -3
- package/dist/toast.global.js +91 -2
- package/dist/toast.global.js.map +3 -3
- package/dist/toast.global.min.js +4 -1
- package/dist/toast.global.min.js.map +4 -4
- package/dist/types/common/AuditableComponent.d.ts +45 -0
- package/dist/types/common/LocalizedComponent.d.ts +3 -2
- package/dist/types/focus-trap/FocusTrap.d.ts +64 -0
- package/dist/types/focus-trap/index.d.ts +3 -0
- package/dist/types/focus-trap/types.d.ts +45 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/mask/BaseInputMask.d.ts +14 -1
- package/dist/types/mask/InputMask.d.ts +1 -0
- package/dist/types/mask/types.d.ts +5 -2
- package/dist/types/masonry/Masonry.d.ts +7 -0
- package/dist/types/masonry/types.d.ts +7 -2
- package/dist/types/scroll/ScrollBlock.d.ts +7 -0
- package/dist/types/scroll/types.d.ts +3 -2
- package/dist/types/toast/Toast.d.ts +3 -0
- package/dist/types/toast/ToastInstance.d.ts +9 -1
- package/dist/types/toast/types.d.ts +3 -2
- package/package.json +9 -3
package/dist/index.esm.js
CHANGED
|
@@ -21,6 +21,49 @@ __export(mask_exports, {
|
|
|
21
21
|
resolveMaskConstructorArgs: () => resolveMaskConstructorArgs
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
+
// src/common/AuditableComponent.ts
|
|
25
|
+
var AuditableComponent = class {
|
|
26
|
+
/**
|
|
27
|
+
* Indication affichée en pied de warning pour expliquer comment désactiver l'audit.
|
|
28
|
+
*/
|
|
29
|
+
getAuditDisableHint() {
|
|
30
|
+
return "Passez { audit: false } dans les options pour d\xE9sactiver cet avertissement";
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Exécute l'audit d'accessibilité et émet un avertissement standardisé dans la console
|
|
34
|
+
* si l'audit est activé et que des contraintes manquent.
|
|
35
|
+
*/
|
|
36
|
+
runAuditWarning(enabled = true) {
|
|
37
|
+
if (!enabled) return [];
|
|
38
|
+
const warnings = this.audit();
|
|
39
|
+
if (warnings.length > 0 && typeof console !== "undefined" && typeof console.warn === "function") {
|
|
40
|
+
console.warn(
|
|
41
|
+
`[${this.getAuditPrefix()}] Audit d'accessibilit\xE9 \u2014 ${warnings.length} contrainte(s) manquante(s) sur ${this.getAuditTargetLabel()} :
|
|
42
|
+
` + warnings.map((w) => ` - ${w}`).join("\n") + `
|
|
43
|
+
(${this.getAuditDisableHint()})`
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
return warnings;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Vérifie si un attribut de référence d'IDs ARIA (ex: aria-labelledby, aria-describedby)
|
|
50
|
+
* pointe vers des éléments réellement présents dans le document.
|
|
51
|
+
*/
|
|
52
|
+
checkAriaIdReferences(element, attrName, warnings) {
|
|
53
|
+
const rawValue = element.getAttribute(attrName)?.trim();
|
|
54
|
+
if (!rawValue) return false;
|
|
55
|
+
const doc = element.ownerDocument || document;
|
|
56
|
+
const ids = rawValue.split(/\s+/).filter(Boolean);
|
|
57
|
+
const isValid = ids.length > 0 && ids.every((id) => Boolean(doc.getElementById(id)));
|
|
58
|
+
if (!isValid) {
|
|
59
|
+
warnings.push(
|
|
60
|
+
`Attribut ${attrName}="${rawValue}" invalide : l'\xE9l\xE9ment cible est introuvable dans le DOM.`
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
return isValid;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
24
67
|
// src/mask/BaseInputMask.ts
|
|
25
68
|
function resolveMaskConstructorArgs(targetOrWrapper, inputOrOptions, maybeOptions) {
|
|
26
69
|
const isSecondArgInput = Boolean(
|
|
@@ -39,8 +82,9 @@ function resolveMaskConstructorArgs(targetOrWrapper, inputOrOptions, maybeOption
|
|
|
39
82
|
options: inputOrOptions && typeof inputOrOptions === "object" && !("tagName" in inputOrOptions) ? inputOrOptions : {}
|
|
40
83
|
};
|
|
41
84
|
}
|
|
42
|
-
var BaseInputMask = class {
|
|
85
|
+
var BaseInputMask = class extends AuditableComponent {
|
|
43
86
|
constructor(targetOrWrapper, inputOrOptions, maybeOptions) {
|
|
87
|
+
super();
|
|
44
88
|
this.ghost = null;
|
|
45
89
|
this.isWrapperCreated = false;
|
|
46
90
|
this.isDestroyed = false;
|
|
@@ -128,8 +172,10 @@ var BaseInputMask = class {
|
|
|
128
172
|
const dataSelectAll = this.getAttr("data-mask-select-on-focus") === "true";
|
|
129
173
|
const dataCopyRaw = this.getAttr("data-mask-copy-raw") === "true";
|
|
130
174
|
const dataAlign = this.getAttr("data-mask-align") || this.getAttr("data-align");
|
|
175
|
+
const dataAudit = this.getAttr("data-mask-audit");
|
|
131
176
|
const { disabled: optDisabled, align: optAlign, ...otherOptions } = options;
|
|
132
177
|
const resolvedDisabled = optDisabled !== void 0 ? optDisabled : dataDisabled ? true : false;
|
|
178
|
+
const resolvedAudit = options.audit ?? (dataAudit !== null ? dataAudit !== "false" : true);
|
|
133
179
|
const isPassword = this.input.type === "password";
|
|
134
180
|
this.options = {
|
|
135
181
|
...otherOptions,
|
|
@@ -139,7 +185,8 @@ var BaseInputMask = class {
|
|
|
139
185
|
copyRaw: isPassword ? false : options.copyRaw ?? dataCopyRaw ?? false,
|
|
140
186
|
disabled: resolvedDisabled,
|
|
141
187
|
align: optAlign ?? (dataAlign || void 0),
|
|
142
|
-
emitNativeInput: options.emitNativeInput ?? true
|
|
188
|
+
emitNativeInput: options.emitNativeInput ?? true,
|
|
189
|
+
audit: resolvedAudit
|
|
143
190
|
};
|
|
144
191
|
if (this.options.showMaskOnFocus) {
|
|
145
192
|
this.wrapper.classList.add("mask-focus-only");
|
|
@@ -484,6 +531,48 @@ var BaseInputMask = class {
|
|
|
484
531
|
getRawValue() {
|
|
485
532
|
return this.input.value;
|
|
486
533
|
}
|
|
534
|
+
/**
|
|
535
|
+
* Vérifie la conformité d'accessibilité WAI-ARIA du champ de saisie (étiquetage, format attendu)
|
|
536
|
+
* et retourne la liste des contraintes manquantes.
|
|
537
|
+
*/
|
|
538
|
+
audit() {
|
|
539
|
+
const warnings = [];
|
|
540
|
+
const doc = this.input.ownerDocument || document;
|
|
541
|
+
const ariaLabel = this.input.getAttribute("aria-label")?.trim();
|
|
542
|
+
const hasValidLabelledby = this.checkAriaIdReferences(this.input, "aria-labelledby", warnings);
|
|
543
|
+
const hasWrappingLabel = Boolean(this.input.closest("label"));
|
|
544
|
+
const hasNativeLabels = Boolean(this.input.labels && this.input.labels.length > 0);
|
|
545
|
+
let hasExplicitLabelFor = false;
|
|
546
|
+
if (this.input.id && typeof CSS !== "undefined" && typeof CSS.escape === "function") {
|
|
547
|
+
hasExplicitLabelFor = Boolean(doc.querySelector(`label[for="${CSS.escape(this.input.id)}"]`));
|
|
548
|
+
} else if (this.input.id) {
|
|
549
|
+
hasExplicitLabelFor = Boolean(doc.querySelector(`label[for="${this.input.id}"]`));
|
|
550
|
+
}
|
|
551
|
+
if (!ariaLabel && !hasValidLabelledby && !hasWrappingLabel && !hasNativeLabels && !hasExplicitLabelFor) {
|
|
552
|
+
warnings.push(
|
|
553
|
+
`\xC9tiquetage accessible manquant : associez un <label for="id"> (ou d\xE9finissez aria-label / aria-labelledby) sur l'input (WCAG 4.1.2).`
|
|
554
|
+
);
|
|
555
|
+
}
|
|
556
|
+
this.checkAriaIdReferences(this.input, "aria-describedby", warnings);
|
|
557
|
+
const extraWarnings = this.getSpecificAuditWarnings();
|
|
558
|
+
warnings.push(...extraWarnings);
|
|
559
|
+
return warnings;
|
|
560
|
+
}
|
|
561
|
+
getAuditPrefix() {
|
|
562
|
+
return `Wulf.Mask.${this.constructor.name || "InputMask"}`;
|
|
563
|
+
}
|
|
564
|
+
getAuditTargetLabel() {
|
|
565
|
+
return this.input.id ? `#${this.input.id}` : this.input.name ? `input[name="${this.input.name}"]` : "<input>";
|
|
566
|
+
}
|
|
567
|
+
getAuditDisableHint() {
|
|
568
|
+
return 'Passez { audit: false } ou data-mask-audit="false" pour d\xE9sactiver cet avertissement';
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Crochet permettant aux classes filles d'ajouter des vérifications d'audit spécifiques.
|
|
572
|
+
*/
|
|
573
|
+
getSpecificAuditWarnings() {
|
|
574
|
+
return [];
|
|
575
|
+
}
|
|
487
576
|
/**
|
|
488
577
|
* Supprime les éléments fantômes, restaure les propriétés et nettoie les attributs.
|
|
489
578
|
*/
|
|
@@ -1278,6 +1367,19 @@ var InputMask = class extends BaseInputMask {
|
|
|
1278
1367
|
this.bindEvents();
|
|
1279
1368
|
this.lastValue = this.input.value;
|
|
1280
1369
|
this.syncInitialValue();
|
|
1370
|
+
this.runAuditWarning(this.options.audit);
|
|
1371
|
+
}
|
|
1372
|
+
getSpecificAuditWarnings() {
|
|
1373
|
+
const warnings = [];
|
|
1374
|
+
const hasDescribedby = Boolean(this.input.getAttribute("aria-describedby")?.trim());
|
|
1375
|
+
const hasPlaceholder = Boolean(this.input.getAttribute("placeholder")?.trim());
|
|
1376
|
+
const hasAriaPlaceholder = Boolean(this.input.getAttribute("aria-placeholder")?.trim());
|
|
1377
|
+
if (!hasDescribedby && !hasPlaceholder && !hasAriaPlaceholder && !this.options.disabled) {
|
|
1378
|
+
warnings.push(
|
|
1379
|
+
"Indication du format attendu manquante : d\xE9finissez aria-describedby, placeholder ou aria-placeholder pour informer les technologies d'assistance (WCAG 3.3.2)."
|
|
1380
|
+
);
|
|
1381
|
+
}
|
|
1382
|
+
return warnings;
|
|
1281
1383
|
}
|
|
1282
1384
|
extractRawSnippet(snippet) {
|
|
1283
1385
|
return this.engine.extractRaw(snippet);
|
|
@@ -2127,6 +2229,7 @@ var InputAmountMask = class extends BaseInputMask {
|
|
|
2127
2229
|
isValid: true
|
|
2128
2230
|
});
|
|
2129
2231
|
}
|
|
2232
|
+
this.runAuditWarning(this.options.audit);
|
|
2130
2233
|
}
|
|
2131
2234
|
extractRawSnippet(snippet) {
|
|
2132
2235
|
const p = this.engine.parse(snippet);
|
|
@@ -2709,6 +2812,7 @@ var InputEmailMask = class extends BaseInputMask {
|
|
|
2709
2812
|
if (!this.options.disabled) {
|
|
2710
2813
|
this.updateSuggestion();
|
|
2711
2814
|
}
|
|
2815
|
+
this.runAuditWarning(this.options.audit);
|
|
2712
2816
|
}
|
|
2713
2817
|
onNativeValueSet(_strVal) {
|
|
2714
2818
|
if (this.options.disabled) return;
|
|
@@ -2980,7 +3084,7 @@ __export(scroll_exports, {
|
|
|
2980
3084
|
});
|
|
2981
3085
|
|
|
2982
3086
|
// src/common/LocalizedComponent.ts
|
|
2983
|
-
var LocalizedComponent = class {
|
|
3087
|
+
var LocalizedComponent = class extends AuditableComponent {
|
|
2984
3088
|
/**
|
|
2985
3089
|
* Définit la langue globale du composant (ex: 'fr', 'en', 'es').
|
|
2986
3090
|
*/
|
|
@@ -3032,6 +3136,7 @@ var LocalizedComponent = class {
|
|
|
3032
3136
|
return this._i18n ? this._i18n.t(key, instanceOverride) : String(key);
|
|
3033
3137
|
}
|
|
3034
3138
|
constructor(i18nOverrides) {
|
|
3139
|
+
super();
|
|
3035
3140
|
this.i18nOverrides = i18nOverrides;
|
|
3036
3141
|
}
|
|
3037
3142
|
/**
|
|
@@ -3181,7 +3286,7 @@ var ScrollBlock = class extends LocalizedComponent {
|
|
|
3181
3286
|
throw new Error(`[ScrollBlock] \xC9l\xE9ment introuvable : "${element}".`);
|
|
3182
3287
|
}
|
|
3183
3288
|
this.root = resolvedElement;
|
|
3184
|
-
this.hasExplicitAriaLabel = Boolean(options?.ariaLabel);
|
|
3289
|
+
this.hasExplicitAriaLabel = Boolean(options?.ariaLabel || options?.i18n?.viewport);
|
|
3185
3290
|
this.options = {
|
|
3186
3291
|
axis: options?.axis || "y",
|
|
3187
3292
|
autoHide: options?.autoHide ?? true,
|
|
@@ -3196,7 +3301,8 @@ var ScrollBlock = class extends LocalizedComponent {
|
|
|
3196
3301
|
onTotalScroll: options?.onTotalScroll || (() => {
|
|
3197
3302
|
}),
|
|
3198
3303
|
onTotalScrollBack: options?.onTotalScrollBack || (() => {
|
|
3199
|
-
})
|
|
3304
|
+
}),
|
|
3305
|
+
audit: options?.audit ?? true
|
|
3200
3306
|
};
|
|
3201
3307
|
this.boundOnScroll = this.handleScroll.bind(this);
|
|
3202
3308
|
this.boundOnMouseEnter = this.handleMouseEnter.bind(this);
|
|
@@ -3211,6 +3317,7 @@ var ScrollBlock = class extends LocalizedComponent {
|
|
|
3211
3317
|
this.setupEventListeners();
|
|
3212
3318
|
this.setupObserver();
|
|
3213
3319
|
this.update();
|
|
3320
|
+
this.runAuditWarning(this.options.audit);
|
|
3214
3321
|
}
|
|
3215
3322
|
/**
|
|
3216
3323
|
* Prépare le viewport défilant sans altérer les éléments enfants.
|
|
@@ -3631,6 +3738,35 @@ var ScrollBlock = class extends LocalizedComponent {
|
|
|
3631
3738
|
behavior
|
|
3632
3739
|
});
|
|
3633
3740
|
}
|
|
3741
|
+
/**
|
|
3742
|
+
* Vérifie la conformité d'accessibilité WAI-ARIA de la zone défilable
|
|
3743
|
+
* et retourne la liste des contraintes manquantes.
|
|
3744
|
+
*/
|
|
3745
|
+
audit() {
|
|
3746
|
+
const warnings = [];
|
|
3747
|
+
const hasViewportLabelledby = this.checkAriaIdReferences(this.viewport, "aria-labelledby", warnings);
|
|
3748
|
+
const hasRootLabelledby = this.checkAriaIdReferences(this.root, "aria-labelledby", warnings);
|
|
3749
|
+
const hasValidLabelledby = hasViewportLabelledby || hasRootLabelledby;
|
|
3750
|
+
const rootAriaLabel = this.root.getAttribute("aria-label")?.trim();
|
|
3751
|
+
const hasCustomViewportAriaLabel = !this.wasAriaLabelInferred && Boolean(this.viewport.getAttribute("aria-label")?.trim());
|
|
3752
|
+
if (!this.hasExplicitAriaLabel && !hasCustomViewportAriaLabel && !rootAriaLabel && !hasValidLabelledby) {
|
|
3753
|
+
warnings.push(
|
|
3754
|
+
"Libell\xE9 contextuel manquant : d\xE9finissez l'option ariaLabel (ou un attribut aria-label / aria-labelledby sur le conteneur) pour d\xE9crire la zone d\xE9filable (WCAG 4.1.2)."
|
|
3755
|
+
);
|
|
3756
|
+
}
|
|
3757
|
+
if (this.options.minThumbSize < 24) {
|
|
3758
|
+
warnings.push(
|
|
3759
|
+
`Taille minimale du curseur insuffisante (minThumbSize: ${this.options.minThumbSize}px) : utilisez au moins 24px pour respecter WCAG 2.5.8.`
|
|
3760
|
+
);
|
|
3761
|
+
}
|
|
3762
|
+
return warnings;
|
|
3763
|
+
}
|
|
3764
|
+
getAuditPrefix() {
|
|
3765
|
+
return "Wulf.Scroll";
|
|
3766
|
+
}
|
|
3767
|
+
getAuditTargetLabel() {
|
|
3768
|
+
return this.root.id ? `#${this.root.id}` : `<${this.root.tagName.toLowerCase()}.wulf-scrollblock>`;
|
|
3769
|
+
}
|
|
3634
3770
|
/**
|
|
3635
3771
|
* Détruit le composant et libère toutes les ressources.
|
|
3636
3772
|
*/
|
|
@@ -3941,7 +4077,7 @@ var Masonry = class extends LocalizedComponent {
|
|
|
3941
4077
|
height: this.root.style.height,
|
|
3942
4078
|
width: this.root.style.width
|
|
3943
4079
|
};
|
|
3944
|
-
this.hasExplicitAriaLabel = Boolean(options.ariaLabel);
|
|
4080
|
+
this.hasExplicitAriaLabel = Boolean(options.ariaLabel || options.i18n?.gallery);
|
|
3945
4081
|
this.options = {
|
|
3946
4082
|
itemSelector: options.itemSelector || "> *",
|
|
3947
4083
|
columnWidth: options.columnWidth ?? 0,
|
|
@@ -3960,7 +4096,8 @@ var Masonry = class extends LocalizedComponent {
|
|
|
3960
4096
|
onLayout: options.onLayout || (() => {
|
|
3961
4097
|
}),
|
|
3962
4098
|
onItemPlaced: options.onItemPlaced || (() => {
|
|
3963
|
-
})
|
|
4099
|
+
}),
|
|
4100
|
+
audit: options.audit ?? true
|
|
3964
4101
|
};
|
|
3965
4102
|
const supportsNativeCSS = typeof CSS !== "undefined" && typeof CSS.supports === "function" && CSS.supports("grid-template-rows", "masonry");
|
|
3966
4103
|
if (this.options.useNativeCSSGrid && supportsNativeCSS) {
|
|
@@ -3975,6 +4112,7 @@ var Masonry = class extends LocalizedComponent {
|
|
|
3975
4112
|
this.initObservers();
|
|
3976
4113
|
this.initImages();
|
|
3977
4114
|
this.layout();
|
|
4115
|
+
this.runAuditWarning(this.options.audit);
|
|
3978
4116
|
}
|
|
3979
4117
|
get items() {
|
|
3980
4118
|
return [...this._items];
|
|
@@ -4227,6 +4365,35 @@ var Masonry = class extends LocalizedComponent {
|
|
|
4227
4365
|
}, dur);
|
|
4228
4366
|
this.removeTimers.add(timerId);
|
|
4229
4367
|
}
|
|
4368
|
+
/**
|
|
4369
|
+
* Vérifie la conformité d'accessibilité WAI-ARIA de la grille Masonry
|
|
4370
|
+
* et retourne la liste des contraintes manquantes.
|
|
4371
|
+
*/
|
|
4372
|
+
audit() {
|
|
4373
|
+
const warnings = [];
|
|
4374
|
+
const hasValidLabelledby = this.checkAriaIdReferences(this.root, "aria-labelledby", warnings);
|
|
4375
|
+
const hasCustomRootAriaLabel = !this.wasAriaLabelInferred && Boolean(this.root.getAttribute("aria-label")?.trim());
|
|
4376
|
+
if (!this.hasExplicitAriaLabel && !hasCustomRootAriaLabel && !hasValidLabelledby) {
|
|
4377
|
+
warnings.push(
|
|
4378
|
+
"Libell\xE9 contextuel manquant : d\xE9finissez l'option ariaLabel (ou un attribut aria-label / aria-labelledby sur le conteneur) pour qualifier la grille (WCAG 4.1.2)."
|
|
4379
|
+
);
|
|
4380
|
+
}
|
|
4381
|
+
const imagesWithoutAlt = Array.from(this.root.querySelectorAll("img")).filter(
|
|
4382
|
+
(img) => !img.hasAttribute("alt") && img.getAttribute("aria-hidden") !== "true"
|
|
4383
|
+
);
|
|
4384
|
+
if (imagesWithoutAlt.length > 0) {
|
|
4385
|
+
warnings.push(
|
|
4386
|
+
`${imagesWithoutAlt.length} image(s) <img> d\xE9pourvue(s) d'attribut alt : renseignez alt="description" (ou alt="" si d\xE9corative) (WCAG 1.1.1).`
|
|
4387
|
+
);
|
|
4388
|
+
}
|
|
4389
|
+
return warnings;
|
|
4390
|
+
}
|
|
4391
|
+
getAuditPrefix() {
|
|
4392
|
+
return "Wulf.Masonry";
|
|
4393
|
+
}
|
|
4394
|
+
getAuditTargetLabel() {
|
|
4395
|
+
return this.root.id ? `#${this.root.id}` : `<${this.root.tagName.toLowerCase()}.wulf-masonry>`;
|
|
4396
|
+
}
|
|
4230
4397
|
/**
|
|
4231
4398
|
* Libère les ressources, déconnecte les observateurs et nettoie les styles injectés.
|
|
4232
4399
|
*/
|
|
@@ -4330,8 +4497,9 @@ var toastI18n = createI18nManager("fr", {
|
|
|
4330
4497
|
|
|
4331
4498
|
// src/toast/ToastInstance.ts
|
|
4332
4499
|
var nextToastId = 1;
|
|
4333
|
-
var ToastInstance = class {
|
|
4500
|
+
var ToastInstance = class extends AuditableComponent {
|
|
4334
4501
|
constructor(options, onDismiss) {
|
|
4502
|
+
super();
|
|
4335
4503
|
this._isClosed = false;
|
|
4336
4504
|
this.timerId = null;
|
|
4337
4505
|
this.remainingTime = 0;
|
|
@@ -4348,10 +4516,45 @@ var ToastInstance = class {
|
|
|
4348
4516
|
}
|
|
4349
4517
|
this.element = this.createDOM();
|
|
4350
4518
|
this.bindEvents();
|
|
4519
|
+
this.runAuditWarning(options.audit !== false);
|
|
4351
4520
|
}
|
|
4352
4521
|
get isClosed() {
|
|
4353
4522
|
return this._isClosed;
|
|
4354
4523
|
}
|
|
4524
|
+
/**
|
|
4525
|
+
* Vérifie la conformité d'accessibilité WAI-ARIA de la notification Toast
|
|
4526
|
+
* et retourne la liste des contraintes manquantes.
|
|
4527
|
+
*/
|
|
4528
|
+
audit() {
|
|
4529
|
+
const warnings = [];
|
|
4530
|
+
const hasTitle = Boolean(this.options.title && this.options.title.trim().length > 0);
|
|
4531
|
+
const hasMessage = Boolean(this.options.message && this.options.message.trim().length > 0);
|
|
4532
|
+
if (!hasTitle && !hasMessage) {
|
|
4533
|
+
warnings.push(
|
|
4534
|
+
"Contenu textuel vide : d\xE9finissez au moins un title ou un message pour que le lecteur d'\xE9cran puisse annoncer la notification (WCAG 4.1.3)."
|
|
4535
|
+
);
|
|
4536
|
+
}
|
|
4537
|
+
const duration = this.options.duration === void 0 ? 4e3 : this.options.duration;
|
|
4538
|
+
if (typeof duration === "number" && duration > 0 && duration < 5e3) {
|
|
4539
|
+
warnings.push(
|
|
4540
|
+
`Dur\xE9e d'affichage trop courte (duration: ${duration}ms) : pr\xE9voyez au moins 5000ms ou duration: false pour laisser le temps de lecture aux utilisateurs (WCAG 2.2.1).`
|
|
4541
|
+
);
|
|
4542
|
+
}
|
|
4543
|
+
const closable = this.options.closable ?? true;
|
|
4544
|
+
const isPersistent = duration === false || typeof duration === "number" && duration <= 0;
|
|
4545
|
+
if (isPersistent && !closable && !this.options.closeOnClick) {
|
|
4546
|
+
warnings.push(
|
|
4547
|
+
"Notification persistante impossible \xE0 fermer : activez closable: true ou closeOnClick: true lorsque duration est d\xE9sactiv\xE9 (WCAG 2.1.1)."
|
|
4548
|
+
);
|
|
4549
|
+
}
|
|
4550
|
+
return warnings;
|
|
4551
|
+
}
|
|
4552
|
+
getAuditPrefix() {
|
|
4553
|
+
return "Wulf.Toast";
|
|
4554
|
+
}
|
|
4555
|
+
getAuditTargetLabel() {
|
|
4556
|
+
return `#${this.id}`;
|
|
4557
|
+
}
|
|
4355
4558
|
/**
|
|
4356
4559
|
* Construction du DOM de manière 100% sécurisée sans aucun `innerHTML`.
|
|
4357
4560
|
*/
|
|
@@ -4712,6 +4915,15 @@ var ToastManager = _ToastManager;
|
|
|
4712
4915
|
|
|
4713
4916
|
// src/toast/Toast.ts
|
|
4714
4917
|
var Toast = class extends LocalizedComponent {
|
|
4918
|
+
audit() {
|
|
4919
|
+
return [];
|
|
4920
|
+
}
|
|
4921
|
+
getAuditPrefix() {
|
|
4922
|
+
return "Wulf.Toast";
|
|
4923
|
+
}
|
|
4924
|
+
getAuditTargetLabel() {
|
|
4925
|
+
return "Toast";
|
|
4926
|
+
}
|
|
4715
4927
|
/**
|
|
4716
4928
|
* Affiche une nouvelle notification Toast avec les options spécifiées.
|
|
4717
4929
|
*/
|
|
@@ -4744,10 +4956,379 @@ if (typeof window !== "undefined") {
|
|
|
4744
4956
|
i18n: toastI18n
|
|
4745
4957
|
});
|
|
4746
4958
|
}
|
|
4959
|
+
|
|
4960
|
+
// src/focus-trap/index.ts
|
|
4961
|
+
var focus_trap_exports = {};
|
|
4962
|
+
__export(focus_trap_exports, {
|
|
4963
|
+
FocusTrap: () => FocusTrap,
|
|
4964
|
+
default: () => FocusTrap
|
|
4965
|
+
});
|
|
4966
|
+
|
|
4967
|
+
// src/focus-trap/FocusTrap.ts
|
|
4968
|
+
var FOCUSABLE_SELECTOR = [
|
|
4969
|
+
"a[href]",
|
|
4970
|
+
"area[href]",
|
|
4971
|
+
"input:not([disabled])",
|
|
4972
|
+
"select:not([disabled])",
|
|
4973
|
+
"textarea:not([disabled])",
|
|
4974
|
+
"button:not([disabled])",
|
|
4975
|
+
"iframe",
|
|
4976
|
+
"object",
|
|
4977
|
+
"embed",
|
|
4978
|
+
'[contenteditable="true"]',
|
|
4979
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
4980
|
+
].join(",");
|
|
4981
|
+
var trapStack = [];
|
|
4982
|
+
var FocusTrap = class extends AuditableComponent {
|
|
4983
|
+
constructor(target, options = {}) {
|
|
4984
|
+
super();
|
|
4985
|
+
this.active = false;
|
|
4986
|
+
this.paused = false;
|
|
4987
|
+
this.previousActiveElement = null;
|
|
4988
|
+
this.inertSiblings = [];
|
|
4989
|
+
// Sentinelles anti-fuite de focus
|
|
4990
|
+
this.startSentinel = null;
|
|
4991
|
+
this.endSentinel = null;
|
|
4992
|
+
const el = typeof target === "string" ? document.querySelector(target) : target;
|
|
4993
|
+
if (!el || !(el instanceof HTMLElement)) {
|
|
4994
|
+
throw new Error(`[Wulf.FocusTrap] Conteneur introuvable ou invalide : "${target}"`);
|
|
4995
|
+
}
|
|
4996
|
+
this.element = el;
|
|
4997
|
+
this.options = {
|
|
4998
|
+
initialFocus: options.initialFocus !== void 0 ? options.initialFocus : "[data-autofocus], [autofocus]",
|
|
4999
|
+
returnFocus: options.returnFocus ?? true,
|
|
5000
|
+
fallbackReturnFocus: options.fallbackReturnFocus ?? "",
|
|
5001
|
+
escapeDeactivates: options.escapeDeactivates ?? true,
|
|
5002
|
+
allowOutsideClick: options.allowOutsideClick ?? false,
|
|
5003
|
+
setInert: options.setInert ?? false,
|
|
5004
|
+
onActivate: options.onActivate ?? (() => {
|
|
5005
|
+
}),
|
|
5006
|
+
onDeactivate: options.onDeactivate ?? (() => {
|
|
5007
|
+
}),
|
|
5008
|
+
audit: options.audit ?? true
|
|
5009
|
+
};
|
|
5010
|
+
this.handleKeyDownBound = this.handleKeyDown.bind(this);
|
|
5011
|
+
this.handleClickOutsideBound = this.handleClickOutside.bind(this);
|
|
5012
|
+
this.handleFocusInBound = this.handleFocusIn.bind(this);
|
|
5013
|
+
this.runAuditWarning(this.options.audit);
|
|
5014
|
+
}
|
|
5015
|
+
/**
|
|
5016
|
+
* Vérifie si un élément est réellement focusable, visible et actif dans le DOM.
|
|
5017
|
+
*/
|
|
5018
|
+
isFocusable(el) {
|
|
5019
|
+
if (!el || !el.isConnected) return false;
|
|
5020
|
+
if (el.disabled) return false;
|
|
5021
|
+
if (el.closest("fieldset[disabled]") && !el.closest("legend")) return false;
|
|
5022
|
+
if (el.hasAttribute("inert") || el.closest("[inert]")) return false;
|
|
5023
|
+
if (el.hidden || el.closest("[hidden]")) return false;
|
|
5024
|
+
if (el.style.display === "none" || el.style.visibility === "hidden") return false;
|
|
5025
|
+
const style = window.getComputedStyle(el);
|
|
5026
|
+
if (style.display === "none" || style.visibility === "hidden") return false;
|
|
5027
|
+
if (el.offsetWidth === 0 && el.offsetHeight === 0 && style.position !== "fixed") {
|
|
5028
|
+
return false;
|
|
5029
|
+
}
|
|
5030
|
+
if (el instanceof HTMLInputElement && el.type === "radio" && el.name) {
|
|
5031
|
+
const group = Array.from(
|
|
5032
|
+
this.element.querySelectorAll(`input[type="radio"][name="${CSS.escape(el.name)}"]`)
|
|
5033
|
+
);
|
|
5034
|
+
const checked = group.find((r) => r.checked);
|
|
5035
|
+
if (checked) {
|
|
5036
|
+
return el === checked;
|
|
5037
|
+
}
|
|
5038
|
+
return el === group[0];
|
|
5039
|
+
}
|
|
5040
|
+
return true;
|
|
5041
|
+
}
|
|
5042
|
+
/**
|
|
5043
|
+
* Retourne tous les éléments focusables réels ordonnés dans le conteneur.
|
|
5044
|
+
*/
|
|
5045
|
+
getFocusableElements() {
|
|
5046
|
+
const rawElements = Array.from(this.element.querySelectorAll(FOCUSABLE_SELECTOR));
|
|
5047
|
+
return rawElements.filter((el) => this.isFocusable(el));
|
|
5048
|
+
}
|
|
5049
|
+
/**
|
|
5050
|
+
* Active le trap.
|
|
5051
|
+
*/
|
|
5052
|
+
activate() {
|
|
5053
|
+
if (this.active) return this;
|
|
5054
|
+
const currentTop = trapStack[trapStack.length - 1];
|
|
5055
|
+
if (currentTop) {
|
|
5056
|
+
currentTop.pause();
|
|
5057
|
+
}
|
|
5058
|
+
this.active = true;
|
|
5059
|
+
this.paused = false;
|
|
5060
|
+
trapStack.push(this);
|
|
5061
|
+
this.previousActiveElement = document.activeElement;
|
|
5062
|
+
this.setupSentinels();
|
|
5063
|
+
if (this.options.setInert) {
|
|
5064
|
+
this.applyInert();
|
|
5065
|
+
}
|
|
5066
|
+
document.addEventListener("keydown", this.handleKeyDownBound, true);
|
|
5067
|
+
document.addEventListener("focusin", this.handleFocusInBound, true);
|
|
5068
|
+
if (!this.options.allowOutsideClick) {
|
|
5069
|
+
document.addEventListener("mousedown", this.handleClickOutsideBound, true);
|
|
5070
|
+
document.addEventListener("touchstart", this.handleClickOutsideBound, true);
|
|
5071
|
+
}
|
|
5072
|
+
this.applyInitialFocus();
|
|
5073
|
+
this.runAuditWarning(this.options.audit);
|
|
5074
|
+
this.options.onActivate();
|
|
5075
|
+
return this;
|
|
5076
|
+
}
|
|
5077
|
+
/**
|
|
5078
|
+
* Désactive le trap et libère les écouteurs.
|
|
5079
|
+
*/
|
|
5080
|
+
deactivate() {
|
|
5081
|
+
if (!this.active) return this;
|
|
5082
|
+
this.active = false;
|
|
5083
|
+
this.paused = false;
|
|
5084
|
+
const index = trapStack.indexOf(this);
|
|
5085
|
+
if (index !== -1) {
|
|
5086
|
+
trapStack.splice(index, 1);
|
|
5087
|
+
}
|
|
5088
|
+
const nextTop = trapStack[trapStack.length - 1];
|
|
5089
|
+
if (nextTop) {
|
|
5090
|
+
nextTop.unpause();
|
|
5091
|
+
}
|
|
5092
|
+
document.removeEventListener("keydown", this.handleKeyDownBound, true);
|
|
5093
|
+
document.removeEventListener("focusin", this.handleFocusInBound, true);
|
|
5094
|
+
document.removeEventListener("mousedown", this.handleClickOutsideBound, true);
|
|
5095
|
+
document.removeEventListener("touchstart", this.handleClickOutsideBound, true);
|
|
5096
|
+
this.removeSentinels();
|
|
5097
|
+
this.removeInert();
|
|
5098
|
+
if (this.options.returnFocus) {
|
|
5099
|
+
this.restoreFocus();
|
|
5100
|
+
}
|
|
5101
|
+
this.options.onDeactivate();
|
|
5102
|
+
return this;
|
|
5103
|
+
}
|
|
5104
|
+
/**
|
|
5105
|
+
* Met en pause le trap (utilisé quand un trap fils s'ouvre au-dessus).
|
|
5106
|
+
*/
|
|
5107
|
+
pause() {
|
|
5108
|
+
this.paused = true;
|
|
5109
|
+
}
|
|
5110
|
+
/**
|
|
5111
|
+
* Sort de pause.
|
|
5112
|
+
*/
|
|
5113
|
+
unpause() {
|
|
5114
|
+
this.paused = false;
|
|
5115
|
+
}
|
|
5116
|
+
/**
|
|
5117
|
+
* Indique si le trap est actuellement actif et non en pause.
|
|
5118
|
+
*/
|
|
5119
|
+
isActive() {
|
|
5120
|
+
return this.active && !this.paused;
|
|
5121
|
+
}
|
|
5122
|
+
/**
|
|
5123
|
+
* Vérifie la conformité d'accessibilité WAI-ARIA du conteneur FocusTrap
|
|
5124
|
+
* et retourne la liste des contraintes manquantes.
|
|
5125
|
+
*/
|
|
5126
|
+
audit() {
|
|
5127
|
+
const warnings = [];
|
|
5128
|
+
const role = this.element.getAttribute("role");
|
|
5129
|
+
const isNativeDialog = this.element.tagName.toLowerCase() === "dialog";
|
|
5130
|
+
const validRoles = ["dialog", "alertdialog", "menu", "listbox", "tree", "grid"];
|
|
5131
|
+
if (!isNativeDialog && (!role || !validRoles.includes(role))) {
|
|
5132
|
+
warnings.push(
|
|
5133
|
+
'R\xF4le s\xE9mantique manquant ou inadapt\xE9 : d\xE9finissez role="dialog" (ou "alertdialog", "menu", "listbox") sur le conteneur.'
|
|
5134
|
+
);
|
|
5135
|
+
}
|
|
5136
|
+
if ((isNativeDialog || role === "dialog" || role === "alertdialog") && this.element.getAttribute("aria-modal") !== "true") {
|
|
5137
|
+
warnings.push(
|
|
5138
|
+
'Isolation modale manquante : d\xE9finissez aria-modal="true" sur le conteneur de dialogue (WCAG 4.1.2).'
|
|
5139
|
+
);
|
|
5140
|
+
}
|
|
5141
|
+
const ariaLabel = this.element.getAttribute("aria-label")?.trim();
|
|
5142
|
+
const hasValidLabelledby = this.checkAriaIdReferences(this.element, "aria-labelledby", warnings);
|
|
5143
|
+
if (!ariaLabel && !hasValidLabelledby) {
|
|
5144
|
+
warnings.push(
|
|
5145
|
+
'Nom accessible manquant : d\xE9finissez aria-labelledby="id-titre" ou aria-label="..." sur le conteneur (WCAG 4.1.2).'
|
|
5146
|
+
);
|
|
5147
|
+
}
|
|
5148
|
+
return warnings;
|
|
5149
|
+
}
|
|
5150
|
+
getAuditPrefix() {
|
|
5151
|
+
return "Wulf.FocusTrap";
|
|
5152
|
+
}
|
|
5153
|
+
getAuditTargetLabel() {
|
|
5154
|
+
return this.element.id ? `#${this.element.id}` : `<${this.element.tagName.toLowerCase()}>`;
|
|
5155
|
+
}
|
|
5156
|
+
/**
|
|
5157
|
+
* Détruit l'instance proprement.
|
|
5158
|
+
*/
|
|
5159
|
+
destroy() {
|
|
5160
|
+
this.deactivate();
|
|
5161
|
+
}
|
|
5162
|
+
// --- Implémentation interne ---
|
|
5163
|
+
handleKeyDown(e) {
|
|
5164
|
+
if (!this.isActive()) return;
|
|
5165
|
+
if (e.key === "Escape" && this.options.escapeDeactivates) {
|
|
5166
|
+
e.preventDefault();
|
|
5167
|
+
e.stopPropagation();
|
|
5168
|
+
this.deactivate();
|
|
5169
|
+
return;
|
|
5170
|
+
}
|
|
5171
|
+
if (e.key !== "Tab") return;
|
|
5172
|
+
const focusables = this.getFocusableElements();
|
|
5173
|
+
if (focusables.length === 0) {
|
|
5174
|
+
e.preventDefault();
|
|
5175
|
+
if (this.element.getAttribute("tabindex") === null) {
|
|
5176
|
+
this.element.setAttribute("tabindex", "-1");
|
|
5177
|
+
}
|
|
5178
|
+
this.element.focus();
|
|
5179
|
+
return;
|
|
5180
|
+
}
|
|
5181
|
+
const first = focusables[0];
|
|
5182
|
+
const last = focusables[focusables.length - 1];
|
|
5183
|
+
const current = document.activeElement;
|
|
5184
|
+
if (!e.shiftKey && (current === last || !this.element.contains(current))) {
|
|
5185
|
+
e.preventDefault();
|
|
5186
|
+
first.focus();
|
|
5187
|
+
} else if (e.shiftKey && (current === first || !this.element.contains(current))) {
|
|
5188
|
+
e.preventDefault();
|
|
5189
|
+
last.focus();
|
|
5190
|
+
}
|
|
5191
|
+
}
|
|
5192
|
+
handleFocusIn(e) {
|
|
5193
|
+
if (!this.isActive()) return;
|
|
5194
|
+
const target = e.target;
|
|
5195
|
+
if (!target) return;
|
|
5196
|
+
if (target === this.startSentinel) {
|
|
5197
|
+
const focusables = this.getFocusableElements();
|
|
5198
|
+
if (focusables.length > 0) {
|
|
5199
|
+
focusables[focusables.length - 1].focus();
|
|
5200
|
+
} else {
|
|
5201
|
+
this.element.focus();
|
|
5202
|
+
}
|
|
5203
|
+
return;
|
|
5204
|
+
}
|
|
5205
|
+
if (target === this.endSentinel) {
|
|
5206
|
+
const focusables = this.getFocusableElements();
|
|
5207
|
+
if (focusables.length > 0) {
|
|
5208
|
+
focusables[0].focus();
|
|
5209
|
+
} else {
|
|
5210
|
+
this.element.focus();
|
|
5211
|
+
}
|
|
5212
|
+
return;
|
|
5213
|
+
}
|
|
5214
|
+
if (!this.element.contains(target)) {
|
|
5215
|
+
const focusables = this.getFocusableElements();
|
|
5216
|
+
if (focusables.length > 0) {
|
|
5217
|
+
focusables[0].focus();
|
|
5218
|
+
} else {
|
|
5219
|
+
if (this.element.getAttribute("tabindex") === null) {
|
|
5220
|
+
this.element.setAttribute("tabindex", "-1");
|
|
5221
|
+
}
|
|
5222
|
+
this.element.focus();
|
|
5223
|
+
}
|
|
5224
|
+
}
|
|
5225
|
+
}
|
|
5226
|
+
handleClickOutside(e) {
|
|
5227
|
+
if (!this.isActive()) return;
|
|
5228
|
+
const target = e.target;
|
|
5229
|
+
if (target && !this.element.contains(target)) {
|
|
5230
|
+
e.preventDefault();
|
|
5231
|
+
e.stopPropagation();
|
|
5232
|
+
}
|
|
5233
|
+
}
|
|
5234
|
+
setupSentinels() {
|
|
5235
|
+
if (!this.startSentinel) {
|
|
5236
|
+
this.startSentinel = document.createElement("span");
|
|
5237
|
+
this.startSentinel.setAttribute("tabindex", "0");
|
|
5238
|
+
this.startSentinel.setAttribute("aria-hidden", "true");
|
|
5239
|
+
this.startSentinel.className = "wulf-sentinel-start";
|
|
5240
|
+
this.startSentinel.style.cssText = "position:fixed;top:0;left:0;opacity:0;pointer-events:none;width:0;height:0;";
|
|
5241
|
+
}
|
|
5242
|
+
if (!this.endSentinel) {
|
|
5243
|
+
this.endSentinel = document.createElement("span");
|
|
5244
|
+
this.endSentinel.setAttribute("tabindex", "0");
|
|
5245
|
+
this.endSentinel.setAttribute("aria-hidden", "true");
|
|
5246
|
+
this.endSentinel.className = "wulf-sentinel-end";
|
|
5247
|
+
this.endSentinel.style.cssText = "position:fixed;top:0;left:0;opacity:0;pointer-events:none;width:0;height:0;";
|
|
5248
|
+
}
|
|
5249
|
+
if (this.element.parentNode) {
|
|
5250
|
+
this.element.parentNode.insertBefore(this.startSentinel, this.element);
|
|
5251
|
+
this.element.parentNode.insertBefore(this.endSentinel, this.element.nextSibling);
|
|
5252
|
+
}
|
|
5253
|
+
}
|
|
5254
|
+
removeSentinels() {
|
|
5255
|
+
this.startSentinel?.remove();
|
|
5256
|
+
this.endSentinel?.remove();
|
|
5257
|
+
this.startSentinel = null;
|
|
5258
|
+
this.endSentinel = null;
|
|
5259
|
+
}
|
|
5260
|
+
applyInert() {
|
|
5261
|
+
this.inertSiblings = [];
|
|
5262
|
+
let parent = this.element.parentElement;
|
|
5263
|
+
let currentChild = this.element;
|
|
5264
|
+
while (parent && parent !== document.body) {
|
|
5265
|
+
currentChild = parent;
|
|
5266
|
+
parent = parent.parentElement;
|
|
5267
|
+
}
|
|
5268
|
+
if (parent === document.body) {
|
|
5269
|
+
Array.from(document.body.children).forEach((child) => {
|
|
5270
|
+
if (child instanceof HTMLElement && child !== currentChild && child !== this.startSentinel && child !== this.endSentinel && !child.hasAttribute("inert")) {
|
|
5271
|
+
child.setAttribute("inert", "");
|
|
5272
|
+
this.inertSiblings.push(child);
|
|
5273
|
+
}
|
|
5274
|
+
});
|
|
5275
|
+
}
|
|
5276
|
+
}
|
|
5277
|
+
removeInert() {
|
|
5278
|
+
this.inertSiblings.forEach((el) => el.removeAttribute("inert"));
|
|
5279
|
+
this.inertSiblings = [];
|
|
5280
|
+
}
|
|
5281
|
+
applyInitialFocus() {
|
|
5282
|
+
if (this.options.initialFocus === false) return;
|
|
5283
|
+
let targetEl = null;
|
|
5284
|
+
if (typeof this.options.initialFocus === "string") {
|
|
5285
|
+
targetEl = this.element.querySelector(this.options.initialFocus);
|
|
5286
|
+
} else if (this.options.initialFocus instanceof HTMLElement) {
|
|
5287
|
+
targetEl = this.options.initialFocus;
|
|
5288
|
+
}
|
|
5289
|
+
if (targetEl && this.isFocusable(targetEl)) {
|
|
5290
|
+
targetEl.focus();
|
|
5291
|
+
return;
|
|
5292
|
+
}
|
|
5293
|
+
const focusables = this.getFocusableElements();
|
|
5294
|
+
if (focusables.length > 0) {
|
|
5295
|
+
focusables[0].focus();
|
|
5296
|
+
} else {
|
|
5297
|
+
if (this.element.getAttribute("tabindex") === null) {
|
|
5298
|
+
this.element.setAttribute("tabindex", "-1");
|
|
5299
|
+
}
|
|
5300
|
+
this.element.focus();
|
|
5301
|
+
}
|
|
5302
|
+
}
|
|
5303
|
+
restoreFocus() {
|
|
5304
|
+
if (this.previousActiveElement && this.previousActiveElement.isConnected) {
|
|
5305
|
+
this.previousActiveElement.focus();
|
|
5306
|
+
return;
|
|
5307
|
+
}
|
|
5308
|
+
if (this.options.fallbackReturnFocus) {
|
|
5309
|
+
const fallback = typeof this.options.fallbackReturnFocus === "string" ? document.querySelector(this.options.fallbackReturnFocus) : this.options.fallbackReturnFocus;
|
|
5310
|
+
if (fallback && fallback.isConnected) {
|
|
5311
|
+
fallback.focus();
|
|
5312
|
+
}
|
|
5313
|
+
}
|
|
5314
|
+
}
|
|
5315
|
+
};
|
|
5316
|
+
|
|
5317
|
+
// src/focus-trap/index.ts
|
|
5318
|
+
if (typeof window !== "undefined") {
|
|
5319
|
+
const win = window;
|
|
5320
|
+
const wulfNamespace = win.Wulf || {};
|
|
5321
|
+
win.Wulf = wulfNamespace;
|
|
5322
|
+
wulfNamespace.FocusTrap = Object.assign(FocusTrap, {
|
|
5323
|
+
FocusTrap
|
|
5324
|
+
});
|
|
5325
|
+
}
|
|
4747
5326
|
export {
|
|
4748
5327
|
AmountEngine,
|
|
5328
|
+
AuditableComponent,
|
|
4749
5329
|
BaseInputMask,
|
|
4750
5330
|
EmailEngine,
|
|
5331
|
+
focus_trap_exports as FocusTrap,
|
|
4751
5332
|
InputAmountMask,
|
|
4752
5333
|
InputEmailMask,
|
|
4753
5334
|
InputMask,
|
|
@@ -4759,6 +5340,7 @@ export {
|
|
|
4759
5340
|
masonry_exports as Masonry,
|
|
4760
5341
|
scroll_exports as Scroll,
|
|
4761
5342
|
toast_exports as Toast,
|
|
5343
|
+
FocusTrap as WulfFocusTrap,
|
|
4762
5344
|
createI18nManager,
|
|
4763
5345
|
mask_default as default,
|
|
4764
5346
|
resolveMaskConstructorArgs
|