insights4you-jekyll-theme 0.2.2 → 0.4.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.
Files changed (271) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +110 -0
  3. data/README.md +113 -30
  4. data/_data/i4y-colors.json +218 -0
  5. data/_data/i4y-social-media.yml +0 -2
  6. data/_includes/layout/footer.html +48 -0
  7. data/_includes/{head.html → layout/head.html} +40 -20
  8. data/_includes/layout/navbar-logo.html +137 -0
  9. data/_includes/layout/navbar.html +82 -0
  10. data/_includes/ui/button.html +13 -14
  11. data/_includes/ui/icon.html +24 -26
  12. data/_includes/ui/spinner.html +2 -0
  13. data/_includes/utils/banner.html +7 -0
  14. data/_includes/utils/settings.html +144 -0
  15. data/_layouts/base.html +63 -0
  16. data/_layouts/default.html +39 -16
  17. data/_sass/_bootstrap-components.scss +31 -0
  18. data/_sass/_bootstrap-config.scss +7 -0
  19. data/_sass/_bootstrap-override.scss +78 -0
  20. data/_sass/_config.scss +9 -0
  21. data/_sass/_core.scss +78 -0
  22. data/_sass/_debug.scss +49 -0
  23. data/_sass/_mixins.scss +2 -0
  24. data/_sass/_props.scss +91 -0
  25. data/_sass/_utilities-marketing.scss +209 -0
  26. data/_sass/_utilities.scss +135 -0
  27. data/_sass/_variables-dark.scss +19 -0
  28. data/_sass/_variables-marketing.scss +0 -0
  29. data/_sass/_variables.scss +1001 -0
  30. data/_sass/bootstrap/LICENSE +21 -0
  31. data/_sass/bootstrap/README.md +246 -0
  32. data/_sass/bootstrap/js/index.esm.js +19 -0
  33. data/_sass/bootstrap/js/index.umd.js +34 -0
  34. data/_sass/bootstrap/js/src/alert.js +87 -0
  35. data/_sass/bootstrap/js/src/base-component.js +85 -0
  36. data/_sass/bootstrap/js/src/button.js +72 -0
  37. data/_sass/bootstrap/js/src/carousel.js +474 -0
  38. data/_sass/bootstrap/js/src/collapse.js +297 -0
  39. data/_sass/bootstrap/js/src/dom/data.js +55 -0
  40. data/_sass/bootstrap/js/src/dom/event-handler.js +317 -0
  41. data/_sass/bootstrap/js/src/dom/manipulator.js +71 -0
  42. data/_sass/bootstrap/js/src/dom/selector-engine.js +126 -0
  43. data/_sass/bootstrap/js/src/dropdown.js +455 -0
  44. data/_sass/bootstrap/js/src/modal.js +378 -0
  45. data/_sass/bootstrap/js/src/offcanvas.js +282 -0
  46. data/_sass/bootstrap/js/src/popover.js +97 -0
  47. data/_sass/bootstrap/js/src/scrollspy.js +296 -0
  48. data/_sass/bootstrap/js/src/tab.js +315 -0
  49. data/_sass/bootstrap/js/src/toast.js +225 -0
  50. data/_sass/bootstrap/js/src/tooltip.js +633 -0
  51. data/_sass/bootstrap/js/src/util/backdrop.js +151 -0
  52. data/_sass/bootstrap/js/src/util/component-functions.js +35 -0
  53. data/_sass/bootstrap/js/src/util/config.js +65 -0
  54. data/_sass/bootstrap/js/src/util/focustrap.js +115 -0
  55. data/_sass/bootstrap/js/src/util/index.js +306 -0
  56. data/_sass/bootstrap/js/src/util/sanitizer.js +117 -0
  57. data/_sass/bootstrap/js/src/util/scrollbar.js +114 -0
  58. data/_sass/bootstrap/js/src/util/swipe.js +146 -0
  59. data/_sass/bootstrap/js/src/util/template-factory.js +160 -0
  60. data/_sass/bootstrap/package.json +184 -0
  61. data/_sass/bootstrap/scss/_accordion.scss +158 -0
  62. data/_sass/bootstrap/scss/_alert.scss +68 -0
  63. data/_sass/bootstrap/scss/_badge.scss +38 -0
  64. data/_sass/bootstrap/scss/_breadcrumb.scss +40 -0
  65. data/_sass/bootstrap/scss/_button-group.scss +142 -0
  66. data/_sass/bootstrap/scss/_buttons.scss +216 -0
  67. data/_sass/bootstrap/scss/_card.scss +239 -0
  68. data/_sass/bootstrap/scss/_carousel.scss +236 -0
  69. data/_sass/bootstrap/scss/_close.scss +63 -0
  70. data/_sass/bootstrap/scss/_containers.scss +41 -0
  71. data/_sass/bootstrap/scss/_dropdown.scss +250 -0
  72. data/_sass/bootstrap/scss/_forms.scss +9 -0
  73. data/_sass/bootstrap/scss/_functions.scss +302 -0
  74. data/_sass/bootstrap/scss/_grid.scss +39 -0
  75. data/_sass/bootstrap/scss/_helpers.scss +12 -0
  76. data/_sass/bootstrap/scss/_images.scss +42 -0
  77. data/_sass/bootstrap/scss/_list-group.scss +197 -0
  78. data/_sass/bootstrap/scss/_maps.scss +174 -0
  79. data/_sass/bootstrap/scss/_mixins.scss +42 -0
  80. data/_sass/bootstrap/scss/_modal.scss +236 -0
  81. data/_sass/bootstrap/scss/_nav.scss +197 -0
  82. data/_sass/bootstrap/scss/_navbar.scss +289 -0
  83. data/_sass/bootstrap/scss/_offcanvas.scss +143 -0
  84. data/_sass/bootstrap/scss/_pagination.scss +109 -0
  85. data/_sass/bootstrap/scss/_placeholders.scss +51 -0
  86. data/_sass/bootstrap/scss/_popover.scss +196 -0
  87. data/_sass/bootstrap/scss/_progress.scss +68 -0
  88. data/_sass/bootstrap/scss/_reboot.scss +611 -0
  89. data/_sass/bootstrap/scss/_root.scss +187 -0
  90. data/_sass/bootstrap/scss/_spinners.scss +85 -0
  91. data/_sass/bootstrap/scss/_tables.scss +171 -0
  92. data/_sass/bootstrap/scss/_toasts.scss +73 -0
  93. data/_sass/bootstrap/scss/_tooltip.scss +119 -0
  94. data/_sass/bootstrap/scss/_transitions.scss +27 -0
  95. data/_sass/bootstrap/scss/_type.scss +106 -0
  96. data/_sass/bootstrap/scss/_utilities.scss +806 -0
  97. data/_sass/bootstrap/scss/_variables-dark.scss +87 -0
  98. data/_sass/bootstrap/scss/_variables.scss +1751 -0
  99. data/_sass/bootstrap/scss/bootstrap-grid.scss +62 -0
  100. data/_sass/bootstrap/scss/bootstrap-reboot.scss +10 -0
  101. data/_sass/bootstrap/scss/bootstrap-utilities.scss +19 -0
  102. data/_sass/bootstrap/scss/bootstrap.scss +52 -0
  103. data/_sass/bootstrap/scss/forms/_floating-labels.scss +95 -0
  104. data/_sass/bootstrap/scss/forms/_form-check.scss +189 -0
  105. data/_sass/bootstrap/scss/forms/_form-control.scss +214 -0
  106. data/_sass/bootstrap/scss/forms/_form-range.scss +91 -0
  107. data/_sass/bootstrap/scss/forms/_form-select.scss +80 -0
  108. data/_sass/bootstrap/scss/forms/_form-text.scss +11 -0
  109. data/_sass/bootstrap/scss/forms/_input-group.scss +132 -0
  110. data/_sass/bootstrap/scss/forms/_labels.scss +36 -0
  111. data/_sass/bootstrap/scss/forms/_validation.scss +12 -0
  112. data/_sass/bootstrap/scss/helpers/_clearfix.scss +3 -0
  113. data/_sass/bootstrap/scss/helpers/_color-bg.scss +7 -0
  114. data/_sass/bootstrap/scss/helpers/_colored-links.scss +30 -0
  115. data/_sass/bootstrap/scss/helpers/_focus-ring.scss +5 -0
  116. data/_sass/bootstrap/scss/helpers/_icon-link.scss +25 -0
  117. data/_sass/bootstrap/scss/helpers/_position.scss +36 -0
  118. data/_sass/bootstrap/scss/helpers/_ratio.scss +26 -0
  119. data/_sass/bootstrap/scss/helpers/_stacks.scss +15 -0
  120. data/_sass/bootstrap/scss/helpers/_stretched-link.scss +15 -0
  121. data/_sass/bootstrap/scss/helpers/_text-truncation.scss +7 -0
  122. data/_sass/bootstrap/scss/helpers/_visually-hidden.scss +8 -0
  123. data/_sass/bootstrap/scss/helpers/_vr.scss +8 -0
  124. data/_sass/bootstrap/scss/mixins/_alert.scss +18 -0
  125. data/_sass/bootstrap/scss/mixins/_backdrop.scss +14 -0
  126. data/_sass/bootstrap/scss/mixins/_banner.scss +7 -0
  127. data/_sass/bootstrap/scss/mixins/_border-radius.scss +78 -0
  128. data/_sass/bootstrap/scss/mixins/_box-shadow.scss +18 -0
  129. data/_sass/bootstrap/scss/mixins/_breakpoints.scss +127 -0
  130. data/_sass/bootstrap/scss/mixins/_buttons.scss +70 -0
  131. data/_sass/bootstrap/scss/mixins/_caret.scss +69 -0
  132. data/_sass/bootstrap/scss/mixins/_clearfix.scss +9 -0
  133. data/_sass/bootstrap/scss/mixins/_color-mode.scss +21 -0
  134. data/_sass/bootstrap/scss/mixins/_color-scheme.scss +7 -0
  135. data/_sass/bootstrap/scss/mixins/_container.scss +11 -0
  136. data/_sass/bootstrap/scss/mixins/_deprecate.scss +10 -0
  137. data/_sass/bootstrap/scss/mixins/_forms.scss +163 -0
  138. data/_sass/bootstrap/scss/mixins/_gradients.scss +47 -0
  139. data/_sass/bootstrap/scss/mixins/_grid.scss +151 -0
  140. data/_sass/bootstrap/scss/mixins/_image.scss +16 -0
  141. data/_sass/bootstrap/scss/mixins/_list-group.scss +26 -0
  142. data/_sass/bootstrap/scss/mixins/_lists.scss +7 -0
  143. data/_sass/bootstrap/scss/mixins/_pagination.scss +10 -0
  144. data/_sass/bootstrap/scss/mixins/_reset-text.scss +17 -0
  145. data/_sass/bootstrap/scss/mixins/_resize.scss +6 -0
  146. data/_sass/bootstrap/scss/mixins/_table-variants.scss +24 -0
  147. data/_sass/bootstrap/scss/mixins/_text-truncate.scss +8 -0
  148. data/_sass/bootstrap/scss/mixins/_transition.scss +26 -0
  149. data/_sass/bootstrap/scss/mixins/_utilities.scss +97 -0
  150. data/_sass/bootstrap/scss/mixins/_visually-hidden.scss +33 -0
  151. data/_sass/bootstrap/scss/utilities/_api.scss +47 -0
  152. data/_sass/fonts/_webfonts.scss +15 -0
  153. data/_sass/helpers/_index.scss +143 -0
  154. data/_sass/layout/_animations.scss +63 -0
  155. data/_sass/layout/_core.scss +62 -0
  156. data/_sass/layout/_dark.scss +77 -0
  157. data/_sass/layout/_footer.scss +12 -0
  158. data/_sass/layout/_navbar.scss +392 -0
  159. data/_sass/layout/_page.scss +169 -0
  160. data/_sass/layout/_root.scss +64 -0
  161. data/_sass/marketing/_browser.scss +67 -0
  162. data/_sass/marketing/_core.scss +8 -0
  163. data/_sass/marketing/_filters.scss +0 -0
  164. data/_sass/marketing/_hero.scss +69 -0
  165. data/_sass/marketing/_pricing.scss +111 -0
  166. data/_sass/marketing/_sections.scss +124 -0
  167. data/_sass/marketing/_shape.scss +31 -0
  168. data/_sass/mixins/_functions.scss +96 -0
  169. data/_sass/mixins/_mixins.scss +68 -0
  170. data/_sass/tabler-flags.scss +2 -0
  171. data/_sass/tabler-marketing.scss +13 -0
  172. data/_sass/tabler-payments.scss +2 -0
  173. data/_sass/tabler-props.scss +1 -0
  174. data/_sass/tabler-socials.scss +2 -0
  175. data/_sass/tabler-themes.scss +121 -0
  176. data/_sass/tabler-vendors.scss +16 -0
  177. data/_sass/tabler.scss +2 -0
  178. data/_sass/ui/_accordion.scss +177 -0
  179. data/_sass/ui/_alerts.scss +99 -0
  180. data/_sass/ui/_avatars.scss +145 -0
  181. data/_sass/ui/_badges.scss +113 -0
  182. data/_sass/ui/_breadcrumbs.scss +50 -0
  183. data/_sass/ui/_button-group.scss +16 -0
  184. data/_sass/ui/_buttons.scss +261 -0
  185. data/_sass/ui/_calendars.scss +104 -0
  186. data/_sass/ui/_cards.scss +594 -0
  187. data/_sass/ui/_carousel.scss +68 -0
  188. data/_sass/ui/_charts.scss +61 -0
  189. data/_sass/ui/_chat.scss +38 -0
  190. data/_sass/ui/_chips.scss +0 -0
  191. data/_sass/ui/_close.scss +60 -0
  192. data/_sass/ui/_datagrid.scss +17 -0
  193. data/_sass/ui/_dropdowns.scss +120 -0
  194. data/_sass/ui/_empty.scss +60 -0
  195. data/_sass/ui/_flags.scss +31 -0
  196. data/_sass/ui/_forms.scss +241 -0
  197. data/_sass/ui/_grid.scss +115 -0
  198. data/_sass/ui/_icons.scss +72 -0
  199. data/_sass/ui/_images.scss +19 -0
  200. data/_sass/ui/_legend.scss +12 -0
  201. data/_sass/ui/_lists.scss +124 -0
  202. data/_sass/ui/_loaders.scss +72 -0
  203. data/_sass/ui/_login.scss +3 -0
  204. data/_sass/ui/_markdown.scss +43 -0
  205. data/_sass/ui/_modals.scss +67 -0
  206. data/_sass/ui/_nav.scss +96 -0
  207. data/_sass/ui/_offcanvas.scss +17 -0
  208. data/_sass/ui/_pagination.scss +58 -0
  209. data/_sass/ui/_payments.scss +28 -0
  210. data/_sass/ui/_placeholder.scss +9 -0
  211. data/_sass/ui/_popovers.scss +2 -0
  212. data/_sass/ui/_progress.scss +107 -0
  213. data/_sass/ui/_ribbons.scss +157 -0
  214. data/_sass/ui/_segmented.scss +101 -0
  215. data/_sass/ui/_signature.scss +15 -0
  216. data/_sass/ui/_social.scss +52 -0
  217. data/_sass/ui/_stars.scss +13 -0
  218. data/_sass/ui/_status.scss +163 -0
  219. data/_sass/ui/_steps.scss +156 -0
  220. data/_sass/ui/_switch-icon.scss +211 -0
  221. data/_sass/ui/_tables.scss +177 -0
  222. data/_sass/ui/_tags.scss +57 -0
  223. data/_sass/ui/_timeline.scss +61 -0
  224. data/_sass/ui/_toasts.scss +18 -0
  225. data/_sass/ui/_toolbar.scss +10 -0
  226. data/_sass/ui/_tracking.scss +29 -0
  227. data/_sass/ui/_type.scss +268 -0
  228. data/_sass/ui/forms/_form-check.scss +91 -0
  229. data/_sass/ui/forms/_form-colorinput.scss +54 -0
  230. data/_sass/ui/forms/_form-custom.scss +28 -0
  231. data/_sass/ui/forms/_form-icon.scss +35 -0
  232. data/_sass/ui/forms/_form-imagecheck.scss +105 -0
  233. data/_sass/ui/forms/_form-selectgroup.scss +153 -0
  234. data/_sass/ui/forms/_validation.scss +13 -0
  235. data/_sass/ui/typo/_hr.scss +77 -0
  236. data/_sass/utils/_background.scss +15 -0
  237. data/_sass/utils/_colors.scss +100 -0
  238. data/_sass/utils/_opacity.scss +7 -0
  239. data/_sass/utils/_scroll.scss +47 -0
  240. data/_sass/utils/_shadow.scss +9 -0
  241. data/_sass/utils/_sizing.scss +6 -0
  242. data/_sass/utils/_text.scss +15 -0
  243. data/_sass/vendors/_apexcharts.scss +48 -0
  244. data/_sass/vendors/_coloris.scss +72 -0
  245. data/_sass/vendors/_dropzone.scss +27 -0
  246. data/_sass/vendors/_fslightbox.scss +13 -0
  247. data/_sass/vendors/_jsvectormap.scss +47 -0
  248. data/_sass/vendors/_litepicker.scss +69 -0
  249. data/_sass/vendors/_nouislider.scss +49 -0
  250. data/_sass/vendors/_plyr.scss +3 -0
  251. data/_sass/vendors/_stars-rating.scss +22 -0
  252. data/_sass/vendors/_tinymce.scss +34 -0
  253. data/_sass/vendors/_tom-select.scss +81 -0
  254. data/_sass/vendors/_turbo.scss +3 -0
  255. data/_sass/vendors/_typed.scss +4 -0
  256. data/_sass/vendors/_wysiwyg.scss +34 -0
  257. data/assets/css/main.scss +10 -0
  258. data/assets/js/custom.js +175 -0
  259. data/assets/js/custom.min.js +1 -0
  260. data/assets/js/theme.js +12 -194
  261. data/assets/js/theme.min.js +12 -0
  262. data/insights4you-jekyll-theme.gemspec +93 -0
  263. metadata +386 -27
  264. data/_data/notifications.yml +0 -10
  265. data/_includes/footer.html +0 -48
  266. data/_includes/header-logo.html +0 -91
  267. data/_includes/header-navbar.html +0 -59
  268. data/_includes/header-svg.html +0 -275
  269. data/_layouts/home.html +0 -19
  270. data/_layouts/post.html +0 -19
  271. data/assets/css/theme.min.css +0 -120
