gd-bs 5.2.6 → 5.2.7
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 +56 -4
- package/build/components/tooltipGroup/index.js +1 -0
- package/dist/gd-bs-icons.js +2 -2
- package/dist/gd-bs-icons.min.js +1 -1
- package/dist/gd-bs.d.ts +2 -0
- package/dist/gd-bs.js +2 -2
- package/dist/gd-bs.min.js +1 -1
- package/package.json +1 -1
- package/src/components/tooltip/index.ts +57 -4
- package/src/components/tooltipGroup/index.ts +1 -0
- package/src/components/tooltipGroup/types.d.ts +2 -0
|
@@ -165,14 +165,14 @@ var _Tooltip = /** @class */ (function (_super) {
|
|
|
165
165
|
// Set the theme
|
|
166
166
|
var theme = null;
|
|
167
167
|
switch (this.props.type) {
|
|
168
|
-
// Dark
|
|
169
|
-
case TooltipTypes.Dark:
|
|
170
|
-
theme = "dark";
|
|
171
|
-
break;
|
|
172
168
|
// Danger
|
|
173
169
|
case TooltipTypes.Danger:
|
|
174
170
|
theme = "danger";
|
|
175
171
|
break;
|
|
172
|
+
// Dark
|
|
173
|
+
case TooltipTypes.Dark:
|
|
174
|
+
theme = "dark";
|
|
175
|
+
break;
|
|
176
176
|
// Info
|
|
177
177
|
case TooltipTypes.Info:
|
|
178
178
|
theme = "info";
|
|
@@ -210,7 +210,59 @@ var _Tooltip = /** @class */ (function (_super) {
|
|
|
210
210
|
break;
|
|
211
211
|
// Default - Secondary
|
|
212
212
|
default:
|
|
213
|
+
// Set the default theme
|
|
213
214
|
theme = "secondary";
|
|
215
|
+
// See if a button exists
|
|
216
|
+
if (this.props.btnProps && this.props.btnProps.type > 0) {
|
|
217
|
+
// Match the theme to the button type
|
|
218
|
+
switch (this.props.type) {
|
|
219
|
+
// Danger
|
|
220
|
+
case button_1.ButtonTypes.Danger:
|
|
221
|
+
case button_1.ButtonTypes.OutlineDanger:
|
|
222
|
+
theme = "danger";
|
|
223
|
+
break;
|
|
224
|
+
// Dark
|
|
225
|
+
case button_1.ButtonTypes.Dark:
|
|
226
|
+
case button_1.ButtonTypes.OutlineDark:
|
|
227
|
+
theme = "dark";
|
|
228
|
+
break;
|
|
229
|
+
// Info
|
|
230
|
+
case button_1.ButtonTypes.Info:
|
|
231
|
+
case button_1.ButtonTypes.OutlineInfo:
|
|
232
|
+
theme = "info";
|
|
233
|
+
break;
|
|
234
|
+
// Light
|
|
235
|
+
case button_1.ButtonTypes.Light:
|
|
236
|
+
case button_1.ButtonTypes.OutlineLight:
|
|
237
|
+
theme = "light";
|
|
238
|
+
break;
|
|
239
|
+
// Link
|
|
240
|
+
case button_1.ButtonTypes.Link:
|
|
241
|
+
case button_1.ButtonTypes.OutlineLink:
|
|
242
|
+
theme = "light-border";
|
|
243
|
+
break;
|
|
244
|
+
// Primary
|
|
245
|
+
case button_1.ButtonTypes.Primary:
|
|
246
|
+
case button_1.ButtonTypes.OutlinePrimary:
|
|
247
|
+
theme = "primary";
|
|
248
|
+
break;
|
|
249
|
+
// Secondary
|
|
250
|
+
case button_1.ButtonTypes.Secondary:
|
|
251
|
+
case button_1.ButtonTypes.OutlineSecondary:
|
|
252
|
+
theme = "secondary";
|
|
253
|
+
break;
|
|
254
|
+
// Success
|
|
255
|
+
case button_1.ButtonTypes.Success:
|
|
256
|
+
case button_1.ButtonTypes.OutlineSuccess:
|
|
257
|
+
theme = "success";
|
|
258
|
+
break;
|
|
259
|
+
// Warning
|
|
260
|
+
case button_1.ButtonTypes.Warning:
|
|
261
|
+
case button_1.ButtonTypes.OutlineWarning:
|
|
262
|
+
theme = "warning";
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
214
266
|
break;
|
|
215
267
|
}
|
|
216
268
|
// Set the options
|
|
@@ -55,6 +55,7 @@ var _TooltipGroup = /** @class */ (function (_super) {
|
|
|
55
55
|
for (var i = 0; i < tooltips.length; i++) {
|
|
56
56
|
var tooltipProps = tooltips[i];
|
|
57
57
|
// Set the properties
|
|
58
|
+
tooltipProps.options = tooltipProps.options || this.props.tooltipOptions;
|
|
58
59
|
tooltipProps.placement = tooltipProps.placement || this.props.tooltipPlacement;
|
|
59
60
|
tooltipProps.type = tooltipProps.type || this.props.tooltipType;
|
|
60
61
|
// See if the button props exists
|
package/dist/gd-bs-icons.js
CHANGED
|
@@ -1490,7 +1490,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
|
|
|
1490
1490
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
1491
1491
|
|
|
1492
1492
|
"use strict";
|
|
1493
|
-
eval("\n\nvar __extends = this && this.__extends || function () {\n var _extendStatics = function extendStatics(d, b) {\n _extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) {\n if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];\n }\n };\n\n return _extendStatics(d, b);\n };\n\n return function (d, b) {\n _extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n}();\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.TooltipGroup = void 0;\n\nvar base_1 = __webpack_require__(/*! ../base */ \"./src/components/base.ts\");\n\nvar tooltip_1 = __webpack_require__(/*! ../tooltip */ \"./src/components/tooltip/index.ts\");\n\nvar templates_1 = __webpack_require__(/*! ./templates */ \"./src/components/tooltipGroup/templates.ts\");\n/**\r\n * Tooltip Group\r\n * @property props - The tooltip group properties.\r\n */\n\n\nvar _TooltipGroup =\n/** @class */\nfunction (_super) {\n __extends(_TooltipGroup, _super); // Constructor\n\n\n function _TooltipGroup(props, template, btnTemplate) {\n if (template === void 0) {\n template = templates_1.HTML;\n }\n\n var _this = _super.call(this, template, props) || this;\n\n _this._tooltips = null; // Configure the tooltip group\n\n _this.configure(btnTemplate); // Configure the parent\n\n\n _this.configureParent();\n\n return _this;\n } // Configure the tooltip group\n\n\n _TooltipGroup.prototype.configure = function (btnTemplate) {\n // Set the attributes\n this.props.id ? this.el.id = this.props.id : null;\n this.props.label ? this.el.setAttribute(\"aria-label\", this.props.label) : null; // Set the class names\n\n this.el.classList.add(this.props.isVertical ? \"btn-group-vertical\" : \"btn-group\");\n this.props.isLarge ? this.el.classList.add(\"btn-group-lg\") : null;\n this.props.isSmall ? this.el.classList.add(\"btn-group-sm\") : null; // Render the tooltips\n\n this.renderTooltips(btnTemplate);\n }; // Render the tooltips\n\n\n _TooltipGroup.prototype.renderTooltips = function (tooltipTemplate) {\n // Clear the tooltips\n this._tooltips = []; // Parse the tooltips\n\n var tooltips = this.props.tooltips || [];\n\n for (var i = 0; i < tooltips.length; i++) {\n var tooltipProps = tooltips[i]; // Set the properties\n\n tooltipProps.placement = tooltipProps.placement || this.props.tooltipPlacement;\n tooltipProps.type = tooltipProps.type || this.props.tooltipType; // See if the button props exists\n\n if (tooltipProps.btnProps) {\n // Set the button type\n tooltipProps.btnProps.type = tooltipProps.btnProps.type || this.props.buttonType;\n } // Create the tooltip\n\n\n var tooltip = tooltip_1.Tooltip(tooltipProps, tooltipTemplate);\n\n this._tooltips.push(tooltip); // Append the tooltip to the group\n\n\n this.el.appendChild(tooltip.el);\n }\n };\n\n Object.defineProperty(_TooltipGroup.prototype, \"tooltips\", {\n /**\r\n * Public Interface\r\n */\n // Reference to the tooltips\n get: function get() {\n return this._tooltips;\n },\n enumerable: false,\n configurable: true\n });\n return _TooltipGroup;\n}(base_1.Base);\n\nexports.TooltipGroup = function (props, template, tooltipTemplate) {\n return new _TooltipGroup(props, template, tooltipTemplate);\n};\n\n//# sourceURL=webpack://gd-bs/./src/components/tooltipGroup/index.ts?");
|
|
1493
|
+
eval("\n\nvar __extends = this && this.__extends || function () {\n var _extendStatics = function extendStatics(d, b) {\n _extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) {\n if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];\n }\n };\n\n return _extendStatics(d, b);\n };\n\n return function (d, b) {\n _extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n}();\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.TooltipGroup = void 0;\n\nvar base_1 = __webpack_require__(/*! ../base */ \"./src/components/base.ts\");\n\nvar tooltip_1 = __webpack_require__(/*! ../tooltip */ \"./src/components/tooltip/index.ts\");\n\nvar templates_1 = __webpack_require__(/*! ./templates */ \"./src/components/tooltipGroup/templates.ts\");\n/**\r\n * Tooltip Group\r\n * @property props - The tooltip group properties.\r\n */\n\n\nvar _TooltipGroup =\n/** @class */\nfunction (_super) {\n __extends(_TooltipGroup, _super); // Constructor\n\n\n function _TooltipGroup(props, template, btnTemplate) {\n if (template === void 0) {\n template = templates_1.HTML;\n }\n\n var _this = _super.call(this, template, props) || this;\n\n _this._tooltips = null; // Configure the tooltip group\n\n _this.configure(btnTemplate); // Configure the parent\n\n\n _this.configureParent();\n\n return _this;\n } // Configure the tooltip group\n\n\n _TooltipGroup.prototype.configure = function (btnTemplate) {\n // Set the attributes\n this.props.id ? this.el.id = this.props.id : null;\n this.props.label ? this.el.setAttribute(\"aria-label\", this.props.label) : null; // Set the class names\n\n this.el.classList.add(this.props.isVertical ? \"btn-group-vertical\" : \"btn-group\");\n this.props.isLarge ? this.el.classList.add(\"btn-group-lg\") : null;\n this.props.isSmall ? this.el.classList.add(\"btn-group-sm\") : null; // Render the tooltips\n\n this.renderTooltips(btnTemplate);\n }; // Render the tooltips\n\n\n _TooltipGroup.prototype.renderTooltips = function (tooltipTemplate) {\n // Clear the tooltips\n this._tooltips = []; // Parse the tooltips\n\n var tooltips = this.props.tooltips || [];\n\n for (var i = 0; i < tooltips.length; i++) {\n var tooltipProps = tooltips[i]; // Set the properties\n\n tooltipProps.options = tooltipProps.options || this.props.tooltipOptions;\n tooltipProps.placement = tooltipProps.placement || this.props.tooltipPlacement;\n tooltipProps.type = tooltipProps.type || this.props.tooltipType; // See if the button props exists\n\n if (tooltipProps.btnProps) {\n // Set the button type\n tooltipProps.btnProps.type = tooltipProps.btnProps.type || this.props.buttonType;\n } // Create the tooltip\n\n\n var tooltip = tooltip_1.Tooltip(tooltipProps, tooltipTemplate);\n\n this._tooltips.push(tooltip); // Append the tooltip to the group\n\n\n this.el.appendChild(tooltip.el);\n }\n };\n\n Object.defineProperty(_TooltipGroup.prototype, \"tooltips\", {\n /**\r\n * Public Interface\r\n */\n // Reference to the tooltips\n get: function get() {\n return this._tooltips;\n },\n enumerable: false,\n configurable: true\n });\n return _TooltipGroup;\n}(base_1.Base);\n\nexports.TooltipGroup = function (props, template, tooltipTemplate) {\n return new _TooltipGroup(props, template, tooltipTemplate);\n};\n\n//# sourceURL=webpack://gd-bs/./src/components/tooltipGroup/index.ts?");
|
|
1494
1494
|
|
|
1495
1495
|
/***/ }),
|
|
1496
1496
|
|
|
@@ -1512,7 +1512,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
|
|
|
1512
1512
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
1513
1513
|
|
|
1514
1514
|
"use strict";
|
|
1515
|
-
eval("\n\nvar __extends = this && this.__extends || function () {\n var _extendStatics = function extendStatics(d, b) {\n _extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) {\n if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];\n }\n };\n\n return _extendStatics(d, b);\n };\n\n return function (d, b) {\n _extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n}();\n\nvar __assign = this && this.__assign || function () {\n __assign = Object.assign || function (t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return __assign.apply(this, arguments);\n};\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.Tooltip = exports.TooltipPlacements = exports.TooltipTypes = void 0;\n\nvar tippy_js_1 = __webpack_require__(/*! tippy.js */ \"./node_modules/.pnpm/tippy.js@6.3.7/node_modules/tippy.js/dist/tippy.esm.js\");\n\nvar libs_1 = __webpack_require__(/*! ../../libs */ \"./src/libs.ts\");\n\nvar base_1 = __webpack_require__(/*! ../base */ \"./src/components/base.ts\");\n\nvar button_1 = __webpack_require__(/*! ../button */ \"./src/components/button/index.ts\");\n\nvar common_1 = __webpack_require__(/*! ../common */ \"./src/components/common.ts\");\n/**\r\n * Tooltip Types\r\n */\n\n\nvar TooltipTypes;\n\n(function (TooltipTypes) {\n TooltipTypes[TooltipTypes[\"Danger\"] = 1] = \"Danger\";\n TooltipTypes[TooltipTypes[\"Dark\"] = 2] = \"Dark\";\n TooltipTypes[TooltipTypes[\"Info\"] = 3] = \"Info\";\n TooltipTypes[TooltipTypes[\"Light\"] = 4] = \"Light\";\n TooltipTypes[TooltipTypes[\"LightBorder\"] = 5] = \"LightBorder\";\n TooltipTypes[TooltipTypes[\"Material\"] = 6] = \"Material\";\n TooltipTypes[TooltipTypes[\"Primary\"] = 7] = \"Primary\";\n TooltipTypes[TooltipTypes[\"Secondary\"] = 8] = \"Secondary\";\n TooltipTypes[TooltipTypes[\"Success\"] = 9] = \"Success\";\n TooltipTypes[TooltipTypes[\"Translucent\"] = 10] = \"Translucent\";\n TooltipTypes[TooltipTypes[\"Warning\"] = 11] = \"Warning\";\n})(TooltipTypes = exports.TooltipTypes || (exports.TooltipTypes = {}));\n/**\r\n * Tooltip Placements\r\n */\n\n\nvar TooltipPlacements;\n\n(function (TooltipPlacements) {\n TooltipPlacements[TooltipPlacements[\"Auto\"] = 1] = \"Auto\";\n TooltipPlacements[TooltipPlacements[\"AutoStart\"] = 2] = \"AutoStart\";\n TooltipPlacements[TooltipPlacements[\"AutoEnd\"] = 3] = \"AutoEnd\";\n TooltipPlacements[TooltipPlacements[\"Bottom\"] = 4] = \"Bottom\";\n TooltipPlacements[TooltipPlacements[\"BottomStart\"] = 5] = \"BottomStart\";\n TooltipPlacements[TooltipPlacements[\"BottomEnd\"] = 6] = \"BottomEnd\";\n TooltipPlacements[TooltipPlacements[\"Left\"] = 7] = \"Left\";\n TooltipPlacements[TooltipPlacements[\"LeftStart\"] = 8] = \"LeftStart\";\n TooltipPlacements[TooltipPlacements[\"LeftEnd\"] = 9] = \"LeftEnd\";\n TooltipPlacements[TooltipPlacements[\"Right\"] = 10] = \"Right\";\n TooltipPlacements[TooltipPlacements[\"RightStart\"] = 11] = \"RightStart\";\n TooltipPlacements[TooltipPlacements[\"RightEnd\"] = 12] = \"RightEnd\";\n TooltipPlacements[TooltipPlacements[\"Top\"] = 13] = \"Top\";\n TooltipPlacements[TooltipPlacements[\"TopStart\"] = 14] = \"TopStart\";\n TooltipPlacements[TooltipPlacements[\"TopEnd\"] = 15] = \"TopEnd\";\n})(TooltipPlacements = exports.TooltipPlacements || (exports.TooltipPlacements = {}));\n/**\r\n * Tooltip\r\n */\n\n\nvar _Tooltip =\n/** @class */\nfunction (_super) {\n __extends(_Tooltip, _super); // Constructor\n\n\n function _Tooltip(props, template) {\n if (template === void 0) {\n template = \"\";\n }\n\n var _this = _super.call(this, template, props) || this;\n\n _this._btn = null;\n _this._elContent = null;\n _this._tippy = null; // Configure the collapse\n\n _this.configure(); // Configure the parent\n\n\n _this.configureParent();\n\n return _this;\n } // Configure the tooltip\n\n\n _Tooltip.prototype.configure = function () {\n // See if the target element was not defined\n if (this.props.target == null) {\n // Default the toggle property for the button\n var btnProps = this.props.btnProps || {};\n btnProps.type = btnProps.type || button_1.ButtonTypes.OutlineSecondary; // Create the button\n\n this._btn = button_1.Button(btnProps); // Update the element\n\n this.el = this._btn.el;\n } // Configure the options\n\n\n this.configureOptions();\n }; // Configure the options\n\n\n _Tooltip.prototype.configureOptions = function () {\n var _this = this; // Set the placements\n\n\n var placement = null;\n\n switch (this.props.placement) {\n // Auto\n case TooltipPlacements.Auto:\n placement = \"auto\";\n break;\n\n case TooltipPlacements.AutoEnd:\n placement = \"auto-end\";\n break;\n\n case TooltipPlacements.AutoStart:\n placement = \"auto-start\";\n break;\n // Bottom\n\n case TooltipPlacements.Bottom:\n placement = \"bottom\";\n break;\n\n case TooltipPlacements.BottomEnd:\n placement = \"bottom-end\";\n break;\n\n case TooltipPlacements.BottomStart:\n placement = \"bottom-start\";\n break;\n // Left\n\n case TooltipPlacements.Left:\n placement = \"left\";\n break;\n\n case TooltipPlacements.LeftEnd:\n placement = \"left-end\";\n break;\n\n case TooltipPlacements.LeftStart:\n placement = \"left-start\";\n break;\n // Right\n\n case TooltipPlacements.Right:\n placement = \"right\";\n break;\n\n case TooltipPlacements.RightEnd:\n placement = \"right-end\";\n break;\n\n case TooltipPlacements.RightStart:\n placement = \"right-start\";\n break;\n // Top\n\n case TooltipPlacements.Top:\n placement = \"top\";\n break;\n\n case TooltipPlacements.TopEnd:\n placement = \"top-end\";\n break;\n\n case TooltipPlacements.TopStart:\n placement = \"top-start\";\n break;\n // Default - Auto\n\n default:\n placement = \"top\";\n break;\n } // Set the theme\n\n\n var theme = null;\n\n switch (this.props.type) {\n // Dark\n case TooltipTypes.Dark:\n theme = \"dark\";\n break;\n // Danger\n\n case TooltipTypes.Danger:\n theme = \"danger\";\n break;\n // Info\n\n case TooltipTypes.Info:\n theme = \"info\";\n break;\n // Light\n\n case TooltipTypes.Light:\n theme = \"light\";\n break;\n\n case TooltipTypes.LightBorder:\n theme = \"light-border\";\n break;\n // Material\n\n case TooltipTypes.Material:\n theme = \"material\";\n break;\n // Primary\n\n case TooltipTypes.Primary:\n theme = \"primary\";\n break;\n // Secondary\n\n case TooltipTypes.Secondary:\n theme = \"secondary\";\n break;\n // Success\n\n case TooltipTypes.Success:\n theme = \"success\";\n break;\n // Translucent\n\n case TooltipTypes.Translucent:\n theme = \"translucent\";\n break;\n // Warning\n\n case TooltipTypes.Warning:\n theme = \"warning\";\n break;\n // Default - Secondary\n\n default:\n theme = \"secondary\";\n break;\n } // Set the options\n\n\n var options = __assign({\n allowHTML: false,\n animation: \"scale\",\n arrow: true,\n content: this.props.content,\n delay: 100,\n inertia: true,\n interactive: false,\n placement: placement,\n plugins: [tippy_js_1.animateFill, tippy_js_1.followCursor, tippy_js_1.inlinePositioning, tippy_js_1.sticky],\n theme: theme\n }, this.props.options); // Create the tooltip content element\n\n\n this._elContent = document.createElement(\"div\");\n\n this._elContent.classList.add(\"tooltip-content\");\n\n common_1.appendContent(this._elContent, options.content);\n options.content = this._elContent; // Set the on create event\n\n options[\"onCreate\"] = function (tippyObj) {\n // Get the content element\n var elContent = tippyObj.popper.querySelector(\".tippy-content\");\n\n if (elContent) {\n // Set the class\n elContent.classList.add(\"bs\"); // Get the custom class name(s)\n\n var custom = (_this.props.className || \"\").trim().split(\" \");\n\n for (var i = 0; i < custom.length; i++) {\n var className = custom[i]; // Add the custom class name\n\n className ? elContent.classList.add(custom[i]) : null;\n }\n } // Call the custom event if it's defined\n\n\n _this.props.options && _this.props.options.onCreate ? _this.props.options.onCreate(tippyObj) : null;\n }; // Create the tippy\n\n\n this._tippy = libs_1.tippy(this.props.target || this.el, options);\n };\n\n Object.defineProperty(_Tooltip.prototype, \"button\", {\n /**\r\n * Public Interface\r\n */\n // Reference to the button\n get: function get() {\n return this._btn;\n },\n enumerable: false,\n configurable: true\n }); // Disbles the tooltip\n\n _Tooltip.prototype.disable = function () {\n // Disable the button\n this._btn ? this._btn.disable() : null;\n }; // Enables the tooltip\n\n\n _Tooltip.prototype.enable = function () {\n // Enable the button\n this._btn ? this._btn.enable() : null;\n }; // Hides the tooltip\n\n\n _Tooltip.prototype.hide = function () {\n // See if it's visible\n if (this.isVisible) {\n this._tippy.hide();\n }\n };\n\n Object.defineProperty(_Tooltip.prototype, \"isVisible\", {\n // Determines if the tooltip is visible\n get: function get() {\n return this._tippy.state.isVisible;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(_Tooltip.prototype, \"tippy\", {\n // The tippy instance\n get: function get() {\n return this._tippy;\n },\n enumerable: false,\n configurable: true\n }); // Shows the tooltip\n\n _Tooltip.prototype.show = function () {\n // See if it's hidden\n if (!this.isVisible) {\n this._tippy.show();\n }\n }; // Toggles the tooltip\n\n\n _Tooltip.prototype.toggle = function () {\n // Toggle the element\n if (this.isVisible) {\n // Hide the element\n this.hide();\n } else {\n // Show the element\n this.show();\n }\n };\n\n return _Tooltip;\n}(base_1.Base);\n\nexports.Tooltip = function (props, template) {\n return new _Tooltip(props, template);\n};\n\n//# sourceURL=webpack://gd-bs/./src/components/tooltip/index.ts?");
|
|
1515
|
+
eval("\n\nvar __extends = this && this.__extends || function () {\n var _extendStatics = function extendStatics(d, b) {\n _extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) {\n if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];\n }\n };\n\n return _extendStatics(d, b);\n };\n\n return function (d, b) {\n _extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n}();\n\nvar __assign = this && this.__assign || function () {\n __assign = Object.assign || function (t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return __assign.apply(this, arguments);\n};\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.Tooltip = exports.TooltipPlacements = exports.TooltipTypes = void 0;\n\nvar tippy_js_1 = __webpack_require__(/*! tippy.js */ \"./node_modules/.pnpm/tippy.js@6.3.7/node_modules/tippy.js/dist/tippy.esm.js\");\n\nvar libs_1 = __webpack_require__(/*! ../../libs */ \"./src/libs.ts\");\n\nvar base_1 = __webpack_require__(/*! ../base */ \"./src/components/base.ts\");\n\nvar button_1 = __webpack_require__(/*! ../button */ \"./src/components/button/index.ts\");\n\nvar common_1 = __webpack_require__(/*! ../common */ \"./src/components/common.ts\");\n/**\r\n * Tooltip Types\r\n */\n\n\nvar TooltipTypes;\n\n(function (TooltipTypes) {\n TooltipTypes[TooltipTypes[\"Danger\"] = 1] = \"Danger\";\n TooltipTypes[TooltipTypes[\"Dark\"] = 2] = \"Dark\";\n TooltipTypes[TooltipTypes[\"Info\"] = 3] = \"Info\";\n TooltipTypes[TooltipTypes[\"Light\"] = 4] = \"Light\";\n TooltipTypes[TooltipTypes[\"LightBorder\"] = 5] = \"LightBorder\";\n TooltipTypes[TooltipTypes[\"Material\"] = 6] = \"Material\";\n TooltipTypes[TooltipTypes[\"Primary\"] = 7] = \"Primary\";\n TooltipTypes[TooltipTypes[\"Secondary\"] = 8] = \"Secondary\";\n TooltipTypes[TooltipTypes[\"Success\"] = 9] = \"Success\";\n TooltipTypes[TooltipTypes[\"Translucent\"] = 10] = \"Translucent\";\n TooltipTypes[TooltipTypes[\"Warning\"] = 11] = \"Warning\";\n})(TooltipTypes = exports.TooltipTypes || (exports.TooltipTypes = {}));\n/**\r\n * Tooltip Placements\r\n */\n\n\nvar TooltipPlacements;\n\n(function (TooltipPlacements) {\n TooltipPlacements[TooltipPlacements[\"Auto\"] = 1] = \"Auto\";\n TooltipPlacements[TooltipPlacements[\"AutoStart\"] = 2] = \"AutoStart\";\n TooltipPlacements[TooltipPlacements[\"AutoEnd\"] = 3] = \"AutoEnd\";\n TooltipPlacements[TooltipPlacements[\"Bottom\"] = 4] = \"Bottom\";\n TooltipPlacements[TooltipPlacements[\"BottomStart\"] = 5] = \"BottomStart\";\n TooltipPlacements[TooltipPlacements[\"BottomEnd\"] = 6] = \"BottomEnd\";\n TooltipPlacements[TooltipPlacements[\"Left\"] = 7] = \"Left\";\n TooltipPlacements[TooltipPlacements[\"LeftStart\"] = 8] = \"LeftStart\";\n TooltipPlacements[TooltipPlacements[\"LeftEnd\"] = 9] = \"LeftEnd\";\n TooltipPlacements[TooltipPlacements[\"Right\"] = 10] = \"Right\";\n TooltipPlacements[TooltipPlacements[\"RightStart\"] = 11] = \"RightStart\";\n TooltipPlacements[TooltipPlacements[\"RightEnd\"] = 12] = \"RightEnd\";\n TooltipPlacements[TooltipPlacements[\"Top\"] = 13] = \"Top\";\n TooltipPlacements[TooltipPlacements[\"TopStart\"] = 14] = \"TopStart\";\n TooltipPlacements[TooltipPlacements[\"TopEnd\"] = 15] = \"TopEnd\";\n})(TooltipPlacements = exports.TooltipPlacements || (exports.TooltipPlacements = {}));\n/**\r\n * Tooltip\r\n */\n\n\nvar _Tooltip =\n/** @class */\nfunction (_super) {\n __extends(_Tooltip, _super); // Constructor\n\n\n function _Tooltip(props, template) {\n if (template === void 0) {\n template = \"\";\n }\n\n var _this = _super.call(this, template, props) || this;\n\n _this._btn = null;\n _this._elContent = null;\n _this._tippy = null; // Configure the collapse\n\n _this.configure(); // Configure the parent\n\n\n _this.configureParent();\n\n return _this;\n } // Configure the tooltip\n\n\n _Tooltip.prototype.configure = function () {\n // See if the target element was not defined\n if (this.props.target == null) {\n // Default the toggle property for the button\n var btnProps = this.props.btnProps || {};\n btnProps.type = btnProps.type || button_1.ButtonTypes.OutlineSecondary; // Create the button\n\n this._btn = button_1.Button(btnProps); // Update the element\n\n this.el = this._btn.el;\n } // Configure the options\n\n\n this.configureOptions();\n }; // Configure the options\n\n\n _Tooltip.prototype.configureOptions = function () {\n var _this = this; // Set the placements\n\n\n var placement = null;\n\n switch (this.props.placement) {\n // Auto\n case TooltipPlacements.Auto:\n placement = \"auto\";\n break;\n\n case TooltipPlacements.AutoEnd:\n placement = \"auto-end\";\n break;\n\n case TooltipPlacements.AutoStart:\n placement = \"auto-start\";\n break;\n // Bottom\n\n case TooltipPlacements.Bottom:\n placement = \"bottom\";\n break;\n\n case TooltipPlacements.BottomEnd:\n placement = \"bottom-end\";\n break;\n\n case TooltipPlacements.BottomStart:\n placement = \"bottom-start\";\n break;\n // Left\n\n case TooltipPlacements.Left:\n placement = \"left\";\n break;\n\n case TooltipPlacements.LeftEnd:\n placement = \"left-end\";\n break;\n\n case TooltipPlacements.LeftStart:\n placement = \"left-start\";\n break;\n // Right\n\n case TooltipPlacements.Right:\n placement = \"right\";\n break;\n\n case TooltipPlacements.RightEnd:\n placement = \"right-end\";\n break;\n\n case TooltipPlacements.RightStart:\n placement = \"right-start\";\n break;\n // Top\n\n case TooltipPlacements.Top:\n placement = \"top\";\n break;\n\n case TooltipPlacements.TopEnd:\n placement = \"top-end\";\n break;\n\n case TooltipPlacements.TopStart:\n placement = \"top-start\";\n break;\n // Default - Auto\n\n default:\n placement = \"top\";\n break;\n } // Set the theme\n\n\n var theme = null;\n\n switch (this.props.type) {\n // Danger\n case TooltipTypes.Danger:\n theme = \"danger\";\n break;\n // Dark\n\n case TooltipTypes.Dark:\n theme = \"dark\";\n break;\n // Info\n\n case TooltipTypes.Info:\n theme = \"info\";\n break;\n // Light\n\n case TooltipTypes.Light:\n theme = \"light\";\n break;\n\n case TooltipTypes.LightBorder:\n theme = \"light-border\";\n break;\n // Material\n\n case TooltipTypes.Material:\n theme = \"material\";\n break;\n // Primary\n\n case TooltipTypes.Primary:\n theme = \"primary\";\n break;\n // Secondary\n\n case TooltipTypes.Secondary:\n theme = \"secondary\";\n break;\n // Success\n\n case TooltipTypes.Success:\n theme = \"success\";\n break;\n // Translucent\n\n case TooltipTypes.Translucent:\n theme = \"translucent\";\n break;\n // Warning\n\n case TooltipTypes.Warning:\n theme = \"warning\";\n break;\n // Default - Secondary\n\n default:\n // Set the default theme\n theme = \"secondary\"; // See if a button exists\n\n if (this.props.btnProps && this.props.btnProps.type > 0) {\n // Match the theme to the button type\n switch (this.props.type) {\n // Danger\n case button_1.ButtonTypes.Danger:\n case button_1.ButtonTypes.OutlineDanger:\n theme = \"danger\";\n break;\n // Dark\n\n case button_1.ButtonTypes.Dark:\n case button_1.ButtonTypes.OutlineDark:\n theme = \"dark\";\n break;\n // Info\n\n case button_1.ButtonTypes.Info:\n case button_1.ButtonTypes.OutlineInfo:\n theme = \"info\";\n break;\n // Light\n\n case button_1.ButtonTypes.Light:\n case button_1.ButtonTypes.OutlineLight:\n theme = \"light\";\n break;\n // Link\n\n case button_1.ButtonTypes.Link:\n case button_1.ButtonTypes.OutlineLink:\n theme = \"light-border\";\n break;\n // Primary\n\n case button_1.ButtonTypes.Primary:\n case button_1.ButtonTypes.OutlinePrimary:\n theme = \"primary\";\n break;\n // Secondary\n\n case button_1.ButtonTypes.Secondary:\n case button_1.ButtonTypes.OutlineSecondary:\n theme = \"secondary\";\n break;\n // Success\n\n case button_1.ButtonTypes.Success:\n case button_1.ButtonTypes.OutlineSuccess:\n theme = \"success\";\n break;\n // Warning\n\n case button_1.ButtonTypes.Warning:\n case button_1.ButtonTypes.OutlineWarning:\n theme = \"warning\";\n break;\n }\n }\n\n break;\n } // Set the options\n\n\n var options = __assign({\n allowHTML: false,\n animation: \"scale\",\n arrow: true,\n content: this.props.content,\n delay: 100,\n inertia: true,\n interactive: false,\n placement: placement,\n plugins: [tippy_js_1.animateFill, tippy_js_1.followCursor, tippy_js_1.inlinePositioning, tippy_js_1.sticky],\n theme: theme\n }, this.props.options); // Create the tooltip content element\n\n\n this._elContent = document.createElement(\"div\");\n\n this._elContent.classList.add(\"tooltip-content\");\n\n common_1.appendContent(this._elContent, options.content);\n options.content = this._elContent; // Set the on create event\n\n options[\"onCreate\"] = function (tippyObj) {\n // Get the content element\n var elContent = tippyObj.popper.querySelector(\".tippy-content\");\n\n if (elContent) {\n // Set the class\n elContent.classList.add(\"bs\"); // Get the custom class name(s)\n\n var custom = (_this.props.className || \"\").trim().split(\" \");\n\n for (var i = 0; i < custom.length; i++) {\n var className = custom[i]; // Add the custom class name\n\n className ? elContent.classList.add(custom[i]) : null;\n }\n } // Call the custom event if it's defined\n\n\n _this.props.options && _this.props.options.onCreate ? _this.props.options.onCreate(tippyObj) : null;\n }; // Create the tippy\n\n\n this._tippy = libs_1.tippy(this.props.target || this.el, options);\n };\n\n Object.defineProperty(_Tooltip.prototype, \"button\", {\n /**\r\n * Public Interface\r\n */\n // Reference to the button\n get: function get() {\n return this._btn;\n },\n enumerable: false,\n configurable: true\n }); // Disbles the tooltip\n\n _Tooltip.prototype.disable = function () {\n // Disable the button\n this._btn ? this._btn.disable() : null;\n }; // Enables the tooltip\n\n\n _Tooltip.prototype.enable = function () {\n // Enable the button\n this._btn ? this._btn.enable() : null;\n }; // Hides the tooltip\n\n\n _Tooltip.prototype.hide = function () {\n // See if it's visible\n if (this.isVisible) {\n this._tippy.hide();\n }\n };\n\n Object.defineProperty(_Tooltip.prototype, \"isVisible\", {\n // Determines if the tooltip is visible\n get: function get() {\n return this._tippy.state.isVisible;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(_Tooltip.prototype, \"tippy\", {\n // The tippy instance\n get: function get() {\n return this._tippy;\n },\n enumerable: false,\n configurable: true\n }); // Shows the tooltip\n\n _Tooltip.prototype.show = function () {\n // See if it's hidden\n if (!this.isVisible) {\n this._tippy.show();\n }\n }; // Toggles the tooltip\n\n\n _Tooltip.prototype.toggle = function () {\n // Toggle the element\n if (this.isVisible) {\n // Hide the element\n this.hide();\n } else {\n // Show the element\n this.show();\n }\n };\n\n return _Tooltip;\n}(base_1.Base);\n\nexports.Tooltip = function (props, template) {\n return new _Tooltip(props, template);\n};\n\n//# sourceURL=webpack://gd-bs/./src/components/tooltip/index.ts?");
|
|
1516
1516
|
|
|
1517
1517
|
/***/ }),
|
|
1518
1518
|
|