|
1 | 1 | import { useEffect, useRef } from 'react';
|
2 | 2 | import { useMergedRef, useUncontrolled } from '@mantine/hooks';
|
3 |
| -import { BoxProps, ElementProps, factory, Factory, StylesApiProps, useProps } from '../../core'; |
| 3 | +import { |
| 4 | + BoxProps, |
| 5 | + ElementProps, |
| 6 | + factory, |
| 7 | + Factory, |
| 8 | + StylesApiProps, |
| 9 | + useProps, |
| 10 | + useResolvedStylesApi, |
| 11 | +} from '../../core'; |
4 | 12 | import { CloseButton } from '../CloseButton';
|
5 | 13 | import { FileButton } from '../FileButton';
|
6 | 14 | import { __BaseInputProps, __InputStylesNames, Input, InputVariant } from '../Input';
|
@@ -62,7 +70,7 @@ export interface FileInputProps<Multiple = false>
|
62 | 70 | export type FileInputFactory = Factory<{
|
63 | 71 | props: FileInputProps;
|
64 | 72 | ref: HTMLButtonElement;
|
65 |
| - stylesNames: __InputStylesNames; |
| 73 | + stylesNames: __InputStylesNames | 'placeholder'; |
66 | 74 | variant: InputVariant;
|
67 | 75 | }>;
|
68 | 76 |
|
@@ -99,10 +107,17 @@ const _FileInput = factory<FileInputFactory>((_props, ref) => {
|
99 | 107 | placeholder,
|
100 | 108 | component,
|
101 | 109 | resetRef: resetRefProp,
|
| 110 | + classNames, |
| 111 | + styles, |
102 | 112 | ...others
|
103 | 113 | } = props;
|
104 | 114 |
|
105 | 115 | const resetRef = useRef<() => void>(null);
|
| 116 | + const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<FileInputFactory>({ |
| 117 | + classNames, |
| 118 | + styles, |
| 119 | + props, |
| 120 | + }); |
106 | 121 |
|
107 | 122 | const [_value, setValue] = useUncontrolled<null | File | File[]>({
|
108 | 123 | value,
|
@@ -159,9 +174,17 @@ const _FileInput = factory<FileInputFactory>((_props, ref) => {
|
159 | 174 | __stylesApiProps={props}
|
160 | 175 | unstyled={unstyled}
|
161 | 176 | size={size}
|
| 177 | + classNames={classNames} |
| 178 | + styles={styles} |
162 | 179 | >
|
163 | 180 | {!hasValue ? (
|
164 |
| - <Input.Placeholder>{placeholder}</Input.Placeholder> |
| 181 | + <Input.Placeholder |
| 182 | + __staticSelector="FileInput" |
| 183 | + classNames={resolvedClassNames} |
| 184 | + styles={resolvedStyles} |
| 185 | + > |
| 186 | + {placeholder} |
| 187 | + </Input.Placeholder> |
165 | 188 | ) : (
|
166 | 189 | <ValueComponent value={_value} />
|
167 | 190 | )}
|
|
0 commit comments