Skip to content

Commit

Permalink
Merge branch 'main' into summary-detail/add-package
Browse files Browse the repository at this point in the history
  • Loading branch information
SiTaggart authored Jan 26, 2024
2 parents b6b653f + e0e69e7 commit 0d678ad
Show file tree
Hide file tree
Showing 92 changed files with 2,268 additions and 493 deletions.
6 changes: 6 additions & 0 deletions .changeset/few-needles-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@twilio-paste/page-header": minor
"@twilio-paste/core": minor
---

[Page Header] Create new PageHeaderSeparator component as part of the Page Header package
5 changes: 5 additions & 0 deletions .changeset/hip-humans-ring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@twilio-paste/codemods": patch
---

[codemods] add new export to page-header package: PageHeaderSeparator
6 changes: 6 additions & 0 deletions .changeset/late-mirrors-rule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@twilio-paste/input": patch
"@twilio-paste/core": patch
---

[Input] Fix rendering logic of decrement arrow on number input
1 change: 1 addition & 0 deletions packages/paste-codemods/tools/.cache/mappings.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
"PageHeaderMeta": "@twilio-paste/core/page-header",
"PageHeaderParagraph": "@twilio-paste/core/page-header",
"PageHeaderPrefix": "@twilio-paste/core/page-header",
"PageHeaderSeparator": "@twilio-paste/core/page-header",
"PageHeaderSetting": "@twilio-paste/core/page-header",
"Pagination": "@twilio-paste/core/pagination",
"PaginationArrow": "@twilio-paste/core/pagination",
Expand Down
2 changes: 1 addition & 1 deletion packages/paste-core/components/input/src/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
const [showDecrement, setShowDecrement] = React.useState(true);

// used for number inputs to be able to track uncontrolled number inputs value being changed by a user and it not being tracked by an applications
const [internalValue, setInternalValue] = React.useState(props.defaultValue ? props.defaultValue : "0");
const [internalValue, setInternalValue] = React.useState(value ?? props.defaultValue ?? "0");

