gd-bs 6.6.90 → 6.6.92
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.
- package/build/bs.js +1 -1
- package/build/components/alert/index.js +2 -2
- package/build/components/button/index.js +13 -3
- package/build/components/custom-element.js +529 -0
- package/build/components/dropdown/index.js +30 -32
- package/build/components/floating-ui/index.js +375 -0
- package/build/components/index.js +4 -0
- package/build/components/modal/index.js +8 -2
- package/build/components/nav/index.js +7 -7
- package/build/components/nav/templates.js +1 -1
- package/build/components/popover/index.js +37 -201
- package/build/components/tooltip/index.js +40 -117
- package/build/custom-elements.js +46 -0
- package/build/index-icons.js +5 -5
- package/build/index.js +5 -5
- package/build/render.js +581 -0
- package/dev.html +229 -0
- package/dist/gd-bs-icons.js +1 -1
- package/dist/gd-bs-icons.js.LICENSE.txt +20 -216
- package/dist/gd-bs-icons.min.js +1 -1
- package/dist/gd-bs.d.ts +113 -150
- package/dist/gd-bs.js +1 -1
- package/dist/gd-bs.js.LICENSE.txt +20 -216
- package/dist/gd-bs.min.js +1 -1
- package/index.html +9 -3
- package/indexv2.html +572 -0
- package/package.json +5 -5
- package/pre-build.js +7 -0
- package/src/bs.scss +2 -2
- package/src/components/alert/index.ts +3 -3
- package/src/components/button/index.ts +12 -3
- package/src/components/custom-element.ts +532 -0
- package/src/components/dropdown/index.ts +30 -36
- package/src/components/dropdown/types.d.ts +4 -4
- package/src/components/floating-ui/index.ts +392 -0
- package/src/components/floating-ui/types.d.ts +73 -0
- package/src/components/form/controlTypes.d.ts +3 -3
- package/src/components/index.ts +6 -1
- package/src/components/modal/index.ts +10 -4
- package/src/components/modal/types.d.ts +3 -2
- package/src/components/nav/index.ts +7 -7
- package/src/components/nav/templates.ts +1 -1
- package/src/components/nav/types.d.ts +1 -0
- package/src/components/navbar/types.d.ts +2 -2
- package/src/components/popover/index.ts +39 -205
- package/src/components/popover/types.d.ts +12 -45
- package/src/components/tooltip/index.ts +33 -110
- package/src/components/tooltip/types.d.ts +9 -45
- package/src/components/tooltipGroup/types.d.ts +3 -2
- package/src/components/types.d.ts +0 -47
- package/src/custom-elements.js +46 -0
- package/src/index-icons.d.ts +1 -3
- package/src/index-icons.ts +4 -4
- package/src/index.d.ts +2 -2
- package/src/index.ts +4 -4
- package/src/render.ts +583 -0
- package/src/styles/_core.scss +0 -2
- package/src/styles/_custom.scss +3 -8
- package/src/styles/_floating-ui.scss +275 -0
- package/src/styles/_tippy.scss +0 -249
|
@@ -19,14 +19,14 @@ exports.Dropdown = exports.DropdownTypes = exports.DropdownPlacements = void 0;
|
|
|
19
19
|
var base_1 = require("../base");
|
|
20
20
|
var button_1 = require("../button");
|
|
21
21
|
var checkboxGroup_1 = require("../checkboxGroup");
|
|
22
|
-
var
|
|
22
|
+
var floating_ui_1 = require("../floating-ui");
|
|
23
23
|
var formItem_1 = require("./formItem");
|
|
24
24
|
var item_1 = require("./item");
|
|
25
25
|
var templates_1 = require("./templates");
|
|
26
26
|
/**
|
|
27
27
|
* Dropdown Types
|
|
28
28
|
*/
|
|
29
|
-
exports.DropdownPlacements =
|
|
29
|
+
exports.DropdownPlacements = floating_ui_1.FloatingUIPlacements;
|
|
30
30
|
exports.DropdownTypes = button_1.ButtonTypes;
|
|
31
31
|
// Gets the template
|
|
32
32
|
var GetHTML = function (props) {
|
|
@@ -57,9 +57,9 @@ var _Dropdown = /** @class */ (function (_super) {
|
|
|
57
57
|
var _this = _super.call(this, template, props) || this;
|
|
58
58
|
_this._autoSelect = null;
|
|
59
59
|
_this._cb = null;
|
|
60
|
+
_this._floatingUI = null;
|
|
60
61
|
_this._initFl = false;
|
|
61
62
|
_this._items = null;
|
|
62
|
-
_this._popover = null;
|
|
63
63
|
// Handles the click event outside of the menu to close it
|
|
64
64
|
_this.handleClick = function (ev) {
|
|
65
65
|
// See if we clicked within the menu
|
|
@@ -229,60 +229,57 @@ var _Dropdown = /** @class */ (function (_super) {
|
|
|
229
229
|
var toggle = this.el.querySelector(".dropdown-toggle");
|
|
230
230
|
if (toggle && this._elMenu) {
|
|
231
231
|
// Set the type, based on the current dropdown type
|
|
232
|
-
var popoverType =
|
|
232
|
+
var popoverType = floating_ui_1.FloatingUITypes.LightBorder;
|
|
233
233
|
switch (this.props.type) {
|
|
234
234
|
case exports.DropdownTypes.Danger:
|
|
235
235
|
case exports.DropdownTypes.OutlineDanger:
|
|
236
|
-
popoverType =
|
|
236
|
+
popoverType = floating_ui_1.FloatingUITypes.Danger;
|
|
237
237
|
break;
|
|
238
238
|
case exports.DropdownTypes.Dark:
|
|
239
239
|
case exports.DropdownTypes.OutlineDark:
|
|
240
|
-
popoverType =
|
|
240
|
+
popoverType = floating_ui_1.FloatingUITypes.Dark;
|
|
241
241
|
break;
|
|
242
242
|
case exports.DropdownTypes.Info:
|
|
243
243
|
case exports.DropdownTypes.OutlineInfo:
|
|
244
|
-
popoverType =
|
|
244
|
+
popoverType = floating_ui_1.FloatingUITypes.Info;
|
|
245
245
|
break;
|
|
246
246
|
case exports.DropdownTypes.Light:
|
|
247
247
|
case exports.DropdownTypes.OutlineLight:
|
|
248
248
|
case exports.DropdownTypes.Link:
|
|
249
249
|
case exports.DropdownTypes.OutlineLink:
|
|
250
|
-
popoverType =
|
|
250
|
+
popoverType = floating_ui_1.FloatingUITypes.Light;
|
|
251
251
|
break;
|
|
252
252
|
case exports.DropdownTypes.Primary:
|
|
253
253
|
case exports.DropdownTypes.OutlinePrimary:
|
|
254
|
-
popoverType =
|
|
254
|
+
popoverType = floating_ui_1.FloatingUITypes.Primary;
|
|
255
255
|
break;
|
|
256
256
|
case exports.DropdownTypes.Secondary:
|
|
257
257
|
case exports.DropdownTypes.OutlineSecondary:
|
|
258
|
-
popoverType =
|
|
258
|
+
popoverType = floating_ui_1.FloatingUITypes.Secondary;
|
|
259
259
|
break;
|
|
260
260
|
case exports.DropdownTypes.Success:
|
|
261
261
|
case exports.DropdownTypes.OutlineSuccess:
|
|
262
|
-
popoverType =
|
|
262
|
+
popoverType = floating_ui_1.FloatingUITypes.Success;
|
|
263
263
|
break;
|
|
264
264
|
case exports.DropdownTypes.Warning:
|
|
265
265
|
case exports.DropdownTypes.OutlineWarning:
|
|
266
|
-
popoverType =
|
|
266
|
+
popoverType = floating_ui_1.FloatingUITypes.Warning;
|
|
267
267
|
break;
|
|
268
268
|
}
|
|
269
|
-
// Create the
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
269
|
+
// Create the menu
|
|
270
|
+
this._floatingUI = (0, floating_ui_1.FloatingUI)({
|
|
271
|
+
className: "floating-dropdown",
|
|
272
|
+
elContent: this._elMenu,
|
|
273
|
+
elTarget: toggle,
|
|
274
|
+
placement: typeof (this.props.placement) === "number" ? this.props.placement : floating_ui_1.FloatingUIPlacements.BottomStart,
|
|
275
|
+
theme: popoverType,
|
|
274
276
|
options: {
|
|
275
277
|
arrow: false,
|
|
276
|
-
|
|
277
|
-
|
|
278
|
+
flip: true,
|
|
279
|
+
shift: true,
|
|
280
|
+
trigger: "click"
|
|
278
281
|
}
|
|
279
|
-
};
|
|
280
|
-
// Call the render event
|
|
281
|
-
props = this.props.onMenuRendering ? this.props.onMenuRendering(props) : props;
|
|
282
|
-
// Create a popover to display the menu
|
|
283
|
-
this._popover = (0, popover_1.Popover)(props);
|
|
284
|
-
// Set the popover content
|
|
285
|
-
this._popover.setContent(this._elMenu);
|
|
282
|
+
});
|
|
286
283
|
}
|
|
287
284
|
};
|
|
288
285
|
// Configures the dropdown for a form
|
|
@@ -594,13 +591,13 @@ var _Dropdown = /** @class */ (function (_super) {
|
|
|
594
591
|
});
|
|
595
592
|
Object.defineProperty(_Dropdown.prototype, "isVisible", {
|
|
596
593
|
// Returns true if the dropdown menu is visible
|
|
597
|
-
get: function () { return this.
|
|
594
|
+
get: function () { return this._floatingUI ? this._floatingUI.isVisible : false; },
|
|
598
595
|
enumerable: false,
|
|
599
596
|
configurable: true
|
|
600
597
|
});
|
|
601
|
-
Object.defineProperty(_Dropdown.prototype, "
|
|
602
|
-
// The
|
|
603
|
-
get: function () { return this.
|
|
598
|
+
Object.defineProperty(_Dropdown.prototype, "floatingUI", {
|
|
599
|
+
// The floating ui menu
|
|
600
|
+
get: function () { return this._floatingUI; },
|
|
604
601
|
enumerable: false,
|
|
605
602
|
configurable: true
|
|
606
603
|
});
|
|
@@ -639,6 +636,7 @@ var _Dropdown = /** @class */ (function (_super) {
|
|
|
639
636
|
};
|
|
640
637
|
// Sets the label of the dropdown
|
|
641
638
|
_Dropdown.prototype.setLabel = function (value) {
|
|
639
|
+
if (value === void 0) { value = ""; }
|
|
642
640
|
// Get the dropdown
|
|
643
641
|
var ddl = this.el.querySelector(".dropdown-toggle");
|
|
644
642
|
if (ddl) {
|
|
@@ -729,7 +727,7 @@ var _Dropdown = /** @class */ (function (_super) {
|
|
|
729
727
|
// See if we are updating the label
|
|
730
728
|
if (this.props.updateLabel) {
|
|
731
729
|
// See if a value exists
|
|
732
|
-
if (value) {
|
|
730
|
+
if (value && typeof (value) === "string") {
|
|
733
731
|
// Set the label
|
|
734
732
|
this.setLabel(value);
|
|
735
733
|
}
|
|
@@ -748,7 +746,7 @@ var _Dropdown = /** @class */ (function (_super) {
|
|
|
748
746
|
// Toggles the menu
|
|
749
747
|
_Dropdown.prototype.toggle = function () {
|
|
750
748
|
// Toggle the popover
|
|
751
|
-
this.
|
|
749
|
+
this._floatingUI ? this._floatingUI.toggle() : null;
|
|
752
750
|
};
|
|
753
751
|
return _Dropdown;
|
|
754
752
|
}(base_1.Base));
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FloatingUI = exports.FloatingUITypes = exports.FloatingUIPlacements = exports.FloatingUILib = void 0;
|
|
4
|
+
var dom_1 = require("@floating-ui/dom");
|
|
5
|
+
var common_1 = require("../common");
|
|
6
|
+
exports.FloatingUILib = require("@floating-ui/dom");
|
|
7
|
+
/**
|
|
8
|
+
* Floating UI Placements
|
|
9
|
+
*/
|
|
10
|
+
var FloatingUIPlacements;
|
|
11
|
+
(function (FloatingUIPlacements) {
|
|
12
|
+
FloatingUIPlacements[FloatingUIPlacements["Auto"] = 1] = "Auto";
|
|
13
|
+
FloatingUIPlacements[FloatingUIPlacements["AutoStart"] = 2] = "AutoStart";
|
|
14
|
+
FloatingUIPlacements[FloatingUIPlacements["AutoEnd"] = 3] = "AutoEnd";
|
|
15
|
+
FloatingUIPlacements[FloatingUIPlacements["Bottom"] = 4] = "Bottom";
|
|
16
|
+
FloatingUIPlacements[FloatingUIPlacements["BottomStart"] = 5] = "BottomStart";
|
|
17
|
+
FloatingUIPlacements[FloatingUIPlacements["BottomEnd"] = 6] = "BottomEnd";
|
|
18
|
+
FloatingUIPlacements[FloatingUIPlacements["Left"] = 7] = "Left";
|
|
19
|
+
FloatingUIPlacements[FloatingUIPlacements["LeftStart"] = 8] = "LeftStart";
|
|
20
|
+
FloatingUIPlacements[FloatingUIPlacements["LeftEnd"] = 9] = "LeftEnd";
|
|
21
|
+
FloatingUIPlacements[FloatingUIPlacements["Right"] = 10] = "Right";
|
|
22
|
+
FloatingUIPlacements[FloatingUIPlacements["RightStart"] = 11] = "RightStart";
|
|
23
|
+
FloatingUIPlacements[FloatingUIPlacements["RightEnd"] = 12] = "RightEnd";
|
|
24
|
+
FloatingUIPlacements[FloatingUIPlacements["Top"] = 13] = "Top";
|
|
25
|
+
FloatingUIPlacements[FloatingUIPlacements["TopStart"] = 14] = "TopStart";
|
|
26
|
+
FloatingUIPlacements[FloatingUIPlacements["TopEnd"] = 15] = "TopEnd";
|
|
27
|
+
})(FloatingUIPlacements = exports.FloatingUIPlacements || (exports.FloatingUIPlacements = {}));
|
|
28
|
+
/**
|
|
29
|
+
* Floating UI Types
|
|
30
|
+
*/
|
|
31
|
+
var FloatingUITypes;
|
|
32
|
+
(function (FloatingUITypes) {
|
|
33
|
+
FloatingUITypes[FloatingUITypes["Danger"] = 1] = "Danger";
|
|
34
|
+
FloatingUITypes[FloatingUITypes["Dark"] = 2] = "Dark";
|
|
35
|
+
FloatingUITypes[FloatingUITypes["Info"] = 3] = "Info";
|
|
36
|
+
FloatingUITypes[FloatingUITypes["Light"] = 4] = "Light";
|
|
37
|
+
FloatingUITypes[FloatingUITypes["LightBorder"] = 5] = "LightBorder";
|
|
38
|
+
FloatingUITypes[FloatingUITypes["Material"] = 6] = "Material";
|
|
39
|
+
FloatingUITypes[FloatingUITypes["Primary"] = 7] = "Primary";
|
|
40
|
+
FloatingUITypes[FloatingUITypes["Secondary"] = 8] = "Secondary";
|
|
41
|
+
FloatingUITypes[FloatingUITypes["Success"] = 9] = "Success";
|
|
42
|
+
FloatingUITypes[FloatingUITypes["Translucent"] = 10] = "Translucent";
|
|
43
|
+
FloatingUITypes[FloatingUITypes["Warning"] = 11] = "Warning";
|
|
44
|
+
})(FloatingUITypes = exports.FloatingUITypes || (exports.FloatingUITypes = {}));
|
|
45
|
+
/**
|
|
46
|
+
* Floating UI Element
|
|
47
|
+
*/
|
|
48
|
+
var _FloatingUI = /** @class */ (function () {
|
|
49
|
+
// Constructor
|
|
50
|
+
function _FloatingUI(props) {
|
|
51
|
+
var _a;
|
|
52
|
+
this._elArrow = null;
|
|
53
|
+
this._elTarget = null;
|
|
54
|
+
this._elContent = null;
|
|
55
|
+
this._options = null;
|
|
56
|
+
this._props = null;
|
|
57
|
+
this._elTarget = props.elTarget;
|
|
58
|
+
this._props = props;
|
|
59
|
+
// Create the content element
|
|
60
|
+
this._elContent = document.createElement("div");
|
|
61
|
+
this._elContent.classList.add("bs");
|
|
62
|
+
this._elContent.classList.add("floating-ui");
|
|
63
|
+
this._elContent.appendChild(props.elContent);
|
|
64
|
+
this._elContent.setAttribute("data-theme", this.getTheme(this._props.theme));
|
|
65
|
+
(0, common_1.setClassNames)(this._elContent, this._props.className);
|
|
66
|
+
// Add the events
|
|
67
|
+
this.addEvents((_a = props.options) === null || _a === void 0 ? void 0 : _a.trigger);
|
|
68
|
+
// Create the floating ui element
|
|
69
|
+
this.create();
|
|
70
|
+
// Set the visibility
|
|
71
|
+
this._props.show ? this.show() : this.hide();
|
|
72
|
+
}
|
|
73
|
+
_FloatingUI.prototype.addEvents = function (trigger) {
|
|
74
|
+
var _this = this;
|
|
75
|
+
if (trigger === void 0) { trigger = ""; }
|
|
76
|
+
// Events
|
|
77
|
+
if (trigger.indexOf("mouse") >= 0) {
|
|
78
|
+
this._elTarget.addEventListener("mouseenter", function () { _this.show(); });
|
|
79
|
+
this._elTarget.addEventListener("mouseleave", function () { _this.hide(); });
|
|
80
|
+
}
|
|
81
|
+
if (trigger.indexOf("focus") >= 0) {
|
|
82
|
+
this._elTarget.addEventListener("focus", function () { _this.show(); });
|
|
83
|
+
this._elTarget.addEventListener("blur", function () { _this.hide(); });
|
|
84
|
+
}
|
|
85
|
+
if (trigger.indexOf("click") >= 0) {
|
|
86
|
+
this._elTarget.addEventListener("click", function (ev) {
|
|
87
|
+
// Call the event
|
|
88
|
+
_this.isVisible ? _this.hide() : _this.show();
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
// Add the events
|
|
92
|
+
_FloatingUI.Events.push(function (ev) {
|
|
93
|
+
// See if it's outside the target element
|
|
94
|
+
if (!_this._elTarget.contains(ev.target)) {
|
|
95
|
+
// Hide the element
|
|
96
|
+
_this.hide();
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
_FloatingUI.ScrollEvents.push(function (ev) {
|
|
100
|
+
// Refresh the content
|
|
101
|
+
_this.refresh();
|
|
102
|
+
});
|
|
103
|
+
// Ensure the click event exists
|
|
104
|
+
if (!_FloatingUI.EventsCreated) {
|
|
105
|
+
// Create the event
|
|
106
|
+
document.addEventListener("click", function (ev) {
|
|
107
|
+
// Wait for the other events to run
|
|
108
|
+
setTimeout(function () {
|
|
109
|
+
// Parse the events
|
|
110
|
+
_FloatingUI.Events.forEach(function (fnEvent) {
|
|
111
|
+
// Call the event
|
|
112
|
+
fnEvent(ev);
|
|
113
|
+
});
|
|
114
|
+
}, 10);
|
|
115
|
+
});
|
|
116
|
+
// Create the scroll event
|
|
117
|
+
document.addEventListener("scroll", function (ev) {
|
|
118
|
+
// Wait for the other events to run
|
|
119
|
+
setTimeout(function () {
|
|
120
|
+
// Parse the events
|
|
121
|
+
_FloatingUI.ScrollEvents.forEach(function (fnEvent) {
|
|
122
|
+
// Call the event
|
|
123
|
+
fnEvent(ev);
|
|
124
|
+
});
|
|
125
|
+
}, 10);
|
|
126
|
+
});
|
|
127
|
+
// Set the flag
|
|
128
|
+
_FloatingUI.EventsCreated = true;
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
// Creates the floating ui
|
|
132
|
+
_FloatingUI.prototype.create = function () {
|
|
133
|
+
var _a;
|
|
134
|
+
var placement = this.getPlacement(this._props.placement);
|
|
135
|
+
var middleware = this.getMiddleware(placement);
|
|
136
|
+
// See if we are adding an arrow
|
|
137
|
+
if ((_a = this._props.options) === null || _a === void 0 ? void 0 : _a.arrow) {
|
|
138
|
+
// Create the element
|
|
139
|
+
this._elArrow = document.createElement("div");
|
|
140
|
+
this._elArrow.classList.add("arrow");
|
|
141
|
+
this._elContent.appendChild(this._elArrow);
|
|
142
|
+
// Add the plugin
|
|
143
|
+
middleware.push((0, dom_1.arrow)({ element: this._elArrow }));
|
|
144
|
+
middleware = [(0, dom_1.offset)(6)].concat(middleware);
|
|
145
|
+
}
|
|
146
|
+
// Set the options
|
|
147
|
+
this._options = {
|
|
148
|
+
middleware: middleware,
|
|
149
|
+
placement: placement.placement
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
// Returns the plugins
|
|
153
|
+
_FloatingUI.prototype.getMiddleware = function (placement) {
|
|
154
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
155
|
+
var middleware = [];
|
|
156
|
+
// See if we are adding the offset option
|
|
157
|
+
if ((_a = this._props.options) === null || _a === void 0 ? void 0 : _a.offset) {
|
|
158
|
+
middleware.push((0, dom_1.offset)(this._props.options.offset));
|
|
159
|
+
}
|
|
160
|
+
// See if we are adding the auto placement option
|
|
161
|
+
if (((_b = this._props.options) === null || _b === void 0 ? void 0 : _b.autoPlacement) || placement.autoPlacement) {
|
|
162
|
+
middleware.push((0, dom_1.autoPlacement)(this._props.options.autoPlacement));
|
|
163
|
+
}
|
|
164
|
+
// Else, see if we are adding the flip option
|
|
165
|
+
else if ((_c = this._props.options) === null || _c === void 0 ? void 0 : _c.flip) {
|
|
166
|
+
middleware.push((0, dom_1.flip)());
|
|
167
|
+
}
|
|
168
|
+
// See if we are adding the hide option
|
|
169
|
+
if ((_d = this._props.options) === null || _d === void 0 ? void 0 : _d.hide) {
|
|
170
|
+
middleware.push((0, dom_1.hide)(this._props.options.hide));
|
|
171
|
+
}
|
|
172
|
+
// See if we are adding the inline option
|
|
173
|
+
if ((_e = this._props.options) === null || _e === void 0 ? void 0 : _e.inline) {
|
|
174
|
+
middleware.push((0, dom_1.inline)(this._props.options.inline));
|
|
175
|
+
}
|
|
176
|
+
// See if we are adding the shift option
|
|
177
|
+
if ((_f = this._props.options) === null || _f === void 0 ? void 0 : _f.shift) {
|
|
178
|
+
middleware.push((0, dom_1.shift)((_g = this._props.options) === null || _g === void 0 ? void 0 : _g.shift));
|
|
179
|
+
}
|
|
180
|
+
// See if we are adding the size option
|
|
181
|
+
if ((_h = this._props.options) === null || _h === void 0 ? void 0 : _h.size) {
|
|
182
|
+
middleware.push((0, dom_1.size)((_j = this._props.options) === null || _j === void 0 ? void 0 : _j.size));
|
|
183
|
+
}
|
|
184
|
+
// Return the middle ware
|
|
185
|
+
return middleware;
|
|
186
|
+
};
|
|
187
|
+
// Returns the placement information
|
|
188
|
+
_FloatingUI.prototype.getPlacement = function (placementValue) {
|
|
189
|
+
var autoPlacement = false;
|
|
190
|
+
var placement = "top-end";
|
|
191
|
+
switch (placementValue) {
|
|
192
|
+
// Auto
|
|
193
|
+
case FloatingUIPlacements.Auto:
|
|
194
|
+
autoPlacement = true;
|
|
195
|
+
break;
|
|
196
|
+
case FloatingUIPlacements.AutoEnd:
|
|
197
|
+
placement = 'end';
|
|
198
|
+
autoPlacement = true;
|
|
199
|
+
break;
|
|
200
|
+
case FloatingUIPlacements.AutoStart:
|
|
201
|
+
placement = 'start';
|
|
202
|
+
autoPlacement = true;
|
|
203
|
+
break;
|
|
204
|
+
// Bottom
|
|
205
|
+
case FloatingUIPlacements.Bottom:
|
|
206
|
+
placement = "bottom";
|
|
207
|
+
break;
|
|
208
|
+
case FloatingUIPlacements.BottomEnd:
|
|
209
|
+
placement = "bottom-end";
|
|
210
|
+
break;
|
|
211
|
+
case FloatingUIPlacements.BottomStart:
|
|
212
|
+
placement = "bottom-start";
|
|
213
|
+
break;
|
|
214
|
+
// Left
|
|
215
|
+
case FloatingUIPlacements.Left:
|
|
216
|
+
placement = "left";
|
|
217
|
+
break;
|
|
218
|
+
case FloatingUIPlacements.LeftEnd:
|
|
219
|
+
placement = "left-end";
|
|
220
|
+
break;
|
|
221
|
+
case FloatingUIPlacements.LeftStart:
|
|
222
|
+
placement = "left-start";
|
|
223
|
+
break;
|
|
224
|
+
// Right
|
|
225
|
+
case FloatingUIPlacements.Right:
|
|
226
|
+
placement = "right";
|
|
227
|
+
break;
|
|
228
|
+
case FloatingUIPlacements.RightEnd:
|
|
229
|
+
placement = "right-end";
|
|
230
|
+
break;
|
|
231
|
+
case FloatingUIPlacements.RightStart:
|
|
232
|
+
placement = "right-start";
|
|
233
|
+
break;
|
|
234
|
+
// Top
|
|
235
|
+
case FloatingUIPlacements.Top:
|
|
236
|
+
placement = "top";
|
|
237
|
+
break;
|
|
238
|
+
case FloatingUIPlacements.TopEnd:
|
|
239
|
+
placement = "top-end";
|
|
240
|
+
break;
|
|
241
|
+
case FloatingUIPlacements.TopStart:
|
|
242
|
+
placement = "top-start";
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
245
|
+
// Return the placement
|
|
246
|
+
return { autoPlacement: autoPlacement, placement: placement };
|
|
247
|
+
};
|
|
248
|
+
// Returns the theme
|
|
249
|
+
_FloatingUI.prototype.getTheme = function (themeValue) {
|
|
250
|
+
var theme = null;
|
|
251
|
+
// Set the theme
|
|
252
|
+
switch (themeValue) {
|
|
253
|
+
// Dark
|
|
254
|
+
case FloatingUITypes.Dark:
|
|
255
|
+
theme = "dark";
|
|
256
|
+
break;
|
|
257
|
+
// Danger
|
|
258
|
+
case FloatingUITypes.Danger:
|
|
259
|
+
theme = "danger";
|
|
260
|
+
break;
|
|
261
|
+
// Info
|
|
262
|
+
case FloatingUITypes.Info:
|
|
263
|
+
theme = "info";
|
|
264
|
+
break;
|
|
265
|
+
// Light
|
|
266
|
+
case FloatingUITypes.Light:
|
|
267
|
+
theme = "light";
|
|
268
|
+
break;
|
|
269
|
+
case FloatingUITypes.LightBorder:
|
|
270
|
+
theme = "light-border";
|
|
271
|
+
break;
|
|
272
|
+
// Material
|
|
273
|
+
case FloatingUITypes.Material:
|
|
274
|
+
theme = "material";
|
|
275
|
+
break;
|
|
276
|
+
// Primary
|
|
277
|
+
case FloatingUITypes.Primary:
|
|
278
|
+
theme = "primary";
|
|
279
|
+
break;
|
|
280
|
+
// Secondary
|
|
281
|
+
case FloatingUITypes.Secondary:
|
|
282
|
+
theme = "secondary";
|
|
283
|
+
break;
|
|
284
|
+
// Success
|
|
285
|
+
case FloatingUITypes.Success:
|
|
286
|
+
theme = "success";
|
|
287
|
+
break;
|
|
288
|
+
// Translucent
|
|
289
|
+
case FloatingUITypes.Translucent:
|
|
290
|
+
theme = "translucent";
|
|
291
|
+
break;
|
|
292
|
+
// Warning
|
|
293
|
+
case FloatingUITypes.Warning:
|
|
294
|
+
theme = "warning";
|
|
295
|
+
break;
|
|
296
|
+
// Default - Light Border
|
|
297
|
+
default:
|
|
298
|
+
theme = "light-border";
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
// Return the theme
|
|
302
|
+
return theme;
|
|
303
|
+
};
|
|
304
|
+
// Refresh the element position
|
|
305
|
+
_FloatingUI.prototype.refresh = function () {
|
|
306
|
+
var _this = this;
|
|
307
|
+
// Create the floating ui
|
|
308
|
+
(0, dom_1.computePosition)(this._elTarget, this._elContent, this._options).then(function (_a) {
|
|
309
|
+
var _b;
|
|
310
|
+
var _c;
|
|
311
|
+
var x = _a.x, y = _a.y, middlewareData = _a.middlewareData;
|
|
312
|
+
// Update the location
|
|
313
|
+
Object.assign(_this._elContent.style, {
|
|
314
|
+
left: "".concat(x, "px"),
|
|
315
|
+
top: "".concat(y, "px")
|
|
316
|
+
});
|
|
317
|
+
// See if the arrow exists
|
|
318
|
+
if (_this._elArrow) {
|
|
319
|
+
var arrowX = middlewareData.arrow.x;
|
|
320
|
+
var arrowY = middlewareData.arrow.y;
|
|
321
|
+
var side = {
|
|
322
|
+
top: 'bottom',
|
|
323
|
+
right: 'left',
|
|
324
|
+
bottom: 'top',
|
|
325
|
+
left: 'right'
|
|
326
|
+
}[((_c = middlewareData.offset) === null || _c === void 0 ? void 0 : _c.placement) || _this._options.placement.split('-')[0]];
|
|
327
|
+
// Update the location
|
|
328
|
+
Object.assign(_this._elArrow.style, (_b = {
|
|
329
|
+
left: arrowX != null ? "".concat(arrowX, "px") : '',
|
|
330
|
+
top: arrowY != null ? "".concat(arrowY, "px") : '',
|
|
331
|
+
right: '',
|
|
332
|
+
bottom: ''
|
|
333
|
+
},
|
|
334
|
+
_b[side] = '-4px',
|
|
335
|
+
_b));
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
};
|
|
339
|
+
/**
|
|
340
|
+
* Public Methods
|
|
341
|
+
*/
|
|
342
|
+
_FloatingUI.prototype.setContent = function (el) { this._elContent = el; };
|
|
343
|
+
// Hides the content
|
|
344
|
+
_FloatingUI.prototype.hide = function () {
|
|
345
|
+
// Remove it from the document
|
|
346
|
+
this._elContent.classList.add("d-none");
|
|
347
|
+
if (document.body.contains(this._elContent)) {
|
|
348
|
+
document.body.removeChild(this._elContent);
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
Object.defineProperty(_FloatingUI.prototype, "isVisible", {
|
|
352
|
+
// Determines if the content is visible
|
|
353
|
+
get: function () { return !this._elContent.classList.contains("d-none"); },
|
|
354
|
+
enumerable: false,
|
|
355
|
+
configurable: true
|
|
356
|
+
});
|
|
357
|
+
// Shows the content
|
|
358
|
+
_FloatingUI.prototype.show = function () {
|
|
359
|
+
// Append it to the document
|
|
360
|
+
this._elContent.classList.remove("d-none");
|
|
361
|
+
if (!document.body.contains(this._elContent)) {
|
|
362
|
+
document.body.appendChild(this._elContent);
|
|
363
|
+
this.refresh();
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
// Toggles the floating ui
|
|
367
|
+
_FloatingUI.prototype.toggle = function () { this.isVisible ? this.hide() : this.show(); };
|
|
368
|
+
// Static events
|
|
369
|
+
_FloatingUI.Events = [];
|
|
370
|
+
_FloatingUI.EventsCreated = false;
|
|
371
|
+
_FloatingUI.ScrollEvents = [];
|
|
372
|
+
return _FloatingUI;
|
|
373
|
+
}());
|
|
374
|
+
var FloatingUI = function (props) { return new _FloatingUI(props); };
|
|
375
|
+
exports.FloatingUI = FloatingUI;
|
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
// Components
|
|
17
18
|
__exportStar(require("./accordion"), exports);
|
|
18
19
|
__exportStar(require("./alert"), exports);
|
|
19
20
|
__exportStar(require("./badge"), exports);
|
|
@@ -26,6 +27,7 @@ __exportStar(require("./carousel"), exports);
|
|
|
26
27
|
__exportStar(require("./checkboxGroup"), exports);
|
|
27
28
|
__exportStar(require("./collapse"), exports);
|
|
28
29
|
__exportStar(require("./dropdown"), exports);
|
|
30
|
+
__exportStar(require("./floating-ui"), exports);
|
|
29
31
|
__exportStar(require("./form"), exports);
|
|
30
32
|
__exportStar(require("./iconLink"), exports);
|
|
31
33
|
__exportStar(require("./inputGroup"), exports);
|
|
@@ -46,3 +48,5 @@ __exportStar(require("./toast"), exports);
|
|
|
46
48
|
__exportStar(require("./toolbar"), exports);
|
|
47
49
|
__exportStar(require("./tooltip"), exports);
|
|
48
50
|
__exportStar(require("./tooltipGroup"), exports);
|
|
51
|
+
// Custom Elements
|
|
52
|
+
__exportStar(require("./custom-element"), exports);
|
|
@@ -91,6 +91,8 @@ var _Modal = /** @class */ (function (_super) {
|
|
|
91
91
|
closeButton ? closeButton.classList.add("d-none") : null;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
+
// Set the header
|
|
95
|
+
(0, common_1.appendContent)(this.el.querySelector(".modal-header"), this.props.header);
|
|
94
96
|
// Set the body
|
|
95
97
|
(0, common_1.appendContent)(this.el.querySelector(".modal-body"), this.props.body);
|
|
96
98
|
// Set the footer
|
|
@@ -303,8 +305,12 @@ var _Modal = /** @class */ (function (_super) {
|
|
|
303
305
|
// Get the title
|
|
304
306
|
var elTitle = this.el.querySelector(".modal-title");
|
|
305
307
|
if (elTitle) {
|
|
306
|
-
//
|
|
307
|
-
elTitle.
|
|
308
|
+
// Clear the element
|
|
309
|
+
while (elTitle.firstChild) {
|
|
310
|
+
elTitle.removeChild(elTitle.firstChild);
|
|
311
|
+
}
|
|
312
|
+
// Append the content
|
|
313
|
+
(0, common_1.appendContent)(elTitle, title);
|
|
308
314
|
}
|
|
309
315
|
};
|
|
310
316
|
// Updates the type
|
|
@@ -27,7 +27,7 @@ var _Nav = /** @class */ (function (_super) {
|
|
|
27
27
|
__extends(_Nav, _super);
|
|
28
28
|
// Constructor
|
|
29
29
|
function _Nav(props, template, itemTemplate) {
|
|
30
|
-
if (template === void 0) { template = props.
|
|
30
|
+
if (template === void 0) { template = props.menuOnly ? templates_1.HTML : (props.isVertical ? templates_1.HTMLVerticalTabs : templates_1.HTMLTabs); }
|
|
31
31
|
var _this = _super.call(this, template, props) || this;
|
|
32
32
|
_this._links = null;
|
|
33
33
|
// Configure the collapse
|
|
@@ -44,12 +44,12 @@ var _Nav = /** @class */ (function (_super) {
|
|
|
44
44
|
var nav = this.el.classList.contains("nav") ? this.el : this.el.querySelector(".nav");
|
|
45
45
|
if (nav) {
|
|
46
46
|
this.props.id ? nav.id = this.props.id : null;
|
|
47
|
-
this.props.enableFill ?
|
|
48
|
-
this.props.isJustified ?
|
|
49
|
-
this.props.isPills ?
|
|
50
|
-
this.props.isTabs ?
|
|
51
|
-
this.props.isUnderline ?
|
|
52
|
-
this.props.isVertical ?
|
|
47
|
+
this.props.enableFill ? nav.classList.add("nav-fill") : null;
|
|
48
|
+
this.props.isJustified ? nav.classList.add("nav-justified") : null;
|
|
49
|
+
this.props.isPills ? nav.classList.add("nav-pills") : null;
|
|
50
|
+
this.props.isTabs ? nav.classList.add("nav-tabs") : null;
|
|
51
|
+
this.props.isUnderline ? nav.classList.add("nav-underline") : null;
|
|
52
|
+
this.props.isVertical ? nav.classList.add("flex-column") : null;
|
|
53
53
|
}
|
|
54
54
|
// Render the nav links
|
|
55
55
|
this.renderItems(itemTemplate);
|
|
@@ -8,6 +8,6 @@ exports.HTMLLink = "\n<li class=\"nav-item\">\n <a class=\"nav-link\" href=\"
|
|
|
8
8
|
// Tab
|
|
9
9
|
exports.HTMLTab = "<div class=\"tab-pane\" role=\"tabpanel\"></div>";
|
|
10
10
|
// Tabs
|
|
11
|
-
exports.HTMLTabs = "\n<div class=\"row\">\n <div class=\"col\">\n <ul class=\"nav
|
|
11
|
+
exports.HTMLTabs = "\n<div class=\"row\">\n <div class=\"col\">\n <ul class=\"nav\" role=\"tablist\"></ul>\n <div class=\"tab-content\"></div>\n </div>\n</div>".trim();
|
|
12
12
|
// Vertical Tabs
|
|
13
13
|
exports.HTMLVerticalTabs = "\n<div class=\"row\">\n <div class=\"col-3\">\n <ul class=\"nav flex-column\" role=\"tablist\"></ul>\n </div>\n <div class=\"col-9\">\n <div class=\"tab-content\"></div>\n </div>\n</div>".trim();
|