@phila/phila-ui-input-form 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # Vue 3 + TypeScript + Vite
2
+
3
+ This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
4
+
5
+ ## Recommended IDE Setup
6
+
7
+ - [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
8
+
9
+ ## Type Support For `.vue` Imports in TS
10
+
11
+ TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.
12
+
13
+ If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:
14
+
15
+ 1. Disable the built-in TypeScript Extension
16
+ 1. Run `Extensions: Show Built-in Extensions` from VSCode's command palette
17
+ 2. Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
18
+ 2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.
@@ -0,0 +1 @@
1
+ @font-face{font-family:Montserrat;src:local("Montserrat Regular"),local("Montserrat-Regular"),url(https://www.phila.gov/assets/fonts/Montserrat/Montserrat-Regular.woff2) format("woff2"),url(https://www.phila.gov/assets/fonts/Montserrat/Montserrat-Regular.woff) format("woff");font-weight:400;font-style:normal}@font-face{font-family:Open Sans;src:local("Open Sans Italic"),local("OpenSans-Italic"),url(https://www.phila.gov/assets/fonts/OpenSans/OpenSans-Italic.woff2) format("woff2"),url(https://www.phila.gov/assets/fonts/OpenSans/OpenSans-Italic.woff) format("woff");font-weight:400;font-style:italic}@font-face{font-family:Open Sans;src:local("Open Sans Bold Italic"),local("OpenSans-BoldItalic"),url(https://www.phila.gov/assets/fonts/OpenSans/OpenSans-BoldItalic.woff2) format("woff2"),url(https://www.phila.gov/assets/fonts/OpenSans/OpenSans-BoldItalic.woff) format("woff");font-weight:700;font-style:italic}@font-face{font-family:Montserrat;src:local("Montserrat Bold"),local("Montserrat-Bold"),url(https://www.phila.gov/assets/fonts/Montserrat/Montserrat-Bold.woff2) format("woff2"),url(https://www.phila.gov/assets/fonts/Montserrat/Montserrat-Bold.woff) format("woff");font-weight:700;font-style:normal}@font-face{font-family:Open Sans;src:local("Open Sans Bold"),local("OpenSans-Bold"),url(https://www.phila.gov/assets/fonts/OpenSans/OpenSans-Bold.woff2) format("woff2"),url(https://www.phila.gov/assets/fonts/OpenSans/OpenSans-Bold.woff) format("woff");font-weight:700;font-style:normal}@font-face{font-family:Open Sans;src:local("Open Sans SemiBold Italic"),local("OpenSans-SemiBoldItalic"),url(https://www.phila.gov/assets/fonts/OpenSans/OpenSans-SemiBoldItalic.woff2) format("woff2"),url(https://www.phila.gov/assets/fonts/OpenSans/OpenSans-SemiBoldItalic.woff) format("woff");font-weight:600;font-style:italic}@font-face{font-family:Open Sans;src:local("Open Sans SemiBold"),local("OpenSans-SemiBold"),url(https://www.phila.gov/assets/fonts/OpenSans/OpenSans-SemiBold.woff2) format("woff2"),url(https://www.phila.gov/assets/fonts/OpenSans/OpenSans-SemiBold.woff) format("woff");font-weight:600;font-style:normal}@font-face{font-family:Open Sans;src:local("Open Sans Regular"),local("OpenSans-Regular"),url(https://www.phila.gov/assets/fonts/OpenSans/OpenSans-Regular.woff2) format("woff2"),url(https://www.phila.gov/assets/fonts/OpenSans/OpenSans-Regular.woff) format("woff");font-weight:400;font-style:normal}.form-title[data-v-906e820c]{font-family:Montserrat,BlinkMacSystemFont,-apple-system,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,Helvetica,Arial,sans-serif;color:#444;font-weight:600;margin:0 0 .5rem;line-height:2.1875rem;font-size:1.75rem!important}.form-errors[data-v-906e820c]{font-size:.875rem;padding:1rem 1.5rem;background-color:#fee7e7;margin:1rem 0}.form-errors span.icon[data-v-906e820c]{font-size:1rem}
@@ -0,0 +1,62 @@
1
+ import "./InputForm.css";
2
+ import { defineComponent as f, computed as h, openBlock as s, createElementBlock as n, mergeProps as v, toDisplayString as d, createCommentVNode as i, renderSlot as c, createElementVNode as u, pushScopeId as y, popScopeId as _ } from "vue";
3
+ import g from "@phila/phila-ui-core";
4
+ const k = (t) => (y("data-v-906e820c"), t = t(), _(), t), I = ["id"], b = {
5
+ key: 0,
6
+ class: "form-title form-padding"
7
+ }, C = {
8
+ key: 1,
9
+ class: "form-subtitle form-padding"
10
+ }, E = {
11
+ key: 2,
12
+ class: "form-errors has-text-centered has-text-weight-bold has-text-love-park-red-dark"
13
+ }, S = /* @__PURE__ */ k(() => /* @__PURE__ */ u("span", { class: "icon" }, [
14
+ /* @__PURE__ */ u("i", { class: "fa fa-exclamation-triangle" })
15
+ ], -1)), $ = {
16
+ key: 3,
17
+ class: "form-submit form-padding"
18
+ }, { formHelpers: B } = g, { randomID: V } = B, P = /* @__PURE__ */ f({
19
+ __name: "InputForm",
20
+ props: {
21
+ id: { default: V() },
22
+ errors: { default() {
23
+ return [];
24
+ } },
25
+ optgroup: { type: Boolean },
26
+ options: {},
27
+ textKey: {},
28
+ valueKey: {},
29
+ imaskProps: {},
30
+ title: { default: "" },
31
+ desc: { default: "" },
32
+ hideErrorsCount: { type: Boolean, default: !1 }
33
+ },
34
+ setup(t) {
35
+ const o = t, r = h(() => Array.isArray(o.errors) ? o.errors.length : typeof o.errors == "string" || typeof o.errors == "number" ? 1 : l(o.errors)), l = (e) => Object.keys(e).map((a) => e[a]).reduce(
36
+ (a, m) => m.length > 0 ? a + 1 : a,
37
+ 0
38
+ );
39
+ return (e, p) => (s(), n("form", v({
40
+ id: `form-${e.id}`
41
+ }, e.$attrs, { novalidate: "" }), [
42
+ e.title ? (s(), n("div", b, d(e.title), 1)) : i("", !0),
43
+ e.desc ? (s(), n("p", C, d(e.desc), 1)) : i("", !0),
44
+ c(e.$slots, "default", {}, void 0, !0),
45
+ !e.hideErrorsCount && r.value > 0 ? (s(), n("div", E, [
46
+ S,
47
+ u("span", null, " This form has " + d(r.value) + " error" + d(r.value > 1 ? "s" : ""), 1)
48
+ ])) : i("", !0),
49
+ e.$slots.submit ? (s(), n("div", $, [
50
+ c(e.$slots, "submit", {}, void 0, !0)
51
+ ])) : i("", !0)
52
+ ], 16, I));
53
+ }
54
+ }), w = (t, o) => {
55
+ const r = t.__vccOpts || t;
56
+ for (const [l, e] of o)
57
+ r[l] = e;
58
+ return r;
59
+ }, N = /* @__PURE__ */ w(P, [["__scopeId", "data-v-906e820c"]]);
60
+ export {
61
+ N as default
62
+ };
@@ -0,0 +1,2 @@
1
+ (function(t,a){typeof exports=="object"&&typeof module<"u"?module.exports=a(require("vue"),require("@phila/phila-ui-core")):typeof define=="function"&&define.amd?define(["vue","@phila/phila-ui-core"],a):(t=typeof globalThis<"u"?globalThis:t||self,t.InputForm=a(t.Vue,t.PhilaUICore))})(this,function(t,a){"use strict";var f=document.createElement("style");f.textContent=`@font-face{font-family:Montserrat;src:local("Montserrat Regular"),local("Montserrat-Regular"),url(https://www.phila.gov/assets/fonts/Montserrat/Montserrat-Regular.woff2) format("woff2"),url(https://www.phila.gov/assets/fonts/Montserrat/Montserrat-Regular.woff) format("woff");font-weight:400;font-style:normal}@font-face{font-family:Open Sans;src:local("Open Sans Italic"),local("OpenSans-Italic"),url(https://www.phila.gov/assets/fonts/OpenSans/OpenSans-Italic.woff2) format("woff2"),url(https://www.phila.gov/assets/fonts/OpenSans/OpenSans-Italic.woff) format("woff");font-weight:400;font-style:italic}@font-face{font-family:Open Sans;src:local("Open Sans Bold Italic"),local("OpenSans-BoldItalic"),url(https://www.phila.gov/assets/fonts/OpenSans/OpenSans-BoldItalic.woff2) format("woff2"),url(https://www.phila.gov/assets/fonts/OpenSans/OpenSans-BoldItalic.woff) format("woff");font-weight:700;font-style:italic}@font-face{font-family:Montserrat;src:local("Montserrat Bold"),local("Montserrat-Bold"),url(https://www.phila.gov/assets/fonts/Montserrat/Montserrat-Bold.woff2) format("woff2"),url(https://www.phila.gov/assets/fonts/Montserrat/Montserrat-Bold.woff) format("woff");font-weight:700;font-style:normal}@font-face{font-family:Open Sans;src:local("Open Sans Bold"),local("OpenSans-Bold"),url(https://www.phila.gov/assets/fonts/OpenSans/OpenSans-Bold.woff2) format("woff2"),url(https://www.phila.gov/assets/fonts/OpenSans/OpenSans-Bold.woff) format("woff");font-weight:700;font-style:normal}@font-face{font-family:Open Sans;src:local("Open Sans SemiBold Italic"),local("OpenSans-SemiBoldItalic"),url(https://www.phila.gov/assets/fonts/OpenSans/OpenSans-SemiBoldItalic.woff2) format("woff2"),url(https://www.phila.gov/assets/fonts/OpenSans/OpenSans-SemiBoldItalic.woff) format("woff");font-weight:600;font-style:italic}@font-face{font-family:Open Sans;src:local("Open Sans SemiBold"),local("OpenSans-SemiBold"),url(https://www.phila.gov/assets/fonts/OpenSans/OpenSans-SemiBold.woff2) format("woff2"),url(https://www.phila.gov/assets/fonts/OpenSans/OpenSans-SemiBold.woff) format("woff");font-weight:600;font-style:normal}@font-face{font-family:Open Sans;src:local("Open Sans Regular"),local("OpenSans-Regular"),url(https://www.phila.gov/assets/fonts/OpenSans/OpenSans-Regular.woff2) format("woff2"),url(https://www.phila.gov/assets/fonts/OpenSans/OpenSans-Regular.woff) format("woff");font-weight:400;font-style:normal}.form-title[data-v-906e820c]{font-family:Montserrat,BlinkMacSystemFont,-apple-system,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,Helvetica,Arial,sans-serif;color:#444;font-weight:600;margin:0 0 .5rem;line-height:2.1875rem;font-size:1.75rem!important}.form-errors[data-v-906e820c]{font-size:.875rem;padding:1rem 1.5rem;background-color:#fee7e7;margin:1rem 0}.form-errors span.icon[data-v-906e820c]{font-size:1rem}
2
+ `,document.head.appendChild(f);const i=o=>(t.pushScopeId("data-v-906e820c"),o=o(),t.popScopeId(),o),p=["id"],c={key:0,class:"form-title form-padding"},m={key:1,class:"form-subtitle form-padding"},d={key:2,class:"form-errors has-text-centered has-text-weight-bold has-text-love-park-red-dark"},w=i(()=>t.createElementVNode("span",{class:"icon"},[t.createElementVNode("i",{class:"fa fa-exclamation-triangle"})],-1)),h={key:3,class:"form-submit form-padding"},{formHelpers:u}=a,{randomID:S}=u,g=t.defineComponent({__name:"InputForm",props:{id:{default:S()},errors:{default(){return[]}},optgroup:{type:Boolean},options:{},textKey:{},valueKey:{},imaskProps:{},title:{default:""},desc:{default:""},hideErrorsCount:{type:Boolean,default:!1}},setup(o){const n=o,s=t.computed(()=>Array.isArray(n.errors)?n.errors.length:typeof n.errors=="string"||typeof n.errors=="number"?1:l(n.errors)),l=e=>Object.keys(e).map(r=>e[r]).reduce((r,y)=>y.length>0?r+1:r,0);return(e,O)=>(t.openBlock(),t.createElementBlock("form",t.mergeProps({id:`form-${e.id}`},e.$attrs,{novalidate:""}),[e.title?(t.openBlock(),t.createElementBlock("div",c,t.toDisplayString(e.title),1)):t.createCommentVNode("",!0),e.desc?(t.openBlock(),t.createElementBlock("p",m,t.toDisplayString(e.desc),1)):t.createCommentVNode("",!0),t.renderSlot(e.$slots,"default",{},void 0,!0),!e.hideErrorsCount&&s.value>0?(t.openBlock(),t.createElementBlock("div",d,[w,t.createElementVNode("span",null," This form has "+t.toDisplayString(s.value)+" error"+t.toDisplayString(s.value>1?"s":""),1)])):t.createCommentVNode("",!0),e.$slots.submit?(t.openBlock(),t.createElementBlock("div",h,[t.renderSlot(e.$slots,"submit",{},void 0,!0)])):t.createCommentVNode("",!0)],16,p))}});return((o,n)=>{const s=o.__vccOpts||o;for(const[l,e]of n)s[l]=e;return s})(g,[["__scopeId","data-v-906e820c"]])});
@@ -0,0 +1,50 @@
1
+ import { InputProps, default as PhilaUICore } from '@phila/phila-ui-core';
2
+ import { InputFormProps } from './types';
3
+
4
+ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<InputProps & InputFormProps>, {
5
+ title: string;
6
+ desc: string;
7
+ hideErrorsCount: boolean;
8
+ errorsCount: number;
9
+ errors(): never[];
10
+ id: any;
11
+ }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<InputProps & InputFormProps>, {
12
+ title: string;
13
+ desc: string;
14
+ hideErrorsCount: boolean;
15
+ errorsCount: number;
16
+ errors(): never[];
17
+ id: any;
18
+ }>>>, {
19
+ id: string;
20
+ errors: PhilaUICore.InputErrors;
21
+ title: string;
22
+ desc: string;
23
+ hideErrorsCount: boolean;
24
+ }, {}>, {
25
+ default?(_: {}): any;
26
+ submit?(_: {}): any;
27
+ }>;
28
+ export default _default;
29
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
30
+ type __VLS_TypePropsToRuntimeProps<T> = {
31
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
32
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
33
+ } : {
34
+ type: import('vue').PropType<T[K]>;
35
+ required: true;
36
+ };
37
+ };
38
+ type __VLS_WithDefaults<P, D> = {
39
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
40
+ default: D[K];
41
+ }> : P[K];
42
+ };
43
+ type __VLS_Prettify<T> = {
44
+ [K in keyof T]: T[K];
45
+ } & {};
46
+ type __VLS_WithTemplateSlots<T, S> = T & {
47
+ new (): {
48
+ $slots: S;
49
+ };
50
+ };
@@ -0,0 +1,12 @@
1
+ import { default as InputForm } from './InputForm.vue';
2
+
3
+ declare module "@vue/runtime-core" {
4
+ interface GlobalComponents {
5
+ InputForm: typeof InputForm;
6
+ }
7
+ }
8
+ export interface InputFormProps {
9
+ title?: string;
10
+ desc?: string;
11
+ hideErrorsCount: boolean;
12
+ }
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@phila/phila-ui-input-form",
3
+ "private": false,
4
+ "version": "0.0.0",
5
+ "type": "module",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "main": "./dist/InputForm.umd.cjs",
10
+ "module": "./dist/InputForm.js",
11
+ "types": "./dist/types.d.ts",
12
+ "scripts": {
13
+ "dev": "vite",
14
+ "prepublish": "npm i && npm run build",
15
+ "build": "vue-tsc && vite build",
16
+ "preview": "vite preview"
17
+ },
18
+ "publishConfig": {
19
+ "registry": "https://registry.npmjs.com/",
20
+ "access": "public"
21
+ },
22
+ "dependencies": {
23
+ "@phila/phila-ui-core": "1.0.12",
24
+ "vue": "^3.3.8"
25
+ },
26
+ "devDependencies": {
27
+ "@types/node": "^20.10.3",
28
+ "@vitejs/plugin-vue": "^4.5.0",
29
+ "sass": "^1.69.5",
30
+ "typescript": "^5.2.2",
31
+ "vite": "^5.0.0",
32
+ "vite-plugin-dts": "^3.6.4",
33
+ "vite-plugin-lib-inject-css": "^1.3.0",
34
+ "vue-tsc": "^1.8.22"
35
+ },
36
+ "gitHead": "24a55656d994e2c54c353513e478fc74091bafc8"
37
+ }