Skip to content

Commit

Permalink
feat(input): adjust with new design token
Browse files Browse the repository at this point in the history
  • Loading branch information
adenvt committed Dec 7, 2022
1 parent 351bfb9 commit a648b3a
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/components/dropzone/Dropzone.vue
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ export default defineComponent({
&:disabled,
&--disabled {
@apply opacity-50 pointer-events-none;
@apply pointer-events-none;
}
a,
Expand Down
2 changes: 1 addition & 1 deletion src/components/form-group/FormGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default defineComponent({

<style lang="postcss">
.form-group {
@apply flex flex-col;
@apply flex flex-col mb-4;
&__label {
@apply font-bold text-xs mb-2 relative;
Expand Down
24 changes: 17 additions & 7 deletions src/components/form-group/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script setup>
import pFormGroup from './FormGroup.vue'
import pInput from '../input/Input.vue'
import pCheckbox from '../checkbox/Checkbox.vue'
</script>

# Form Group
Expand Down Expand Up @@ -118,13 +119,22 @@ Add decription note below the form input using `description` prop.

Error message from validation can be add in here using prop `error`. Note, it'll replace `description` message.

<preview>
<p-form-group
label="First Name"
description="Lorem Ipsum dolor sitar"
error="Please fill this field">
<p-input />
</p-form-group>
<preview class="flex-col space-y-4">
<div>
<p-form-group
label="First Name"
description="Lorem Ipsum dolor sitar"
error="Please fill this field">
<p-input />
</p-form-group>
<p-form-group
label="First Name"
description="Lorem Ipsum dolor sitar"
error="Please fill this field">
<p-checkbox>Female</p-checkbox>
<p-checkbox>Male</p-checkbox>
</p-form-group>
</div>
</preview>

```vue
Expand Down
8 changes: 8 additions & 0 deletions src/components/input-file/InputFile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,14 @@ export default defineComponent({
}
}
&--disabled,
&:disabled {
.input-group__addon,
.input-group .input__form {
@apply bg-muted border-muted text-muted;
}
}
&:hover {
.input-group__addon,
.input-group .input__form {
Expand Down
2 changes: 1 addition & 1 deletion src/components/input-group/InputGroupAddon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<style lang="postcss">
.input-group {
&__addon {
@apply flex items-center text-base rounded border border-solid border-muted outline-none bg-default;
@apply flex items-center text-muted rounded border border-solid border-muted outline-none bg-default;
}
&--xs > .input-group__addon {
Expand Down
4 changes: 2 additions & 2 deletions src/components/input-range/InputRange.vue
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ export default defineComponent({
@apply p-2 w-full;
&__tracks {
@apply relative flex w-full bg-gray-15 cursor-pointer overflow-visible rounded;
@apply relative flex w-full bg-subtle cursor-pointer overflow-visible rounded;
}
&__track {
Expand All @@ -288,7 +288,7 @@ export default defineComponent({
}
&__thumb {
@apply w-4 h-4 rounded-full bg-default shadow absolute top-1/2 bottom-0 -translate-y-1/2 border border-gray-25;
@apply w-4 h-4 rounded-full bg-default shadow-sm absolute top-1/2 bottom-0 -translate-y-1/2 border border-gray-25;
@apply touch-none select-none;
&:hover,
Expand Down
6 changes: 5 additions & 1 deletion src/components/input/Input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,18 @@ export default defineComponent({
&:disabled,
&--disabled {
@apply opacity-50 pointer-events-none;
@apply bg-muted border-muted pointer-events-none text-muted;
}
&:focus {
@apply border-subtle ring-4 ring-subtle/10 z-[1];
}
}
&--xs {
@apply text-xs px-3 py-2;
}
&--sm {
@apply px-3 py-2;
}
Expand Down
12 changes: 6 additions & 6 deletions src/components/input/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

### Simple Usage
<preview>
<p-input v-model.number="value" placeholder="Input Here" />
<p-input v-model="value" placeholder="Input Here" />
</preview>

```vue
Expand All @@ -22,7 +22,7 @@

## Sizing

<preview class="flex-col space-gap-3">
<preview class="flex-col space-y-3">
<p-input size="xs" />
<p-input size="sm" />
<p-input size="md" />
Expand All @@ -40,7 +40,7 @@

## Disabled state

<preview class="flex-col space-gap-3">
<preview class="flex-col space-y-3">
<p-input disabled />
</preview>

Expand All @@ -52,7 +52,7 @@

## Readonly state

<preview class="flex-col space-gap-3">
<preview class="flex-col space-y-3">
<p-input readonly />
</preview>

Expand All @@ -64,7 +64,7 @@

## Error state

<preview class="flex-col space-gap-3">
<preview class="flex-col space-y-3">
<p-input error />
</preview>

Expand All @@ -78,7 +78,7 @@

Add clear button to input with prop `clearable`.

<preview class="flex-col space-gap-3">
<preview class="flex-col space-y-3">
<p-input clearable />
</preview>

Expand Down
2 changes: 1 addition & 1 deletion src/components/textarea/Textarea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export default defineComponent({
}
&__counter {
@apply text-right text-muted text-xs absolute bottom-1 right-1 pointer-events-none;
@apply text-right text-muted text-xs absolute bottom-1 right-1 pointer-events-none z-1;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/docs/browser-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,6 @@ _We need to keep moving forward, and savoring the journey_ 😎
{{ item.browser }}
</template>
<template #cell(version)="{ item }">
<p-label size="sm" variant="light">{{ item.version }}</p-label>
<p-label size="sm">{{ item.version }}</p-label>
</template>
</p-table>

0 comments on commit a648b3a

Please sign in to comment.