bootstrap 5.2.3 → 5.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/assets/javascripts/bootstrap/alert.js +22 -32
  4. data/assets/javascripts/bootstrap/base-component.js +22 -38
  5. data/assets/javascripts/bootstrap/button.js +19 -22
  6. data/assets/javascripts/bootstrap/carousel.js +52 -135
  7. data/assets/javascripts/bootstrap/collapse.js +40 -102
  8. data/assets/javascripts/bootstrap/dom/data.js +8 -12
  9. data/assets/javascripts/bootstrap/dom/event-handler.js +19 -66
  10. data/assets/javascripts/bootstrap/dom/manipulator.js +4 -17
  11. data/assets/javascripts/bootstrap/dom/selector-engine.js +42 -24
  12. data/assets/javascripts/bootstrap/dropdown.js +74 -145
  13. data/assets/javascripts/bootstrap/modal.js +53 -133
  14. data/assets/javascripts/bootstrap/offcanvas.js +50 -102
  15. data/assets/javascripts/bootstrap/popover.js +23 -29
  16. data/assets/javascripts/bootstrap/scrollspy.js +53 -90
  17. data/assets/javascripts/bootstrap/tab.js +62 -111
  18. data/assets/javascripts/bootstrap/toast.js +31 -73
  19. data/assets/javascripts/bootstrap/tooltip.js +75 -177
  20. data/assets/javascripts/bootstrap/util/backdrop.js +28 -54
  21. data/assets/javascripts/bootstrap/util/component-functions.js +13 -18
  22. data/assets/javascripts/bootstrap/util/config.js +15 -27
  23. data/assets/javascripts/bootstrap/util/focustrap.js +20 -36
  24. data/assets/javascripts/bootstrap/util/index.js +42 -111
  25. data/assets/javascripts/bootstrap/util/sanitizer.js +30 -42
  26. data/assets/javascripts/bootstrap/util/scrollbar.js +24 -50
  27. data/assets/javascripts/bootstrap/util/swipe.js +27 -48
  28. data/assets/javascripts/bootstrap/util/template-factory.js +25 -52
  29. data/assets/javascripts/bootstrap-sprockets.js +10 -10
  30. data/assets/javascripts/bootstrap.js +688 -1443
  31. data/assets/javascripts/bootstrap.min.js +3 -3
  32. data/assets/stylesheets/_bootstrap-grid.scss +1 -3
  33. data/assets/stylesheets/_bootstrap-reboot.scss +1 -0
  34. data/assets/stylesheets/_bootstrap.scss +1 -0
  35. data/assets/stylesheets/bootstrap/_accordion.scss +9 -0
  36. data/assets/stylesheets/bootstrap/_alert.scss +8 -11
  37. data/assets/stylesheets/bootstrap/_button-group.scss +2 -2
  38. data/assets/stylesheets/bootstrap/_buttons.scss +3 -3
  39. data/assets/stylesheets/bootstrap/_card.scss +5 -0
  40. data/assets/stylesheets/bootstrap/_carousel.scss +20 -2
  41. data/assets/stylesheets/bootstrap/_close.scss +32 -9
  42. data/assets/stylesheets/bootstrap/_dropdown.scss +1 -0
  43. data/assets/stylesheets/bootstrap/_functions.scss +1 -1
  44. data/assets/stylesheets/bootstrap/_grid.scss +6 -0
  45. data/assets/stylesheets/bootstrap/_helpers.scss +2 -0
  46. data/assets/stylesheets/bootstrap/_list-group.scss +12 -7
  47. data/assets/stylesheets/bootstrap/_maps.scss +120 -0
  48. data/assets/stylesheets/bootstrap/_mixins.scss +1 -2
  49. data/assets/stylesheets/bootstrap/_nav.scss +42 -17
  50. data/assets/stylesheets/bootstrap/_navbar.scss +15 -4
  51. data/assets/stylesheets/bootstrap/_offcanvas.scss +4 -2
  52. data/assets/stylesheets/bootstrap/_pagination.scss +1 -1
  53. data/assets/stylesheets/bootstrap/_progress.scss +10 -1
  54. data/assets/stylesheets/bootstrap/_reboot.scss +7 -7
  55. data/assets/stylesheets/bootstrap/_root.scss +121 -10
  56. data/assets/stylesheets/bootstrap/_tables.scss +18 -11
  57. data/assets/stylesheets/bootstrap/_tooltip.scss +4 -5
  58. data/assets/stylesheets/bootstrap/_utilities.scss +172 -13
  59. data/assets/stylesheets/bootstrap/_variables-dark.scss +85 -0
  60. data/assets/stylesheets/bootstrap/_variables.scss +268 -157
  61. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +1 -0
  62. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +23 -3
  63. data/assets/stylesheets/bootstrap/forms/_form-check.scss +25 -12
  64. data/assets/stylesheets/bootstrap/forms/_form-control.scss +24 -4
  65. data/assets/stylesheets/bootstrap/forms/_form-range.scss +3 -3
  66. data/assets/stylesheets/bootstrap/forms/_form-select.scss +12 -3
  67. data/assets/stylesheets/bootstrap/forms/_input-group.scss +1 -1
  68. data/assets/stylesheets/bootstrap/helpers/_color-bg.scss +1 -4
  69. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +20 -2
  70. data/assets/stylesheets/bootstrap/helpers/_focus-ring.scss +5 -0
  71. data/assets/stylesheets/bootstrap/helpers/_icon-link.scss +25 -0
  72. data/assets/stylesheets/bootstrap/helpers/_vr.scss +1 -1
  73. data/assets/stylesheets/bootstrap/mixins/_alert.scss +4 -1
  74. data/assets/stylesheets/bootstrap/mixins/_banner.scss +2 -4
  75. data/assets/stylesheets/bootstrap/mixins/_caret.scss +30 -25
  76. data/assets/stylesheets/bootstrap/mixins/_color-mode.scss +21 -0
  77. data/assets/stylesheets/bootstrap/mixins/_forms.scss +8 -7
  78. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +2 -0
  79. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +1 -1
  80. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +5 -1
  81. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +23 -29
  82. data/bootstrap.gemspec +1 -1
  83. data/lib/bootstrap/version.rb +2 -2
  84. data/tasks/updater/js.rb +1 -1
  85. data/tasks/updater/scss.rb +1 -1
  86. metadata +12 -8
