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
package/src/components/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// Components
|
|
1
2
|
export * from "./accordion";
|
|
2
3
|
export * from "./alert";
|
|
3
4
|
export * from "./badge";
|
|
@@ -10,6 +11,7 @@ export * from "./carousel";
|
|
|
10
11
|
export * from "./checkboxGroup";
|
|
11
12
|
export * from "./collapse";
|
|
12
13
|
export * from "./dropdown";
|
|
14
|
+
export * from "./floating-ui";
|
|
13
15
|
export * from "./form";
|
|
14
16
|
export * from "./iconLink";
|
|
15
17
|
export * from "./inputGroup";
|
|
@@ -29,4 +31,7 @@ export * from "./table";
|
|
|
29
31
|
export * from "./toast";
|
|
30
32
|
export * from "./toolbar";
|
|
31
33
|
export * from "./tooltip";
|
|
32
|
-
export * from "./tooltipGroup";
|
|
34
|
+
export * from "./tooltipGroup";
|
|
35
|
+
|
|
36
|
+
// Custom Elements
|
|
37
|
+
export * from "./custom-element";
|
|
@@ -82,6 +82,9 @@ class _Modal extends Base<IModalProps> implements IModal {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
// Set the header
|
|
86
|
+
appendContent(this.el.querySelector(".modal-header"), this.props.header);
|
|
87
|
+
|
|
85
88
|
// Set the body
|
|
86
89
|
appendContent(this.el.querySelector(".modal-body"), this.props.body);
|
|
87
90
|
|
|
@@ -299,12 +302,15 @@ class _Modal extends Base<IModalProps> implements IModal {
|
|
|
299
302
|
}
|
|
300
303
|
|
|
301
304
|
// Updates the title
|
|
302
|
-
setTitle(title: string) {
|
|
305
|
+
setTitle(title: string | Element) {
|
|
303
306
|
// Get the title
|
|
304
|
-
let elTitle = this.el.querySelector(".modal-title");
|
|
307
|
+
let elTitle = this.el.querySelector(".modal-title") as HTMLElement;
|
|
305
308
|
if (elTitle) {
|
|
306
|
-
//
|
|
307
|
-
elTitle.
|
|
309
|
+
// Clear the element
|
|
310
|
+
while (elTitle.firstChild) { elTitle.removeChild(elTitle.firstChild); }
|
|
311
|
+
|
|
312
|
+
// Append the content
|
|
313
|
+
appendContent(elTitle, title);
|
|
308
314
|
}
|
|
309
315
|
}
|
|
310
316
|
|
|
@@ -76,7 +76,7 @@ import { IBaseProps } from "../types";
|
|
|
76
76
|
/**
|
|
77
77
|
* Modal
|
|
78
78
|
*/
|
|
79
|
-
export interface IModal {
|
|
79
|
+
export interface IModal<T = HTMLElement> {
|
|
80
80
|
/** The element. */
|
|
81
81
|
el: HTMLElement;
|
|
82
82
|
|
|
@@ -108,7 +108,7 @@ export interface IModal {
|
|
|
108
108
|
setScrollable: (value: boolean) => void;
|
|
109
109
|
|
|
110
110
|
/** Updates the title. */
|
|
111
|
-
setTitle: (title: string) => void;
|
|
111
|
+
setTitle: (title: string | T) => void;
|
|
112
112
|
|
|
113
113
|
/** Updates the type. */
|
|
114
114
|
setType: (modalType: number) => void;
|
|
@@ -153,6 +153,7 @@ export interface IModalProps<T = HTMLElement> extends IBaseProps<IModal> {
|
|
|
153
153
|
body?: string | T;
|
|
154
154
|
disableFade?: boolean;
|
|
155
155
|
footer?: string | T;
|
|
156
|
+
header?: string | T;
|
|
156
157
|
hideCloseButton?: boolean;
|
|
157
158
|
id?: string;
|
|
158
159
|
onClose?: (el: HTMLDivElement) => void;
|
|
@@ -11,7 +11,7 @@ class _Nav extends Base<INavProps> implements INav {
|
|
|
11
11
|
private _links: Array<NavLink> = null;
|
|
12
12
|
|
|
13
13
|
// Constructor
|
|
14
|
-
constructor(props: INavProps, template: string = props.
|
|
14
|
+
constructor(props: INavProps, template: string = props.menuOnly ? HTML : (props.isVertical ? HTMLVerticalTabs : HTMLTabs), itemTemplate?: string) {
|
|
15
15
|
super(template, props);
|
|
16
16
|
|
|
17
17
|
// Configure the collapse
|
|
@@ -30,12 +30,12 @@ class _Nav extends Base<INavProps> implements INav {
|
|
|
30
30
|
let nav = this.el.classList.contains("nav") ? this.el : this.el.querySelector(".nav");
|
|
31
31
|
if (nav) {
|
|
32
32
|
this.props.id ? nav.id = this.props.id : null;
|
|
33
|
-
this.props.enableFill ?
|
|
34
|
-
this.props.isJustified ?
|
|
35
|
-
this.props.isPills ?
|
|
36
|
-
this.props.isTabs ?
|
|
37
|
-
this.props.isUnderline ?
|
|
38
|
-
this.props.isVertical ?
|
|
33
|
+
this.props.enableFill ? nav.classList.add("nav-fill") : null;
|
|
34
|
+
this.props.isJustified ? nav.classList.add("nav-justified") : null;
|
|
35
|
+
this.props.isPills ? nav.classList.add("nav-pills") : null;
|
|
36
|
+
this.props.isTabs ? nav.classList.add("nav-tabs") : null;
|
|
37
|
+
this.props.isUnderline ? nav.classList.add("nav-underline") : null;
|
|
38
|
+
this.props.isVertical ? nav.classList.add("flex-column") : null;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
// Render the nav links
|
|
@@ -14,7 +14,7 @@ export const HTMLTab = `<div class="tab-pane" role="tabpanel"></div>`;
|
|
|
14
14
|
export const HTMLTabs = `
|
|
15
15
|
<div class="row">
|
|
16
16
|
<div class="col">
|
|
17
|
-
<ul class="nav
|
|
17
|
+
<ul class="nav" role="tablist"></ul>
|
|
18
18
|
<div class="tab-content"></div>
|
|
19
19
|
</div>
|
|
20
20
|
</div>`.trim();
|
|
@@ -92,6 +92,7 @@ export interface INavProps<T = HTMLElement> extends IBaseProps<INav> {
|
|
|
92
92
|
isTabs?: boolean;
|
|
93
93
|
isUnderline?: boolean;
|
|
94
94
|
isVertical?: boolean;
|
|
95
|
+
menuOnly?: boolean;
|
|
95
96
|
onClick?: (newTab?: INavLink, prevTab?: INavLink) => void;
|
|
96
97
|
onLinkRendered?: (el?: HTMLElement, item?: INavLinkProps) => void;
|
|
97
98
|
onRendered?: (el?: HTMLElement) => void;
|
|
@@ -92,7 +92,7 @@ export const NavbarTypes: INavbarTypes;
|
|
|
92
92
|
|
|
93
93
|
import { IBaseProps } from "../types";
|
|
94
94
|
import { IDropdownItem } from "../dropdown/types";
|
|
95
|
-
import {
|
|
95
|
+
import { IFloatingUIProps } from "../floating-ui/types";
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
98
|
* Navbar
|
|
@@ -130,7 +130,7 @@ export interface INavbarItem {
|
|
|
130
130
|
isDisabled?: boolean;
|
|
131
131
|
items?: Array<IDropdownItem>;
|
|
132
132
|
onClick?: (item?: INavbarItem, ev?: Event) => void;
|
|
133
|
-
onMenuRendering?: (props:
|
|
133
|
+
onMenuRendering?: (props: IFloatingUIProps) => IFloatingUIProps;
|
|
134
134
|
onRender?: (el?: HTMLElement, item?: INavbarItem) => void;
|
|
135
135
|
target?: string;
|
|
136
136
|
text?: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ITippyProps } from "../types";
|
|
3
|
-
import { IPopover, IPopoverProps } from "./types";
|
|
1
|
+
import { IFloatingUI } from "../floating-ui/types";
|
|
4
2
|
import { Button } from "../button";
|
|
5
3
|
import { Base } from "../base";
|
|
6
4
|
import { appendContent, setClassNames } from "../common";
|
|
5
|
+
import { FloatingUI, FloatingUIPlacements } from "../floating-ui";
|
|
6
|
+
import { IPopover, IPopoverProps } from "./types";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Popover Types
|
|
@@ -25,30 +25,14 @@ export enum PopoverTypes {
|
|
|
25
25
|
/**
|
|
26
26
|
* Popover Placements
|
|
27
27
|
*/
|
|
28
|
-
export
|
|
29
|
-
Auto = 1,
|
|
30
|
-
AutoStart = 2,
|
|
31
|
-
AutoEnd = 3,
|
|
32
|
-
Bottom = 4,
|
|
33
|
-
BottomStart = 5,
|
|
34
|
-
BottomEnd = 6,
|
|
35
|
-
Left = 7,
|
|
36
|
-
LeftStart = 8,
|
|
37
|
-
LeftEnd = 9,
|
|
38
|
-
Right = 10,
|
|
39
|
-
RightStart = 11,
|
|
40
|
-
RightEnd = 12,
|
|
41
|
-
Top = 13,
|
|
42
|
-
TopStart = 14,
|
|
43
|
-
TopEnd = 15
|
|
44
|
-
}
|
|
28
|
+
export { FloatingUIPlacements as PopoverPlacements }
|
|
45
29
|
|
|
46
30
|
/**
|
|
47
31
|
* Popover
|
|
48
32
|
*/
|
|
49
33
|
class _Popover extends Base<IPopoverProps> implements IPopover {
|
|
50
34
|
private _elContent: HTMLDivElement = null;
|
|
51
|
-
private
|
|
35
|
+
private _floatingUI: IFloatingUI = null;
|
|
52
36
|
|
|
53
37
|
// Constructor
|
|
54
38
|
constructor(props: IPopoverProps, template: string = "") {
|
|
@@ -63,143 +47,6 @@ class _Popover extends Base<IPopoverProps> implements IPopover {
|
|
|
63
47
|
|
|
64
48
|
// Configure the card group
|
|
65
49
|
private configure() {
|
|
66
|
-
// Set the placements
|
|
67
|
-
let placement = null;
|
|
68
|
-
switch (this.props.placement) {
|
|
69
|
-
// Auto
|
|
70
|
-
case PopoverPlacements.Auto:
|
|
71
|
-
placement = "auto";
|
|
72
|
-
break;
|
|
73
|
-
case PopoverPlacements.AutoEnd:
|
|
74
|
-
placement = "auto-end";
|
|
75
|
-
break;
|
|
76
|
-
case PopoverPlacements.AutoStart:
|
|
77
|
-
placement = "auto-start";
|
|
78
|
-
break;
|
|
79
|
-
// Bottom
|
|
80
|
-
case PopoverPlacements.Bottom:
|
|
81
|
-
placement = "bottom";
|
|
82
|
-
break;
|
|
83
|
-
case PopoverPlacements.BottomEnd:
|
|
84
|
-
placement = "bottom-end";
|
|
85
|
-
break;
|
|
86
|
-
case PopoverPlacements.BottomStart:
|
|
87
|
-
placement = "bottom-start";
|
|
88
|
-
break;
|
|
89
|
-
// Left
|
|
90
|
-
case PopoverPlacements.Left:
|
|
91
|
-
placement = "left";
|
|
92
|
-
break;
|
|
93
|
-
case PopoverPlacements.LeftEnd:
|
|
94
|
-
placement = "left-end";
|
|
95
|
-
break;
|
|
96
|
-
case PopoverPlacements.LeftStart:
|
|
97
|
-
placement = "left-start";
|
|
98
|
-
break;
|
|
99
|
-
// Right
|
|
100
|
-
case PopoverPlacements.Right:
|
|
101
|
-
placement = "right";
|
|
102
|
-
break;
|
|
103
|
-
case PopoverPlacements.RightEnd:
|
|
104
|
-
placement = "right-end";
|
|
105
|
-
break;
|
|
106
|
-
case PopoverPlacements.RightStart:
|
|
107
|
-
placement = "right-start";
|
|
108
|
-
break;
|
|
109
|
-
// Top
|
|
110
|
-
case PopoverPlacements.Top:
|
|
111
|
-
placement = "top";
|
|
112
|
-
break;
|
|
113
|
-
case PopoverPlacements.TopEnd:
|
|
114
|
-
placement = "top-end";
|
|
115
|
-
break;
|
|
116
|
-
case PopoverPlacements.TopStart:
|
|
117
|
-
placement = "top-start";
|
|
118
|
-
break;
|
|
119
|
-
// Default - Auto
|
|
120
|
-
default:
|
|
121
|
-
placement = "top";
|
|
122
|
-
break;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// Set the theme
|
|
126
|
-
let theme = null;
|
|
127
|
-
switch (this.props.type) {
|
|
128
|
-
// Dark
|
|
129
|
-
case PopoverTypes.Dark:
|
|
130
|
-
theme = "dark";
|
|
131
|
-
break;
|
|
132
|
-
// Danger
|
|
133
|
-
case PopoverTypes.Danger:
|
|
134
|
-
theme = "danger";
|
|
135
|
-
break;
|
|
136
|
-
// Info
|
|
137
|
-
case PopoverTypes.Info:
|
|
138
|
-
theme = "info";
|
|
139
|
-
break;
|
|
140
|
-
// Light
|
|
141
|
-
case PopoverTypes.Light:
|
|
142
|
-
theme = "light";
|
|
143
|
-
break;
|
|
144
|
-
case PopoverTypes.LightBorder:
|
|
145
|
-
theme = "light-border";
|
|
146
|
-
break;
|
|
147
|
-
// Material
|
|
148
|
-
case PopoverTypes.Material:
|
|
149
|
-
theme = "material";
|
|
150
|
-
break;
|
|
151
|
-
// Primary
|
|
152
|
-
case PopoverTypes.Primary:
|
|
153
|
-
theme = "primary";
|
|
154
|
-
break;
|
|
155
|
-
// Secondary
|
|
156
|
-
case PopoverTypes.Secondary:
|
|
157
|
-
theme = "secondary";
|
|
158
|
-
break;
|
|
159
|
-
// Success
|
|
160
|
-
case PopoverTypes.Success:
|
|
161
|
-
theme = "success";
|
|
162
|
-
break;
|
|
163
|
-
// Translucent
|
|
164
|
-
case PopoverTypes.Translucent:
|
|
165
|
-
theme = "translucent";
|
|
166
|
-
break;
|
|
167
|
-
// Warning
|
|
168
|
-
case PopoverTypes.Warning:
|
|
169
|
-
theme = "warning";
|
|
170
|
-
break;
|
|
171
|
-
// Default - Light Border
|
|
172
|
-
default:
|
|
173
|
-
theme = "light-border";
|
|
174
|
-
break;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// Set the options
|
|
178
|
-
let options: ITippyProps = {
|
|
179
|
-
...{
|
|
180
|
-
allowHTML: true,
|
|
181
|
-
appendTo: document.body,
|
|
182
|
-
animation: "scale",
|
|
183
|
-
arrow: true,
|
|
184
|
-
delay: 100,
|
|
185
|
-
inertia: true,
|
|
186
|
-
interactive: true,
|
|
187
|
-
placement,
|
|
188
|
-
plugins: [animateFill, followCursor, inlinePositioning, sticky],
|
|
189
|
-
theme,
|
|
190
|
-
popperOptions: {
|
|
191
|
-
modifiers: [{
|
|
192
|
-
name: "preventOverflow",
|
|
193
|
-
options: {
|
|
194
|
-
altAxis: true,
|
|
195
|
-
tether: false
|
|
196
|
-
}
|
|
197
|
-
}]
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
...this.props.options
|
|
201
|
-
};
|
|
202
|
-
|
|
203
50
|
// See if we are targeting an element
|
|
204
51
|
let elPopover: HTMLElement = null;
|
|
205
52
|
if (this.props.target) {
|
|
@@ -219,44 +66,28 @@ class _Popover extends Base<IPopoverProps> implements IPopover {
|
|
|
219
66
|
this.el = Button(btnProps).el;
|
|
220
67
|
}
|
|
221
68
|
|
|
222
|
-
// Create the
|
|
223
|
-
this._elContent = document.createElement("div")
|
|
69
|
+
// Create the content element
|
|
70
|
+
this._elContent = document.createElement("div");
|
|
224
71
|
this._elContent.classList.add("popover");
|
|
225
|
-
this._elContent.
|
|
72
|
+
setClassNames(this._elContent, this.props.className);
|
|
226
73
|
this._elContent.innerHTML = '<div class="popover-header"></div><div class="popover-body"></div>';
|
|
227
74
|
appendContent(this._elContent.querySelector(".popover-header"), this.props.title);
|
|
228
75
|
setClassNames(this._elContent.querySelector(".popover-header"), this.props.classNameHeader);
|
|
229
|
-
appendContent(this._elContent.querySelector(".popover-body"), options
|
|
76
|
+
appendContent(this._elContent.querySelector(".popover-body"), this.props.options?.content);
|
|
230
77
|
setClassNames(this._elContent.querySelector(".popover-body"), this.props.classNameBody);
|
|
231
|
-
options.content = this._elContent;
|
|
232
|
-
|
|
233
|
-
// Set the on create event
|
|
234
|
-
options["onCreate"] = (tippyObj) => {
|
|
235
|
-
// Get the content element
|
|
236
|
-
let elContent = tippyObj.popper.querySelector(".tippy-content") as HTMLElement;
|
|
237
|
-
if (elContent) {
|
|
238
|
-
// Set the class
|
|
239
|
-
elContent.classList.add("bs");
|
|
240
|
-
|
|
241
|
-
// Set the styling
|
|
242
|
-
elContent.style.padding = "0";
|
|
243
78
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
// Create the tippy
|
|
259
|
-
this._tippy = tippy(this.el, options as any);
|
|
79
|
+
// Create the floating ui
|
|
80
|
+
this._floatingUI = FloatingUI({
|
|
81
|
+
elContent: this._elContent,
|
|
82
|
+
elTarget: this.el,
|
|
83
|
+
options: {
|
|
84
|
+
...{ arrow: true, flip: true, shift: { padding: 5 } },
|
|
85
|
+
...this.props.options
|
|
86
|
+
},
|
|
87
|
+
placement: this.props.placement,
|
|
88
|
+
show: this.props.show,
|
|
89
|
+
theme: this.props.type
|
|
90
|
+
});
|
|
260
91
|
}
|
|
261
92
|
|
|
262
93
|
/**
|
|
@@ -276,20 +107,17 @@ class _Popover extends Base<IPopoverProps> implements IPopover {
|
|
|
276
107
|
}
|
|
277
108
|
|
|
278
109
|
// Hides the popover
|
|
279
|
-
hide() {
|
|
280
|
-
// See if it's visible
|
|
281
|
-
if (this.isVisible) { this._tippy.hide(); }
|
|
282
|
-
}
|
|
110
|
+
hide() { this._floatingUI.hide(); }
|
|
283
111
|
|
|
284
112
|
// Determines if the popover is visible
|
|
285
|
-
get isVisible(): boolean { return this.
|
|
113
|
+
get isVisible(): boolean { return this._floatingUI.isVisible; }
|
|
286
114
|
|
|
287
|
-
// The
|
|
288
|
-
get
|
|
115
|
+
// The floating ui instand
|
|
116
|
+
get floatingUI() { return this._floatingUI; }
|
|
289
117
|
|
|
290
118
|
// Sets the popover body element
|
|
291
119
|
setBody(content: string | Element) {
|
|
292
|
-
let elBody: HTMLElement = this.
|
|
120
|
+
let elBody: HTMLElement = this._elContent.querySelector(".popover-body");
|
|
293
121
|
if (elBody) {
|
|
294
122
|
// Clear the content
|
|
295
123
|
while (elBody.firstChild) { elBody.removeChild(elBody.firstChild); }
|
|
@@ -301,13 +129,22 @@ class _Popover extends Base<IPopoverProps> implements IPopover {
|
|
|
301
129
|
|
|
302
130
|
// Sets the tippy content
|
|
303
131
|
setContent(content: string | Element) {
|
|
304
|
-
//
|
|
305
|
-
|
|
132
|
+
// See if this is a string
|
|
133
|
+
if (typeof (content) === "string") {
|
|
134
|
+
// Set the content
|
|
135
|
+
this._elContent.innerHTML = content;
|
|
136
|
+
} else {
|
|
137
|
+
// Clear the content
|
|
138
|
+
while (this._elContent.firstChild) { this._elContent.removeChild(this._elContent.firstChild); }
|
|
139
|
+
|
|
140
|
+
// Append the content
|
|
141
|
+
appendContent(this._elContent, content);
|
|
142
|
+
}
|
|
306
143
|
}
|
|
307
144
|
|
|
308
145
|
// Sets the popover header element
|
|
309
146
|
setHeader(content: string | Element) {
|
|
310
|
-
let elHeader: HTMLElement = this.
|
|
147
|
+
let elHeader: HTMLElement = this._elContent.querySelector(".popover-header");
|
|
311
148
|
if (elHeader) {
|
|
312
149
|
// Clear the content
|
|
313
150
|
while (elHeader.firstChild) { elHeader.removeChild(elHeader.firstChild); }
|
|
@@ -318,10 +155,7 @@ class _Popover extends Base<IPopoverProps> implements IPopover {
|
|
|
318
155
|
}
|
|
319
156
|
|
|
320
157
|
// Shows the popover
|
|
321
|
-
show() {
|
|
322
|
-
// See if it's hidden
|
|
323
|
-
if (!this.isVisible) { this._tippy.show(); }
|
|
324
|
-
}
|
|
158
|
+
show() { this._floatingUI.show(); }
|
|
325
159
|
|
|
326
160
|
// Toggles the popover
|
|
327
161
|
toggle() {
|
|
@@ -55,15 +55,16 @@ export const Popover: (props: IPopoverProps, template?: string) => IPopover;
|
|
|
55
55
|
/**
|
|
56
56
|
* Popover Placements
|
|
57
57
|
*/
|
|
58
|
-
export const PopoverPlacements:
|
|
58
|
+
export const PopoverPlacements: IFloatingUIPlacements;
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
61
|
* Popover Types
|
|
62
62
|
*/
|
|
63
|
-
export const PopoverTypes:
|
|
63
|
+
export const PopoverTypes: IFloatingUITypes;
|
|
64
64
|
|
|
65
|
-
import { IBaseProps
|
|
65
|
+
import { IBaseProps } from "../types";
|
|
66
66
|
import { IButtonProps } from "../button/types";
|
|
67
|
+
import { IFloatingUIOptions, IFloatingUIPlacements, IFloatingUITypes } from "../floating-ui/types";
|
|
67
68
|
|
|
68
69
|
/**
|
|
69
70
|
* Popover
|
|
@@ -72,8 +73,8 @@ export interface IPopover {
|
|
|
72
73
|
/** The element. */
|
|
73
74
|
el: HTMLElement;
|
|
74
75
|
|
|
75
|
-
/** The
|
|
76
|
-
|
|
76
|
+
/** The floating ui instance. */
|
|
77
|
+
floatingUI: any;
|
|
77
78
|
|
|
78
79
|
/** Enables the popover. */
|
|
79
80
|
enable: () => void;
|
|
@@ -81,13 +82,16 @@ export interface IPopover {
|
|
|
81
82
|
/** Hides an element’s popover. */
|
|
82
83
|
hide: () => void;
|
|
83
84
|
|
|
85
|
+
/** True if the popover is visible, false otherwise. */
|
|
86
|
+
isVisible: boolean;
|
|
87
|
+
|
|
84
88
|
/** Toggles an element's popover. */
|
|
85
89
|
toggle: () => void;
|
|
86
90
|
|
|
87
91
|
/** Sets the body element of the popover. */
|
|
88
92
|
setBody: (content: string | Element) => void;
|
|
89
93
|
|
|
90
|
-
/** Sets the
|
|
94
|
+
/** Sets the floating ui content. */
|
|
91
95
|
setContent: (content: string | Element) => void;
|
|
92
96
|
|
|
93
97
|
/** Sets the header element of the popover. */
|
|
@@ -105,47 +109,10 @@ export interface IPopoverProps extends IBaseProps<IPopover> {
|
|
|
105
109
|
classNameBody?: string;
|
|
106
110
|
classNameHeader?: string;
|
|
107
111
|
isDismissible?: boolean;
|
|
108
|
-
options?:
|
|
112
|
+
options?: IFloatingUIOptions;
|
|
109
113
|
placement?: number;
|
|
114
|
+
show?: boolean;
|
|
110
115
|
target?: HTMLElement,
|
|
111
116
|
title?: string;
|
|
112
117
|
type?: number;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Popover Types
|
|
117
|
-
*/
|
|
118
|
-
export type IPopoverTypes = {
|
|
119
|
-
Danger: number;
|
|
120
|
-
Dark: number;
|
|
121
|
-
Info: number;
|
|
122
|
-
Light: number;
|
|
123
|
-
LightBorder: number;
|
|
124
|
-
Material: number;
|
|
125
|
-
Primary: number;
|
|
126
|
-
Secondary: number;
|
|
127
|
-
Success: number;
|
|
128
|
-
Translucent: number;
|
|
129
|
-
Warning: number;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Popover Placements
|
|
134
|
-
*/
|
|
135
|
-
export type IPopoverPlacements = {
|
|
136
|
-
Auto: number;
|
|
137
|
-
AutoStart: number;
|
|
138
|
-
AutoEnd: number;
|
|
139
|
-
Bottom: number;
|
|
140
|
-
BottomStart: number;
|
|
141
|
-
BottomEnd: number;
|
|
142
|
-
Left: number;
|
|
143
|
-
LeftStart: number;
|
|
144
|
-
LeftEnd: number;
|
|
145
|
-
Right: number;
|
|
146
|
-
RightStart: number;
|
|
147
|
-
RightEnd: number;
|
|
148
|
-
Top: number;
|
|
149
|
-
TopStart: number;
|
|
150
|
-
TopEnd: number;
|
|
151
118
|
}
|