-
Notifications
You must be signed in to change notification settings - Fork 119
fix(form-pill): fix issues where pill text not being truncated #4047
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
e366d8b
5050da2
50ec945
e799106
ca29e1a
e612d23
f02ffdf
e1c300a
b7195fe
4194539
06e950d
63c5ec1
1c76772
7735287
2186bfa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@twilio-paste/form-pill-group": patch | ||
"@twilio-paste/core": patch | ||
--- | ||
|
||
[FormPillGroup] fixed a bug where long text in a form pill would wrap and break styling. Text within FormPill is now truncated so FormPill(s) will not stretch beyond FormPillGroup width. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@twilio-paste/combobox": patch | ||
"@twilio-paste/core": patch | ||
--- | ||
|
||
[Combobox] added ellipse styling to text that exceeds length of a single select combobox when not active |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
import { Avatar } from "@twilio-paste/avatar"; | ||
import { Box } from "@twilio-paste/box"; | ||
import { CalendarIcon } from "@twilio-paste/icons/esm/CalendarIcon"; | ||
import { Stack } from "@twilio-paste/stack"; | ||
import { Text } from "@twilio-paste/text"; | ||
import * as React from "react"; | ||
|
||
import { FormPill, FormPillGroup, useFormPillState } from "../src"; | ||
|
@@ -177,6 +179,157 @@ export const FormPillTreeVariant = (): JSX.Element => { | |
|
||
FormPillTreeVariant.storyName = "FormPillGroup Tree Variant"; | ||
|
||
export const PillStringOverflowVSComposed: React.FC< | ||
React.PropsWithChildren<{ | ||
selected?: boolean; | ||
dismissable?: boolean; | ||
disabled?: boolean; | ||
ariaLabel?: string; | ||
size?: FormPillGroupSizeVariant; | ||
}> | ||
> = ({ selected = false, dismissable = true, disabled = false, ariaLabel = "Basic pills:", size }) => { | ||
const pillState = useFormPillState(); | ||
const pillState2 = useFormPillState(); | ||
|
||
return ( | ||
<Box maxWidth="150px"> | ||
<Stack orientation="vertical" spacing="space80"> | ||
<FormPillGroup {...pillState} data-testid="form-pill-group-1" aria-label={ariaLabel} size={size}> | ||
{PILL_NAMES.map((pill, index) => ( | ||
<FormPill | ||
key={`${pill}-1`} | ||
data-testid={`form-pill-${index}-01`} | ||
{...pillState} | ||
selected={selected} | ||
variant={index > 2 ? "error" : "default"} | ||
onDismiss={dismissable ? () => {} : undefined} | ||
disabled={disabled} | ||
> | ||
{index % 3 === 2 ? ( | ||
<Avatar | ||
size={size === "large" ? "sizeIcon20" : "sizeIcon10"} | ||
name="avatar example" | ||
src="./avatars/avatar4.png" | ||
/> | ||
) : null} | ||
{index % 3 === 1 ? ( | ||
<CalendarIcon decorative size={size === "large" ? "sizeIcon20" : "sizeIcon10"} /> | ||
) : null} | ||
{pill} | ||
</FormPill> | ||
))} | ||
</FormPillGroup> | ||
|
||
<FormPillGroup {...pillState2} data-testid="form-pill-group-2" aria-label={ariaLabel} size={size}> | ||
{PILL_NAMES.map((pill, index) => ( | ||
<FormPill | ||
key={`${pill}-2`} | ||
data-testid={`form-pill-${index}-02`} | ||
{...pillState2} | ||
selected={selected} | ||
variant={index > 2 ? "error" : "default"} | ||
onDismiss={dismissable ? () => {} : undefined} | ||
disabled={disabled} | ||
> | ||
{pill} | ||
</FormPill> | ||
))} | ||
</FormPillGroup> | ||
</Stack> | ||
</Box> | ||
); | ||
}; | ||
|
||
PillStringOverflowVSComposed.storyName = "Pill String Overflow vs Composed"; | ||
|
||
export const PillNarrowContainerDecorationsEnd: React.FC< | ||
React.PropsWithChildren<{ | ||
selected?: boolean; | ||
dismissable?: boolean; | ||
disabled?: boolean; | ||
ariaLabel?: string; | ||
size?: FormPillGroupSizeVariant; | ||
}> | ||
> = ({ selected = false, dismissable = true, disabled = false, ariaLabel = "Basic pills:", size }) => { | ||
const pillState = useFormPillState(); | ||
const pillState2 = useFormPillState(); | ||
|
||
return ( | ||
<Box maxWidth="150px"> | ||
<FormPillGroup {...pillState} data-testid="form-pill-group" aria-label={ariaLabel} size={size}> | ||
{PILL_NAMES.map((pill, index) => ( | ||
<FormPill | ||
key={`${pill}-1`} | ||
data-testid={`form-pill-${index}`} | ||
{...pillState} | ||
selected={selected} | ||
variant={index > 2 ? "error" : "default"} | ||
onDismiss={dismissable ? () => {} : undefined} | ||
disabled={disabled} | ||
> | ||
{pill} | ||
{index % 3 === 2 ? ( | ||
<Avatar | ||
size={size === "large" ? "sizeIcon20" : "sizeIcon10"} | ||
name="avatar example" | ||
src="./avatars/avatar4.png" | ||
/> | ||
) : null} | ||
{index % 3 === 1 ? <CalendarIcon decorative size={size === "large" ? "sizeIcon20" : "sizeIcon10"} /> : null} | ||
</FormPill> | ||
))} | ||
</FormPillGroup> | ||
</Box> | ||
); | ||
}; | ||
|
||
PillNarrowContainerDecorationsEnd.storyName = "Pill Narrow Container Decorations End"; | ||
|
||
export const PillNarrowContainerFormattedTextContent: React.FC< | ||
krisantrobus marked this conversation as resolved.
Show resolved
Hide resolved
|
||
React.PropsWithChildren<{ | ||
selected?: boolean; | ||
dismissable?: boolean; | ||
disabled?: boolean; | ||
ariaLabel?: string; | ||
size?: FormPillGroupSizeVariant; | ||
}> | ||
> = ({ selected = false, dismissable = true, disabled = false, ariaLabel = "Basic pills:", size }) => { | ||
const pillState = useFormPillState(); | ||
const pillState2 = useFormPillState(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion(non-blocking): should this line be removed? doesn't look like it's being used |
||
|
||
return ( | ||
<Box maxWidth="90px"> | ||
<FormPillGroup {...pillState} data-testid="form-pill-group" aria-label={ariaLabel} size={size}> | ||
{PILL_NAMES.map((pill, index) => ( | ||
<FormPill | ||
key={`${pill}-1`} | ||
data-testid={`form-pill-${index}`} | ||
{...pillState} | ||
selected={selected} | ||
variant={index > 2 ? "error" : "default"} | ||
onDismiss={dismissable ? () => {} : undefined} | ||
disabled={disabled} | ||
> | ||
{index % 3 === 2 ? ( | ||
<Avatar | ||
size={size === "large" ? "sizeIcon20" : "sizeIcon10"} | ||
name="avatar example" | ||
src="./avatars/avatar4.png" | ||
/> | ||
) : null} | ||
{index % 3 === 1 ? <CalendarIcon decorative size={size === "large" ? "sizeIcon20" : "sizeIcon10"} /> : null} | ||
<Text fontWeight="fontWeightBold" fontStyle="italic"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue: Text should have an |
||
{pill} | ||
</Text> | ||
</FormPill> | ||
))} | ||
</FormPillGroup> | ||
</Box> | ||
); | ||
}; | ||
|
||
PillNarrowContainerFormattedTextContent.storyName = "Pill Narrow Container Formatted Text Content"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion(non-blocking) this line isn't necessary unless you're changing the name of the story, adds errors to the file |
||
|
||
// eslint-disable-next-line import/no-default-export | ||
export default { | ||
title: "Components/Form Pill Group", | ||
|
Uh oh!
There was an error while loading. Please reload this page.