Skip to content
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

Elevation component changes #4226

Open
wants to merge 41 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
9014fdc
feat(side-panel): add elevation changes
PixeledCode Jan 29, 2025
8f156b5
feat(minimizable-dialog): add elevation changes
PixeledCode Jan 29, 2025
2f80f75
feat(side-modal): add elevation changes
PixeledCode Jan 29, 2025
4d547af
feat(input): add elevation changes
PixeledCode Jan 29, 2025
b66c60d
feat(tooltip): add elevation changes
PixeledCode Jan 29, 2025
57f78a3
feat(callout): add elevation changes
PixeledCode Jan 29, 2025
d38bf69
feat(topbar): add elevation changes
PixeledCode Jan 29, 2025
9c68a2b
feat(side-panel): update footer and header tokens
PixeledCode Jan 29, 2025
70e5636
feat(chat-composer): update tokens for elevation
PixeledCode Feb 3, 2025
d4a29b9
feat(chat-log): update tokens for elevation
PixeledCode Feb 3, 2025
6ebbcbe
feat(side-panel): remove background color from header and footer
PixeledCode Feb 3, 2025
dfc6198
feat(topbar): remove border bottom
PixeledCode Feb 3, 2025
629c914
feat(sidebar): update tokens for elevation
PixeledCode Feb 3, 2025
d7ebf55
feat(menu): update tokens for elevation
PixeledCode Feb 3, 2025
518c6f4
feat(user-dialog): update tokens for elevation
PixeledCode Feb 3, 2025
8da65b9
feat(combobox): update tokens for elevation
PixeledCode Feb 3, 2025
08b7a61
feat(popover): update tokens for elevation
PixeledCode Feb 3, 2025
72fdc82
feat(toast): update tokens for elevation
PixeledCode Feb 3, 2025
207aa8d
feat(modal): update tokens for elevation
PixeledCode Feb 3, 2025
462d5d4
feat(sidebar): remove commented code
PixeledCode Feb 3, 2025
08de6c1
feat(paste): add changeset
PixeledCode Feb 3, 2025
e1b11a8
feat(input): update default background token
PixeledCode Feb 3, 2025
89e7a2c
feat(input): update increament and decreament background token
PixeledCode Feb 3, 2025
b77590d
feat(minimizable-dialog): remove unused import
PixeledCode Feb 3, 2025
d2664a3
feat(side-modal): remove extra tokens
PixeledCode Feb 3, 2025
33f1ab7
feat(input-box): removed unused import
PixeledCode Feb 3, 2025
a8df70b
feat(side-panel): update hover token
PixeledCode Feb 3, 2025
6d68a63
feat(elevation): changes from review
PixeledCode Feb 5, 2025
14a9ad7
feat(sidepanel): update tokens
PixeledCode Feb 6, 2025
09f4aec
feat(sidebar): update tokens
PixeledCode Feb 6, 2025
6c15853
feat(tokens): add shadow-elevation-top-20 token
PixeledCode Feb 10, 2025
f295932
feat(elevation): update componets to use new token
PixeledCode Feb 10, 2025
02a7309
feat(elevation): add new token color-background-strong-elevation
PixeledCode Feb 10, 2025
07d5b6d
feat(chat-log): update background color
PixeledCode Feb 10, 2025
c0f8b12
feat(elevation): add changeset
PixeledCode Feb 10, 2025
cb91e54
feat(elevation): update typedocs
PixeledCode Feb 10, 2025
94105a0
feat(tokens): add color-background-strong-elevation for dark theme
PixeledCode Feb 10, 2025
642df3f
feat(tokens): update comments
PixeledCode Feb 10, 2025
f76c569
Merge branch 'main' into elevation-component-changes
PixeledCode Feb 12, 2025
80eab76
feat(elevation): implement changes from chromatic review
PixeledCode Feb 13, 2025
983c7f6
feat(chat-composer): fix disable text color
PixeledCode Feb 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/great-singers-stare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@twilio-paste/design-tokens": minor
"@twilio-paste/core": minor
---

[Design Tokens] Add new box shadow and background color tokens for elevation
22 changes: 22 additions & 0 deletions .changeset/red-mirrors-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
"@twilio-paste/callout": patch
"@twilio-paste/chat-composer": patch
"@twilio-paste/chat-log": patch
"@twilio-paste/combobox": patch
"@twilio-paste/input": patch
"@twilio-paste/input-box": patch
"@twilio-paste/menu": patch
"@twilio-paste/minimizable-dialog": patch
"@twilio-paste/modal": patch
"@twilio-paste/popover": patch
"@twilio-paste/side-modal": patch
"@twilio-paste/side-panel": patch
"@twilio-paste/sidebar": patch
"@twilio-paste/toast": patch
"@twilio-paste/tooltip": patch
"@twilio-paste/topbar": patch
"@twilio-paste/user-dialog": patch
"@twilio-paste/core": patch
---