@@ -1,25 +1,22 @@
1
1
  /*!
2
- * Bootstrap backdrop.js v5.2.3 (https://getbootstrap.com/)
3
- * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap backdrop.js v5.3.1 (https://getbootstrap.com/)
3
+ * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
6
6
  (function (global, factory) {
7
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../dom/event-handler'), require('./index'), require('./config')) :
8
- typeof define === 'function' && define.amd ? define(['../dom/event-handler', './index', './config'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Backdrop = factory(global.EventHandler, global.Index, global.Config));
10
- })(this, (function (EventHandler, index, Config) { 'use strict';
11
-
12
- const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
13
-
14
- const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
15
- const Config__default = /*#__PURE__*/_interopDefaultLegacy(Config);
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';
16
11
 
17
12
  /**
18
13
  * --------------------------------------------------------------------------
19
- * Bootstrap (v5.2.3): util/backdrop.js
14
+ * Bootstrap util/backdrop.js
20
15
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
21
16
  * --------------------------------------------------------------------------
22
17
  */
18
+
19
+
23
20
  /**
24
21
  * Constants
25
22
  */
@@ -35,8 +32,8 @@
35
32
  isVisible: true,
36
33
  // if false, we use the backdrop helper without adding any element to the dom
37
34
  rootElement: 'body' // give the choice to place backdrop under different elements
38
-
39
35
  };
36
+
40
37
  const DefaultType = {
41
38
  className: 'string',
42
39
  clickCallback: '(function|null)',
@@ -44,120 +41,97 @@
44
41
  isVisible: 'boolean',
45
42
  rootElement: '(element|string)'
46
43
  };
44
+
47
45
  /**
48
46
  * Class definition
49
47
  */
50
48
 
51
- class Backdrop extends Config__default.default {
49
+ class Backdrop extends Config {
52
50
  constructor(config) {
53
51
  super();
54
52
  this._config = this._getConfig(config);
55
53
  this._isAppended = false;
56
54
  this._element = null;
57
- } // Getters
58
-
55
+ }
59
56
 
57
+ // Getters
60
58
  static get Default() {
61
59
  return Default;
62
60
  }
63
-
64
61
  static get DefaultType() {
65
62
  return DefaultType;
66
63
  }
67
-
68
64
  static get NAME() {
69
65
  return NAME;
70
- } // Public
71
-
66
+ }
72
67
 
