Skip to content

Commit

Permalink
Merge pull request #2758 from udecode/registry
Browse files Browse the repository at this point in the history
Update Registry
  • Loading branch information
zbeyens authored Nov 28, 2023
2 parents b623800 + 9243995 commit 4daed4d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions apps/www/public/registry/styles/default/comments-popover.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
{
"name": "comment-more-dropdown.tsx",
"content": "'use client';\n\nimport React from 'react';\nimport {\n useCommentDeleteButton,\n useCommentDeleteButtonState,\n useCommentEditButton,\n useCommentEditButtonState,\n} from '@udecode/plate-comments';\n\nimport { cn } from '@/lib/utils';\nimport { Icons } from '@/components/icons';\nimport { Button } from '@/registry/default/plate-ui/button';\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from '@/registry/default/plate-ui/dropdown-menu';\n\nexport function CommentMoreDropdown() {\n const editButtonState = useCommentEditButtonState();\n const editProps = useCommentEditButton(editButtonState);\n const deleteButtonState = useCommentDeleteButtonState();\n const deleteProps = useCommentDeleteButton(deleteButtonState);\n\n return (\n <DropdownMenu modal={false}>\n <DropdownMenuTrigger asChild>\n <Button variant=\"ghost\" className={cn('h-6 p-1 text-muted-foreground')}>\n <Icons.more className=\"h-4 w-4\" />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent>\n <DropdownMenuItem {...(editProps as any)}>\n Edit comment\n </DropdownMenuItem>\n <DropdownMenuItem {...(deleteProps as any)}>\n Delete comment\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n"
"content": "'use client';\n\nimport React from 'react';\nimport {\n useCommentDeleteButton,\n useCommentDeleteButtonState,\n useCommentEditButton,\n useCommentEditButtonState,\n} from '@udecode/plate-comments';\n\nimport { cn } from '@/lib/utils';\nimport { Icons } from '@/components/icons';\nimport { Button } from '@/registry/default/plate-ui/button';\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from '@/registry/default/plate-ui/dropdown-menu';\n\nexport function CommentMoreDropdown() {\n const editButtonState = useCommentEditButtonState();\n const { props: editProps } = useCommentEditButton(editButtonState);\n const deleteButtonState = useCommentDeleteButtonState();\n const { props: deleteProps } = useCommentDeleteButton(deleteButtonState);\n\n return (\n <DropdownMenu modal={false}>\n <DropdownMenuTrigger asChild>\n <Button variant=\"ghost\" className={cn('h-6 p-1 text-muted-foreground')}>\n <Icons.more className=\"h-4 w-4\" />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent>\n <DropdownMenuItem {...editProps}>Edit comment</DropdownMenuItem>\n <DropdownMenuItem {...deleteProps}>Delete comment</DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n"
},
{
"name": "comment-reply-items.tsx",
Expand All @@ -38,7 +38,7 @@
},
{
"name": "comment-value.tsx",
"content": "'use client';\n\nimport React from 'react';\nimport {\n CommentEditActions,\n CommentEditTextarea,\n useCommentValue,\n} from '@udecode/plate-comments';\n\nimport { cn } from '@/lib/utils';\nimport { buttonVariants } from '@/registry/default/plate-ui/button';\nimport { inputVariants } from '@/registry/default/plate-ui/input';\n\nexport function CommentValue() {\n const { textareaRef } = useCommentValue();\n\n return (\n <div className=\"my-2 flex flex-col items-end gap-2\">\n <CommentEditTextarea\n ref={textareaRef}\n className={cn(inputVariants(), 'min-h-[60px]')}\n />\n\n <div className=\"flex space-x-2\">\n <CommentEditActions.CancelButton\n className={buttonVariants({ variant: 'outline', size: 'xs' })}\n >\n Cancel\n </CommentEditActions.CancelButton>\n\n <CommentEditActions.SaveButton\n className={buttonVariants({ variant: 'default', size: 'xs' })}\n >\n Save\n </CommentEditActions.SaveButton>\n </div>\n </div>\n );\n}\n"
"content": "'use client';\n\nimport React from 'react';\nimport {\n CommentEditActions,\n CommentEditTextarea,\n} from '@udecode/plate-comments';\n\nimport { cn } from '@/lib/utils';\nimport { buttonVariants } from '@/registry/default/plate-ui/button';\nimport { inputVariants } from '@/registry/default/plate-ui/input';\n\nexport function CommentValue() {\n return (\n <div className=\"my-2 flex flex-col items-end gap-2\">\n <CommentEditTextarea className={cn(inputVariants(), 'min-h-[60px]')} />\n\n <div className=\"flex space-x-2\">\n <CommentEditActions.CancelButton\n className={buttonVariants({ variant: 'outline', size: 'xs' })}\n >\n Cancel\n </CommentEditActions.CancelButton>\n\n <CommentEditActions.SaveButton\n className={buttonVariants({ variant: 'default', size: 'xs' })}\n >\n Save\n </CommentEditActions.SaveButton>\n </div>\n </div>\n );\n}\n"
}
],
"type": "components:plate-ui"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"files": [
{
"name": "table-cell-element.tsx",
"content": "import React from 'react';\nimport { PlateElement, PlateElementProps, Value } from '@udecode/plate-common';\nimport {\n TTableCellElement,\n useTableCellElement,\n useTableCellElementResizable,\n useTableCellElementResizableState,\n useTableCellElementState,\n} from '@udecode/plate-table';\n\nimport { cn } from '@/lib/utils';\n\nimport { ResizeHandle } from './resizable';\n\nexport interface TableCellElementProps\n extends PlateElementProps<Value, TTableCellElement> {\n hideBorder?: boolean;\n isHeader?: boolean;\n}\n\nconst TableCellElement = React.forwardRef<\n React.ElementRef<typeof PlateElement>,\n TableCellElementProps\n>(({ children, className, style, hideBorder, isHeader, ...props }, ref) => {\n const { element } = props;\n\n const {\n colIndex,\n rowIndex,\n readOnly,\n selected,\n hovered,\n hoveredLeft,\n rowSize,\n borders,\n isSelectingCell,\n } = useTableCellElementState();\n const { props: cellProps } = useTableCellElement({ element: props.element });\n const resizableState = useTableCellElementResizableState({\n colIndex,\n rowIndex,\n });\n const { rightProps, bottomProps, leftProps, hiddenLeft } =\n useTableCellElementResizable(resizableState);\n\n const Cell = isHeader ? 'th' : 'td';\n\n return (\n <PlateElement\n asChild\n ref={ref}\n className={cn(\n 'relative overflow-visible border-none bg-background p-0',\n hideBorder && 'before:border-none',\n element.background ? 'bg-[--cellBackground]' : 'bg-background',\n !hideBorder &&\n cn(\n isHeader && 'text-left [&_>_*]:m-0',\n 'before:h-full before:w-full',\n selected && 'before:z-10 before:bg-muted',\n \"before:absolute before:box-border before:select-none before:content-['']\",\n borders &&\n cn(\n borders.bottom?.size &&\n `before:border-b before:border-b-border`,\n borders.right?.size && `before:border-r before:border-r-border`,\n borders.left?.size && `before:border-l before:border-l-border`,\n borders.top?.size && `before:border-t before:border-t-border`\n )\n ),\n className\n )}\n {...cellProps}\n {...props}\n style={\n {\n '--cellBackground': element.background,\n ...style,\n } as React.CSSProperties\n }\n >\n <Cell>\n <div\n className=\"relative z-20 box-border h-full px-3 py-2\"\n style={{\n minHeight: rowSize,\n }}\n >\n {children}\n </div>\n\n {!isSelectingCell && (\n <div\n className=\"group absolute top-0 h-full w-full select-none\"\n contentEditable={false}\n suppressContentEditableWarning={true}\n >\n {!readOnly && (\n <>\n <ResizeHandle\n {...rightProps}\n className=\"-top-3 right-[-5px] w-[10px]\"\n />\n <ResizeHandle\n {...bottomProps}\n className=\"bottom-[-5px] h-[10px]\"\n />\n {!hiddenLeft && (\n <ResizeHandle\n {...leftProps}\n className=\"-top-3 left-[-5px] w-[10px]\"\n />\n )}\n\n {hovered && (\n <div\n className={cn(\n 'absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring',\n 'right-[-1.5px]'\n )}\n />\n )}\n {hoveredLeft && (\n <div\n className={cn(\n 'absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring',\n 'left-[-1.5px]'\n )}\n />\n )}\n </>\n )}\n </div>\n )}\n </Cell>\n </PlateElement>\n );\n});\nTableCellElement.displayName = 'TableCellElement';\n\nconst TableCellHeaderElement = React.forwardRef<\n React.ElementRef<typeof TableCellElement>,\n TableCellElementProps\n>((props, ref) => {\n return <TableCellElement ref={ref} {...props} isHeader />;\n});\nTableCellHeaderElement.displayName = 'TableCellHeaderElement';\n\nexport { TableCellElement, TableCellHeaderElement };\n"
"content": "import React from 'react';\nimport { PlateElement, PlateElementProps, Value } from '@udecode/plate-common';\nimport {\n TTableCellElement,\n useTableCellElement,\n useTableCellElementResizable,\n useTableCellElementResizableState,\n useTableCellElementState,\n} from '@udecode/plate-table';\n\nimport { cn } from '@/lib/utils';\n\nimport { ResizeHandle } from './resizable';\n\nexport interface TableCellElementProps\n extends PlateElementProps<Value, TTableCellElement> {\n hideBorder?: boolean;\n isHeader?: boolean;\n}\n\nconst TableCellElement = React.forwardRef<\n React.ElementRef<typeof PlateElement>,\n TableCellElementProps\n>(({ children, className, style, hideBorder, isHeader, ...props }, ref) => {\n const { element } = props;\n\n const {\n colIndex,\n rowIndex,\n readOnly,\n selected,\n hovered,\n hoveredLeft,\n rowSize,\n borders,\n isSelectingCell,\n colSpan,\n } = useTableCellElementState();\n const { props: cellProps } = useTableCellElement({ element: props.element });\n const resizableState = useTableCellElementResizableState({\n colIndex,\n rowIndex,\n colSpan,\n });\n\n const { rightProps, bottomProps, leftProps, hiddenLeft } =\n useTableCellElementResizable(resizableState);\n\n const Cell = isHeader ? 'th' : 'td';\n\n return (\n <PlateElement\n asChild\n ref={ref}\n className={cn(\n 'relative h-full overflow-visible border-none bg-background p-0',\n hideBorder && 'before:border-none',\n element.background ? 'bg-[--cellBackground]' : 'bg-background',\n !hideBorder &&\n cn(\n isHeader && 'text-left [&_>_*]:m-0',\n 'before:h-full before:w-full',\n selected && 'before:z-10 before:bg-muted',\n \"before:absolute before:box-border before:select-none before:content-['']\",\n borders &&\n cn(\n borders.bottom?.size &&\n `before:border-b before:border-b-border`,\n borders.right?.size && `before:border-r before:border-r-border`,\n borders.left?.size && `before:border-l before:border-l-border`,\n borders.top?.size && `before:border-t before:border-t-border`\n )\n ),\n className\n )}\n {...cellProps}\n {...props}\n style={\n {\n '--cellBackground': element.background,\n ...style,\n } as React.CSSProperties\n }\n >\n <Cell>\n <div\n className=\"relative z-20 box-border h-full px-3 py-2\"\n style={{\n minHeight: rowSize,\n }}\n >\n {children}\n </div>\n\n {!isSelectingCell && (\n <div\n className=\"group absolute top-0 h-full w-full select-none\"\n contentEditable={false}\n suppressContentEditableWarning={true}\n >\n {!readOnly && (\n <>\n <ResizeHandle\n {...rightProps}\n className=\"-top-3 right-[-5px] w-[10px]\"\n />\n <ResizeHandle\n {...bottomProps}\n className=\"bottom-[-5px] h-[10px]\"\n />\n {!hiddenLeft && (\n <ResizeHandle\n {...leftProps}\n className=\"-top-3 left-[-5px] w-[10px]\"\n />\n )}\n\n {hovered && (\n <div\n className={cn(\n 'absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring',\n 'right-[-1.5px]'\n )}\n />\n )}\n {hoveredLeft && (\n <div\n className={cn(\n 'absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring',\n 'left-[-1.5px]'\n )}\n />\n )}\n </>\n )}\n </div>\n )}\n </Cell>\n </PlateElement>\n );\n});\nTableCellElement.displayName = 'TableCellElement';\n\nconst TableCellHeaderElement = React.forwardRef<\n React.ElementRef<typeof TableCellElement>,\n TableCellElementProps\n>((props, ref) => {\n return <TableCellElement ref={ref} {...props} isHeader />;\n});\nTableCellHeaderElement.displayName = 'TableCellHeaderElement';\n\nexport { TableCellElement, TableCellHeaderElement };\n"
}
],
"type": "components:plate-ui"
Expand Down
Loading

0 comments on commit 4daed4d

Please sign in to comment.