[Callout, ChatComposer, ChatLog, Combobox, Input, InputBox, Menu, MinimizableDialog, Modal, Popover, SideModal, SidePanel, Sidebar, Toast, Tooltip, Topbar, UserDialog]: Update styles to implement new elevation tokens
8 changes: 4 additions & 4 deletions packages/paste-core/components/callout/src/Callout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export interface CalloutProps extends HTMLPasteProps<"div"> {

const variantStyles: Record<CalloutVariants, BoxStyleProps> = {
success: {
backgroundColor: "colorBackgroundWeak",
backgroundColor: "colorBackgroundBodyElevation",
color: "colorTextSuccess",
borderColor: "colorBorderSuccessWeak",
},
Expand All @@ -74,17 +74,17 @@ const variantStyles: Record<CalloutVariants, BoxStyleProps> = {
borderColor: "colorBorderErrorWeak",
},
warning: {
backgroundColor: "colorBackgroundWeak",
backgroundColor: "colorBackgroundBodyElevation",
color: "colorTextWarningStrong",
borderColor: "colorBorderWarningWeak",
},
new: {
backgroundColor: "colorBackgroundWeak",
backgroundColor: "colorBackgroundBodyElevation",
color: "colorTextNew",
borderColor: "colorBorderNewWeak",
},
neutral: {
backgroundColor: "colorBackgroundWeak",
backgroundColor: "colorBackgroundBodyElevation",
color: "colorTextNeutral",
borderColor: "colorBorderNeutralWeak",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,8 @@ const ChatComposerAttachmentCard = React.forwardRef<HTMLDivElement, ChatComposer
ref={ref}
paddingY="space30"
paddingX="space40"
borderStyle="solid"
borderColor="colorBorderWeaker"
borderRadius="borderRadius30"
borderWidth="borderWidth10"
boxShadow="shadowLow"
backgroundColor="colorBackgroundBodyElevation"
position="relative"
display="inline-block"
width="100%"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ import * as React from "react";
import { ChatComposerContext } from "./ChatComposerContext";

const Styles: Record<string, BoxStyleProps> = {
default: {},
default: {
backgroundColor: "colorBackgroundWeaker",
},
contained: {
borderWidth: "borderWidth10",
borderStyle: "solid",
borderRadius: "borderRadius30",
borderColor: "colorBorderWeaker",
boxShadow: "shadowLow",
backgroundColor: "colorBackgroundBody",
boxShadow: "shadowElevation10",
backgroundColor: "colorBackgroundWeaker",
},
};

Expand Down Expand Up @@ -56,6 +55,7 @@ export const ChatComposerContainer = React.forwardRef<HTMLDivElement, ChatCompos
gridAutoColumns="1fr auto"
disabled={isDisabled}
aria-disabled={isDisabled}
color="colorTextWeak"
_disabled={{
color: "colorTextWeaker",
backgroundColor: "colorBackground",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const PlaceholderWrapper: React.FC<
right="space40"
display="flex"
alignItems="center"
color="colorTextWeak"
color="inherit"
pointerEvents="none"
userSelect="none"
fontStyle="italic"
Expand Down
4 changes: 2 additions & 2 deletions packages/paste-core/components/chat-log/src/ChatBubble.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ const bubbleVariantStyles: {
[key in MessageVariants]: BoxStyleProps;
} = {
inbound: {
backgroundColor: "colorBackground",
backgroundColor: "colorBackgroundElevation",
alignSelf: "flex-start",
},
outbound: {
backgroundColor: "colorBackgroundInverseStronger",
backgroundColor: "colorBackgroundInverseStrongerElevation",
alignSelf: "flex-end",
color: "colorTextInverse",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,8 @@ const ComposerAttachmentCard = React.forwardRef<HTMLDivElement, ComposerAttachme
ref={ref}
paddingY="space30"
paddingX="space40"
borderStyle="solid"
borderColor="colorBorderWeaker"
borderRadius="borderRadius30"
borderWidth="borderWidth10"
boxShadow="shadowLow"
backgroundColor="colorBackgroundBodyElevation"
position="relative"
display="inline-block"
width="100%"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,9 @@ const ComboboxListbox = React.forwardRef<HTMLUListElement, ComboboxListboxProps>
<Box
{...safelySpreadBoxProps(props)}
as="div"
backgroundColor="colorBackgroundBody"
backgroundColor="colorBackgroundWeaker"
borderRadius="borderRadius20"
borderColor="colorBorderWeak"
borderWidth="borderWidth10"
borderStyle="solid"
boxShadow="shadow"
boxShadow="shadowElevation10"
element={element}
listStyleType="none"
margin="space0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ const getInputChevronIconColor = (

const BackgroundColorStyles: { [variant: string]: { [key: string]: BackgroundColor } } = {
default: {
default: "colorBackground",
default: "colorBackgroundBodyElevation",
disabled: "colorBackground",
readOnly: "colorBackground",
readOnly: "colorBackgroundBodyElevation",
},
inverse: {
default: "colorBackgroundInverseStrong",
default: "colorBackgroundInverseElevation",
disabled: "colorBackgroundInverse",
readOnly: "colorBackgroundInverseStrong",
readOnly: "colorBackgroundInverseElevation",
},
};

Expand Down
13 changes: 3 additions & 10 deletions packages/paste-core/components/input-box/src/Prefix.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Box } from "@twilio-paste/box";
import type { BoxProps } from "@twilio-paste/box";
import type { BackgroundColor, BorderColor } from "@twilio-paste/style-props";
import type { BackgroundColor } from "@twilio-paste/style-props";
import * as React from "react";

import type { Variants } from "./types";
Expand All @@ -18,18 +18,14 @@ export interface PrefixProps {

const Prefix = React.forwardRef<HTMLDivElement, PrefixProps>(
({ children, disabled, element = "PREFIX", variant }, ref) => {
let backgroundColor = "colorBackgroundWeak" as BackgroundColor;
let borderColor = "colorBorderWeaker" as BorderColor;
let backgroundColor = "colorBackgroundBodyElevation" as BackgroundColor;

if (disabled && variant === "inverse") {
backgroundColor = "none";
borderColor = "colorBorderInverseWeaker";
} else if (variant === "inverse") {
backgroundColor = "colorBackgroundInverse";
borderColor = "colorBorderInverse";
backgroundColor = "colorBackgroundInverseElevation";
} else if (disabled) {
backgroundColor = "none";
borderColor = "colorBorderWeaker";
}

if (children == null) return null;
Expand All @@ -38,9 +34,6 @@ const Prefix = React.forwardRef<HTMLDivElement, PrefixProps>(
alignItems="flex-start"
backgroundColor={backgroundColor}
borderBottomLeftRadius="borderRadius20"
borderRightColor={borderColor}
borderRightStyle="solid"
borderRightWidth="borderWidth10"
borderTopLeftRadius="borderRadius20"
display="flex"
element={`${element}_PREFIX`}
Expand Down
13 changes: 3 additions & 10 deletions packages/paste-core/components/input-box/src/Suffix.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Box } from "@twilio-paste/box";
import type { BoxProps } from "@twilio-paste/box";
import type { BackgroundColor, BorderColor } from "@twilio-paste/style-props";
import type { BackgroundColor } from "@twilio-paste/style-props";
import * as React from "react";

import type { Variants } from "./types";
Expand All @@ -18,18 +18,14 @@ export interface SuffixProps {

const Suffix = React.forwardRef<HTMLDivElement, SuffixProps>(
({ children, disabled, element = "SUFFIX", variant }, ref) => {
let backgroundColor = "colorBackgroundWeak" as BackgroundColor;
let borderColor = "colorBorderWeaker" as BorderColor;
let backgroundColor = "colorBackgroundBodyElevation" as BackgroundColor;

if (disabled && variant === "inverse") {
backgroundColor = "none";
borderColor = "colorBorderInverseWeaker";
} else if (variant === "inverse") {
backgroundColor = "colorBackgroundInverse";
borderColor = "colorBorderInverse";
backgroundColor = "colorBackgroundInverseElevation";
} else if (disabled) {
backgroundColor = "none";
borderColor = "colorBorderWeaker";
}

if (children == null) return null;
Expand All @@ -38,9 +34,6 @@ const Suffix = React.forwardRef<HTMLDivElement, SuffixProps>(
alignItems="flex-start"
backgroundColor={backgroundColor}
borderBottomRightRadius="borderRadius20"
borderLeftColor={borderColor}
borderLeftStyle="solid"
borderLeftWidth="borderWidth10"
borderTopRightRadius="borderRadius20"
display="flex"
element={`${element}_SUFFIX`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const DecrementButton = React.forwardRef<HTMLButtonElement, DecrementButt
size="reset"
type="button"
borderRadius="borderRadius20"
backgroundColor={variant === "inverse" ? "colorBackgroundInverseStrong" : "colorBackground"}
backgroundColor={variant === "inverse" ? "colorBackgroundInverseElevation" : "colorBackgroundBodyElevation"}
marginRight="space30"
_focus={{
boxShadow: variant === "inverse" ? "shadowBorderInverseStrong" : "shadowBorderPrimary",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const IncrementButton = React.forwardRef<HTMLButtonElement, IncrementButt
size="reset"
type="button"
borderRadius="borderRadius20"
backgroundColor={variant === "inverse" ? "colorBackgroundInverseStrong" : "colorBackground"}
backgroundColor={variant === "inverse" ? "colorBackgroundInverseElevation" : "colorBackgroundBodyElevation"}
marginRight="space30"
_focus={{
boxShadow: variant === "inverse" ? "shadowBorderInverseStrong" : "shadowBorderPrimary",
Expand Down
7 changes: 2 additions & 5 deletions packages/paste-core/components/menu/src/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@ const StyledMenu = React.forwardRef<HTMLDivElement, BoxElementProps>(({ style, .
return (
<Box
{...safelySpreadBoxProps(props)}
backgroundColor="colorBackgroundBody"
borderStyle="solid"
borderWidth="borderWidth10"
borderColor="colorBorderWeaker"
backgroundColor="colorBackgroundWeaker"
borderRadius="borderRadius30"
boxShadow="shadow"
boxShadow="shadowElevation10"
maxWidth="size30"
minWidth="size20"
zIndex="zIndex20"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export const StyledMenuItem = React.forwardRef<HTMLDivElement | HTMLAnchorElemen
_disabled={{
color: "colorTextWeaker",
cursor: "not-allowed",
backgroundColor: "colorBackgroundBody",
backgroundColor: "colorBackgroundWeaker",
borderColor: "transparent",
}}
ref={ref}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,12 @@ const MinimizableDialogHeader = React.forwardRef<HTMLDivElement, MinimizableDial
display="grid"
gridTemplateColumns="1fr auto auto"
columnGap="space30"
backgroundColor="colorBackground"
backgroundColor={minimized ? "colorBackgroundBodyElevation" : "colorBackgroundWeaker"}
paddingX="space70"
paddingY="space40"
color="colorTextWeak"
overflow="hidden"
borderBottomWidth="borderWidth10"
borderBottomStyle="solid"
borderBottomColor="colorBorderWeaker"
borderTopRightRadius="borderRadius20"
borderTopLeftRadius="borderRadius20"
boxShadow={minimized ? "shadowElevation10" : "none"}
element={element}
>
<Box
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
import { Box } from "@twilio-paste/box";
import type { BoxProps } from "@twilio-paste/box";
import { Box } from "@twilio-paste/box";
import * as React from "react";

export const StyledMinimizableDialog: React.FC<React.PropsWithChildren<Pick<BoxProps, "element">>> = ({
element,
children,
}) => (
<Box
element={element}
borderRadius="borderRadius20"
display="flex"
flexDirection="column"
backgroundColor="colorBackgroundBody"
width="size40"
boxShadow="shadow"
>
{children}
</Box>
);
}) => {
return (
<Box
element={element}
borderRadius="borderRadius20"
display="flex"
flexDirection="column"
backgroundColor="colorBackgroundWeaker"
width="size40"
boxShadow="shadowElevationTop20"
>
{children}
</Box>
);
};

StyledMinimizableDialog.displayName = "StyledMinimizableDialog";
5 changes: 1 addition & 4 deletions packages/paste-core/components/modal/src/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,8 @@ export const ModalDialogContent = animated(
maxHeight: "90%",
minHeight: "170px",
backgroundColor: "colorBackgroundBody",
borderColor: "colorBorderWeaker",
borderRadius: "borderRadius30",
borderStyle: "solid",
borderWidth: "borderWidth10",
boxShadow: "shadow",
boxShadow: "shadowElevationTop20",
display: "flex",
flexDirection: "column",
}),
Expand Down
7 changes: 2 additions & 5 deletions packages/paste-core/components/popover/src/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ const StyledPopover = React.forwardRef<HTMLDivElement, BoxProps>(({ style, width
<Box
{...safelySpreadBoxProps(props)}
width={width}
backgroundColor="colorBackgroundBody"
borderStyle="solid"
borderWidth="borderWidth10"
borderColor="colorBorderWeaker"
backgroundColor="colorBackgroundWeaker"
borderRadius="borderRadius30"
boxShadow="shadowLow"
boxShadow="shadowElevation10"
maxWidth="size50"
zIndex="zIndex80"
_focus={{ outline: "none" }}
Expand Down
4 changes: 2 additions & 2 deletions packages/paste-core/components/side-modal/src/SideModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ export const SideModal = React.forwardRef<HTMLDivElement, SideModalProps>(
display="grid"
gridTemplateRows="auto 1fr auto"
height="100vh"
backgroundColor="colorBackgroundBody"
boxShadow="shadow"
backgroundColor="colorBackgroundWeaker"
boxShadow="shadowElevationLeft20"
width="size80"
>
{children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const StyledSidePanelWrapper = React.forwardRef<HTMLDivElement, BoxProps>((props
width={["100%", "size40", "size40"]}
height={props.height}
boxSizing="content-box"
backgroundColor="colorBackgroundWeaker"
/>
));

Expand Down
Loading
Loading