Skip to content

Commit

Permalink
feat: add fluid variant to input
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasphil committed Aug 20, 2024
1 parent eef4388 commit 561f597
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 18 deletions.
33 changes: 18 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"prettier:fix": "prettier --write --ignore-unknown ."
},
"dependencies": {
"primevue": "^4.0.0",
"primevue": "^4.0.4",
"vue": "^3.4.29"
},
"devDependencies": {
Expand Down
13 changes: 11 additions & 2 deletions src/preset/inputText/inputText.stories.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { html } from "@/lib/tags";
import { Meta, StoryObj } from "@storybook/vue3";
import InputGroup from "primevue/inputgroup";
import InputGroupAddon from "primevue/inputgroupaddon";
import Fluid from "primevue/fluid";
import InputText from "primevue/inputtext";
import ErrorOutline from "~icons/ic/error-outline";

Expand Down Expand Up @@ -121,3 +120,13 @@ export const Invalid: StoryObj<typeof meta> = {
</div>`,
}),
};

export const FluidProp: StoryObj<typeof meta> = {
render: (args) => ({
components: { InputText, Fluid },
setup() {
return { args };
},
template: html`<InputText v-bind="args" fluid />`,
}),
};
4 changes: 4 additions & 0 deletions src/preset/inputText/inputText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ const inputText: InputTextPassThroughOptions = {
const isInputGroup = parent.instance.$name === "InputGroup";
const inputGroup = tw`bg-transparent placeholder:text-gray-900 focus:outline-none`;

// Integration for primevue/fluid
const fluid = tw`w-full`;

// Sizes
const small = tw`h-48 px-16 py-4`;
const large = tw`h-64 px-24 py-4`;
Expand All @@ -26,6 +29,7 @@ const inputText: InputTextPassThroughOptions = {
class: {
[base]: !isInputGroup,
[inputGroup]: isInputGroup,
[fluid]: !!props.fluid,
[password]: true,
[small]: (!props.size || props.size === "small") && !isInputGroup,
[smallInGroup]: (!props.size || props.size === "small") && isInputGroup,
Expand Down

0 comments on commit 561f597

Please sign in to comment.