68
+ // Public
73
69
  show(callback) {
74
70
  if (!this._config.isVisible) {
75
- index.execute(callback);
71
+ index_js.execute(callback);
76
72
  return;
77
73
  }
78
-
79
74
  this._append();
80
-
81
75
  const element = this._getElement();
82
-
83
76
  if (this._config.isAnimated) {
84
- index.reflow(element);
77
+ index_js.reflow(element);
85
78
  }
86
-
87
79
  element.classList.add(CLASS_NAME_SHOW);
88
-
89
80
  this._emulateAnimation(() => {
90
- index.execute(callback);
81
+ index_js.execute(callback);
91
82
  });
92
83
  }
93
-
94
84
  hide(callback) {
95
85
  if (!this._config.isVisible) {
96
- index.execute(callback);
86
+ index_js.execute(callback);
97
87
  return;
98
88
  }
99
-
100
89
  this._getElement().classList.remove(CLASS_NAME_SHOW);
101
-
102
90
  this._emulateAnimation(() => {
103
91
  this.dispose();
104
- index.execute(callback);
92
+ index_js.execute(callback);
105
93
  });
106
94
  }
107
-
108
95
  dispose() {
109
96
  if (!this._isAppended) {
110
97
  return;
111
98
  }
112
-
113
- EventHandler__default.default.off(this._element, EVENT_MOUSEDOWN);
114
-
99
+ EventHandler.off(this._element, EVENT_MOUSEDOWN);
115
100
  this._element.remove();
116
-
117
101
  this._isAppended = false;
118
- } // Private
119
-
102
+ }
120
103
 
104
+ // Private
121
105
  _getElement() {
122
106
  if (!this._element) {
123
107
  const backdrop = document.createElement('div');
124
108
  backdrop.className = this._config.className;
125
-
126
109
  if (this._config.isAnimated) {
127
110
  backdrop.classList.add(CLASS_NAME_FADE);
128
111
  }
129
-
130
112
  this._element = backdrop;
131
113
  }
132
-
133
114
  return this._element;
134
115
  }
135
-
136
116
  _configAfterMerge(config) {
137
117
  // use getElement() with the default "body" to get a fresh Element on each instantiation
138
- config.rootElement = index.getElement(config.rootElement);
118
+ config.rootElement = index_js.getElement(config.rootElement);
139
119
  return config;
140
120
  }
141
-
142
121
  _append() {
143
122
  if (this._isAppended) {
144
123
  return;
145
124
  }
146
-
147
125
  const element = this._getElement();
148
-
149
126
  this._config.rootElement.append(element);
150
-
151
- EventHandler__default.default.on(element, EVENT_MOUSEDOWN, () => {
152
- index.execute(this._config.clickCallback);
127
+ EventHandler.on(element, EVENT_MOUSEDOWN, () => {
128
+ index_js.execute(this._config.clickCallback);
153
129
  });
154
130
  this._isAppended = true;
155
131
  }
156
-
157
132
  _emulateAnimation(callback) {
158
- index.executeAfterTransition(callback, this._getElement(), this._config.isAnimated);
133
+ index_js.executeAfterTransition(callback, this._getElement(), this._config.isAnimated);
159
134
  }
160
-
161
135
  }
162
136
 
163
137
  return Backdrop;
@@ -1,21 +1,17 @@
1
1
  /*!
2
- * Bootstrap component-functions.js v5.2.3 (https://getbootstrap.com/)
3
- * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap component-functions.js v5.3.1 (https://getbootstrap.com/)
3
+ * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
6
6
  (function (global, factory) {
7
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('../dom/event-handler'), require('./index')) :
8
- typeof define === 'function' && define.amd ? define(['exports', '../dom/event-handler', './index'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ComponentFunctions = {}, global.EventHandler, global.Index));
10
- })(this, (function (exports, EventHandler, index) { 'use strict';
11
-
12
- const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
13
-
14
- const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
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';
15
11
 
16
12
  /**
17
13
  * --------------------------------------------------------------------------
18
- * Bootstrap (v5.2.3): util/component-functions.js
14
+ * Bootstrap util/component-functions.js
19
15
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
20
16
  * --------------------------------------------------------------------------
21
17
  */
@@ -23,24 +19,23 @@
23
19
  const enableDismissTrigger = (component, method = 'hide') => {
24
20
  const clickEvent = `click.dismiss${component.EVENT_KEY}`;
25
21
  const name = component.NAME;
26
- EventHandler__default.default.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) {
22
+ EventHandler.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) {
27
23
  if (['A', 'AREA'].includes(this.tagName)) {
28
24
  event.preventDefault();
29
25
  }
30
-
31
- if (index.isDisabled(this)) {
26
+ if (index_js.isDisabled(this)) {
32
27
  return;
33
28
  }
29
+ const target = SelectorEngine.getElementFromSelector(this) || this.closest(`.${name}`);
30
+ const instance = component.getOrCreateInstance(target);
34
31
 
35
- const target = index.getElementFromSelector(this) || this.closest(`.${name}`);
36
- const instance = component.getOrCreateInstance(target); // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method
37
-
32
+ // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method
38
33
  instance[method]();
39
34
  });
40
35
  };
