diff --git a/packages/canon/src/components/Box/Box.stories.tsx b/packages/canon/src/components/Box/Box.stories.tsx index c7fc341bf4..98ae922c2e 100644 --- a/packages/canon/src/components/Box/Box.stories.tsx +++ b/packages/canon/src/components/Box/Box.stories.tsx @@ -17,7 +17,7 @@ import React from 'react'; import type { Meta, StoryObj } from '@storybook/react'; import { Box } from './Box'; -import { Stack } from '../Stack'; +import { Flex } from '../Flex'; import { Inline } from '../Inline'; const meta = { @@ -81,7 +81,7 @@ const CardDisplay = ({ children }: { children?: React.ReactNode }) => { export const Display: Story = { render: args => ( - + Block @@ -96,7 +96,7 @@ export const Display: Story = { Responsive - + ), }; @@ -116,7 +116,7 @@ export const Padding: Story = { }, }, render: args => ( - + Padding @@ -142,7 +142,7 @@ export const Padding: Story = { Padding Left - + ), }; @@ -156,7 +156,7 @@ export const Margin: Story = { }, }, render: args => ( - + @@ -196,6 +196,6 @@ export const Margin: Story = { - + ), }; diff --git a/packages/canon/src/components/Button/Button.stories.tsx b/packages/canon/src/components/Button/Button.stories.tsx index 8661dc927d..719da4758c 100644 --- a/packages/canon/src/components/Button/Button.stories.tsx +++ b/packages/canon/src/components/Button/Button.stories.tsx @@ -18,7 +18,7 @@ import React from 'react'; import type { Meta, StoryObj } from '@storybook/react'; import { Button } from './Button'; import { Inline } from '../Inline'; -import { Stack } from '../Stack'; +import { Flex } from '../Flex'; import { Text } from '../Text'; import { ButtonProps } from './types'; @@ -95,11 +95,11 @@ export const FullWidth: Story = { children: 'Button', }, render: args => ( - + ))} - + ))} - + ), }; diff --git a/packages/canon/src/components/Checkbox/Checkbox.stories.tsx b/packages/canon/src/components/Checkbox/Checkbox.stories.tsx index 574783578c..40fee4a177 100644 --- a/packages/canon/src/components/Checkbox/Checkbox.stories.tsx +++ b/packages/canon/src/components/Checkbox/Checkbox.stories.tsx @@ -18,7 +18,7 @@ import React from 'react'; import type { Meta, StoryObj } from '@storybook/react'; import { Checkbox } from './Checkbox'; import { Inline } from '../Inline'; -import { Stack } from '../Stack'; +import { Flex } from '../Flex'; import { Text } from '../Text'; const meta = { @@ -51,7 +51,7 @@ export const AllVariants: Story = { export const Playground: Story = { render: () => ( - + All variants @@ -59,6 +59,6 @@ export const Playground: Story = { - + ), }; diff --git a/packages/canon/src/components/Stack/Stack.props.ts b/packages/canon/src/components/Flex/Flex.props.ts similarity index 89% rename from packages/canon/src/components/Stack/Stack.props.ts rename to packages/canon/src/components/Flex/Flex.props.ts index 3d3a4e220a..7d758c5ee3 100644 --- a/packages/canon/src/components/Stack/Stack.props.ts +++ b/packages/canon/src/components/Flex/Flex.props.ts @@ -25,7 +25,7 @@ const directionValues = [ ] as const; /** @public */ -const stackPropDefs = { +const flexPropDefs = { align: { type: 'enum', className: 'cu-align', @@ -44,7 +44,7 @@ const stackPropDefs = { }; /** @public */ -type StackOwnProps = GetPropDefTypes; +type FlexOwnProps = GetPropDefTypes; -export { stackPropDefs }; -export type { StackOwnProps }; +export { flexPropDefs }; +export type { FlexOwnProps }; diff --git a/packages/canon/src/components/Stack/Stack.stories.tsx b/packages/canon/src/components/Flex/Flex.stories.tsx similarity index 87% rename from packages/canon/src/components/Stack/Stack.stories.tsx rename to packages/canon/src/components/Flex/Flex.stories.tsx index 06a2f74565..86693274db 100644 --- a/packages/canon/src/components/Stack/Stack.stories.tsx +++ b/packages/canon/src/components/Flex/Flex.stories.tsx @@ -16,11 +16,11 @@ import React from 'react'; import type { Meta, StoryObj } from '@storybook/react'; -import { Stack } from './Stack'; +import { Flex } from './Flex'; const meta = { - title: 'Components/Stack', - component: Stack, + title: 'Components/Flex', + component: Flex, argTypes: { align: { control: 'inline-radio', @@ -38,7 +38,7 @@ const meta = { gap: '4', children: 'hello world', }, -} satisfies Meta; +} satisfies Meta; export default meta; type Story = StoryObj; @@ -81,60 +81,60 @@ export const RowDirection: Story = { export const AlignLeft: Story = { render: () => ( - + - + ), }; export const AlignCenter: Story = { render: () => ( - + - + ), }; export const AlignRight: Story = { render: () => ( - + - + ), }; export const ResponsiveAlign: Story = { render: () => ( - + - + ), }; export const ResponsiveGap: Story = { render: () => ( - + - + ), }; export const LargeGap: Story = { render: () => ( - + - + ), }; diff --git a/packages/canon/src/components/Stack/Stack.tsx b/packages/canon/src/components/Flex/Flex.tsx similarity index 81% rename from packages/canon/src/components/Stack/Stack.tsx rename to packages/canon/src/components/Flex/Flex.tsx index 9080a28e11..7c84ed08f8 100644 --- a/packages/canon/src/components/Stack/Stack.tsx +++ b/packages/canon/src/components/Flex/Flex.tsx @@ -15,24 +15,24 @@ */ import { createElement, forwardRef } from 'react'; -import { StackProps } from './types'; +import { FlexProps } from './types'; import clsx from 'clsx'; -import { stackPropDefs } from './Stack.props'; +import { flexPropDefs } from './Flex.props'; import { extractProps } from '../../utils/extractProps'; import { gapPropDefs } from '../../props/gap-props'; /** @public */ -export const Stack = forwardRef((props, ref) => { +export const Flex = forwardRef((props, ref) => { const propDefs = { ...gapPropDefs, - ...stackPropDefs, + ...flexPropDefs, }; const { className, style } = extractProps(props, propDefs); return createElement('div', { ref, - className: clsx('canon-Stack', className), + className: clsx('canon-Flex', className), style, children: props.children, }); diff --git a/packages/canon/src/components/Stack/index.ts b/packages/canon/src/components/Flex/index.ts similarity index 88% rename from packages/canon/src/components/Stack/index.ts rename to packages/canon/src/components/Flex/index.ts index 7abbc3f439..4e4c883119 100644 --- a/packages/canon/src/components/Stack/index.ts +++ b/packages/canon/src/components/Flex/index.ts @@ -13,5 +13,5 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export { Stack } from './Stack'; -export type { StackProps } from './types'; +export { Flex } from './Flex'; +export type { FlexProps } from './types'; diff --git a/packages/canon/src/components/Stack/styles.css b/packages/canon/src/components/Flex/styles.css similarity index 97% rename from packages/canon/src/components/Stack/styles.css rename to packages/canon/src/components/Flex/styles.css index dc8fdd392f..094edffca7 100644 --- a/packages/canon/src/components/Stack/styles.css +++ b/packages/canon/src/components/Flex/styles.css @@ -14,6 +14,6 @@ * limitations under the License. */ -.canon-Stack { +.canon-Flex { display: flex; } diff --git a/packages/canon/src/components/Stack/types.ts b/packages/canon/src/components/Flex/types.ts similarity index 82% rename from packages/canon/src/components/Stack/types.ts rename to packages/canon/src/components/Flex/types.ts index 2ef2299060..c01af20e99 100644 --- a/packages/canon/src/components/Stack/types.ts +++ b/packages/canon/src/components/Flex/types.ts @@ -15,15 +15,15 @@ */ import type { SpaceProps } from '../../types'; -import { StackOwnProps } from './Stack.props'; +import { FlexOwnProps } from './Flex.props'; import type { GapProps } from '../../props/gap-props'; /** @public */ -export interface StackProps extends SpaceProps { +export interface FlexProps extends SpaceProps { children: React.ReactNode; gap?: GapProps['gap']; - align?: StackOwnProps['align']; - direction?: StackOwnProps['direction']; + align?: FlexOwnProps['align']; + direction?: FlexOwnProps['direction']; className?: string; style?: React.CSSProperties; } diff --git a/packages/canon/src/components/Grid/Grid.stories.tsx b/packages/canon/src/components/Grid/Grid.stories.tsx index ebffe29bc0..c4ac7f1849 100644 --- a/packages/canon/src/components/Grid/Grid.stories.tsx +++ b/packages/canon/src/components/Grid/Grid.stories.tsx @@ -19,7 +19,7 @@ import type { Meta, StoryObj } from '@storybook/react'; import { Grid } from './Grid'; import type { GridItemProps } from './types'; import { Box } from '../Box/Box'; -import { Stack } from '../Stack'; +import { Flex } from '../Flex'; const meta = { title: 'Components/Grid', @@ -82,7 +82,7 @@ export const ColumnSizes: Story = { columns: '12', }, render: args => ( - + {Array.from({ length: 11 }, (_, i) => ( @@ -93,7 +93,7 @@ export const ColumnSizes: Story = { ))} - + ), }; @@ -102,7 +102,7 @@ export const RowAndColumns: Story = { columns: '12', }, render: args => ( - + - + ), }; diff --git a/packages/canon/src/components/Heading/Heading.stories.tsx b/packages/canon/src/components/Heading/Heading.stories.tsx index dc74ea0e16..09c0a76ea0 100644 --- a/packages/canon/src/components/Heading/Heading.stories.tsx +++ b/packages/canon/src/components/Heading/Heading.stories.tsx @@ -17,7 +17,7 @@ import React from 'react'; import type { Meta, StoryObj } from '@storybook/react'; import { Heading } from './Heading'; -import { Stack } from '../Stack'; +import { Flex } from '../Flex'; import { Text } from '../Text'; const meta = { title: 'Components/Heading', @@ -41,13 +41,13 @@ export const Title1: Story = { export const AllVariants: Story = { render: () => ( - + Display Title 1 Title 2 Title 3 Title 4 - + ), }; @@ -69,7 +69,7 @@ export const CustomTag: Story = { export const Playground: Story = { render: () => ( - + All variants Display Title 1 @@ -77,6 +77,6 @@ export const Playground: Story = { Title 3 Title 4 Title 5 - + ), }; diff --git a/packages/canon/src/components/Text/Text.stories.tsx b/packages/canon/src/components/Text/Text.stories.tsx index b0776beee9..547b637619 100644 --- a/packages/canon/src/components/Text/Text.stories.tsx +++ b/packages/canon/src/components/Text/Text.stories.tsx @@ -17,7 +17,7 @@ import React from 'react'; import type { Meta, StoryObj } from '@storybook/react'; import { Text } from './Text'; -import { Stack } from '../Stack'; +import { Flex } from '../Flex'; const meta = { title: 'Components/Text', @@ -40,7 +40,7 @@ export const Default: Story = { export const AllVariants: Story = { render: () => ( - + A man looks at a painting in a museum and says, “Brothers and sisters I have none, but that man's father is my father's son.” Who is @@ -61,13 +61,13 @@ export const AllVariants: Story = { have none, but that man's father is my father's son.” Who is in the painting? - + ), }; export const AllWeights: Story = { render: () => ( - + A man looks at a painting in a museum and says, “Brothers and sisters I have none, but that man's father is my father's son.” Who is @@ -78,7 +78,7 @@ export const AllWeights: Story = { have none, but that man's father is my father's son.” Who is in the painting? - + ), }; @@ -93,7 +93,7 @@ export const Responsive: Story = { export const Playground: Story = { render: () => ( - + Subtitle A man looks at a painting in a museum and says, “Brothers and sisters I @@ -118,6 +118,6 @@ export const Playground: Story = { have none, but that man's father is my father's son.” Who is in the painting? - + ), }; diff --git a/packages/canon/src/css/components.css b/packages/canon/src/css/components.css index 39f77847c5..1abee6eb5d 100644 --- a/packages/canon/src/css/components.css +++ b/packages/canon/src/css/components.css @@ -17,7 +17,7 @@ /* Components */ @import '../components/Box/styles.css'; @import '../components/Button/styles.css'; -@import '../components/Stack/styles.css'; +@import '../components/Flex/styles.css'; @import '../components/Grid/styles.css'; @import '../components/Container/styles.css'; @import '../components/Icon/styles.css'; diff --git a/packages/canon/src/index.ts b/packages/canon/src/index.ts index 3b88ada0ce..1168990966 100644 --- a/packages/canon/src/index.ts +++ b/packages/canon/src/index.ts @@ -26,7 +26,7 @@ export * from './contexts/canon'; // Layout components export * from './components/Box'; export * from './components/Grid'; -export * from './components/Stack'; +export * from './components/Flex'; export * from './components/Container'; export * from './components/Text'; export * from './components/Heading';