Skip to content

Commit

Permalink
fix(Textarea): fixed resize-orientation=both and readonly-variant=plain
Browse files Browse the repository at this point in the history
  • Loading branch information
mtorromeo committed Nov 28, 2023
1 parent cc97839 commit 77873fa
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
27 changes: 26 additions & 1 deletion apps/docs/src/stories/Components/Textarea.story.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,33 @@
## Examples
</pre>

<story-canvas title="Example">
<story-canvas title="With regex pattern validation">
<pf-textarea pattern="[0-9\s]+" placeholder="Numbers and spaces only" />
</story-canvas>

<story-canvas title="Vertically resizable">
<pf-textarea resize-orientation="vertical" aria-label="text area vertical resize example" />
</story-canvas>

<story-canvas title="Horizontally resizable">
<pf-textarea resize-orientation="horizontal" aria-label="text area horizontal resize example" />
</story-canvas>

<story-canvas title="Disabled">
<pf-textarea aria-label="Disabled text area example" disabled />
</story-canvas>

<story-canvas title="Read only">
<div style="margin-bottom: 12px">
<pf-checkbox v-model="plain" label="Plain read only variant" />
</div>
<pf-textarea aria-label="read only text area example" model-value="read only text area example" :readonly-variant="plain ? 'plain' : 'default'" />
</story-canvas>
</doc-page>
</template>

<script lang="ts" setup>
import { ref } from 'vue';
const plain = ref(false);
</script>
8 changes: 5 additions & 3 deletions packages/core/src/components/Textarea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
<span
:class="[
styles.formControl, {
[styles.modifiers.readonly]: !!readOnlyVariant,
[styles.modifiers.readonly]: !!readonlyVariant,
[styles.modifiers.plain]: readonlyVariant === 'plain',
[styles.modifiers.disabled]: disabled,
[styles.modifiers.resizeVertical]: resizeOrientation === 'vertical',
[styles.modifiers.resizeHorizontal]: resizeOrientation === 'horizontal',
[styles.modifiers.resizeBoth]: resizeOrientation === 'both',
[styles.modifiers.success]: effectiveValidated === 'success',
[styles.modifiers.warning]: effectiveValidated === 'warning',
[styles.modifiers.error]: effectiveValidated === 'error',
Expand All @@ -17,7 +19,7 @@
:value="value"
v-bind="{...ouiaProps, ...$attrs}"
:disabled="disabled || undefined"
:readonly="!!readOnlyVariant || readonly"
:readonly="!!readonlyVariant || readonly"
:aria-invalid="effectiveValidated === 'error'"
@change="handleChange"
@input="onInput($event as InputEvent)"
Expand Down Expand Up @@ -54,7 +56,7 @@ export interface Props extends /* @vue-ignore */ TextareaHTMLAttributes {
readonly?: boolean;
/** Read only variant. */
readOnlyVariant?: 'default' | 'plain';
readonlyVariant?: 'default' | 'plain';
/** Flag to modify height based on contents. */
autoResize?: boolean;
Expand Down

0 comments on commit 77873fa

Please sign in to comment.