Skip to content

Commit

Permalink
fix: added missing theming props to file upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Pagebakers committed Feb 6, 2024
1 parent a4f5bf1 commit ae2e787
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/modern-jokes-sing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@saas-ui/file-upload': patch
---

Added missing theming props
17 changes: 15 additions & 2 deletions packages/saas-ui-file-upload/src/file-upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
Image,
ImageProps,
useEnvironment,
ThemingProps,
} from '@chakra-ui/react'

import { pick, runIfFn, split } from '@chakra-ui/utils'
Expand All @@ -27,13 +28,22 @@ import { fileUploadTheme } from './file-upload-theme'

export interface FileUploadProps
extends Omit<HTMLChakraProps<'div'>, 'children' | 'dir'>,
ThemingProps<'SuiFileUpload'>,
FileUploadOptions {
children: MaybeRenderProp<FileUploadRenderContext>
inputRef?: React.Ref<HTMLInputElement>
}

export const FileUpload = forwardRef<FileUploadProps, 'div'>((props, ref) => {
const { children, inputRef, ...rest } = props
const {
children,
inputRef,
colorScheme,
size,
variant,
styleConfig,
...rest
} = props

const [options, containerProps] = split(rest, [
'accept',
Expand All @@ -59,7 +69,10 @@ export const FileUpload = forwardRef<FileUploadProps, 'div'>((props, ref) => {
})

const styles = useMultiStyleConfig('SuiFileUpload', {
styleConfig: fileUploadTheme,
styleConfig: styleConfig ?? fileUploadTheme,
size,
variant,
colorScheme,
})

const renderContext: FileUploadRenderContext = pick(context, [
Expand Down

0 comments on commit ae2e787

Please sign in to comment.