Skip to content

Commit ad151ea

Browse files
committed
rename filinput
1 parent 88744b5 commit ad151ea

File tree

11 files changed

+32
-20
lines changed

11 files changed

+32
-20
lines changed

packages/compass-components/src/components/file-input.spec.tsx renamed to packages/compass-components/src/components/file-picker-dialog.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
import FileInput, {
1515
FileInputBackendProvider,
1616
createElectronFileInputBackend,
17-
} from './file-input';
17+
} from './file-picker-dialog';
1818

1919
describe('FileInput', function () {
2020
let spy;

packages/compass-components/src/components/file-input.tsx renamed to packages/compass-components/src/components/file-picker-dialog.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,16 @@ export function createElectronFileInputBackend<ElectronWindow>(
311311
};
312312
}
313313

314-
function FileInput({
314+
/**
315+
* This component is not intended to work in a browser environment. It is designed
316+
* to be used in environments like Electron where you have access to nodes fs module
317+
* to read/write files.
318+
*
319+
* For browser environments, you should use the `FileSelector` component instead.
320+
*
321+
* @deprecated
322+
*/
323+
function FilePickerDialog({
315324
autoOpen = false,
316325
id,
317326
label,
@@ -553,4 +562,4 @@ function FileInput({
553562
);
554563
}
555564

556-
export default FileInput;
565+
export default FilePickerDialog;

packages/compass-components/src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ import type {
1818
ElectronFileDialogOptions,
1919
ElectronShowFileDialogProvider,
2020
FileInputBackend,
21-
} from './components/file-input';
22-
import FileInput, {
21+
} from './components/file-picker-dialog';
22+
import FilePickerDialog, {
2323
createElectronFileInputBackend,
2424
createJSDomFileInputDummyBackend,
2525
FileInputBackendProvider,
26-
} from './components/file-input';
26+
} from './components/file-picker-dialog';
2727
import { OptionsToggle } from './components/options-toggle';
2828
import {
2929
ErrorSummary,
@@ -118,7 +118,7 @@ export {
118118
CollapsibleFieldSet,
119119
ConfirmationModal,
120120
ErrorSummary,
121-
FileInput,
121+
FilePickerDialog,
122122
FileInputBackendProvider,
123123
IndexIcon,
124124
OptionsToggle,

packages/compass-connection-import-export/src/components/file-input.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useCallback } from 'react';
2-
import { FileInput as CompassFileInput } from '@mongodb-js/compass-components';
2+
import { FilePickerDialog } from '@mongodb-js/compass-components';
33

44
type FileInputProps = {
55
label: string;
@@ -24,7 +24,7 @@ export function FileInput({
2424
);
2525

2626
return (
27-
<CompassFileInput
27+
<FilePickerDialog
2828
disabled={disabled}
2929
label={label}
3030
onChange={onChangeFiles}

packages/compass-import-export/src/components/import-file-input.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useCallback } from 'react';
2-
import { FileInput } from '@mongodb-js/compass-components';
2+
import { FilePickerDialog } from '@mongodb-js/compass-components';
33

44
type ImportFileInputProps = {
55
autoOpen?: boolean;
@@ -28,7 +28,7 @@ function ImportFileInput({
2828
const values = fileName ? [fileName] : undefined;
2929

3030
return (
31-
<FileInput
31+
<FilePickerDialog
3232
autoOpen={autoOpen}
3333
label="Import file:"
3434
id="import-file"

packages/connection-form/src/components/advanced-options-tabs/csfle-tab/csfle-tab.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { Binary } from 'bson';
1919
import ConnectionForm from '../../../';
2020
import { getNextKmsProviderName } from './kms-provider-content';
2121
import { FileInputBackendProvider } from '@mongodb-js/compass-components';
22-
import { createJSDomFileInputDummyBackend } from '@mongodb-js/compass-components/lib/components/file-input';
22+
import { createJSDomFileInputDummyBackend } from '@mongodb-js/compass-components/lib/components/file-picker-dialog';
2323

2424
const openAdvancedTab = async (
2525
tabId: 'general' | 'authentication' | 'tls' | 'proxy' | 'advanced' | 'csfle'

packages/connection-form/src/components/advanced-options-tabs/ssh-tunnel-tab/ssh-tunnel-identity.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import SSHTunnelIdentity from './ssh-tunnel-identity';
88
import type { ConnectionFormError } from '../../../utils/validation';
99
import { errorMessageByFieldName } from '../../../utils/validation';
1010
import { FileInputBackendProvider } from '@mongodb-js/compass-components';
11-
import { createJSDomFileInputDummyBackend } from '@mongodb-js/compass-components/lib/components/file-input';
11+
import { createJSDomFileInputDummyBackend } from '@mongodb-js/compass-components/lib/components/file-picker-dialog';
1212

1313
const formFields: {
1414
key: keyof SSHConnectionOptions;

packages/connection-form/src/components/advanced-options-tabs/ssh-tunnel-tab/ssh-tunnel-identity.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, { useCallback } from 'react';
33
import {
44
FormFieldContainer,
55
TextInput,
6-
FileInput,
6+
FilePickerDialog,
77
} from '@mongodb-js/compass-components';
88
import type { SSHConnectionOptions } from '../../../utils/connection-ssh-handler';
99
import type { ConnectionFormError } from '../../../utils/validation';
@@ -113,7 +113,7 @@ function SshTunnelIdentity({
113113
case 'file':
114114
return (
115115
<FormFieldContainer key={name}>
116-
<FileInput
116+
<FilePickerDialog
117117
id={name}
118118
dataTestId={name}
119119
onChange={(files: string[]) => {

packages/connection-form/src/components/advanced-options-tabs/tls-ssl-tab/tls-certificate-authority.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import React from 'react';
2-
import { FormFieldContainer, FileInput } from '@mongodb-js/compass-components';
2+
import {
3+
FormFieldContainer,
4+
FilePickerDialog,
5+
} from '@mongodb-js/compass-components';
36

47
function TLSCertificateAuthority({
58
tlsCAFile,
@@ -15,7 +18,7 @@ function TLSCertificateAuthority({
1518
return (
1619
<>
1720
<FormFieldContainer>
18-
<FileInput
21+
<FilePickerDialog
1922
description={
2023
displayDatabaseConnectionUserHints ? 'Learn More' : undefined
2124
}

packages/connection-form/src/components/advanced-options-tabs/tls-ssl-tab/tls-client-certificate.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import {
33
FormFieldContainer,
4-
FileInput,
4+
FilePickerDialog,
55
TextInput,
66
} from '@mongodb-js/compass-components';
77

@@ -27,7 +27,7 @@ function TLSClientCertificate({
2727
return (
2828
<>
2929
<FormFieldContainer>
30-
<FileInput
30+
<FilePickerDialog
3131
description={
3232
displayDatabaseConnectionUserHints ? 'Learn More' : undefined
3333
}

0 commit comments

Comments
 (0)