React.useEffect(() => {
if (type !== "number") return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -715,8 +715,8 @@ DefaultNumberInput.storyName = "Number Input - Controlled";

export const TestNumberInput = (): React.ReactNode => {
const uid = useUID();
const [value, setValue] = React.useState("0");
const [minValue, setMinValue] = React.useState("-10");
const [value, setValue] = React.useState("5");
const [minValue, setMinValue] = React.useState("0");
const [maxValue, setMaxValue] = React.useState("10");
const [stepValue, setStepValue] = React.useState("1");
return (
Expand Down
2 changes: 1 addition & 1 deletion packages/paste-core/components/page-header/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"category": "layout",
"status": "production",
"description": "Page header is a layout component that wraps all top level components on a page.",
"description": "Page Header is a layout component that wraps all top-level components on a page.",
"author": "Twilio Inc.",
"license": "MIT",
"main:dev": "src/index.tsx",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const PageHeader = React.forwardRef<HTMLDivElement, PageHeaderProps>(
element={element}
display="grid"
gridTemplateRows="auto auto auto"
gridTemplateAreas='"setting" "details" "in_page_navigation"'
gridTemplateAreas='"setting" "details" "content_barrier"'
>
{children}
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface PageHeaderInPageNavigationProps extends HTMLPasteProps<"div"> {
const PageHeaderInPageNavigation = React.forwardRef<HTMLDivElement, PageHeaderInPageNavigationProps>(
({ element = "PAGE_HEADER_IN_PAGE_NAVIGATION", children, ...props }, ref) => {
return (
<Box {...safelySpreadBoxProps(props)} ref={ref} element={element} gridArea="in_page_navigation">
<Box {...safelySpreadBoxProps(props)} ref={ref} element={element} gridArea="content_barrier">
{children}
</Box>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Box, safelySpreadBoxProps } from "@twilio-paste/box";
import type { BoxProps } from "@twilio-paste/box";
import type { HTMLPasteProps } from "@twilio-paste/types";
import * as React from "react";

export interface PageHeaderSeparatorProps extends HTMLPasteProps<"div"> {
children?: React.ReactNode;
/**
* Overrides the default element name to apply unique styles with the Customization Provider
* @default 'PAGE_HEADER_SEPARATOR'
* @type {BoxProps['element']}
* @memberof PageHeaderSeparatorProps
*/
element?: BoxProps["element"];
}

const PageHeaderSeparator = React.forwardRef<HTMLDivElement, PageHeaderSeparatorProps>(
({ element = "PAGE_HEADER_SEPARATOR", children, ...props }, ref) => {
return (
<Box
{...safelySpreadBoxProps(props)}
ref={ref}
element={element}
gridArea="content_barrier"
marginBottom="space60"
>
{children}
</Box>
);
},
);

PageHeaderSeparator.displayName = "PageHeaderSeparator";

export { PageHeaderSeparator };
2 changes: 2 additions & 0 deletions packages/paste-core/components/page-header/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ export { PageHeaderActions } from "./PageHeaderActions";
export type { PageHeaderActionsProps } from "./PageHeaderActions";
export { PageHeaderInPageNavigation } from "./PageHeaderInPageNavigation";
export type { PageHeaderInPageNavigationProps } from "./PageHeaderInPageNavigation";
export { PageHeaderSeparator } from "./PageHeaderSeparator";
export type { PageHeaderSeparatorProps } from "./PageHeaderSeparator";
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
ProgressStepSeparator,
ProgressSteps,
} from "@twilio-paste/progress-steps";
import { Separator } from "@twilio-paste/separator";
import { StatusBadge } from "@twilio-paste/status";
import { useTheme } from "@twilio-paste/theme";
import * as React from "react";
Expand All @@ -32,6 +33,7 @@ import {
PageHeaderMeta,
PageHeaderParagraph,
PageHeaderPrefix,
PageHeaderSeparator,
PageHeaderSetting,
} from "../src";

Expand Down Expand Up @@ -84,6 +86,81 @@ export const Default = (): React.ReactElement => {
);
};

export const SeparatorVersusNav = (): React.ReactElement => {
return (
<Box display="flex" columnGap="space200">
<Box width="size70" backgroundColor="colorBackground" height="min-content">
<PageHeader size="default">
<PageHeaderSetting>
<Breadcrumb>
<BreadcrumbItem href="#">Breadcrumb</BreadcrumbItem>
<BreadcrumbItem href="#">Breadcrumb</BreadcrumbItem>
</Breadcrumb>
</PageHeaderSetting>
<PageHeaderDetails>
<PageHeaderKeyword>Wizard title</PageHeaderKeyword>
<PageHeaderPrefix>
<Avatar size="sizeIcon90" name="Avatar Name" />
</PageHeaderPrefix>
<PageHeaderHeading>Page title</PageHeaderHeading>
<PageHeaderActions>
<Button variant="secondary">Action</Button>
</PageHeaderActions>
<PageHeaderMeta>
<Badge variant="success" as="span">
Badge
</Badge>
Meta
<Anchor href="#">Meta</Anchor>
</PageHeaderMeta>
<PageHeaderParagraph>Paragraph text</PageHeaderParagraph>
</PageHeaderDetails>
<PageHeaderSeparator>
<Separator orientation="horizontal" />
</PageHeaderSeparator>
</PageHeader>
</Box>
<Box width="size70" backgroundColor="colorBackground" height="min-content">
<PageHeader size="default">
<PageHeaderSetting>
<Breadcrumb>
<BreadcrumbItem href="#">Breadcrumb</BreadcrumbItem>
<BreadcrumbItem href="#">Breadcrumb</BreadcrumbItem>
</Breadcrumb>
</PageHeaderSetting>
<PageHeaderDetails>
<PageHeaderKeyword>Wizard title</PageHeaderKeyword>
<PageHeaderPrefix>
<Avatar size="sizeIcon90" name="Avatar Name" />
</PageHeaderPrefix>
<PageHeaderHeading>Page title</PageHeaderHeading>
<PageHeaderActions>
<Button variant="secondary">Action</Button>
</PageHeaderActions>
<PageHeaderMeta>
<Badge variant="success" as="span">
Badge
</Badge>
Meta
<Anchor href="#">Meta</Anchor>
</PageHeaderMeta>
<PageHeaderParagraph>Paragraph text</PageHeaderParagraph>
</PageHeaderDetails>
<PageHeaderInPageNavigation>
<InPageNavigation aria-label="get started">
<InPageNavigationItem href="#" currentPage>
Label
</InPageNavigationItem>
<InPageNavigationItem href="#">Label</InPageNavigationItem>
<InPageNavigationItem href="#">Label</InPageNavigationItem>
</InPageNavigation>
</PageHeaderInPageNavigation>
</PageHeader>
</Box>
</Box>
);
};

export const Compact = (): React.ReactElement => {
return (
<Box maxWidth="size50">
Expand Down
Loading

0 comments on commit 0d678ad

Please sign in to comment.