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,246 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Bootstrap offcanvas.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('./base-component.js'), require('./dom/event-handler.js'), require('./dom/selector-engine.js'), require('./util/backdrop.js'), require('./util/component-functions.js'), require('./util/focustrap.js'), require('./util/index.js'), require('./util/scrollbar.js')) :
|
|
8
|
+
typeof define === 'function' && define.amd ? define(['./base-component', './dom/event-handler', './dom/selector-engine', './util/backdrop', './util/component-functions', './util/focustrap', './util/index', './util/scrollbar'], factory) :
|
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Offcanvas = factory(global.BaseComponent, global.EventHandler, global.SelectorEngine, global.Backdrop, global.ComponentFunctions, global.Focustrap, global.Index, global.Scrollbar));
|
|
10
|
+
})(this, (function (BaseComponent, EventHandler, SelectorEngine, Backdrop, componentFunctions_js, FocusTrap, index_js, ScrollBarHelper) { 'use strict';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* --------------------------------------------------------------------------
|
|
14
|
+
* Bootstrap offcanvas.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 = 'offcanvas';
|
|
25
|
+
const DATA_KEY = 'bs.offcanvas';
|
|
26
|
+
const EVENT_KEY = `.${DATA_KEY}`;
|
|
27
|
+
const DATA_API_KEY = '.data-api';
|
|
28
|
+
const EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`;
|
|
29
|
+
const ESCAPE_KEY = 'Escape';
|
|
30
|
+
const CLASS_NAME_SHOW = 'show';
|
|
31
|
+
const CLASS_NAME_SHOWING = 'showing';
|
|
32
|
+
const CLASS_NAME_HIDING = 'hiding';
|
|
33
|
+
const CLASS_NAME_BACKDROP = 'offcanvas-backdrop';
|
|
34
|
+
const OPEN_SELECTOR = '.offcanvas.show';
|
|
35
|
+
const EVENT_SHOW = `show${EVENT_KEY}`;
|
|
36
|
+
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
|
37
|
+
const EVENT_HIDE = `hide${EVENT_KEY}`;
|
|
38
|
+
const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY}`;
|
|
39
|
+
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
|
40
|
+
const EVENT_RESIZE = `resize${EVENT_KEY}`;
|
|
41
|
+
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
|
42
|
+
const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY}`;
|
|
43
|
+
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="offcanvas"]';
|
|
44
|
+
const Default = {
|
|
45
|
+
backdrop: true,
|
|
46
|
+
keyboard: true,
|
|
47
|
+
scroll: false
|
|
48
|
+
};
|
|
49
|
+
const DefaultType = {
|
|
50
|
+
backdrop: '(boolean|string)',
|
|
51
|
+
keyboard: 'boolean',
|
|
52
|
+
scroll: 'boolean'
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Class definition
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
class Offcanvas extends BaseComponent {
|
|
60
|
+
constructor(element, config) {
|
|
61
|
+
super(element, config);
|
|
62
|
+
this._isShown = false;
|
|
63
|
+
this._backdrop = this._initializeBackDrop();
|
|
64
|
+
this._focustrap = this._initializeFocusTrap();
|
|
65
|
+
this._addEventListeners();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Getters
|
|
69
|
+
static get Default() {
|
|
70
|
+
return Default;
|
|
71
|
+
}
|
|
72
|
+
static get DefaultType() {
|
|
73
|
+
return DefaultType;
|
|
74
|
+
}
|
|
75
|
+
static get NAME() {
|
|
76
|
+
return NAME;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Public
|
|
80
|
+
toggle(relatedTarget) {
|
|
81
|
+
return this._isShown ? this.hide() : this.show(relatedTarget);
|
|
82
|
+
}
|
|
83
|
+
show(relatedTarget) {
|
|
84
|
+
if (this._isShown) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, {
|
|
88
|
+
relatedTarget
|
|
89
|
+
});
|
|
90
|
+
if (showEvent.defaultPrevented) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
this._isShown = true;
|
|
94
|
+
this._backdrop.show();
|
|
95
|
+
if (!this._config.scroll) {
|
|
96
|
+
new ScrollBarHelper().hide();
|
|
97
|
+
}
|
|
98
|
+
this._element.setAttribute('aria-modal', true);
|
|
99
|
+
this._element.setAttribute('role', 'dialog');
|
|
100
|
+
this._element.classList.add(CLASS_NAME_SHOWING);
|
|
101
|
+
const completeCallBack = () => {
|
|
102
|
+
if (!this._config.scroll || this._config.backdrop) {
|
|
103
|
+
this._focustrap.activate();
|
|
104
|
+
}
|
|
105
|
+
this._element.classList.add(CLASS_NAME_SHOW);
|
|
106
|
+
this._element.classList.remove(CLASS_NAME_SHOWING);
|
|
107
|
+
EventHandler.trigger(this._element, EVENT_SHOWN, {
|
|
108
|
+
relatedTarget
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
this._queueCallback(completeCallBack, this._element, true);
|
|
112
|
+
}
|
|
113
|
+
hide() {
|
|
114
|
+
if (!this._isShown) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE);
|
|
118
|
+
if (hideEvent.defaultPrevented) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
this._focustrap.deactivate();
|
|
122
|
+
this._element.blur();
|
|
123
|
+
this._isShown = false;
|
|
124
|
+
this._element.classList.add(CLASS_NAME_HIDING);
|
|
125
|
+
this._backdrop.hide();
|
|
126
|
+
const completeCallback = () => {
|
|
127
|
+
this._element.classList.remove(CLASS_NAME_SHOW, CLASS_NAME_HIDING);
|
|
128
|
+
this._element.removeAttribute('aria-modal');
|
|
129
|
+
this._element.removeAttribute('role');
|
|
130
|
+
if (!this._config.scroll) {
|
|
131
|
+
new ScrollBarHelper().reset();
|
|
132
|
+
}
|
|
133
|
+
EventHandler.trigger(this._element, EVENT_HIDDEN);
|
|
134
|
+
};
|
|
135
|
+
this._queueCallback(completeCallback, this._element, true);
|
|
136
|
+
}
|
|
137
|
+
dispose() {
|
|
138
|
+
this._backdrop.dispose();
|
|
139
|
+
this._focustrap.deactivate();
|
|
140
|
+
super.dispose();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Private
|
|
144
|
+
_initializeBackDrop() {
|
|
145
|
+
const clickCallback = () => {
|
|
146
|
+
if (this._config.backdrop === 'static') {
|
|
147
|
+
EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
this.hide();
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
// 'static' option will be translated to true, and booleans will keep their value
|
|
154
|
+
const isVisible = Boolean(this._config.backdrop);
|
|
155
|
+
return new Backdrop({
|
|
156
|
+
className: CLASS_NAME_BACKDROP,
|
|
157
|
+
isVisible,
|
|
158
|
+
isAnimated: true,
|
|
159
|
+
rootElement: this._element.parentNode,
|
|
160
|
+
clickCallback: isVisible ? clickCallback : null
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
_initializeFocusTrap() {
|
|
164
|
+
return new FocusTrap({
|
|
165
|
+
trapElement: this._element
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
_addEventListeners() {
|
|
169
|
+
EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {
|
|
170
|
+
if (event.key !== ESCAPE_KEY) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (this._config.keyboard) {
|
|
174
|
+
this.hide();
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Static
|
|
182
|
+
static jQueryInterface(config) {
|
|
183
|
+
return this.each(function () {
|
|
184
|
+
const data = Offcanvas.getOrCreateInstance(this, config);
|
|
185
|
+
if (typeof config !== 'string') {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
|
|
189
|
+
throw new TypeError(`No method named "${config}"`);
|
|
190
|
+
}
|
|
191
|
+
data[config](this);
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Data API implementation
|
|
198
|
+
*/
|
|
199
|
+
|
|
200
|
+
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
|
|
201
|
+
const target = SelectorEngine.getElementFromSelector(this);
|
|
202
|
+
if (['A', 'AREA'].includes(this.tagName)) {
|
|
203
|
+
event.preventDefault();
|
|
204
|
+
}
|
|
205
|
+
if (index_js.isDisabled(this)) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
EventHandler.one(target, EVENT_HIDDEN, () => {
|
|
209
|
+
// focus on trigger when it is closed
|
|
210
|
+
if (index_js.isVisible(this)) {
|
|
211
|
+
this.focus();
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
// avoid conflict when clicking a toggler of an offcanvas, while another is open
|
|
216
|
+
const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR);
|
|
217
|
+
if (alreadyOpen && alreadyOpen !== target) {
|
|
218
|
+
Offcanvas.getInstance(alreadyOpen).hide();
|
|
219
|
+
}
|
|
220
|
+
const data = Offcanvas.getOrCreateInstance(target);
|
|
221
|
+
data.toggle(this);
|
|
222
|
+
});
|
|
223
|
+
EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
|
|
224
|
+
for (const selector of SelectorEngine.find(OPEN_SELECTOR)) {
|
|
225
|
+
Offcanvas.getOrCreateInstance(selector).show();
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
EventHandler.on(window, EVENT_RESIZE, () => {
|
|
229
|
+
for (const element of SelectorEngine.find('[aria-modal][class*=show][class*=offcanvas-]')) {
|
|
230
|
+
if (getComputedStyle(element).position !== 'fixed') {
|
|
231
|
+
Offcanvas.getOrCreateInstance(element).hide();
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
componentFunctions_js.enableDismissTrigger(Offcanvas);
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* jQuery
|
|
239
|
+
*/
|
|
240
|
+
|
|
241
|
+
index_js.defineJQueryPlugin(Offcanvas);
|
|
242
|
+
|
|
243
|
+
return Offcanvas;
|
|
244
|
+
|
|
245
|
+
}));
|
|
246
|
+
//# sourceMappingURL=offcanvas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offcanvas.js","sources":["../src/offcanvas.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap offcanvas.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport BaseComponent from './base-component.js'\nimport EventHandler from './dom/event-handler.js'\nimport SelectorEngine from './dom/selector-engine.js'\nimport Backdrop from './util/backdrop.js'\nimport { enableDismissTrigger } from './util/component-functions.js'\nimport FocusTrap from './util/focustrap.js'\nimport {\n defineJQueryPlugin,\n isDisabled,\n isVisible\n} from './util/index.js'\nimport ScrollBarHelper from './util/scrollbar.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'offcanvas'\nconst DATA_KEY = 'bs.offcanvas'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\nconst EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`\nconst ESCAPE_KEY = 'Escape'\n\nconst CLASS_NAME_SHOW = 'show'\nconst CLASS_NAME_SHOWING = 'showing'\nconst CLASS_NAME_HIDING = 'hiding'\nconst CLASS_NAME_BACKDROP = 'offcanvas-backdrop'\nconst OPEN_SELECTOR = '.offcanvas.show'\n\nconst EVENT_SHOW = `show${EVENT_KEY}`\nconst EVENT_SHOWN = `shown${EVENT_KEY}`\nconst EVENT_HIDE = `hide${EVENT_KEY}`\nconst EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY}`\nconst EVENT_HIDDEN = `hidden${EVENT_KEY}`\nconst EVENT_RESIZE = `resize${EVENT_KEY}`\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\nconst EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY}`\n\nconst SELECTOR_DATA_TOGGLE = '[data-bs-toggle=\"offcanvas\"]'\n\nconst Default = {\n backdrop: true,\n keyboard: true,\n scroll: false\n}\n\nconst DefaultType = {\n backdrop: '(boolean|string)',\n keyboard: 'boolean',\n scroll: 'boolean'\n}\n\n/**\n * Class definition\n */\n\nclass Offcanvas extends BaseComponent {\n constructor(element, config) {\n super(element, config)\n\n this._isShown = false\n this._backdrop = this._initializeBackDrop()\n this._focustrap = this._initializeFocusTrap()\n this._addEventListeners()\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 toggle(relatedTarget) {\n return this._isShown ? this.hide() : this.show(relatedTarget)\n }\n\n show(relatedTarget) {\n if (this._isShown) {\n return\n }\n\n const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, { relatedTarget })\n\n if (showEvent.defaultPrevented) {\n return\n }\n\n this._isShown = true\n this._backdrop.show()\n\n if (!this._config.scroll) {\n new ScrollBarHelper().hide()\n }\n\n this._element.setAttribute('aria-modal', true)\n this._element.setAttribute('role', 'dialog')\n this._element.classList.add(CLASS_NAME_SHOWING)\n\n const completeCallBack = () => {\n if (!this._config.scroll || this._config.backdrop) {\n this._focustrap.activate()\n }\n\n this._element.classList.add(CLASS_NAME_SHOW)\n this._element.classList.remove(CLASS_NAME_SHOWING)\n EventHandler.trigger(this._element, EVENT_SHOWN, { relatedTarget })\n }\n\n this._queueCallback(completeCallBack, this._element, true)\n }\n\n hide() {\n if (!this._isShown) {\n return\n }\n\n const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE)\n\n if (hideEvent.defaultPrevented) {\n return\n }\n\n this._focustrap.deactivate()\n this._element.blur()\n this._isShown = false\n this._element.classList.add(CLASS_NAME_HIDING)\n this._backdrop.hide()\n\n const completeCallback = () => {\n this._element.classList.remove(CLASS_NAME_SHOW, CLASS_NAME_HIDING)\n this._element.removeAttribute('aria-modal')\n this._element.removeAttribute('role')\n\n if (!this._config.scroll) {\n new ScrollBarHelper().reset()\n }\n\n EventHandler.trigger(this._element, EVENT_HIDDEN)\n }\n\n this._queueCallback(completeCallback, this._element, true)\n }\n\n dispose() {\n this._backdrop.dispose()\n this._focustrap.deactivate()\n super.dispose()\n }\n\n // Private\n _initializeBackDrop() {\n const clickCallback = () => {\n if (this._config.backdrop === 'static') {\n EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED)\n return\n }\n\n this.hide()\n }\n\n // 'static' option will be translated to true, and booleans will keep their value\n const isVisible = Boolean(this._config.backdrop)\n\n return new Backdrop({\n className: CLASS_NAME_BACKDROP,\n isVisible,\n isAnimated: true,\n rootElement: this._element.parentNode,\n clickCallback: isVisible ? clickCallback : null\n })\n }\n\n _initializeFocusTrap() {\n return new FocusTrap({\n trapElement: this._element\n })\n }\n\n _addEventListeners() {\n EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {\n if (event.key !== ESCAPE_KEY) {\n return\n }\n\n if (this._config.keyboard) {\n this.hide()\n return\n }\n\n EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED)\n })\n }\n\n // Static\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Offcanvas.getOrCreateInstance(this, config)\n\n if (typeof config !== 'string') {\n return\n }\n\n if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config](this)\n })\n }\n}\n\n/**\n * Data API implementation\n */\n\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {\n const target = SelectorEngine.getElementFromSelector(this)\n\n if (['A', 'AREA'].includes(this.tagName)) {\n event.preventDefault()\n }\n\n if (isDisabled(this)) {\n return\n }\n\n EventHandler.one(target, EVENT_HIDDEN, () => {\n // focus on trigger when it is closed\n if (isVisible(this)) {\n this.focus()\n }\n })\n\n // avoid conflict when clicking a toggler of an offcanvas, while another is open\n const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR)\n if (alreadyOpen && alreadyOpen !== target) {\n Offcanvas.getInstance(alreadyOpen).hide()\n }\n\n const data = Offcanvas.getOrCreateInstance(target)\n data.toggle(this)\n})\n\nEventHandler.on(window, EVENT_LOAD_DATA_API, () => {\n for (const selector of SelectorEngine.find(OPEN_SELECTOR)) {\n Offcanvas.getOrCreateInstance(selector).show()\n }\n})\n\nEventHandler.on(window, EVENT_RESIZE, () => {\n for (const element of SelectorEngine.find('[aria-modal][class*=show][class*=offcanvas-]')) {\n if (getComputedStyle(element).position !== 'fixed') {\n Offcanvas.getOrCreateInstance(element).hide()\n }\n }\n})\n\nenableDismissTrigger(Offcanvas)\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Offcanvas)\n\nexport default Offcanvas\n"],"names":["NAME","DATA_KEY","EVENT_KEY","DATA_API_KEY","EVENT_LOAD_DATA_API","ESCAPE_KEY","CLASS_NAME_SHOW","CLASS_NAME_SHOWING","CLASS_NAME_HIDING","CLASS_NAME_BACKDROP","OPEN_SELECTOR","EVENT_SHOW","EVENT_SHOWN","EVENT_HIDE","EVENT_HIDE_PREVENTED","EVENT_HIDDEN","EVENT_RESIZE","EVENT_CLICK_DATA_API","EVENT_KEYDOWN_DISMISS","SELECTOR_DATA_TOGGLE","Default","backdrop","keyboard","scroll","DefaultType","Offcanvas","BaseComponent","constructor","element","config","_isShown","_backdrop","_initializeBackDrop","_focustrap","_initializeFocusTrap","_addEventListeners","toggle","relatedTarget","hide","show","showEvent","EventHandler","trigger","_element","defaultPrevented","_config","ScrollBarHelper","setAttribute","classList","add","completeCallBack","activate","remove","_queueCallback","hideEvent","deactivate","blur","completeCallback","removeAttribute","reset","dispose","clickCallback","isVisible","Boolean","Backdrop","className","isAnimated","rootElement","parentNode","FocusTrap","trapElement","on","event","key","jQueryInterface","each","data","getOrCreateInstance","undefined","startsWith","TypeError","document","target","SelectorEngine","getElementFromSelector","includes","tagName","preventDefault","isDisabled","one","focus","alreadyOpen","findOne","getInstance","window","selector","find","getComputedStyle","position","enableDismissTrigger","defineJQueryPlugin"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;;EAeA;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,YAAY,GAAG,WAAW;EAChC,MAAMC,mBAAmB,GAAG,CAAA,IAAA,EAAOF,SAAS,CAAA,EAAGC,YAAY,CAAA,CAAE;EAC7D,MAAME,UAAU,GAAG,QAAQ;EAE3B,MAAMC,eAAe,GAAG,MAAM;EAC9B,MAAMC,kBAAkB,GAAG,SAAS;EACpC,MAAMC,iBAAiB,GAAG,QAAQ;EAClC,MAAMC,mBAAmB,GAAG,oBAAoB;EAChD,MAAMC,aAAa,GAAG,iBAAiB;EAEvC,MAAMC,UAAU,GAAG,CAAA,IAAA,EAAOT,SAAS,CAAA,CAAE;EACrC,MAAMU,WAAW,GAAG,CAAA,KAAA,EAAQV,SAAS,CAAA,CAAE;EACvC,MAAMW,UAAU,GAAG,CAAA,IAAA,EAAOX,SAAS,CAAA,CAAE;EACrC,MAAMY,oBAAoB,GAAG,CAAA,aAAA,EAAgBZ,SAAS,CAAA,CAAE;EACxD,MAAMa,YAAY,GAAG,CAAA,MAAA,EAASb,SAAS,CAAA,CAAE;EACzC,MAAMc,YAAY,GAAG,CAAA,MAAA,EAASd,SAAS,CAAA,CAAE;EACzC,MAAMe,oBAAoB,GAAG,CAAA,KAAA,EAAQf,SAAS,CAAA,EAAGC,YAAY,CAAA,CAAE;EAC/D,MAAMe,qBAAqB,GAAG,CAAA,eAAA,EAAkBhB,SAAS,CAAA,CAAE;EAE3D,MAAMiB,oBAAoB,GAAG,8BAA8B;E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;EAClDN,EAAAA,IAAI,CAACxC,MAAM,CAAC,IAAI,CAAC;EACnB,CAAC,CAAC;EAEFK,YAAY,CAAC8B,EAAE,CAACuB,MAAM,EAAE1F,mBAAmB,EAAE,MAAM;IACjD,KAAK,MAAM2F,QAAQ,IAAIZ,cAAc,CAACa,IAAI,CAACtF,aAAa,CAAC,EAAE;MACzDe,SAAS,CAACoD,mBAAmB,CAACkB,QAAQ,CAAC,CAACxD,IAAI,EAAE;EAChD,EAAA;EACF,CAAC,CAAC;EAEFE,YAAY,CAAC8B,EAAE,CAACuB,MAAM,EAAE9E,YAAY,EAAE,MAAM;IAC1C,KAAK,MAAMY,OAAO,IAAIuD,cAAc,CAACa,IAAI,CAAC,8CAA8C,CAAC,EAAE;MACzF,IAAIC,gBAAgB,CAACrE,OAAO,CAAC,CAACsE,QAAQ,KAAK,OAAO,EAAE;QAClDzE,SAAS,CAACoD,mBAAmB,CAACjD,OAAO,CAAC,CAACU,IAAI,EAAE;EAC/C,IAAA;EACF,EAAA;EACF,CAAC,CAAC;AAEF6D,4CAAoB,CAAC1E,SAAS,CAAC;;EAE/B;EACA;EACA;;AAEA2E,6BAAkB,CAAC3E,SAAS,CAAC;;;;;;;;"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Bootstrap popover.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('./tooltip.js'), require('./util/index.js')) :
|
|
8
|
+
typeof define === 'function' && define.amd ? define(['./tooltip', './util/index'], factory) :
|
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Popover = factory(global.Tooltip, global.Index));
|
|
10
|
+
})(this, (function (Tooltip, index_js) { 'use strict';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* --------------------------------------------------------------------------
|
|
14
|
+
* Bootstrap popover.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 = 'popover';
|
|
25
|
+
const SELECTOR_TITLE = '.popover-header';
|
|
26
|
+
const SELECTOR_CONTENT = '.popover-body';
|
|
27
|
+
const Default = {
|
|
28
|
+
...Tooltip.Default,
|
|
29
|
+
content: '',
|
|
30
|
+
offset: [0, 8],
|
|
31
|
+
placement: 'right',
|
|
32
|
+
template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>',
|
|
33
|
+
trigger: 'click'
|
|
34
|
+
};
|
|
35
|
+
const DefaultType = {
|
|
36
|
+
...Tooltip.DefaultType,
|
|
37
|
+
content: '(null|string|element|function)'
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Class definition
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
class Popover extends Tooltip {
|
|
45
|
+
// Getters
|
|
46
|
+
static get Default() {
|
|
47
|
+
return Default;
|
|
48
|
+
}
|
|
49
|
+
static get DefaultType() {
|
|
50
|
+
return DefaultType;
|
|
51
|
+
}
|
|
52
|
+
static get NAME() {
|
|
53
|
+
return NAME;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Overrides
|
|
57
|
+
_isWithContent() {
|
|
58
|
+
return this._getTitle() || this._getContent();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Private
|
|
62
|
+
_getContentForTemplate() {
|
|
63
|
+
return {
|
|
64
|
+
[SELECTOR_TITLE]: this._getTitle(),
|
|
65
|
+
[SELECTOR_CONTENT]: this._getContent()
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
_getContent() {
|
|
69
|
+
return this._resolvePossibleFunction(this._config.content);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Static
|
|
73
|
+
static jQueryInterface(config) {
|
|
74
|
+
return this.each(function () {
|
|
75
|
+
const data = Popover.getOrCreateInstance(this, config);
|
|
76
|
+
if (typeof config !== 'string') {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (typeof data[config] === 'undefined') {
|
|
80
|
+
throw new TypeError(`No method named "${config}"`);
|
|
81
|
+
}
|
|
82
|
+
data[config]();
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* jQuery
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
index_js.defineJQueryPlugin(Popover);
|
|
92
|
+
|
|
93
|
+
return Popover;
|
|
94
|
+
|
|
95
|
+
}));
|
|
96
|
+
//# sourceMappingURL=popover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popover.js","sources":["../src/popover.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap popover.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport Tooltip from './tooltip.js'\nimport { defineJQueryPlugin } from './util/index.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'popover'\n\nconst SELECTOR_TITLE = '.popover-header'\nconst SELECTOR_CONTENT = '.popover-body'\n\nconst Default = {\n ...Tooltip.Default,\n content: '',\n offset: [0, 8],\n placement: 'right',\n template: '<div class=\"popover\" role=\"tooltip\">' +\n '<div class=\"popover-arrow\"></div>' +\n '<h3 class=\"popover-header\"></h3>' +\n '<div class=\"popover-body\"></div>' +\n '</div>',\n trigger: 'click'\n}\n\nconst DefaultType = {\n ...Tooltip.DefaultType,\n content: '(null|string|element|function)'\n}\n\n/**\n * Class definition\n */\n\nclass Popover extends Tooltip {\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 // Overrides\n _isWithContent() {\n return this._getTitle() || this._getContent()\n }\n\n // Private\n _getContentForTemplate() {\n return {\n [SELECTOR_TITLE]: this._getTitle(),\n [SELECTOR_CONTENT]: this._getContent()\n }\n }\n\n _getContent() {\n return this._resolvePossibleFunction(this._config.content)\n }\n\n // Static\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Popover.getOrCreateInstance(this, config)\n\n if (typeof config !== 'string') {\n return\n }\n\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config]()\n })\n }\n}\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Popover)\n\nexport default Popover\n"],"names":["NAME","SELECTOR_TITLE","SELECTOR_CONTENT","Default","Tooltip","content","offset","placement","template","trigger","DefaultType","Popover","_isWithContent","_getTitle","_getContent","_getContentForTemplate","_resolvePossibleFunction","_config","jQueryInterface","config","each","data","getOrCreateInstance","TypeError","defineJQueryPlugin"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;;EAKA;EACA;EACA;;EAEA,MAAMA,IAAI,GAAG,SAAS;EAEtB,MAAMC,cAAc,GAAG,iBAAiB;EACxC,MAAMC,gBAAgB,GAAG,eAAe;EAExC,MAAMC,OAAO,GAAG;IACd,GAAGC,OAAO,CAACD,OAAO;EAClBE,EAAAA,OAAO,EAAE,EAAE;EACXC,EAAAA,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;EACdC,EAAAA,SAAS,EAAE,OAAO;IAClBC,QAAQ,EAAE,sCAAsC,GAC9C,mCAAmC,GACnC,kCAAkC,GAClC,kCAAkC,GAClC,QAAQ;EACVC,EAAAA,OAAO,EAAE;EACX,CAAC;EAED,MAAMC,WAAW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AAEAK,6BAAkB,CAACb,OAAO,CAAC;;;;;;;;"}
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Bootstrap scrollspy.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('./base-component.js'), require('./dom/event-handler.js'), require('./dom/selector-engine.js'), require('./util/index.js')) :
|
|
8
|
+
typeof define === 'function' && define.amd ? define(['./base-component', './dom/event-handler', './dom/selector-engine', './util/index'], factory) :
|
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Scrollspy = factory(global.BaseComponent, global.EventHandler, global.SelectorEngine, global.Index));
|
|
10
|
+
})(this, (function (BaseComponent, EventHandler, SelectorEngine, index_js) { 'use strict';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* --------------------------------------------------------------------------
|
|
14
|
+
* Bootstrap scrollspy.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 = 'scrollspy';
|
|
25
|
+
const DATA_KEY = 'bs.scrollspy';
|
|
26
|
+
const EVENT_KEY = `.${DATA_KEY}`;
|
|
27
|
+
const DATA_API_KEY = '.data-api';
|
|
28
|
+
const EVENT_ACTIVATE = `activate${EVENT_KEY}`;
|
|
29
|
+
const EVENT_CLICK = `click${EVENT_KEY}`;
|
|
30
|
+
const EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`;
|
|
31
|
+
const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
|
|
32
|
+
const CLASS_NAME_ACTIVE = 'active';
|
|
33
|
+
const SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]';
|
|
34
|
+
const SELECTOR_TARGET_LINKS = '[href]';
|
|
35
|
+
const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
|
|
36
|
+
const SELECTOR_NAV_LINKS = '.nav-link';
|
|
37
|
+
const SELECTOR_NAV_ITEMS = '.nav-item';
|
|
38
|
+
const SELECTOR_LIST_ITEMS = '.list-group-item';
|
|
39
|
+
const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_NAV_ITEMS} > ${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`;
|
|
40
|
+
const SELECTOR_DROPDOWN = '.dropdown';
|
|
41
|
+
const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
|
|
42
|
+
const Default = {
|
|
43
|
+
offset: null,
|
|
44
|
+
// TODO: v6 @deprecated, keep it for backwards compatibility reasons
|
|
45
|
+
rootMargin: '0px 0px -25%',
|
|
46
|
+
smoothScroll: false,
|
|
47
|
+
target: null,
|
|
48
|
+
threshold: [0.1, 0.5, 1]
|
|
49
|
+
};
|
|
50
|
+
const DefaultType = {
|
|
51
|
+
offset: '(number|null)',
|
|
52
|
+
// TODO v6 @deprecated, keep it for backwards compatibility reasons
|
|
53
|
+
rootMargin: 'string',
|
|
54
|
+
smoothScroll: 'boolean',
|
|
55
|
+
target: 'element',
|
|
56
|
+
threshold: 'array'
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Class definition
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
class ScrollSpy extends BaseComponent {
|
|
64
|
+
constructor(element, config) {
|
|
65
|
+
super(element, config);
|
|
66
|
+
|
|
67
|
+
// this._element is the observablesContainer and config.target the menu links wrapper
|
|
68
|
+
this._targetLinks = new Map();
|
|
69
|
+
this._observableSections = new Map();
|
|
70
|
+
this._rootElement = getComputedStyle(this._element).overflowY === 'visible' ? null : this._element;
|
|
71
|
+
this._activeTarget = null;
|
|
72
|
+
this._observer = null;
|
|
73
|
+
this._previousScrollData = {
|
|
74
|
+
visibleEntryTop: 0,
|
|
75
|
+
parentScrollTop: 0
|
|
76
|
+
};
|
|
77
|
+
this.refresh(); // initialize
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Getters
|
|
81
|
+
static get Default() {
|
|
82
|
+
return Default;
|
|
83
|
+
}
|
|
84
|
+
static get DefaultType() {
|
|
85
|
+
return DefaultType;
|
|
86
|
+
}
|
|
87
|
+
static get NAME() {
|
|
88
|
+
return NAME;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Public
|
|
92
|
+
refresh() {
|
|
93
|
+
this._initializeTargetsAndObservables();
|
|
94
|
+
this._maybeEnableSmoothScroll();
|
|
95
|
+
if (this._observer) {
|
|
96
|
+
this._observer.disconnect();
|
|
97
|
+
} else {
|
|
98
|
+
this._observer = this._getNewObserver();
|
|
99
|
+
}
|
|
100
|
+
for (const section of this._observableSections.values()) {
|
|
101
|
+
this._observer.observe(section);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
dispose() {
|
|
105
|
+
this._observer.disconnect();
|
|
106
|
+
super.dispose();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Private
|
|
110
|
+
_configAfterMerge(config) {
|
|
111
|
+
// TODO: on v6 target should be given explicitly & remove the {target: 'ss-target'} case
|
|
112
|
+
config.target = index_js.getElement(config.target) || document.body;
|
|
113
|
+
|
|
114
|
+
// TODO: v6 Only for backwards compatibility reasons. Use rootMargin only
|
|
115
|
+
config.rootMargin = config.offset ? `${config.offset}px 0px -30%` : config.rootMargin;
|
|
116
|
+
if (typeof config.threshold === 'string') {
|
|
117
|
+
config.threshold = config.threshold.split(',').map(value => Number.parseFloat(value));
|
|
118
|
+
}
|
|
119
|
+
return config;
|
|
120
|
+
}
|
|
121
|
+
_maybeEnableSmoothScroll() {
|
|
122
|
+
if (!this._config.smoothScroll) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// unregister any previous listeners
|
|
127
|
+
EventHandler.off(this._config.target, EVENT_CLICK);
|
|
128
|
+
EventHandler.on(this._config.target, EVENT_CLICK, SELECTOR_TARGET_LINKS, event => {
|
|
129
|
+
const observableSection = this._observableSections.get(event.target.hash);
|
|
130
|
+
if (observableSection) {
|
|
131
|
+
event.preventDefault();
|
|
132
|
+
const root = this._rootElement || window;
|
|
133
|
+
const height = observableSection.offsetTop - this._element.offsetTop;
|
|
134
|
+
if (root.scrollTo) {
|
|
135
|
+
root.scrollTo({
|
|
136
|
+
top: height,
|
|
137
|
+
behavior: 'smooth'
|
|
138
|
+
});
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Chrome 60 doesn't support `scrollTo`
|
|
143
|
+
root.scrollTop = height;
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
_getNewObserver() {
|
|
148
|
+
const options = {
|
|
149
|
+
root: this._rootElement,
|
|
150
|
+
threshold: this._config.threshold,
|
|
151
|
+
rootMargin: this._config.rootMargin
|
|
152
|
+
};
|
|
153
|
+
return new IntersectionObserver(entries => this._observerCallback(entries), options);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// The logic of selection
|
|
157
|
+
_observerCallback(entries) {
|
|
158
|
+
const targetElement = entry => this._targetLinks.get(`#${entry.target.id}`);
|
|
159
|
+
const activate = entry => {
|
|
160
|
+
this._previousScrollData.visibleEntryTop = entry.target.offsetTop;
|
|
161
|
+
this._process(targetElement(entry));
|
|
162
|
+
};
|
|
163
|
+
const parentScrollTop = (this._rootElement || document.documentElement).scrollTop;
|
|
164
|
+
const userScrollsDown = parentScrollTop >= this._previousScrollData.parentScrollTop;
|
|
165
|
+
this._previousScrollData.parentScrollTop = parentScrollTop;
|
|
166
|
+
for (const entry of entries) {
|
|
167
|
+
if (!entry.isIntersecting) {
|
|
168
|
+
this._activeTarget = null;
|
|
169
|
+
this._clearActiveClass(targetElement(entry));
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
const entryIsLowerThanPrevious = entry.target.offsetTop >= this._previousScrollData.visibleEntryTop;
|
|
173
|
+
// if we are scrolling down, pick the bigger offsetTop
|
|
174
|
+
if (userScrollsDown && entryIsLowerThanPrevious) {
|
|
175
|
+
activate(entry);
|
|
176
|
+
// if parent isn't scrolled, let's keep the first visible item, breaking the iteration
|
|
177
|
+
if (!parentScrollTop) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// if we are scrolling up, pick the smallest offsetTop
|
|
184
|
+
if (!userScrollsDown && !entryIsLowerThanPrevious) {
|
|
185
|
+
activate(entry);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
_initializeTargetsAndObservables() {
|
|
190
|
+
this._targetLinks = new Map();
|
|
191
|
+
this._observableSections = new Map();
|
|
192
|
+
const targetLinks = SelectorEngine.find(SELECTOR_TARGET_LINKS, this._config.target);
|
|
193
|
+
for (const anchor of targetLinks) {
|
|
194
|
+
// ensure that the anchor has an id and is not disabled
|
|
195
|
+
if (!anchor.hash || index_js.isDisabled(anchor)) {
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
const observableSection = SelectorEngine.findOne(decodeURI(anchor.hash), this._element);
|
|
199
|
+
|
|
200
|
+
// ensure that the observableSection exists & is visible
|
|
201
|
+
if (index_js.isVisible(observableSection)) {
|
|
202
|
+
this._targetLinks.set(decodeURI(anchor.hash), anchor);
|
|
203
|
+
this._observableSections.set(anchor.hash, observableSection);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
_process(target) {
|
|
208
|
+
if (this._activeTarget === target) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
this._clearActiveClass(this._config.target);
|
|
212
|
+
this._activeTarget = target;
|
|
213
|
+
target.classList.add(CLASS_NAME_ACTIVE);
|
|
214
|
+
this._activateParents(target);
|
|
215
|
+
EventHandler.trigger(this._element, EVENT_ACTIVATE, {
|
|
216
|
+
relatedTarget: target
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
_activateParents(target) {
|
|
220
|
+
// Activate dropdown parents
|
|
221
|
+
if (target.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
|
|
222
|
+
SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE, target.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE);
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
for (const listGroup of SelectorEngine.parents(target, SELECTOR_NAV_LIST_GROUP)) {
|
|
226
|
+
// Set triggered links parents as active
|
|
227
|
+
// With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
|
|
228
|
+
for (const item of SelectorEngine.prev(listGroup, SELECTOR_LINK_ITEMS)) {
|
|
229
|
+
item.classList.add(CLASS_NAME_ACTIVE);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
_clearActiveClass(parent) {
|
|
234
|
+
parent.classList.remove(CLASS_NAME_ACTIVE);
|
|
235
|
+
const activeNodes = SelectorEngine.find(`${SELECTOR_TARGET_LINKS}.${CLASS_NAME_ACTIVE}`, parent);
|
|
236
|
+
for (const node of activeNodes) {
|
|
237
|
+
node.classList.remove(CLASS_NAME_ACTIVE);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// Static
|
|
242
|
+
static jQueryInterface(config) {
|
|
243
|
+
return this.each(function () {
|
|
244
|
+
const data = ScrollSpy.getOrCreateInstance(this, config);
|
|
245
|
+
if (typeof config !== 'string') {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
|
|
249
|
+
throw new TypeError(`No method named "${config}"`);
|
|
250
|
+
}
|
|
251
|
+
data[config]();
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Data API implementation
|
|
258
|
+
*/
|
|
259
|
+
|
|
260
|
+
EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
|
|
261
|
+
for (const spy of SelectorEngine.find(SELECTOR_DATA_SPY)) {
|
|
262
|
+
ScrollSpy.getOrCreateInstance(spy);
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* jQuery
|
|
268
|
+
*/
|
|
269
|
+
|
|
270
|
+
index_js.defineJQueryPlugin(ScrollSpy);
|
|
271
|
+
|
|
272
|
+
return ScrollSpy;
|
|
273
|
+
|
|
274
|
+
}));
|
|
275
|
+
//# sourceMappingURL=scrollspy.js.map
|