Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
zbeyens committed Dec 27, 2023
2 parents b022228 + bba06d2 commit 7c28480
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion apps/www/public/registry/styles/default/toolbar.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"files": [
{
"name": "toolbar.tsx",
"content": "'use client';\n\nimport * as React from 'react';\nimport { ComponentPropsWithoutRef, ReactNode } from 'react';\nimport * as ToolbarPrimitive from '@radix-ui/react-toolbar';\nimport { cn, withCn, withRef, withVariants } from '@udecode/cn';\n\nimport { Icons } from '@/components/icons';\n\nimport { Separator } from './separator';\nimport { Toggle, toggleVariants } from './toggle';\nimport {\n Tooltip,\n TooltipContent,\n TooltipPortal,\n TooltipTrigger,\n} from './tooltip';\n\nexport const Toolbar = withCn(\n ToolbarPrimitive.Root,\n 'relative flex select-none items-stretch gap-1 bg-background'\n);\n\nexport const ToolbarToggleGroup = ToolbarPrimitive.ToggleGroup;\n\nexport const ToolbarLink = withCn(\n ToolbarPrimitive.Link,\n 'font-medium underline underline-offset-4'\n);\n\nexport const ToolbarSeparator = withCn(\n ToolbarPrimitive.Separator,\n 'my-1 w-[1px] shrink-0 bg-border'\n);\n\nexport const ToolbarButton = withRef<\n typeof ToolbarPrimitive.Button,\n Omit<ComponentPropsWithoutRef<typeof Toggle>, 'type'> & {\n buttonType?: 'button' | 'toggle';\n pressed?: boolean;\n tooltip?: ReactNode;\n isDropdown?: boolean;\n }\n>(\n (\n {\n className,\n variant,\n size = 'sm',\n isDropdown,\n children,\n pressed,\n value,\n tooltip,\n ...props\n },\n ref\n ) => {\n const [isLoaded, setIsLoaded] = React.useState(false);\n\n React.useEffect(() => {\n setIsLoaded(true);\n }, []);\n\n const content =\n typeof pressed === 'boolean' ? (\n <ToolbarToggleGroup type=\"single\" value=\"single\">\n <ToolbarToggleItem\n ref={ref}\n className={cn(\n toggleVariants({\n variant,\n size,\n }),\n isDropdown && 'my-1 justify-between pr-1',\n className\n )}\n value={pressed ? 'single' : ''}\n {...props}\n >\n <div className=\"flex flex-1\">{children}</div>\n <div>\n {isDropdown && (\n <Icons.arrowDown className=\"ml-0.5 h-4 w-4\" data-icon />\n )}\n </div>\n </ToolbarToggleItem>\n </ToolbarToggleGroup>\n ) : (\n <ToolbarPrimitive.Button\n ref={ref}\n className={cn(\n toggleVariants({\n variant,\n size,\n }),\n isDropdown && 'pr-1',\n className\n )}\n {...props}\n >\n {children}\n </ToolbarPrimitive.Button>\n );\n\n return isLoaded && tooltip ? (\n <Tooltip>\n <TooltipTrigger asChild>{content}</TooltipTrigger>\n\n <TooltipPortal>\n <TooltipContent>{tooltip}</TooltipContent>\n </TooltipPortal>\n </Tooltip>\n ) : (\n <>{content}</>\n );\n }\n);\n\nexport const ToolbarToggleItem = withVariants(\n ToolbarPrimitive.ToggleItem,\n toggleVariants,\n ['variant', 'size']\n);\n\nexport const ToolbarGroup = withRef<\n 'div',\n {\n noSeparator?: boolean;\n }\n>(({ className, children, noSeparator }, ref) => {\n const childArr = React.Children.map(children, (c) => c);\n if (!childArr || childArr.length === 0) return null;\n\n return (\n <div ref={ref} className={cn('flex', className)}>\n {!noSeparator && (\n <div className=\"h-full py-1\">\n <Separator orientation=\"vertical\" />\n </div>\n )}\n\n <div className=\"mx-1 flex items-center gap-1\">{children}</div>\n </div>\n );\n});\n"
"content": "'use client';\n\nimport * as React from 'react';\nimport { ComponentPropsWithoutRef, ReactNode } from 'react';\nimport * as ToolbarPrimitive from '@radix-ui/react-toolbar';\nimport { cn, withCn, withRef, withVariants } from '@udecode/cn';\n\nimport { Icons } from '@/components/icons';\n\nimport { Separator } from './separator';\nimport { Toggle, toggleVariants } from './toggle';\nimport {\n Tooltip,\n TooltipContent,\n TooltipPortal,\n TooltipTrigger,\n} from './tooltip';\n\nexport const Toolbar = withCn(\n ToolbarPrimitive.Root,\n 'relative flex select-none items-stretch gap-1 bg-background'\n);\n\nexport const ToolbarToggleGroup = withCn(\n ToolbarPrimitive.ToolbarToggleGroup,\n 'flex items-center'\n);\n\nexport const ToolbarLink = withCn(\n ToolbarPrimitive.Link,\n 'font-medium underline underline-offset-4'\n);\n\nexport const ToolbarSeparator = withCn(\n ToolbarPrimitive.Separator,\n 'my-1 w-[1px] shrink-0 bg-border'\n);\n\nexport const ToolbarButton = withRef<\n typeof ToolbarPrimitive.Button,\n Omit<ComponentPropsWithoutRef<typeof Toggle>, 'type'> & {\n buttonType?: 'button' | 'toggle';\n pressed?: boolean;\n tooltip?: ReactNode;\n isDropdown?: boolean;\n }\n>(\n (\n {\n className,\n variant,\n size = 'sm',\n isDropdown,\n children,\n pressed,\n value,\n tooltip,\n ...props\n },\n ref\n ) => {\n const [isLoaded, setIsLoaded] = React.useState(false);\n\n React.useEffect(() => {\n setIsLoaded(true);\n }, []);\n\n const content =\n typeof pressed === 'boolean' ? (\n <ToolbarToggleGroup type=\"single\" value=\"single\">\n <ToolbarToggleItem\n ref={ref}\n className={cn(\n toggleVariants({\n variant,\n size,\n }),\n isDropdown && 'my-1 justify-between pr-1',\n className\n )}\n value={pressed ? 'single' : ''}\n {...props}\n >\n <div className=\"flex flex-1\">{children}</div>\n <div>\n {isDropdown && (\n <Icons.arrowDown className=\"ml-0.5 h-4 w-4\" data-icon />\n )}\n </div>\n </ToolbarToggleItem>\n </ToolbarToggleGroup>\n ) : (\n <ToolbarPrimitive.Button\n ref={ref}\n className={cn(\n toggleVariants({\n variant,\n size,\n }),\n isDropdown && 'pr-1',\n className\n )}\n {...props}\n >\n {children}\n </ToolbarPrimitive.Button>\n );\n\n return isLoaded && tooltip ? (\n <Tooltip>\n <TooltipTrigger asChild>{content}</TooltipTrigger>\n\n <TooltipPortal>\n <TooltipContent>{tooltip}</TooltipContent>\n </TooltipPortal>\n </Tooltip>\n ) : (\n <>{content}</>\n );\n }\n);\n\nexport const ToolbarToggleItem = withVariants(\n ToolbarPrimitive.ToggleItem,\n toggleVariants,\n ['variant', 'size']\n);\n\nexport const ToolbarGroup = withRef<\n 'div',\n {\n noSeparator?: boolean;\n }\n>(({ className, children, noSeparator }, ref) => {\n const childArr = React.Children.map(children, (c) => c);\n if (!childArr || childArr.length === 0) return null;\n\n return (\n <div ref={ref} className={cn('flex', className)}>\n {!noSeparator && (\n <div className=\"h-full py-1\">\n <Separator orientation=\"vertical\" />\n </div>\n )}\n\n <div className=\"mx-1 flex items-center gap-1\">{children}</div>\n </div>\n );\n});\n"
}
],
"type": "components:plate-ui"
Expand Down

0 comments on commit 7c28480

Please sign in to comment.