PageSourceSearch

https://accounts.purwakartakab.go.id/assets/controllers/tooltip_controller-xkydvJt.js

js purwakartakab.go.id collected 2026-10-02 16:49:06 UTC 13,956 bytes, 405 lines download raw bytes

1function _array_like_to_array(arr, len) {
2    if (len == null || len > arr.length) len = arr.length;
3    for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4    return arr2;
5}
6function _array_without_holes(arr) {
7    if (Array.isArray(arr)) return _array_like_to_array(arr);
8}
9function _assert_this_initialized(self) {
10    if (self === void 0) {
11        throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
12    }
13    return self;
14}
15function _class_call_check(instance, Constructor) {
16    if (!(instance instanceof Constructor)) {
17        throw new TypeError("Cannot call a class as a function");
18    }
19}
20function _defineProperties(target, props) {
21    for(var i = 0; i < props.length; i++){
22        var descriptor = props[i];
23        descriptor.enumerable = descriptor.enumerable || false;
24        descriptor.configurable = true;
25        if ("value" in descriptor) descriptor.writable = true;
26        Object.defineProperty(target, descriptor.key, descriptor);
27    }
28}
29function _create_class(Constructor, protoProps, staticProps) {
30    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
31    if (staticProps) _defineProperties(Constructor, staticProps);
32    return Constructor;
33}
34function _define_property(obj, key, value) {
35    if (key in obj) {
36        Object.defineProperty(obj, key, {
37            value: value,
38            enumerable: true,
39            configurable: true,
40            writable: true
41        });
42    } else {
43        obj[key] = value;
44    }
45    return obj;
46}
47function _get_prototype_of(o) {
48    _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
49        return o.__proto__ || Object.getPrototypeOf(o);
50    };
51    return _get_prototype_of(o);
52}
53function _inherits(subClass, superClass) {
54    if (typeof superClass !== "function" && superClass !== null) {
55        throw new TypeError("Super expression must either be null or a function");
56    }
57    subClass.prototype = Object.create(superClass && superClass.prototype, {
58        constructor: {
59            value: subClass,
60            writable: true,
61            configurable: true
62        }
63    });
64    if (superClass) _set_prototype_of(subClass, superClass);
65}
66function _iterable_to_array(iter) {
67    if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
68}
69function _non_iterable_spread() {
70    throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
71}
72function _possible_constructor_return(self, call) {
73    if (call && (_type_of(call) === "object" || typeof call === "function")) {
74        return call;
75    }
76    return _assert_this_initialized(self);
77}
78function _set_prototype_of(o, p) {
79    _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
80        o.__proto__ = p;
81        return o;
82    };
83    return _set_prototype_of(o, p);
84}
85function _to_consumable_array(arr) {
86    return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
87}
88function _type_of(obj) {
89    "@swc/helpers - typeof";
90    return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
91}
92function _unsupported_iterable_to_array(o, minLen) {
93    if (!o) return;
94    if (typeof o === "string") return _array_like_to_array(o, minLen);
95    var n = Object.prototype.toString.call(o).slice(8, -1);
96    if (n === "Object" && o.constructor) n = o.constructor.name;
97    if (n === "Map" || n === "Set") return Array.from(n);
98    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
99}
100function _is_native_reflect_construct() {
101    if (typeof Reflect === "undefined" || !Reflect.construct) return false;
102    if (Reflect.construct.sham) return false;
103    if (typeof Proxy === "function") return true;
104    try {
105        Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
106        return true;
107    } catch (e) {
108        return false;
109    }
110}
111function _create_super(Derived) {
112    var hasNativeReflectConstruct = _is_native_reflect_construct();
113    return function _createSuperInternal() {
114        var Super = _get_prototype_of(Derived), result;
115        if (hasNativeReflectConstruct) {
116            var NewTarget = _get_prototype_of(this).constructor;
117            result = Reflect.construct(Super, arguments, NewTarget);
118        } else {
119            result = Super.apply(this, arguments);
120        }
121        return _possible_constructor_return(this, result);
122    };
123}
124import { Controller } from "@hotwired/stimulus";
125import tippy from "tippy.js";
126import "tippy.js/dist/tippy.css";
127import "tippy.js/animations/shift-away.css";
128var _class = /*#__PURE__*/ function(Controller) {
129    "use strict";
130    _inherits(_class, Controller);
131    var _super = _create_super(_class);
132    function _class() {
133        _class_call_check(this, _class);
134        var _this;
135        _this = _super.apply(this, arguments);
136        _define_property(_assert_this_initialized(_this), "tippyInstance", null);
137        return _this;
138    }
139    _create_class(_class, [
140        {
141            key: "connect",
142            value: function connect() {
143                this.createTooltip();
144            }
145        },
146        {
147            key: "disconnect",
148            value: function disconnect() {
149                this.destroyTooltip();
150            }
151        },
152        {
153            key: "createTooltip",
154            value: /**
155     * Create the tippy tooltip instance
156     */ function createTooltip() {
157                if (this.disabledValue) {
158                    return;
159                }
160                var content = this.buildTooltipContent();
161                if (!content) {
162                    return;
163                }
164                this.tippyInstance = tippy(this.element, {
165                    content: content,
166                    allowHTML: true,
167                    placement: this.placementValue,
168                    delay: [
169                        this.delayValue,
170                        0
171                    ],
172                    theme: "bootstrap",
173                    animation: "shift-away",
174                    arrow: true,
175                    trigger: this.triggerValue,
176                    interactive: this.interactiveValue,
177                    maxWidth: this.maxWidthValue
178                });
179            }
180        },
181        {
182            key: "destroyTooltip",
183            value: /**
184     * Destroy the tippy tooltip instance
185     */ function destroyTooltip() {
186                if (this.tippyInstance) {
187                    this.tippyInstance.destroy();
188                    this.tippyInstance = null;
189                }
190            }
191        },
192        {
193            key: "buildTooltipContent",
194            value: /**
195     * Build the tooltip content with shortcuts if provided
196     */ function buildTooltipContent() {
197                var _this = this;
198                var content = "";
199                // Determine base content
200                if (this.hasHtmlValue && this.htmlValue) {
201                    content = this.htmlValue;
202                } else if (this.hasContentValue && this.contentValue) {
203                    content = this.escapeHtml(this.contentValue);
204                }
205                // Add shortcuts if provided
206                var shortcuts = this.getShortcuts();
207                if (shortcuts.length > 0) {
208                    var shortcutHtml = shortcuts.map(function(shortcut) {
209                        return _this.formatShortcut(shortcut);
210                    }).join(", ");
211                    if (content) {
212                        content += '<br><span class="el-muted">'.concat(shortcutHtml, "</span>");
213                    } else {
214                        content = shortcutHtml;
215                    }
216                }
217                return content;
218            }
219        },
220        {
221            key: "getShortcuts",
222            value: /**
223     * Get all shortcuts (from either shortcut or shortcuts value)
224     */ function getShortcuts() {
225                var shortcuts = [];
226                if (this.hasShortcutValue && this.shortcutValue) {
227                    shortcuts.push(this.shortcutValue);
228                }
229                if (this.hasShortcutsValue && this.shortcutsValue) {
230                    var _shortcuts;
231                    (_shortcuts = shortcuts).push.apply(_shortcuts, _to_consumable_array(this.shortcutsValue));
232                }
233                return shortcuts;
234            }
235        },
236        {
237            key: "formatShortcut",
238            value: /**
239     * Format a keyboard shortcut with <kbd> tags
240     * Splits on + and wraps each key in <kbd>
241     */ function formatShortcut(shortcut) {
242                var _this = this;
243                var keys = shortcut.split("+").map(function(key) {
244                    return key.trim();
245                });
246                var kbdElements = keys.map(function(key) {
247                    return "<kbd>
247".concat(_this.escapeHtml(key), "</kbd>");
248                });
249                return kbdElements.join('<span class="el-muted">+</span>');
250            }
251        },
252        {
253            key: "escapeHtml",
254            value: /**
255     * Escape HTML special characters
256     */ function escapeHtml(text) {
257                var div = document.createElement("div");
258                div.textContent = text;
259                return div.innerHTML;
260            }
261        },
262        {
263            /**
264     * Update tooltip content when values change
265     */ key: "contentValueChanged",
266            value: function contentValueChanged() {
267                this.updateTooltipContent();
268            }
269        },
270        {
271            key: "htmlValueChanged",
272            value: function htmlValueChanged() {
273                this.updateTooltipContent();
274            }
275        },
276        {
277            key: "shortcutValueChanged",
278            value: function shortcutValueChanged() {
279                this.updateTooltipContent();
280            }
281        },
282        {
283            key: "shortcutsValueChanged",
284            value: function shortcutsValueChanged() {
285                this.updateTooltipContent();
286            }
287        },
288        {
289            key: "disabledValueChanged",
290            value: function disabledValueChanged() {
291                if (this.disabledValue) {
292                    this.destroyTooltip();
293                } else if (!this.tippyInstance) {
294                    this.createTooltip();
295                }
296            }
297        },
298        {
299            key: "updateTooltipContent",
300            value: /**
301     * Update the tooltip content
302     */ function updateTooltipContent() {
303                if (this.tippyInstance) {
304                    var content = this.buildTooltipContent();
305                    if (content) {
306                        this.tippyInstance.setContent(content);
307                    } else {
308                        this.destroyTooltip();
309                    }
310                } else if (!this.disabledValue) {
311                    this.createTooltip();
312                }
313            }
314        }
315    ]);
316    return _class;
317}(Controller);
318_define_property(_class, "values", {
319    content: String,
320    html: String,
321    shortcut: String,
322    shortcuts: Array,
323    placement: {
324        type: String,
325        default: "bottom"
326    },
327    delay: {
328        type: Number,
329        default: 300
330    },
331    disabled: Boolean,
332    trigger: {
333        type: String,
334        default: "mouseenter focus"
335    },
336    interactive: {
337        type: Boolean,
338        default: false
339    },
340    maxWidth: {
341        type: Number,
342        default: 350
343    }
344});
345/**
346 * Tooltip Controller
347 * 
348 * Provides enhanced tooltips using Tippy.js with support for HTML content,
349 * keyboard shortcuts styled with <kbd> tags, and Bootstrap theming.
350 * 
351 * Controller identifier: tooltip
352 * 
353 * Basic Usage:
354 *   <button data-controller="tooltip" 
355 *           data-tooltip-content-value="Simple tooltip">
356 *     Hover me
357 *   </button>
358 * 
359 * With Keyboard Shortcuts:
360 *   <button data-controller="tooltip" 
361 *           data-tooltip-content-value="Delete" 
362 *           data-tooltip-shortcut-value="Del">
363 *     Delete
364 *   </button>
365 * 
366 * With Multiple Shortcuts:
367 *   <button data-controller="tooltip" 
368 *           data-tooltip-content-value="Refresh" 
369 *           data-tooltip-shortcuts-value='["Ctrl+R", "F5"]'>
370 *     Refresh
371 *   </button>
372 * 
373 * Custom HTML Content:
374 *   <button data-controller="tooltip" 
375 *           data-tooltip-html-value="<strong>Bold</strong> tooltip">
376 *     Hover me
377 *   </button>
378 * 
379 * Custom Placement:
380 *   <button data-controller="tooltip" 
381 *           data-tooltip-content-value="Top tooltip" 
382 *           data-tooltip-placement-value="top">
383 *     Hover me
384 *   </button>
385 * 
386 * Click-triggered Interactive Tooltip:
387 *   <button data-controller="tooltip" 
388 *           data-tooltip-trigger-value="click"
389 *           data-tooltip-interactive-value="true"
390 *           data-tooltip-html-value="<div>Interactive content with links</div>">
391 *     Click me
392 *   </button>
393 * 
394 * Values:
395 * - content: Plain text content for the tooltip
396 * - html: HTML content for the tooltip (overrides content)
397 * - shortcut: Single keyboard shortcut to display (e.g., "Ctrl+S")
398 * - shortcuts: Multiple keyboard shortcuts as JSON array
399 * - placement: Tooltip placement ('top', 'bottom', 'left', 'right', 'auto')
400 * - delay: Delay in ms before showing tooltip (default: 300)
401 * - disabled: Whether the tooltip is disabled
402 * - trigger: Event that triggers the tooltip (default: 'mouseenter focus', also: 'click')
403 * - interactive: Whether the tooltip content can be interacted with (default: false)
404 * - maxWidth: Maximum width of the tooltip in pixels (default: 350)
405 */ export { _class as default };

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.