@@ -0,0 +1,151 @@
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * Bootstrap util/backdrop.js
4
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
+ * --------------------------------------------------------------------------
6
+ */
7
+
8
+ import EventHandler from '../dom/event-handler.js'
9
+ import Config from './config.js'
10
+ import {
11
+ execute, executeAfterTransition, getElement, reflow
12
+ } from './index.js'
13
+
14
+ /**
15
+ * Constants
16
+ */
17
+
18
+ const NAME = 'backdrop'
19
+ const CLASS_NAME_FADE = 'fade'
20
+ const CLASS_NAME_SHOW = 'show'
21
+ const EVENT_MOUSEDOWN = `mousedown.bs.${NAME}`
22
+
23
+ const Default = {
24
+ className: 'modal-backdrop',
25
+ clickCallback: null,
26
+ isAnimated: false,
27
+ isVisible: true, // if false, we use the backdrop helper without adding any element to the dom
28
+ rootElement: 'body' // give the choice to place backdrop under different elements
29
+ }
30
+
31
+ const DefaultType = {
32
+ className: 'string',
33
+ clickCallback: '(function|null)',
34
+ isAnimated: 'boolean',
35
+ isVisible: 'boolean',
36
+ rootElement: '(element|string)'
37
+ }
38
+
39
+ /**
40
+ * Class definition
41
+ */
42
+
43
+ class Backdrop extends Config {
44
+ constructor(config) {
45
+ super()
46
+ this._config = this._getConfig(config)
47
+ this._isAppended = false
48
+ this._element = null
49
+ }
50
+
51
+ // Getters
52
+ static get Default() {
53
+ return Default
54
+ }
55
+
56
+ static get DefaultType() {
57
+ return DefaultType
58
+ }
59
+
60
+ static get NAME() {
61
+ return NAME
62
+ }
63
+
64
+ // Public
65
+ show(callback) {
66
+ if (!this._config.isVisible) {
67
+ execute(callback)
68
+ return
69
+ }
70
+
71
+ this._append()
72
+
73
+ const element = this._getElement()
74
+ if (this._config.isAnimated) {
75
+ reflow(element)
76
+ }
77
+
78
+ element.classList.add(CLASS_NAME_SHOW)
79
+
80
+ this._emulateAnimation(() => {
81
+ execute(callback)
82
+ })
83
+ }
84
+
85
+ hide(callback) {
86
+ if (!this._config.isVisible) {
87
+ execute(callback)
88
+ return
89
+ }
90
+
91
+ this._getElement().classList.remove(CLASS_NAME_SHOW)
92
+
93
+ this._emulateAnimation(() => {
94
+ this.dispose()
95
+ execute(callback)
96
+ })
97
+ }
98
+
99
+ dispose() {
100
+ if (!this._isAppended) {
101
+ return
102
+ }
103
+
104
+ EventHandler.off(this._element, EVENT_MOUSEDOWN)
105
+
106
+ this._element.remove()
107
+ this._isAppended = false
108
+ }
109
+
110
+ // Private
111
+ _getElement() {
112
+ if (!this._element) {
113
+ const backdrop = document.createElement('div')
114
+ backdrop.className = this._config.className
115
+ if (this._config.isAnimated) {
116
+ backdrop.classList.add(CLASS_NAME_FADE)
117
+ }
118
+
119
+ this._element = backdrop
120
+ }
121
+
122
+ return this._element
123
+ }
124
+
125
+ _configAfterMerge(config) {
126
+ // use getElement() with the default "body" to get a fresh Element on each instantiation
127
+ config.rootElement = getElement(config.rootElement)
128
+ return config
129
+ }
130
+
131
+ _append() {
132
+ if (this._isAppended) {
133
+ return
134
+ }
135
+
136
+ const element = this._getElement()
137
+ this._config.rootElement.append(element)
138
+
139
+ EventHandler.on(element, EVENT_MOUSEDOWN, () => {
140
+ execute(this._config.clickCallback)
141
+ })
142
+
143
+ this._isAppended = true
144
+ }
145
+
146
+ _emulateAnimation(callback) {
147
+ executeAfterTransition(callback, this._getElement(), this._config.isAnimated)
148
+ }
149
+ }
150
+
151
+ export default Backdrop
@@ -0,0 +1,35 @@
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * Bootstrap util/component-functions.js
4
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
+ * --------------------------------------------------------------------------
6
+ */
7
+
8
+ import EventHandler from '../dom/event-handler.js'
9
+ import SelectorEngine from '../dom/selector-engine.js'
10
+ import { isDisabled } from './index.js'
11
+
12
+ const enableDismissTrigger = (component, method = 'hide') => {
13
+ const clickEvent = `click.dismiss${component.EVENT_KEY}`
14
+ const name = component.NAME
15
+
16
+ EventHandler.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) {
17
+ if (['A', 'AREA'].includes(this.tagName)) {
18
+ event.preventDefault()
19
+ }
20
+
21
+ if (isDisabled(this)) {
22
+ return
23
+ }
24
+
25
+ const target = SelectorEngine.getElementFromSelector(this) || this.closest(`.${name}`)
26
+ const instance = component.getOrCreateInstance(target)
27
+
28
+ // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method
29
+ instance[method]()
30
+ })
31
+ }
32
+
33
+ export {
34
+ enableDismissTrigger
35
+ }
@@ -0,0 +1,65 @@
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * Bootstrap util/config.js
4
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
+ * --------------------------------------------------------------------------
6
+ */
7
+
8
+ import Manipulator from '../dom/manipulator.js'
9
+ import { isElement, toType } from './index.js'
10
+
11
+ /**
12
+ * Class definition
13
+ */
14
+
15
+ class Config {
16
+ // Getters
17
+ static get Default() {
18
+ return {}
19
+ }
20
+
21
+ static get DefaultType() {
22
+ return {}
23
+ }
24
+
25
+ static get NAME() {
26
+ throw new Error('You have to implement the static method "NAME", for each component!')
27
+ }
28
+
29
+ _getConfig(config) {
30
+ config = this._mergeConfigObj(config)
31
+ config = this._configAfterMerge(config)
32
+ this._typeCheckConfig(config)
33
+ return config
34
+ }
35
+
36
+ _configAfterMerge(config) {
37
+ return config
38
+ }
39
+
40
+ _mergeConfigObj(config, element) {
41
+ const jsonConfig = isElement(element) ? Manipulator.getDataAttribute(element, 'config') : {} // try to parse
42
+
43
+ return {
44
+ ...this.constructor.Default,
45
+ ...(typeof jsonConfig === 'object' ? jsonConfig : {}),
46
+ ...(isElement(element) ? Manipulator.getDataAttributes(element) : {}),
47
+ ...(typeof config === 'object' ? config : {})
48
+ }
49
+ }
50
+
51
+ _typeCheckConfig(config, configTypes = this.constructor.DefaultType) {
52
+ for (const [property, expectedTypes] of Object.entries(configTypes)) {
53
+ const value = config[property]
54
+ const valueType = isElement(value) ? 'element' : toType(value)
55
+
56
+ if (!new RegExp(expectedTypes).test(valueType)) {
57
+ throw new TypeError(
58
+ `${this.constructor.NAME.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`
59
+ )
60
+ }
61
+ }
62
+ }
63
+ }
64
+
65
+ export default Config
@@ -0,0 +1,115 @@
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * Bootstrap util/focustrap.js
4
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
+ * --------------------------------------------------------------------------
6
+ */
7
+
8
+ import EventHandler from '../dom/event-handler.js'
9
+ import SelectorEngine from '../dom/selector-engine.js'
10
+ import Config from './config.js'
11
+
12
+ /**
13
+ * Constants
14
+ */
15
+
16
+ const NAME = 'focustrap'
17
+ const DATA_KEY = 'bs.focustrap'
18
+ const EVENT_KEY = `.${DATA_KEY}`
19
+ const EVENT_FOCUSIN = `focusin${EVENT_KEY}`
20
+ const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY}`
21
+
22
+ const TAB_KEY = 'Tab'
23
+ const TAB_NAV_FORWARD = 'forward'
24
+ const TAB_NAV_BACKWARD = 'backward'
25
+
26
+ const Default = {
27
+ autofocus: true,
28
+ trapElement: null // The element to trap focus inside of
29
+ }
30
+
31
+ const DefaultType = {
32
+ autofocus: 'boolean',
33
+ trapElement: 'element'
34
+ }
35
+
36
+ /**
37
+ * Class definition
38
+ */
39
+
40
+ class FocusTrap extends Config {
41
+ constructor(config) {
42
+ super()
43
+ this._config = this._getConfig(config)
44
+ this._isActive = false
45
+ this._lastTabNavDirection = null
46
+ }
47
+
48
+ // Getters
49
+ static get Default() {
50
+ return Default
51
+ }
52
+
53
+ static get DefaultType() {
54
+ return DefaultType
55
+ }
56
+
57
+ static get NAME() {
58
+ return NAME
59
+ }
60
+
61
+ // Public
62
+ activate() {
63
+ if (this._isActive) {
64
+ return
65
+ }
66
+
67
+ if (this._config.autofocus) {
68
+ this._config.trapElement.focus()
69
+ }
70
+
71
+ EventHandler.off(document, EVENT_KEY) // guard against infinite focus loop
72
+ EventHandler.on(document, EVENT_FOCUSIN, event => this._handleFocusin(event))
73
+ EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event))
74
+
75
+ this._isActive = true
76
+ }
77
+
78
+ deactivate() {
79
+ if (!this._isActive) {
80
+ return
81
+ }
82
+
83
+ this._isActive = false
84
+ EventHandler.off(document, EVENT_KEY)
85
+ }
86
+
87
+ // Private
88
+ _handleFocusin(event) {
89
+ const { trapElement } = this._config
90
+
91
+ if (event.target === document || event.target === trapElement || trapElement.contains(event.target)) {
92
+ return
93
+ }
94
+
95
+ const elements = SelectorEngine.focusableChildren(trapElement)
96
+
97
+ if (elements.length === 0) {
98
+ trapElement.focus()
99
+ } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {
100
+ elements[elements.length - 1].focus()
101
+ } else {
102
+ elements[0].focus()
103
+ }
104
+ }
105
+
106
+ _handleKeydown(event) {
107
+ if (event.key !== TAB_KEY) {
108
+ return
109
+ }
110
+
111
+ this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD
112
+ }
113
+ }
114
+
115
+ export default FocusTrap
@@ -0,0 +1,306 @@
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * Bootstrap util/index.js
4
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
+ * --------------------------------------------------------------------------
6
+ */
7
+
8
+ const MAX_UID = 1_000_000
9
+ const MILLISECONDS_MULTIPLIER = 1000
10
+ const TRANSITION_END = 'transitionend'
11
+
12
+ /**
13
+ * Properly escape IDs selectors to handle weird IDs
14
+ * @param {string} selector
15
+ * @returns {string}
16
+ */
17
+ const parseSelector = selector => {
18
+ if (selector && window.CSS && window.CSS.escape) {
19
+ // document.querySelector needs escaping to handle IDs (html5+) containing for instance /
20
+ selector = selector.replace(/#([^\s"#']+)/g, (match, id) => `#${CSS.escape(id)}`)
21
+ }
22
+
23
+ return selector
24
+ }
25
+
26
+ // Shout-out Angus Croll (https://goo.gl/pxwQGp)
27
+ const toType = object => {
28
+ if (object === null || object === undefined) {
29
+ return `${object}`
30
+ }
31
+
32
+ return Object.prototype.toString.call(object).match(/\s([a-z]+)/i)[1].toLowerCase()
33
+ }
34
+
35
+ /**
36
+ * Public Util API
37
+ */
38
+
39
+ const getUID = prefix => {
40
+ do {
41
+ prefix += Math.floor(Math.random() * MAX_UID)
42
+ } while (document.getElementById(prefix))
43
+
44
+ return prefix
45
+ }
46
+
47
+ const getTransitionDurationFromElement = element => {
48
+ if (!element) {
49
+ return 0
50
+ }
51
+
52
+ // Get transition-duration of the element
53
+ let { transitionDuration, transitionDelay } = window.getComputedStyle(element)
54
+
55
+ const floatTransitionDuration = Number.parseFloat(transitionDuration)
56
+ const floatTransitionDelay = Number.parseFloat(transitionDelay)
57
+
58
+ // Return 0 if element or transition duration is not found
59
+ if (!floatTransitionDuration && !floatTransitionDelay) {
60
+ return 0
61
+ }
62
+
63
+ // If multiple durations are defined, take the first
64
+ transitionDuration = transitionDuration.split(',')[0]
65
+ transitionDelay = transitionDelay.split(',')[0]
66
+
67
+ return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER
68
+ }
69
+
70
+ const triggerTransitionEnd = element => {
71
+ element.dispatchEvent(new Event(TRANSITION_END))
72
+ }
73
+
74
+ const isElement = object => {
75
+ if (!object || typeof object !== 'object') {
76
+ return false
77
+ }
78
+
79
+ if (typeof object.jquery !== 'undefined') {
80
+ object = object[0]
81
+ }
82
+
83
+ return typeof object.nodeType !== 'undefined'
84
+ }
85
+
86
+ const getElement = object => {
87
+ // it's a jQuery object or a node element
88
+ if (isElement(object)) {
89
+ return object.jquery ? object[0] : object
90
+ }
91
+
92
+ if (typeof object === 'string' && object.length > 0) {
93
+ return document.querySelector(parseSelector(object))
94
+ }
95
+
96
+ return null
97
+ }
98
+
99
+ const isVisible = element => {
100
+ if (!isElement(element) || element.getClientRects().length === 0) {
101
+ return false
102
+ }
103
+
104
+ const elementIsVisible = getComputedStyle(element).getPropertyValue('visibility') === 'visible'
105
+ // Handle `details` element as its content may falsie appear visible when it is closed
106
+ const closedDetails = element.closest('details:not([open])')
107
+
108
+ if (!closedDetails) {
109
+ return elementIsVisible
110
+ }
111
+
112
+ if (closedDetails !== element) {
113
+ const summary = element.closest('summary')
114
+ if (summary && summary.parentNode !== closedDetails) {
115
+ return false
116
+ }
117
+
118
+ if (summary === null) {
119
+ return false
120
+ }
121
+ }
122
+
123
+ return elementIsVisible
124
+ }
125
+
126
+ const isDisabled = element => {
127
+ if (!element || element.nodeType !== Node.ELEMENT_NODE) {
128
+ return true
129
+ }
130
+
131
+ if (element.classList.contains('disabled')) {
132
+ return true
133
+ }
134
+
135
+ if (typeof element.disabled !== 'undefined') {
136
+ return element.disabled
137
+ }
138
+
139
+ return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false'
140
+ }
141
+
142
+ const findShadowRoot = element => {
143
+ if (!document.documentElement.attachShadow) {
144
+ return null
145
+ }
146
+
147
+ // Can find the shadow root otherwise it'll return the document
148
+ if (typeof element.getRootNode === 'function') {
149
+ const root = element.getRootNode()
150
+ return root instanceof ShadowRoot ? root : null
151
+ }
152
+
153
+ if (element instanceof ShadowRoot) {
154
+ return element
155
+ }
156
+
157
+ // when we don't find a shadow root
158
+ if (!element.parentNode) {
159
+ return null
160
+ }
161
+
162
+ return findShadowRoot(element.parentNode)
163
+ }
164
+
165
+ const noop = () => {}
166
+
167
+ /**
168
+ * Trick to restart an element's animation
169
+ *
170
+ * @param {HTMLElement} element
171
+ * @return void
172
+ *
173
+ * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation
174
+ */
175
+ const reflow = element => {
176
+ element.offsetHeight // eslint-disable-line no-unused-expressions
177
+ }
178
+
179
+ const getjQuery = () => {
180
+ if (window.jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
181
+ return window.jQuery
182
+ }
183
+
184
+ return null
185
+ }
186
+
187
+ const DOMContentLoadedCallbacks = []
188
+
189
+ const onDOMContentLoaded = callback => {
190
+ if (document.readyState === 'loading') {
191
+ // add listener on the first call when the document is in loading state
192
+ if (!DOMContentLoadedCallbacks.length) {
193
+ document.addEventListener('DOMContentLoaded', () => {
194
+ for (const callback of DOMContentLoadedCallbacks) {
195
+ callback()
196
+ }
197
+ })
198
+ }
199
+
200
+ DOMContentLoadedCallbacks.push(callback)
201
+ } else {
202
+ callback()
203
+ }
204
+ }
205
+
206
+ const isRTL = () => document.documentElement.dir === 'rtl'
207
+
208
+ const defineJQueryPlugin = plugin => {
209
+ onDOMContentLoaded(() => {
210
+ const $ = getjQuery()
211
+ /* istanbul ignore if */
212
+ if ($) {
213
+ const name = plugin.NAME
214
+ const JQUERY_NO_CONFLICT = $.fn[name]
215
+ $.fn[name] = plugin.jQueryInterface
216
+ $.fn[name].Constructor = plugin
217
+ $.fn[name].noConflict = () => {
218
+ $.fn[name] = JQUERY_NO_CONFLICT
219
+ return plugin.jQueryInterface
220
+ }
221
+ }
222
+ })
223
+ }
224
+
225
+ const execute = (possibleCallback, args = [], defaultValue = possibleCallback) => {
226
+ return typeof possibleCallback === 'function' ? possibleCallback(...args) : defaultValue
227
+ }
228
+
229
+ const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
230
+ if (!waitForTransition) {
231
+ execute(callback)
232
+ return
233
+ }
234
+
235
+ const durationPadding = 5
236
+ const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding
237
+
238
+ let called = false
239
+
240
+ const handler = ({ target }) => {
241
+ if (target !== transitionElement) {
242
+ return
243
+ }
244
+
245
+ called = true
246
+ transitionElement.removeEventListener(TRANSITION_END, handler)
247
+ execute(callback)
248
+ }
249
+
250
+ transitionElement.addEventListener(TRANSITION_END, handler)
251
+ setTimeout(() => {
252
+ if (!called) {
253
+ triggerTransitionEnd(transitionElement)
254
+ }
255
+ }, emulatedDuration)
256
+ }
257
+
258
+ /**
259
+ * Return the previous/next element of a list.
260
+ *
261
+ * @param {array} list The list of elements
262
+ * @param activeElement The active element
263
+ * @param shouldGetNext Choose to get next or previous element
264
+ * @param isCycleAllowed
265
+ * @return {Element|elem} The proper element
266
+ */
267
+ const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {
268
+ const listLength = list.length
269
+ let index = list.indexOf(activeElement)
270
+
271
+ // if the element does not exist in the list return an element
272
+ // depending on the direction and if cycle is allowed
273
+ if (index === -1) {
274
+ return !shouldGetNext && isCycleAllowed ? list[listLength - 1] : list[0]
275
+ }
276
+
277
+ index += shouldGetNext ? 1 : -1
278
+
279
+ if (isCycleAllowed) {
280
+ index = (index + listLength) % listLength
281
+ }
282
+
283
+ return list[Math.max(0, Math.min(index, listLength - 1))]
284
+ }
285
+
286
+ export {
287
+ defineJQueryPlugin,
288
+ execute,
289
+ executeAfterTransition,
290
+ findShadowRoot,
291
+ getElement,
292
+ getjQuery,
293
+ getNextActiveElement,
294
+ getTransitionDurationFromElement,
295
+ getUID,
296
+ isDisabled,
297
+ isElement,
298
+ isRTL,
299
+ isVisible,
300
+ noop,
301
+ onDOMContentLoaded,
302
+ parseSelector,
303
+ reflow,
304
+ triggerTransitionEnd,
305
+ toType
306
+ }