@openeuropa/bcl-bootstrap 0.14.0 → 0.18.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 (81) hide show
  1. package/bin/build-plugins.js +77 -160
  2. package/bootstrap-icons.js +211 -1
  3. package/js/dist/alert.js +6 -137
  4. package/js/dist/alert.js.map +1 -1
  5. package/js/dist/base-component.js +7 -109
  6. package/js/dist/base-component.js.map +1 -1
  7. package/js/dist/button.js +5 -65
  8. package/js/dist/button.js.map +1 -1
  9. package/js/dist/carousel.js +13 -190
  10. package/js/dist/carousel.js.map +1 -1
  11. package/js/dist/collapse.js +12 -170
  12. package/js/dist/collapse.js.map +1 -1
  13. package/js/dist/dom/data.js +0 -5
  14. package/js/dist/dom/data.js.map +1 -1
  15. package/js/dist/dom/event-handler.js +5 -29
  16. package/js/dist/dom/event-handler.js.map +1 -1
  17. package/js/dist/dom/manipulator.js +0 -5
  18. package/js/dist/dom/manipulator.js.map +1 -1
  19. package/js/dist/dom/selector-engine.js +5 -53
  20. package/js/dist/dom/selector-engine.js.map +1 -1
  21. package/js/dist/dropdown.js +23 -212
  22. package/js/dist/dropdown.js.map +1 -1
  23. package/js/dist/modal.js +18 -611
  24. package/js/dist/modal.js.map +1 -1
  25. package/js/dist/offcanvas.js +19 -610
  26. package/js/dist/offcanvas.js.map +1 -1
  27. package/js/dist/popover.js +5 -65
  28. package/js/dist/popover.js.map +1 -1
  29. package/js/dist/scrollspy.js +8 -147
  30. package/js/dist/scrollspy.js.map +1 -1
  31. package/js/dist/tab.js +8 -127
  32. package/js/dist/tab.js.map +1 -1
  33. package/js/dist/toast.js +8 -185
  34. package/js/dist/toast.js.map +1 -1
  35. package/js/dist/tooltip.js +18 -277
  36. package/js/dist/tooltip.js.map +1 -1
  37. package/js/dist/util/backdrop.js +138 -0
  38. package/js/dist/util/backdrop.js.map +1 -0
  39. package/js/dist/util/component-functions.js +42 -0
  40. package/js/dist/util/component-functions.js.map +1 -0
  41. package/js/dist/util/focustrap.js +118 -0
  42. package/js/dist/util/focustrap.js.map +1 -0
  43. package/js/dist/util/index.js +342 -0
  44. package/js/dist/util/index.js.map +1 -0
  45. package/js/dist/util/sanitizer.js +125 -0
  46. package/js/dist/util/sanitizer.js.map +1 -0
  47. package/js/dist/util/scrollbar.js +119 -0
  48. package/js/dist/util/scrollbar.js.map +1 -0
  49. package/package.json +4 -3
  50. package/plugins/alert.js +0 -230
  51. package/plugins/alert.js.map +0 -1
  52. package/plugins/base-component.js +0 -178
  53. package/plugins/base-component.js.map +0 -1
  54. package/plugins/button.js +0 -141
  55. package/plugins/button.js.map +0 -1
  56. package/plugins/carousel.js +0 -738
  57. package/plugins/carousel.js.map +0 -1
  58. package/plugins/collapse.js +0 -490
  59. package/plugins/collapse.js.map +0 -1
  60. package/plugins/dom/data.js +0 -64
  61. package/plugins/dom/data.js.map +0 -1
  62. package/plugins/dom/event-handler.js +0 -317
  63. package/plugins/dom/event-handler.js.map +0 -1
  64. package/plugins/dom/manipulator.js +0 -84
  65. package/plugins/dom/manipulator.js.map +0 -1
  66. package/plugins/dom/selector-engine.js +0 -123
  67. package/plugins/dom/selector-engine.js.map +0 -1
  68. package/plugins/dropdown.js +0 -682
  69. package/plugins/dropdown.js.map +0 -1
  70. package/plugins/modal.js +0 -1037
  71. package/plugins/modal.js.map +0 -1
  72. package/plugins/popover.js +0 -179
  73. package/plugins/popover.js.map +0 -1
  74. package/plugins/scrollspy.js +0 -386
  75. package/plugins/scrollspy.js.map +0 -1
  76. package/plugins/tab.js +0 -328
  77. package/plugins/tab.js.map +0 -1
  78. package/plugins/toast.js +0 -418
  79. package/plugins/toast.js.map +0 -1
  80. package/plugins/tooltip.js +0 -1001
  81. package/plugins/tooltip.js.map +0 -1
