UNPKG

v-dashkit

Version:

This template should help get you started developing with Vue 3 in Vite.

120 lines (119 loc) 4.97 kB
import { D as r } from "./utils.esm-8765b9e6.js"; import { B as p, s as c } from "./basedirective.esm-f0eabb7b.js"; import { B as m } from "./basecomponent.esm-3611fa56.js"; import { openBlock as f, createElementBlock as h, mergeProps as v, createElementVNode as y } from "vue"; var g = { root: "p-ink" }, b = m.extend({ name: "ripple", classes: g }), C = p.extend({ style: b }); function A(e) { return x(e) || w(e) || E(e) || k(); } function k() { throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); } function E(e, t) { if (e) { if (typeof e == "string") return s(e, t); var n = Object.prototype.toString.call(e).slice(8, -1); if (n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set") return Array.from(e); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return s(e, t); } } function w(e) { if (typeof Symbol < "u" && e[Symbol.iterator] != null || e["@@iterator"] != null) return Array.from(e); } function x(e) { if (Array.isArray(e)) return s(e); } function s(e, t) { (t == null || t > e.length) && (t = e.length); for (var n = 0, o = new Array(t); n < t; n++) o[n] = e[n]; return o; } var M = C.extend("ripple", { mounted: function(t) { var n, o = t == null || (n = t.$instance) === null || n === void 0 ? void 0 : n.$config; o && o.ripple && (this.create(t), this.bindEvents(t), t.setAttribute("data-pd-ripple", !0)); }, unmounted: function(t) { this.remove(t); }, timeout: void 0, methods: { bindEvents: function(t) { t.addEventListener("mousedown", this.onMouseDown.bind(this)); }, unbindEvents: function(t) { t.removeEventListener("mousedown", this.onMouseDown.bind(this)); }, create: function(t) { var n = r.createElement("span", { role: "presentation", "aria-hidden": !0, "data-p-ink": !0, "data-p-ink-active": !1, class: !this.isUnstyled() && this.cx("root"), onAnimationEnd: this.onAnimationEnd.bind(this), "p-bind": this.ptm("root") }); t.appendChild(n), this.$el = n; }, remove: function(t) { var n = this.getInk(t); n && (this.unbindEvents(t), n.removeEventListener("animationend", this.onAnimationEnd), n.remove()); }, onMouseDown: function(t) { var n = this, o = t.currentTarget, i = this.getInk(o); if (!(!i || getComputedStyle(i, null).display === "none")) { if (!this.isUnstyled() && r.removeClass(i, "p-ink-active"), i.setAttribute("data-p-ink-active", "false"), !r.getHeight(i) && !r.getWidth(i)) { var a = Math.max(r.getOuterWidth(o), r.getOuterHeight(o)); i.style.height = a + "px", i.style.width = a + "px"; } var u = r.getOffset(o), d = t.pageX - u.left + document.body.scrollTop - r.getWidth(i) / 2, l = t.pageY - u.top + document.body.scrollLeft - r.getHeight(i) / 2; i.style.top = l + "px", i.style.left = d + "px", !this.isUnstyled() && r.addClass(i, "p-ink-active"), i.setAttribute("data-p-ink-active", "true"), this.timeout = setTimeout(function() { i && (!n.isUnstyled() && r.removeClass(i, "p-ink-active"), i.setAttribute("data-p-ink-active", "false")); }, 401); } }, onAnimationEnd: function(t) { this.timeout && clearTimeout(this.timeout), !this.isUnstyled() && r.removeClass(t.currentTarget, "p-ink-active"), t.currentTarget.setAttribute("data-p-ink-active", "false"); }, getInk: function(t) { return t && t.children ? A(t.children).find(function(n) { return r.getAttribute(n, "data-pc-name") === "ripple"; }) : void 0; } } }), _ = { name: "PlusIcon", extends: c }, $ = /* @__PURE__ */ y("path", { d: "M7.67742 6.32258V0.677419C7.67742 0.497757 7.60605 0.325452 7.47901 0.198411C7.35197 0.0713707 7.17966 0 7 0C6.82034 0 6.64803 0.0713707 6.52099 0.198411C6.39395 0.325452 6.32258 0.497757 6.32258 0.677419V6.32258H0.677419C0.497757 6.32258 0.325452 6.39395 0.198411 6.52099C0.0713707 6.64803 0 6.82034 0 7C0 7.17966 0.0713707 7.35197 0.198411 7.47901C0.325452 7.60605 0.497757 7.67742 0.677419 7.67742H6.32258V13.3226C6.32492 13.5015 6.39704 13.6725 6.52358 13.799C6.65012 13.9255 6.82106 13.9977 7 14C7.17966 14 7.35197 13.9286 7.47901 13.8016C7.60605 13.6745 7.67742 13.5022 7.67742 13.3226V7.67742H13.3226C13.5022 7.67742 13.6745 7.60605 13.8016 7.47901C13.9286 7.35197 14 7.17966 14 7C13.9977 6.82106 13.9255 6.65012 13.799 6.52358C13.6725 6.39704 13.5015 6.32492 13.3226 6.32258H7.67742Z", fill: "currentColor" }, null, -1), I = [$]; function T(e, t, n, o, i, a) { return f(), h("svg", v({ width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, e.pti()), I, 16); } _.render = T; export { M as R, _ as s };