Skip to content

Commit e308a1d

Browse files
committed
refactor(styles): set width of inputs, dropdowns, ... to 100 %
1 parent a0efc07 commit e308a1d

File tree

6 files changed

+62
-30
lines changed

6 files changed

+62
-30
lines changed

README.md

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,41 @@
22

33
Helper classes for using [Formkit](https://formkit.com/) with the [PrimeVue UI Framework](https://www.primefaces.org/primevue/#/)
44

5-
## Usages
5+
## Usage
6+
7+
```typescript
8+
9+
import { defaultConfig, plugin } from '@formkit/vue'
10+
import { primeInputs } from '@sfxcode/formkit-primevue'
11+
12+
13+
app.use(plugin, defaultConfig({
14+
locales: { de, en },
15+
// Define the active locale
16+
locale: 'en',
17+
inputs: primeInputs,
18+
}))
19+
```
20+
21+
### Basic Styling
22+
23+
Basic styling is provided with the **formkit-primevue.scss** file.
24+
25+
Features:
26+
27+
- Width of all text and dropdown elements is set to 100%
28+
- Error Color by varianble (--formkit-error-color)
29+
- Some margins, font sizes ...
30+
31+
You can use it or take it as base for your own styling.
32+
33+
### Extended Styling
34+
35+
- All inputs are wrapped in a div with a **p-formkit** class
36+
- Most Prime Components have access to class / styles attributes
37+
- PT and PTOptions are available ([https://primevue.org/passthrough/](https://primevue.org/passthrough/))
38+
39+
## Showcases
640

741
A Nuxt 3 Module (PrimeVue and Formkit bundled) under [nuxt-primevue](https://github.com/sfxcode/nuxt-primevue)
842

@@ -31,21 +65,7 @@ A Nuxt 3 Module (PrimeVue and Formkit bundled) under [nuxt-primevue](https://git
3165
- TriStateCheckbox
3266
- RadioButton
3367

34-
## Usage
35-
36-
```typescript
37-
38-
import { defaultConfig, plugin } from '@formkit/vue'
39-
import { primeInputs } from '@sfxcode/formkit-primevue'
40-
4168

42-
app.use(plugin, defaultConfig({
43-
locales: { de, en },
44-
// Define the active locale
45-
locale: 'en',
46-
inputs: primeInputs,
47-
}))
48-
```
4969

5070
![](formkit-primevue.png)
5171

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sfxcode/formkit-primevue",
3-
"version": "1.4.0",
3+
"version": "1.4.1",
44
"type": "module",
55
"license": "MIT",
66
"repository": "https://github.com/sfxcode/formkit-primevue",

public/sass/formkit-primevue.scss

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,27 @@
1212
.formkit-outer {
1313
margin: 0;
1414
padding-bottom: 12px;
15+
16+
.formkit-inner {
17+
18+
.p-formkit {
19+
20+
.p-formkit-icon {
21+
box-sizing: border-box;
22+
width: 100%;
23+
}
24+
25+
.p-inputtext, .p-password, .p-multiselect, .p-dropdown {
26+
box-sizing: border-box;
27+
width: 100%;
28+
&.p-colorpicker-preview {
29+
width: 2rem;
30+
}
31+
}
32+
33+
}
34+
}
35+
1536
ul {
1637
margin-block-start: 2px;
1738
margin-block-end: 2px;
@@ -75,16 +96,7 @@
7596
padding: 0;
7697
}
7798

78-
.formkit-inner {
79-
position: relative;
80-
border-radius: 0;
81-
display: flex;
82-
align-items: center;
83-
width: fit-content;
84-
&:focus-within {
8599

86-
}
87-
}
88100

89101
.formkit-help {
90102
margin: 4px 0 0 0 ;

src/components/demo/PrimeInput.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ const documentationLink = `https://primevue.org/${props.header.replace('Prime',
2121
<div>
2222
<h1>{{ header }}</h1>
2323

24-
<div class="flex flex-wrap">
25-
<div class="min-w-lg mb-6 mr-6">
24+
<div class="flex flex-wrap gap-12">
25+
<div class="min-w-30rem basis-1/3 md:basis-1/4">
2626
<FormKit
2727
id="form"
2828
v-model="formData"
@@ -36,7 +36,7 @@ const documentationLink = `https://primevue.org/${props.header.replace('Prime',
3636
<h3>Data</h3>
3737
<pre>{{ formData }}</pre>
3838
</div>
39-
<div class="max-w-xl">
39+
<div class="">
4040
<TabView>
4141
<TabPanel header="Schema">
4242
<pre>{{ formSchema }}</pre>

src/formkit/PrimeInputText.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const styleClass = computed(() => (context?.state.validationVisible && !context?
3636

3737
<template>
3838
<div class="p-formkit">
39-
<span :class="spanClass()">
39+
<span class="p-formkit-icon" :class="spanClass()">
4040
<i v-if="hasLeftIcon()" :class="context.iconLeft" />
4141

4242
<InputText

src/pages/demo/Slider.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const schema
99
$formkit: 'primeSlider',
1010
name: 'slider',
1111
label: 'Use Slider',
12-
class: 'mt-2 w-48',
12+
class: 'mt-2 w-72',
1313
min: 5,
1414
max: 100,
1515
step: 5,

0 commit comments

Comments
 (0)