41
36
 
42
37
  exports.enableDismissTrigger = enableDismissTrigger;
43
38
 
44
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
39
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
45
40
 
46
41
  }));
@@ -1,24 +1,22 @@
1
1
  /*!
2
- * Bootstrap config.js v5.2.3 (https://getbootstrap.com/)
3
- * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap config.js v5.3.1 (https://getbootstrap.com/)
3
+ * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
6
6
  (function (global, factory) {
7
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./index'), require('../dom/manipulator')) :
8
- typeof define === 'function' && define.amd ? define(['./index', '../dom/manipulator'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Config = factory(global.Index, global.Manipulator));
10
- })(this, (function (index, Manipulator) { 'use strict';
11
-
12
- const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
13
-
14
- const Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
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';
15
11
 
16
12
  /**
17
13
  * --------------------------------------------------------------------------
18
- * Bootstrap (v5.2.3): util/config.js
14
+ * Bootstrap util/config.js
19
15
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
20
16
  * --------------------------------------------------------------------------
21
17
  */
18
+
19
+
22
20
  /**
23
21
  * Class definition
24
22
  */
@@ -28,50 +26,40 @@
28
26
  static get Default() {
29
27
  return {};
30
28
  }
31
-
32
29
  static get DefaultType() {
33
30
  return {};
34
31
  }
35
-
36
32
  static get NAME() {
37
33
  throw new Error('You have to implement the static method "NAME", for each component!');
38
34
  }
39
-
40
35
  _getConfig(config) {
41
36
  config = this._mergeConfigObj(config);
42
37
  config = this._configAfterMerge(config);
43
-
44
38
  this._typeCheckConfig(config);
45
-
46
39
  return config;
47
40
  }
48
-
49
41
  _configAfterMerge(config) {
50
42
  return config;
51
43
  }
