Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect react-fast-pdf to the Expensify app #12

Merged
merged 32 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
545466d
centrilize page
rezkiy37 Dec 20, 2023
faa7a22
add dynamic error and loading components
rezkiy37 Dec 20, 2023
d914e1a
track dist
rezkiy37 Dec 20, 2023
04755c8
centralize error
rezkiy37 Dec 21, 2023
3a90e92
integrate custom password form
rezkiy37 Dec 21, 2023
8fd0d6c
track dist
rezkiy37 Dec 21, 2023
fb679b8
migrate features
rezkiy37 Dec 21, 2023
59115c9
fix device pixel ratio handling
rezkiy37 Dec 21, 2023
a5e5494
track dist
rezkiy37 Dec 21, 2023
91295e0
rework password form rendering
rezkiy37 Dec 21, 2023
36e8cbb
track dist
rezkiy37 Dec 21, 2023
7a525a4
clarify type
rezkiy37 Dec 21, 2023
3b72469
rework invisible loading when password
rezkiy37 Dec 21, 2023
ecb6779
track dist
rezkiy37 Dec 21, 2023
35d631d
separate container styles
rezkiy37 Dec 21, 2023
73959d8
track dist
rezkiy37 Dec 21, 2023
e3b7c78
bump node version
rezkiy37 Jan 31, 2024
b7b8ccb
bump node version
rezkiy37 Jan 31, 2024
e38b536
upgrade deps.
rezkiy37 Jan 31, 2024
5a6fc35
integrate changes based on latest work at Expensify
rezkiy37 Jan 31, 2024
bdedc07
track dist
rezkiy37 Jan 31, 2024
0e3a635
add a password hint
rezkiy37 Jan 31, 2024
faf2648
fix list width value
rezkiy37 Jan 31, 2024
b925199
track dist
rezkiy37 Jan 31, 2024
551bada
add display name for PDFPreviewer
rezkiy37 Jan 31, 2024
909df2f
hide overflow content
rezkiy37 Jan 31, 2024
d5627b2
track dist
rezkiy37 Jan 31, 2024
4d7908a
fix list width value
rezkiy37 Feb 1, 2024
dac9f20
track dist
rezkiy37 Feb 1, 2024
150ae8d
untrack dist
rezkiy37 Feb 1, 2024
5e866c7
remove dist
rezkiy37 Feb 1, 2024
fb9d445
update package-lock.json
rezkiy37 Feb 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.9.0
20.10.0
2 changes: 1 addition & 1 deletion example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function App() {
type="button"
onClick={() => setFile('example_protected.pdf')}
>
example_protected.pdf
example_protected.pdf (Password: 123456)
</button>
</div>
</>
Expand Down
7 changes: 6 additions & 1 deletion example/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@
}

* {
margin: 0;
color: #e7ece9;
font-family: ExpensifyMono-Neue;
}

*:not(div) {
rezkiy37 marked this conversation as resolved.
Show resolved Hide resolved
margin: 0;
}

body {
width: 100vw;
height: 100vh;
Expand All @@ -38,6 +41,8 @@ body {
}

.react-pdf__Page {
direction: ltr;
margin: 1px auto -8px auto;
background-color: transparent !important;
}

Expand Down
127 changes: 59 additions & 68 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
},
"homepage": "https://github.com/Expensify/react-fast-pdf#readme",
"dependencies": {
"react-pdf": "^7.3.3",
"react-window": "^1.8.9"
"react-pdf": "^7.7.0",
"react-window": "^1.8.10"
},
"peerDependencies": {
"lodash": "4.x",
Expand Down Expand Up @@ -66,13 +66,13 @@
"prettier": "^3.0.0",
"style-loader": "^3.3.3",
"ts-loader": "^9.4.4",
"typescript": "^5.1.6",
"typescript": "^5.3.2",
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1"
},
"engines": {
"node": "20.9.0",
"npm": "10.1.0"
"node": "20.10.0",
"npm": "10.2.3"
}
}
9 changes: 3 additions & 6 deletions src/PDFPasswordForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {isSafari} from './helpers';

type Props = {
isPasswordInvalid?: boolean;
isFocused: boolean;
onSubmit?: (password: string) => void;
onPasswordChange?: (password: string) => void;
onPasswordFieldFocus?: (isFocused: boolean) => void;
Expand All @@ -16,9 +15,6 @@ const propTypes = {
/** If the submitted password is invalid (show an error message) */
isPasswordInvalid: PropTypes.bool,

/** Should focus to the password input */
isFocused: PropTypes.bool.isRequired,

/** Notify parent that the password form has been submitted */
onSubmit: PropTypes.func,

Expand All @@ -36,7 +32,7 @@ const defaultProps = {
onPasswordFieldFocus: () => {},
};

function PDFPasswordForm({isPasswordInvalid, isFocused, onSubmit, onPasswordChange, onPasswordFieldFocus}: Props) {
function PDFPasswordForm({isPasswordInvalid, onSubmit, onPasswordChange, onPasswordFieldFocus}: Props) {
const [password, setPassword] = useState('');
const [validationErrorText, setValidationErrorText] = useState('');
const [shouldShowForm, setShouldShowForm] = useState(false);
Expand Down Expand Up @@ -135,7 +131,7 @@ function PDFPasswordForm({isPasswordInvalid, isFocused, onSubmit, onPasswordChan
*/
autoComplete={isSafari() ? 'username' : 'off'}
// eslint-disable-next-line jsx-a11y/no-autofocus
autoFocus={isFocused}
autoFocus
type="password"
onFocus={() => onPasswordFieldFocus?.(true)}
onBlur={validateAndNotifyPasswordBlur}
Expand All @@ -159,4 +155,5 @@ PDFPasswordForm.propTypes = propTypes;
PDFPasswordForm.defaultProps = defaultProps;
PDFPasswordForm.displayName = 'PDFPasswordForm';

export type {Props as PDFPasswordFormProps};
export default PDFPasswordForm;
Loading
Loading