publishing_platform_publishing_components 0.1.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.
- checksums.yaml +7 -0
- data/LICENSE +22 -0
- data/README.md +2 -0
- data/Rakefile +41 -0
- data/app/assets/builds/gemkeep +0 -0
- data/app/assets/config/publishing_platform_publishing_components_manifest.js +2 -0
- data/app/assets/images/publishing_platform_publishing_components/gemkeep +0 -0
- data/app/assets/stylesheets/publishing_platform_publishing_components/_all_components.scss +3 -0
- data/app/assets/stylesheets/publishing_platform_publishing_components/components/_attachment.scss +117 -0
- data/app/assets/stylesheets/publishing_platform_publishing_components/components/_summary-list.scss +169 -0
- data/app/controllers/publishing_platform_publishing_components/application_controller.rb +4 -0
- data/app/helpers/publishing_platform_publishing_components/application_helper.rb +4 -0
- data/app/models/publishing_platform_publishing_components/component_doc.rb +90 -0
- data/app/models/publishing_platform_publishing_components/component_docs.rb +57 -0
- data/app/models/publishing_platform_publishing_components/component_example.rb +104 -0
- data/app/models/publishing_platform_publishing_components/shared_accessibility_criteria.rb +37 -0
- data/app/views/publishing_platform_publishing_components/component_doc/_component_output.html.erb +15 -0
- data/app/views/publishing_platform_publishing_components/components/_attachment.html.erb +91 -0
- data/app/views/publishing_platform_publishing_components/components/_error_summary.html.erb +38 -0
- data/app/views/publishing_platform_publishing_components/components/_summary_list.html.erb +135 -0
- data/app/views/publishing_platform_publishing_components/components/attachment/_thumbnail_document.html.erb +3 -0
- data/app/views/publishing_platform_publishing_components/components/attachment/_thumbnail_external.html.erb +3 -0
- data/app/views/publishing_platform_publishing_components/components/attachment/_thumbnail_generic.html.erb +4 -0
- data/app/views/publishing_platform_publishing_components/components/attachment/_thumbnail_html.html.erb +3 -0
- data/app/views/publishing_platform_publishing_components/components/attachment/_thumbnail_pdf.html.erb +3 -0
- data/app/views/publishing_platform_publishing_components/components/attachment/_thumbnail_spreadsheet.html.erb +5 -0
- data/app/views/publishing_platform_publishing_components/components/docs/attachment.yml +104 -0
- data/app/views/publishing_platform_publishing_components/components/docs/error_summary.yml +51 -0
- data/app/views/publishing_platform_publishing_components/components/docs/summary_list.yml +137 -0
- data/config/initializers/assets.rb +24 -0
- data/config/routes.rb +2 -0
- data/lib/publishing_platform_publishing_components/config.rb +25 -0
- data/lib/publishing_platform_publishing_components/engine.rb +5 -0
- data/lib/publishing_platform_publishing_components/presenters/attachment_helper.rb +176 -0
- data/lib/publishing_platform_publishing_components/presenters/component_wrapper_helper.rb +290 -0
- data/lib/publishing_platform_publishing_components/presenters/shared_helper.rb +24 -0
- data/lib/publishing_platform_publishing_components/version.rb +3 -0
- data/lib/publishing_platform_publishing_components.rb +10 -0
- data/lib/tasks/publishing_platform_publishing_components_tasks.rake +4 -0
- data/node_modules/bootstrap/LICENSE +21 -0
- data/node_modules/bootstrap/README.md +246 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.css +4085 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.min.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.css +4084 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.min.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.css +601 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.min.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.css +598 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.min.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.css +5406 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.min.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.css +5397 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.min.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap.css +12048 -0
- data/node_modules/bootstrap/dist/css/bootstrap.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap.min.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap.rtl.css +12021 -0
- data/node_modules/bootstrap/dist/css/bootstrap.rtl.css.map +1 -0
- data/node_modules/bootstrap/dist/css/bootstrap.rtl.min.css +6 -0
- data/node_modules/bootstrap/dist/css/bootstrap.rtl.min.css.map +1 -0
- data/node_modules/bootstrap/dist/js/bootstrap.bundle.js +6312 -0
- data/node_modules/bootstrap/dist/js/bootstrap.bundle.js.map +1 -0
- data/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js +7 -0
- data/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js.map +1 -0
- data/node_modules/bootstrap/dist/js/bootstrap.esm.js +4447 -0
- data/node_modules/bootstrap/dist/js/bootstrap.esm.js.map +1 -0
- data/node_modules/bootstrap/dist/js/bootstrap.esm.min.js +7 -0
- data/node_modules/bootstrap/dist/js/bootstrap.esm.min.js.map +1 -0
- data/node_modules/bootstrap/dist/js/bootstrap.js +4494 -0
- data/node_modules/bootstrap/dist/js/bootstrap.js.map +1 -0
- data/node_modules/bootstrap/dist/js/bootstrap.min.js +7 -0
- data/node_modules/bootstrap/dist/js/bootstrap.min.js.map +1 -0
- data/node_modules/bootstrap/js/dist/alert.js +90 -0
- data/node_modules/bootstrap/js/dist/alert.js.map +1 -0
- data/node_modules/bootstrap/js/dist/base-component.js +86 -0
- data/node_modules/bootstrap/js/dist/base-component.js.map +1 -0
- data/node_modules/bootstrap/js/dist/button.js +79 -0
- data/node_modules/bootstrap/js/dist/button.js.map +1 -0
- data/node_modules/bootstrap/js/dist/carousel.js +388 -0
- data/node_modules/bootstrap/js/dist/carousel.js.map +1 -0
- data/node_modules/bootstrap/js/dist/collapse.js +249 -0
- data/node_modules/bootstrap/js/dist/collapse.js.map +1 -0
- data/node_modules/bootstrap/js/dist/dom/data.js +63 -0
- data/node_modules/bootstrap/js/dist/dom/data.js.map +1 -0
- data/node_modules/bootstrap/js/dist/dom/event-handler.js +237 -0
- data/node_modules/bootstrap/js/dist/dom/event-handler.js.map +1 -0
- data/node_modules/bootstrap/js/dist/dom/manipulator.js +72 -0
- data/node_modules/bootstrap/js/dist/dom/manipulator.js.map +1 -0
- data/node_modules/bootstrap/js/dist/dom/selector-engine.js +104 -0
- data/node_modules/bootstrap/js/dist/dom/selector-engine.js.map +1 -0
- data/node_modules/bootstrap/js/dist/dropdown.js +402 -0
- data/node_modules/bootstrap/js/dist/dropdown.js.map +1 -0
- data/node_modules/bootstrap/js/dist/modal.js +320 -0
- data/node_modules/bootstrap/js/dist/modal.js.map +1 -0
- data/node_modules/bootstrap/js/dist/offcanvas.js +246 -0
- data/node_modules/bootstrap/js/dist/offcanvas.js.map +1 -0
- data/node_modules/bootstrap/js/dist/popover.js +96 -0
- data/node_modules/bootstrap/js/dist/popover.js.map +1 -0
- data/node_modules/bootstrap/js/dist/scrollspy.js +275 -0
- data/node_modules/bootstrap/js/dist/scrollspy.js.map +1 -0
- data/node_modules/bootstrap/js/dist/tab.js +285 -0
- data/node_modules/bootstrap/js/dist/tab.js.map +1 -0
- data/node_modules/bootstrap/js/dist/toast.js +198 -0
- data/node_modules/bootstrap/js/dist/toast.js.map +1 -0
- data/node_modules/bootstrap/js/dist/tooltip.js +546 -0
- data/node_modules/bootstrap/js/dist/tooltip.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/backdrop.js +139 -0
- data/node_modules/bootstrap/js/dist/util/backdrop.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/component-functions.js +42 -0
- data/node_modules/bootstrap/js/dist/util/component-functions.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/config.js +68 -0
- data/node_modules/bootstrap/js/dist/util/config.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/focustrap.js +113 -0
- data/node_modules/bootstrap/js/dist/util/focustrap.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/index.js +281 -0
- data/node_modules/bootstrap/js/dist/util/index.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/sanitizer.js +113 -0
- data/node_modules/bootstrap/js/dist/util/sanitizer.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/scrollbar.js +113 -0
- data/node_modules/bootstrap/js/dist/util/scrollbar.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/swipe.js +135 -0
- data/node_modules/bootstrap/js/dist/util/swipe.js.map +1 -0
- data/node_modules/bootstrap/js/dist/util/template-factory.js +151 -0
- data/node_modules/bootstrap/js/dist/util/template-factory.js.map +1 -0
- data/node_modules/bootstrap/js/index.esm.js +19 -0
- data/node_modules/bootstrap/js/index.umd.js +34 -0
- data/node_modules/bootstrap/js/src/alert.js +87 -0
- data/node_modules/bootstrap/js/src/base-component.js +86 -0
- data/node_modules/bootstrap/js/src/button.js +72 -0
- data/node_modules/bootstrap/js/src/carousel.js +474 -0
- data/node_modules/bootstrap/js/src/collapse.js +297 -0
- data/node_modules/bootstrap/js/src/dom/data.js +55 -0
- data/node_modules/bootstrap/js/src/dom/event-handler.js +317 -0
- data/node_modules/bootstrap/js/src/dom/manipulator.js +71 -0
- data/node_modules/bootstrap/js/src/dom/selector-engine.js +126 -0
- data/node_modules/bootstrap/js/src/dropdown.js +455 -0
- data/node_modules/bootstrap/js/src/modal.js +378 -0
- data/node_modules/bootstrap/js/src/offcanvas.js +282 -0
- data/node_modules/bootstrap/js/src/popover.js +97 -0
- data/node_modules/bootstrap/js/src/scrollspy.js +296 -0
- data/node_modules/bootstrap/js/src/tab.js +315 -0
- data/node_modules/bootstrap/js/src/toast.js +224 -0
- data/node_modules/bootstrap/js/src/tooltip.js +633 -0
- data/node_modules/bootstrap/js/src/util/backdrop.js +151 -0
- data/node_modules/bootstrap/js/src/util/component-functions.js +35 -0
- data/node_modules/bootstrap/js/src/util/config.js +65 -0
- data/node_modules/bootstrap/js/src/util/focustrap.js +115 -0
- data/node_modules/bootstrap/js/src/util/index.js +306 -0
- data/node_modules/bootstrap/js/src/util/sanitizer.js +116 -0
- data/node_modules/bootstrap/js/src/util/scrollbar.js +114 -0
- data/node_modules/bootstrap/js/src/util/swipe.js +146 -0
- data/node_modules/bootstrap/js/src/util/template-factory.js +160 -0
- data/node_modules/bootstrap/package.json +210 -0
- data/node_modules/bootstrap/scss/_accordion.scss +153 -0
- data/node_modules/bootstrap/scss/_alert.scss +68 -0
- data/node_modules/bootstrap/scss/_badge.scss +38 -0
- data/node_modules/bootstrap/scss/_breadcrumb.scss +40 -0
- data/node_modules/bootstrap/scss/_button-group.scss +147 -0
- data/node_modules/bootstrap/scss/_buttons.scss +216 -0
- data/node_modules/bootstrap/scss/_card.scss +238 -0
- data/node_modules/bootstrap/scss/_carousel.scss +226 -0
- data/node_modules/bootstrap/scss/_close.scss +66 -0
- data/node_modules/bootstrap/scss/_containers.scss +41 -0
- data/node_modules/bootstrap/scss/_dropdown.scss +250 -0
- data/node_modules/bootstrap/scss/_forms.scss +9 -0
- data/node_modules/bootstrap/scss/_functions.scss +302 -0
- data/node_modules/bootstrap/scss/_grid.scss +39 -0
- data/node_modules/bootstrap/scss/_helpers.scss +12 -0
- data/node_modules/bootstrap/scss/_images.scss +42 -0
- data/node_modules/bootstrap/scss/_list-group.scss +199 -0
- data/node_modules/bootstrap/scss/_maps.scss +174 -0
- data/node_modules/bootstrap/scss/_mixins.scss +42 -0
- data/node_modules/bootstrap/scss/_modal.scss +240 -0
- data/node_modules/bootstrap/scss/_nav.scss +197 -0
- data/node_modules/bootstrap/scss/_navbar.scss +289 -0
- data/node_modules/bootstrap/scss/_offcanvas.scss +147 -0
- data/node_modules/bootstrap/scss/_pagination.scss +109 -0
- data/node_modules/bootstrap/scss/_placeholders.scss +51 -0
- data/node_modules/bootstrap/scss/_popover.scss +196 -0
- data/node_modules/bootstrap/scss/_progress.scss +68 -0
- data/node_modules/bootstrap/scss/_reboot.scss +617 -0
- data/node_modules/bootstrap/scss/_root.scss +187 -0
- data/node_modules/bootstrap/scss/_spinners.scss +86 -0
- data/node_modules/bootstrap/scss/_tables.scss +171 -0
- data/node_modules/bootstrap/scss/_toasts.scss +73 -0
- data/node_modules/bootstrap/scss/_tooltip.scss +119 -0
- data/node_modules/bootstrap/scss/_transitions.scss +27 -0
- data/node_modules/bootstrap/scss/_type.scss +106 -0
- data/node_modules/bootstrap/scss/_utilities.scss +806 -0
- data/node_modules/bootstrap/scss/_variables-dark.scss +102 -0
- data/node_modules/bootstrap/scss/_variables.scss +1753 -0
- data/node_modules/bootstrap/scss/bootstrap-grid.scss +62 -0
- data/node_modules/bootstrap/scss/bootstrap-reboot.scss +10 -0
- data/node_modules/bootstrap/scss/bootstrap-utilities.scss +19 -0
- data/node_modules/bootstrap/scss/bootstrap.scss +52 -0
- data/node_modules/bootstrap/scss/forms/_floating-labels.scss +97 -0
- data/node_modules/bootstrap/scss/forms/_form-check.scss +189 -0
- data/node_modules/bootstrap/scss/forms/_form-control.scss +214 -0
- data/node_modules/bootstrap/scss/forms/_form-range.scss +91 -0
- data/node_modules/bootstrap/scss/forms/_form-select.scss +80 -0
- data/node_modules/bootstrap/scss/forms/_form-text.scss +11 -0
- data/node_modules/bootstrap/scss/forms/_input-group.scss +132 -0
- data/node_modules/bootstrap/scss/forms/_labels.scss +36 -0
- data/node_modules/bootstrap/scss/forms/_validation.scss +12 -0
- data/node_modules/bootstrap/scss/helpers/_clearfix.scss +3 -0
- data/node_modules/bootstrap/scss/helpers/_color-bg.scss +7 -0
- data/node_modules/bootstrap/scss/helpers/_colored-links.scss +30 -0
- data/node_modules/bootstrap/scss/helpers/_focus-ring.scss +5 -0
- data/node_modules/bootstrap/scss/helpers/_icon-link.scss +25 -0
- data/node_modules/bootstrap/scss/helpers/_position.scss +36 -0
- data/node_modules/bootstrap/scss/helpers/_ratio.scss +26 -0
- data/node_modules/bootstrap/scss/helpers/_stacks.scss +15 -0
- data/node_modules/bootstrap/scss/helpers/_stretched-link.scss +15 -0
- data/node_modules/bootstrap/scss/helpers/_text-truncation.scss +7 -0
- data/node_modules/bootstrap/scss/helpers/_visually-hidden.scss +8 -0
- data/node_modules/bootstrap/scss/helpers/_vr.scss +8 -0
- data/node_modules/bootstrap/scss/mixins/_alert.scss +18 -0
- data/node_modules/bootstrap/scss/mixins/_backdrop.scss +14 -0
- data/node_modules/bootstrap/scss/mixins/_banner.scss +7 -0
- data/node_modules/bootstrap/scss/mixins/_border-radius.scss +78 -0
- data/node_modules/bootstrap/scss/mixins/_box-shadow.scss +24 -0
- data/node_modules/bootstrap/scss/mixins/_breakpoints.scss +127 -0
- data/node_modules/bootstrap/scss/mixins/_buttons.scss +70 -0
- data/node_modules/bootstrap/scss/mixins/_caret.scss +69 -0
- data/node_modules/bootstrap/scss/mixins/_clearfix.scss +9 -0
- data/node_modules/bootstrap/scss/mixins/_color-mode.scss +21 -0
- data/node_modules/bootstrap/scss/mixins/_color-scheme.scss +7 -0
- data/node_modules/bootstrap/scss/mixins/_container.scss +11 -0
- data/node_modules/bootstrap/scss/mixins/_deprecate.scss +10 -0
- data/node_modules/bootstrap/scss/mixins/_forms.scss +163 -0
- data/node_modules/bootstrap/scss/mixins/_gradients.scss +47 -0
- data/node_modules/bootstrap/scss/mixins/_grid.scss +151 -0
- data/node_modules/bootstrap/scss/mixins/_image.scss +16 -0
- data/node_modules/bootstrap/scss/mixins/_list-group.scss +26 -0
- data/node_modules/bootstrap/scss/mixins/_lists.scss +7 -0
- data/node_modules/bootstrap/scss/mixins/_pagination.scss +10 -0
- data/node_modules/bootstrap/scss/mixins/_reset-text.scss +17 -0
- data/node_modules/bootstrap/scss/mixins/_resize.scss +6 -0
- data/node_modules/bootstrap/scss/mixins/_table-variants.scss +24 -0
- data/node_modules/bootstrap/scss/mixins/_text-truncate.scss +8 -0
- data/node_modules/bootstrap/scss/mixins/_transition.scss +26 -0
- data/node_modules/bootstrap/scss/mixins/_utilities.scss +97 -0
- data/node_modules/bootstrap/scss/mixins/_visually-hidden.scss +38 -0
- data/node_modules/bootstrap/scss/utilities/_api.scss +47 -0
- data/node_modules/bootstrap/scss/vendor/_rfs.scss +348 -0
- metadata +448 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Bootstrap backdrop.js v5.3.8 (https://getbootstrap.com/)
|
|
3
|
+
* Copyright 2011-2025 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
|
+
*/
|
|
6
|
+
(function (global, factory) {
|
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../dom/event-handler.js'), require('./config.js'), require('./index.js')) :
|
|
8
|
+
typeof define === 'function' && define.amd ? define(['../dom/event-handler', './config', './index'], factory) :
|
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Backdrop = factory(global.EventHandler, global.Config, global.Index));
|
|
10
|
+
})(this, (function (EventHandler, Config, index_js) { 'use strict';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* --------------------------------------------------------------------------
|
|
14
|
+
* Bootstrap util/backdrop.js
|
|
15
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
16
|
+
* --------------------------------------------------------------------------
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Constants
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
const NAME = 'backdrop';
|
|
25
|
+
const CLASS_NAME_FADE = 'fade';
|
|
26
|
+
const CLASS_NAME_SHOW = 'show';
|
|
27
|
+
const EVENT_MOUSEDOWN = `mousedown.bs.${NAME}`;
|
|
28
|
+
const Default = {
|
|
29
|
+
className: 'modal-backdrop',
|
|
30
|
+
clickCallback: null,
|
|
31
|
+
isAnimated: false,
|
|
32
|
+
isVisible: true,
|
|
33
|
+
// if false, we use the backdrop helper without adding any element to the dom
|
|
34
|
+
rootElement: 'body' // give the choice to place backdrop under different elements
|
|
35
|
+
};
|
|
36
|
+
const DefaultType = {
|
|
37
|
+
className: 'string',
|
|
38
|
+
clickCallback: '(function|null)',
|
|
39
|
+
isAnimated: 'boolean',
|
|
40
|
+
isVisible: 'boolean',
|
|
41
|
+
rootElement: '(element|string)'
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Class definition
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
class Backdrop extends Config {
|
|
49
|
+
constructor(config) {
|
|
50
|
+
super();
|
|
51
|
+
this._config = this._getConfig(config);
|
|
52
|
+
this._isAppended = false;
|
|
53
|
+
this._element = null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Getters
|
|
57
|
+
static get Default() {
|
|
58
|
+
return Default;
|
|
59
|
+
}
|
|
60
|
+
static get DefaultType() {
|
|
61
|
+
return DefaultType;
|
|
62
|
+
}
|
|
63
|
+
static get NAME() {
|
|
64
|
+
return NAME;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Public
|
|
68
|
+
show(callback) {
|
|
69
|
+
if (!this._config.isVisible) {
|
|
70
|
+
index_js.execute(callback);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
this._append();
|
|
74
|
+
const element = this._getElement();
|
|
75
|
+
if (this._config.isAnimated) {
|
|
76
|
+
index_js.reflow(element);
|
|
77
|
+
}
|
|
78
|
+
element.classList.add(CLASS_NAME_SHOW);
|
|
79
|
+
this._emulateAnimation(() => {
|
|
80
|
+
index_js.execute(callback);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
hide(callback) {
|
|
84
|
+
if (!this._config.isVisible) {
|
|
85
|
+
index_js.execute(callback);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
this._getElement().classList.remove(CLASS_NAME_SHOW);
|
|
89
|
+
this._emulateAnimation(() => {
|
|
90
|
+
this.dispose();
|
|
91
|
+
index_js.execute(callback);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
dispose() {
|
|
95
|
+
if (!this._isAppended) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
EventHandler.off(this._element, EVENT_MOUSEDOWN);
|
|
99
|
+
this._element.remove();
|
|
100
|
+
this._isAppended = false;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Private
|
|
104
|
+
_getElement() {
|
|
105
|
+
if (!this._element) {
|
|
106
|
+
const backdrop = document.createElement('div');
|
|
107
|
+
backdrop.className = this._config.className;
|
|
108
|
+
if (this._config.isAnimated) {
|
|
109
|
+
backdrop.classList.add(CLASS_NAME_FADE);
|
|
110
|
+
}
|
|
111
|
+
this._element = backdrop;
|
|
112
|
+
}
|
|
113
|
+
return this._element;
|
|
114
|
+
}
|
|
115
|
+
_configAfterMerge(config) {
|
|
116
|
+
// use getElement() with the default "body" to get a fresh Element on each instantiation
|
|
117
|
+
config.rootElement = index_js.getElement(config.rootElement);
|
|
118
|
+
return config;
|
|
119
|
+
}
|
|
120
|
+
_append() {
|
|
121
|
+
if (this._isAppended) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const element = this._getElement();
|
|
125
|
+
this._config.rootElement.append(element);
|
|
126
|
+
EventHandler.on(element, EVENT_MOUSEDOWN, () => {
|
|
127
|
+
index_js.execute(this._config.clickCallback);
|
|
128
|
+
});
|
|
129
|
+
this._isAppended = true;
|
|
130
|
+
}
|
|
131
|
+
_emulateAnimation(callback) {
|
|
132
|
+
index_js.executeAfterTransition(callback, this._getElement(), this._config.isAnimated);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return Backdrop;
|
|
137
|
+
|
|
138
|
+
}));
|
|
139
|
+
//# sourceMappingURL=backdrop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backdrop.js","sources":["../../src/util/backdrop.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap util/backdrop.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport EventHandler from '../dom/event-handler.js'\nimport Config from './config.js'\nimport {\n execute, executeAfterTransition, getElement, reflow\n} from './index.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'backdrop'\nconst CLASS_NAME_FADE = 'fade'\nconst CLASS_NAME_SHOW = 'show'\nconst EVENT_MOUSEDOWN = `mousedown.bs.${NAME}`\n\nconst Default = {\n className: 'modal-backdrop',\n clickCallback: null,\n isAnimated: false,\n isVisible: true, // if false, we use the backdrop helper without adding any element to the dom\n rootElement: 'body' // give the choice to place backdrop under different elements\n}\n\nconst DefaultType = {\n className: 'string',\n clickCallback: '(function|null)',\n isAnimated: 'boolean',\n isVisible: 'boolean',\n rootElement: '(element|string)'\n}\n\n/**\n * Class definition\n */\n\nclass Backdrop extends Config {\n constructor(config) {\n super()\n this._config = this._getConfig(config)\n this._isAppended = false\n this._element = null\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n show(callback) {\n if (!this._config.isVisible) {\n execute(callback)\n return\n }\n\n this._append()\n\n const element = this._getElement()\n if (this._config.isAnimated) {\n reflow(element)\n }\n\n element.classList.add(CLASS_NAME_SHOW)\n\n this._emulateAnimation(() => {\n execute(callback)\n })\n }\n\n hide(callback) {\n if (!this._config.isVisible) {\n execute(callback)\n return\n }\n\n this._getElement().classList.remove(CLASS_NAME_SHOW)\n\n this._emulateAnimation(() => {\n this.dispose()\n execute(callback)\n })\n }\n\n dispose() {\n if (!this._isAppended) {\n return\n }\n\n EventHandler.off(this._element, EVENT_MOUSEDOWN)\n\n this._element.remove()\n this._isAppended = false\n }\n\n // Private\n _getElement() {\n if (!this._element) {\n const backdrop = document.createElement('div')\n backdrop.className = this._config.className\n if (this._config.isAnimated) {\n backdrop.classList.add(CLASS_NAME_FADE)\n }\n\n this._element = backdrop\n }\n\n return this._element\n }\n\n _configAfterMerge(config) {\n // use getElement() with the default \"body\" to get a fresh Element on each instantiation\n config.rootElement = getElement(config.rootElement)\n return config\n }\n\n _append() {\n if (this._isAppended) {\n return\n }\n\n const element = this._getElement()\n this._config.rootElement.append(element)\n\n EventHandler.on(element, EVENT_MOUSEDOWN, () => {\n execute(this._config.clickCallback)\n })\n\n this._isAppended = true\n }\n\n _emulateAnimation(callback) {\n executeAfterTransition(callback, this._getElement(), this._config.isAnimated)\n }\n}\n\nexport default Backdrop\n"],"names":["NAME","CLASS_NAME_FADE","CLASS_NAME_SHOW","EVENT_MOUSEDOWN","Default","className","clickCallback","isAnimated","isVisible","rootElement","DefaultType","Backdrop","Config","constructor","config","_config","_getConfig","_isAppended","_element","show","callback","execute","_append","element","_getElement","reflow","classList","add","_emulateAnimation","hide","remove","dispose","EventHandler","off","backdrop","document","createElement","_configAfterMerge","getElement","append","on","executeAfterTransition"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;;EAQA;EACA;EACA;;EAEA,MAAMA,IAAI,GAAG,UAAU;EACvB,MAAMC,eAAe,GAAG,MAAM;EAC9B,MAAMC,eAAe,GAAG,MAAM;EAC9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AAGgB,QAAQ;EAC1B,IAAA;MAEA,OAAO,IAAI,CAAChB,QAAQ;EACtB,EAAA;IAEAmB,iBAAiBA,CAACvB,MAAM,EAAE;EACxB;MACAA,MAAM,CAACL,WAAW,GAAG6B,mBAAU,CAACxB,MAAM,CAACL,WAAW,CAAC;EACnD,IAAA,OAAOK,MAAM;EACf,EAAA;EAEAQ,EAAAA,OAAOA,GAAG;MACR,IAAI,IAAI,CAACL,WAAW,EAAE;EACpB,MAAA;EACF,IAAA;EAEA,IAAA,MAAMM,OAAO,GAAG,IAAI,CAACC,WAAW,EAAE;MAClC,IAAI,CAACT,OAAO,CAACN,WAAW,CAAC8B,MAAM,CAAChB,OAAO,CAAC;EAExCS,IAAAA,YAAY,CAACQ,EAAE,CAACjB,OAAO,EAAEpB,eAAe,EAAE,MAAM;EAC9CkB,MAAAA,gBAAO,CAAC,IAAI,CAACN,OAAO,CAACT,aAAa,CAAC;EACrC,IAAA,CAAC,CAAC;MAEF,IAAI,CAACW,WAAW,GAAG,IAAI;EACzB,EAAA;IAEAW,iBAAiBA,CAACR,QAAQ,EAAE;EAC1BqB,IAAAA,+BAAsB,CAACrB,QAAQ,EAAE,IAAI,CAACI,WAAW,EAAE,EAAE,IAAI,CAACT,OAAO,CAACR,UAAU,CAAC;EAC/E,EAAA;EACF;;;;;;;;"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Bootstrap component-functions.js v5.3.8 (https://getbootstrap.com/)
|
|
3
|
+
* Copyright 2011-2025 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
|
+
*/
|
|
6
|
+
(function (global, factory) {
|
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('../dom/event-handler.js'), require('../dom/selector-engine.js'), require('./index.js')) :
|
|
8
|
+
typeof define === 'function' && define.amd ? define(['exports', '../dom/event-handler', '../dom/selector-engine', './index'], factory) :
|
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ComponentFunctions = {}, global.EventHandler, global.SelectorEngine, global.Index));
|
|
10
|
+
})(this, (function (exports, EventHandler, SelectorEngine, index_js) { 'use strict';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* --------------------------------------------------------------------------
|
|
14
|
+
* Bootstrap util/component-functions.js
|
|
15
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
16
|
+
* --------------------------------------------------------------------------
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const enableDismissTrigger = (component, method = 'hide') => {
|
|
20
|
+
const clickEvent = `click.dismiss${component.EVENT_KEY}`;
|
|
21
|
+
const name = component.NAME;
|
|
22
|
+
EventHandler.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) {
|
|
23
|
+
if (['A', 'AREA'].includes(this.tagName)) {
|
|
24
|
+
event.preventDefault();
|
|
25
|
+
}
|
|
26
|
+
if (index_js.isDisabled(this)) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const target = SelectorEngine.getElementFromSelector(this) || this.closest(`.${name}`);
|
|
30
|
+
const instance = component.getOrCreateInstance(target);
|
|
31
|
+
|
|
32
|
+
// Method argument is left, for Alert and only, as it doesn't implement the 'hide' method
|
|
33
|
+
instance[method]();
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
exports.enableDismissTrigger = enableDismissTrigger;
|
|
38
|
+
|
|
39
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
40
|
+
|
|
41
|
+
}));
|
|
42
|
+
//# sourceMappingURL=component-functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-functions.js","sources":["../../src/util/component-functions.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap util/component-functions.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport EventHandler from '../dom/event-handler.js'\nimport SelectorEngine from '../dom/selector-engine.js'\nimport { isDisabled } from './index.js'\n\nconst enableDismissTrigger = (component, method = 'hide') => {\n const clickEvent = `click.dismiss${component.EVENT_KEY}`\n const name = component.NAME\n\n EventHandler.on(document, clickEvent, `[data-bs-dismiss=\"${name}\"]`, function (event) {\n if (['A', 'AREA'].includes(this.tagName)) {\n event.preventDefault()\n }\n\n if (isDisabled(this)) {\n return\n }\n\n const target = SelectorEngine.getElementFromSelector(this) || this.closest(`.${name}`)\n const instance = component.getOrCreateInstance(target)\n\n // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method\n instance[method]()\n })\n}\n\nexport {\n enableDismissTrigger\n}\n"],"names":["enableDismissTrigger","component","method","clickEvent","EVENT_KEY","name","NAME","EventHandler","on","document","event","includes","tagName","preventDefault","isDisabled","target","SelectorEngine","getElementFromSelector","closest","instance","getOrCreateInstance"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;AAMA,QAAMA,oBAAoB,GAAGA,CAACC,SAAS,EAAEC,MAAM,GAAG,MAAM,KAAK;EAC3D,EAAA,MAAMC,UAAU,GAAG,CAAA,aAAA,EAAgBF,SAAS,CAACG,SAAS,CAAA,CAAE;EACxD,EAAA,MAAMC,IAAI,GAAGJ,SAAS,CAACK,IAAI;EAE3BC,EAAAA,YAAY,CAACC,EAAE,CAACC,QAAQ,EAAEN,UAAU,EAAE,CAAA,kBAAA,EAAqBE,IAAI,CAAA,EAAA,CAAI,EAAE,UAAUK,KAAK,EAAE;EACpF,IAAA,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAACC,QAAQ,CAAC,IAAI,CAACC,OAAO,CAAC,EAAE;QACxCF,KAAK,CAACG,cAAc,EAAE;EACxB,IAAA;EAEA,IAAA,IAAIC,mBAAU,CAAC,IAAI,CAAC,EAAE;EACpB,MAAA;EACF,IAAA;EAEA,IAAA,MAAMC,MAAM,GAAGC,cAAc,CAACC,sBAAsB,CAAC,IAAI,CAAC,IAAI,IAAI,CAACC,OAAO,CAAC,CAAA,CAAA,EAAIb,IAAI,EAAE,CAAC;EACtF,IAAA,MAAMc,QAAQ,GAAGlB,SAAS,CAACmB,mBAAmB,CAACL,MAAM,CAAC;;EAEtD;EACAI,IAAAA,QAAQ,CAACjB,MAAM,CAAC,EAAE;EACpB,EAAA,CAAC,CAAC;EACJ;;;;;;;;;;"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Bootstrap config.js v5.3.8 (https://getbootstrap.com/)
|
|
3
|
+
* Copyright 2011-2025 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
|
+
*/
|
|
6
|
+
(function (global, factory) {
|
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../dom/manipulator.js'), require('./index.js')) :
|
|
8
|
+
typeof define === 'function' && define.amd ? define(['../dom/manipulator', './index'], factory) :
|
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Config = factory(global.Manipulator, global.Index));
|
|
10
|
+
})(this, (function (Manipulator, index_js) { 'use strict';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* --------------------------------------------------------------------------
|
|
14
|
+
* Bootstrap util/config.js
|
|
15
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
16
|
+
* --------------------------------------------------------------------------
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Class definition
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
class Config {
|
|
25
|
+
// Getters
|
|
26
|
+
static get Default() {
|
|
27
|
+
return {};
|
|
28
|
+
}
|
|
29
|
+
static get DefaultType() {
|
|
30
|
+
return {};
|
|
31
|
+
}
|
|
32
|
+
static get NAME() {
|
|
33
|
+
throw new Error('You have to implement the static method "NAME", for each component!');
|
|
34
|
+
}
|
|
35
|
+
_getConfig(config) {
|
|
36
|
+
config = this._mergeConfigObj(config);
|
|
37
|
+
config = this._configAfterMerge(config);
|
|
38
|
+
this._typeCheckConfig(config);
|
|
39
|
+
return config;
|
|
40
|
+
}
|
|
41
|
+
_configAfterMerge(config) {
|
|
42
|
+
return config;
|
|
43
|
+
}
|
|
44
|
+
_mergeConfigObj(config, element) {
|
|
45
|
+
const jsonConfig = index_js.isElement(element) ? Manipulator.getDataAttribute(element, 'config') : {}; // try to parse
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
...this.constructor.Default,
|
|
49
|
+
...(typeof jsonConfig === 'object' ? jsonConfig : {}),
|
|
50
|
+
...(index_js.isElement(element) ? Manipulator.getDataAttributes(element) : {}),
|
|
51
|
+
...(typeof config === 'object' ? config : {})
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
_typeCheckConfig(config, configTypes = this.constructor.DefaultType) {
|
|
55
|
+
for (const [property, expectedTypes] of Object.entries(configTypes)) {
|
|
56
|
+
const value = config[property];
|
|
57
|
+
const valueType = index_js.isElement(value) ? 'element' : index_js.toType(value);
|
|
58
|
+
if (!new RegExp(expectedTypes).test(valueType)) {
|
|
59
|
+
throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return Config;
|
|
66
|
+
|
|
67
|
+
}));
|
|
68
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../../src/util/config.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap util/config.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport Manipulator from '../dom/manipulator.js'\nimport { isElement, toType } from './index.js'\n\n/**\n * Class definition\n */\n\nclass Config {\n // Getters\n static get Default() {\n return {}\n }\n\n static get DefaultType() {\n return {}\n }\n\n static get NAME() {\n throw new Error('You have to implement the static method \"NAME\", for each component!')\n }\n\n _getConfig(config) {\n config = this._mergeConfigObj(config)\n config = this._configAfterMerge(config)\n this._typeCheckConfig(config)\n return config\n }\n\n _configAfterMerge(config) {\n return config\n }\n\n _mergeConfigObj(config, element) {\n const jsonConfig = isElement(element) ? Manipulator.getDataAttribute(element, 'config') : {} // try to parse\n\n return {\n ...this.constructor.Default,\n ...(typeof jsonConfig === 'object' ? jsonConfig : {}),\n ...(isElement(element) ? Manipulator.getDataAttributes(element) : {}),\n ...(typeof config === 'object' ? config : {})\n }\n }\n\n _typeCheckConfig(config, configTypes = this.constructor.DefaultType) {\n for (const [property, expectedTypes] of Object.entries(configTypes)) {\n const value = config[property]\n const valueType = isElement(value) ? 'element' : toType(value)\n\n if (!new RegExp(expectedTypes).test(valueType)) {\n throw new TypeError(\n `${this.constructor.NAME.toUpperCase()}: Option \"${property}\" provided type \"${valueType}\" but expected type \"${expectedTypes}\".`\n )\n }\n }\n }\n}\n\nexport default Config\n"],"names":["Config","Default","DefaultType","NAME","Error","_getConfig","config","_mergeConfigObj","_configAfterMerge","_typeCheckConfig","element","jsonConfig","isElement","Manipulator","getDataAttribute","constructor","getDataAttributes","configTypes","property","expectedTypes","Object","entries","value","valueType","toType","RegExp","test","TypeError","toUpperCase"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;;EAKA;EACA;EACA;;EAEA,MAAMA,MAAM,CAAC;EACX;IACA,WAAWC,OAAOA,GAAG;EACnB,IAAA,OAAO,EAAE;EACX,EAAA;IAEA,WAAWC,WAAWA,GAAG;EACvB,IAAA,OAAO,EAAE;EACX,EAAA;IAEA,WAAWC,IAAIA,GAAG;EAChB,IAAA,MAAM,IA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E9D,IAAI,CAAC,IAAIG,MAAM,CAACN,aAAa,CAAC,CAACO,IAAI,CAACH,SAAS,CAAC,EAAE;UAC9C,MAAM,IAAII,SAAS,CACjB,CAAA,EAAG,IAAI,CAACZ,WAAW,CAACZ,IAAI,CAACyB,WAAW,EAAE,aAAaV,QAAQ,CAAA,iBAAA,EAAoBK,SAAS,CAAA,qBAAA,EAAwBJ,aAAa,IAC/H,CAAC;EACH,MAAA;EACF,IAAA;EACF,EAAA;EACF;;;;;;;;"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Bootstrap focustrap.js v5.3.8 (https://getbootstrap.com/)
|
|
3
|
+
* Copyright 2011-2025 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
|
+
*/
|
|
6
|
+
(function (global, factory) {
|
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../dom/event-handler.js'), require('../dom/selector-engine.js'), require('./config.js')) :
|
|
8
|
+
typeof define === 'function' && define.amd ? define(['../dom/event-handler', '../dom/selector-engine', './config'], factory) :
|
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Focustrap = factory(global.EventHandler, global.SelectorEngine, global.Config));
|
|
10
|
+
})(this, (function (EventHandler, SelectorEngine, Config) { 'use strict';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* --------------------------------------------------------------------------
|
|
14
|
+
* Bootstrap util/focustrap.js
|
|
15
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
16
|
+
* --------------------------------------------------------------------------
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Constants
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
const NAME = 'focustrap';
|
|
25
|
+
const DATA_KEY = 'bs.focustrap';
|
|
26
|
+
const EVENT_KEY = `.${DATA_KEY}`;
|
|
27
|
+
const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
|
|
28
|
+
const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY}`;
|
|
29
|
+
const TAB_KEY = 'Tab';
|
|
30
|
+
const TAB_NAV_FORWARD = 'forward';
|
|
31
|
+
const TAB_NAV_BACKWARD = 'backward';
|
|
32
|
+
const Default = {
|
|
33
|
+
autofocus: true,
|
|
34
|
+
trapElement: null // The element to trap focus inside of
|
|
35
|
+
};
|
|
36
|
+
const DefaultType = {
|
|
37
|
+
autofocus: 'boolean',
|
|
38
|
+
trapElement: 'element'
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Class definition
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
class FocusTrap extends Config {
|
|
46
|
+
constructor(config) {
|
|
47
|
+
super();
|
|
48
|
+
this._config = this._getConfig(config);
|
|
49
|
+
this._isActive = false;
|
|
50
|
+
this._lastTabNavDirection = null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Getters
|
|
54
|
+
static get Default() {
|
|
55
|
+
return Default;
|
|
56
|
+
}
|
|
57
|
+
static get DefaultType() {
|
|
58
|
+
return DefaultType;
|
|
59
|
+
}
|
|
60
|
+
static get NAME() {
|
|
61
|
+
return NAME;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Public
|
|
65
|
+
activate() {
|
|
66
|
+
if (this._isActive) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (this._config.autofocus) {
|
|
70
|
+
this._config.trapElement.focus();
|
|
71
|
+
}
|
|
72
|
+
EventHandler.off(document, EVENT_KEY); // guard against infinite focus loop
|
|
73
|
+
EventHandler.on(document, EVENT_FOCUSIN, event => this._handleFocusin(event));
|
|
74
|
+
EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event));
|
|
75
|
+
this._isActive = true;
|
|
76
|
+
}
|
|
77
|
+
deactivate() {
|
|
78
|
+
if (!this._isActive) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
this._isActive = false;
|
|
82
|
+
EventHandler.off(document, EVENT_KEY);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Private
|
|
86
|
+
_handleFocusin(event) {
|
|
87
|
+
const {
|
|
88
|
+
trapElement
|
|
89
|
+
} = this._config;
|
|
90
|
+
if (event.target === document || event.target === trapElement || trapElement.contains(event.target)) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const elements = SelectorEngine.focusableChildren(trapElement);
|
|
94
|
+
if (elements.length === 0) {
|
|
95
|
+
trapElement.focus();
|
|
96
|
+
} else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {
|
|
97
|
+
elements[elements.length - 1].focus();
|
|
98
|
+
} else {
|
|
99
|
+
elements[0].focus();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
_handleKeydown(event) {
|
|
103
|
+
if (event.key !== TAB_KEY) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return FocusTrap;
|
|
111
|
+
|
|
112
|
+
}));
|
|
113
|
+
//# sourceMappingURL=focustrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focustrap.js","sources":["../../src/util/focustrap.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap util/focustrap.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport EventHandler from '../dom/event-handler.js'\nimport SelectorEngine from '../dom/selector-engine.js'\nimport Config from './config.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'focustrap'\nconst DATA_KEY = 'bs.focustrap'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst EVENT_FOCUSIN = `focusin${EVENT_KEY}`\nconst EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY}`\n\nconst TAB_KEY = 'Tab'\nconst TAB_NAV_FORWARD = 'forward'\nconst TAB_NAV_BACKWARD = 'backward'\n\nconst Default = {\n autofocus: true,\n trapElement: null // The element to trap focus inside of\n}\n\nconst DefaultType = {\n autofocus: 'boolean',\n trapElement: 'element'\n}\n\n/**\n * Class definition\n */\n\nclass FocusTrap extends Config {\n constructor(config) {\n super()\n this._config = this._getConfig(config)\n this._isActive = false\n this._lastTabNavDirection = null\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n activate() {\n if (this._isActive) {\n return\n }\n\n if (this._config.autofocus) {\n this._config.trapElement.focus()\n }\n\n EventHandler.off(document, EVENT_KEY) // guard against infinite focus loop\n EventHandler.on(document, EVENT_FOCUSIN, event => this._handleFocusin(event))\n EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event))\n\n this._isActive = true\n }\n\n deactivate() {\n if (!this._isActive) {\n return\n }\n\n this._isActive = false\n EventHandler.off(document, EVENT_KEY)\n }\n\n // Private\n _handleFocusin(event) {\n const { trapElement } = this._config\n\n if (event.target === document || event.target === trapElement || trapElement.contains(event.target)) {\n return\n }\n\n const elements = SelectorEngine.focusableChildren(trapElement)\n\n if (elements.length === 0) {\n trapElement.focus()\n } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {\n elements[elements.length - 1].focus()\n } else {\n elements[0].focus()\n }\n }\n\n _handleKeydown(event) {\n if (event.key !== TAB_KEY) {\n return\n }\n\n this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD\n }\n}\n\nexport default FocusTrap\n"],"names":["NAME","DATA_KEY","EVENT_KEY","EVENT_FOCUSIN","EVENT_KEYDOWN_TAB","TAB_KEY","TAB_NAV_FORWARD","TAB_NAV_BACKWARD","Default","autofocus","trapElement","DefaultType","FocusTrap","Config","constructor","config","_config","_getConfig","_isActive","_lastTabNavDirection","activate","focus","EventHandler","off","document","on","event","_handleFocusin","_handleKeydown","deactivate","target","contains","elements","SelectorEngine","focusableChildren","length","key","shiftKey"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;;EAMA;EACA;EACA;;EAEA,MAAMA,IAAI,GAAG,WAAW;EACxB,MAAMC,QAAQ,GAAG,cAAc;EAC/B,MAAMC,SAAS,GAAG,CAAA,CAAA,EAAID,QAAQ,CAAA,CAAE;EAChC,MAAME,aAAa,GAAG,CAAA,OAAA,EAAUD,SAAS,CAAA,CAAE;EAC3C,MAAME,iBAAiB,GAAG,CAAA,WAAA,EAAcF,SAAS,CAAA,CAAE;EAEnD,MAAMG,OAAO,GAAG,KAAK;EACrB,MAAMC,eAAe,GAAG,SAAS;EACjC,MAAMC,gBAAgB,GAAG,UAAU;EAEnC,MAAMC,OAAO,GAAG;EACdC,EAAAA,SAAS,EAAE,IAAI;IACfC,WAAW,EAAE,IAAI;EACnB,CAAC;EAED,MAAMC,WAAW,GAAG;EAClBF,EAAAA,SAAS,EAAE,SAAS;EACpBC,EAAAA,WAAW,EAAE;EACf,CAAC;;EAED;EACA;EACA;;EAEA,MAAME,SAAS,SAASC,MAAM,CAAC;IAC7BC,WAAWA,CAACC,MAAM,EAAE;EAClB,IAAA,KAAK,EAAE;MACP,IAAI,CAACC,OAAO,GAAG,IAAI,CAACC,UAAU,CAACF,MAAM,CAAC;MACtC,IAAI,CAACG,SAAS,GAAG,KAAK;MACtB,IAAI,CAACC,oBAAoB,GAAG,IAAI;EAClC,EAAA;;EAEA;IACA,WAAWX,OAAOA,GAAG;EACnB,IAAA,OAAOA,OAAO;EAChB,EAAA;IAEA,WAAWG,WAAWA,GAAG;EACvB,IAAA,OAAOA,WAAW;EACpB,EAAA;IAEA,WAAWX,IAAIA,GAAG;EAChB,IAAA,OAA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