52
-
53
44
  _mergeConfigObj(config, element) {
54
- const jsonConfig = index.isElement(element) ? Manipulator__default.default.getDataAttribute(element, 'config') : {}; // try to parse
45
+ const jsonConfig = index_js.isElement(element) ? Manipulator.getDataAttribute(element, 'config') : {}; // try to parse
55
46
 
56
- return { ...this.constructor.Default,
47
+ return {
48
+ ...this.constructor.Default,
57
49
  ...(typeof jsonConfig === 'object' ? jsonConfig : {}),
58
- ...(index.isElement(element) ? Manipulator__default.default.getDataAttributes(element) : {}),
50
+ ...(index_js.isElement(element) ? Manipulator.getDataAttributes(element) : {}),
59
51
  ...(typeof config === 'object' ? config : {})
60
52
  };
61
53
  }
62
-
63
54
  _typeCheckConfig(config, configTypes = this.constructor.DefaultType) {
64
- for (const property of Object.keys(configTypes)) {
65
- const expectedTypes = configTypes[property];
55
+ for (const [property, expectedTypes] of Object.entries(configTypes)) {
66
56
  const value = config[property];
67
- const valueType = index.isElement(value) ? 'element' : index.toType(value);
68
-
57
+ const valueType = index_js.isElement(value) ? 'element' : index_js.toType(value);
69
58
  if (!new RegExp(expectedTypes).test(valueType)) {
70
59
  throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
71
60
  }
72
61
  }
73
62
  }
74
-
75
63
  }
76
64
 
77
65
  return Config;
@@ -1,26 +1,22 @@
1
1
  /*!
2
- * Bootstrap focustrap.js v5.2.3 (https://getbootstrap.com/)
3
- * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap focustrap.js v5.3.1 (https://getbootstrap.com/)
3
+ * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
6
6
  (function (global, factory) {
7
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../dom/event-handler'), require('../dom/selector-engine'), require('./config')) :
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../dom/event-handler.js'), require('../dom/selector-engine.js'), require('./config.js')) :
8
8
  typeof define === 'function' && define.amd ? define(['../dom/event-handler', '../dom/selector-engine', './config'], factory) :
9
9
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Focustrap = factory(global.EventHandler, global.SelectorEngine, global.Config));
10
10
  })(this, (function (EventHandler, SelectorEngine, Config) { 'use strict';
11
11
 
12
- const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
13
-
14
- const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
15
- const SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
16
- const Config__default = /*#__PURE__*/_interopDefaultLegacy(Config);
17
-
18
12
  /**
19
13
  * --------------------------------------------------------------------------
20
- * Bootstrap (v5.2.3): util/focustrap.js
14
+ * Bootstrap util/focustrap.js
21
15
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
22
16
  * --------------------------------------------------------------------------
23
17
  */
18
+
19
+
24
20
  /**
25
21
  * Constants
26
22
  */
@@ -36,75 +32,66 @@
36
32
  const Default = {
37
33
  autofocus: true,
38
34
  trapElement: null // The element to trap focus inside of
39
-
40
35
  };
36
+
41
37
  const DefaultType = {
42
38
  autofocus: 'boolean',
43
39
  trapElement: 'element'
44
40
  };
41
+
45
42
  /**
46
43
  * Class definition
47
44
  */
48
45
 
49
- class FocusTrap extends Config__default.default {
46
+ class FocusTrap extends Config {
50
47
  constructor(config) {
51
48
  super();
52
49
  this._config = this._getConfig(config);
53
50
  this._isActive = false;
54
51
  this._lastTabNavDirection = null;
55
- } // Getters
56
-
52
+ }
57
53
 
54
+ // Getters
58
55
  static get Default() {
59
56
  return Default;
60
57
  }
61
-
62
58
  static get DefaultType() {
63
59
  return DefaultType;
64
60
  }
65
-
66
61
  static get NAME() {
67
62
  return NAME;
68
- } // Public
69
-
63
+ }
70
64
 
65
+ // Public
71
66
  activate() {
72
67
  if (this._isActive) {
73
68
  return;
74
69
  }
75
-
76
70
  if (this._config.autofocus) {
77
71
  this._config.trapElement.focus();
78
72
  }
79
-
80
- EventHandler__default.default.off(document, EVENT_KEY); // guard against infinite focus loop
81
-
82
- EventHandler__default.default.on(document, EVENT_FOCUSIN, event => this._handleFocusin(event));
83
- EventHandler__default.default.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event));
73
+ EventHandler.off(document, EVENT_KEY); // guard against infinite focus loop
74
+ EventHandler.on(document, EVENT_FOCUSIN, event => this._handleFocusin(event));
75
+ EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event));
84
76
  this._isActive = true;
85
77
  }
86
-
87
78
  deactivate() {
88
79
  if (!this._isActive) {
89
80
  return;
90
81
  }
91
-
92
82
  this._isActive = false;
93
- EventHandler__default.default.off(document, EVENT_KEY);
94
- } // Private
95
-
83
+ EventHandler.off(document, EVENT_KEY);
84
+ }
96
85
 
86
+ // Private
97
87
  _handleFocusin(event) {
98
88
  const {
99
89
  trapElement
100
90
  } = this._config;
101
-
102
91
  if (event.target === document || event.target === trapElement || trapElement.contains(event.target)) {
103
92
  return;
104
93
  }
105
-
106
- const elements = SelectorEngine__default.default.focusableChildren(trapElement);
107
-
94
+ const elements = SelectorEngine.focusableChildren(trapElement);
108
95
  if (elements.length === 0) {
109
96
  trapElement.focus();
110
97
  } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {
@@ -113,15 +100,12 @@
113
100
  elements[0].focus();
114
101
  }
115
102
  }
116
-
117
103
  _handleKeydown(event) {
118
104
  if (event.key !== TAB_KEY) {
119
105
  return;
120
106
  }
121
-
122
107
  this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD;
123
108
  }
124
-
125
109
  }
126
110
 
127
111
  return FocusTrap;