Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
chore: delete unused ai-command-bar components and stories
Oleg Isonenb67aaafe1510
diff --git a/packages/design-system/src/components/ai-command-bar/autogrow-text-area.stories.tsx b/packages/design-system/src/components/ai-command-bar/autogrow-text-area.stories.tsxdeleted file mode 100644index 0bdb9e91f1..0000000000--- a/packages/design-system/src/components/ai-command-bar/autogrow-text-area.stories.tsx+++ /dev/null@@ -1,52 +0,0 @@-import { AutogrowTextArea } from "./autogrow-text-area";-import { Box } from "../box";-import { Grid } from "../grid";-import { ScrollArea } from "../scroll-area";-import { StorySection, StoryGrid } from "../storybook";--export default {- title: "Autogrow Text Area",-};--export const Demo = () => {- return (- <>- <StorySection title="Autogrow textarea">- <StoryGrid css={{ width: 200 }}>- <Box css={{ backgroundColor: "black", color: "white", padding: 8 }}>- <AutogrowTextArea- defaultValue={`1\n2\n3\n4\n5\n6\n7\n8`}- placeholder="Enter value..."- />- </Box>- </StoryGrid>- <Box css={{ height: 16 }} />- <StoryGrid css={{ width: 200 }}>- <Box css={{ backgroundColor: "black", color: "white", padding: 8 }}>- <AutogrowTextArea- state="invalid"- value="invalid value"- placeholder="Enter value..."- />- </Box>- </StoryGrid>- </StorySection>-- <StorySection title="Autogrow textarea with scroll and max-height">- <StoryGrid css={{ width: 200 }}>- <Box css={{ backgroundColor: "black", color: "white", padding: 8 }}>- <Grid>- <ScrollArea css={{ maxHeight: 100 }}>- <AutogrowTextArea- defaultValue={`1\n2\n3\n4\n5\n6\n7\n8`}- placeholder="Enter value..."- />- </ScrollArea>- </Grid>- </Box>- </StoryGrid>- </StorySection>- </>- );-};-Demo.storyName = "Autogrow Text Area";diff --git a/packages/design-system/src/components/ai-command-bar/autogrow-text-area.tsx b/packages/design-system/src/components/ai-command-bar/autogrow-text-area.tsxdeleted file mode 100644index e0ded8fe37..0000000000--- a/packages/design-system/src/components/ai-command-bar/autogrow-text-area.tsx+++ /dev/null@@ -1,98 +0,0 @@-/**- * Implementation of the autogrowing text input for the AI- * https://www.figma.com/file/xCBegXEWxROLqA1Y31z2Xo/%F0%9F%93%96-Webstudio-Design-Docs?node-id=7586%3A48784&mode=dev- */--import { type ComponentProps, type Ref, forwardRef } from "react";-import { type CSS, css, theme } from "../../stitches.config";-import { textVariants } from "../text";-import { Grid } from "../grid";-import { useControllableState } from "@radix-ui/react-use-controllable-state";--const commonStyle = css(textVariants.regular, {- border: "none",- paddingRight: 0,- paddingLeft: 0,- paddingTop: 0,- paddingBottom: 0,- boxSizing: "border-box",- gridArea: "1 / 1 / 2 / 2",- background: "transparent",- color: "inherit",- textWrap: "wrap",- overflowWrap: "break-word",- whiteSpace: "pre-wrap",- overflow: "hidden",-});--const style = css(commonStyle, {- outline: "none",- resize: "none",- "&::placeholder": {- color: theme.colors.foregroundContrastSubtle,- },- "&:disabled": {- color: theme.colors.foregroundDisabled,- // @todo: Ask Taylor if we should use the same color as the placeholder- opacity: 0.6,- },- variants: {- state: {- invalid: {- color: theme.colors.foregroundDestructive,- },- },- },-});--type Props = Omit<- ComponentProps<"textarea">,- "value" | "defaultValue" | "onChange"-> & {- css?: CSS;- state?: "invalid";- value?: string;- defaultValue?: string;- onChange?: (value: string) => void;-};--export const AutogrowTextArea = forwardRef(- (- { css, className, state, value, defaultValue, onChange, ...props }: Props,- ref: Ref<HTMLTextAreaElement>- ) => {- // use- const [textValue, setTextValue] = useControllableState({- prop: value,- defaultProp: defaultValue ?? "",- onChange,- });-- return (- <Grid>- <div- className={style({- css: { visibility: "hidden", ...css },- state,- className,- })}- >- {textValue}{" "}- </div>- <textarea- rows={1}- value={textValue}- onChange={(event) => setTextValue(event.target.value)}- spellCheck={false}- className={style({- state,- className,- })}- ref={ref}- {...props}- />- </Grid>- );- }-);-AutogrowTextArea.displayName = "AutogrowTextArea";diff --git a/packages/design-system/src/components/ai-command-bar/command-bar-button.stories.tsx b/packages/design-system/src/components/ai-command-bar/command-bar-button.stories.tsxdeleted file mode 100644index c89b8a73da..0000000000--- a/packages/design-system/src/components/ai-command-bar/command-bar-button.stories.tsx+++ /dev/null@@ -1,54 +0,0 @@-import { CommandBarButton } from "./command-bar-button";-import { StorySection, StoryGrid } from "../storybook";-import {- AiIcon,- StopIcon,- MicIcon,- LargeXIcon,- ChevronUpIcon,-} from "@webstudio-is/icons";--export default {- title: "AI Command Button",-};--export const Demo = () => {- return (- <>- <StorySection title="AI Menu Buttons">- <StoryGrid horizontal css={{ backgroundColor: "#1D1D1D", padding: 8 }}>- <CommandBarButton color="dark-ghost">- <ChevronUpIcon />- </CommandBarButton>- </StoryGrid>- </StorySection>- <StorySection title="AI Buttons">- <StoryGrid horizontal css={{ backgroundColor: "#1D1D1D", padding: 8 }}>- <CommandBarButton color="gradient">- <AiIcon />- </CommandBarButton>- <CommandBarButton color="gradient" disabled>- <AiIcon />- </CommandBarButton>- <CommandBarButton color="neutral-destructive" disabled>- <LargeXIcon />- </CommandBarButton>- </StoryGrid>- </StorySection>- <StorySection title="Sound Buttons">- <StoryGrid- horizontal- css={{ backgroundColor: "#1D1D1D", padding: 8, color: "#FFF" }}- >- <CommandBarButton color="dark-ghost">- <MicIcon />- </CommandBarButton>- <CommandBarButton color="destructive">- <StopIcon />- </CommandBarButton>- </StoryGrid>- </StorySection>- </>- );-};-Demo.storyName = "AI Command Button";diff --git a/packages/design-system/src/components/ai-command-bar/command-bar-button.tsx b/packages/design-system/src/components/ai-command-bar/command-bar-button.tsxdeleted file mode 100644index 69afd0e5a6..0000000000--- a/packages/design-system/src/components/ai-command-bar/command-bar-button.tsx+++ /dev/null@@ -1,18 +0,0 @@-import { forwardRef, type ComponentProps, type Ref } from "react";-import { Button } from "../button";-import { styled, theme } from "../../stitches.config";--type CommandButtonProps = ComponentProps<typeof Button>;--const RoundedButton = styled(Button, {- borderRadius: theme.borderRadius["pill"],- aspectRatio: "1",-});--export const CommandBarButton = forwardRef(- ({ children, ...props }: CommandButtonProps, ref: Ref<HTMLButtonElement>) => {- return <RoundedButton {...props} prefix={children} ref={ref as null} />;- }-);--CommandBarButton.displayName = "CommandButton";diff --git a/packages/design-system/src/components/ai-command-bar/command-bar.stories.tsx b/packages/design-system/src/components/ai-command-bar/command-bar.stories.tsxdeleted file mode 100644index 8f39286824..0000000000--- a/packages/design-system/src/components/ai-command-bar/command-bar.stories.tsx+++ /dev/null@@ -1,95 +0,0 @@-import { useState } from "react";-import {- AutogrowTextArea,- CommandBar,- CommandBarButton,- CommandBarContentPrompt,- CommandBarContentSection,- CommandBarTrigger,-} from "./index";-import { ScrollArea, Box, Grid, Text, theme } from "../..";-import { AiIcon, MicIcon, ChevronUpIcon } from "@webstudio-is/icons";--export default {- title: "AI Command Bar",-};--const CommandBarContent = () => {- return (- <>- <CommandBarContentSection>- <Text variant={"labels"} align={"center"}>- Previous propmts- </Text>- <div />- <CommandBarContentPrompt>- Make a new section with a contact form- </CommandBarContentPrompt>- <CommandBarContentPrompt>- Add an image of a cat smiling wearing eyeglasses- </CommandBarContentPrompt>- <CommandBarContentPrompt>- Write a breakup letter for my girlfriend and make it long enough to- break into multiple lines- </CommandBarContentPrompt>- <CommandBarContentPrompt>- Make all headings bold- </CommandBarContentPrompt>- </CommandBarContentSection>- </>- );-};--export const Demo = () => {- const [open, setOpen] = useState(false);-- const commandBarContent = <CommandBarContent />;-- return (- <Box- css={{- position: "fixed",- bottom: 80,- left: 0,- right: 0,- height: 0,- display: "flex",- justifyContent: "center",- alignItems: "flex-end",- }}- >- <CommandBar- open={open}- onOpenChange={setOpen}- content={commandBarContent}- >- <CommandBarTrigger>- <CommandBarButton color="dark-ghost">- <ChevronUpIcon />- </CommandBarButton>- </CommandBarTrigger>-- <Grid- css={{- alignSelf: "center",- // color: theme.colors.foregroundContrastMain,- // Set maxWidth to autogrow in width- width: theme.spacing[31],- }}- >- <ScrollArea css={{ maxHeight: theme.spacing[29] }}>- <AutogrowTextArea placeholder="Enter value..." />- </ScrollArea>- </Grid>-- <CommandBarButton color="dark-ghost">- <MicIcon />- </CommandBarButton>- <CommandBarButton color="gradient">- <AiIcon />- </CommandBarButton>- </CommandBar>- </Box>- );-};-Demo.storyName = "AI Command Bar";diff --git a/packages/design-system/src/components/ai-command-bar/command-bar.tsx b/packages/design-system/src/components/ai-command-bar/command-bar.tsxdeleted file mode 100644index 635c220760..0000000000--- a/packages/design-system/src/components/ai-command-bar/command-bar.tsx+++ /dev/null@@ -1,113 +0,0 @@-/**- * Implementation of the "ai command bar" component from:- * https://www.figma.com/file/xCBegXEWxROLqA1Y31z2Xo/%F0%9F%93%96-Webstudio-Design-Docs?node-id=7586%3A48927&mode=dev- */-import * as Collapsible from "@radix-ui/react-collapsible";-import * as Separator from "@radix-ui/react-separator";-import { styled, theme } from "../../stitches.config";-import { Grid } from "../grid";-import { Button } from "../button";-import { forwardRef, type ReactNode } from "react";--type Props = {- children: React.ReactNode;- content?: React.ReactNode;- open: boolean;- onOpenChange: (open: boolean) => void;-};--// @todo replace with theme variables, as of now they are no ready yet-const borderRadius = 22;-const backgroundColor = "#1D1D1D";-const borderColor = "#323232";-const boxShadow =- "0px 5px 17px 0px rgba(0, 0, 0, 0.30), 0px 2px 7px 0px rgba(0, 0, 0, 0.10)";--const GridContainer = styled(Grid, {- gridTemplateColumns: `max-content 1fr`,- gridAutoColumns: "max-content",- gridAutoFlow: "column",- padding: theme.spacing[5],- borderRadius,- variants: {- open: {- true: {- borderTopLeftRadius: 0,- borderTopRightRadius: 0,- borderTop: `1px solid ${borderColor}`,- },- },- },-});--const CollapsibleRoot = styled(Collapsible.Root, {- color: theme.colors.foregroundContrastMain,- backgroundColor,- borderRadius,- border: `1px solid ${borderColor}`,- boxShadow,-});--const CollapsibleContent = styled(Collapsible.Content, {- width: "min-content",- minWidth: "100%",-});--export const CommandBar = (props: Props) => {- const open = props.content !== undefined && props.open;- const onOpenChange =- props.content !== undefined ? props.onOpenChange : undefined;-- return (- <CollapsibleRoot open={open} onOpenChange={onOpenChange}>- <CollapsibleContent>{props.content}</CollapsibleContent>- <GridContainer gap={2} open={props.open}>- {props.children}- </GridContainer>- </CollapsibleRoot>- );-};--export const CommandBarTrigger = forwardRef<- HTMLButtonElement,- { children: ReactNode }->((props, ref) => <Collapsible.Trigger ref={ref} asChild {...props} />);-CommandBarTrigger.displayName = "CommandBarTrigger";--export const CommandBarContentSection = (props: { children: ReactNode }) => (- <Grid css={{ padding: theme.panel.padding }} gap={2} {...props} />-);--export const CommandBarContentSeparator = styled(Separator.Root, {- backgroundColor: borderColor,- height: 1,-});--const CommandBarContentPromptStyled = styled(Button, {- justifyContent: "start",- p: theme.spacing[4],- height: "auto",-});--const CommandBarContentPromptText = styled("span", {- overflow: "auto",- whiteSpace: "break-spaces",-});--export const CommandBarContentPrompt = forwardRef<- HTMLButtonElement,- {- children: ReactNode;- onClick?: () => void;- }->((props, ref) => {- return (- <CommandBarContentPromptStyled ref={ref} color="dark" {...props}>- <CommandBarContentPromptText>- {props.children}- </CommandBarContentPromptText>- </CommandBarContentPromptStyled>- );-});--CommandBarContentPrompt.displayName = "CommandBarContentPrompt";diff --git a/packages/design-system/src/components/ai-command-bar/index.tsx b/packages/design-system/src/components/ai-command-bar/index.tsxdeleted file mode 100644index cb66f1e49f..0000000000--- a/packages/design-system/src/components/ai-command-bar/index.tsx+++ /dev/null@@ -1,9 +0,0 @@-export {- CommandBar,- CommandBarContentPrompt,- CommandBarContentSection,- CommandBarContentSeparator,- CommandBarTrigger,-} from "./command-bar";-export { AutogrowTextArea } from "./autogrow-text-area";-export { CommandBarButton } from "./command-bar-button";diff --git a/packages/design-system/src/index.ts b/packages/design-system/src/index.tsindex 898ed28645..4422f98b23 100644--- a/packages/design-system/src/index.ts+++ b/packages/design-system/src/index.ts@@ -52,7 +52,6 @@ export * from "./components/component-card";export * from "./components/input-field";export * from "./components/nested-input-button";export * from "./components/panel-tabs";-export * from "./components/ai-command-bar";export * from "./components/link";export * from "./components/panel-banner";export * from "./components/focus-ring";