gd-bs 6.6.15 → 6.6.17
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/components/tooltip/index.js +39 -16
- package/dist/gd-bs-icons.js +1 -1
- package/dist/gd-bs-icons.min.js +1 -1
- package/dist/gd-bs.d.ts +6 -1
- package/dist/gd-bs.js +1 -1
- package/dist/gd-bs.min.js +1 -1
- package/package.json +1 -1
- package/src/components/tooltip/index.ts +41 -19
- package/src/components/tooltip/types.d.ts +6 -1
|
@@ -30,6 +30,7 @@ exports.Tooltip = exports.TooltipPlacements = exports.TooltipTypes = void 0;
|
|
|
30
30
|
var tippy_js_1 = require("tippy.js");
|
|
31
31
|
var base_1 = require("../base");
|
|
32
32
|
var button_1 = require("../button");
|
|
33
|
+
var dropdown_1 = require("../dropdown");
|
|
33
34
|
var common_1 = require("../common");
|
|
34
35
|
/**
|
|
35
36
|
* Tooltip Types
|
|
@@ -79,6 +80,7 @@ var _Tooltip = /** @class */ (function (_super) {
|
|
|
79
80
|
if (template === void 0) { template = ""; }
|
|
80
81
|
var _this = _super.call(this, template, props) || this;
|
|
81
82
|
_this._btn = null;
|
|
83
|
+
_this._ddl = null;
|
|
82
84
|
_this._elContent = null;
|
|
83
85
|
_this._tippy = null;
|
|
84
86
|
// Configure the collapse
|
|
@@ -91,18 +93,30 @@ var _Tooltip = /** @class */ (function (_super) {
|
|
|
91
93
|
_Tooltip.prototype.configure = function () {
|
|
92
94
|
// See if the target element was not defined
|
|
93
95
|
if (this.props.target == null) {
|
|
94
|
-
//
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
//
|
|
100
|
-
|
|
96
|
+
// See if the dropdown property exists
|
|
97
|
+
if (this.props.ddlProps) {
|
|
98
|
+
// Set the default properties
|
|
99
|
+
var ddlProps = this.props.ddlProps;
|
|
100
|
+
ddlProps.type = ddlProps.type || dropdown_1.DropdownTypes.OutlinePrimary;
|
|
101
|
+
// Create the dropdown
|
|
102
|
+
this._ddl = (0, dropdown_1.Dropdown)(ddlProps);
|
|
103
|
+
// Update the element
|
|
104
|
+
this.el = this._ddl.el.querySelector("button");
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
// Default the toggle property for the button
|
|
108
|
+
var btnProps = this.props.btnProps || {};
|
|
109
|
+
btnProps.type = btnProps.type || button_1.ButtonTypes.OutlineSecondary;
|
|
110
|
+
// See if the content is text
|
|
111
|
+
if (typeof (this.props.content) === "string") {
|
|
112
|
+
// Set the label
|
|
113
|
+
btnProps.description = this.props.content;
|
|
114
|
+
}
|
|
115
|
+
// Create the button
|
|
116
|
+
this._btn = (0, button_1.Button)(btnProps);
|
|
117
|
+
// Update the element
|
|
118
|
+
this.el = this._btn.el;
|
|
101
119
|
}
|
|
102
|
-
// Create the button
|
|
103
|
-
this._btn = (0, button_1.Button)(btnProps);
|
|
104
|
-
// Update the element
|
|
105
|
-
this.el = this._btn.el;
|
|
106
120
|
}
|
|
107
121
|
// Configure the options
|
|
108
122
|
this.configureOptions();
|
|
@@ -319,15 +333,23 @@ var _Tooltip = /** @class */ (function (_super) {
|
|
|
319
333
|
enumerable: false,
|
|
320
334
|
configurable: true
|
|
321
335
|
});
|
|
336
|
+
Object.defineProperty(_Tooltip.prototype, "ddl", {
|
|
337
|
+
// Reference to the dropdown
|
|
338
|
+
get: function () { return this._ddl; },
|
|
339
|
+
enumerable: false,
|
|
340
|
+
configurable: true
|
|
341
|
+
});
|
|
322
342
|
// Disbles the tooltip
|
|
323
343
|
_Tooltip.prototype.disable = function () {
|
|
324
|
-
// Disable the button
|
|
344
|
+
// Disable the button or dropdown
|
|
325
345
|
this._btn ? this._btn.disable() : null;
|
|
346
|
+
this._ddl ? this._ddl.disable() : null;
|
|
326
347
|
};
|
|
327
348
|
// Enables the tooltip
|
|
328
349
|
_Tooltip.prototype.enable = function () {
|
|
329
|
-
// Enable the button
|
|
350
|
+
// Enable the button or dropdown
|
|
330
351
|
this._btn ? this._btn.enable() : null;
|
|
352
|
+
this._ddl ? this._ddl.enable() : null;
|
|
331
353
|
};
|
|
332
354
|
// Hides the tooltip
|
|
333
355
|
_Tooltip.prototype.hide = function () {
|
|
@@ -352,10 +374,11 @@ var _Tooltip = /** @class */ (function (_super) {
|
|
|
352
374
|
_Tooltip.prototype.setContent = function (content) {
|
|
353
375
|
// Set the tippy content
|
|
354
376
|
this.tippy.setContent(content);
|
|
355
|
-
// See if the
|
|
356
|
-
if (
|
|
377
|
+
// See if the content is a string
|
|
378
|
+
if (typeof (content) === "string") {
|
|
357
379
|
// Update the content
|
|
358
|
-
this._btn.el.setAttribute("aria-description", content);
|
|
380
|
+
this._btn ? this._btn.el.setAttribute("aria-description", content) : null;
|
|
381
|
+
this._ddl ? this._ddl.el.setAttribute("aria-description", content) : null;
|
|
359
382
|
}
|
|
360
383
|
};
|
|
361
384
|
// Shows the tooltip
|