UNPKG

bootstrap-vue-next

Version:

Seamless integration of Vue 3, Bootstrap 5, and TypeScript for modern, type-safe UI development

1 lines 8.7 kB
{"version":3,"file":"VisuallyHiddenInput-D1SjTCVH.mjs","names":[],"sources":["../../../node_modules/.pnpm/reka-ui@2.9.2_vue@3.5.31_typescript@5.9.3_/node_modules/reka-ui/dist/VisuallyHidden/VisuallyHiddenInputBubble.js","../../../node_modules/.pnpm/reka-ui@2.9.2_vue@3.5.31_typescript@5.9.3_/node_modules/reka-ui/dist/VisuallyHidden/VisuallyHiddenInput.js"],"sourcesContent":["import { usePrimitiveElement } from \"../Primitive/usePrimitiveElement.js\";\nimport { VisuallyHidden_default } from \"./VisuallyHidden.js\";\nimport { computed, createBlock, defineComponent, mergeProps, openBlock, watch } from \"vue\";\n\n//#region src/VisuallyHidden/VisuallyHiddenInputBubble.vue?vue&type=script&setup=true&lang.ts\nvar VisuallyHiddenInputBubble_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({\n\tinheritAttrs: false,\n\t__name: \"VisuallyHiddenInputBubble\",\n\tprops: {\n\t\tname: {\n\t\t\ttype: String,\n\t\t\trequired: true\n\t\t},\n\t\tvalue: {\n\t\t\ttype: null,\n\t\t\trequired: true\n\t\t},\n\t\tchecked: {\n\t\t\ttype: Boolean,\n\t\t\trequired: false,\n\t\t\tdefault: void 0\n\t\t},\n\t\trequired: {\n\t\t\ttype: Boolean,\n\t\t\trequired: false\n\t\t},\n\t\tdisabled: {\n\t\t\ttype: Boolean,\n\t\t\trequired: false\n\t\t},\n\t\tfeature: {\n\t\t\ttype: String,\n\t\t\trequired: false,\n\t\t\tdefault: \"fully-hidden\"\n\t\t}\n\t},\n\tsetup(__props) {\n\t\tconst props = __props;\n\t\tconst { primitiveElement, currentElement } = usePrimitiveElement();\n\t\tconst valueState = computed(() => props.checked ?? props.value);\n\t\twatch(valueState, (cur, prev) => {\n\t\t\tif (!currentElement.value) return;\n\t\t\tconst input = currentElement.value;\n\t\t\tconst inputProto = window.HTMLInputElement.prototype;\n\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(inputProto, \"value\");\n\t\t\tconst setValue = descriptor.set;\n\t\t\tif (setValue && cur !== prev) {\n\t\t\t\tconst inputEvent = new Event(\"input\", { bubbles: true });\n\t\t\t\tconst changeEvent = new Event(\"change\", { bubbles: true });\n\t\t\t\tsetValue.call(input, cur);\n\t\t\t\tinput.dispatchEvent(inputEvent);\n\t\t\t\tinput.dispatchEvent(changeEvent);\n\t\t\t}\n\t\t});\n\t\treturn (_ctx, _cache) => {\n\t\t\treturn openBlock(), createBlock(VisuallyHidden_default, mergeProps({\n\t\t\t\tref_key: \"primitiveElement\",\n\t\t\t\tref: primitiveElement\n\t\t\t}, {\n\t\t\t\t...props,\n\t\t\t\t..._ctx.$attrs\n\t\t\t}, { as: \"input\" }), null, 16);\n\t\t};\n\t}\n});\n\n//#endregion\n//#region src/VisuallyHidden/VisuallyHiddenInputBubble.vue\nvar VisuallyHiddenInputBubble_default = VisuallyHiddenInputBubble_vue_vue_type_script_setup_true_lang_default;\n\n//#endregion\nexport { VisuallyHiddenInputBubble_default };\n//# sourceMappingURL=VisuallyHiddenInputBubble.js.map","import { VisuallyHiddenInputBubble_default } from \"./VisuallyHiddenInputBubble.js\";\nimport { Fragment, computed, createBlock, createCommentVNode, createElementBlock, defineComponent, mergeProps, openBlock, renderList } from \"vue\";\n\n//#region src/VisuallyHidden/VisuallyHiddenInput.vue?vue&type=script&setup=true&lang.ts\nvar VisuallyHiddenInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({\n\tinheritAttrs: false,\n\t__name: \"VisuallyHiddenInput\",\n\tprops: {\n\t\tname: {\n\t\t\ttype: String,\n\t\t\trequired: true\n\t\t},\n\t\tvalue: {\n\t\t\ttype: null,\n\t\t\trequired: true\n\t\t},\n\t\tchecked: {\n\t\t\ttype: Boolean,\n\t\t\trequired: false,\n\t\t\tdefault: void 0\n\t\t},\n\t\trequired: {\n\t\t\ttype: Boolean,\n\t\t\trequired: false\n\t\t},\n\t\tdisabled: {\n\t\t\ttype: Boolean,\n\t\t\trequired: false\n\t\t},\n\t\tfeature: {\n\t\t\ttype: String,\n\t\t\trequired: false,\n\t\t\tdefault: \"fully-hidden\"\n\t\t}\n\t},\n\tsetup(__props) {\n\t\tconst props = __props;\n\t\tconst isFormArrayEmptyAndRequired = computed(() => typeof props.value === \"object\" && Array.isArray(props.value) && props.value.length === 0 && props.required);\n\t\tconst parsedValue = computed(() => {\n\t\t\tif (typeof props.value === \"string\" || typeof props.value === \"number\" || typeof props.value === \"boolean\" || props.value === null || props.value === void 0) return [{\n\t\t\t\tname: props.name,\n\t\t\t\tvalue: props.value\n\t\t\t}];\n\t\t\telse if (typeof props.value === \"object\" && Array.isArray(props.value)) return props.value.flatMap((obj, index) => {\n\t\t\t\tif (typeof obj === \"object\") return Object.entries(obj).map(([key, value]) => ({\n\t\t\t\t\tname: `${props.name}[${index}][${key}]`,\n\t\t\t\t\tvalue\n\t\t\t\t}));\n\t\t\t\telse return {\n\t\t\t\t\tname: `${props.name}[${index}]`,\n\t\t\t\t\tvalue: obj\n\t\t\t\t};\n\t\t\t});\n\t\t\telse if (props.value !== null && typeof props.value === \"object\" && !Array.isArray(props.value)) return Object.entries(props.value).map(([key, value]) => ({\n\t\t\t\tname: `${props.name}[${key}]`,\n\t\t\t\tvalue\n\t\t\t}));\n\t\t\treturn [];\n\t\t});\n\t\treturn (_ctx, _cache) => {\n\t\t\treturn openBlock(), createElementBlock(Fragment, null, [createCommentVNode(\" We render single input if it's required \"), isFormArrayEmptyAndRequired.value ? (openBlock(), createBlock(VisuallyHiddenInputBubble_default, mergeProps({ key: _ctx.name }, {\n\t\t\t\t...props,\n\t\t\t\t..._ctx.$attrs\n\t\t\t}, {\n\t\t\t\tname: _ctx.name,\n\t\t\t\tvalue: _ctx.value\n\t\t\t}), null, 16, [\"name\", \"value\"])) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(parsedValue.value, (parsed) => {\n\t\t\t\treturn openBlock(), createBlock(VisuallyHiddenInputBubble_default, mergeProps({ key: parsed.name }, { ref_for: true }, {\n\t\t\t\t\t...props,\n\t\t\t\t\t..._ctx.$attrs\n\t\t\t\t}, {\n\t\t\t\t\tname: parsed.name,\n\t\t\t\t\tvalue: parsed.value\n\t\t\t\t}), null, 16, [\"name\", \"value\"]);\n\t\t\t}), 128))], 2112);\n\t\t};\n\t}\n});\n\n//#endregion\n//#region src/VisuallyHidden/VisuallyHiddenInput.vue\nvar VisuallyHiddenInput_default = VisuallyHiddenInput_vue_vue_type_script_setup_true_lang_default;\n\n//#endregion\nexport { VisuallyHiddenInput_default };\n//# sourceMappingURL=VisuallyHiddenInput.js.map"],"x_google_ignoreList":[0,1],"mappings":";;;AAoEA,IAAI,oCA/DwF,gCAAgB;CAC3G,cAAc;CACd,QAAQ;CACR,OAAO;EACN,MAAM;GACL,MAAM;GACN,UAAU;GACV;EACD,OAAO;GACN,MAAM;GACN,UAAU;GACV;EACD,SAAS;GACR,MAAM;GACN,UAAU;GACV,SAAS,KAAK;GACd;EACD,UAAU;GACT,MAAM;GACN,UAAU;GACV;EACD,UAAU;GACT,MAAM;GACN,UAAU;GACV;EACD,SAAS;GACR,MAAM;GACN,UAAU;GACV,SAAS;GACT;EACD;CACD,MAAM,SAAS;EACd,MAAM,QAAQ;EACd,MAAM,EAAE,kBAAkB,mBAAmB,qBAAqB;AAElE,QADmB,eAAe,MAAM,WAAW,MAAM,MAAM,GAC5C,KAAK,SAAS;AAChC,OAAI,CAAC,eAAe,MAAO;GAC3B,MAAM,QAAQ,eAAe;GAC7B,MAAM,aAAa,OAAO,iBAAiB;GAE3C,MAAM,WADa,OAAO,yBAAyB,YAAY,QAAQ,CAC3C;AAC5B,OAAI,YAAY,QAAQ,MAAM;IAC7B,MAAM,aAAa,IAAI,MAAM,SAAS,EAAE,SAAS,MAAM,CAAC;IACxD,MAAM,cAAc,IAAI,MAAM,UAAU,EAAE,SAAS,MAAM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