@sokchea/vue-form-khmer 1.0.31 → 1.0.32

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.
@@ -1,42 +1,11 @@
1
- import { openBlock as r, createElementBlock as n, withModifiers as f, renderSlot as b, createElementVNode as c, toDisplayString as d, createTextVNode as p, createCommentVNode as a, normalizeClass as _ } from "vue";
2
- const m = (t, o) => {
3
- const e = t.__vccOpts || t;
4
- for (const [l, s] of o)
5
- e[l] = s;
1
+ import { openBlock as n, createElementBlock as r, createTextVNode as c, toDisplayString as d, createCommentVNode as l, createElementVNode as i, normalizeClass as m } from "vue";
2
+ const f = (o, t) => {
3
+ const e = o.__vccOpts || o;
4
+ for (const [a, s] of t)
5
+ e[a] = s;
6
6
  return e;
7
- }, y = {
8
- name: "Form",
9
- props: {
10
- submitText: {
11
- type: String,
12
- default: "Submit"
13
- },
14
- onSubmit: {
15
- type: Function,
16
- default: null
17
- }
18
- },
19
- emits: ["submit"],
20
- methods: {
21
- handleSubmit(t) {
22
- this.$emit("submit", t), this.onSubmit && this.onSubmit(t);
23
- }
24
- }
25
- }, h = {
26
- type: "submit",
27
- class: "bg-blue-600 text-white px-4 py-2 rounded hover:bg-blue-700 transition"
28
- };
29
- function S(t, o, e, l, s, u) {
30
- return r(), n("form", {
31
- onSubmit: o[0] || (o[0] = f((...i) => u.handleSubmit && u.handleSubmit(...i), ["prevent"])),
32
- class: "space-y-4"
33
- }, [
34
- b(t.$slots, "default", {}, void 0, !0),
35
- c("button", h, d(e.submitText), 1)
36
- ], 32);
37
- }
38
- const B = /* @__PURE__ */ m(y, [["render", S], ["__scopeId", "data-v-c3510b80"], ["__file", "/Users/sokchea/Documents/Study/vue-form-khmer/src/components/Form.vue"]]), x = {
39
- name: "Input",
7
+ }, p = {
8
+ name: "VfkInput",
40
9
  props: {
41
10
  modelValue: {
42
11
  type: [String, Number],
@@ -64,37 +33,43 @@ const B = /* @__PURE__ */ m(y, [["render", S], ["__scopeId", "data-v-c3510b80"],
64
33
  }
65
34
  },
66
35
  emits: ["update:modelValue"]
67
- }, g = { class: "flex flex-col" }, v = {
36
+ }, _ = { class: "flex flex-col" }, y = {
68
37
  key: 0,
69
38
  class: "mb-1 font-semibold text-gray-700"
70
- }, k = {
39
+ }, g = {
71
40
  key: 0,
72
41
  class: "text-red-500"
73
- }, V = ["type", "value", "placeholder"], I = {
42
+ }, b = ["type", "value", "placeholder"], x = {
74
43
  key: 1,
75
44
  class: "text-red-500 text-sm mt-1"
76
45
  };
77
- function F(t, o, e, l, s, u) {
78
- return r(), n("div", g, [
79
- e.label ? (r(), n("label", v, [
80
- p(d(e.label) + " ", 1),
81
- e.required ? (r(), n("span", k, "*")) : a("", !0)
82
- ])) : a("", !0),
83
- c("input", {
46
+ function h(o, t, e, a, s, V) {
47
+ return n(), r("div", _, [
48
+ e.label ? (n(), r("label", y, [
49
+ c(d(e.label) + " ", 1),
50
+ e.required ? (n(), r("span", g, "*")) : l("", !0)
51
+ ])) : l("", !0),
52
+ i("input", {
84
53
  type: e.type,
85
54
  value: e.modelValue,
86
55
  placeholder: e.placeholder,
87
- class: _([
56
+ class: m([
88
57
  "border rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500",
89
58
  e.error ? "border-red-500" : "border-gray-300"
90
59
  ]),
91
- onInput: o[0] || (o[0] = (i) => t.$emit("update:modelValue", e.modelValue))
92
- }, null, 42, V),
93
- e.error ? (r(), n("p", I, d(e.error), 1)) : a("", !0)
60
+ onInput: t[0] || (t[0] = (u) => o.$emit("update:modelValue", u.target.value))
61
+ }, null, 42, b),
62
+ e.error ? (n(), r("p", x, d(e.error), 1)) : l("", !0)
94
63
  ]);
95
64
  }
96
- const D = /* @__PURE__ */ m(x, [["render", F], ["__scopeId", "data-v-6bfa3c29"], ["__file", "/Users/sokchea/Documents/Study/vue-form-khmer/src/components/Input.vue"]]);
65
+ const k = /* @__PURE__ */ f(p, [["render", h], ["__scopeId", "data-v-6bfa3c29"], ["__file", "/Users/sokchea/Documents/Study/vue-form-khmer/src/components/Input.vue"]]), v = [k], I = {
66
+ install(o) {
67
+ v.forEach((t) => {
68
+ t.name || console.warn("Component missing name", t), o.component(t.name, t);
69
+ });
70
+ }
71
+ };
97
72
  export {
98
- B as Form,
99
- D as Input
73
+ k as VfkInput,
74
+ I as default
100
75
  };
@@ -1 +1 @@
1
- (function(n,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(n=typeof globalThis<"u"?globalThis:n||self,e(n.VueFormKhmer={},n.Vue))})(this,(function(n,e){"use strict";const i=(o,r)=>{const t=o.__vccOpts||o;for(const[l,s]of r)t[l]=s;return t},c={name:"Form",props:{submitText:{type:String,default:"Submit"},onSubmit:{type:Function,default:null}},emits:["submit"],methods:{handleSubmit(o){this.$emit("submit",o),this.onSubmit&&this.onSubmit(o)}}},u={type:"submit",class:"bg-blue-600 text-white px-4 py-2 rounded hover:bg-blue-700 transition"};function m(o,r,t,l,s,d){return e.openBlock(),e.createElementBlock("form",{onSubmit:r[0]||(r[0]=e.withModifiers((...a)=>d.handleSubmit&&d.handleSubmit(...a),["prevent"])),class:"space-y-4"},[e.renderSlot(o.$slots,"default",{},void 0,!0),e.createElementVNode("button",u,e.toDisplayString(t.submitText),1)],32)}const f=i(c,[["render",m],["__scopeId","data-v-c3510b80"],["__file","/Users/sokchea/Documents/Study/vue-form-khmer/src/components/Form.vue"]]),p={name:"Input",props:{modelValue:{type:[String,Number],default:""},label:{type:String,default:""},type:{type:String,default:"text"},placeholder:{type:String,default:""},required:{type:Boolean,default:!1},error:{type:String,default:""}},emits:["update:modelValue"]},b={class:"flex flex-col"},y={key:0,class:"mb-1 font-semibold text-gray-700"},_={key:0,class:"text-red-500"},h=["type","value","placeholder"],S={key:1,class:"text-red-500 text-sm mt-1"};function k(o,r,t,l,s,d){return e.openBlock(),e.createElementBlock("div",b,[t.label?(e.openBlock(),e.createElementBlock("label",y,[e.createTextVNode(e.toDisplayString(t.label)+" ",1),t.required?(e.openBlock(),e.createElementBlock("span",_,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("input",{type:t.type,value:t.modelValue,placeholder:t.placeholder,class:e.normalizeClass(["border rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500",t.error?"border-red-500":"border-gray-300"]),onInput:r[0]||(r[0]=a=>o.$emit("update:modelValue",t.modelValue))},null,42,h),t.error?(e.openBlock(),e.createElementBlock("p",S,e.toDisplayString(t.error),1)):e.createCommentVNode("",!0)])}const g=i(p,[["render",k],["__scopeId","data-v-6bfa3c29"],["__file","/Users/sokchea/Documents/Study/vue-form-khmer/src/components/Input.vue"]]);n.Form=f,n.Input=g,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(n,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(n=typeof globalThis<"u"?globalThis:n||self,e(n.VueFormKhmer={},n.Vue))})(this,(function(n,e){"use strict";const s=(l,o)=>{const t=l.__vccOpts||l;for(const[a,d]of o)t[a]=d;return t},c={name:"VfkInput",props:{modelValue:{type:[String,Number],default:""},label:{type:String,default:""},type:{type:String,default:"text"},placeholder:{type:String,default:""},required:{type:Boolean,default:!1},error:{type:String,default:""}},emits:["update:modelValue"]},i={class:"flex flex-col"},u={key:0,class:"mb-1 font-semibold text-gray-700"},m={key:0,class:"text-red-500"},f=["type","value","placeholder"],p={key:1,class:"text-red-500 text-sm mt-1"};function y(l,o,t,a,d,h){return e.openBlock(),e.createElementBlock("div",i,[t.label?(e.openBlock(),e.createElementBlock("label",u,[e.createTextVNode(e.toDisplayString(t.label)+" ",1),t.required?(e.openBlock(),e.createElementBlock("span",m,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("input",{type:t.type,value:t.modelValue,placeholder:t.placeholder,class:e.normalizeClass(["border rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500",t.error?"border-red-500":"border-gray-300"]),onInput:o[0]||(o[0]=g=>l.$emit("update:modelValue",g.target.value))},null,42,f),t.error?(e.openBlock(),e.createElementBlock("p",p,e.toDisplayString(t.error),1)):e.createCommentVNode("",!0)])}const r=s(c,[["render",y],["__scopeId","data-v-6bfa3c29"],["__file","/Users/sokchea/Documents/Study/vue-form-khmer/src/components/Input.vue"]]),_=[r],k={install(l){_.forEach(o=>{o.name||console.warn("Component missing name",o),l.component(o.name,o)})}};n.VfkInput=r,n.default=k,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
package/package.json CHANGED
@@ -1,42 +1,46 @@
1
1
  {
2
2
  "name": "@sokchea/vue-form-khmer",
3
- "version": "1.0.31",
3
+ "version": "1.0.32",
4
4
  "description": "Vue 3 Form Components with Khmer validation support",
5
5
  "type": "module",
6
+
6
7
  "main": "dist/vue-form-khmer.umd.js",
7
8
  "module": "dist/vue-form-khmer.es.js",
9
+
8
10
  "exports": {
9
11
  ".": {
10
12
  "import": "./dist/vue-form-khmer.es.js",
11
13
  "require": "./dist/vue-form-khmer.umd.js"
12
14
  }
13
15
  },
14
- "files": [
15
- "dist",
16
- "src",
17
- "lib"
18
- ],
19
- "style": "dist/style.css",
16
+
17
+ "files": ["dist"],
18
+
20
19
  "scripts": {
21
- "build": "vite build"
20
+ "dev": "vite",
21
+ "build": "vite build",
22
+ "preview": "vite preview"
22
23
  },
24
+
23
25
  "keywords": [
24
26
  "vue",
25
27
  "form",
26
28
  "khmer",
27
29
  "validation"
28
30
  ],
31
+
29
32
  "author": "sokchea",
30
33
  "license": "MIT",
34
+
31
35
  "peerDependencies": {
32
- "vue": "^3.3.0"
36
+ "vue": "^3.3.0",
37
+ "tailwindcss": "^4.0.0"
33
38
  },
39
+
34
40
  "devDependencies": {
35
41
  "@vitejs/plugin-vue": "^6.0.5",
36
- "vite": "^7.3.1"
37
- },
38
- "dependencies": {
39
- "@tailwindcss/vite": "^4.2.2",
40
- "tailwindcss": "^4.2.2"
42
+ "vite": "^7.3.1",
43
+ "tailwindcss": "^4.2.2",
44
+ "@tailwindcss/vite": "^4.2.2"
41
45
  }
42
- }
46
+ }
package/src/App.vue DELETED
@@ -1,14 +0,0 @@
1
- <script setup>
2
-
3
- </script>
4
-
5
- <template>
6
- <header>
7
- <div class="text-red-500">HelloWorld</div>
8
-
9
- </header>
10
-
11
- <main>
12
-
13
- </main>
14
- </template>
@@ -1,86 +0,0 @@
1
- /* color palette from <https://github.com/vuejs/theme> */
2
- :root {
3
- --vt-c-white: #ffffff;
4
- --vt-c-white-soft: #f8f8f8;
5
- --vt-c-white-mute: #f2f2f2;
6
-
7
- --vt-c-black: #181818;
8
- --vt-c-black-soft: #222222;
9
- --vt-c-black-mute: #282828;
10
-
11
- --vt-c-indigo: #2c3e50;
12
-
13
- --vt-c-divider-light-1: rgba(60, 60, 60, 0.29);
14
- --vt-c-divider-light-2: rgba(60, 60, 60, 0.12);
15
- --vt-c-divider-dark-1: rgba(84, 84, 84, 0.65);
16
- --vt-c-divider-dark-2: rgba(84, 84, 84, 0.48);
17
-
18
- --vt-c-text-light-1: var(--vt-c-indigo);
19
- --vt-c-text-light-2: rgba(60, 60, 60, 0.66);
20
- --vt-c-text-dark-1: var(--vt-c-white);
21
- --vt-c-text-dark-2: rgba(235, 235, 235, 0.64);
22
- }
23
-
24
- /* semantic color variables for this project */
25
- :root {
26
- --color-background: var(--vt-c-white);
27
- --color-background-soft: var(--vt-c-white-soft);
28
- --color-background-mute: var(--vt-c-white-mute);
29
-
30
- --color-border: var(--vt-c-divider-light-2);
31
- --color-border-hover: var(--vt-c-divider-light-1);
32
-
33
- --color-heading: var(--vt-c-text-light-1);
34
- --color-text: var(--vt-c-text-light-1);
35
-
36
- --section-gap: 160px;
37
- }
38
-
39
- @media (prefers-color-scheme: dark) {
40
- :root {
41
- --color-background: var(--vt-c-black);
42
- --color-background-soft: var(--vt-c-black-soft);
43
- --color-background-mute: var(--vt-c-black-mute);
44
-
45
- --color-border: var(--vt-c-divider-dark-2);
46
- --color-border-hover: var(--vt-c-divider-dark-1);
47
-
48
- --color-heading: var(--vt-c-text-dark-1);
49
- --color-text: var(--vt-c-text-dark-2);
50
- }
51
- }
52
-
53
- *,
54
- *::before,
55
- *::after {
56
- box-sizing: border-box;
57
- margin: 0;
58
- font-weight: normal;
59
- }
60
-
61
- body {
62
- min-height: 100vh;
63
- color: var(--color-text);
64
- background: var(--color-background);
65
- transition:
66
- color 0.5s,
67
- background-color 0.5s;
68
- line-height: 1.6;
69
- font-family:
70
- Inter,
71
- -apple-system,
72
- BlinkMacSystemFont,
73
- 'Segoe UI',
74
- Roboto,
75
- Oxygen,
76
- Ubuntu,
77
- Cantarell,
78
- 'Fira Sans',
79
- 'Droid Sans',
80
- 'Helvetica Neue',
81
- sans-serif;
82
- font-size: 15px;
83
- text-rendering: optimizeLegibility;
84
- -webkit-font-smoothing: antialiased;
85
- -moz-osx-font-smoothing: grayscale;
86
- }
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 261.76 226.69"><path d="M161.096.001l-30.225 52.351L100.647.001H-.005l130.877 226.688L261.749.001z" fill="#41b883"/><path d="M161.096.001l-30.225 52.351L100.647.001H52.346l78.526 136.01L209.398.001z" fill="#34495e"/></svg>
@@ -1,36 +0,0 @@
1
- @import './base.css';
2
- @import "tailwindcss";
3
-
4
- #app {
5
- max-width: 1280px;
6
- margin: 0 auto;
7
- padding: 2rem;
8
- font-weight: normal;
9
- }
10
-
11
- a,
12
- .green {
13
- text-decoration: none;
14
- color: hsla(160, 100%, 37%, 1);
15
- transition: 0.4s;
16
- padding: 3px;
17
- }
18
-
19
- @media (hover: hover) {
20
- a:hover {
21
- background-color: hsla(160, 100%, 37%, 0.2);
22
- }
23
- }
24
-
25
- @media (min-width: 1024px) {
26
- body {
27
- display: flex;
28
- place-items: center;
29
- }
30
-
31
- #app {
32
- display: grid;
33
- grid-template-columns: 1fr 1fr;
34
- padding: 0 2rem;
35
- }
36
- }
@@ -1,46 +0,0 @@
1
- <template>
2
- <form @submit.prevent="handleSubmit" class="space-y-4">
3
- <!-- Render slot content for inputs -->
4
- <slot></slot>
5
-
6
- <!-- Submit button -->
7
- <button
8
- type="submit"
9
- class="bg-blue-600 text-white px-4 py-2 rounded hover:bg-blue-700 transition"
10
- >
11
- {{ submitText }}
12
- </button>
13
- </form>
14
- </template>
15
-
16
- <script>
17
- export default {
18
- name: 'Form',
19
- props: {
20
- submitText: {
21
- type: String,
22
- default: 'Submit',
23
- },
24
- onSubmit: {
25
- type: Function,
26
- default: null,
27
- },
28
- },
29
- emits: ['submit'],
30
- methods: {
31
- handleSubmit(event) {
32
- // Emit submit event with form data
33
- this.$emit('submit', event);
34
-
35
- // Call onSubmit prop if provided
36
- if (this.onSubmit) {
37
- this.onSubmit(event);
38
- }
39
- },
40
- },
41
- };
42
- </script>
43
-
44
- <style scoped>
45
- /* Optional scoped styles for form */
46
- </style>
@@ -1,64 +0,0 @@
1
- <template>
2
- <div class="flex flex-col">
3
- <!-- Label -->
4
- <label v-if="label" class="mb-1 font-semibold text-gray-700">
5
- {{ label }}
6
- <span v-if="required" class="text-red-500">*</span>
7
- </label>
8
-
9
- <!-- Input field -->
10
- <input
11
- :type="type"
12
- :value="modelValue"
13
- :placeholder="placeholder"
14
- :class="[
15
- 'border rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500',
16
- error ? 'border-red-500' : 'border-gray-300'
17
- ]"
18
- @input="$emit('update:modelValue', modelValue)"
19
- />
20
-
21
- <!-- Error message -->
22
- <p v-if="error" class="text-red-500 text-sm mt-1">{{ error }}</p>
23
- </div>
24
- </template>
25
-
26
- <script>
27
- export default {
28
- name: 'Input',
29
- props: {
30
- modelValue: {
31
- type: [String, Number],
32
- default: '',
33
- },
34
- label: {
35
- type: String,
36
- default: '',
37
- },
38
- type: {
39
- type: String,
40
- default: 'text',
41
- },
42
- placeholder: {
43
- type: String,
44
- default: '',
45
- },
46
- required: {
47
- type: Boolean,
48
- default: false,
49
- },
50
- error: {
51
- type: String,
52
- default: '',
53
- },
54
- },
55
- emits: ['update:modelValue'],
56
- };
57
- </script>
58
-
59
- <style scoped>
60
- /* Optional: smooth focus animation */
61
- input:focus {
62
- transition: all 0.2s ease-in-out;
63
- }
64
- </style>
package/src/index.js DELETED
@@ -1,2 +0,0 @@
1
- export { default as Form } from './components/Form.vue'
2
- export { default as Input } from './components/Input.vue'
package/src/main.js DELETED
@@ -1,6 +0,0 @@
1
- import './assets/main.css'
2
-
3
- import { createApp } from 'vue'
4
- import App from './App.vue'
5
-
6
- createApp(App).mount('#app')
package/src/style.css DELETED
@@ -1 +0,0 @@
1
- @import "tailwindcss";