Skip to content

Commit

Permalink
feat(select): apply line-clamp-1 to label and set `optionValue="code"…
Browse files Browse the repository at this point in the history
…` in Storybook

- Added line-clamp-1 to truncate overflowing text after one line.
- Configured `optionValue="code"` to ensure options are correctly identified by their code values.
  • Loading branch information
hamo225 committed Nov 4, 2024
1 parent 7e32c5e commit ef218d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/primevue/select/select.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const Default: StoryObj<typeof meta> = {
v-bind="args"
v-model="selectedOption"
optionLabel="name"
optionValue="code"
:options="options"
/>`,
}),
Expand Down Expand Up @@ -65,6 +66,7 @@ export const WithLabel: StoryObj<typeof meta> = {
v-bind="args"
v-model="selectedOption"
optionLabel="name"
optionValue="code"
:options="options"
/>
</div>`,
Expand Down Expand Up @@ -92,6 +94,7 @@ export const WithHorizontalLabel: StoryObj<typeof meta> = {
v-bind="args"
v-model="selectedOption"
optionLabel="name"
optionValue="code"
:options="options"
fluid
/>
Expand Down Expand Up @@ -121,6 +124,7 @@ export const Disabled: StoryObj<typeof meta> = {
v-bind="args"
v-model="selectedOption"
optionLabel="name"
optionValue="code"
:options="options"
/>`,
}),
Expand Down Expand Up @@ -151,6 +155,7 @@ export const Invalid: StoryObj<typeof meta> = {
v-bind="args"
v-model="selectedOption"
optionLabel="name"
optionValue="code"
:options="options"
/>
<small id="invalid-hint"><ErrorOutline />Invalid date</small>
Expand Down
4 changes: 2 additions & 2 deletions src/primevue/select/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "./select.css";
const select: SelectPassThroughOptions = {
root: ({ props, state }) => {
// Base
const base = tw`ris-body2-regular inline-flex h-48 items-center justify-between border-2 bg-white py-4 pl-16 pr-12 outline-4 -outline-offset-4 [&+label]:ml-8`;
const base = tw`ris-body2-regular inline-flex h-48 items-center justify-between border-2 bg-white py-4 pl-16 pr-12 outline-4 -outline-offset-4`;

// States
const normal = tw`cursor-pointer border-blue-800 outline-blue-800`;
Expand Down Expand Up @@ -45,7 +45,7 @@ const select: SelectPassThroughOptions = {
},

label: {
class: tw`outline-none`,
class: tw`line-clamp-1 outline-none`,
},

overlay: {
Expand Down

0 comments on commit ef218d8

Please sign in to comment.