preline
Version:
Preline UI is an open-source set of prebuilt UI components based on the utility-first Tailwind CSS framework.
9 lines • 6.37 kB
JavaScript
!function(t,o){if("object"==typeof exports&&"object"==typeof module)module.exports=o();else if("function"==typeof define&&define.amd)define([],o);else{var n=o();for(var e in n)("object"==typeof exports?exports:t)[e]=n[e]}}(self,(()=>(()=>{"use strict";var t={961:(t,o)=>{Object.defineProperty(o,"__esModule",{value:!0});var n=function(){function t(t,o,n){this.el=t,this.options=o,this.events=n,this.el=t,this.options=o,this.events={}}return t.prototype.createCollection=function(t,o){var n;t.push({id:(null===(n=null==o?void 0:o.el)||void 0===n?void 0:n.id)||t.length+1,element:o})},t.prototype.fireEvent=function(t,o){if(void 0===o&&(o=null),this.events.hasOwnProperty(t))return this.events[t](o)},t.prototype.on=function(t,o){this.events[t]=o},t}();o.default=n},347:function(t,o,n){
/*
* HSRangeSlider
* @version: 2.5.0
* @author: Preline Labs Ltd.
* @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
* Copyright 2024 Preline Labs Ltd.
*/
var e,i=this&&this.__extends||(e=function(t,o){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o}||function(t,o){for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(t[n]=o[n])},e(t,o)},function(t,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function n(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)}),r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var o,n=1,e=arguments.length;n<e;n++)for(var i in o=arguments[n])Object.prototype.hasOwnProperty.call(o,i)&&(t[i]=o[i]);return t},r.apply(this,arguments)},s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(o,"__esModule",{value:!0});var a=function(t){function o(o,n,e){var i=t.call(this,o,n,e)||this,s=o.getAttribute("data-hs-range-slider"),a=s?JSON.parse(s):{};return i.concatOptions=r(r(r({},a),n),{cssClasses:r(r({},noUiSlider.cssClasses),i.processClasses(a.cssClasses))}),i.init(),i}return i(o,t),Object.defineProperty(o.prototype,"formattedValue",{get:function(){var t=this,o=this.el.noUiSlider.get();if(Array.isArray(o)&&this.format){var n=[];return o.forEach((function(o){n.push(t.format.to(o))})),n}return this.format?this.format.to(o):o},enumerable:!1,configurable:!0}),o.prototype.processClasses=function(t){var o={};return Object.keys(t).forEach((function(n){n&&(o[n]="".concat(noUiSlider.cssClasses[n]," ").concat(t[n]))})),o},o.prototype.init=function(){var t,o,n,e,i,r,s,a,l,c,u,d,f;this.createCollection(window.$hsRangeSliderCollection,this),("object"==typeof(null===(t=this.concatOptions)||void 0===t?void 0:t.formatter)?"thousandsSeparatorAndDecimalPoints"===(null===(n=null===(o=this.concatOptions)||void 0===o?void 0:o.formatter)||void 0===n?void 0:n.type):"thousandsSeparatorAndDecimalPoints"===(null===(e=this.concatOptions)||void 0===e?void 0:e.formatter))?this.thousandsSeparatorAndDecimalPointsFormatter():("object"==typeof(null===(i=this.concatOptions)||void 0===i?void 0:i.formatter)?"integer"===(null===(s=null===(r=this.concatOptions)||void 0===r?void 0:r.formatter)||void 0===s?void 0:s.type):"integer"===(null===(a=this.concatOptions)||void 0===a?void 0:a.formatter))?this.integerFormatter():"object"==typeof(null===(l=this.concatOptions)||void 0===l?void 0:l.formatter)&&((null===(u=null===(c=this.concatOptions)||void 0===c?void 0:c.formatter)||void 0===u?void 0:u.prefix)||(null===(f=null===(d=this.concatOptions)||void 0===d?void 0:d.formatter)||void 0===f?void 0:f.postfix))&&this.prefixOrPostfixFormatter(),noUiSlider.create(this.el,this.concatOptions),this.concatOptions.disabled&&this.setDisabled()},o.prototype.formatValue=function(t){var o,n,e,i,r,s,a,l,c,u="";return"object"==typeof(null===(o=this.concatOptions)||void 0===o?void 0:o.formatter)?((null===(e=null===(n=this.concatOptions)||void 0===n?void 0:n.formatter)||void 0===e?void 0:e.prefix)&&(u+=null===(r=null===(i=this.concatOptions)||void 0===i?void 0:i.formatter)||void 0===r?void 0:r.prefix),u+=t,(null===(a=null===(s=this.concatOptions)||void 0===s?void 0:s.formatter)||void 0===a?void 0:a.postfix)&&(u+=null===(c=null===(l=this.concatOptions)||void 0===l?void 0:l.formatter)||void 0===c?void 0:c.postfix)):u+=t,u},o.prototype.integerFormatter=function(){var t,o=this;this.format={to:function(t){return o.formatValue(Math.round(t))},from:function(t){return Math.round(+t)}},(null===(t=this.concatOptions)||void 0===t?void 0:t.tooltips)&&(this.concatOptions.tooltips=this.format)},o.prototype.prefixOrPostfixFormatter=function(){var t,o=this;this.format={to:function(t){return o.formatValue(t)},from:function(t){return+t}},(null===(t=this.concatOptions)||void 0===t?void 0:t.tooltips)&&(this.concatOptions.tooltips=this.format)},o.prototype.thousandsSeparatorAndDecimalPointsFormatter=function(){var t,o=this;this.format={to:function(t){return o.formatValue(new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}).format(t))},from:function(t){return parseFloat(t.replace(/,/g,""))}},(null===(t=this.concatOptions)||void 0===t?void 0:t.tooltips)&&(this.concatOptions.tooltips=this.format)},o.prototype.setDisabled=function(){this.el.setAttribute("disabled","disabled"),this.el.classList.add("disabled")},o.getInstance=function(t,o){void 0===o&&(o=!1);var n=window.$hsRangeSliderCollection.find((function(o){return o.element.el===("string"==typeof t?document.querySelector(t):t)}));return n?o?n:n.element.el:null},o.autoInit=function(){window.$hsRangeSliderCollection||(window.$hsRangeSliderCollection=[]),document.querySelectorAll("[data-hs-range-slider]:not(.--prevent-on-load-init)").forEach((function(t){window.$hsRangeSliderCollection.find((function(o){var n;return(null===(n=null==o?void 0:o.element)||void 0===n?void 0:n.el)===t}))||new o(t)}))},o.on=function(t,o,n){var e=window.$hsRangeSliderCollection.find((function(t){return t.element.el===("string"==typeof o?document.querySelector(o):o)}));e&&(e.element.events[t]=n)},o}(s(n(961)).default);window.addEventListener("load",(function(){a.autoInit()})),"undefined"!=typeof window&&(window.HSRangeSlider=a),o.default=a}},o={};var n=function n(e){var i=o[e];if(void 0!==i)return i.exports;var r=o[e]={exports:{}};return t[e].call(r.exports,r,r.exports,n),r.exports}(347);return n})()));