@@ -4,182 +4,99 @@
4
4
  * Script to build our plugins to use them separately.
5
5
  * Copyright 2020-2021 The Bootstrap Authors
6
6
  * Copyright 2020-2021 Twitter, Inc.
7
- * Licensed under MIT (https://github.com/twbs/../blob/main/LICENSE)
7
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
8
8
  */
9
9
 
10
- "use strict";
11
-
12
- const path = require("path");
13
- const rollup = require("rollup");
14
- const { babel } = require("@rollup/plugin-babel");
15
-
16
- const rootPath = path.resolve(__dirname, "../plugins");
17
- const plugins = [
18
- babel({
19
- // Only transpile our source code
20
- exclude: "node_modules/**",
21
- // Include the helpers in each file, at most one copy of each
22
- babelHelpers: "bundled",
23
- }),
24
- ];
25
- const bsPlugins = {
26
- Data: path.resolve(__dirname, "../js/src/dom/data.js"),
27
- EventHandler: path.resolve(__dirname, "../js/src/dom/event-handler.js"),
28
- Manipulator: path.resolve(__dirname, "../js/src/dom/manipulator.js"),
29
- SelectorEngine: path.resolve(__dirname, "../js/src/dom/selector-engine.js"),
30
- Alert: path.resolve(__dirname, "../js/src/alert.js"),
31
- Base: path.resolve(__dirname, "../js/src/base-component.js"),
32
- Button: path.resolve(__dirname, "../js/src/button.js"),
33
- Carousel: path.resolve(__dirname, "../js/src/carousel.js"),
34
- Collapse: path.resolve(__dirname, "../js/src/collapse.js"),
35
- Dropdown: path.resolve(__dirname, "../js/src/dropdown.js"),
36
- Modal: path.resolve(__dirname, "../js/src/modal.js"),
37
- Offcanvas: path.resolve(__dirname, "../js/src/modal.js"),
38
- Popover: path.resolve(__dirname, "../js/src/popover.js"),
39
- ScrollSpy: path.resolve(__dirname, "../js/src/scrollspy.js"),
40
- Tab: path.resolve(__dirname, "../js/src/tab.js"),
41
- Toast: path.resolve(__dirname, "../js/src/toast.js"),
42
- Tooltip: path.resolve(__dirname, "../js/src/tooltip.js"),
43
- };
44
-
45
- const defaultPluginConfig = {
46
- external: [
47
- bsPlugins.Data,
48
- bsPlugins.Base,
49
- bsPlugins.EventHandler,
50
- bsPlugins.SelectorEngine,
51
- ],
52
- globals: {
53
- [bsPlugins.Data]: "Data",
54
- [bsPlugins.Base]: "Base",
55
- [bsPlugins.EventHandler]: "EventHandler",
56
- [bsPlugins.SelectorEngine]: "SelectorEngine",
57
- },
58
- };
59
-
60
- const getConfigByPluginKey = (pluginKey) => {
61
- if (
62
- pluginKey === "Data" ||
63
- pluginKey === "Manipulator" ||
64
- pluginKey === "EventHandler" ||
65
- pluginKey === "SelectorEngine" ||
66
- pluginKey === "Util" ||
67
- pluginKey === "Sanitizer" ||
68
- pluginKey === "Backdrop"
69
- ) {
70
- return {
71
- external: [],
72
- };
73
- }
74
-
75
- if (
76
- pluginKey === "Alert" ||
77
- pluginKey === "Tab" ||
78
- pluginKey === "Offcanvas"
79
- ) {
80
- return defaultPluginConfig;
81
- }
82
-
83
- if (
84
- pluginKey === "Base" ||
85
- pluginKey === "Button" ||
86
- pluginKey === "Carousel" ||
87
- pluginKey === "Collapse" ||
88
- pluginKey === "Modal" ||
89
- pluginKey === "ScrollSpy"
90
- ) {
91
- const config = Object.assign(defaultPluginConfig);
92
- config.external.push(bsPlugins.Manipulator);
93
- config.globals[bsPlugins.Manipulator] = "Manipulator";
94
- return config;
95
- }
96
-
97
- if (pluginKey === "Dropdown" || pluginKey === "Tooltip") {
98
- const config = Object.assign(defaultPluginConfig);
99
- config.external.push(bsPlugins.Manipulator, "@popperjs/core");
100
- config.globals[bsPlugins.Manipulator] = "Manipulator";
101
- config.globals["@popperjs/core"] = "Popper";
102
- return config;
103
- }
104
-
105
- if (pluginKey === "Popover") {
106
- return {
107
- external: [bsPlugins.Data, bsPlugins.SelectorEngine, bsPlugins.Tooltip],
108
- globals: {
109
- [bsPlugins.Data]: "Data",
110
- [bsPlugins.SelectorEngine]: "SelectorEngine",
111
- [bsPlugins.Tooltip]: "Tooltip",
112
- },
113
- };
114
- }
10
+ 'use strict'
115
11
 
116
- if (pluginKey === "Toast") {
117
- return {
118
- external: [
119
- bsPlugins.Data,
120
- bsPlugins.Base,
121
- bsPlugins.EventHandler,
122
- bsPlugins.Manipulator,
123
- ],
124
- globals: {
125
- [bsPlugins.Data]: "Data",
126
- [bsPlugins.Base]: "Base",
127
- [bsPlugins.EventHandler]: "EventHandler",
128
- [bsPlugins.Manipulator]: "Manipulator",
129
- },
130
- };
131
- }
132
- };
12
+ const path = require('path')
13
+ const rollup = require('rollup')
14
+ const glob = require('glob')
15
+ const { babel } = require('@rollup/plugin-babel')
133
16
 
134
- const utilObjects = new Set(["Util", "Sanitizer", "Backdrop"]);
17
+ const srcPath = path.resolve(__dirname, '../js/src/')
18
+ const jsFiles = glob.sync(srcPath + '/**/*.js')
135
19
 
136
- const domObjects = new Set([
137
- "Data",
138
- "EventHandler",
139
- "Manipulator",
140
- "SelectorEngine",
141
- ]);
20
+ // Array which holds the resolved plugins
21
+ const resolvedPlugins = []
142
22
 
143
- const build = async (plugin) => {
144
- console.log(`Building ${plugin} plugin...`);
23
+ // Trims the "js" extension and uppercases => first letter, hyphens, backslashes & slashes
24
+ const filenameToEntity = filename => filename.replace('.js', '')
25
+ .replace(/(?:^|-|\/|\\)[a-z]/g, str => str.slice(-1).toUpperCase())
145
26
 
146
- const { external, globals } = getConfigByPluginKey(plugin);
147
- const pluginFilename = path.basename(bsPlugins[plugin]);
148
- let pluginPath = rootPath;
27
+ for (const file of jsFiles) {
28
+ resolvedPlugins.push({
29
+ src: file.replace('.js', ''),
30
+ dist: file.replace('src', 'dist'),
31
+ fileName: path.basename(file),
32
+ className: filenameToEntity(path.basename(file))
33
+ // safeClassName: filenameToEntity(path.relative(srcPath, file))
34
+ })
35
+ }
149
36
 
150
- if (utilObjects.has(plugin)) {
151
- pluginPath = `${rootPath}/util/`;
152
- }
153
-
154
- if (domObjects.has(plugin)) {
155
- pluginPath = `${rootPath}/dom/`;
156
- }
37
+ const build = async plugin => {
38
+ const globals = {}
157
39
 
158
40
  const bundle = await rollup.rollup({
159
- input: bsPlugins[plugin],
160
- plugins,
161
- external,
162
- });
41
+ input: plugin.src,
42
+ plugins: [
43
+ babel({
44
+ // Only transpile our source code
45
+ exclude: 'node_modules/**',
46
+ // Include the helpers in each file, at most one copy of each
47
+ babelHelpers: 'bundled'
48
+ })
49
+ ],
50
+ external: source => {
51
+ // Pattern to identify local files
52
+ const pattern = /^(\.{1,2})\//
53
+
54
+ // It's not a local file, e.g a Node.js package
55
+ if (!pattern.test(source)) {
56
+ globals[source] = source
57
+ return true
58
+ }
59
+
60
+ const usedPlugin = resolvedPlugins.find(plugin => {
61
+ return plugin.src.includes(source.replace(pattern, ''))
62
+ })
63
+
64
+ if (!usedPlugin) {
65
+ throw new Error(`Source ${source} is not mapped!`)
66
+ }
67
+
68
+ // We can change `Index` with `UtilIndex` etc if we use
69
+ // `safeClassName` instead of `className` everywhere
70
+ globals[path.normalize(usedPlugin.src)] = usedPlugin.className
71
+ return true
72
+ }
73
+ })
163
74
 
164
75
  await bundle.write({
165
- format: "umd",
166
- name: plugin,
76
+ format: 'umd',
77
+ name: plugin.className,
167
78
  sourcemap: true,
168
79
  globals,
169
- file: path.resolve(__dirname, `${pluginPath}/${pluginFilename}`),
170
- });
80
+ generatedCode: 'es2015',
81
+ file: plugin.dist
82
+ })
171
83
 
