The Open Standard for Generative UI
Storybook fix (#15)
Ankit Das95b82086b15e
diff --git a/frontend-sdk/packages/react-ui/src/components/Accordion/Accordion.tsx b/frontend-sdk/packages/react-ui/src/components/Accordion/Accordion.tsxindex 937e94cd5..5cb39ef82 100644--- a/frontend-sdk/packages/react-ui/src/components/Accordion/Accordion.tsx+++ b/frontend-sdk/packages/react-ui/src/components/Accordion/Accordion.tsx@@ -19,20 +19,27 @@ export const Accordion = forwardRef</>));+type AccordionItemVariant = "card" | "sunk";export interface AccordionItemPropsextends React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item> {className?: string;style?: React.CSSProperties;value: string;- variant?: "card" | "sunk";+ variant?: AccordionItemVariant;}++const variantMap: Record<AccordionItemVariant, string> = {+ card: "crayon-accordion-item-card",+ sunk: "crayon-accordion-item-sunk",+};+export const AccordionItem = forwardRef<React.ComponentRef<typeof AccordionPrimitive.Item>,AccordionItemProps>(({ className, style, value, variant = "card", ...props }, ref) => (<AccordionPrimitive.Itemref={ref}- className={clsx("crayon-accordion-item", `crayon-accordion-item-${variant}`, className)}+ className={clsx("crayon-accordion-item", variantMap[variant], className)}style={style}value={value}{...props}diff --git a/frontend-sdk/packages/react-ui/src/components/Accordion/stories/accordion.stories.tsx b/frontend-sdk/packages/react-ui/src/components/Accordion/stories/accordion.stories.tsxindex a3cd4a212..d3c72494d 100644--- a/frontend-sdk/packages/react-ui/src/components/Accordion/stories/accordion.stories.tsx+++ b/frontend-sdk/packages/react-ui/src/components/Accordion/stories/accordion.stories.tsx@@ -9,139 +9,147 @@ import "../../Image/image.scss";import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "../Accordion";import "../accordion.scss";-const meta: Meta<typeof Accordion> = {+interface AccordionStoryProps {+ type: "single" | "multiple";+ collapsible?: boolean;+ defaultValue?: string;+ variant?: "card" | "sunk";+ showIcons?: boolean;+}++const meta: Meta<AccordionStoryProps> = {title: "Components/Accordion",- component: Accordion,+ component: Accordion as any, // Type casting needed since we're using a custom props interfacetags: ["autodocs"],- decorators: [(Story) => <Story />],+ parameters: {+ layout: "centered",+ },+ decorators: [+ (Story) => (+ <div style={{ width: "400px" }}>+ <Story />+ </div>+ ),+ ],+ argTypes: {+ type: {+ control: "radio",+ options: ["single", "multiple"],+ description: "The type of accordion behavior - single item open or multiple items",+ defaultValue: "single",+ },+ collapsible: {+ control: "boolean",+ description: "Whether the accordion items can be collapsed (only available for single type)",+ defaultValue: true,+ if: { arg: "type", eq: "single" },+ },+ defaultValue: {+ description: 'The default opened item value (only for type="single")',+ control: false,+ },+ variant: {+ control: "radio",+ options: ["card", "sunk"],+ description: "The visual style variant of the accordion",+ defaultValue: "card",+ },+ showIcons: {+ control: "boolean",+ description: "Whether to show icons in the accordion triggers",+ defaultValue: false,+ },+ },};+export default meta;+type Story = StoryObj<AccordionStoryProps>;-type Story = StoryObj<typeof Accordion>;+export const Single: Story = {+ render: (args) => {+ const items = [+ {+ value: "item-1",+ title: "Accordion 1",+ imageId: "600",+ },+ {+ value: "item-2",+ title: "Accordion 2",+ imageId: "700",+ },+ {+ value: "item-3",+ title: "Accordion 3",+ imageId: "900",+ },+ ];-export const Default: Story = {- render: () => (- <Accordion type="single" collapsible>- <AccordionItem value="item-1">- <AccordionTrigger text="Accordion 1" />- <AccordionContent>- <Header- title="Title"- subtitle="Subtitle"- actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}- />- <Image src="https://picsum.photos/200/300" alt="Image" scale="fill" />- </AccordionContent>- </AccordionItem>- <AccordionItem value="item-2">- <AccordionTrigger text="Accordion 2" />- <AccordionContent>- <Header- title="Title"- subtitle="Subtitle"- actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}- />- <Image src="https://picsum.photos/300/400" alt="Image" scale="fill" />- </AccordionContent>- </AccordionItem>- <AccordionItem value="item-3">- <AccordionTrigger text="Accordion 3" />- <AccordionContent>- <Header- title="Title"- subtitle="Subtitle"- actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}- />- <Image src="https://picsum.photos/400/500" alt="Image" scale="fill" />- </AccordionContent>- </AccordionItem>- </Accordion>- ),-};+ const AccordionComponent =+ args.type === "single" ? (+ <Accordion type="single" collapsible={args.collapsible} defaultValue={args.defaultValue}>+ {items.map((item) => (+ <AccordionItem key={item.value} value={item.value} variant={args.variant}>+ <AccordionTrigger+ text={item.title}+ icon={args.showIcons ? <Download /> : undefined}+ />+ <AccordionContent>+ <Header+ title="Title"+ subtitle="Subtitle"+ actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}+ />+ <Image src={`https://picsum.photos/400/${item.imageId}`} alt="Image" scale="fill" />+ </AccordionContent>+ </AccordionItem>+ ))}+ </Accordion>+ ) : (+ <Accordion type="multiple">+ {items.map((item) => (+ <AccordionItem key={item.value} value={item.value} variant={args.variant}>+ <AccordionTrigger+ text={item.title}+ icon={args.showIcons ? <Download /> : undefined}+ />+ <AccordionContent>+ <Header+ title="Title"+ subtitle="Subtitle"+ actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}+ />+ <Image src={`https://picsum.photos/400/${item.imageId}`} alt="Image" scale="fill" />+ </AccordionContent>+ </AccordionItem>+ ))}+ </Accordion>+ );-export const SingleOpen: Story = {- render: () => (- <Accordion type="single" collapsible defaultValue="item-1">- <AccordionItem value="item-1">- <AccordionTrigger text="Accordion 1" />- <AccordionContent>- <Header- title="Title"- subtitle="Subtitle"- actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}- />- <Image src="https://picsum.photos/200/300" alt="Image" scale="fill" />- </AccordionContent>- </AccordionItem>- <AccordionItem value="item-2">- <AccordionTrigger text="Accordion 2" />- <AccordionContent>- <Header- title="Title"- subtitle="Subtitle"- actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}- />- <Image src="https://picsum.photos/300/400" alt="Image" scale="fill" />- </AccordionContent>- </AccordionItem>- <AccordionItem value="item-3">- <AccordionTrigger text="Accordion 3" />- <AccordionContent>- <Header- title="Title"- subtitle="Subtitle"- actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}- />- <Image src="https://picsum.photos/400/500" alt="Image" scale="fill" />- </AccordionContent>- </AccordionItem>- </Accordion>- ),+ return AccordionComponent;+ },+ args: {+ type: "single",+ collapsible: true,+ variant: "card",+ showIcons: false,+ },};export const Multiple: Story = {- render: () => (- <Accordion type="multiple">- <AccordionItem value="item-1">- <AccordionTrigger text="Accordion 1" />- <AccordionContent>- <Header- title="Title"- subtitle="Subtitle"- actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}- />- <Image src="https://picsum.photos/200/300" alt="Image" scale="fill" />- </AccordionContent>- </AccordionItem>- <AccordionItem value="item-2">- <AccordionTrigger text="Accordion 2" />- <AccordionContent>- <Header- title="Title"- subtitle="Subtitle"- actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}- />- <Image src="https://picsum.photos/300/400" alt="Image" scale="fill" />- </AccordionContent>- </AccordionItem>- <AccordionItem value="item-3">- <AccordionTrigger text="Accordion 3" />- <AccordionContent>- <Header- title="Title"- subtitle="Subtitle"- actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}- />- <Image src="https://picsum.photos/400/500" alt="Image" scale="fill" />- </AccordionContent>- </AccordionItem>- </Accordion>- ),-};--export const MultipleOpen: Story = {- render: () => (- <Accordion type="multiple" defaultValue={["item-1", "item-2"]}>+ args: {+ type: "multiple",+ },+ parameters: {+ docs: {+ description: {+ story:+ "An example of an Accordion that allows multiple items to be open simultaneously. This variant gives users the flexibility to view multiple content sections at once.",+ },+ },+ },+ render: (args) => (+ <Accordion type={args.type}><AccordionItem value="item-1"><AccordionTrigger text="Accordion 1" /><AccordionContent>@@ -180,8 +188,13 @@ export const MultipleOpen: Story = {};export const withIcon: Story = {- render: () => (- <Accordion type="single" collapsible>+ args: {+ type: "single",+ collapsible: true,+ showIcons: true,+ },+ render: (args) => (+ <Accordion type={args.type} collapsible={args.collapsible}><AccordionItem value="item-1"><AccordionTrigger text="Accordion 1" icon={<Download />} /><AccordionContent>@@ -220,9 +233,14 @@ export const withIcon: Story = {};export const CardVariant: Story = {- render: () => (- <Accordion type="single" collapsible>- <AccordionItem value="item-1" variant="card">+ args: {+ type: "single",+ collapsible: true,+ variant: "card",+ },+ render: (args) => (+ <Accordion type={args.type} collapsible={args.collapsible}>+ <AccordionItem value="item-1" variant={args.variant}><AccordionTrigger text="Accordion 1" /><AccordionContent><Header@@ -233,7 +251,7 @@ export const CardVariant: Story = {<Image src="https://picsum.photos/200/300" alt="Image" scale="fill" /></AccordionContent></AccordionItem>- <AccordionItem value="item-2" variant="card">+ <AccordionItem value="item-2" variant={args.variant}><AccordionTrigger text="Accordion 2" /><AccordionContent><Header@@ -244,7 +262,7 @@ export const CardVariant: Story = {<Image src="https://picsum.photos/300/400" alt="Image" scale="fill" /></AccordionContent></AccordionItem>- <AccordionItem value="item-3" variant="card">+ <AccordionItem value="item-3" variant={args.variant}><AccordionTrigger text="Accordion 3" /><AccordionContent><Header@@ -260,9 +278,14 @@ export const CardVariant: Story = {};export const SunkVariant: Story = {- render: () => (- <Accordion type="single" collapsible>- <AccordionItem value="item-1" variant="sunk">+ args: {+ type: "single",+ collapsible: true,+ variant: "sunk",+ },+ render: (args) => (+ <Accordion type={args.type} collapsible={args.collapsible}>+ <AccordionItem value="item-1" variant={args.variant}><AccordionTrigger text="Accordion 1" /><AccordionContent><Header@@ -273,7 +296,7 @@ export const SunkVariant: Story = {<Image src="https://picsum.photos/200/300" alt="Image" scale="fill" /></AccordionContent></AccordionItem>- <AccordionItem value="item-2" variant="sunk">+ <AccordionItem value="item-2" variant={args.variant}><AccordionTrigger text="Accordion 2" /><AccordionContent><Header@@ -284,7 +307,7 @@ export const SunkVariant: Story = {<Image src="https://picsum.photos/300/400" alt="Image" scale="fill" /></AccordionContent></AccordionItem>- <AccordionItem value="item-3" variant="sunk">+ <AccordionItem value="item-3" variant={args.variant}><AccordionTrigger text="Accordion 3" /><AccordionContent><Headerdiff --git a/frontend-sdk/packages/react-ui/src/components/Button/Button.tsx b/frontend-sdk/packages/react-ui/src/components/Button/Button.tsxindex 9bc904c37..4e3249b9a 100644--- a/frontend-sdk/packages/react-ui/src/components/Button/Button.tsx+++ b/frontend-sdk/packages/react-ui/src/components/Button/Button.tsx@@ -1,8 +1,8 @@import clsx from "clsx";import { forwardRef, ReactNode } from "react";-export type ButtonVariant = "primary" | "secondary" | "tertiary";-export type ButtonSize = "small" | "medium" | "large";+type ButtonVariant = "primary" | "secondary" | "tertiary";+type ButtonSize = "small" | "medium" | "large";export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {variant?: ButtonVariant;@@ -11,6 +11,18 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemeniconRight?: ReactNode;}+const variantMap: Record<ButtonVariant, string> = {+ primary: "crayon-button-base-primary",+ secondary: "crayon-button-base-secondary",+ tertiary: "crayon-button-base-tertiary",+};++const sizeMap: Record<ButtonSize, string> = {+ small: "crayon-button-base-small",+ medium: "crayon-button-base-medium",+ large: "crayon-button-base-large",+};+export const Button = forwardRef<HTMLButtonElement, ButtonProps>(({ children, variant = "primary", size = "medium", iconLeft, iconRight, className, ...props },@@ -19,12 +31,7 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(return (<buttonref={ref}- className={clsx(- "crayon-button-base",- `crayon-button-base-${variant}`,- `crayon-button-base-${size}`,- className,- )}+ className={clsx("crayon-button-base", variantMap[variant], sizeMap[size], className)}{...props}>{iconLeft}diff --git a/frontend-sdk/packages/react-ui/src/components/Card/Card.tsx b/frontend-sdk/packages/react-ui/src/components/Card/Card.tsxindex 9918423da..8a43b8f20 100644--- a/frontend-sdk/packages/react-ui/src/components/Card/Card.tsx+++ b/frontend-sdk/packages/react-ui/src/components/Card/Card.tsx@@ -1,17 +1,31 @@import clsx from "clsx";import React from "react";+type CardVariant = "clear" | "card" | "sunk";+type CardWidth = "standard" | "full";+export interface CardProps extends React.HTMLAttributes<HTMLDivElement> {- variant?: "clear" | "card" | "sunk";- width?: "standard" | "full";+ variant?: CardVariant;+ width?: CardWidth;}+const variantMap: Record<CardVariant, string> = {+ clear: "crayon-card-clear",+ card: "crayon-card-card",+ sunk: "crayon-card-sunk",+};++const widthMap: Record<CardWidth, string> = {+ standard: "crayon-card-standard",+ full: "crayon-card-full",+};+export const Card = React.forwardRef<HTMLDivElement, CardProps>((props, ref) => {const { className, children, variant = "card", width = "standard", ...rest } = props;return (<divref={ref}- className={clsx("crayon-card", className, `crayon-card-${variant}`, `crayon-card-${width}`)}+ className={clsx("crayon-card", className, variantMap[variant], widthMap[width])}{...rest}>{children}diff --git a/frontend-sdk/packages/react-ui/src/components/Carousel/Carousel.tsx b/frontend-sdk/packages/react-ui/src/components/Carousel/Carousel.tsxindex 48b55b0b5..1d5103c25 100644--- a/frontend-sdk/packages/react-ui/src/components/Carousel/Carousel.tsx+++ b/frontend-sdk/packages/react-ui/src/components/Carousel/Carousel.tsx@@ -6,7 +6,7 @@ interface CarouselContextType {scrollDivRef: React.RefObject<HTMLDivElement | null>;scroll: (direction: "left" | "right") => void;itemsToScroll: number;- hasWrappingDivForCards?: boolean;+ noSnap?: boolean;showButtons?: boolean;}@@ -20,22 +20,12 @@ const useCarousel = () => {export interface CarouselProps extends React.HTMLAttributes<HTMLDivElement> {itemsToScroll?: number;- hasWrappingDivForCards?: boolean;+ noSnap?: boolean;showButtons?: boolean;}export const Carousel = forwardRef<HTMLDivElement, CarouselProps>(- (- {- itemsToScroll = 1,- hasWrappingDivForCards,- showButtons = true,- className,- children,- ...props- },- ref,- ) => {+ ({ itemsToScroll = 1, noSnap, showButtons = true, className, children, ...props }, ref) => {const scrollDivRef = useRef<HTMLDivElement>(null);const scroll = (direction: "left" | "right") => {@@ -45,7 +35,7 @@ export const Carousel = forwardRef<HTMLDivElement, CarouselProps>(const spacingEl = children.splice(0, 1)[0] as HTMLElement;- if (hasWrappingDivForCards) {+ if (noSnap) {children = Array.from(children[0]!.children);}@@ -74,7 +64,7 @@ export const Carousel = forwardRef<HTMLDivElement, CarouselProps>(return (<CarouselContext.Provider- value={{ scrollDivRef, scroll, itemsToScroll, hasWrappingDivForCards, showButtons }}+ value={{ scrollDivRef, scroll, itemsToScroll, noSnap, showButtons }}><div className={clsx("crayon-carousel", className)} ref={ref} {...props}>{children}@@ -86,12 +76,18 @@ export const Carousel = forwardRef<HTMLDivElement, CarouselProps>(export const CarouselContent = forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(({ className, children, ...props }, ref) => {- const { scrollDivRef } = useCarousel();+ const { scrollDivRef, noSnap } = useCarousel();++ const content = noSnap ? (+ <div className="crayon-carousel-content-wrapper">{children}</div>+ ) : (+ children+ );return (<div ref={scrollDivRef} className={clsx("crayon-carousel-content", className)} {...props}>- <div className="" />- {children}+ <div />+ {content}</div>);},diff --git a/frontend-sdk/packages/react-ui/src/components/Carousel/carousel.scss b/frontend-sdk/packages/react-ui/src/components/Carousel/carousel.scssindex 2c799c104..fd4e241cd 100644--- a/frontend-sdk/packages/react-ui/src/components/Carousel/carousel.scss+++ b/frontend-sdk/packages/react-ui/src/components/Carousel/carousel.scss@@ -8,11 +8,17 @@&-content {position: relative;display: flex;+ flex-direction: row;width: 100%;- gap: map.get(cssUtils.$spacing, "xl");+ gap: map.get(cssUtils.$spacing, "m");overflow-x: auto;scroll-snap-type: x mandatory;+ &-wrapper {+ display: flex;+ gap: map.get(cssUtils.$spacing, "m");+ }+&::-webkit-scrollbar {display: none;}diff --git a/frontend-sdk/packages/react-ui/src/components/Carousel/stories/carousel.stories.tsx b/frontend-sdk/packages/react-ui/src/components/Carousel/stories/carousel.stories.tsxindex e25cd8c58..00050b5ef 100644--- a/frontend-sdk/packages/react-ui/src/components/Carousel/stories/carousel.stories.tsx+++ b/frontend-sdk/packages/react-ui/src/components/Carousel/stories/carousel.stories.tsx@@ -15,121 +15,172 @@ import {} from "../Carousel";import "../carousel.scss";-const meta: Meta<typeof Carousel> = {+interface CarouselStoryProps {+ itemsToScroll: number;+ noSnap?: boolean;+ showButtons: boolean;+}++const meta: Meta<CarouselStoryProps> = {title: "Components/Carousel",- component: Carousel,+ component: Carousel as any,parameters: {layout: "centered",},tags: ["autodocs"],+ decorators: [+ (Story) => (+ <div style={{ width: "100%", maxWidth: "28rem" }}>+ <Story />+ </div>+ ),+ ],+ argTypes: {+ itemsToScroll: {+ control: "number",+ description: "Number of items to scroll when clicking navigation buttons",+ defaultValue: 1,+ },+ noSnap: {+ control: "boolean",+ description: "Whether to disable snap scrolling",+ defaultValue: false,+ },+ showButtons: {+ control: "boolean",+ description: "Whether to show the navigation buttons",+ defaultValue: true,+ },+ },};export default meta;-type Story = StoryObj<typeof Carousel>;+type Story = StoryObj<CarouselStoryProps>;-export const Default: Story = {- render: () => (- <Carousel style={{ width: "100%", maxWidth: "20rem" }}>- <CarouselContent>- {Array.from({ length: 10 }).map((_, index) => (- <CarouselItem key={index}>- <Header- title="Title"- subtitle="Subtitle"- actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}- />- <Image src="https://picsum.photos/200/300" alt="Image" scale="fill" />- </CarouselItem>- ))}- </CarouselContent>+const CarouselDemo = ({ itemsToScroll, noSnap, showButtons }: CarouselStoryProps) => {+ const items = [+ {+ title: "Nature",+ subtitle: "Beautiful landscapes",+ imageWidth: 400,+ imageHeight: 300,+ },+ {+ title: "Architecture",+ subtitle: "Modern buildings",+ imageWidth: 500,+ imageHeight: 400,+ },+ {+ title: "Technology",+ subtitle: "Digital innovation",+ imageWidth: 600,+ imageHeight: 500,+ },+ {+ title: "Art",+ subtitle: "Creative expressions",+ imageWidth: 700,+ imageHeight: 600,+ },+ {+ title: "Travel",+ subtitle: "World exploration",+ imageWidth: 800,+ imageHeight: 700,+ },+ ];++ const repeatedItems = Array.from({ length: 20 }, (_, index) => ({+ ...items[index % items.length],+ id: `item-${index + 1}`,+ }));++ const carouselItems = repeatedItems.map((item) => (+ <CarouselItem key={item.id}>+ <Header+ title={item.title}+ subtitle={item.subtitle}+ actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}+ />+ <Image+ src={`https://picsum.photos/${item.imageWidth}/${item.imageHeight}`}+ alt={`${item.title} image`}+ scale="fill"+ />+ </CarouselItem>+ ));++ return (+ <Carousel itemsToScroll={itemsToScroll} noSnap={noSnap} showButtons={showButtons}>+ <CarouselContent>{carouselItems}</CarouselContent><CarouselPrevious icon={<ChevronLeft />} /><CarouselNext icon={<ChevronRight />} /></Carousel>- ),+ );};-export const MultipleItems: Story = {- render: () => (- <Carousel style={{ width: "100%", maxWidth: "28rem" }} itemsToScroll={2}>- <CarouselContent>- {Array.from({ length: 10 }).map((_, index) => (- <CarouselItem key={index}>- <Header- title="Title"- subtitle="Subtitle"- actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}- />- <Image src="https://picsum.photos/200/300" alt="Image" scale="fill" />- </CarouselItem>- ))}- </CarouselContent>- <CarouselPrevious icon={<ChevronLeft />} />- <CarouselNext icon={<ChevronRight />} />- </Carousel>- ),+export const Default: Story = {+ args: {+ itemsToScroll: 1,+ noSnap: false,+ showButtons: true,+ },+ parameters: {+ docs: {+ description: {+ story: "Default carousel configuration with single item scrolling and navigation buttons.",+ },+ },+ },+ render: (args) => <CarouselDemo {...args} />,};-export const WithWrappingDiv: Story = {- render: () => (- <Carousel style={{ width: "100%", maxWidth: "28rem" }} hasWrappingDivForCards>- <CarouselContent>- <div style={{ display: "flex" }}>- {Array.from({ length: 20 }).map((_, index) => (- <CarouselItem key={index}>- <Header- title="Title"- subtitle="Subtitle"- actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}- />- <Image src="https://picsum.photos/200/300" alt="Image" scale="fill" />- </CarouselItem>- ))}- </div>- </CarouselContent>- <CarouselPrevious icon={<ChevronLeft />} />- <CarouselNext icon={<ChevronRight />} />- </Carousel>- ),+export const MultipleItems: Story = {+ args: {+ itemsToScroll: 2,+ noSnap: false,+ showButtons: true,+ },+ parameters: {+ docs: {+ description: {+ story:+ "Carousel configured to scroll multiple items at once when clicking navigation buttons.",+ },+ },+ },+ render: (args) => <CarouselDemo {...args} />,};-export const WithNoButtons: Story = {- render: () => (- <Carousel style={{ width: "100%", maxWidth: "28rem" }} showButtons={false}>- <CarouselContent style={{ gap: "1rem" }}>- {Array.from({ length: 10 }).map((_, index) => (- <CarouselItem key={index}>- <Header- title="Title"- subtitle="Subtitle"- actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}- />- <Image src="https://picsum.photos/200/300" alt="Image" scale="fill" />- </CarouselItem>- ))}- </CarouselContent>- <CarouselPrevious icon={<ChevronLeft />} />- <CarouselNext icon={<ChevronRight />} />- </Carousel>- ),+export const WithNoSnap: Story = {+ args: {+ itemsToScroll: 1,+ noSnap: true,+ showButtons: true,+ },+ parameters: {+ docs: {+ description: {+ story: "Carousel with no snap scrolling, useful for custom layout requirements.",+ },+ },+ },+ render: (args) => <CarouselDemo {...args} />,};-export const CustomStyling: Story = {- render: () => (- <Carousel style={{ width: "100%", maxWidth: "28rem" }}>- <CarouselContent style={{ gap: "1rem" }}>- {Array.from({ length: 10 }).map((_, index) => (- <CarouselItem key={index}>- <Header- title="Title"- subtitle="Subtitle"- actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}- />- <Image src="https://picsum.photos/200/300" alt="Image" scale="fill" />- </CarouselItem>- ))}- </CarouselContent>- <CarouselPrevious icon={<ChevronLeft />} />- <CarouselNext icon={<ChevronRight />} />- </Carousel>- ),+export const WithNoButtons: Story = {+ args: {+ itemsToScroll: 1,+ noSnap: true,+ showButtons: false,+ },+ parameters: {+ docs: {+ description: {+ story: "Carousel without navigation buttons, relying on native scroll behavior.",+ },+ },+ },+ render: (args) => <CarouselDemo {...args} />,};diff --git a/frontend-sdk/packages/react-ui/src/components/Charts/AreaChart/AreaChart.tsx b/frontend-sdk/packages/react-ui/src/components/Charts/AreaChart/AreaChart.tsxindex e01d80f36..acd29ad9f 100644--- a/frontend-sdk/packages/react-ui/src/components/Charts/AreaChart/AreaChart.tsx+++ b/frontend-sdk/packages/react-ui/src/components/Charts/AreaChart/AreaChart.tsx@@ -13,7 +13,7 @@ import { getDistributedColors, getPalette } from "../utils/PalletUtils";type AreaChartData = Array<Record<string, string | number>>;-interface AreaChartProps<T extends AreaChartData> {+export interface AreaChartProps<T extends AreaChartData> {data: T;categoryKey: keyof T[number];theme?: "ocean" | "orchid" | "emerald" | "sunset" | "spectrum" | "vivid";diff --git a/frontend-sdk/packages/react-ui/src/components/Charts/AreaChart/stories/areaChart.stories.tsx b/frontend-sdk/packages/react-ui/src/components/Charts/AreaChart/stories/areaChart.stories.tsxnew file mode 100644index 000000000..970484326--- /dev/null+++ b/frontend-sdk/packages/react-ui/src/components/Charts/AreaChart/stories/areaChart.stories.tsx@@ -0,0 +1,230 @@+import type { Meta, StoryObj } from "@storybook/react";+import { Monitor, TabletSmartphone } from "lucide-react";+import { Card } from "../../../Card";+import "../../../Card/card.scss";+import "../../charts.scss";+import { AreaChart, AreaChartProps } from "../AreaChart";++const areaChartData = [+ { month: "January", desktop: 150, mobile: 90 },+ { month: "February", desktop: 280, mobile: 180 },+ { month: "March", desktop: 220, mobile: 140 },+ { month: "April", desktop: 180, mobile: 160 },+ { month: "May", desktop: 250, mobile: 120 },+ { month: "June", desktop: 300, mobile: 180 },+];++const icons = {+ desktop: Monitor,+ mobile: TabletSmartphone,+} as const;++const meta: Meta<AreaChartProps<typeof areaChartData>> = {+ title: "Components/Charts/AreaChart",+ component: AreaChart,+ parameters: {+ layout: "centered",+ },+ tags: ["autodocs"],+ argTypes: {+ data: {+ description:+ "An array of data objects where each object represents a data point. Each object should have a category field (e.g., month) and one or more numeric values for the areas to be plotted.",+ control: false,+ table: {+ type: { summary: "Array<Record<string, string | number>>" },+ defaultValue: { summary: "[]" },+ },+ },+ categoryKey: {+ description:+ "The key from your data object to be used as the x-axis categories (e.g., 'month', 'year', 'date')",+ control: false,+ table: {+ type: { summary: "string" },+ },+ },+ width: {+ description: "The width of the chart area in pixels. This excludes margins and padding.",+ control: false,+ table: {+ type: { summary: "number" },+ defaultValue: { summary: "800" },+ },+ },+ height: {+ description: "The height of the chart area in pixels. This excludes margins and padding.",+ control: false,+ table: {+ type: { summary: "number" },+ defaultValue: { summary: "400" },+ },+ },+ theme: {+ description:+ "The color palette theme for the chart. Each theme provides a different set of colors for the areas.",+ control: "select",+ options: ["ocean", "orchid", "emerald", "sunset", "spectrum", "vivid"],+ table: {+ defaultValue: { summary: "ocean" },+ },+ },+ icons: {+ description:+ "An object that maps data keys to icon components. These icons will appear in the legend next to their corresponding data series.",+ control: false,+ table: {+ type: { summary: "Record<string, React.ComponentType>" },+ defaultValue: { summary: "{}" },+ },+ },+ variant: {+ description:+ "The interpolation method used to create the area curves. 'linear' creates straight lines between points, 'natural' creates smooth curves, and 'step' creates a stepped area.",+ control: "radio",+ options: ["linear", "natural", "step"],+ table: {+ defaultValue: { summary: "natural" },+ },+ },+ opacity: {+ description:+ "The opacity of the filled area beneath each line (0 = fully transparent, 1 = fully opaque)",+ control: false,+ table: {+ type: { summary: "number" },+ defaultValue: { summary: "0.5" },+ },+ },+ grid: {+ description: "Whether to display the background grid lines in the chart",+ control: "boolean",+ table: {+ type: { summary: "boolean" },+ defaultValue: { summary: "true" },+ },+ },+ label: {+ description: "Whether to display data point labels above each point on the chart",+ control: "boolean",+ table: {+ type: { summary: "boolean" },+ defaultValue: { summary: "true" },+ },+ },+ legend: {+ description:+ "Whether to display the chart legend showing the data series names and their corresponding colors/icons",+ control: "boolean",+ table: {+ type: { summary: "boolean" },+ defaultValue: { summary: "true" },+ },+ },+ },+} satisfies Meta<typeof AreaChart>;++export default meta;+type Story = StoryObj<typeof meta>;++export const AreaChartStory: Story = {+ name: "Area Chart",+ args: {+ data: areaChartData,+ categoryKey: "month",+ theme: "ocean",+ variant: "linear",+ width: 460,+ height: 300,+ opacity: 0.5,+ grid: true,+ legend: true,+ label: true,+ },+ render: (args) => (+ <Card style={{ width: "500px" }}>+ <AreaChart {...args} />+ </Card>+ ),+ parameters: {+ docs: {+ source: {+ code: `+const areaChartData = [+ { month: "January", desktop: 150, mobile: 90 },+ { month: "February", desktop: 280, mobile: 180 },+ { month: "March", desktop: 220, mobile: 140 },+ { month: "April", desktop: 180, mobile: 160 },+ { month: "May", desktop: 250, mobile: 120 },+ { month: "June", desktop: 300, mobile: 180 },+];++<Card style={{ width: "500px" }}>+ <AreaChart+ data={areaChartData}+ categoryKey="month"+ width={460}+ height={300}+ theme="ocean"+ variant="linear"+ opacity={0.5}+ grid={true}+ legend={true}+ label={true}+ />+</Card>`,+ },+ },+ },+};++export const AreaChartStoryWithIcons: Story = {+ name: "Area Chart with Icons",+ args: {+ ...AreaChartStory.args,+ icons: icons,+ },+ render: (args) => (+ <Card style={{ width: "500px" }}>+ <AreaChart {...args} />+ </Card>+ ),+ parameters: {+ docs: {+ source: {+ code: `+ import { Monitor, TabletSmartphone } from "lucide-react";++ const areaChartData = [+ { month: "January", desktop: 150, mobile: 90 },+ { month: "February", desktop: 280, mobile: 180 },+ { month: "March", desktop: 220, mobile: 140 },+ { month: "April", desktop: 180, mobile: 160 },+ { month: "May", desktop: 250, mobile: 120 },+ { month: "June", desktop: 300, mobile: 180 },+ ];++ const icons = {+ desktop: Monitor,+ mobile: TabletSmartphone,+ };++ <Card style={{ width: "500px" }}>+ <AreaChart+ data={areaChartData}+ categoryKey="month"+ width={460}+ height={300}+ theme="ocean"+ variant="linear"+ opacity={0.5}+ grid={true}+ legend={true}+ label={true}+ icons={icons}+ />+ </Card>`,+ },+ },+ },+};diff --git a/frontend-sdk/packages/react-ui/src/components/Charts/BarChart/BarChart.tsx b/frontend-sdk/packages/react-ui/src/components/Charts/BarChart/BarChart.tsxindex b4b4a0684..06560761a 100644--- a/frontend-sdk/packages/react-ui/src/components/Charts/BarChart/BarChart.tsx+++ b/frontend-sdk/packages/react-ui/src/components/Charts/BarChart/BarChart.tsx@@ -13,7 +13,7 @@ import { getDistributedColors, getPalette } from "../utils/PalletUtils";type BarChartData = Array<Record<string, string | number>>;-interface BarChartProps<T extends BarChartData> {+export interface BarChartProps<T extends BarChartData> {data: T;categoryKey: keyof T[number];theme?: "ocean" | "orchid" | "emerald" | "sunset" | "spectrum" | "vivid";diff --git a/frontend-sdk/packages/react-ui/src/components/Charts/BarChart/stories/barChart.stories.tsx b/frontend-sdk/packages/react-ui/src/components/Charts/BarChart/stories/barChart.stories.tsxnew file mode 100644index 000000000..f671908b1--- /dev/null+++ b/frontend-sdk/packages/react-ui/src/components/Charts/BarChart/stories/barChart.stories.tsx@@ -0,0 +1,239 @@+import type { Meta, StoryObj } from "@storybook/react";+import { Monitor, TabletSmartphone } from "lucide-react";+import { Card } from "../../../Card";+import "../../../Card/card.scss";+import "../../charts.scss";+import { BarChart, BarChartProps } from "../BarChart";++const barChartData = [+ { month: "January", desktop: 150, mobile: 90 },+ { month: "February", desktop: 280, mobile: 180 },+ { month: "March", desktop: 220, mobile: 140 },+ { month: "April", desktop: 180, mobile: 160 },+ { month: "May", desktop: 250, mobile: 120 },+ { month: "June", desktop: 300, mobile: 180 },+];++const icons = {+ desktop: Monitor,+ mobile: TabletSmartphone,+} as const;++const meta: Meta<BarChartProps<typeof barChartData>> = {+ title: "Components/Charts/BarChart",+ component: BarChart,+ parameters: {+ layout: "centered",+ },+ tags: ["autodocs"],+ argTypes: {+ data: {+ description:+ "An array of data objects where each object represents a data point. Each object should have a category field (e.g., month) and one or more numeric values for the areas to be plotted.",+ control: false,+ table: {+ type: { summary: "Array<Record<string, string | number>>" },+ defaultValue: { summary: "[]" },+ },+ },+ categoryKey: {+ description:+ "The key from your data object to be used as the x-axis categories (e.g., 'month', 'year', 'date')",+ control: false,+ table: {+ type: { summary: "string" },+ },+ },+ width: {+ description: "The width of the chart area in pixels. This excludes margins and padding.",+ control: false,+ table: {+ type: { summary: "number" },+ defaultValue: { summary: "800" },+ },+ },+ height: {+ description: "The height of the chart area in pixels. This excludes margins and padding.",+ control: false,+ table: {+ type: { summary: "number" },+ defaultValue: { summary: "400" },+ },+ },+ theme: {+ description:+ "The color palette theme for the chart. Each theme provides a different set of colors for the areas.",+ control: "select",+ options: ["ocean", "orchid", "emerald", "sunset", "spectrum", "vivid"],+ table: {+ defaultValue: { summary: "ocean" },+ },+ },+ icons: {+ description:+ "An object that maps data keys to icon components. These icons will appear in the legend next to their corresponding data series.",+ control: false,+ table: {+ type: { summary: "Record<string, React.ComponentType>" },+ defaultValue: { summary: "{}" },+ },+ },+ variant: {+ description:+ "The style of the bar chart. 'grouped' shows bars side by side, while 'stacked' shows bars stacked on top of each other.",+ control: "radio",+ options: ["grouped", "stacked"],+ table: {+ defaultValue: { summary: "grouped" },+ },+ },+ radius: {+ description: "The radius of the rounded corners of the bars",+ control: false,+ table: {+ type: { summary: "number" },+ defaultValue: { summary: "4" },+ },+ },+ grid: {+ description: "Whether to display the background grid lines in the chart",+ control: "boolean",+ table: {+ type: { summary: "boolean" },+ defaultValue: { summary: "true" },+ },+ },+ label: {+ description: "Whether to display data point labels above each point on the chart",+ control: "boolean",+ table: {+ type: { summary: "boolean" },+ defaultValue: { summary: "true" },+ },+ },+ legend: {+ description:+ "Whether to display the chart legend showing the data series names and their corresponding colors/icons",+ control: "boolean",+ table: {+ type: { summary: "boolean" },+ defaultValue: { summary: "true" },+ },+ },+ },+} satisfies Meta<typeof BarChart>;++export default meta;+type Story = StoryObj<typeof meta>;++export const BarChartStory: Story = {+ name: "Bar Chart",+ args: {+ data: barChartData,+ categoryKey: "month",+ theme: "ocean",+ variant: "grouped",+ width: 460,+ height: 300,+ radius: 4,+ grid: true,+ label: true,+ legend: true,+ },+ render: (args) => (+ <Card style={{ width: "500px" }}>+ <BarChart {...args} />+ </Card>+ ),+ parameters: {+ docs: {+ source: {+ code: `+const barChartData = [+ { month: "January", desktop: 150, mobile: 90 },+ { month: "February", desktop: 280, mobile: 180 },+ { month: "March", desktop: 220, mobile: 140 },+ { month: "April", desktop: 180, mobile: 160 },+ { month: "May", desktop: 250, mobile: 120 },+ { month: "June", desktop: 300, mobile: 180 },+];++<Card+ style={{+ width: '500px'+ }}+>+ <BarChart+ categoryKey="month"+ data={barChartData}+ grid+ height={300}+ label+ legend+ radius={4}+ theme="sunset"+ variant="grouped"+ width={460}+ />+</Card>+`,+ },+ },+ },+};++export const BarChartStoryWithIcons: Story = {+ name: "Bar Chart with Icons",+ args: {+ ...BarChartStory.args,+ icons: icons,+ },+ render: (args) => (+ <Card style={{ width: "500px" }}>+ <BarChart {...args} />+ </Card>+ ),+ parameters: {+ docs: {+ source: {+ code: `+ import { Monitor, TabletSmartphone } from "lucide-react";++ const barChartData = [+ { month: "January", desktop: 150, mobile: 90 },+ { month: "February", desktop: 280, mobile: 180 },+ { month: "March", desktop: 220, mobile: 140 },+ { month: "April", desktop: 180, mobile: 160 },+ { month: "May", desktop: 250, mobile: 120 },+ { month: "June", desktop: 300, mobile: 180 },+ ];++ const icons = {+ desktop: Monitor,+ mobile: TabletSmartphone,+ };++ <Card+ style={{+ width: '500px'+ }}+ >+ <BarChart+ categoryKey="month"+ data={barChartData}+ grid+ height={300}+ label+ legend+ radius={4}+ theme="sunset"+ variant="grouped"+ width={460}+ icons={icons}+ />+ </Card>+ `,+ },+ },+ },+};diff --git a/frontend-sdk/packages/react-ui/src/components/Charts/LineChart/LineChart.tsx b/frontend-sdk/packages/react-ui/src/components/Charts/LineChart/LineChart.tsxindex 124ca4ff3..cc4bcf8f0 100644--- a/frontend-sdk/packages/react-ui/src/components/Charts/LineChart/LineChart.tsx+++ b/frontend-sdk/packages/react-ui/src/components/Charts/LineChart/LineChart.tsx@@ -13,7 +13,7 @@ import { getDistributedColors, getPalette } from "../utils/PalletUtils";type LineChartData = Array<Record<string, string | number>>;-interface LineChartProps<T extends LineChartData> {+export interface LineChartProps<T extends LineChartData> {data: T;categoryKey: keyof T[number];theme?: "ocean" | "orchid" | "emerald" | "sunset" | "spectrum" | "vivid";@@ -89,7 +89,7 @@ export const LineChart = <T extends LineChartData>({textAnchor="middle"tickFormatter={(value) => value.slice(0, 4)}/>- <ChartTooltip content={<ChartTooltipContent indicator="line" />} />+ <ChartTooltip content={<ChartTooltipContent indicator="dot" />} />{dataKeys.map((key) => {const color = `var(--color-${key})`;if (label) {diff --git a/frontend-sdk/packages/react-ui/src/components/Charts/LineChart/stories/lineChart.stories.tsx b/frontend-sdk/packages/react-ui/src/components/Charts/LineChart/stories/lineChart.stories.tsxnew file mode 100644index 000000000..9374c5488--- /dev/null+++ b/frontend-sdk/packages/react-ui/src/components/Charts/LineChart/stories/lineChart.stories.tsx@@ -0,0 +1,238 @@+import type { Meta, StoryObj } from "@storybook/react";+import { Monitor, TabletSmartphone } from "lucide-react";+import { Card } from "../../../Card";+import "../../../Card/card.scss";+import "../../charts.scss";+import { LineChart, LineChartProps } from "../LineChart";++const lineChartData = [+ { month: "January", desktop: 150, mobile: 90 },+ { month: "February", desktop: 280, mobile: 180 },+ { month: "March", desktop: 220, mobile: 140 },+ { month: "April", desktop: 180, mobile: 160 },+ { month: "May", desktop: 250, mobile: 120 },+ { month: "June", desktop: 300, mobile: 180 },+];++const icons = {+ desktop: Monitor,+ mobile: TabletSmartphone,+} as const;++const meta: Meta<LineChartProps<typeof lineChartData>> = {+ title: "Components/Charts/LineChart",+ component: LineChart,+ parameters: {+ layout: "centered",+ },+ tags: ["autodocs"],+ argTypes: {+ data: {+ description:+ "An array of data objects where each object represents a data point. Each object should have a category field (e.g., month) and one or more numeric values for the areas to be plotted.",+ control: false,+ table: {+ type: { summary: "Array<Record<string, string | number>>" },+ defaultValue: { summary: "[]" },+ },+ },+ categoryKey: {+ description:+ "The key from your data object to be used as the x-axis categories (e.g., 'month', 'year', 'date')",+ control: false,+ table: {+ type: { summary: "string" },+ },+ },+ width: {+ description: "The width of the chart area in pixels. This excludes margins and padding.",+ control: false,+ table: {+ type: { summary: "number" },+ defaultValue: { summary: "800" },+ },+ },+ height: {+ description: "The height of the chart area in pixels. This excludes margins and padding.",+ control: false,+ table: {+ type: { summary: "number" },+ defaultValue: { summary: "400" },+ },+ },+ theme: {+ description:+ "The color palette theme for the chart. Each theme provides a different set of colors for the areas.",+ control: "select",+ options: ["ocean", "orchid", "emerald", "sunset", "spectrum", "vivid"],+ table: {+ defaultValue: { summary: "ocean" },+ },+ },+ icons: {+ description:+ "An object that maps data keys to icon components. These icons will appear in the legend next to their corresponding data series.",+ control: false,+ table: {+ type: { summary: "Record<string, React.ComponentType>" },+ defaultValue: { summary: "{}" },+ },+ },+ variant: {+ description:+ "The interpolation method used to create the line curves. 'linear' creates straight lines between points, 'natural' creates smooth curves, and 'step' creates a stepped line.",+ control: "radio",+ options: ["linear", "natural", "step"],+ table: {+ defaultValue: { summary: "natural" },+ },+ },+ strokeWidth: {+ description: "The width of the line stroke",+ control: false,+ table: {+ type: { summary: "number" },+ defaultValue: { summary: "2" },+ },+ },+ grid: {+ description: "Whether to display the background grid lines in the chart",+ control: "boolean",+ table: {+ type: { summary: "boolean" },+ defaultValue: { summary: "true" },+ },+ },+ label: {+ description: "Whether to display data point labels above each point on the chart",+ control: "boolean",+ table: {+ type: { summary: "boolean" },+ defaultValue: { summary: "true" },+ },+ },+ legend: {+ description:+ "Whether to display the chart legend showing the data series names and their corresponding colors/icons",+ control: "boolean",+ table: {+ type: { summary: "boolean" },+ defaultValue: { summary: "true" },+ },+ },+ },+} satisfies Meta<typeof LineChart>;++export default meta;+type Story = StoryObj<typeof meta>;++export const LineChartStory: Story = {+ name: "Line Chart",+ args: {+ data: lineChartData,+ categoryKey: "month",+ theme: "ocean",+ variant: "natural",+ width: 460,+ height: 300,+ strokeWidth: 2,+ grid: true,+ label: true,+ legend: true,+ },+ render: (args) => (+ <Card style={{ width: "500px" }}>+ <LineChart {...args} />+ </Card>+ ),+ parameters: {+ docs: {+ source: {+ code: `+const lineChartData = [+ { month: "January", desktop: 150, mobile: 90 },+ { month: "February", desktop: 280, mobile: 180 },+ { month: "March", desktop: 220, mobile: 140 },+ { month: "April", desktop: 180, mobile: 160 },+ { month: "May", desktop: 250, mobile: 120 },+ { month: "June", desktop: 300, mobile: 180 },+];+<Card+ style={{+ width: '500px'+ }}+>+ <LineChart+ categoryKey="month"+ data={lineChartData}+ grid+ height={300}+ label+ legend+ strokeWidth={2}+ theme="ocean"+ variant="natural"+ width={460}+ />+</Card>+`,+ },+ },+ },+};++export const LineChartStoryWithIcons: Story = {+ name: "Line Chart with Icons",+ args: {+ ...LineChartStory.args,+ icons: icons,+ },+ render: (args) => (+ <Card style={{ width: "500px" }}>+ <LineChart {...args} />+ </Card>+ ),+ parameters: {+ docs: {+ source: {+ code: `+ import { Monitor, TabletSmartphone } from "lucide-react";++ const lineChartData = [+ { month: "January", desktop: 150, mobile: 90 },+ { month: "February", desktop: 280, mobile: 180 },+ { month: "March", desktop: 220, mobile: 140 },+ { month: "April", desktop: 180, mobile: 160 },+ { month: "May", desktop: 250, mobile: 120 },+ { month: "June", desktop: 300, mobile: 180 },+];++const icons = {+ desktop: Monitor,+ mobile: TabletSmartphone,+};++<Card+ style={{+ width: '500px'+ }}+>+ <LineChart+ categoryKey="month"+ data={lineChartData}+ grid+ height={300}+ label+ legend+ strokeWidth={2}+ theme="ocean"+ variant="natural"+ width={460}+ icons={icons}+ />+</Card>+ `,+ },+ },+ },+};diff --git a/frontend-sdk/packages/react-ui/src/components/Charts/PieChart/PieChart.tsx b/frontend-sdk/packages/react-ui/src/components/Charts/PieChart/PieChart.tsxindex 34743bcdf..2845f2e89 100644--- a/frontend-sdk/packages/react-ui/src/components/Charts/PieChart/PieChart.tsx+++ b/frontend-sdk/packages/react-ui/src/components/Charts/PieChart/PieChart.tsx@@ -15,7 +15,7 @@ import { getDistributedColors, getPalette } from "../utils/PalletUtils";type PieChartData = Array<Record<string, string | number>>;-interface PieChartProps<T extends PieChartData> {+export interface PieChartProps<T extends PieChartData> {data: T;categoryKey: keyof T[number];dataKey: keyof T[number];@@ -24,12 +24,17 @@ interface PieChartProps<T extends PieChartData> {format?: "percentage" | "number";legend?: boolean;label?: boolean;- outerRadius?: number;- innerRadius?: number;width?: number;height?: number;}+const layoutMap: Record<string, string> = {+ mobile: "crayon-pie-chart-container-mobile",+ fullscreen: "crayon-pie-chart-container-fullscreen",+ tray: "crayon-pie-chart-container-tray",+ copilot: "crayon-pie-chart-container-copilot",+};+// Helper function to calculate percentageconst calculatePercentage = (value: number, total: number): number => {if (total === 0) {@@ -47,8 +52,6 @@ export const PieChart = <T extends PieChartData>({format = "number",legend = true,label = true,- outerRadius,- innerRadius,width = 800,height = 400,}: PieChartProps<T>) => {@@ -85,14 +88,14 @@ export const PieChart = <T extends PieChartData>({}}- setCalculatedOuterRadius(outerRadius ?? newOuterRadius);- setCalculatedInnerRadius(innerRadius ?? newInnerRadius);+ setCalculatedOuterRadius(newOuterRadius);+ setCalculatedInnerRadius(newInnerRadius);}, 100),);resizeObserver.observe(containerRef.current);return () => resizeObserver.disconnect();- }, [layout, label, variant, outerRadius, innerRadius]);+ }, [layout, label, variant]);// Calculate total for percentage calculationsconst total = data.reduce((sum, item) => sum + Number(item[dataKey]), 0);@@ -149,7 +152,7 @@ export const PieChart = <T extends PieChartData>({<ChartContainerref={containerRef}config={chartConfig}- className={clsx("crayon-pie-chart-container", `crayon-pie-chart-container-${layout}`)}+ className={clsx("crayon-pie-chart-container", layoutMap[layout])}><RechartsPieChart width={width} height={height}><ChartTooltip content={<ChartTooltipContent showPercentage={format === "percentage"} />} />diff --git a/frontend-sdk/packages/react-ui/src/components/Charts/PieChart/pieChart.scss b/frontend-sdk/packages/react-ui/src/components/Charts/PieChart/pieChart.scssdeleted file mode 100644index 10b7560c0..000000000--- a/frontend-sdk/packages/react-ui/src/components/Charts/PieChart/pieChart.scss+++ /dev/null@@ -1,29 +0,0 @@-@use "sass:map";-@use "../../../cssUtils.scss" as cssUtils;--.crayon-pie-chart {- &-container {- margin-left: auto;- margin-right: auto;-- &-fullscreen {- min-height: 400px;- width: 100%;- }-- &-mobile {- min-height: 300px;- width: 100%;- }-- &-tray {- min-height: 350px;- width: 100%;- }-- &-copilot {- min-height: 350px;- width: 100%;- }- }-}diff --git a/frontend-sdk/packages/react-ui/src/components/Charts/PieChart/stories/pieChart.stories.tsx b/frontend-sdk/packages/react-ui/src/components/Charts/PieChart/stories/pieChart.stories.tsxnew file mode 100644index 000000000..3d1cfd24a--- /dev/null+++ b/frontend-sdk/packages/react-ui/src/components/Charts/PieChart/stories/pieChart.stories.tsx@@ -0,0 +1,170 @@+import type { Meta, StoryObj } from "@storybook/react";+import { Card } from "../../../Card";+import "../../../Card/card.scss";+import "../../charts.scss";+import { PieChart, PieChartProps } from "../PieChart";++const pieChartData = [+ { month: "January", value: 400 },+ { month: "February", value: 300 },+ { month: "March", value: 300 },+ { month: "April", value: 400 },+ { month: "May", value: 300 },+ { month: "June", value: 300 },+ { month: "July", value: 300 },+];++const meta: Meta<PieChartProps<typeof pieChartData>> = {+ title: "Components/Charts/PieChart",+ component: PieChart,+ parameters: {+ layout: "centered",+ },+ tags: ["autodocs"],+ argTypes: {+ data: {+ description:+ "An array of data objects where each object represents a data point. Each object should have a category field (e.g., month) and one or more numeric values for the areas to be plotted.",+ control: false,+ table: {+ type: { summary: "Array<Record<string, string | number>>" },+ defaultValue: { summary: "[]" },+ },+ },+ categoryKey: {+ description:+ "The key from your data object to be used as the segment labels (e.g., 'month', 'category', 'name')",+ control: false,+ table: {+ type: { summary: "string" },+ },+ },+ dataKey: {+ description:+ "The key from your data object to be used as the values that determine the slice sizes (e.g., 'value', 'count', 'amount')",+ control: false,+ table: {+ type: { summary: "string" },+ },+ },+ width: {+ description: "The width of the chart area in pixels. This excludes margins and padding.",+ control: false,+ table: {+ type: { summary: "number" },+ defaultValue: { summary: "800" },+ },+ },+ height: {+ description: "The height of the chart area in pixels. This excludes margins and padding.",+ control: false,+ table: {+ type: { summary: "number" },+ defaultValue: { summary: "400" },+ },+ },+ theme: {+ description:+ "The color palette theme for the chart. Each theme provides a different set of colors for the areas.",+ control: "select",+ options: ["ocean", "orchid", "emerald", "sunset", "spectrum", "vivid"],+ table: {+ defaultValue: { summary: "ocean" },+ },+ },+ variant: {+ description:+ "The style of the pie chart. 'pie' shows a pie chart, while 'donut' shows a donut chart.",+ control: "radio",+ options: ["pie", "donut"],+ table: {+ defaultValue: { summary: "pie" },+ },+ },+ format: {+ description:+ "The format of the data. 'percentage' shows the data as a percentage, while 'number' shows the data as a number.",+ control: "radio",+ options: ["percentage", "number"],+ table: {+ defaultValue: { summary: "percentage" },+ },+ },+ legend: {+ description: "Whether to display the legend",+ control: "boolean",+ table: {+ type: { summary: "boolean" },+ defaultValue: { summary: "true" },+ },+ },+ label: {+ description: "Whether to display the data point labels above each point on the chart",+ control: "boolean",+ table: {+ type: { summary: "boolean" },+ defaultValue: { summary: "true" },+ },+ },+ },+} satisfies Meta<typeof PieChart>;++export default meta;+type Story = StoryObj<typeof meta>;++export const PieChartStory: Story = {+ name: "Pie Chart",+ args: {+ data: pieChartData,+ categoryKey: "month",+ dataKey: "value",+ theme: "ocean",+ variant: "pie",+ format: "number",+ legend: true,+ label: true,+ width: 460,+ height: 300,+ },+ render: (args) => (+ <Card style={{ width: "500px" }}>+ <PieChart {...args} />+ </Card>+ ),+ parameters: {+ docs: {+ source: {+ code: `+ const pieChartData = [+ { month: "January", value: 400 },+ { month: "February", value: 300 },+ { month: "March", value: 300 },+ { month: "April", value: 400 },+ { month: "May", value: 300 },+ { month: "June", value: 300 },+ { month: "July", value: 300 },+];++<Card+ style={{+ width: '500px'+ }}+>+ <PieChart+ categoryKey="month"+ data={pieChartData}+ dataKey="value"+ format="percentage"+ height={300}+ label+ legend+ theme="ocean"+ variant="donut"+ width={460}+ />+</Card>+ `,+ },+ },+ },+};diff --git a/frontend-sdk/packages/react-ui/src/components/Charts/RadarChart/RadarChart.tsx b/frontend-sdk/packages/react-ui/src/components/Charts/RadarChart/RadarChart.tsxindex 949955db4..c023abebf 100644--- a/frontend-sdk/packages/react-ui/src/components/Charts/RadarChart/RadarChart.tsx+++ b/frontend-sdk/packages/react-ui/src/components/Charts/RadarChart/RadarChart.tsx@@ -12,7 +12,7 @@ import { getDistributedColors, getPalette } from "../utils/PalletUtils";type RadarChartData = Array<Record<string, string | number>>;-interface RadarChartProps<T extends RadarChartData> {+export interface RadarChartProps<T extends RadarChartData> {data: T;categoryKey: keyof T[number];theme?: "ocean" | "orchid" | "emerald" | "sunset" | "spectrum" | "vivid";diff --git a/frontend-sdk/packages/react-ui/src/components/Charts/RadarChart/stories/raderChart.stories.tsx b/frontend-sdk/packages/react-ui/src/components/Charts/RadarChart/stories/raderChart.stories.tsxnew file mode 100644index 000000000..864577b34--- /dev/null+++ b/frontend-sdk/packages/react-ui/src/components/Charts/RadarChart/stories/raderChart.stories.tsx@@ -0,0 +1,239 @@+import type { Meta, StoryObj } from "@storybook/react";+import { Monitor, TabletSmartphone } from "lucide-react";+import { Card } from "../../../Card";+import "../../../Card/card.scss";+import "../../charts.scss";+import { RadarChart, RadarChartProps } from "../RadarChart";++const radarChartData = [+ { month: "January", desktop: 250, mobile: 150 },+ { month: "February", desktop: 280, mobile: 180 },+ { month: "March", desktop: 220, mobile: 140 },+ { month: "April", desktop: 180, mobile: 160 },+ { month: "May", desktop: 250, mobile: 120 },+ { month: "June", desktop: 300, mobile: 180 },+];++const icons = {+ desktop: Monitor,+ mobile: TabletSmartphone,+} as const;++const meta: Meta<RadarChartProps<typeof radarChartData>> = {+ title: "Components/Charts/RadarChart",+ component: RadarChart,+ parameters: {+ layout: "centered",+ },+ tags: ["autodocs"],+ argTypes: {+ data: {+ description:+ "An array of data objects where each object represents a data point. Each object should have a category field (e.g., month) and one or more numeric values for the areas to be plotted.",+ control: false,+ table: {+ type: { summary: "Array<Record<string, string | number>>" },+ defaultValue: { summary: "[]" },+ },+ },+ categoryKey: {+ description:+ "The key from your data object to be used as the x-axis categories (e.g., 'month', 'year', 'date')",+ control: false,+ table: {+ type: { summary: "string" },+ },+ },+ width: {+ description: "The width of the chart area in pixels. This excludes margins and padding.",+ control: false,+ table: {+ type: { summary: "number" },+ defaultValue: { summary: "800" },+ },+ },+ height: {+ description: "The height of the chart area in pixels. This excludes margins and padding.",+ control: false,+ table: {+ type: { summary: "number" },+ defaultValue: { summary: "400" },+ },+ },+ theme: {+ description:+ "The color palette theme for the chart. Each theme provides a different set of colors for the areas.",+ control: "select",+ options: ["ocean", "orchid", "emerald", "sunset", "spectrum", "vivid"],+ table: {+ defaultValue: { summary: "ocean" },+ },+ },+ icons: {+ description:+ "An object that maps data keys to icon components. These icons will appear in the legend next to their corresponding data series.",+ control: false,+ table: {+ type: { summary: "Record<string, React.ComponentType>" },+ defaultValue: { summary: "{}" },+ },+ },+ variant: {+ description:+ "The style of the radar chart. 'line' shows only the connecting lines between data points, while 'area' fills the shape created by the data points.",+ control: "radio",+ options: ["line", "area"],+ table: {+ defaultValue: { summary: "area" },+ },+ },+ strokeWidth: {+ description: "The width of the line stroke",+ control: false,+ table: {+ type: { summary: "number" },+ defaultValue: { summary: "2" },+ },+ },+ grid: {+ description: "Whether to display the background grid lines in the chart",+ control: "boolean",+ table: {+ type: { summary: "boolean" },+ defaultValue: { summary: "true" },+ },+ },+ areaOpacity: {+ description: "The opacity of the area fill",+ control: false,+ table: {+ type: { summary: "number" },+ defaultValue: { summary: "0.7" },+ },+ },+ legend: {+ description:+ "Whether to display the chart legend showing the data series names and their corresponding colors/icons",+ control: "boolean",+ table: {+ type: { summary: "boolean" },+ defaultValue: { summary: "true" },+ },+ },+ },+} satisfies Meta<typeof RadarChart>;++export default meta;+type Story = StoryObj<typeof meta>;++export const RadarChartStory: Story = {+ name: "Radar Chart",+ args: {+ data: radarChartData,+ categoryKey: "month",+ theme: "ocean",+ variant: "area",+ width: 460,+ height: 300,+ strokeWidth: 2,+ areaOpacity: 0.5,+ legend: true,+ grid: true,+ },+ render: (args) => (+ <Card style={{ width: "500px" }}>+ <RadarChart {...args} />+ </Card>+ ),+ parameters: {+ docs: {+ source: {+ code: `+ const radarChartData = [+ { month: "January", desktop: 250, mobile: 150 },+ { month: "February", desktop: 280, mobile: 180 },+ { month: "March", desktop: 220, mobile: 140 },+ { month: "April", desktop: 180, mobile: 160 },+ { month: "May", desktop: 250, mobile: 120 },+ { month: "June", desktop: 300, mobile: 180 },+];++<Card+ style={{+ width: '500px'+ }}+>+ <RadarChart+ areaOpacity={0.5}+ categoryKey="month"+ data={radarChartData}+ grid+ height={300}+ legend+ strokeWidth={2}+ theme="sunset"+ variant="area"+ width={460}+ />+</Card>+ `,+ },+ },+ },+};++export const RadarChartStoryWithIcons: Story = {+ name: "Radar Chart with Icons",+ args: {+ ...RadarChartStory.args,+ icons: icons,+ },+ render: (args) => (+ <Card style={{ width: "500px" }}>+ <RadarChart {...args} />+ </Card>+ ),+ parameters: {+ docs: {+ source: {+ code: `+import { Monitor, TabletSmartphone } from "lucide-react";++const radarChartData = [+ { month: "January", desktop: 250, mobile: 150 },+ { month: "February", desktop: 280, mobile: 180 },+ { month: "March", desktop: 220, mobile: 140 },+ { month: "April", desktop: 180, mobile: 160 },+ { month: "May", desktop: 250, mobile: 120 },+ { month: "June", desktop: 300, mobile: 180 },+];++const icons = {+ desktop: Monitor,+ mobile: TabletSmartphone,+} as const;++<Card+ style={{+ width: '500px'+ }}+>+ <RadarChart+ areaOpacity={0.5}+ categoryKey="month"+ data={radarChartData}+ grid+ height={300}+ legend+ strokeWidth={2}+ theme="sunset"+ variant="area"+ width={460}+ icons={icons}+ />+</Card>+ `,+ },+ },+ },+};diff --git a/frontend-sdk/packages/react-ui/src/components/Charts/RadialChart/RadialChart.tsx b/frontend-sdk/packages/react-ui/src/components/Charts/RadialChart/RadialChart.tsxindex f2ad35c66..41521b2ac 100644--- a/frontend-sdk/packages/react-ui/src/components/Charts/RadialChart/RadialChart.tsx+++ b/frontend-sdk/packages/react-ui/src/components/Charts/RadialChart/RadialChart.tsx@@ -15,7 +15,7 @@ import { getDistributedColors, getPalette } from "../utils/PalletUtils";type RadialChartData = Array<Record<string, string | number>>;-interface RadialChartProps<T extends RadialChartData> {+export interface RadialChartProps<T extends RadialChartData> {data: T;categoryKey: keyof T[number];dataKey: keyof T[number];@@ -25,12 +25,17 @@ interface RadialChartProps<T extends RadialChartData> {legend?: boolean;label?: boolean;grid?: boolean;- outerRadius?: number;- innerRadius?: number;width?: number;height?: number;}+const layoutMap: Record<string, string> = {+ mobile: "crayon-pie-chart-container-mobile",+ fullscreen: "crayon-pie-chart-container-fullscreen",+ tray: "crayon-pie-chart-container-tray",+ copilot: "crayon-pie-chart-container-copilot",+};+// Helper function to calculate percentageconst calculatePercentage = (value: number, total: number): number => {if (total === 0) return 0;@@ -47,8 +52,6 @@ export const RadialChart = <T extends RadialChartData>({legend = true,label = true,grid = true,- outerRadius,- innerRadius,width = 800,height = 400,}: RadialChartProps<T>) => {@@ -86,14 +89,14 @@ export const RadialChart = <T extends RadialChartData>({newInnerRadius = 30;}- setCalculatedOuterRadius(outerRadius ?? newOuterRadius);- setCalculatedInnerRadius(innerRadius ?? newInnerRadius);+ setCalculatedOuterRadius(newOuterRadius);+ setCalculatedInnerRadius(newInnerRadius);}, 100),);resizeObserver.observe(containerRef.current);return () => resizeObserver.disconnect();- }, [layout, label, outerRadius, innerRadius]);+ }, [layout, label]);// Calculate total for percentage calculationsconst total = data.reduce((sum, item) => sum + Number(item[dataKey]), 0);@@ -140,11 +143,7 @@ export const RadialChart = <T extends RadialChartData>({<ChartContainerref={containerRef}config={chartConfig}- className={clsx(- "crayon-radial-chart-container",- `crayon-radial-chart-container-${layout}`,- "aspect-square",- )}+ className={clsx("crayon-radial-chart-container", layoutMap[layout], "aspect-square")}><RadialBarChartwidth={width}diff --git a/frontend-sdk/packages/react-ui/src/components/Charts/RadialChart/stories/radialChart.stories.tsx b/frontend-sdk/packages/react-ui/src/components/Charts/RadialChart/stories/radialChart.stories.tsxnew file mode 100644index 000000000..ab131215f--- /dev/null+++ b/frontend-sdk/packages/react-ui/src/components/Charts/RadialChart/stories/radialChart.stories.tsx@@ -0,0 +1,180 @@+import type { Meta, StoryObj } from "@storybook/react";+import { Card } from "../../../Card";+import "../../../Card/card.scss";+import "../../charts.scss";+import { RadialChart, RadialChartProps } from "../RadialChart";++const radialChartData = [+ { month: "January", value: 400 },+ { month: "February", value: 300 },+ { month: "March", value: 300 },+ { month: "April", value: 400 },+ { month: "May", value: 300 },+ { month: "June", value: 300 },+ { month: "July", value: 300 },+];++const meta: Meta<RadialChartProps<typeof radialChartData>> = {+ title: "Components/Charts/RadialChart",+ component: RadialChart,+ parameters: {+ layout: "centered",+ },+ tags: ["autodocs"],+ argTypes: {+ data: {+ description:+ "An array of data objects where each object represents a data point. Each object should have a category field (e.g., month) and one or more numeric values for the areas to be plotted.",+ control: false,+ table: {+ type: { summary: "Array<Record<string, string | number>>" },+ defaultValue: { summary: "[]" },+ },+ },+ categoryKey: {+ description:+ "The key from your data object to be used as the category labels for each segment (e.g., 'month', 'year', 'category')",+ control: false,+ table: {+ type: { summary: "string" },+ },+ },+ dataKey: {+ description:+ "The key from your data object to be used as the values that determine the segment sizes (e.g., 'value', 'count', 'amount')",+ control: false,+ table: {+ type: { summary: "string" },+ },+ },+ width: {+ description: "The width of the chart area in pixels. This excludes margins and padding.",+ control: false,+ table: {+ type: { summary: "number" },+ defaultValue: { summary: "800" },+ },+ },+ height: {+ description: "The height of the chart area in pixels. This excludes margins and padding.",+ control: false,+ table: {+ type: { summary: "number" },+ defaultValue: { summary: "400" },+ },+ },+ theme: {+ description:+ "The color palette theme for the chart. Each theme provides a different set of colors for the areas.",+ control: "select",+ options: ["ocean", "orchid", "emerald", "sunset", "spectrum", "vivid"],+ table: {+ defaultValue: { summary: "ocean" },+ },+ },+ variant: {+ description:+ "The style of the pie chart. 'circular' shows a circular chart, while 'semicircle' shows a semicircle chart.",+ control: "radio",+ options: ["circular", "semicircle"],+ table: {+ defaultValue: { summary: "circular" },+ },+ },+ format: {+ description:+ "The format of the data. 'percentage' shows the data as a percentage, while 'number' shows the data as a number.",+ control: "radio",+ options: ["percentage", "number"],+ table: {+ defaultValue: { summary: "percentage" },+ },+ },+ legend: {+ description: "Whether to display the legend",+ control: "boolean",+ table: {+ type: { summary: "boolean" },+ defaultValue: { summary: "true" },+ },+ },+ label: {+ description: "Whether to display the data point labels above each point on the chart",+ control: "boolean",+ table: {+ type: { summary: "boolean" },+ defaultValue: { summary: "true" },+ },+ },+ grid: {+ description: "Whether to display the grid lines",+ control: "boolean",+ table: {+ type: { summary: "boolean" },+ defaultValue: { summary: "true" },+ },+ },+ },+} satisfies Meta<typeof RadialChart>;++export default meta;+type Story = StoryObj<typeof meta>;++export const RadialChartStory: Story = {+ name: "Radial Chart",+ args: {+ data: radialChartData,+ categoryKey: "month",+ dataKey: "value",+ theme: "ocean",+ variant: "circular",+ format: "number",+ legend: true,+ label: true,+ grid: true,+ width: 460,+ height: 300,+ },+ render: (args) => (+ <Card style={{ width: "500px" }}>+ <RadialChart {...args} />+ </Card>+ ),+ parameters: {+ docs: {+ source: {+ code: `+const radialChartData = [+ { month: "January", value: 400 },+ { month: "February", value: 300 },+ { month: "March", value: 300 },+ { month: "April", value: 400 },+ { month: "May", value: 300 },+ { month: "June", value: 300 },+ { month: "July", value: 300 },+];++<Card+ style={{+ width: '500px'+ }}+>+ <RadialChart+ categoryKey="month"+ data={radialChartData}+ dataKey="value"+ format="number"+ grid+ label+ legend+ theme="ocean"+ variant="circular"+ width={460}+ height={300}+ />+</Card>+ `,+ },+ },+ },+};diff --git a/frontend-sdk/packages/react-ui/src/components/Charts/charts.scss b/frontend-sdk/packages/react-ui/src/components/Charts/charts.scssindex 9c44f2e3e..3c7e764ad 100644--- a/frontend-sdk/packages/react-ui/src/components/Charts/charts.scss+++ b/frontend-sdk/packages/react-ui/src/components/Charts/charts.scss@@ -219,3 +219,32 @@.crayon-chart-label-list {fill: map.get(cssUtils.$colors, "fills", "secondary");}++//Pie Chart styles++.crayon-pie-chart {+ &-container {+ margin-left: auto;+ margin-right: auto;++ &-fullscreen {+ min-height: 400px;+ width: 100%;+ }++ &-mobile {+ min-height: 300px;+ width: 100%;+ }++ &-tray {+ min-height: 350px;+ width: 100%;+ }++ &-copilot {+ min-height: 350px;+ width: 100%;+ }+ }+}diff --git a/frontend-sdk/packages/react-ui/src/components/Charts/stories/charts.stories.tsx b/frontend-sdk/packages/react-ui/src/components/Charts/stories/charts.stories.tsxdeleted file mode 100644index 8e65f4888..000000000--- a/frontend-sdk/packages/react-ui/src/components/Charts/stories/charts.stories.tsx+++ /dev/null@@ -1,273 +0,0 @@-import type { Meta, StoryObj } from "@storybook/react";-import { Download, Monitor, TabletSmartphone, TrendingUp } from "lucide-react";-import { Button } from "../../Button";-import { Card } from "../../Card";-import { Footer } from "../../Footer/Footer";-import { Header } from "../../Header";-import { IconButton } from "../../IconButton";-import { AreaChart } from "../AreaChart";-import { BarChart } from "../BarChart";-import "../charts.scss";-import { LineChart } from "../LineChart";-import { PieChart } from "../PieChart";-import "../PieChart/pieChart.scss";-import { RadarChart } from "../RadarChart";-import { RadialChart } from "../RadialChart";--const chartData = [- { month: "January", desktop: 186, mobile: 80 },- { month: "February", desktop: 305, mobile: 200 },- { month: "March", desktop: 237, mobile: 120 },- { month: "April", desktop: 73, mobile: 190 },- { month: "May", desktop: 209, mobile: 130 },- { month: "June", desktop: 214, mobile: 140 },-];--const areaChartData = [- { month: "January", desktop: 150, mobile: 90 },- { month: "February", desktop: 280, mobile: 180 },- { month: "March", desktop: 220, mobile: 140 },- { month: "April", desktop: 180, mobile: 160 },- { month: "May", desktop: 250, mobile: 120 },- { month: "June", desktop: 300, mobile: 180 },-];--const lineChartData = [- { month: "January", desktop: 186, mobile: 80 },- { month: "February", desktop: 305, mobile: 200 },- { month: "March", desktop: 237, mobile: 120 },- { month: "April", desktop: 73, mobile: 190 },- { month: "May", desktop: 209, mobile: 130 },- { month: "June", desktop: 214, mobile: 140 },-];--const radarChartData = [- { month: "January", desktop: 186, mobile: 80 },- { month: "February", desktop: 305, mobile: 200 },- { month: "March", desktop: 237, mobile: 120 },- { month: "April", desktop: 73, mobile: 190 },- { month: "May", desktop: 209, mobile: 130 },- { month: "June", desktop: 214, mobile: 140 },-];--const pieChartData = [- { month: "January", desktop: 186 },- { month: "February", desktop: 305 },- { month: "March", desktop: 237 },- { month: "April", desktop: 73 },- { month: "May", desktop: 209 },- { month: "June", desktop: 214 },-];--const radialChartData = [- { month: "January", desktop: 186 },- { month: "February", desktop: 305 },- { month: "March", desktop: 237 },- { month: "April", desktop: 73 },- { month: "May", desktop: 209 },- { month: "June", desktop: 214 },-];--const icons = {- desktop: Monitor,- mobile: TabletSmartphone,-} as const;--const BarChartComponent = () => {- return (- <Card style={{ width: "500px" }}>- <Header- actions={[- <IconButton variant="tertiary" key="download-btn" size="small" icon={<TrendingUp />} />,- ]}- title="Bar Chart - Multiple"- subtitle="January - June 2024"- />- <BarChart- data={chartData}- categoryKey="month"- theme="sunset"- icons={icons}- variant="stacked"- />- <Footer>- <Button iconRight={<Download />}>Download</Button>- </Footer>- </Card>- );-};--const AreaChartComponent = () => {- return (- <Card style={{ width: "500px" }}>- <Header- actions={[- <IconButton variant="tertiary" key="download-btn" size="small" icon={<TrendingUp />} />,- ]}- title="Area Chart - Multiple"- subtitle="January - June 2024"- />- <AreaChart- data={areaChartData}- categoryKey="month"- theme="ocean"- icons={icons}- variant="linear"- width={460}- height={300}- opacity={1}- />- <Footer>- <Button iconRight={<Download />}>Download</Button>- </Footer>- </Card>- );-};--const LineChartComponent = () => {- return (- <Card style={{ width: "500px" }}>- <Header- actions={[- <IconButton variant="tertiary" key="download-btn" size="small" icon={<TrendingUp />} />,- ]}- title="Line Chart - Multiple"- subtitle="January - June 2024"- />- <LineChart- data={lineChartData}- categoryKey="month"- theme="emerald"- icons={icons}- variant="step"- width={460}- height={300}- strokeWidth={3}- />- <Footer>- <Button iconRight={<Download />}>Download</Button>- </Footer>- </Card>- );-};--const RadarChartComponent = () => {- return (- <Card style={{ width: "500px" }}>- <Header- actions={[- <IconButton variant="tertiary" key="download-btn" size="small" icon={<TrendingUp />} />,- ]}- title="Rader Chart - Multiple"- subtitle="January - June 2024"- />- <RadarChart- data={radarChartData}- categoryKey="month"- theme="vivid"- icons={icons}- variant="area"- width={460}- height={400}- strokeWidth={3}- areaOpacity={1}- />- <Footer>- <Button iconRight={<Download />}>Download</Button>- </Footer>- </Card>- );-};--const PieChartComponent = () => {- return (- <Card style={{ width: "500px" }}>- <Header- actions={[- <IconButton variant="tertiary" key="download-btn" size="small" icon={<TrendingUp />} />,- ]}- title="Pie Chart - Multiple"- subtitle="January - June 2024"- />- <PieChart- data={pieChartData}- categoryKey="month"- dataKey="desktop"- theme="vivid"- format="percentage"- variant="donut"- />- <Footer>- <Button iconRight={<Download />}>Download</Button>- </Footer>- </Card>- );-};--const RadialChartComponent = () => {- return (- <Card style={{ width: "500px" }}>- <Header- actions={[- <IconButton variant="tertiary" key="download-btn" size="small" icon={<TrendingUp />} />,- ]}- title="Radial Chart - Multiple"- subtitle="January - June 2024"- />- <RadialChart- data={pieChartData}- categoryKey="month"- dataKey="desktop"- theme="vivid"- format="percentage"- variant="circular"- width={460}- height={400}- />- <Footer>- <Button iconRight={<Download />}>Download</Button>- </Footer>- </Card>- );-};-const meta = {- title: "Components/Charts/BarChart",- component: BarChartComponent,- parameters: {- layout: "centered",- },- tags: ["autodocs"],-} satisfies Meta<typeof BarChartComponent>;--export default meta;-type Story = StoryObj<typeof meta>;--export const BarChartStory: Story = {- name: "Bar Chart",- render: () => <BarChartComponent />,-};--export const AreaChartStory: Story = {- name: "Area Chart",- render: () => <AreaChartComponent />,-};--export const LineChartStory: Story = {- name: "Line Chart",- render: () => <LineChartComponent />,-};--export const RadarChartStory: Story = {- name: "Radar Chart",- render: () => <RadarChartComponent />,-};--export const PieChartStory: Story = {- name: "Pie Chart",- render: () => <PieChartComponent />,-};--export const RadialChartStory: Story = {- name: "Radial Chart",- render: () => <RadialChartComponent />,-};diff --git a/frontend-sdk/packages/react-ui/src/components/CheckBoxGroup/CheckBoxGroup.tsx b/frontend-sdk/packages/react-ui/src/components/CheckBoxGroup/CheckBoxGroup.tsxindex b24fefff1..56c205f37 100644--- a/frontend-sdk/packages/react-ui/src/components/CheckBoxGroup/CheckBoxGroup.tsx+++ b/frontend-sdk/packages/react-ui/src/components/CheckBoxGroup/CheckBoxGroup.tsx@@ -2,19 +2,27 @@ import clsx from "clsx";import React from "react";import { CheckBoxItemProps } from "../CheckBoxItem";+type CheckBoxGroupVariant = "clear" | "card" | "sunk";+interface CheckBoxGroupProps {children: React.ReactElement<CheckBoxItemProps> | React.ReactElement<CheckBoxItemProps>[];className?: string;style?: React.CSSProperties;- variant?: "clear" | "card" | "sunk";+ variant?: CheckBoxGroupVariant;}+const variantMap: Record<CheckBoxGroupVariant, string> = {+ clear: "crayon-checkbox-group-clear",+ card: "crayon-checkbox-group-card",+ sunk: "crayon-checkbox-group-sunk",+};+const CheckBoxGroup = React.forwardRef<HTMLDivElement, CheckBoxGroupProps>((props, ref) => {const { children, className, style, variant = "clear" } = props;return (<divref={ref}- className={clsx("crayon-checkbox-group", `crayon-checkbox-group-${variant}`, className)}+ className={clsx("crayon-checkbox-group", variantMap[variant], className)}style={style}>{children}diff --git a/frontend-sdk/packages/react-ui/src/components/CheckBoxGroup/stories/CheckBoxGroup.stories.tsx b/frontend-sdk/packages/react-ui/src/components/CheckBoxGroup/stories/CheckBoxGroup.stories.tsxindex f6a05268f..b01f099bd 100644--- a/frontend-sdk/packages/react-ui/src/components/CheckBoxGroup/stories/CheckBoxGroup.stories.tsx+++ b/frontend-sdk/packages/react-ui/src/components/CheckBoxGroup/stories/CheckBoxGroup.stories.tsx@@ -1,39 +1,77 @@import type { Meta, StoryObj } from "@storybook/react";import { CheckBoxItem } from "../../CheckBoxItem";import "../../CheckBoxItem/checkBoxItem.scss";-import "../../FormControl/Label/label.scss";+import "../../Label/label.scss";import { CheckBoxGroup } from "../CheckBoxGroup";import "../checkBoxGroup.scss";const meta = {title: "Components/CheckBoxGroup",component: CheckBoxGroup,+ subcomponents: { CheckBoxItem } as any,parameters: {layout: "centered",},+ argTypes: {+ variant: {+ control: "radio",+ options: ["clear", "card", "sunk"],+ description: "The visual style variant of the checkbox group",+ table: {+ category: "Appearance",+ type: {+ summary: "'clear' | 'card' | 'sunk'",+ },+ defaultValue: { summary: "clear" },+ },+ },+ children: {+ control: false,+ description: "The child elements of the checkbox group that accept CheckBoxItem components",+ table: {+ category: "Content",+ type: {+ summary: "ReactNode[] | ReactNode",+ },+ expanded: false,+ },+ },+ className: {+ control: false,+ description: "Additional CSS class name for custom styling",+ table: {+ category: "Styling",+ type: {+ summary: "string",+ },+ expanded: false,+ },+ },+ style: {+ control: false,+ description: "Inline CSS styles for custom styling",+ table: {+ category: "Styling",+ type: {+ summary: "CSSProperties",+ },+ expanded: false,+ },+ },+ },tags: ["autodocs"],} satisfies Meta<typeof CheckBoxGroup>;export default meta;type Story = StoryObj<typeof meta>;-export const Default: Story = {- args: {- children: [- <CheckBoxItem key="1" label="Option 1" onChange={() => {}} />,- <CheckBoxItem key="2" label="Option 2" onChange={() => {}} />,- <CheckBoxItem key="3" label="Option 3" onChange={() => {}} />,- ],- },-};-export const ClearVariant: Story = {args: {variant: "clear",children: [- <CheckBoxItem key="1" label="Clear Option 1" onChange={() => {}} />,- <CheckBoxItem key="2" label="Clear Option 2" onChange={() => {}} />,- <CheckBoxItem key="3" label="Clear Option 3" onChange={() => {}} />,+ <CheckBoxItem key="1" label="Option 1" />,+ <CheckBoxItem key="2" label="Option 2" />,+ <CheckBoxItem key="3" label="Option 3" />,],},};@@ -42,9 +80,9 @@ export const CardVariant: Story = {args: {variant: "card",children: [- <CheckBoxItem key="1" label="Card Option 1" onChange={() => {}} />,- <CheckBoxItem key="2" label="Card Option 2" onChange={() => {}} />,- <CheckBoxItem key="3" label="Card Option 3" onChange={() => {}} />,+ <CheckBoxItem key="1" label="Card Option 1" />,+ <CheckBoxItem key="2" label="Card Option 2" />,+ <CheckBoxItem key="3" label="Card Option 3" />,],},};@@ -53,30 +91,9 @@ export const SunkVariant: Story = {args: {variant: "sunk",children: [- <CheckBoxItem key="1" label="Sunk Option 1" onChange={() => {}} />,- <CheckBoxItem key="2" label="Sunk Option 2" onChange={() => {}} />,- <CheckBoxItem key="3" label="Sunk Option 3" onChange={() => {}} />,- ],- },-};--export const WithCustomClassName: Story = {- args: {- className: "custom-class",- children: [- <CheckBoxItem key="1" label="Custom Class Option 1" onChange={() => {}} />,- <CheckBoxItem key="2" label="Custom Class Option 2" onChange={() => {}} />,- ],- },-};--export const WithCustomStyle: Story = {- args: {- style: { maxWidth: "300px" },- variant: "card",- children: [- <CheckBoxItem key="1" label="Custom Style Option 1" onChange={() => {}} />,- <CheckBoxItem key="2" label="Custom Style Option 2" onChange={() => {}} />,+ <CheckBoxItem key="1" label="Sunk Option 1" />,+ <CheckBoxItem key="2" label="Sunk Option 2" />,+ <CheckBoxItem key="3" label="Sunk Option 3" />,],},};diff --git a/frontend-sdk/packages/react-ui/src/components/CheckBoxItem/CheckBoxItem.tsx b/frontend-sdk/packages/react-ui/src/components/CheckBoxItem/CheckBoxItem.tsxindex 0e40bffd4..7f8aceb18 100644--- a/frontend-sdk/packages/react-ui/src/components/CheckBoxItem/CheckBoxItem.tsx+++ b/frontend-sdk/packages/react-ui/src/components/CheckBoxItem/CheckBoxItem.tsx@@ -1,25 +1,24 @@import * as Checkbox from "@radix-ui/react-checkbox";import clsx from "clsx";import { Check } from "lucide-react";-import React, { useId } from "react";+import { CSSProperties, forwardRef, ReactNode, useId } from "react";import { Label } from "../FormControl";export interface CheckBoxItemProps {- label?: React.ReactNode;+ label?: ReactNode;className?: string;- style?: React.CSSProperties;+ style?: CSSProperties;checked?: boolean;defaultChecked?: boolean;disabled?: boolean;required?: boolean;name?: string;value?: string;- checkedIcon?: React.ReactNode;onChange?: (checked: boolean) => void;}-const CheckBoxItem = React.forwardRef<HTMLButtonElement, CheckBoxItemProps>((props, ref) => {- const { label, onChange, className, disabled, ...rest } = props;+const CheckBoxItem = forwardRef<HTMLButtonElement, CheckBoxItemProps>((props, ref) => {+ const { label, onChange, className, disabled, required, ...rest } = props;const id = useId();return (<div className="crayon-checkbox-item-container">@@ -30,13 +29,19 @@ const CheckBoxItem = React.forwardRef<HTMLButtonElement, CheckBoxItemProps>((proid={id}className={clsx("crayon-checkbox-item-root", className)}disabled={disabled}+ required={required}><Checkbox.Indicator className="crayon-checkbox-item-indicator"><Check size={11} /></Checkbox.Indicator></Checkbox.Root>{label && (- <Label htmlFor={id} className="crayon-checkbox-item-label" disabled={disabled}>+ <Label+ htmlFor={id}+ className="crayon-checkbox-item-label"+ disabled={disabled}+ required={required}+ >{label}</Label>)}diff --git a/frontend-sdk/packages/react-ui/src/components/CheckBoxItem/stories/CheckBoxItem.stories.tsx b/frontend-sdk/packages/react-ui/src/components/CheckBoxItem/stories/CheckBoxItem.stories.tsxindex 6c53dd79f..3398b1196 100644--- a/frontend-sdk/packages/react-ui/src/components/CheckBoxItem/stories/CheckBoxItem.stories.tsx+++ b/frontend-sdk/packages/react-ui/src/components/CheckBoxItem/stories/CheckBoxItem.stories.tsx@@ -1,5 +1,5 @@import type { Meta, StoryObj } from "@storybook/react";-import "../../FormControl/Label/label.scss";+import "../../Label/label.scss";import { CheckBoxItem } from "../CheckBoxItem";import "../checkBoxItem.scss";@@ -9,6 +9,101 @@ const meta: Meta<typeof CheckBoxItem> = {parameters: {layout: "centered",},+ argTypes: {+ label: {+ control: "text",+ defaultValue: "Default Checkbox",+ description: "The label of the checkbox",+ table: {+ type: {+ summary: "string",+ },+ },+ },+ checked: {+ control: "boolean",+ description: "State of the checkbox, used for controlled mode",+ table: {+ type: {+ summary: "boolean",+ },+ defaultValue: { summary: "false" },+ },+ },+ defaultChecked: {+ control: false,+ description:+ "The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state.",+ table: {+ type: {+ summary: "boolean",+ },+ defaultValue: { summary: "false" },+ },+ },+ disabled: {+ control: "boolean",+ description: "Whether the checkbox is disabled or not",+ table: {+ type: { summary: "boolean" },+ defaultValue: { summary: "false" },+ },+ },+ required: {+ control: "boolean",+ description:+ "When true, indicates that the user must check the checkbox before the owning form can be submitted.",+ table: {+ type: { summary: "boolean" },+ defaultValue: { summary: "false" },+ },+ },+ name: {+ control: false,+ description:+ "The name of the checkbox. Submitted with its owning form as part of a name/value pair.",+ table: {+ type: { summary: "string" },+ defaultValue: { summary: "undefined" },+ },+ },+ value: {+ control: false,+ description: "The value given as data when submitted with a `name`/`value` pair.",+ table: {+ type: { summary: "string" },+ },+ },+ onChange: {+ control: false,+ description: "The function to call when the checkbox is changed",+ table: {+ type: {+ summary: "(checked: boolean) => void",+ },+ },+ },+ className: {+ control: false,+ description: "The class name of the checkbox",+ table: {+ category: "Appearance",+ type: {+ summary: "string",+ },+ },+ },+ style: {+ control: false,+ description: "The style of the checkbox",+ table: {+ category: "Appearance",+ type: {+ summary: "CSSProperties",+ },+ },+ },+ },tags: ["autodocs"],};@@ -46,25 +141,3 @@ export const DisabledChecked: Story = {onChange: (checked) => console.log("Checkbox changed:", checked),},};--export const Required: Story = {- args: {- label: "Required Checkbox",- required: true,- onChange: (checked) => console.log("Checkbox changed:", checked),- },-};--export const WithCustomClassName: Story = {- args: {- label: "Custom Styled Checkbox",- className: "custom-checkbox",- onChange: (checked) => console.log("Checkbox changed:", checked),- },-};--export const WithoutLabel: Story = {- args: {- onChange: (checked) => console.log("Checkbox changed:", checked),- },-};diff --git a/frontend-sdk/packages/react-ui/src/components/DatePicker/helpers/utils/styles.tsx b/frontend-sdk/packages/react-ui/src/components/DatePicker/helpers/utils/styles.tsxindex 79591b834..6c1f3e420 100644--- a/frontend-sdk/packages/react-ui/src/components/DatePicker/helpers/utils/styles.tsx+++ b/frontend-sdk/packages/react-ui/src/components/DatePicker/helpers/utils/styles.tsx@@ -1,15 +1,44 @@import { ClassNames, getDefaultClassNames } from "react-day-picker";-export const getDayPickerStyles = (botType: "mobile" | "fullscreen" | "tray" | "copilot") => {+type BotType = "mobile" | "fullscreen" | "tray" | "copilot";+export const getDayPickerStyles = (botType: BotType) => {const defaultClassNames = getDefaultClassNames();+ const botTypeMapNav: Record<BotType, string> = {+ mobile: "crayon-date-picker-nav-mobile",+ fullscreen: "crayon-date-picker-nav-fullscreen",+ tray: "crayon-date-picker-nav-tray",+ copilot: "crayon-date-picker-nav-copilot",+ };++ const botTypeMapDropdowns: Record<BotType, string> = {+ mobile: "crayon-date-picker-dropdowns-mobile",+ fullscreen: "crayon-date-picker-dropdowns-fullscreen",+ tray: "crayon-date-picker-dropdowns-tray",+ copilot: "crayon-date-picker-dropdowns-copilot",+ };++ const botTypeMapButtonNext: Record<BotType, string> = {+ mobile: "crayon-date-picker-button-next-mobile",+ fullscreen: "crayon-date-picker-button-next-fullscreen",+ tray: "crayon-date-picker-button-next-tray",+ copilot: "crayon-date-picker-button-next-copilot",+ };++ const botTypeMapButtonPrevious: Record<BotType, string> = {+ mobile: "crayon-date-picker-button-previous-mobile",+ fullscreen: "crayon-date-picker-button-previous-fullscreen",+ tray: "crayon-date-picker-button-previous-tray",+ copilot: "crayon-date-picker-button-previous-copilot",+ };+const commonClassNames: Partial<ClassNames> = {root: `${defaultClassNames.root} crayon-date-picker-root`,- nav: `${defaultClassNames.nav} crayon-date-picker-nav-${botType}`,- dropdowns: `${defaultClassNames.dropdowns} crayon-date-picker-dropdowns-${botType}`,+ nav: `${defaultClassNames.nav} ${botTypeMapNav[botType]}`,+ dropdowns: `${defaultClassNames.dropdowns} ${botTypeMapDropdowns[botType]}`,month_grid: `crayon-date-picker-month-grid`,- button_next: `crayon-date-picker-button-next crayon-date-picker-button-next-${botType}`,- button_previous: `crayon-date-picker-button-previous crayon-date-picker-button-previous-${botType}`,+ button_next: `crayon-date-picker-button-next ${botTypeMapButtonNext[botType]}`,+ button_previous: `crayon-date-picker-button-previous ${botTypeMapButtonPrevious[botType]}`,today: `crayon-date-picker-today`,disabled: `crayon-date-picker-disabled`,weekdays: `crayon-date-picker-weekdays`,diff --git a/frontend-sdk/packages/react-ui/src/components/DatePicker/stories/DatePicker.stories.tsx b/frontend-sdk/packages/react-ui/src/components/DatePicker/stories/DatePicker.stories.tsxindex a5c226ffc..e9b1b919e 100644--- a/frontend-sdk/packages/react-ui/src/components/DatePicker/stories/DatePicker.stories.tsx+++ b/frontend-sdk/packages/react-ui/src/components/DatePicker/stories/DatePicker.stories.tsx@@ -6,12 +6,112 @@ import "../../Select/select.scss";import { DatePicker } from "../DatePicker";import "../datePicker.scss";-const meta = {+const meta: Meta<typeof DatePicker> = {title: "Components/DatePicker",component: DatePicker,parameters: {layout: "centered",},+ decorators: [+ (Story) => (+ <div+ style={{+ width: "400px",+ height: "400px",+ }}+ >+ <Story />+ </div>+ ),+ ],+ argTypes: {+ mode: {+ control: "radio",+ options: ["single", "range"],+ description: "The mode of date selection - either single date or date range",+ table: {+ category: "Behavior",+ type: {+ summary: "'single' | 'range'",+ },+ defaultValue: { summary: "single" },+ },+ },+ variant: {+ control: "radio",+ options: ["docked", "floating"],+ description: "The visual presentation style of the date picker",+ table: {+ category: "Appearance",+ type: {+ summary: "'docked' | 'floating'",+ },+ defaultValue: { summary: "docked" },+ },+ },+ selectedSingleDate: {+ control: false,+ description: "The currently selected date (for single mode)",+ table: {+ category: "State",+ type: {+ summary: "Date | undefined",+ },+ },+ },+ setSelectedSingleDate: {+ control: false,+ description: "Callback function to update the selected date (for single mode)",+ table: {+ category: "Callbacks",+ type: {+ summary: "(date: Date | undefined) => void",+ },+ },+ },+ selectedRangeDates: {+ control: false,+ description:+ "The currently selected date range (for range mode), use type DateRange from react-day-picker",+ table: {+ category: "State",+ type: {+ summary: "DateRange | undefined",+ },+ },+ },+ setSelectedRangeDates: {+ control: false,+ description:+ "Callback function to update the selected date range (for range mode), use type DateRange from react-day-picker",+ table: {+ category: "Callbacks",+ type: {+ summary: "(range: DateRange | undefined) => void",+ },+ },+ },+ className: {+ control: false,+ description: "Additional CSS class name for custom styling",+ table: {+ category: "Styling",+ type: {+ summary: "string",+ },+ },+ },+ style: {+ control: false,+ description: "Inline CSS styles for custom styling",+ table: {+ category: "Styling",+ type: {+ summary: "CSSProperties",+ },+ },+ },+ },tags: ["autodocs"],} satisfies Meta<typeof DatePicker>;@@ -19,11 +119,9 @@ export default meta;type Story = StoryObj<typeof meta>;// Basic single date picker with docked variant-export const Default: Story = {+export const SinglePicker: Story = {render: (args) => (- <div style={{ width: "400px", height: `${args.variant === "docked" ? "unset" : "400px"}` }}>- <DatePicker {...args} />- </div>+ <DatePicker style={{ width: args.variant === "docked" ? "unset" : "350px" }} {...args} />),args: {mode: "single",@@ -41,17 +139,39 @@ export const RangePicker: Story = {// Single date picker with floating variantexport const FloatingPicker: Story = {- render: () => (- <div style={{ width: "600px" }}>- <DatePicker mode="single" variant="floating" />- </div>- ),+ render: (args) => <DatePicker {...args} style={{ width: "350px" }} />,+ args: {+ mode: "single",+ variant: "floating",+ },};-// Controlled single date picker-const ControlledSinglePicker = () => {+export const ControlledSingle: Story = {+ render: (args) => {+ const [selectedDate, setSelectedDate] = useState<Date>();+ return (+ <div>+ <DatePicker+ mode={args.mode}+ variant={args.variant}+ selectedSingleDate={selectedDate}+ setSelectedSingleDate={setSelectedDate}+ />+ <div style={{ marginTop: "1rem" }}>Selected date: {selectedDate?.toLocaleDateString()}</div>+ </div>+ );+ },+ args: {+ mode: "single",+ variant: "docked",+ },+ parameters: {+ docs: {+ source: {+ code: `+const ControlledDatePickerExample = () => {const [selectedDate, setSelectedDate] = useState<Date>();-+return (<div><DatePicker@@ -60,13 +180,17 @@ const ControlledSinglePicker = () => {selectedSingleDate={selectedDate}setSelectedSingleDate={setSelectedDate}/>- <div style={{ marginTop: "1rem" }}>Selected date: {selectedDate?.toLocaleDateString()}</div>+ <div style={{ marginTop: "1rem" }}>+ Selected date: {selectedDate?.toLocaleDateString()}+ </div></div>);-};--export const ControlledSingle: Story = {- render: () => <ControlledSinglePicker />,+};`,+ language: "tsx",+ type: "code",+ },+ },+ },};// Controlled range date picker@@ -91,4 +215,30 @@ const ControlledRangePicker = () => {export const ControlledRange: Story = {render: () => <ControlledRangePicker />,+ parameters: {+ docs: {+ source: {+ code: `+const ControlledRangePicker = () => {+ const [dateRange, setDateRange] = useState<DateRange>();++ return (+ <div>+ <DatePicker+ mode="range"+ variant="docked"+ selectedRangeDates={dateRange}+ setSelectedRangeDates={setDateRange}+ />+ <div style={{ marginTop: "1rem" }}>+ Selected range: {dateRange?.from?.toLocaleDateString()} - {dateRange?.to?.toLocaleDateString()}+ </div>+ </div>+ );+};`,+ language: "tsx",+ type: "code",+ },+ },+ },};diff --git a/frontend-sdk/packages/react-ui/src/components/FollowUpBlock/FollowUpBlock.tsx b/frontend-sdk/packages/react-ui/src/components/FollowUpBlock/FollowUpBlock.tsxindex 76926243d..2a3a209d3 100644--- a/frontend-sdk/packages/react-ui/src/components/FollowUpBlock/FollowUpBlock.tsx+++ b/frontend-sdk/packages/react-ui/src/components/FollowUpBlock/FollowUpBlock.tsx@@ -1,14 +1,14 @@import clsx from "clsx";-import React from "react";+import { CSSProperties, forwardRef, ReactElement } from "react";import { FollowUpItemProps } from "../FollowUpItem";export interface FollowUpBlockProps {- children: React.ReactElement<FollowUpItemProps> | React.ReactElement<FollowUpItemProps>[];+ children: ReactElement<FollowUpItemProps> | ReactElement<FollowUpItemProps>[];className?: string;- style?: React.CSSProperties;+ style?: CSSProperties;}-const FollowUpBlock = React.forwardRef<HTMLDivElement, FollowUpBlockProps>((props, ref) => {+const FollowUpBlock = forwardRef<HTMLDivElement, FollowUpBlockProps>((props, ref) => {const { children, className, style } = props;return (<div ref={ref} className={clsx("crayon-follow-up-block", className)} style={style}>diff --git a/frontend-sdk/packages/react-ui/src/components/FollowUpBlock/stories/FollowUpBlock.stories.tsx b/frontend-sdk/packages/react-ui/src/components/FollowUpBlock/stories/FollowUpBlock.stories.tsxindex 0de8e14cd..6ce1086dc 100644--- a/frontend-sdk/packages/react-ui/src/components/FollowUpBlock/stories/FollowUpBlock.stories.tsx+++ b/frontend-sdk/packages/react-ui/src/components/FollowUpBlock/stories/FollowUpBlock.stories.tsx@@ -8,55 +8,52 @@ import "../FollowUpBlock.scss";const meta: Meta<typeof FollowUpBlock> = {title: "Components/FollowUpBlock",component: FollowUpBlock,+ subcomponents: { FollowUpItem } as any,tags: ["autodocs"],parameters: {layout: "centered",},+ argTypes: {+ children: {+ control: false,+ description: "The child elements of the follow up block that accept FollowUpItem components",+ table: {+ category: "Content",+ type: { summary: "ReactNode[] | ReactNode" },+ expanded: false,+ },+ },+ className: {+ control: false,+ description: "Additional CSS class name for custom styling",+ table: {+ category: "Styling",+ type: { summary: "string" },+ expanded: false,+ },+ },+ style: {+ control: false,+ description: "Inline CSS styles for custom styling",+ table: {+ category: "Styling",+ type: { summary: "CSSProperties" },+ expanded: false,+ },+ },+ },};export default meta;type Story = StoryObj<typeof FollowUpBlock>;-export const Default: Story = {- render: () => (+export const FollowUpBlockWithItems: Story = {+ render: (args) => (<FollowUpBlock>+ <FollowUpItem text="What is machine learning?" icon={<Plus size={16} />} />+ <FollowUpItem text="what is the weather in tokyo?" icon={<Plus size={16} />} /><FollowUpItem- text="What is machine learning?"- onClick={() => console.log("Clicked")}- icon={<Plus size={16} />}- />- </FollowUpBlock>- ),-};--export const MultipleItems: Story = {- render: () => (- <FollowUpBlock>- <FollowUpItem- text="Tell me more about artificial intelligence"- onClick={() => console.log("Clicked 1")}- icon={<Plus size={16} />}- />- <FollowUpItem- text="How does deep learning work?"- onClick={() => console.log("Clicked 2")}- icon={<Plus size={16} />}- />- <FollowUpItem- text="What are neural networks?"- onClick={() => console.log("Clicked 3")}- icon={<Plus size={16} />}- />- </FollowUpBlock>- ),-};--export const CustomStyling: Story = {- render: () => (- <FollowUpBlock className="custom-class" style={{ backgroundColor: "#f5f5f5", padding: "20px" }}>- <FollowUpItem- text="How can I customize the appearance?"- onClick={() => console.log("Clicked")}+ text="How to leverage AI to improve customer service?"icon={<Plus size={16} />}/></FollowUpBlock>diff --git a/frontend-sdk/packages/react-ui/src/components/FollowUpItem/FollowUpItem.tsx b/frontend-sdk/packages/react-ui/src/components/FollowUpItem/FollowUpItem.tsxindex afe53f51f..5a5260924 100644--- a/frontend-sdk/packages/react-ui/src/components/FollowUpItem/FollowUpItem.tsx+++ b/frontend-sdk/packages/react-ui/src/components/FollowUpItem/FollowUpItem.tsx@@ -1,17 +1,16 @@import clsx from "clsx";-import React from "react";+import { ButtonHTMLAttributes, forwardRef, ReactNode } from "react";-export interface FollowUpItemProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {- text: React.ReactNode;- icon?: React.ReactNode;+export interface FollowUpItemProps extends ButtonHTMLAttributes<HTMLButtonElement> {+ text: ReactNode;+ icon?: ReactNode;className?: string;- style?: React.CSSProperties;}-const FollowUpItem = React.forwardRef<HTMLButtonElement, FollowUpItemProps>((props, ref) => {- const { className, style, text, icon, ...rest } = props;+const FollowUpItem = forwardRef<HTMLButtonElement, FollowUpItemProps>((props, ref) => {+ const { className, text, icon, ...rest } = props;return (- <button ref={ref} className={clsx("crayon-follow-up-item", className)} style={style} {...rest}>+ <button ref={ref} className={clsx("crayon-follow-up-item", className)} {...rest}>{text}{icon}</button>diff --git a/frontend-sdk/packages/react-ui/src/components/FollowUpItem/stories/FollowUpItem.stories.tsx b/frontend-sdk/packages/react-ui/src/components/FollowUpItem/stories/FollowUpItem.stories.tsxindex bc6b5375a..e149a804b 100644--- a/frontend-sdk/packages/react-ui/src/components/FollowUpItem/stories/FollowUpItem.stories.tsx+++ b/frontend-sdk/packages/react-ui/src/components/FollowUpItem/stories/FollowUpItem.stories.tsx@@ -6,19 +6,37 @@ import "../FollowUpItem.scss";const meta: Meta<typeof FollowUpItem> = {title: "Components/FollowUpItem",component: FollowUpItem,+ parameters: {+ layout: "centered",+ },tags: ["autodocs"],argTypes: {text: {control: "text",description: "The text content of the follow-up item",+ table: {+ category: "Content",+ type: { summary: "string" },+ defaultValue: { summary: "undefined" },+ },},icon: {- control: "boolean",- description: "Whether to show an icon",+ control: false,+ description: "",+ table: {+ category: "Content",+ type: { summary: "ReactNode" },+ defaultValue: { summary: "undefined" },+ },},className: {- control: "text",+ control: false,description: "Additional CSS class names",+ table: {+ category: "Styling",+ type: { summary: "string" },+ defaultValue: { summary: "undefined" },+ },},},};@@ -29,25 +47,6 @@ type Story = StoryObj<typeof FollowUpItem>;export const Default: Story = {args: {text: "Continue with this topic",- },-};--export const WithIcon: Story = {- args: {- text: "Tell me more",icon: <ArrowRight size={16} />,},};--export const CustomStyling: Story = {- args: {- text: "Custom styled button",- icon: <ArrowRight size={16} />,- className: "custom-follow-up",- style: {- backgroundColor: "#f0f9ff",- borderColor: "#bae6fd",- color: "#0369a1",- },- },-};diff --git a/frontend-sdk/packages/react-ui/src/components/Footer/Footer.tsx b/frontend-sdk/packages/react-ui/src/components/Footer/Footer.tsxindex fded1a3f2..7e4f14bac 100644--- a/frontend-sdk/packages/react-ui/src/components/Footer/Footer.tsx+++ b/frontend-sdk/packages/react-ui/src/components/Footer/Footer.tsx@@ -1,25 +1,30 @@import clsx from "clsx";-import React from "react";-import { Button } from "../Button";-import { IconButton } from "../IconButton";+import { CSSProperties, forwardRef, HTMLAttributes, ReactElement } from "react";+import { ButtonProps } from "../Button";+import { IconButtonProps } from "../IconButton";-export type FooterVariant = "vertical" | "horizontal";+type FooterVariant = "vertical" | "horizontal";-export interface FooterProps extends React.HTMLAttributes<HTMLDivElement> {+export interface FooterProps extends HTMLAttributes<HTMLDivElement> {variant?: FooterVariant;children:- | React.ReactElement<typeof Button | typeof IconButton>- | React.ReactElement<typeof Button | typeof IconButton>[];+ | ReactElement<ButtonProps | IconButtonProps>+ | ReactElement<ButtonProps | IconButtonProps>[];className?: string;- style?: React.CSSProperties;+ style?: CSSProperties;}-export const Footer = React.forwardRef<HTMLDivElement, FooterProps>((props, ref) => {- const { className, style, variant, children, ...rest } = props;+const variantMap: Record<FooterVariant, string> = {+ vertical: "crayon-footer-vertical",+ horizontal: "crayon-footer-horizontal",+};++export const Footer = forwardRef<HTMLDivElement, FooterProps>((props, ref) => {+ const { className, style, variant = "horizontal", children, ...rest } = props;return (<divref={ref}- className={clsx("crayon-footer", `crayon-footer-${variant}`, className)}+ className={clsx("crayon-footer", variantMap[variant], className)}style={style}{...rest}>diff --git a/frontend-sdk/packages/react-ui/src/components/Footer/stories/footer.stories.tsx b/frontend-sdk/packages/react-ui/src/components/Footer/stories/footer.stories.tsxindex 601e9c421..ae335675d 100644--- a/frontend-sdk/packages/react-ui/src/components/Footer/stories/footer.stories.tsx+++ b/frontend-sdk/packages/react-ui/src/components/Footer/stories/footer.stories.tsx@@ -1,5 +1,9 @@import type { Meta, StoryObj } from "@storybook/react";+import { ArrowLeft } from "lucide-react";import { Button } from "../../Button";+import "../../Button/button.scss";+import { IconButton } from "../../IconButton";+import "../../IconButton/iconButton.scss";import { Footer } from "../Footer";import "../footer.scss";@@ -9,10 +13,52 @@ const meta: Meta<typeof Footer> = {parameters: {layout: "centered",},+ decorators: [+ (Story) => (+ <div style={{ width: "500px" }}>+ <Story />+ </div>+ ),+ ],argTypes: {variant: {control: "radio",options: ["horizontal", "vertical"],+ table: {+ category: "Appearance",+ type: { summary: "'horizontal' | 'vertical'" },+ defaultValue: { summary: "'horizontal'" },+ },+ },+ children: {+ control: false,+ description: "The child elements of the footer that accept Button and IconButton components",+ table: {+ category: "Content",+ type: {+ summary:+ "ReactNode[]<ButtonProps | IconButtonProps> | ReactNode<ButtonProps | IconButtonProps>",+ },+ defaultValue: { summary: "undefined" },+ },+ },+ className: {+ control: false,+ description: "Additional CSS class name for custom styling",+ table: {+ category: "Styling",+ type: { summary: "string" },+ defaultValue: { summary: "undefined" },+ },+ },+ style: {+ control: false,+ description: "Inline CSS styles for custom styling",+ table: {+ category: "Styling",+ type: { summary: "CSSProperties" },+ defaultValue: { summary: "undefined" },+ },},},tags: ["autodocs"],@@ -27,11 +73,10 @@ export const FooterStory: Story = {variant: "horizontal",},render: (args) => (- <div style={{ width: "500px" }}>- <Footer variant={args.variant}>- <Button>Cancel</Button>- <Button>Save</Button>- </Footer>- </div>+ <Footer variant={args.variant}>+ <Button>Cancel</Button>+ <Button>Save</Button>+ <IconButton icon={<ArrowLeft size={16} />} />+ </Footer>),};diff --git a/frontend-sdk/packages/react-ui/src/components/FormControl/Hint/hint.scss b/frontend-sdk/packages/react-ui/src/components/FormControl/Hint/hint.scssindex bf0772f33..369b41409 100644--- a/frontend-sdk/packages/react-ui/src/components/FormControl/Hint/hint.scss+++ b/frontend-sdk/packages/react-ui/src/components/FormControl/Hint/hint.scss@@ -5,4 +5,7 @@box-sizing: border-box;@include cssUtils.typography(label, default);color: map.get(cssUtils.$colors, "text", "secondary");+ display: flex;+ align-items: center;+ gap: map.get(cssUtils.$spacing, "2xs");}diff --git a/frontend-sdk/packages/react-ui/src/components/FormControl/formControl.scss b/frontend-sdk/packages/react-ui/src/components/FormControl/formControl.scssindex 083e16f1a..ed94abc41 100644--- a/frontend-sdk/packages/react-ui/src/components/FormControl/formControl.scss+++ b/frontend-sdk/packages/react-ui/src/components/FormControl/formControl.scss@@ -1,5 +1,6 @@@use "sass:map";@use "../../cssUtils.scss" as cssUtils;+@forward "hint/hint.scss";.crayon-form-control {box-sizing: border-box;diff --git a/frontend-sdk/packages/react-ui/src/components/FormControl/index.ts b/frontend-sdk/packages/react-ui/src/components/FormControl/index.tsindex be0d9901b..37eda4e42 100644--- a/frontend-sdk/packages/react-ui/src/components/FormControl/index.ts+++ b/frontend-sdk/packages/react-ui/src/components/FormControl/index.ts@@ -1,3 +1,3 @@+export * from "../Label";export * from "./FormControl";export * from "./Hint";-export * from "./Label";diff --git a/frontend-sdk/packages/react-ui/src/components/FormControl/stories/FormControl.stories.tsx b/frontend-sdk/packages/react-ui/src/components/FormControl/stories/FormControl.stories.tsxindex 51d28023f..80c1f55ef 100644--- a/frontend-sdk/packages/react-ui/src/components/FormControl/stories/FormControl.stories.tsx+++ b/frontend-sdk/packages/react-ui/src/components/FormControl/stories/FormControl.stories.tsx@@ -1,10 +1,12 @@import type { Meta, StoryObj } from "@storybook/react";+import { Info } from "lucide-react";import { Input } from "../../Input";+import "../../Input/input.scss";+import { Label } from "../../Label";+import "../../Label/label.scss";import { FormControl } from "../FormControl";import { Hint } from "../Hint";import "../Hint/hint.scss";-import { Label } from "../Label";-import "../Label/label.scss";const meta: Meta<typeof FormControl> = {title: "Components/FormControl",@@ -13,56 +15,53 @@ const meta: Meta<typeof FormControl> = {parameters: {layout: "centered",},+ argTypes: {+ children: {+ control: false,+ description:+ "The child elements of the form control that accept Label, Input, and Hint components",+ table: {+ category: "Content",+ type: { summary: "ReactNode[] | ReactNode" },+ defaultValue: { summary: "undefined" },+ },+ },+ className: {+ control: false,+ description: "Additional CSS class name for custom styling",+ table: {+ category: "Styling",+ type: { summary: "string" },+ defaultValue: { summary: "undefined" },+ },+ },+ style: {+ control: false,+ description: "Inline CSS styles for custom styling",+ table: {+ category: "Styling",+ type: { summary: "CSSProperties" },+ defaultValue: { summary: "undefined" },+ },+ },+ },};export default meta;type Story = StoryObj<typeof FormControl>;-export const Basic: Story = {- args: {- children: <Input placeholder="Enter text..." />,- },-};-export const WithLabelAndHint: Story = {render: () => (<FormControl><Label>Username</Label><Input placeholder="Enter username" />- <Hint>Must be at least 4 characters long</Hint>+ <Hint>+ <Info size={14} /> Must be at least 4 characters long+ </Hint></FormControl>),};-export const WithCustomStyle: Story = {- args: {- children: (- <>- <Label htmlFor="email">Email</Label>- <Input placeholder="Enter email" id="email" type="email" />- <Hint>We'll never share your email</Hint>- </>- ),- style: {- width: "300px",- margin: "20px",- },- },-};--export const WithCustomClass: Story = {- args: {- children: (- <>- <Label htmlFor="password">Password</Label>- <Input type="password" placeholder="Enter password" id="password" />- <Hint>Use a strong password with mixed characters</Hint>- </>- ),- className: "custom-form-control",- },-};-export const WithMultipleChildren: Story = {render: () => (<FormControl>diff --git a/frontend-sdk/packages/react-ui/src/components/Header/Header.tsx b/frontend-sdk/packages/react-ui/src/components/Header/Header.tsxindex 661df3ea8..287cba9bd 100644--- a/frontend-sdk/packages/react-ui/src/components/Header/Header.tsx+++ b/frontend-sdk/packages/react-ui/src/components/Header/Header.tsx@@ -1,17 +1,17 @@import clsx from "clsx";-import React, { forwardRef } from "react";-import { Button } from "../Button";-import { IconButton } from "../IconButton";+import { cloneElement, CSSProperties, forwardRef, ReactElement, ReactNode } from "react";+import { ButtonProps } from "../Button";+import { IconButtonProps } from "../IconButton";export interface HeaderProps {- icon?: React.ReactNode;- title?: React.ReactNode;- subtitle?: React.ReactNode;+ icon?: ReactNode;+ title?: ReactNode;+ subtitle?: ReactNode;actions?:- | React.ReactElement<typeof Button | typeof IconButton>- | React.ReactElement<typeof Button | typeof IconButton>[];+ | ReactElement<ButtonProps | IconButtonProps>+ | ReactElement<ButtonProps | IconButtonProps>[];className?: string;- styles?: React.CSSProperties;+ styles?: CSSProperties;}export const Header = forwardRef<HTMLDivElement, HeaderProps>((props, ref) => {@@ -25,7 +25,7 @@ export const Header = forwardRef<HTMLDivElement, HeaderProps>((props, ref) => {</div><div className="crayon-header-top-right">{Array.isArray(actions)- ? actions.map((action, index) => React.cloneElement(action, { key: index }))+ ? actions.map((action, index) => cloneElement(action, { key: index })): actions}</div></div>diff --git a/frontend-sdk/packages/react-ui/src/components/Header/stories/header.stories.tsx b/frontend-sdk/packages/react-ui/src/components/Header/stories/header.stories.tsxindex ffa579eff..cb49c7017 100644--- a/frontend-sdk/packages/react-ui/src/components/Header/stories/header.stories.tsx+++ b/frontend-sdk/packages/react-ui/src/components/Header/stories/header.stories.tsx@@ -1,6 +1,7 @@import type { Meta, StoryObj } from "@storybook/react";import { ArrowRight, Download } from "lucide-react";import { IconButton } from "../../IconButton";+import "../../IconButton/iconButton.scss";import { Header } from "../Header";import "../header.scss";@@ -10,18 +11,67 @@ const meta: Meta<typeof Header> = {parameters: {layout: "centered",},+ decorators: [+ (Story) => (+ <div style={{ width: "350px" }}>+ <Story />+ </div>+ ),+ ],argTypes: {icon: {- control: "object",+ control: false,+ description: "The icon to display in the header beside the title",+ table: {+ category: "Content",+ type: { summary: "ReactNode" },+ defaultValue: { summary: "undefined" },+ },},title: {- control: "object",+ control: "text",+ description: "The title to display in the header",+ table: {+ category: "Content",+ type: { summary: "ReactNode" },+ defaultValue: { summary: "undefined" },+ },},subtitle: {- control: "object",+ control: "text",+ description: "The subtitle to display in the header",+ table: {+ category: "Content",+ type: { summary: "ReactNode" },+ defaultValue: { summary: "undefined" },+ },},actions: {- control: "object",+ control: false,+ description: "The actions to display in the header",+ table: {+ category: "Content",+ type: { summary: "ReactElement<ButtonProps | IconButtonProps>[]" },+ defaultValue: { summary: "undefined" },+ },+ },+ className: {+ control: false,+ description: "The class name to apply to the header",+ table: {+ category: "Styling",+ type: { summary: "string" },+ defaultValue: { summary: "undefined" },+ },+ },+ styles: {+ control: false,+ description: "Inline CSS styles for custom styling",+ table: {+ category: "Styling",+ type: { summary: "CSSProperties" },+ defaultValue: { summary: "undefined" },+ },},},tags: ["autodocs"],@@ -31,20 +81,16 @@ export default meta;type Story = StoryObj<typeof Header>;// Basic button stories-export const CardStory: Story = {+export const HeaderStory: Story = {args: {icon: <ArrowRight />,- title: "Crayon",- subtitle: "Crayon Heading",+ title: "Thesys Crayon",+ subtitle: "Crayon UI is a set of React components.",actions: [<IconButton variant="tertiary" size="extra-small" icon={<Download />} />,<IconButton variant="tertiary" size="extra-small" icon={<Download />} />,<IconButton variant="tertiary" size="extra-small" icon={<Download />} />,],},- render: (args) => (- <div style={{ width: "500px" }}>- <Header {...args} />- </div>- ),+ render: (args) => <Header {...args} />,};diff --git a/frontend-sdk/packages/react-ui/src/components/IconButton/IconButton.tsx b/frontend-sdk/packages/react-ui/src/components/IconButton/IconButton.tsxindex 56c59a971..2b7f29782 100644--- a/frontend-sdk/packages/react-ui/src/components/IconButton/IconButton.tsx+++ b/frontend-sdk/packages/react-ui/src/components/IconButton/IconButton.tsx@@ -1,23 +1,39 @@import clsx from "clsx";-import React from "react";+import { ButtonHTMLAttributes, forwardRef, ReactNode } from "react";-export type IconButtonVariant = "primary" | "secondary" | "tertiary";-export type IconButtonSize = "extra-small" | "small" | "medium" | "large";-export type IconButtonShape = "square" | "circle";+type IconButtonVariant = "primary" | "secondary" | "tertiary";+type IconButtonSize = "extra-small" | "small" | "medium" | "large";+type IconButtonShape = "square" | "circle";-export interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {- icon: React.ReactNode;+export interface IconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {+ icon: ReactNode;variant?: IconButtonVariant;size?: IconButtonSize;shape?: IconButtonShape;className?: string;- style?: React.CSSProperties;}-export const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>((props, ref) => {+const iconButtonVariants = {+ primary: "crayon-icon-button-primary",+ secondary: "crayon-icon-button-secondary",+ tertiary: "crayon-icon-button-tertiary",+} as const;++const iconButtonSizes = {+ "extra-small": "crayon-icon-button-extra-small",+ small: "crayon-icon-button-small",+ medium: "crayon-icon-button-medium",+ large: "crayon-icon-button-large",+} as const;++const iconButtonShapes = {+ square: "crayon-icon-button-square",+ circle: "crayon-icon-button-circle",+} as const;++export const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>((props, ref) => {const {className,- style,icon,variant = "primary",size = "medium",@@ -30,12 +46,11 @@ export const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>((ref={ref}className={clsx("crayon-icon-button",- `crayon-icon-button-${variant}`,- `crayon-icon-button-${size}`,- `crayon-icon-button-${shape}`,+ iconButtonVariants[variant],+ iconButtonSizes[size],+ iconButtonShapes[shape],className,)}- style={style}{...rest}>{icon && <span className="crayon-icon-button-icon">{icon}</span>}diff --git a/frontend-sdk/packages/react-ui/src/components/IconButton/stories/iconButton.stories.tsx b/frontend-sdk/packages/react-ui/src/components/IconButton/stories/iconButton.stories.tsxindex 911c81cb7..7268dbf32 100644--- a/frontend-sdk/packages/react-ui/src/components/IconButton/stories/iconButton.stories.tsx+++ b/frontend-sdk/packages/react-ui/src/components/IconButton/stories/iconButton.stories.tsx@@ -10,20 +10,62 @@ const meta: Meta<typeof IconButton> = {layout: "centered",},argTypes: {+ icon: {+ control: false,+ description: "The icon to display in the button",+ table: {+ category: "Content",+ type: { summary: "ReactNode" },+ defaultValue: { summary: "undefined" },+ },+ },variant: {control: "radio",options: ["primary", "secondary", "tertiary"],+ description: "The variant of the button",+ table: {+ category: "Appearance",+ type: { summary: "string" },+ defaultValue: { summary: "primary" },+ },},size: {control: "radio",options: ["extra-small", "small", "medium", "large"],+ description: "The size of the button",+ table: {+ category: "Appearance",+ type: { summary: "string" },+ defaultValue: { summary: "medium" },+ },},shape: {control: "radio",options: ["square", "circle"],+ description: "The shape of the button",+ table: {+ category: "Appearance",+ type: { summary: "string" },+ defaultValue: { summary: "square" },+ },},disabled: {control: "boolean",+ description: "Whether the button is disabled",+ table: {+ category: "Behavior",+ type: { summary: "boolean" },+ defaultValue: { summary: "false" },+ },+ },+ className: {+ control: false,+ description: "Additional CSS classes to apply to the button",+ table: {+ category: "Styling",+ type: { summary: "string" },+ defaultValue: { summary: "undefined" },+ },},},tags: ["autodocs"],@@ -33,13 +75,27 @@ export default meta;type Story = StoryObj<typeof IconButton>;// Basic button stories-export const ButtonStory: Story = {+export const PrimaryButton: Story = {args: {icon: <Download />,- variant: "primary",- size: "extra-small",- shape: "square",disabled: false,},render: (args) => <IconButton {...args} />,};++// Secondary button stories+export const SecondaryButton: Story = {+ args: {+ ...PrimaryButton.args,+ variant: "secondary",+ },+};++// Tertiary button stories+export const TertiaryButton: Story = {+ name: "Tertiary (Ghost)",+ args: {+ ...PrimaryButton.args,+ variant: "tertiary",+ },+};diff --git a/frontend-sdk/packages/react-ui/src/components/Image/Image.tsx b/frontend-sdk/packages/react-ui/src/components/Image/Image.tsxindex 37be1cac6..a47c476cc 100644--- a/frontend-sdk/packages/react-ui/src/components/Image/Image.tsx+++ b/frontend-sdk/packages/react-ui/src/components/Image/Image.tsx@@ -7,7 +7,7 @@ type ScaleType = "fit" | "fill";export interface ImageProps extends React.ImgHTMLAttributes<HTMLImageElement> {src: string;- alt: string;+ alt?: string;styles?: React.CSSProperties;className?: string;aspectRatio?: AspectRatioType;@@ -22,13 +22,18 @@ const aspectRatioMap: Record<AspectRatioType, number> = {"16:9": 16 / 9,};+const scaleMap: Record<ScaleType, string> = {+ fit: "crayon-image-fit",+ fill: "crayon-image-fill",+};+export const Image = forwardRef<HTMLImageElement, ImageProps>((props, ref) => {const { src, alt, styles, className, aspectRatio = "3:2", scale = "fit", ...rest } = props;const imageClasses = clsx(- "image",+ "crayon-image",{- [`image-${scale}`]: scale,+ [`${scaleMap[scale]}`]: scale,},className,);diff --git a/frontend-sdk/packages/react-ui/src/components/Image/image.scss b/frontend-sdk/packages/react-ui/src/components/Image/image.scssindex 5f673aa44..95ec90c8f 100644--- a/frontend-sdk/packages/react-ui/src/components/Image/image.scss+++ b/frontend-sdk/packages/react-ui/src/components/Image/image.scss@@ -1,7 +1,7 @@@use "sass:map";@use "../../cssUtils.scss" as cssUtils;-.image {+.crayon-image {display: flex;box-sizing: border-box;max-width: 100%;diff --git a/frontend-sdk/packages/react-ui/src/components/Image/stories/Image.stories.tsx b/frontend-sdk/packages/react-ui/src/components/Image/stories/Image.stories.tsxindex 54602c066..96cd9e88a 100644--- a/frontend-sdk/packages/react-ui/src/components/Image/stories/Image.stories.tsx+++ b/frontend-sdk/packages/react-ui/src/components/Image/stories/Image.stories.tsx@@ -1,5 +1,4 @@import { Meta, StoryObj } from "@storybook/react";-import { Card } from "../../Card";import { Image } from "../Image";import "../image.scss";@@ -11,11 +10,8 @@ const meta: Meta<typeof Image> = {(Story) => (<divstyle={{- maxWidth: 600,- margin: "20px auto",- padding: "20px",- backgroundColor: "#f5f5f5",- borderRadius: "8px",+ maxWidth: 400,+ margin: "auto",}}><Story />@@ -23,14 +19,53 @@ const meta: Meta<typeof Image> = {),],argTypes: {+ className: {+ control: false,+ description: "Additional CSS classes to apply to the image",+ table: {+ category: "Styling",+ },+ },+ styles: {+ control: false,+ description: "Additional CSS styles to apply to the image",+ table: {+ category: "Styling",+ },+ },aspectRatio: {control: "select",options: ["1:1", "3:2", "3:4", "4:3", "16:9"],description: "Uses Radix UI AspectRatio component",+ table: {+ category: "Appearance",+ type: { summary: "string" },+ defaultValue: { summary: "3:2" },+ },},scale: {control: "radio",options: ["fit", "fill"],+ description: "The scaling behavior of the image",+ table: {+ category: "Appearance",+ type: { summary: "string" },+ defaultValue: { summary: "fit" },+ },+ },+ src: {+ control: "text",+ description: "The source URL of the image",+ table: {+ category: "Content",+ },+ },+ alt: {+ control: "text",+ description: "The alternative text for the image",+ table: {+ category: "Content",+ },},},};@@ -42,41 +77,7 @@ export const Default: Story = {args: {src: "https://picsum.photos/800/600",alt: "Sample image",- },-};--export const WithScaleFill: Story = {- args: {- src: "https://picsum.photos/800/600",- alt: "Sample image with fill scaling",- aspectRatio: "1:1",- scale: "fill",- },-};--export const InCard: Story = {- render: (args) => (- <Card>- <Image {...args} />- <h3>Card Title</h3>- <p>This is how the image looks inside a card component.</p>- </Card>- ),- args: {- src: "https://picsum.photos/800/600",- alt: "Sample image in card",- aspectRatio: "16:9",- scale: "fill",- },-};--export const WithCustomStyles: Story = {- args: {- src: "https://picsum.photos/800/600",- alt: "Sample image with custom styles",- styles: {- border: "2px solid #000",- borderRadius: "8px",- },+ aspectRatio: "3:2",+ scale: "fit",},};diff --git a/frontend-sdk/packages/react-ui/src/components/Input/stories/Input.stories.tsx b/frontend-sdk/packages/react-ui/src/components/Input/stories/Input.stories.tsxindex 8efa58d24..35a301d9e 100644--- a/frontend-sdk/packages/react-ui/src/components/Input/stories/Input.stories.tsx+++ b/frontend-sdk/packages/react-ui/src/components/Input/stories/Input.stories.tsx@@ -1,17 +1,80 @@import { Meta, StoryObj } from "@storybook/react";+import { useState } from "react";import { Input } from "../Input";import "../input.scss";const meta: Meta<typeof Input> = {title: "Components/Input",component: Input,+ parameters: {+ layout: "centered",+ },+ decorators: [+ (Story) => (+ <div style={{ width: "400px" }}>+ <Story />+ </div>+ ),+ ],argTypes: {size: {control: "radio",options: ["small", "medium", "large"],+ description: "The size of the input",+ table: {+ category: "Appearance",+ type: { summary: "string" },+ defaultValue: { summary: "medium" },+ },},disabled: {control: "boolean",+ description: "Whether the input is disabled",+ table: {+ category: "Behavior",+ type: { summary: "boolean" },+ defaultValue: { summary: "false" },+ },+ },+ placeholder: {+ control: "text",+ description: "The placeholder text for the input",+ table: {+ category: "Content",+ type: { summary: "string" },+ defaultValue: { summary: "undefined" },+ },+ },+ value: {+ control: "text",+ description: "The value of the input",+ table: {+ category: "Content",+ type: { summary: "string" },+ defaultValue: { summary: "undefined" },+ },+ },+ onChange: {+ control: false,+ description: "The function to call when the input value changes",+ table: {+ category: "Behavior",+ type: { summary: "function" },+ },+ },+ styles: {+ control: false,+ description: "Additional CSS styles to apply to the input",+ table: {+ category: "Styling",+ },+ },+ className: {+ control: false,+ description: "Additional CSS classes to apply to the input",+ table: {+ category: "Styling",+ },},},tags: ["autodocs"],@@ -27,14 +90,43 @@ export const Default: Story = {disabled: false,},render: (args) => (- <Input size={args.size} placeholder={args.placeholder} disabled={args.disabled} />+ <Input+ size={args.size}+ placeholder={args.placeholder}+ disabled={args.disabled}+ value={args.value}+ onChange={args.onChange}+ />),};-export const WithValue: Story = {- args: {- size: "medium",- value: "Hello World",+const ControlledInput = () => {+ const [value, setValue] = useState<string | undefined>();++ return (+ <Input+ size="medium"+ value={value}+ onChange={(e) => setValue(e.target.value)}+ placeholder="Enter text..."+ />+ );+};++export const Controlled: Story = {+ render: () => <ControlledInput />,+ parameters: {+ docs: {+ source: {+ code: `+import { useState } from "react";++const ControlledInput = () => {+ const [value, setValue] = useState<string | undefined>();++ return <Input size="medium" value={value} onChange={(e) => setValue(e.target.value)} placeholder="Enter text..." />;+};`,+ },+ },},- render: (args) => <Input size={args.size} value={args.value} disabled={args.disabled} />,};diff --git a/frontend-sdk/packages/react-ui/src/components/FormControl/Label/Label.tsx b/frontend-sdk/packages/react-ui/src/components/Label/Label.tsxsimilarity index 65%rename from frontend-sdk/packages/react-ui/src/components/FormControl/Label/Label.tsxrename to frontend-sdk/packages/react-ui/src/components/Label/Label.tsxindex 9081888e3..758cc0e49 100644--- a/frontend-sdk/packages/react-ui/src/components/FormControl/Label/Label.tsx+++ b/frontend-sdk/packages/react-ui/src/components/Label/Label.tsx@@ -7,18 +7,26 @@ export interface LabelProps extends React.ComponentPropsWithoutRef<typeof LabelPclassName?: string;style?: React.CSSProperties;disabled?: boolean;+ required?: boolean;}const Label = forwardRef<HTMLLabelElement, LabelProps>(- ({ children, className, style, disabled, ...props }, ref) => {+ ({ children, className, style, disabled, required, ...props }, ref) => {return (<LabelPrimitive.Rootref={ref}- className={clsx("crayon-label", { "crayon-label-disabled": disabled }, className)}+ className={clsx(+ "crayon-label",+ {+ "crayon-label-disabled": disabled,+ },+ className,+ )}style={style}{...props}>{children}+ {required && <span className="crayon-label-required-asterisk">*</span>}</LabelPrimitive.Root>);},diff --git a/frontend-sdk/packages/react-ui/src/components/FormControl/Label/index.ts b/frontend-sdk/packages/react-ui/src/components/Label/index.tssimilarity index 100%rename from frontend-sdk/packages/react-ui/src/components/FormControl/Label/index.tsrename to frontend-sdk/packages/react-ui/src/components/Label/index.tsdiff --git a/frontend-sdk/packages/react-ui/src/components/FormControl/Label/label.scss b/frontend-sdk/packages/react-ui/src/components/Label/label.scsssimilarity index 86%rename from frontend-sdk/packages/react-ui/src/components/FormControl/Label/label.scssrename to frontend-sdk/packages/react-ui/src/components/Label/label.scssindex 32f2c701b..79031321a 100644--- a/frontend-sdk/packages/react-ui/src/components/FormControl/Label/label.scss+++ b/frontend-sdk/packages/react-ui/src/components/Label/label.scss@@ -1,5 +1,5 @@@use "sass:map";-@use "../../../cssUtils.scss" as cssUtils;+@use "../../cssUtils.scss" as cssUtils;.crayon-label {box-sizing: border-box;diff --git a/frontend-sdk/packages/react-ui/src/components/ListBlock/ListBlock.tsx b/frontend-sdk/packages/react-ui/src/components/ListBlock/ListBlock.tsxindex 4c79ad8e0..70356056c 100644--- a/frontend-sdk/packages/react-ui/src/components/ListBlock/ListBlock.tsx+++ b/frontend-sdk/packages/react-ui/src/components/ListBlock/ListBlock.tsx@@ -1,14 +1,14 @@import clsx from "clsx";-import React from "react";+import { CSSProperties, forwardRef, ReactElement } from "react";import { ListItemProps } from "../ListItem";export interface ListBlockProps {- children: React.ReactElement<ListItemProps> | React.ReactElement<ListItemProps>[];+ children: ReactElement<ListItemProps> | ReactElement<ListItemProps>[];className?: string;- style?: React.CSSProperties;+ style?: CSSProperties;}-const ListBlock = React.forwardRef<HTMLDivElement, ListBlockProps>((props, ref) => {+const ListBlock = forwardRef<HTMLDivElement, ListBlockProps>((props, ref) => {return (<div ref={ref} className={clsx("crayon-list-block", props.className)} style={props.style}>{props.children}diff --git a/frontend-sdk/packages/react-ui/src/components/ListBlock/stories/ListBlock.stories.tsx b/frontend-sdk/packages/react-ui/src/components/ListBlock/stories/ListBlock.stories.tsxindex 4195f89b2..f83d8dabb 100644--- a/frontend-sdk/packages/react-ui/src/components/ListBlock/stories/ListBlock.stories.tsx+++ b/frontend-sdk/packages/react-ui/src/components/ListBlock/stories/ListBlock.stories.tsx@@ -4,18 +4,54 @@ import { ListItem } from "../../ListItem";import "../../ListItem/listItem.scss";import { ListBlock } from "../ListBlock";import "../listBlock.scss";-const meta: Meta<typeof ListBlock> = {title: "Components/ListBlock",component: ListBlock,+ subcomponents: {+ ListItem: ListItem as any,+ },+ parameters: {+ layout: "centered",+ },+ decorators: [+ (Story) => (+ <div style={{ width: "400px" }}>+ <Story />+ </div>+ ),+ ],+ argTypes: {+ children: {+ control: false,+ description: "Accepts ListItem components as children",+ table: {+ category: "Content",+ type: { summary: "ListItemProps" },+ },+ },+ className: {+ control: false,+ description: "Additional CSS class name for custom styling",+ table: {+ category: "Appearance",+ },+ },+ style: {+ control: false,+ description: "Additional CSS style for custom styling",+ table: {+ category: "Appearance",+ },+ },+ },tags: ["autodocs"],};export default meta;type Story = StoryObj<typeof ListBlock>;-export const Default: Story = {- render: () => (+export const ListBlockWithItems: Story = {+ render: (args) => (<ListBlock><ListItemdecorativeIcon={<User size={16} />}@@ -31,32 +67,10 @@ export const Default: Story = {/><ListItemdecorativeIcon={<Mail size={16} />}- title="Simple Item"- subtitle="Without icons"+ title="Ankit Das"+ subtitle="Software Developer"actionIcon={<ChevronRight size={16} />}/></ListBlock>),};--export const SingleItem: Story = {- render: () => (- <ListBlock>- <ListItem- decorativeIcon={<User size={16} />}- title="Single Item"- subtitle="With icons"- actionIcon={<ChevronRight size={16} />}- />- </ListBlock>- ),-};--export const NoIcons: Story = {- render: () => (- <ListBlock>- <ListItem title="First Item" subtitle="Description here" />- <ListItem title="Second Item" subtitle="Another description" />- </ListBlock>- ),-};diff --git a/frontend-sdk/packages/react-ui/src/components/ListItem/ListItem.tsx b/frontend-sdk/packages/react-ui/src/components/ListItem/ListItem.tsxindex f43b2ea7f..918cd5e31 100644--- a/frontend-sdk/packages/react-ui/src/components/ListItem/ListItem.tsx+++ b/frontend-sdk/packages/react-ui/src/components/ListItem/ListItem.tsx@@ -1,13 +1,13 @@import clsx from "clsx";-import React from "react";+import React, { CSSProperties, ReactNode } from "react";export interface ListItemProps {className?: string;- style?: React.CSSProperties;- decorativeIcon?: React.ReactNode;- title?: React.ReactNode;- subtitle?: React.ReactNode;- actionIcon?: React.ReactNode;+ style?: CSSProperties;+ decorativeIcon?: ReactNode;+ title?: ReactNode;+ subtitle?: ReactNode;+ actionIcon?: ReactNode;onClick?: () => void;}diff --git a/frontend-sdk/packages/react-ui/src/components/ListItem/stories/ListItem.stories.tsx b/frontend-sdk/packages/react-ui/src/components/ListItem/stories/ListItem.stories.tsxindex 367929af6..b49a5aef9 100644--- a/frontend-sdk/packages/react-ui/src/components/ListItem/stories/ListItem.stories.tsx+++ b/frontend-sdk/packages/react-ui/src/components/ListItem/stories/ListItem.stories.tsx@@ -1,5 +1,5 @@import type { Meta, StoryObj } from "@storybook/react";-import { ChevronRight, Mail, User } from "lucide-react";+import { ChevronRight, Mail } from "lucide-react";import { ListItem } from "../ListItem";import "../listItem.scss";@@ -12,76 +12,69 @@ const meta: Meta<typeof ListItem> = {},argTypes: {decorativeIcon: {- control: "select",- options: ["Mail", "User", "none"],- mapping: {- Mail: Mail,- User: User,- none: undefined,+ control: false,+ description: "The decorative icon to display above the title",+ table: {+ category: "Content",+ type: { summary: "ReactNode" },+ },+ },+ title: {+ control: "text",+ description: "The main title text of the list item",+ table: {+ category: "Content",+ type: { summary: "ReactNode" },+ },+ },+ subtitle: {+ control: "text",+ description: "The secondary text of the list item",+ table: {+ category: "Content",+ type: { summary: "ReactNode" },},},actionIcon: {- control: "select",- options: ["ChevronRight", "none"],- mapping: {- ChevronRight: ChevronRight,- none: undefined,+ control: false,+ description: "The action icon to display on the right side of the list item",+ table: {+ category: "Content",+ type: { summary: "ReactNode" },+ },+ },+ onClick: {+ control: false,+ description: "The function to call when the list item is clicked",+ table: {+ category: "Behavior",+ type: { summary: "function" },+ },+ },+ className: {+ control: false,+ description: "Additional CSS class name for custom styling",+ table: {+ category: "Appearance",+ },+ },+ style: {+ control: false,+ description: "Additional CSS style for custom styling",+ table: {+ category: "Appearance",},},- onClick: { action: "clicked" },},};export default meta;type Story = StoryObj<typeof ListItem>;-export const Default: Story = {- args: {- title: "List Item Title",- subtitle: "Subtitle text goes here",- decorativeIcon: <Mail size={16} />,- actionIcon: <ChevronRight size={16} />,- },-};--export const WithoutIcons: Story = {+export const ListItemStory: Story = {args: {title: "List Item Title",subtitle: "Subtitle text goes here",- },-};--export const OnlyDecorativeIcon: Story = {- args: {- title: "List Item with Icon",- subtitle: "Has only decorative icon",- decorativeIcon: <User size={16} />,- },-};--export const OnlyActionIcon: Story = {- args: {- title: "List Item with Action",- subtitle: "Has only action icon",- actionIcon: <ChevronRight size={16} />,- },-};--export const TitleOnly: Story = {- args: {- title: "Title Only List Item",- },-};--// Example of how to render title and subtitle with custom styling-export const CustomStyling: Story = {- args: {- title: <div style={{ fontWeight: "bold", color: "#333" }}>Custom Styled Title</div>,- subtitle: (- <div style={{ fontSize: "0.875rem", color: "#666" }}>- Custom styled subtitle with different color and size- </div>- ),decorativeIcon: <Mail size={16} />,actionIcon: <ChevronRight size={16} />,},diff --git a/frontend-sdk/packages/react-ui/src/components/RadioGroup/RadioGroup.tsx b/frontend-sdk/packages/react-ui/src/components/RadioGroup/RadioGroup.tsxindex 6c6c9c8b3..02c909af0 100644--- a/frontend-sdk/packages/react-ui/src/components/RadioGroup/RadioGroup.tsx+++ b/frontend-sdk/packages/react-ui/src/components/RadioGroup/RadioGroup.tsx@@ -1,21 +1,28 @@import * as Radio from "@radix-ui/react-radio-group";import clsx from "clsx";-import { forwardRef } from "react";+import { CSSProperties, forwardRef, ReactElement } from "react";import { RadioItemProps } from "../RadioItem";+type RadioGroupVariant = "clear" | "card" | "sunk";interface RadioGroupProps extends Radio.RadioGroupProps {- children: React.ReactElement<RadioItemProps>;- variant?: "clear" | "card" | "sunk";+ children: ReactElement<RadioItemProps> | ReactElement<RadioItemProps>[];+ variant?: RadioGroupVariant;className?: string;- style?: React.CSSProperties;+ style?: CSSProperties;}+const variants: Record<RadioGroupVariant, string> = {+ clear: "crayon-radio-group-clear",+ card: "crayon-radio-group-card",+ sunk: "crayon-radio-group-sunk",+};+const RadioGroup = forwardRef<HTMLDivElement, RadioGroupProps>((props, ref) => {const { children, className, style, variant = "clear", ...rest } = props;return (<Radio.Rootref={ref}- className={clsx("crayon-radio-group", `crayon-radio-group-${variant}`, className)}+ className={clsx("crayon-radio-group", variants[variant], className)}style={style}{...rest}>diff --git a/frontend-sdk/packages/react-ui/src/components/RadioGroup/index.ts b/frontend-sdk/packages/react-ui/src/components/RadioGroup/index.tsindex e69de29bb..da254de29 100644--- a/frontend-sdk/packages/react-ui/src/components/RadioGroup/index.ts+++ b/frontend-sdk/packages/react-ui/src/components/RadioGroup/index.ts@@ -0,0 +1 @@+export * from "./RadioGroup";diff --git a/frontend-sdk/packages/react-ui/src/components/RadioGroup/radioGroup.scss b/frontend-sdk/packages/react-ui/src/components/RadioGroup/radioGroup.scssindex 51cf964a6..28e27b03c 100644--- a/frontend-sdk/packages/react-ui/src/components/RadioGroup/radioGroup.scss+++ b/frontend-sdk/packages/react-ui/src/components/RadioGroup/radioGroup.scss@@ -5,7 +5,7 @@box-sizing: border-box;display: flex;flex-direction: column;- gap: map.get(cssUtils.$spacing, "2xs");+ gap: map.get(cssUtils.$spacing, "s");border: 1px solid;border-radius: map.get(cssUtils.$radius, "m");diff --git a/frontend-sdk/packages/react-ui/src/components/RadioGroup/stories/RadioGroup.stories.tsx b/frontend-sdk/packages/react-ui/src/components/RadioGroup/stories/RadioGroup.stories.tsxindex 9f0a1dc8c..2787b66ac 100644--- a/frontend-sdk/packages/react-ui/src/components/RadioGroup/stories/RadioGroup.stories.tsx+++ b/frontend-sdk/packages/react-ui/src/components/RadioGroup/stories/RadioGroup.stories.tsx@@ -1,5 +1,5 @@import type { Meta, StoryObj } from "@storybook/react";-import "../../FormControl/Label/label.scss";+import "../../Label/label.scss";import { RadioItem } from "../../RadioItem";import "../../RadioItem/radioItem.scss";import { RadioGroup } from "../RadioGroup";@@ -8,9 +8,53 @@ import "../radioGroup.scss";const meta: Meta<typeof RadioGroup> = {title: "Components/RadioGroup",component: RadioGroup,+ subcomponents: {+ RadioItem: RadioItem as any,+ },parameters: {layout: "centered",},+ decorators: [+ (Story) => (+ <div style={{ width: "350px" }}>+ <Story />+ </div>+ ),+ ],+ argTypes: {+ variant: {+ control: "select",+ options: ["clear", "card", "sunk"],+ description: "The variant of the radio group",+ table: {+ category: "Appearance",+ type: { summary: "string" },+ defaultValue: { summary: "clear" },+ },+ },+ children: {+ control: false,+ description: "The children of the radio group",+ table: {+ category: "Content",+ type: { summary: "RadioItemProps[]| RadioItemProps" },+ },+ },+ className: {+ control: false,+ description: "Additional CSS class name for custom styling",+ table: {+ category: "Styling",+ },+ },+ style: {+ control: false,+ description: "Additional CSS style for custom styling",+ table: {+ category: "Styling",+ },+ },+ },tags: ["autodocs"],};@@ -19,67 +63,38 @@ type Story = StoryObj<typeof RadioGroup>;export const Default: Story = {args: {- defaultValue: "option1",- children: (- <>- <RadioItem value="option1" label="Option 1" />- <RadioItem value="option2" label="Option 2" />- <RadioItem value="option3" label="Option 3" />- </>- ),+ variant: "clear",},+ render: (args) => (+ <RadioGroup {...args}>+ <RadioItem value="option1" label="Option 1" />+ <RadioItem value="option2" label="Option 2" />+ <RadioItem value="option3" label="Option 3" />+ </RadioGroup>+ ),};--export const CardVariant: Story = {+export const Card: Story = {args: {variant: "card",- defaultValue: "option1",- children: (- <>- <RadioItem value="option1" label="Option 1" />- <RadioItem value="option2" label="Option 2" />- <RadioItem value="option3" label="Option 3" />- </>- ),},+ render: (args) => (+ <RadioGroup {...args}>+ <RadioItem value="option1" label="Option 1" />+ <RadioItem value="option2" label="Option 2" />+ <RadioItem value="option3" label="Option 3" />+ </RadioGroup>+ ),};-export const SunkVariant: Story = {+export const Sunk: Story = {args: {variant: "sunk",- defaultValue: "option1",- children: (- <>- <RadioItem value="option1" label="Option 1" />- <RadioItem value="option2" label="Option 2" />- <RadioItem value="option3" label="Option 3" />- </>- ),- },-};--export const WithDisabledOption: Story = {- args: {- defaultValue: "option1",- children: (- <>- <RadioItem value="option1" label="Option 1" />- <RadioItem value="option2" label="Option 2" disabled />- <RadioItem value="option3" label="Option 3" />- </>- ),- },-};--export const WithDescription: Story = {- args: {- defaultValue: "option1",- children: (- <>- <RadioItem value="option1" label="Option 1" />- <RadioItem value="option2" label="Option 2" />- <RadioItem value="option3" label="Option 3" />- </>- ),},+ render: (args) => (+ <RadioGroup {...args}>+ <RadioItem value="option1" label="Option 1" />+ <RadioItem value="option2" label="Option 2" />+ <RadioItem value="option3" label="Option 3" />+ </RadioGroup>+ ),};diff --git a/frontend-sdk/packages/react-ui/src/components/RadioItem/RadioItem.tsx b/frontend-sdk/packages/react-ui/src/components/RadioItem/RadioItem.tsxindex bb083769d..e26fddf1c 100644--- a/frontend-sdk/packages/react-ui/src/components/RadioItem/RadioItem.tsx+++ b/frontend-sdk/packages/react-ui/src/components/RadioItem/RadioItem.tsx@@ -1,12 +1,12 @@import * as Radio from "@radix-ui/react-radio-group";import clsx from "clsx";-import React, { forwardRef, useId } from "react";-import { Label } from "../FormControl/Label";+import { CSSProperties, forwardRef, ReactNode, useId } from "react";+import { Label } from "../Label";export interface RadioItemProps {- label?: React.ReactNode;+ label?: ReactNode;className?: string;- style?: React.CSSProperties;+ style?: CSSProperties;disabled?: boolean;required?: boolean;value: string;@@ -51,7 +51,12 @@ const RadioItem = forwardRef<HTMLButtonElement, RadioItemProps>((props, ref) =></svg></Radio.Item>{label && (- <Label htmlFor={id} className="crayon-radio-item-label" disabled={disabled}>+ <Label+ htmlFor={id}+ className="crayon-radio-item-label"+ disabled={disabled}+ required={required}+ >{label}</Label>)}diff --git a/frontend-sdk/packages/react-ui/src/components/RadioItem/stories/RadioItem.stories.tsx b/frontend-sdk/packages/react-ui/src/components/RadioItem/stories/RadioItem.stories.tsxindex bf220b133..5c2ba14b9 100644--- a/frontend-sdk/packages/react-ui/src/components/RadioItem/stories/RadioItem.stories.tsx+++ b/frontend-sdk/packages/react-ui/src/components/RadioItem/stories/RadioItem.stories.tsx@@ -1,6 +1,6 @@import * as Radio from "@radix-ui/react-radio-group";import type { Meta, StoryObj } from "@storybook/react";-import "../../FormControl/Label/label.scss";+import "../../Label/label.scss";import { RadioItem } from "../RadioItem";import "../radioItem.scss";@@ -12,11 +12,67 @@ const meta: Meta<typeof RadioItem> = {},decorators: [(Story) => (- <Radio.Root defaultValue="default">+ <Radio.Root><Story /></Radio.Root>),],+ argTypes: {+ value: {+ control: "text",+ description: "The value of the radio item",+ table: {+ category: "Property",+ type: { summary: "string" },+ defaultValue: { summary: "undefined" },+ },+ },+ label: {+ control: "text",+ description: "The label of the radio item",+ table: {+ category: "Content",+ type: { summary: "string" },+ defaultValue: { summary: "undefined" },+ },+ },+ required: {+ control: "boolean",+ description: "Whether the radio item is required",+ table: {+ category: "Property",+ type: { summary: "boolean" },+ defaultValue: { summary: "false" },+ },+ },+ disabled: {+ control: "boolean",+ description: "Whether the radio item is disabled",+ table: {+ category: "Property",+ type: { summary: "boolean" },+ defaultValue: { summary: "false" },+ },+ },+ className: {+ control: false,+ description: "Additional CSS class name for custom styling",+ table: {+ category: "Styling",+ defaultValue: { summary: "undefined" },+ type: { summary: "string" },+ },+ },+ style: {+ control: false,+ description: "Additional CSS style for custom styling",+ table: {+ category: "Styling",+ defaultValue: { summary: "undefined" },+ type: { summary: "CSSProperties" },+ },+ },+ },tags: ["autodocs"],};@@ -26,49 +82,8 @@ type Story = StoryObj<typeof RadioItem>;export const Default: Story = {args: {value: "default",- },-};--export const WithLabel: Story = {- args: {- value: "with-label",- label: "Radio Option",- },-};--export const Disabled: Story = {- args: {- value: "disabled",- label: "Disabled Option",- disabled: true,- },-};--export const Required: Story = {- args: {- value: "required",- label: "Required Option",- required: true,- },-};--export const MultipleOptions: Story = {- render: () => (- <Radio.Root defaultValue="option1">- <div style={{ display: "flex", flexDirection: "column", gap: "8px" }}>- <RadioItem value="option1" label="Option 1" />- <RadioItem value="option2" label="Option 2" />- <RadioItem value="option3" label="Option 3" />- </div>- </Radio.Root>- ),-};--export const CustomStyling: Story = {- args: {- value: "custom",- label: "Custom Styled Option",- className: "custom-radio",- style: { marginLeft: "16px" },+ label: "Default",+ required: false,+ disabled: false,},};diff --git a/frontend-sdk/packages/react-ui/src/components/Select/Select.tsx b/frontend-sdk/packages/react-ui/src/components/Select/Select.tsxindex 8852576d5..158f488a2 100644--- a/frontend-sdk/packages/react-ui/src/components/Select/Select.tsx+++ b/frontend-sdk/packages/react-ui/src/components/Select/Select.tsx@@ -18,6 +18,12 @@ export interface SelectTriggerPropssize?: "sm" | "md" | "lg";}+const sizeMap: Record<string, string> = {+ sm: "crayon-select-trigger-sm",+ md: "crayon-select-trigger-md",+ lg: "crayon-select-trigger-lg",+};+export const SelectTrigger = forwardRef<React.ComponentRef<typeof SelectPrimitive.Trigger>,SelectTriggerProps@@ -52,6 +58,7 @@ export const SelectContent = forwardRef<ref={ref}className={clsx("crayon-select-content", className)}position={position}+ sideOffset={2}{...props}><SelectPrimitive.Viewport className="crayon-select-viewport" data-position={position}>diff --git a/frontend-sdk/packages/react-ui/src/components/Select/select.scss b/frontend-sdk/packages/react-ui/src/components/Select/select.scssindex b8b547423..6a31d47c0 100644--- a/frontend-sdk/packages/react-ui/src/components/Select/select.scss+++ b/frontend-sdk/packages/react-ui/src/components/Select/select.scss@@ -3,7 +3,7 @@.crayon-select-trigger {box-sizing: border-box;- background-color: map.get(cssUtils.$colors, "fills", "background");+ background-color: map.get(cssUtils.$colors, "fills", "container");color: map.get(cssUtils.$colors, "text", "primary");@include cssUtils.typography(label, default);border: 1px solid map.get(cssUtils.$colors, "strokes", "default");@@ -35,7 +35,7 @@&-sm {padding: map.get(cssUtils.$spacing, "2xs") map.get(cssUtils.$spacing, "s");- border-radius: map.get(cssUtils.$radius, "2xs");+ border-radius: map.get(cssUtils.$radius, "xs");}&-md {padding: map.get(cssUtils.$spacing, "xs") map.get(cssUtils.$spacing, "s");@@ -43,7 +43,7 @@}&-lg {padding: map.get(cssUtils.$spacing, "s");- border-radius: map.get(cssUtils.$radius, "s");+ border-radius: map.get(cssUtils.$radius, "xs");}&-icon {height: 16px;@@ -59,8 +59,10 @@min-width: var(--radix-select-trigger-width);overflow: hidden;border-radius: map.get(cssUtils.$radius, "m");- background-color: map.get(cssUtils.$colors, "fills", "background");+ background-color: map.get(cssUtils.$colors, "fills", "container");+ border: 1px solid map.get(cssUtils.$colors, "strokes", "default");box-shadow: map.get(cssUtils.$shadow, "m");+ color: map.get(cssUtils.$colors, "text", "primary");}.crayon-select-viewport {@@ -117,13 +119,13 @@&:focus {background-color: map.get(cssUtils.$colors, "fills", "sunk");color: map.get(cssUtils.$colors, "text", "accent-foreground");- outline: 1px solid map.get(cssUtils.$colors, "strokes", "sunk");+ outline: 1px solid map.get(cssUtils.$colors, "strokes", "interactive-el");outline-offset: -1px;}&[data-state="checked"] {background-color: map.get(cssUtils.$colors, "fills", "sunk");- outline: 1px solid map.get(cssUtils.$colors, "strokes", "sunk");+ outline: 1px solid map.get(cssUtils.$colors, "strokes", "interactive-el");outline-offset: -1px;}@@ -138,7 +140,6 @@&-check-icon {height: 16px;width: 16px;- color: aliceblue;}// Text content@@ -157,5 +158,5 @@box-sizing: border-box;margin: 4px -4px;height: 1px;- border-top: 1px solid map.get(cssUtils.$colors, "strokes", "primary-el");+ border-top: 1px solid map.get(cssUtils.$colors, "strokes", "default");}diff --git a/frontend-sdk/packages/react-ui/src/components/Select/stories/select.stories.tsx b/frontend-sdk/packages/react-ui/src/components/Select/stories/select.stories.tsxindex 96cfdff51..a5706693e 100644--- a/frontend-sdk/packages/react-ui/src/components/Select/stories/select.stories.tsx+++ b/frontend-sdk/packages/react-ui/src/components/Select/stories/select.stories.tsx@@ -1,4 +1,4 @@-import type { Meta } from "@storybook/react";+import type { Meta, StoryObj } from "@storybook/react";import {Select,SelectContent,@@ -11,29 +11,82 @@ import {} from "../Select";import "../select.scss";-type SelectProps = React.ComponentProps<typeof Select | typeof SelectTrigger>;+interface SelectStoryProps {+ size?: "sm" | "md" | "lg";+ showTick?: boolean;+ hideDropdownIcon?: boolean;+ placeholder?: string;+}-const meta: Meta<SelectProps> = {+const meta: Meta<SelectStoryProps> = {title: "Components/Select",- args: {- size: "lg",+ component: Select as any,+ tags: ["autodocs"],+ parameters: {+ layout: "centered",},+ decorators: [+ (Story) => (+ <div style={{ width: "240px" }}>+ <Story />+ </div>+ ),+ ],argTypes: {size: {- control: { type: "select" },- options: ["lg", "md", "sm"],+ control: "radio",+ options: ["sm", "md", "lg"],+ description: "The size of the select trigger",+ table: {+ type: { summary: "string" },+ defaultValue: { summary: "md" },+ },+ },+ showTick: {+ control: "boolean",+ description: "Whether to show the tick icon for selected items",+ table: {+ type: { summary: "boolean" },+ defaultValue: { summary: "true" },+ },+ },+ hideDropdownIcon: {+ control: "boolean",+ description: "Whether to hide the dropdown icon in the trigger",+ table: {+ type: { summary: "boolean" },+ defaultValue: { summary: "false" },+ },+ },+ placeholder: {+ control: "text",+ description: "Placeholder text for the select",+ table: {+ type: { summary: "string" },+ defaultValue: { summary: "undefined" },+ },},},- tags: ["autodocs"],};export default meta;+type Story = StoryObj<SelectStoryProps>;-export const SelectDemo = (args: any) => {- return (+export const Basic: Story = {+ args: {+ size: "md",+ showTick: true,+ hideDropdownIcon: false,+ placeholder: "Select an option",+ },+ render: (args) => (<Select>- <SelectTrigger style={{ width: "228px" }} size={args.size}>- <SelectValue placeholder="Select a fruit" />+ <SelectTrigger+ style={{ width: "228px" }}+ hideDropdownIcon={args.hideDropdownIcon}+ size={args.size}+ >+ <SelectValue placeholder={args.placeholder} /></SelectTrigger><SelectContent><SelectGroup>@@ -55,5 +108,5 @@ export const SelectDemo = (args: any) => {</SelectGroup></SelectContent></Select>- );+ ),};diff --git a/frontend-sdk/packages/react-ui/src/components/Slider/stories/slider.stories.tsx b/frontend-sdk/packages/react-ui/src/components/Slider/stories/slider.stories.tsxindex d966a7428..4dc5400d5 100644--- a/frontend-sdk/packages/react-ui/src/components/Slider/stories/slider.stories.tsx+++ b/frontend-sdk/packages/react-ui/src/components/Slider/stories/slider.stories.tsx@@ -1,14 +1,72 @@import type { Meta, StoryObj } from "@storybook/react";-import Slider from "../Slider";+import { Slider, SliderProps } from "../Slider";import "../slider.scss";-const meta = {+const meta: Meta<SliderProps> = {title: "Components/Slider",component: Slider,parameters: {layout: "centered",},tags: ["autodocs"],+ argTypes: {+ variant: {+ control: "radio",+ options: ["continuous", "discrete", "range"],+ description:+ "The type of slider - continuous for smooth sliding, discrete for stepped values, or range for selecting a range",+ defaultValue: "continuous",+ },+ min: {+ control: "number",+ description: "Minimum value of the slider",+ defaultValue: 0,+ },+ max: {+ control: "number",+ description: "Maximum value of the slider",+ defaultValue: 100,+ },+ step: {+ control: "number",+ description: "Step increment (required for discrete variant)",+ defaultValue: 1,+ },+ disabled: {+ control: "boolean",+ description: "Whether the slider is disabled",+ table: {+ type: { summary: "boolean" },+ defaultValue: { summary: "true" },+ },+ },+ value: {+ control: false,+ description:+ "Current value(s) of the slider. Single number for continuous/discrete, array of two numbers for range",+ },+ className: {+ control: "text",+ description: "Additional CSS class names",+ table: {+ disable: true,+ },+ },+ style: {+ control: "object",+ description: "Additional inline styles",+ table: {+ disable: true,+ },+ },+ },+ decorators: [+ (Story) => (+ <div style={{ width: "400px", padding: "2rem" }}>+ <Story />+ </div>+ ),+ ],} satisfies Meta<typeof Slider>;export default meta;@@ -21,7 +79,15 @@ export const Continuous: Story = {max: 100,step: 1,value: [50],- onValueChange: (value) => console.log(value),+ onValueChange: (value) => console.log("Value changed:", value),+ disabled: false,+ },+ parameters: {+ docs: {+ description: {+ story: "A continuous slider allows smooth, precise value selection across its range.",+ },+ },},};@@ -32,7 +98,15 @@ export const Discrete: Story = {max: 100,step: 10,value: [50],- onValueChange: (value) => console.log(value),+ onValueChange: (value) => console.log("Value changed:", value),+ },+ parameters: {+ docs: {+ description: {+ story:+ "A discrete slider shows step markers and snaps to specific values. Useful for selecting from predefined options.",+ },+ },},};@@ -43,8 +117,32 @@ export const Range: Story = {max: 100,step: 1,value: [25, 75],- defaultValue: [25, 75],- onValueChange: (value) => console.log(value),+ onValueChange: (value) => console.log("Range changed:", value),+ },+ parameters: {+ docs: {+ description: {+ story: "A range slider allows selection of a value range using two handles.",+ },+ },+ },+};++export const SmallSteps: Story = {+ args: {+ variant: "discrete",+ min: 0,+ max: 1,+ step: 0.1,+ value: [0.5],+ onValueChange: (value) => console.log("Value changed:", value),+ },+ parameters: {+ docs: {+ description: {+ story: "Slider configured with small decimal steps, useful for precise value selection.",+ },+ },},};@@ -56,6 +154,31 @@ export const Disabled: Story = {step: 1,disabled: true,value: [50],- onValueChange: (value) => console.log(value),+ onValueChange: (value) => console.log("Value changed:", value),+ },+ parameters: {+ docs: {+ description: {+ story: "A disabled slider prevents user interaction and shows a visual disabled state.",+ },+ },+ },+};++export const CustomRange: Story = {+ args: {+ variant: "continuous",+ min: -50,+ max: 50,+ step: 5,+ value: [0],+ onValueChange: (value) => console.log("Value changed:", value),+ },+ parameters: {+ docs: {+ description: {+ story: "A slider with a custom range, including negative values.",+ },+ },},};diff --git a/frontend-sdk/packages/react-ui/src/components/SwitchGroup/SwitchGroup.tsx b/frontend-sdk/packages/react-ui/src/components/SwitchGroup/SwitchGroup.tsxindex 5a127192c..554141643 100644--- a/frontend-sdk/packages/react-ui/src/components/SwitchGroup/SwitchGroup.tsx+++ b/frontend-sdk/packages/react-ui/src/components/SwitchGroup/SwitchGroup.tsx@@ -1,20 +1,27 @@import clsx from "clsx";-import React, { forwardRef } from "react";+import { CSSProperties, forwardRef, ReactElement } from "react";import { SwitchItemProps } from "../SwitchItem";+type SwitchGroupVariant = "clear" | "card" | "sunk";export interface SwitchGroupProps {- children: React.ReactElement<SwitchItemProps> | React.ReactElement<SwitchItemProps>[];+ children: ReactElement<SwitchItemProps> | ReactElement<SwitchItemProps>[];className?: string;- style?: React.CSSProperties;- variant?: "clear" | "card" | "sunk";+ style?: CSSProperties;+ variant?: SwitchGroupVariant;}+const variants: Record<SwitchGroupVariant, string> = {+ clear: "crayon-switch-group-clear",+ card: "crayon-switch-group-card",+ sunk: "crayon-switch-group-sunk",+};+const SwitchGroup = forwardRef<HTMLDivElement, SwitchGroupProps>((props, ref) => {const { children, className, style, variant = "clear" } = props;return (<divref={ref}- className={clsx("crayon-switch-group", `crayon-switch-group-${variant}`, className)}+ className={clsx("crayon-switch-group", variants[variant], className)}style={style}>{children}diff --git a/frontend-sdk/packages/react-ui/src/components/SwitchGroup/stories/SwitchGroup.stories.tsx b/frontend-sdk/packages/react-ui/src/components/SwitchGroup/stories/SwitchGroup.stories.tsxindex 0d7e2bd4b..b163cf2b6 100644--- a/frontend-sdk/packages/react-ui/src/components/SwitchGroup/stories/SwitchGroup.stories.tsx+++ b/frontend-sdk/packages/react-ui/src/components/SwitchGroup/stories/SwitchGroup.stories.tsx@@ -1,5 +1,5 @@import { Meta, StoryObj } from "@storybook/react";-import "../../FormControl/Label/Label.scss";+import "../../Label/Label.scss";import { SwitchItem } from "../../SwitchItem";import "../../SwitchItem/switchItem.scss";import { SwitchGroup } from "../SwitchGroup";@@ -8,55 +8,66 @@ import "../switchGroup.scss";const meta: Meta<typeof SwitchGroup> = {title: "Components/SwitchGroup",component: SwitchGroup,+ subcomponents: {+ SwitchItem: SwitchItem as any,+ },+ parameters: {+ layout: "centered",+ },+ decorators: [+ (Story) => (+ <div style={{ width: "350px" }}>+ <Story />+ </div>+ ),+ ],+ argTypes: {+ variant: {+ control: "select",+ options: ["clear", "card", "sunk"],+ defaultValue: "clear",+ description: "The variant of the switch group",+ table: {+ category: "Appearance",+ type: { summary: "string" },+ defaultValue: { summary: "clear" },+ },+ },+ children: {+ control: false,+ description: "Accepts SwitchItem components",+ table: {+ category: "Content",+ type: { summary: "SwitchItemProps[]| SwitchItemProps" },+ },+ },+ className: {+ control: false,+ description: "Additional CSS class name for custom styling",+ table: {+ category: "Styling",+ },+ },+ style: {+ control: false,+ description: "Additional CSS style for custom styling",+ table: {+ category: "Styling",+ },+ },+ },tags: ["autodocs"],};export default meta;type Story = StoryObj<typeof SwitchGroup>;-export const Default: Story = {- render: () => (- <SwitchGroup>- <SwitchItem value="option1" label="Option 1" />- <SwitchItem value="option2" label="Option 2" />- <SwitchItem value="option3" label="Option 3" />- </SwitchGroup>- ),-};--export const CardVariant: Story = {- render: () => (- <SwitchGroup variant="card">- <SwitchItem value="option1" label="Option 1" />- <SwitchItem value="option2" label="Option 2" />- <SwitchItem value="option3" label="Option 3" />- </SwitchGroup>- ),-};--export const SunkVariant: Story = {- render: () => (- <SwitchGroup variant="sunk">- <SwitchItem value="option1" label="Option 1" />- <SwitchItem value="option2" label="Option 2" />- <SwitchItem value="option3" label="Option 3" />- </SwitchGroup>- ),-};--export const WithCustomClassName: Story = {- render: () => (- <SwitchGroup className="custom-class">- <SwitchItem value="option1" label="Option 1" />- <SwitchItem value="option2" label="Option 2" />- <SwitchItem value="option3" label="Option 3" />- </SwitchGroup>- ),-};--export const WithCustomStyle: Story = {- render: () => (- <SwitchGroup style={{ maxWidth: "300px", margin: "20px" }}>+export const SwitchGroupStory: Story = {+ args: {+ variant: "clear",+ },+ render: (args) => (+ <SwitchGroup {...args}><SwitchItem value="option1" label="Option 1" /><SwitchItem value="option2" label="Option 2" /><SwitchItem value="option3" label="Option 3" />diff --git a/frontend-sdk/packages/react-ui/src/components/SwitchItem/SwitchItem.tsx b/frontend-sdk/packages/react-ui/src/components/SwitchItem/SwitchItem.tsxindex 518d7fa0d..d4cd9c41a 100644--- a/frontend-sdk/packages/react-ui/src/components/SwitchItem/SwitchItem.tsx+++ b/frontend-sdk/packages/react-ui/src/components/SwitchItem/SwitchItem.tsx@@ -1,12 +1,12 @@import * as Switch from "@radix-ui/react-switch";import clsx from "clsx";-import React, { useId } from "react";+import { CSSProperties, forwardRef, ReactNode, useId } from "react";import { Label } from "../FormControl";interface SwitchItemProps {- label?: React.ReactNode;+ label?: ReactNode;className?: string;- style?: React.CSSProperties;+ style?: CSSProperties;checked?: boolean;disabled?: boolean;defaultChecked?: boolean;@@ -16,23 +16,29 @@ interface SwitchItemProps {onChange?: (value: boolean) => void;}-const SwitchItem = React.forwardRef<HTMLButtonElement, SwitchItemProps>((props, ref) => {- const { label, onChange, className, disabled, ...rest } = props;+const SwitchItem = forwardRef<HTMLButtonElement, SwitchItemProps>((props, ref) => {+ const { label, onChange, className, disabled, required, ...rest } = props;const id = useId();return (<div className="crayon-switch-item-container"><Switch.Rootref={ref}onCheckedChange={onChange}- {...rest}id={id}className={clsx("crayon-switch-item-root", className)}disabled={disabled}+ required={required}+ {...rest}><Switch.Thumb className="crayon-switch-item-thumb" /></Switch.Root>{label && (- <Label htmlFor={id} className="crayon-switch-item-label" disabled={disabled}>+ <Label+ htmlFor={id}+ className="crayon-switch-item-label"+ disabled={disabled}+ required={required}+ >{label}</Label>)}diff --git a/frontend-sdk/packages/react-ui/src/components/SwitchItem/stories/SwitchItem.stories.tsx b/frontend-sdk/packages/react-ui/src/components/SwitchItem/stories/SwitchItem.stories.tsxindex 880706838..8d78d6478 100644--- a/frontend-sdk/packages/react-ui/src/components/SwitchItem/stories/SwitchItem.stories.tsx+++ b/frontend-sdk/packages/react-ui/src/components/SwitchItem/stories/SwitchItem.stories.tsx@@ -1,6 +1,5 @@import type { Meta, StoryObj } from "@storybook/react";-import { useState } from "react";-import "../../FormControl/Label/Label.scss";+import "../../Label/Label.scss";import { SwitchItem } from "../SwitchItem";import "../switchItem.scss";@@ -12,10 +11,88 @@ const meta = {},tags: ["autodocs"],argTypes: {- label: { control: "text" },- disabled: { control: "boolean" },- checked: { control: "boolean" },- onChange: { action: "changed" },+ label: {+ control: "text",+ description: "The label of the switch item",+ table: {+ category: "Content",+ type: { summary: "string" },+ defaultValue: { summary: "undefined" },+ },+ },+ disabled: {+ control: "boolean",+ description: "Whether the switch item is disabled",+ table: {+ category: "Behavior",+ type: { summary: "boolean" },+ defaultValue: { summary: "false" },+ },+ },+ required: {+ control: "boolean",+ description: "Whether the switch item is required",+ table: {+ category: "Behavior",+ type: { summary: "boolean" },+ defaultValue: { summary: "false" },+ },+ },+ checked: {+ control: "boolean",+ description: "Whether the switch item is checked Or can be used for controlled mode",+ table: {+ category: "Behavior",+ type: { summary: "boolean" },+ defaultValue: { summary: "false" },+ },+ },+ name: {+ table: {+ disable: true,+ },+ },+ value: {+ control: false,+ description: "The value of the switch item",+ table: {+ category: "Property",+ type: { summary: "string" },+ defaultValue: { summary: "undefined" },+ },+ },+ defaultChecked: {+ table: {+ disable: true,+ },+ },+ className: {+ control: false,+ description: "Additional CSS class name for custom styling",+ table: {+ category: "Styling",+ type: { summary: "string" },+ defaultValue: { summary: "undefined" },+ },+ },+ style: {+ control: false,+ description: "Additional CSS style for custom styling",+ table: {+ category: "Styling",+ type: { summary: "CSSProperties" },+ defaultValue: { summary: "undefined" },+ },+ },+ onChange: {+ control: false,+ description: "The callback function when the switch item is clicked",+ table: {+ category: "Behavior",+ type: { summary: "function" },+ defaultValue: { summary: "undefined" },+ },+ },},} satisfies Meta<typeof SwitchItem>;@@ -26,69 +103,9 @@ type Story = StoryObj<typeof meta>;export const Default: Story = {args: {label: "Switch Item",- onChange: () => {},- },-};--// With description-export const WithDescription: Story = {- args: {- label: "Notifications",- onChange: () => {},- },-};--// Disabled state-export const Disabled: Story = {- args: {- label: "Disabled Switch",- disabled: true,- onChange: () => {},- },-};--// Checked state-export const Checked: Story = {- args: {- label: "Checked Switch",- checked: true,- onChange: () => {},- },-};--// Controlled component example-export const ControlledSwitchTemplate = () => {- const [isChecked, setIsChecked] = useState(false);-- return (- <SwitchItem- label="Controlled Switch"- checked={isChecked}- onChange={(checked) => setIsChecked(checked)}- />- );-};--export const Controlled: Story = {- args: {- label: "Controlled Switch",checked: false,+ disabled: false,+ required: false,},-};--// Long text example-export const LongText: Story = {- args: {- label:- "Switch with a very long label that might wrap to multiple lines to test the component's layout handling",- onChange: () => {},- },-};--// Error state (if supported)-export const WithError: Story = {- args: {- label: "Switch with Error",- onChange: () => {},- },+ render: (args) => <SwitchItem {...args} />,};diff --git a/frontend-sdk/packages/react-ui/src/components/Table/stories/Table.stories.tsx b/frontend-sdk/packages/react-ui/src/components/Table/stories/Table.stories.tsxindex faffddea9..13683429d 100644--- a/frontend-sdk/packages/react-ui/src/components/Table/stories/Table.stories.tsx+++ b/frontend-sdk/packages/react-ui/src/components/Table/stories/Table.stories.tsx@@ -23,8 +23,8 @@ type Story = StoryObj<typeof Table>;// Basic Table Storyexport const Basic: Story = {- render: () => (- <Table>+ render: (args) => (+ <Table {...args}><TableCaption>A list of your recent invoices.</TableCaption><TableHeader><TableRow>@@ -93,30 +93,3 @@ export const WithFooter: Story = {</Table>),};--// Table with Custom Styling Story-export const CustomStyling: Story = {- render: () => (- <Table className="border rounded-lg">- <TableHeader>- <TableRow className="bg-gray-100">- <TableHead className="font-bold">Name</TableHead>- <TableHead className="font-bold">Email</TableHead>- <TableHead className="font-bold">Role</TableHead>- </TableRow>- </TableHeader>- <TableBody>- <TableRow>- <TableCell className="font-medium">John Doe</TableCell>- <TableCell>[email protected]</TableCell>- <TableCell>Admin</TableCell>- </TableRow>- <TableRow>- <TableCell className="font-medium">Jane Smith</TableCell>- <TableCell>[email protected]</TableCell>- <TableCell>User</TableCell>- </TableRow>- </TableBody>- </Table>- ),-};diff --git a/frontend-sdk/packages/react-ui/src/components/Table/table.scss b/frontend-sdk/packages/react-ui/src/components/Table/table.scssindex 6b4c408d9..025f72a79 100644--- a/frontend-sdk/packages/react-ui/src/components/Table/table.scss+++ b/frontend-sdk/packages/react-ui/src/components/Table/table.scss@@ -60,7 +60,7 @@color: map.get(cssUtils.$colors, "text", "primary");display: inline-flex;flex-grow: 1;- justify-content: center;+ justify-content: left;}& .crayon-table-head-content {@@ -68,6 +68,12 @@align-items: center;gap: map.get(cssUtils.$spacing, "2xs");}++ & .crayon-table-head-icon {+ display: flex;+ align-items: center;+ justify-content: center;+ }}.crayon-table-caption {diff --git a/frontend-sdk/packages/react-ui/src/components/Tabs/Tabs.tsx b/frontend-sdk/packages/react-ui/src/components/Tabs/Tabs.tsxindex e81f222e4..e02b72847 100644--- a/frontend-sdk/packages/react-ui/src/components/Tabs/Tabs.tsx+++ b/frontend-sdk/packages/react-ui/src/components/Tabs/Tabs.tsx@@ -2,17 +2,25 @@ import * as TabsPrimitive from "@radix-ui/react-tabs";import clsx from "clsx";import React, { forwardRef } from "react";+type TabsVariant = "clear" | "card" | "sunk";+export interface TabsProps extends React.ComponentPropsWithoutRef<typeof TabsPrimitive.Root> {className?: string;style?: React.CSSProperties;- variant?: "clear" | "card" | "sunk";+ variant?: TabsVariant;}+const tabsVariants: Record<TabsVariant, string> = {+ clear: "crayon-tabs-clear",+ card: "crayon-tabs-card",+ sunk: "crayon-tabs-sunk",+};+export const Tabs = forwardRef<React.ComponentRef<typeof TabsPrimitive.Root>, TabsProps>(({ className, style, variant = "clear", ...props }, ref) => (<TabsPrimitive.Rootref={ref}- className={clsx("crayon-tabs", className, `crayon-tabs-${variant}`)}+ className={clsx("crayon-tabs", tabsVariants[variant], className)}style={style}{...props}/>diff --git a/frontend-sdk/packages/react-ui/src/components/Tabs/stories/tabs.stories.tsx b/frontend-sdk/packages/react-ui/src/components/Tabs/stories/tabs.stories.tsxindex 759efd1fa..a5da17398 100644--- a/frontend-sdk/packages/react-ui/src/components/Tabs/stories/tabs.stories.tsx+++ b/frontend-sdk/packages/react-ui/src/components/Tabs/stories/tabs.stories.tsx@@ -13,21 +13,66 @@ const meta: Meta<typeof Tabs> = {title: "Components/Tabs",component: Tabs,tags: ["autodocs"],+ parameters: {+ layout: "centered",+ },decorators: [(Story) => (- <div style={{ maxWidth: "600px", margin: "2rem" }}>+ <div style={{ width: "400px", margin: "2rem" }}><Story /></div>),],+ argTypes: {+ variant: {+ control: {+ type: "select",+ options: ["clear", "card", "sunk"],+ },+ description: "The variant of the tabs",+ table: {+ type: {+ summary: "clear | card | sunk",+ },+ defaultValue: { summary: "clear" },+ category: "Appearance",+ },+ },+ defaultValue: {+ control: false,+ description: "The default value of the tabs which is used to determine which tab is selected",+ table: {+ defaultValue: { summary: "undefined" },+ category: "Behavior",+ },+ },+ className: {+ control: false,+ description: "Additional class name for the tabs",+ table: {+ category: "Styling",+ },+ },+ style: {+ control: false,+ description: "Additional style for the tabs",+ table: {+ category: "Styling",+ },+ },+ },};export default meta;type Story = StoryObj<typeof Tabs>;export const Default: Story = {- render: () => (- <Tabs defaultValue="tab1">+ args: {+ variant: "clear",+ defaultValue: "tab1",+ },+ render: (args) => (+ <Tabs {...args}><TabsList><TabsTrigger value="tab1" text="Account" /><TabsTrigger value="tab2" text="Password" />@@ -39,43 +84,7 @@ export const Default: Story = {subtitle="Subtitle"actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}/>- <Image src="https://picsum.photos/200/300" alt="Image" scale="fill" />- </TabsContent>- <TabsContent value="tab2">- <Header- title="Title"- subtitle="Subtitle"- actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}- />- <Image src="https://picsum.photos/300/400" alt="Image" scale="fill" />- </TabsContent>- <TabsContent value="tab3">- <Header- title="Title"- subtitle="Subtitle"- actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}- />- <Image src="https://picsum.photos/400/500" alt="Image" scale="fill" />- </TabsContent>- </Tabs>- ),-};--export const Disabled: Story = {- render: () => (- <Tabs defaultValue="tab1">- <TabsList>- <TabsTrigger value="tab1" text="Active Tab" />- <TabsTrigger value="tab2" disabled text="Disabled Tab" />- <TabsTrigger value="tab3" text="Another Tab" />- </TabsList>- <TabsContent value="tab1">- <Header- title="Title"- subtitle="Subtitle"- actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}- />- <Image src="https://picsum.photos/200/300" alt="Image" scale="fill" />+ <Image src="https://picsum.photos/700/700" alt="Image" scale="fill" /></TabsContent><TabsContent value="tab2"><Header@@ -83,7 +92,7 @@ export const Disabled: Story = {subtitle="Subtitle"actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}/>- <Image src="https://picsum.photos/300/400" alt="Image" scale="fill" />+ <Image src="https://picsum.photos/700/750" alt="Image" scale="fill" /></TabsContent><TabsContent value="tab3"><Header@@ -91,42 +100,19 @@ export const Disabled: Story = {subtitle="Subtitle"actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}/>- <Image src="https://picsum.photos/400/500" alt="Image" scale="fill" />- </TabsContent>- </Tabs>- ),-};--export const CustomStyling: Story = {- render: () => (- <Tabs defaultValue="tab1" className="custom-tabs">- <TabsList className="custom-tabs-list">- <TabsTrigger value="tab1" text="Tab 1" />- <TabsTrigger value="tab2" text="Tab 2" />- </TabsList>- <TabsContent value="tab1" className="custom-content">- <Header- title="Title"- subtitle="Subtitle"- actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}- />- <Image src="https://picsum.photos/200/300" alt="Image" scale="fill" />- </TabsContent>- <TabsContent value="tab2" className="custom-content">- <Header- title="Title"- subtitle="Subtitle"- actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}- />- <Image src="https://picsum.photos/300/400" alt="Image" scale="fill" />+ <Image src="https://picsum.photos/700/760" alt="Image" scale="fill" /></TabsContent></Tabs>),};export const WithIcon: Story = {- render: () => (- <Tabs defaultValue="tab1" variant="clear">+ args: {+ variant: "clear",+ defaultValue: "tab2",+ },+ render: (args) => (+ <Tabs {...args}><TabsList><TabsTrigger value="tab1" text="Account" icon={<UserRound />} /><TabsTrigger value="tab2" text="Password" icon={<ShieldCheck />} />@@ -159,111 +145,3 @@ export const WithIcon: Story = {</Tabs>),};--export const Clear: Story = {- render: () => (- <Tabs defaultValue="tab1" variant="clear">- <TabsList>- <TabsTrigger value="tab1" text="Account" />- <TabsTrigger value="tab2" text="Password" />- <TabsTrigger value="tab3" text="Settings" />- </TabsList>- <TabsContent value="tab1">- <Header- title="Title"- subtitle="Subtitle"- actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}- />- <Image src="https://picsum.photos/200/300" alt="Image" scale="fill" />- </TabsContent>- <TabsContent value="tab2">- <Header- title="Title"- subtitle="Subtitle"- actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}- />- <Image src="https://picsum.photos/300/400" alt="Image" scale="fill" />- </TabsContent>- <TabsContent value="tab3">- <Header- title="Title"- subtitle="Subtitle"- actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}- />- <Image src="https://picsum.photos/400/500" alt="Image" scale="fill" />- </TabsContent>- </Tabs>- ),-};--export const Card: Story = {- render: () => (- <Tabs defaultValue="tab2" variant="card">- <TabsList>- <TabsTrigger value="tab1" text="Account" />- <TabsTrigger value="tab2" text="Password" />- <TabsTrigger value="tab3" text="Settings" />- </TabsList>- <TabsContent value="tab1">- <Header- title="Title"- subtitle="Subtitle"- actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}- />- <Image src="https://picsum.photos/200/300" alt="Image" scale="fill" />- </TabsContent>- <TabsContent value="tab2">- <Header- title="Title"- subtitle="Subtitle"- actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}- />- <Image src="https://picsum.photos/300/400" alt="Image" scale="fill" />- </TabsContent>- <TabsContent value="tab3">- <Header- title="Title"- subtitle="Subtitle"- actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}- />- <Image src="https://picsum.photos/400/500" alt="Image" scale="fill" />- </TabsContent>- </Tabs>- ),-};--export const Sunk: Story = {- render: () => (- <Tabs defaultValue="tab3" variant="sunk">- <TabsList>- <TabsTrigger value="tab1" text="Account" />- <TabsTrigger value="tab2" text="Password" />- <TabsTrigger value="tab3" text="Settings" />- </TabsList>- <TabsContent value="tab1">- <Header- title="Title"- subtitle="Subtitle"- actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}- />- <Image src="https://picsum.photos/200/300" alt="Image" scale="fill" />- </TabsContent>- <TabsContent value="tab2">- <Header- title="Title"- subtitle="Subtitle"- actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}- />- <Image src="https://picsum.photos/300/400" alt="Image" scale="fill" />- </TabsContent>- <TabsContent value="tab3">- <Header- title="Title"- subtitle="Subtitle"- actions={[<IconButton variant="tertiary" size="small" icon={<Bell />} />]}- />- <Image src="https://picsum.photos/400/500" alt="Image" scale="fill" />- </TabsContent>- </Tabs>- ),-};diff --git a/frontend-sdk/packages/react-ui/src/components/Tag/Tag.tsx b/frontend-sdk/packages/react-ui/src/components/Tag/Tag.tsxindex df6bd756a..909d05955 100644--- a/frontend-sdk/packages/react-ui/src/components/Tag/Tag.tsx+++ b/frontend-sdk/packages/react-ui/src/components/Tag/Tag.tsx@@ -1,11 +1,11 @@import clsx from "clsx";-import React, { forwardRef } from "react";+import { CSSProperties, forwardRef, ReactNode } from "react";export interface TagProps {className?: string;- styles?: React.CSSProperties;- icon?: React.ReactNode;- text: React.ReactNode;+ styles?: CSSProperties;+ icon?: ReactNode;+ text: ReactNode;}export const Tag = forwardRef<HTMLDivElement, TagProps>((props, ref) => {diff --git a/frontend-sdk/packages/react-ui/src/components/Tag/stories/Tag.stories.tsx b/frontend-sdk/packages/react-ui/src/components/Tag/stories/Tag.stories.tsxindex 4aa1e0bb4..fa3eec942 100644--- a/frontend-sdk/packages/react-ui/src/components/Tag/stories/Tag.stories.tsx+++ b/frontend-sdk/packages/react-ui/src/components/Tag/stories/Tag.stories.tsx@@ -1,5 +1,5 @@import type { Meta, StoryObj } from "@storybook/react";-import { Heart, Tag as TagIcon, User } from "lucide-react";+import { User } from "lucide-react";import { Tag } from "../Tag";import "../tag.scss";@@ -9,6 +9,44 @@ const meta: Meta<typeof Tag> = {parameters: {layout: "centered",},+ argTypes: {+ text: {+ control: "text",+ description: "The text content of the tag",+ table: {+ category: "Content",+ type: { summary: "string" },+ defaultValue: { summary: "undefined" },+ },+ },+ icon: {+ control: false,+ description: "The icon to display in the tag",+ table: {+ category: "Content",+ type: { summary: "ReactNode" },+ defaultValue: { summary: "undefined" },+ },+ },+ className: {+ control: false,+ description: "Additional CSS class name for custom styling",+ table: {+ category: "Styling",+ type: { summary: "string" },+ defaultValue: { summary: "undefined" },+ },+ },+ styles: {+ control: false,+ description: "Additional CSS styles for custom styling",+ table: {+ category: "Styling",+ type: { summary: "CSSProperties" },+ defaultValue: { summary: "undefined" },+ },+ },+ },tags: ["autodocs"],};@@ -17,71 +55,8 @@ type Story = StoryObj<typeof Tag>;// Basic Tagexport const Default: Story = {- args: {- text: "Basic Tag",- },-};--// Tag with Icon-export const WithIcon: Story = {args: {text: "User Tag",icon: <User size={16} />,},};--// Tag with Custom Style-export const CustomStyle: Story = {- args: {- text: "Custom Tag",- styles: {- backgroundColor: "#e6f4ff",- color: "#0066cc",- borderColor: "#91caff",- },- },-};--export const CustomStyleWithIcon: Story = {- args: {- text: "Custom Tag",- icon: <User size={16} />,- styles: {- backgroundColor: "#e6f4ff",- color: "#0066cc",- borderColor: "#91caff",- },- },-};--// Multiple Tags Example-export const MultipleTagsExample: Story = {- render: () => (- <div style={{ display: "flex", gap: "8px" }}>- <Tag text="Feature" icon={<TagIcon className="mr-1" size={16} />} />- <Tag text="Important" icon={<Heart className="mr-1" size={16} />} />- <Tag text="New" />- </div>- ),-};--// Long Text Tag-export const LongTextTag: Story = {- args: {- text: "This is a very long tag text that should be truncated when it exceeds the available space",- styles: {- maxWidth: "200px",- },- },-};--// Long Text Tag-export const LongTextTagWithIcon: Story = {- args: {- text: "This is a very long tag text that should be truncated when it exceeds the available space",- icon: <User size={16} />,- styles: {- maxWidth: "200px",- },- },-};diff --git a/frontend-sdk/packages/react-ui/src/components/TagBlock/TagBlock.tsx b/frontend-sdk/packages/react-ui/src/components/TagBlock/TagBlock.tsxindex 3371c8e19..88e946875 100644--- a/frontend-sdk/packages/react-ui/src/components/TagBlock/TagBlock.tsx+++ b/frontend-sdk/packages/react-ui/src/components/TagBlock/TagBlock.tsx@@ -1,10 +1,10 @@import clsx from "clsx";-import React, { forwardRef } from "react";+import { CSSProperties, forwardRef, ReactElement } from "react";import { Tag } from "../Tag";export interface TagBlockProps {- children: React.ReactElement<typeof Tag> | React.ReactElement<typeof Tag>[];- styles?: React.CSSProperties;+ children: ReactElement<typeof Tag> | ReactElement<typeof Tag>[];+ styles?: CSSProperties;className?: string;}diff --git a/frontend-sdk/packages/react-ui/src/components/TagBlock/stories/TagBlock.stories.tsx b/frontend-sdk/packages/react-ui/src/components/TagBlock/stories/TagBlock.stories.tsxindex 079d5bca9..73e430eb6 100644--- a/frontend-sdk/packages/react-ui/src/components/TagBlock/stories/TagBlock.stories.tsx+++ b/frontend-sdk/packages/react-ui/src/components/TagBlock/stories/TagBlock.stories.tsx@@ -1,6 +1,7 @@import type { Meta, StoryObj } from "@storybook/react";import { Heart, Star, User } from "lucide-react";import { Tag } from "../../Tag";+import "../../Tag/tag.scss";import { TagBlock } from "../TagBlock";import "../TagBlock.scss";@@ -10,6 +11,35 @@ const meta: Meta<typeof TagBlock> = {parameters: {layout: "centered",},+ argTypes: {+ children: {+ control: false,+ description: "Accepts Tag components as children",+ table: {+ category: "Content",+ type: { summary: "ReactElement<typeof Tag> | ReactElement<typeof Tag>[]" },+ defaultValue: { summary: "undefined" },+ },+ },+ className: {+ control: false,+ description: "Additional CSS class name for custom styling",+ table: {+ category: "Styling",+ type: { summary: "string" },+ defaultValue: { summary: "undefined" },+ },+ },+ styles: {+ control: false,+ description: "Additional CSS styles for custom styling",+ table: {+ category: "Styling",+ type: { summary: "CSSProperties" },+ defaultValue: { summary: "undefined" },+ },+ },+ },tags: ["autodocs"],};@@ -17,41 +47,11 @@ export default meta;type Story = StoryObj<typeof TagBlock>;export const Default: Story = {- render: () => (- <TagBlock styles={{}}>- <Tag text="Simple Tag" />- <Tag text="Another Tag" />- <Tag text="Third Tag" />- </TagBlock>- ),-};--export const WithIcons: Story = {- render: () => (- <TagBlock>+ render: (args) => (+ <TagBlock {...args}><Tag icon={<User size={16} />} text="User" /><Tag icon={<Star size={16} />} text="Star" /><Tag icon={<Heart size={16} />} text="Heart" /></TagBlock>),};--export const CustomStyles: Story = {- render: () => (- <TagBlock>- <Tag text="Custom Color" styles={{ backgroundColor: "#e6f3ff", color: "#0066cc" }} />- <Tag text="Different Style" styles={{ backgroundColor: "#ffe6e6", color: "#cc0000" }} />- <Tag text="Another Style" styles={{ backgroundColor: "#e6ffe6", color: "#006600" }} />- </TagBlock>- ),-};--export const ManyTags: Story = {- render: () => (- <TagBlock>- {Array.from({ length: 10 }, (_, i) => (- <Tag key={i} text={`Tag ${i + 1}`} />- ))}- </TagBlock>- ),-};diff --git a/frontend-sdk/packages/react-ui/src/components/TextArea/TextArea.tsx b/frontend-sdk/packages/react-ui/src/components/TextArea/TextArea.tsxindex c7062ff4d..db46c2cee 100644--- a/frontend-sdk/packages/react-ui/src/components/TextArea/TextArea.tsx+++ b/frontend-sdk/packages/react-ui/src/components/TextArea/TextArea.tsx@@ -1,25 +1,18 @@import clsx from "clsx";-import React from "react";+import React, { forwardRef } from "react";export interface TextAreaPropsextends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "size"> {className?: string;- styles?: React.CSSProperties;placeholder?: string;rows?: number;}-const TextArea = React.forwardRef<HTMLTextAreaElement, TextAreaProps>((props, ref) => {- const { className, styles, rows = 3, ...rest } = props;+const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>((props, ref) => {+ const { className, rows = 3, ...rest } = props;return (- <textarea- ref={ref}- className={clsx("crayon-textarea", className)}- style={styles}- {...rest}- rows={rows}- />+ <textarea ref={ref} className={clsx("crayon-textarea", className)} {...rest} rows={rows} />);});diff --git a/frontend-sdk/packages/react-ui/src/components/TextArea/stories/TextArea.stories.tsx b/frontend-sdk/packages/react-ui/src/components/TextArea/stories/TextArea.stories.tsxindex 082b57131..84d9ccbbf 100644--- a/frontend-sdk/packages/react-ui/src/components/TextArea/stories/TextArea.stories.tsx+++ b/frontend-sdk/packages/react-ui/src/components/TextArea/stories/TextArea.stories.tsx@@ -8,6 +8,44 @@ const meta = {parameters: {layout: "centered",},+ argTypes: {+ placeholder: {+ control: "text",+ description: "The placeholder text of the text area",+ table: {+ category: "Content",+ type: { summary: "string" },+ defaultValue: { summary: "undefined" },+ },+ },+ rows: {+ control: "number",+ description: "The number of rows of the text area",+ table: {+ category: "Appearance",+ type: { summary: "number" },+ defaultValue: { summary: "3" },+ },+ },+ className: {+ control: false,+ description: "Additional CSS class name for custom styling",+ table: {+ category: "Styling",+ type: { summary: "string" },+ defaultValue: { summary: "undefined" },+ },+ },+ style: {+ control: false,+ description: "Additional CSS style for custom styling",+ table: {+ category: "Styling",+ type: { summary: "CSSProperties" },+ defaultValue: { summary: "undefined" },+ },+ },+ },tags: ["autodocs"],} satisfies Meta<typeof TextArea>;@@ -17,53 +55,6 @@ type Story = StoryObj<typeof meta>;export const Default: Story = {args: {placeholder: "Enter your text here",- },-};--export const Small: Story = {- args: {- placeholder: "Small textarea",- rows: 2,- },-};--export const Large: Story = {- args: {- placeholder: "Large textarea",- rows: 4,- },-};--export const Disabled: Story = {- args: {- disabled: true,- placeholder: "This textarea is disabled",- value: "This textarea is disabled",- },-};--export const WithValue: Story = {- args: {- value: "This is a pre-filled textarea with some content",- placeholder: "Enter notes",- },-};--export const WithCustomStyle: Story = {- args: {- placeholder: "Custom styled textarea",- styles: {- width: "400px",- margin: "20px",- },- },-};--// Example with icons (you'll need to import your icon components)-export const WithIcons: Story = {- args: {- placeholder: "Textarea with icons",- // iconLeft: <YourLeftIcon />,- // iconRight: <YourRightIcon />,+ rows: 3,},};diff --git a/frontend-sdk/packages/react-ui/src/components/TextContent/TextContent.tsx b/frontend-sdk/packages/react-ui/src/components/TextContent/TextContent.tsxindex 29fa578e7..ff863cc6a 100644--- a/frontend-sdk/packages/react-ui/src/components/TextContent/TextContent.tsx+++ b/frontend-sdk/packages/react-ui/src/components/TextContent/TextContent.tsx@@ -1,18 +1,26 @@import clsx from "clsx";-import React from "react";+import { CSSProperties, ReactNode } from "react";++export type TextContentVariant = "clear" | "card" | "sunk";export interface TextContentProps {- children: React.ReactNode;- variant?: "clear" | "card" | "sunk";+ children: ReactNode;+ variant?: TextContentVariant;className?: string;- style?: React.CSSProperties;+ style?: CSSProperties;}+const variants: Record<TextContentVariant, string> = {+ clear: "text-content-clear",+ card: "text-content-card",+ sunk: "text-content-sunk",+};+const TextContent = (props: TextContentProps) => {const { children, variant = "sunk", className, style } = props;return (- <div className={clsx("text-content", `text-content-${variant}`, className)} style={style}>+ <div className={clsx("text-content", variants[variant], className)} style={style}>{children}</div>);diff --git a/frontend-sdk/packages/react-ui/src/components/TextContent/stories/TextContent.stories.tsx b/frontend-sdk/packages/react-ui/src/components/TextContent/stories/TextContent.stories.tsxindex 5711c24bb..16de84b97 100644--- a/frontend-sdk/packages/react-ui/src/components/TextContent/stories/TextContent.stories.tsx+++ b/frontend-sdk/packages/react-ui/src/components/TextContent/stories/TextContent.stories.tsx@@ -13,10 +13,38 @@ const meta: Meta<typeof TextContent> = {control: "select",options: ["clear", "card", "sunk"],description: "Visual style variant of the text content",+ table: {+ category: "Appearance",+ type: { summary: "string" },+ defaultValue: { summary: "sunk" },+ },},children: {control: "text",description: "Content to be displayed",+ table: {+ category: "Content",+ type: { summary: "string | ReactNode" },+ defaultValue: { summary: "undefined" },+ },+ },+ className: {+ control: false,+ description: "Additional CSS class name for custom styling",+ table: {+ category: "Styling",+ type: { summary: "string" },+ defaultValue: { summary: "undefined" },+ },+ },+ style: {+ control: false,+ description: "Additional CSS style for custom styling",+ table: {+ category: "Styling",+ type: { summary: "CSSProperties" },+ defaultValue: { summary: "undefined" },+ },},},};@@ -30,52 +58,3 @@ export const Default: Story = {variant: "sunk",},};--export const Clear: Story = {- args: {- children: "This is text content with clear variant.",- variant: "clear",- },-};--export const Card: Story = {- args: {- children: "This is text content with card variant.",- variant: "card",- },-};--export const WithLongContent: Story = {- args: {- children: `- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor- incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis- nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.-- Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore- eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt- in culpa qui officia deserunt mollit anim id est laborum.- `,- variant: "sunk",- },-};--export const WithHTMLContent: Story = {- args: {- children: (- <>- <h1>Heading 1</h1>- <p>- This is a paragraph with <strong>bold</strong> and <em>italic</em> text.- </p>- <h2>Heading 2</h2>- <ul>- <li>List item 1</li>- <li>List item 2</li>- <li>List item 3</li>- </ul>- </>- ),- variant: "card",- },-};diff --git a/frontend-sdk/packages/react-ui/src/components/ThemeProvider/ThemeProvider.tsx b/frontend-sdk/packages/react-ui/src/components/ThemeProvider/ThemeProvider.tsxindex b23710a84..60fc43688 100644--- a/frontend-sdk/packages/react-ui/src/components/ThemeProvider/ThemeProvider.tsx+++ b/frontend-sdk/packages/react-ui/src/components/ThemeProvider/ThemeProvider.tsx@@ -165,7 +165,7 @@ const defaultTheme: ThemeProviderProps = {rounded3xl: "20px",rounded4xl: "24px",roundedFull: "999px",- roundedClickable:'6px',+ roundedClickable: "6px",// Primary FontfontPrimary: '400 14px/20px "Inter"',@@ -197,13 +197,16 @@ const defaultTheme: ThemeProviderProps = {// RegularfontBody: '400 14px/18px "Inter"',fontBodyLetterSpacing: "0px",+fontBodyMedium: '400 16px/24px "Inter"',fontBodyMediumLetterSpacing: "0px",+fontBodySmall: '400 14px/20px "Inter"',fontBodySmallLetterSpacing: "0px",// HeavyfontBodyHeavy: '600 16px/24px "Inter"',fontBodyHeavyLetterSpacing: "0px",+fontBodySmallHeavy: '600 14px/20px "Inter"',fontBodySmallHeavyLetterSpacing: "0px",// Special@@ -214,26 +217,31 @@ const defaultTheme: ThemeProviderProps = {// LargefontLabelLarge: '400 12px/16px "Inter"',fontLabelLargeLetterSpacing: "0px",+fontLabelLargeHeavy: '500 12px/16px "Inter"',fontLabelLargeHeavyLetterSpacing: "0px",// RegularfontLabel: '400 12px/16px "Inter"',fontLabelLetterSpacing: "0px",+fontLabelHeavy: '500 12px/16px "Inter"',fontLabelHeavyLetterSpacing: "0px",// MediumfontLabelMedium: '400 10px/16px "Inter"',fontLabelMediumLetterSpacing: "0px",+fontLabelMediumHeavy: '600 10px/16px "Inter"',fontLabelMediumHeavyLetterSpacing: "0px",// SmallfontLabelSmall: '400 10px/16px "Inter"',fontLabelSmallLetterSpacing: "0px",+fontLabelSmallHeavy: '500 10px/16px "Inter"',fontLabelSmallHeavyLetterSpacing: "0px",// Extra SmallfontLabelExtraSmall: '400 8px/12px "Inter"',fontLabelExtraSmallLetterSpacing: "0px",+fontLabelExtraSmallHeavy: '500 8px/12px "Inter"',fontLabelExtraSmallHeavyLetterSpacing: "0px",