Skip to content

Commit f7f39b2

Browse files
authored
Merge pull request #16 from kevinkosterr/4-pre-styled-components
Add themes
2 parents eb3ee05 + 26fc5e3 commit f7f39b2

20 files changed

+800
-297
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
"module": "./dist/vue3-form-generator.es.js",
1111
"scripts": {
1212
"dev": "vite",
13+
"dev:sass": "sass --watch src/scss/themes:playground/css/",
1314
"test": "vitest",
14-
"build": "vite build",
15-
"build:publish": "vitest && vite build && npm publish --access public",
15+
"build": "vite build && sass src/scss/themes/:dist/themes/",
1616
"preview": "vite preview"
1717
},
1818
"exports": {
@@ -43,6 +43,7 @@
4343
"eslint-plugin-import-alias": "^1.2.0",
4444
"eslint-plugin-vue": "9.27.0",
4545
"jsdom": "^25.0.1",
46+
"sass": "^1.79.5",
4647
"terser": "^5.33.0",
4748
"typescript": "^5.4.5",
4849
"vite": "^5.2.14",

playground/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
schema.js
1+
schema.js
2+
css

playground/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import App from './App.vue'
66
import JsonViewer from 'vue3-json-viewer'
77
import VueFormGenerator from '@/index.js'
88
import 'vue3-json-viewer/dist/index.css'
9+
import './css/basic.css'
910

1011
const app = createApp(App).use(JsonViewer)
1112

src/FormGenerator.vue

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,4 @@ const onReset = () => {
9494
</template>
9595
</fieldset>
9696
</form>
97-
</template>
98-
99-
<style>
100-
.vue-form-generator input:not([type='checkbox'],[type='submit'],[type='radio']) {
101-
width: 100%;
102-
}
103-
104-
.vue-form-generator > fieldset {
105-
border: none;
106-
}
107-
</style>
97+
</template>

src/FormGroup.vue

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,4 @@ const shouldHaveLabel = computed(() => {
6868
</template>
6969
</div>
7070
</div>
71-
</template>
72-
73-
<style>
74-
.form-group:has(input[required],select[required]) label:first-child::after {
75-
content: "*";
76-
font-size: .9em;
77-
color: red;
78-
margin-left: .2rem;
79-
}
80-
81-
.hint {
82-
color: gray;
83-
font-size: 90%;
84-
}
85-
86-
.errors {
87-
color: red;
88-
font-size: .8rem;
89-
margin-bottom: .3rem;
90-
}
91-
</style>
71+
</template>

src/fields/buttons/FieldReset.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<input type="reset" :value="field.buttonText">
2+
<input type="reset" class="field-reset" :value="field.buttonText">
33
</template>
44

55
<script>

src/fields/buttons/FieldSubmit.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<template>
22
<input
33
type="submit"
4+
class="field-submit"
45
:disabled="isDisabled"
56
:value="field.buttonText || 'Submit'"
67
>

src/fields/input/FieldColor.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<template>
22
<input
33
:id="id"
4+
class="field-color"
45
type="color"
56
:name="field.name"
67
:required="isRequired"

src/fields/input/FieldPassword.vue

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,4 @@ export default {
4949
}
5050
}
5151
}
52-
</script>
53-
54-
<style scoped>
55-
.password-strength-indicator {
56-
transition: width 0.1s ease-in, background 0.3s ease-in;
57-
height: .5em;
58-
width: 100%;
59-
background: rgba(0, 0, 0, 0.1);
60-
}
61-
</style>
52+
</script>

src/fields/input/FieldRadio.vue

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<template v-for="option in field.options" :key="option.value">
3-
<div class="option-wrap">
3+
<div class="option-wrap field-radio">
44
<input
55
:id="getFieldId(option.name)"
66
type="radio"
@@ -26,14 +26,4 @@ export default {
2626
}
2727
}
2828
}
29-
</script>
30-
31-
<style scoped>
32-
.option-wrap {
33-
margin: .4rem;
34-
}
35-
36-
label {
37-
margin-left: .5rem;
38-
}
39-
</style>
29+
</script>

0 commit comments

Comments
 (0)