172
- console.log(`Building ${plugin} plugin... Done!`);
173
- };
84
+ console.log(`Built ${plugin.className}`)
85
+ }
174
86
 
175
- const main = async () => {
87
+ (async () => {
176
88
  try {
177
- await Promise.all(Object.keys(bsPlugins).map((plugin) => build(plugin)));
178
- } catch (error) {
179
- console.error(error);
89
+ const basename = path.basename(__filename)
90
+ const timeLabel = `[${basename}] finished`
180
91
 
181
- process.exit(1);
182
- }
183
- };
92
+ console.log('Building individual plugins...')
93
+ console.time(timeLabel)
94
+
95
+ await Promise.all(Object.values(resolvedPlugins).map(plugin => build(plugin)))
184
96
 
185
- main();
97
+ console.timeEnd(timeLabel)
98
+ } catch (error) {
99
+ console.error(error)
100
+ process.exit(1)
101
+ }
102
+ })()
@@ -1,4 +1,5 @@
1
1
  export default [
2
+ "123",
2
3
  "alarm-fill",
3
4
  "alarm",
4
5
  "align-bottom",
@@ -1323,5 +1324,214 @@ export default [
1323
1324
  "x",
1324
1325
  "youtube",
1325
1326
  "zoom-in",
1326
- "zoom-out"
1327
+ "zoom-out",
1328
+ "bank",
1329
+ "bank2",
1330
+ "bell-slash-fill",
1331
+ "bell-slash",
1332
+ "cash-coin",
1333
+ "check-lg",
1334
+ "coin",
1335
+ "currency-bitcoin",
1336
+ "currency-dollar",
1337
+ "currency-euro",
1338
+ "currency-exchange",
1339
+ "currency-pound",
1340
+ "currency-yen",
1341
+ "dash-lg",
1342
+ "exclamation-lg",
1343
+ "file-earmark-pdf-fill",
1344
+ "file-earmark-pdf",
1345
+ "file-pdf-fill",
1346
+ "file-pdf",
1347
+ "gender-ambiguous",
1348
+ "gender-female",
1349
+ "gender-male",
1350
+ "gender-trans",
1351
+ "headset-vr",
1352
+ "info-lg",
1353
+ "mastodon",
1354
+ "messenger",
1355
+ "piggy-bank-fill",
1356
+ "piggy-bank",
1357
+ "pin-map-fill",
1358
+ "pin-map",
1359
+ "plus-lg",
1360
+ "question-lg",
1361
+ "recycle",
1362
+ "reddit",
1363
+ "safe-fill",
1364
+ "safe2-fill",
1365
+ "safe2",
1366
+ "sd-card-fill",
1367
+ "sd-card",
1368
+ "skype",
1369
+ "slash-lg",
1370
+ "translate",
1371
+ "x-lg",
1372
+ "safe",
1373
+ "apple",
1374
+ "microsoft",
1375
+ "windows",
1376
+ "behance",
1377
+ "dribbble",
1378
+ "line",
1379
+ "medium",
1380
+ "paypal",
1381
+ "pinterest",
1382
+ "signal",
1383
+ "snapchat",
1384
+ "spotify",
1385
+ "stack-overflow",
1386
+ "strava",
1387
+ "wordpress",
1388
+ "vimeo",
1389
+ "activity",
1390
+ "easel2-fill",
1391
+ "easel2",
1392
+ "easel3-fill",
1393
+ "easel3",
1394
+ "fan",
1395
+ "fingerprint",
1396
+ "graph-down-arrow",
1397
+ "graph-up-arrow",
1398
+ "hypnotize",
1399
+ "magic",
1400
+ "person-rolodex",
1401
+ "person-video",
1402
+ "person-video2",
1403
+ "person-video3",
1404
+ "person-workspace",
1405
+ "radioactive",
1406
+ "webcam-fill",
1407
+ "webcam",
1408
+ "yin-yang",
1409
+ "bandaid-fill",
1410
+ "bandaid",
1411
+ "bluetooth",
1412
+ "body-text",
1413
+ "boombox",
1414
+ "boxes",
1415
+ "dpad-fill",
1416
+ "dpad",
1417
+ "ear-fill",
1418
+ "ear",
1419
+ "envelope-check-1",
1420
+ "envelope-check-fill",
1421
+ "envelope-check",
1422
+ "envelope-dash-1",
1423
+ "envelope-dash-fill",
1424
+ "envelope-dash",
1425
+ "envelope-exclamation-1",
1426
+ "envelope-exclamation-fill",
1427
+ "envelope-exclamation",
1428
+ "envelope-plus-fill",
1429
+ "envelope-plus",
1430
+ "envelope-slash-1",
1431
+ "envelope-slash-fill",
1432
+ "envelope-slash",
1433
+ "envelope-x-1",
1434
+ "envelope-x-fill",
1435
+ "envelope-x",
1436
+ "explicit-fill",
1437
+ "explicit",
1438
+ "git",
1439
+ "infinity",
1440
+ "list-columns-reverse",
1441
+ "list-columns",
1442
+ "meta",
1443
+ "mortorboard-fill",
1444
+ "mortorboard",
1445
+ "nintendo-switch",
1446
+ "pc-display-horizontal",
1447
+ "pc-display",
1448
+ "pc-horizontal",
1449
+ "pc",
1450
+ "playstation",
1451
+ "plus-slash-minus",
1452
+ "projector-fill",
1453
+ "projector",
1454
+ "qr-code-scan",
1455
+ "qr-code",
1456
+ "quora",
1457
+ "quote",
1458
+ "robot",
1459
+ "send-check-fill",
1460
+ "send-check",
1461
+ "send-dash-fill",
1462
+ "send-dash",
1463
+ "send-exclamation-1",
1464
+ "send-exclamation-fill",
1465
+ "send-exclamation",
1466
+ "send-fill",
1467
+ "send-plus-fill",
1468
+ "send-plus",
1469
+ "send-slash-fill",
1470
+ "send-slash",
1471
+ "send-x-fill",
1472
+ "send-x",
1473
+ "send",
1474
+ "steam",
1475
+ "terminal-dash-1",
1476
+ "terminal-dash",
1477
+ "terminal-plus",
1478
+ "terminal-split",
1479
+ "ticket-detailed-fill",
1480
+ "ticket-detailed",
1481
+ "ticket-fill",
1482
+ "ticket-perferated-fill",
1483
+ "ticket-perferated",
1484
+ "ticket",
1485
+ "tiktok",
1486
+ "window-dash",
1487
+ "window-desktop",
1488
+ "window-fullscreen",
1489
+ "window-plus",
1490
+ "window-split",
1491
+ "window-stack",
1492
+ "window-x",
1493
+ "xbox",
1494
+ "ethernet",
1495
+ "hdmi-fill",
1496
+ "hdmi",
1497
+ "usb-c-fill",
1498
+ "usb-c",
1499
+ "usb-fill",
1500
+ "usb-plug-fill",
1501
+ "usb-plug",
1502
+ "usb-symbol",
1503
+ "usb",
1504
+ "boombox-fill",
1505
+ "displayport-1",
1506
+ "displayport",
1507
+ "gpu-card",
1508
+ "memory",
1509
+ "modem-fill",
1510
+ "modem",
1511
+ "motherboard-fill",
1512
+ "motherboard",
1513
+ "optical-audio-fill",
1514
+ "optical-audio",
1515
+ "pci-card",
1516
+ "router-fill",
1517
+ "router",
1518
+ "ssd-fill",
1519
+ "ssd",
1520
+ "thunderbolt-fill",
1521
+ "thunderbolt",
1522
+ "usb-drive-fill",
1523
+ "usb-drive",
1524
+ "usb-micro-fill",
1525
+ "usb-micro",
1526
+ "usb-mini-fill",
1527
+ "usb-mini",
1528
+ "cloud-haze2",
1529
+ "device-hdd-fill",
1530
+ "device-hdd",
1531
+ "device-ssd-fill",
1532
+ "device-ssd",
1533
+ "displayport-fill",
1534
+ "mortarboard-fill",
1535
+ "mortarboard",
1536
+ "terminal-x"
1327
1537
  ]
package/js/dist/alert.js CHANGED
@@ -1,145 +1,14 @@
1
- /*!
2
- * Bootstrap alert.js v5.1.3 (https://getbootstrap.com/)
3
- * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
- */
6
1
  (function (global, factory) {
7
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/event-handler.js'), require('./base-component.js')) :
8
- typeof define === 'function' && define.amd ? define(['./dom/event-handler', './base-component'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Alert = factory(global.EventHandler, global.Base));
10
- })(this, (function (EventHandler, BaseComponent) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./util/index'), require('./dom/event-handler'), require('./base-component'), require('./util/component-functions')) :
3
+ typeof define === 'function' && define.amd ? define(['./util/index', './dom/event-handler', './base-component', './util/component-functions'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Alert = factory(global.Index, global.EventHandler, global.BaseComponent, global.ComponentFunctions));
5
+ })(this, (function (index, EventHandler, BaseComponent, componentFunctions) { 'use strict';
11
6
 
12
7
  const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
13
8
 
14
9
  const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
15
10
  const BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
16
11
 
17
- /**
18
- * --------------------------------------------------------------------------
19
- * Bootstrap (v5.1.3): util/index.js
20
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
21
- * --------------------------------------------------------------------------
22
- */
23
-
24
- const getSelector = element => {
25
- let selector = element.getAttribute('data-bs-target');
26
-
27
- if (!selector || selector === '#') {
28
- let hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
29
- // so everything starting with `#` or `.`. If a "real" URL is used as the selector,
30
- // `document.querySelector` will rightfully complain it is invalid.
31
- // See https://github.com/twbs/bootstrap/issues/32273
32
-
33
- if (!hrefAttr || !hrefAttr.includes('#') && !hrefAttr.startsWith('.')) {
34
- return null;
35
- } // Just in case some CMS puts out a full URL with the anchor appended
36
-
37
-
38
- if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
39
- hrefAttr = `#${hrefAttr.split('#')[1]}`;
40
- }
41
-
42
- selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
43
- }
44
-
45
- return selector;
46
- };
47
-
48
- const getElementFromSelector = element => {
49
- const selector = getSelector(element);
50
- return selector ? document.querySelector(selector) : null;
51
- };
52
-
53
- const isDisabled = element => {
54
- if (!element || element.nodeType !== Node.ELEMENT_NODE) {
55
- return true;
56
- }
57
-
58
- if (element.classList.contains('disabled')) {
59
- return true;
60
- }
61
-
62
- if (typeof element.disabled !== 'undefined') {
63
- return element.disabled;
64
- }
65
-
66
- return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
67
- };
68
-
69
- const getjQuery = () => {
70
- const {
71
- jQuery
72
- } = window;
73
-
74
- if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
75
- return jQuery;
76
- }
77
-
78
- return null;
79
- };
80
-
81
- const DOMContentLoadedCallbacks = [];
82
-
83
- const onDOMContentLoaded = callback => {
84
- if (document.readyState === 'loading') {
85
- // add listener on the first call when the document is in loading state
86
- if (!DOMContentLoadedCallbacks.length) {
87
- document.addEventListener('DOMContentLoaded', () => {
88
- DOMContentLoadedCallbacks.forEach(callback => callback());
89
- });
90
- }
91
-
92
- DOMContentLoadedCallbacks.push(callback);
93
- } else {
94
- callback();
95
- }
96
- };
97
-
98
- const defineJQueryPlugin = plugin => {
99
- onDOMContentLoaded(() => {
100
- const $ = getjQuery();
101
- /* istanbul ignore if */
102
-
103
- if ($) {
104
- const name = plugin.NAME;
105
- const JQUERY_NO_CONFLICT = $.fn[name];
106
- $.fn[name] = plugin.jQueryInterface;
107
- $.fn[name].Constructor = plugin;
108
-
109
- $.fn[name].noConflict = () => {
110
- $.fn[name] = JQUERY_NO_CONFLICT;
111
- return plugin.jQueryInterface;
112
- };
113
- }
114
- });
115
- };
116
-
117
- /**
118
- * --------------------------------------------------------------------------
119
- * Bootstrap (v5.1.3): util/component-functions.js
120
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
121
- * --------------------------------------------------------------------------
122
- */
123
-
124
- const enableDismissTrigger = (component, method = 'hide') => {
125
- const clickEvent = `click.dismiss${component.EVENT_KEY}`;
126
- const name = component.NAME;
127
- EventHandler__default.default.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) {
128
- if (['A', 'AREA'].includes(this.tagName)) {
129
- event.preventDefault();
130
- }
131
-
132
- if (isDisabled(this)) {
133
- return;
134
- }
135
-
136
- const target = getElementFromSelector(this) || this.closest(`.${name}`);
137
- const instance = component.getOrCreateInstance(target); // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method
138
-
139
- instance[method]();
140
- });
141
- };
142
-
143
12
  /**
144
13
  * --------------------------------------------------------------------------
145
14
  * Bootstrap (v5.1.3): alert.js
@@ -219,7 +88,7 @@
219
88
  */
220
89
 
221
90
 
222
- enableDismissTrigger(Alert, 'close');
91
+ componentFunctions.enableDismissTrigger(Alert, 'close');
223
92
  /**
224
93
  * ------------------------------------------------------------------------
225
94
  * jQuery
@@ -227,7 +96,7 @@
227
96
  * add .Alert to jQuery only if jQuery is present
228
97
  */
229
98
 
230
- defineJQueryPlugin(Alert);
99
+ index.defineJQueryPlugin(Alert);
231
100
 
232
101
  return Alert;
233
102