@sokchea/vue-form-khmer 1.0.2 → 1.0.3

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 CHANGED
@@ -4,7 +4,7 @@ This template should help get you started developing with Vue 3 in Vite.
4
4
 
5
5
 
6
6
  ```sh
7
- npm i vue-form-khmer
7
+ npm i @sokchea/vue-form-khmer
8
8
 
9
9
  ```
10
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sokchea/vue-form-khmer",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Vue 3 Form Components with Khmer validation support",
5
5
  "type": "module",
6
6
  "main": "dist/vue-form-khmer.umd.js",
@@ -11,9 +11,7 @@
11
11
  "require": "./dist/vue-form-khmer.umd.js"
12
12
  }
13
13
  },
14
- "files": [
15
- "dist"
16
- ],
14
+ "files": ["dist", "src", "lib"],
17
15
  "scripts": {
18
16
  "build": "vite build"
19
17
  },
package/src/App.vue ADDED
@@ -0,0 +1,14 @@
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>
@@ -0,0 +1,86 @@
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
+ }
@@ -0,0 +1 @@
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>
@@ -0,0 +1,36 @@
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
+ }
@@ -0,0 +1,46 @@
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>
@@ -0,0 +1,64 @@
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
+ v-model="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/main.js ADDED
@@ -0,0 +1,6 @@
1
+ import './assets/main.css'
2
+
3
+ import { createApp } from 'vue'
4
+ import App from './App.vue'
5
+
6
+ createApp(App).mount('#app')