UNPKG

@ntohq/buefy-next

Version:

Lightweight UI components for Vue.js (v3) based on Bulma

86 lines (81 loc) 2.46 kB
import { a as PROGRESS_INJECTION_KEY, P as Progress } from './Progress-pDmKzy3s.js'; import { defineComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, renderSlot, createTextVNode, toDisplayString, createCommentVNode } from 'vue'; import { _ as _export_sfc, a as registerComponent } from './plugins-y-E4hvZJ.js'; import './config-3Md_fpMO.js'; const ProgressBar$1 = defineComponent({ name: "BProgressBar", inject: { parent: { from: PROGRESS_INJECTION_KEY, default: void 0 } }, props: { type: { type: [String], default: void 0 }, value: { type: Number, default: void 0 }, showValue: { type: Boolean, default: false } }, computed: { parentProgress() { return this.parent; }, newType() { return [ this.parentProgress.size, this.type || this.parentProgress.type ]; }, newShowValue() { return this.showValue || this.parentProgress.showValue; }, newValue() { return this.parentProgress.calculateValue(this.value); }, barWidth() { return `${(this.value === void 0 ? 0 : this.value) * 100 / this.parentProgress.max}%`; } } }); var _sfc_main = ProgressBar$1; const _hoisted_1 = ["aria-valuenow", "aria-valuemax"]; const _hoisted_2 = { key: 0, class: "progress-value" }; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("div", { class: normalizeClass(["progress-bar", _ctx.newType]), role: "progressbar", "aria-valuenow": _ctx.value, "aria-valuemax": _ctx.parentProgress.max, "aria-valuemin": "0", style: normalizeStyle({ width: _ctx.barWidth }) }, [ _ctx.newShowValue ? (openBlock(), createElementBlock("p", _hoisted_2, [ renderSlot(_ctx.$slots, "default", {}, () => [ createTextVNode( toDisplayString(_ctx.newValue), 1 /* TEXT */ ) ]) ])) : createCommentVNode("v-if", true) ], 14, _hoisted_1); } var ProgressBar = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/buefy-next/buefy-next/packages/buefy-next/src/components/progress/ProgressBar.vue"]]); const Plugin = { install(Vue) { registerComponent(Vue, Progress); registerComponent(Vue, ProgressBar); } }; export { Progress as BProgress, ProgressBar as BProgressBar, Plugin as default };