@insightphp/forms
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -1,49 +0,77 @@ | ||
import { openBlock as s, createElementBlock as c } from "vue"; | ||
const a = (n, e) => { | ||
const t = n.__vccOpts || n; | ||
for (const [o, r] of e) | ||
t[o] = r; | ||
return t; | ||
}, l = {}; | ||
function i(n, e) { | ||
return s(), c("p", null, "this is stacked form"); | ||
} | ||
const _ = /* @__PURE__ */ a(l, [["render", i]]), m = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
import { defineComponent as s, openBlock as l, createElementBlock as o, Fragment as m, renderList as i, createTextVNode as p, toDisplayString as d, createCommentVNode as a, createElementVNode as c, createVNode as V, unref as _, normalizeClass as f } from "vue"; | ||
import { Portal as g, ViewComponentManager as h } from "@insightphp/inertia-view-components"; | ||
const y = { class: "space-y-6" }, b = { | ||
key: 0, | ||
class: "block text-sm font-medium text-gray-700" | ||
}, v = { | ||
key: 0, | ||
class: "text-danger-500" | ||
}, x = { class: "mt-1" }, k = /* @__PURE__ */ s({ | ||
__name: "StackedForm", | ||
props: { | ||
items: null, | ||
modelValue: null, | ||
errors: null | ||
}, | ||
setup(e) { | ||
return (r, u) => (l(), o("div", y, [ | ||
(l(!0), o(m, null, i(e.items, (t) => (l(), o("div", null, [ | ||
t.label ? (l(), o("label", b, [ | ||
p(d(t.label) + " ", 1), | ||
t.isRequired ? (l(), o("span", v, "*")) : a("", !0) | ||
])) : a("", !0), | ||
c("div", x, [ | ||
V(_(g), { | ||
component: t.fieldView, | ||
name: t.name, | ||
modelValue: e.modelValue[t.name], | ||
"onUpdate:modelValue": (n) => e.modelValue[t.name] = n, | ||
"inertia-form": e.modelValue, | ||
errors: e.errors, | ||
error: e.errors[t.name], | ||
"field-path": [] | ||
}, null, 8, ["component", "name", "modelValue", "onUpdate:modelValue", "inertia-form", "errors", "error"]) | ||
]) | ||
]))), 256)) | ||
])); | ||
} | ||
}), C = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
default: _ | ||
}, Symbol.toStringTag, { value: "Module" })), u = {}; | ||
function f(n, e) { | ||
return s(), c("p", null, "this is text input"); | ||
} | ||
const b = /* @__PURE__ */ a(u, [["render", f]]), g = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
default: k | ||
}, Symbol.toStringTag, { value: "Module" })), S = ["value", "type", "placeholder"], T = { | ||
key: 0, | ||
class: "mt-1 text-xs text-danger-600" | ||
}, j = /* @__PURE__ */ s({ | ||
__name: "TextInput", | ||
props: { | ||
name: null, | ||
modelValue: null, | ||
error: null, | ||
type: null, | ||
placeholder: null | ||
}, | ||
emits: ["update:modelValue"], | ||
setup(e, { emit: r }) { | ||
function u(t) { | ||
var n; | ||
r("update:modelValue", (n = t.target) == null ? void 0 : n.value); | ||
} | ||
return (t, n) => (l(), o(m, null, [ | ||
c("input", { | ||
value: e.modelValue, | ||
onInput: u, | ||
class: f(["form-input text-sm", [t.$attrs.class, { "has-error": !!e.error }]]), | ||
type: e.type, | ||
placeholder: e.placeholder || void 0 | ||
}, null, 42, S), | ||
e.error ? (l(), o("p", T, d(e.error), 1)) : a("", !0) | ||
], 64)); | ||
} | ||
}), w = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
default: b | ||
}, Symbol.toStringTag, { value: "Module" })); | ||
var h = Object.defineProperty, d = (n, e, t) => e in n ? h(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, v = (n, e, t) => (d(n, typeof e != "symbol" ? e + "" : e, t), t); | ||
class y { | ||
constructor() { | ||
v(this, "components", {}); | ||
} | ||
registerComponentsInNamespace(e, t, o = "app") { | ||
this.components.hasOwnProperty(o) || (this.components[o] = {}), Object.keys(e).forEach((r) => { | ||
const p = r.replace("./", "").replace(t.replace("./", ""), "").replace("/", "").replace(/\//g, "-"); | ||
this.components[o][this.resolveComponentName(p)] = e[r]; | ||
}); | ||
} | ||
resolveComponentName(e, t = null) { | ||
const o = e.split("/"), r = o[o.length - 1].replace(".vue", "").replace(/\B([A-Z])(?=[a-z])/g, "-$1").replace(/\B([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(); | ||
return t ? `${t}-${r}` : r; | ||
} | ||
boot(e) { | ||
Object.keys(this.components).forEach((t) => { | ||
Object.keys(this.components[t]).forEach((o) => { | ||
e.component(`${t}-${o}`, this.components[t][o].default); | ||
}); | ||
}); | ||
} | ||
} | ||
const O = new y(), k = { | ||
install(n, e) { | ||
O.registerComponentsInNamespace( | ||
/* @__PURE__ */ Object.assign({ "./ViewComponents/StackedForm.vue": m, "./ViewComponents/TextInput.vue": g }), | ||
default: j | ||
}, Symbol.toStringTag, { value: "Module" })), O = { | ||
install(e, r) { | ||
h.registerComponentsInNamespace( | ||
/* @__PURE__ */ Object.assign({ "./ViewComponents/StackedForm.vue": C, "./ViewComponents/TextInput.vue": w }), | ||
"./ViewComponents", | ||
@@ -55,5 +83,5 @@ "insight-forms" | ||
export { | ||
k as Plugin, | ||
_ as StackedForm, | ||
b as TextInput | ||
O as Plugin, | ||
k as StackedForm, | ||
j as TextInput | ||
}; |
@@ -1,1 +0,1 @@ | ||
(function(s,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],c):(s=typeof globalThis<"u"?globalThis:s||self,c(s.Forms={},s.Vue))})(this,function(s,c){"use strict";const i=(n,e)=>{const t=n.__vccOpts||n;for(const[o,r]of e)t[o]=r;return t},a={};function u(n,e){return c.openBlock(),c.createElementBlock("p",null,"this is stacked form")}const l=i(a,[["render",u]]),m=Object.freeze(Object.defineProperty({__proto__:null,default:l},Symbol.toStringTag,{value:"Module"})),_={};function f(n,e){return c.openBlock(),c.createElementBlock("p",null,"this is text input")}const p=i(_,[["render",f]]),d=Object.freeze(Object.defineProperty({__proto__:null,default:p},Symbol.toStringTag,{value:"Module"}));var b=Object.defineProperty,h=(n,e,t)=>e in n?b(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,g=(n,e,t)=>(h(n,typeof e!="symbol"?e+"":e,t),t);class v{constructor(){g(this,"components",{})}registerComponentsInNamespace(e,t,o="app"){this.components.hasOwnProperty(o)||(this.components[o]={}),Object.keys(e).forEach(r=>{const O=r.replace("./","").replace(t.replace("./",""),"").replace("/","").replace(/\//g,"-");this.components[o][this.resolveComponentName(O)]=e[r]})}resolveComponentName(e,t=null){const o=e.split("/"),r=o[o.length-1].replace(".vue","").replace(/\B([A-Z])(?=[a-z])/g,"-$1").replace(/\B([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return t?`${t}-${r}`:r}boot(e){Object.keys(this.components).forEach(t=>{Object.keys(this.components[t]).forEach(o=>{e.component(`${t}-${o}`,this.components[t][o].default)})})}}const y=new v,k={install(n,e){y.registerComponentsInNamespace(Object.assign({"./ViewComponents/StackedForm.vue":m,"./ViewComponents/TextInput.vue":d}),"./ViewComponents","insight-forms")}};s.Plugin=k,s.StackedForm=l,s.TextInput=p,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); | ||
(function(o,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@insightphp/inertia-view-components")):typeof define=="function"&&define.amd?define(["exports","vue","@insightphp/inertia-view-components"],e):(o=typeof globalThis<"u"?globalThis:o||self,e(o.Forms={},o.Vue,o.InertiaViewComponents))})(this,function(o,e,a){"use strict";const m={class:"space-y-6"},d={key:0,class:"block text-sm font-medium text-gray-700"},u={key:0,class:"text-danger-500"},p={class:"mt-1"},c=e.defineComponent({__name:"StackedForm",props:{items:null,modelValue:null,errors:null},setup(t){return(r,s)=>(e.openBlock(),e.createElementBlock("div",m,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,n=>(e.openBlock(),e.createElementBlock("div",null,[n.label?(e.openBlock(),e.createElementBlock("label",d,[e.createTextVNode(e.toDisplayString(n.label)+" ",1),n.isRequired?(e.openBlock(),e.createElementBlock("span",u,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",p,[e.createVNode(e.unref(a.Portal),{component:n.fieldView,name:n.name,modelValue:t.modelValue[n.name],"onUpdate:modelValue":l=>t.modelValue[n.name]=l,"inertia-form":t.modelValue,errors:t.errors,error:t.errors[n.name],"field-path":[]},null,8,["component","name","modelValue","onUpdate:modelValue","inertia-form","errors","error"])])]))),256))]))}}),f=Object.freeze(Object.defineProperty({__proto__:null,default:c},Symbol.toStringTag,{value:"Module"})),V=["value","type","placeholder"],g={key:0,class:"mt-1 text-xs text-danger-600"},i=e.defineComponent({__name:"TextInput",props:{name:null,modelValue:null,error:null,type:null,placeholder:null},emits:["update:modelValue"],setup(t,{emit:r}){function s(n){var l;r("update:modelValue",(l=n.target)==null?void 0:l.value)}return(n,l)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("input",{value:t.modelValue,onInput:s,class:e.normalizeClass(["form-input text-sm",[n.$attrs.class,{"has-error":!!t.error}]]),type:t.type,placeholder:t.placeholder||void 0},null,42,V),t.error?(e.openBlock(),e.createElementBlock("p",g,e.toDisplayString(t.error),1)):e.createCommentVNode("",!0)],64))}}),h=Object.freeze(Object.defineProperty({__proto__:null,default:i},Symbol.toStringTag,{value:"Module"})),_={install(t,r){a.ViewComponentManager.registerComponentsInNamespace(Object.assign({"./ViewComponents/StackedForm.vue":f,"./ViewComponents/TextInput.vue":h}),"./ViewComponents","insight-forms")}};o.Plugin=_,o.StackedForm=c,o.TextInput=i,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
@@ -1,2 +0,31 @@ | ||
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>; | ||
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{ | ||
items: Array<{ | ||
label: string | null; | ||
name: string; | ||
hint: string | null; | ||
isRequired: boolean; | ||
fieldView: any; | ||
}>; | ||
modelValue: any; | ||
errors: Record<string, string>; | ||
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{ | ||
items: Array<{ | ||
label: string | null; | ||
name: string; | ||
hint: string | null; | ||
isRequired: boolean; | ||
fieldView: any; | ||
}>; | ||
modelValue: any; | ||
errors: Record<string, string>; | ||
}>>>, {}>; | ||
export default _default; | ||
declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T; | ||
declare type __VLS_TypePropsToRuntimeProps<T> = { | ||
[K in keyof T]-?: {} extends Pick<T, K> ? { | ||
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>; | ||
} : { | ||
type: import('vue').PropType<T[K]>; | ||
required: true; | ||
}; | ||
}; |
@@ -1,2 +0,25 @@ | ||
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>; | ||
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{ | ||
name: string; | ||
modelValue: string | null | number; | ||
error: string | null; | ||
type: string; | ||
placeholder: string | null; | ||
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{ | ||
name: string; | ||
modelValue: string | null | number; | ||
error: string | null; | ||
type: string; | ||
placeholder: string | null; | ||
}>>> & { | ||
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined; | ||
}, {}>; | ||
export default _default; | ||
declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T; | ||
declare type __VLS_TypePropsToRuntimeProps<T> = { | ||
[K in keyof T]-?: {} extends Pick<T, K> ? { | ||
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>; | ||
} : { | ||
type: import('vue').PropType<T[K]>; | ||
required: true; | ||
}; | ||
}; |
{ | ||
"name": "@insightphp/forms", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Forms component of Insight.", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -11,7 +11,5 @@ import type { App } from "vue"; | ||
ViewComponentManager.registerComponentsInNamespace( | ||
import.meta.globEager('./ViewComponents/**/*.vue'), | ||
'./ViewComponents', | ||
'insight-forms', | ||
import.meta.globEager('./ViewComponents/**/*.vue'), './ViewComponents', 'insight-forms', | ||
) | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11483
194
1