UNPKG

@nextcloud/vue

Version:
98 lines (97 loc) 3.91 kB
import '../assets/NcFormBoxItem.css'; import { defineComponent, useSlots, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, createBlock, resolveDynamicComponent, mergeProps, withCtx, renderSlot, createTextVNode, toDisplayString, createCommentVNode } from "vue"; import { u as useNcFormBox } from "./useNcFormBox.mjs"; import { c as createElementId } from "./createElementId.mjs"; import { a as isLegacy } from "./legacy.mjs"; import { _ as _export_sfc } from "./_plugin-vue_export-helper.mjs"; const _hoisted_1 = ["id"]; const _sfc_main = /* @__PURE__ */ defineComponent({ ...{ inheritAttrs: false }, __name: "NcFormBoxItem", props: { tag: {}, label: { default: () => void 0 }, description: { default: () => void 0 }, invertedAccent: { type: Boolean, default: false }, class: { default: () => void 0 }, itemClasses: { default: () => void 0 } }, emits: ["click"], setup(__props) { const slots = useSlots(); const { formBoxItemClass } = useNcFormBox(); const descriptionId = createElementId(); const hasDescription = () => !!__props.description || !!slots.description; return (_ctx, _cache) => { return openBlock(), createElementBlock("div", { class: normalizeClass([ __props.class, _ctx.$style.formBoxItem, unref(formBoxItemClass), { [_ctx.$style.formBoxItem_inverted]: __props.invertedAccent && hasDescription(), [_ctx.$style.formBoxItem_legacy]: unref(isLegacy) } ]) }, [ createElementVNode("span", { class: normalizeClass(_ctx.$style.formBoxItem__content) }, [ (openBlock(), createBlock(resolveDynamicComponent(__props.tag), mergeProps({ class: [_ctx.$style.formBoxItem__element, __props.itemClasses] }, _ctx.$attrs, { onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click", $event)) }), { default: withCtx(() => [ renderSlot(_ctx.$slots, "default", { descriptionId: unref(descriptionId) }, () => [ createTextVNode(toDisplayString(__props.label || "⚠️ Label is missing"), 1) ]) ]), _: 3 }, 16, ["class"])), hasDescription() ? (openBlock(), createElementBlock("span", { key: 0, id: unref(descriptionId), class: normalizeClass(_ctx.$style.formBoxItem__description) }, [ renderSlot(_ctx.$slots, "description", {}, () => [ createTextVNode(toDisplayString(__props.description), 1) ]) ], 10, _hoisted_1)) : createCommentVNode("", true) ], 2), createElementVNode("span", { class: normalizeClass(_ctx.$style.formBoxItem__icon) }, [ renderSlot(_ctx.$slots, "icon", { descriptionId: unref(descriptionId) }, () => [ _cache[1] || (_cache[1] = createTextVNode(" ⚠️ Icon is missing ", -1)) ]) ], 2) ], 2); }; } }); const formBoxItem = "_formBoxItem_PJOAO"; const formBoxItem__description = "_formBoxItem__description_mgQF6"; const formBoxItem_legacy = "_formBoxItem_legacy_DqLYy"; const formBoxItem_inverted = "_formBoxItem_inverted_77j8f"; const formBoxItem__element = "_formBoxItem__element_l-vrn"; const formBoxItem__content = "_formBoxItem__content_x-g-c"; const formBoxItem__icon = "_formBoxItem__icon_ag5Tf"; const style0 = { "material-design-icon": "_material-design-icon_38d5k", formBoxItem, formBoxItem__description, formBoxItem_legacy, formBoxItem_inverted, formBoxItem__element, formBoxItem__content, formBoxItem__icon }; const cssModules = { "$style": style0 }; const NcFormBoxItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__cssModules", cssModules]]); export { NcFormBoxItem as N }; //# sourceMappingURL=NcFormBoxItem.mjs.map