Skip to content

Commit

Permalink
UI: Use form attribite with a form in doc root to prevent outer form …
Browse files Browse the repository at this point in the history
…submit (#4283)

* Use form attribite with a form in doc root to prevent outer form submit

* Fix Unsplash a11y bug — don't focus on hidden links

* Combine search and filter into one SearchFilterInput component for Unsplash

* Refactor Browser and ProviderView

* Refactor FileCard to hooks

* Finish SearchFilterInput, add reset labels and no results copy, better styles

* don't use debounce for now

* combine useEffects, named export, extract RenderMetaFields component

* inputCSSClassName --> inputClassName

* Remove typo

* 🤦

* Patch Preact to work with Jest

* tabs vs spaces

---------

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
  • Loading branch information
arturi and aduh95 authored Mar 30, 2023
1 parent e6c9a46 commit f9e9702
Show file tree
Hide file tree
Showing 21 changed files with 533 additions and 475 deletions.
50 changes: 49 additions & 1 deletion .yarn/patches/preact-npm-10.10.0-dd04de05e8.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,53 @@
diff --git a/debug/package.json b/debug/package.json
index 054944f5478a0a5cf7b6b8791950c595f956157b..06a4fe2719605eb42c5ee795101c21cfd10b59ce 100644
--- a/debug/package.json
+++ b/debug/package.json
@@ -9,6 +9,7 @@
"umd:main": "dist/debug.umd.js",
"source": "src/index.js",
"license": "MIT",
+ "type": "module",
"mangle": {
"regex": "^(?!_renderer)^_"
},
diff --git a/devtools/package.json b/devtools/package.json
index 09b04a77690bdfba01083939ff9eaf987dd50bcb..92c159fbb3cf312c6674202085fb237d6fb921ad 100644
--- a/devtools/package.json
+++ b/devtools/package.json
@@ -10,6 +10,7 @@
"source": "src/index.js",
"license": "MIT",
"types": "src/index.d.ts",
+ "type": "module",
"peerDependencies": {
"preact": "^10.0.0"
},
diff --git a/hooks/package.json b/hooks/package.json
index 74807025bf3de273ebada2cd355428a2c972503d..98501726ffbfe55ffa09928e56a9dcafb9a348ff 100644
--- a/hooks/package.json
+++ b/hooks/package.json
@@ -10,6 +10,7 @@
"source": "src/index.js",
"license": "MIT",
"types": "src/index.d.ts",
+ "type": "module",
"scripts": {
"build": "microbundle build --raw",
"dev": "microbundle watch --raw --format cjs",
diff --git a/jsx-runtime/package.json b/jsx-runtime/package.json
index 7a4027831223f16519a74e3028c34f2f8f5f011a..6b58d17dbacce81894467ef43c0a8e2435e388c4 100644
--- a/jsx-runtime/package.json
+++ b/jsx-runtime/package.json
@@ -10,6 +10,7 @@
"source": "src/index.js",
"types": "src/index.d.ts",
"license": "MIT",
+ "type": "module",
"peerDependencies": {
"preact": "^10.0.0"
},
diff --git a/package.json b/package.json
index 60279c24a08b808ffbf7dc64a038272bddb6785d..71cb8aa038daeeb7edf43564ed78a219003a0c99 100644
index 60279c24a08b808ffbf7dc64a038272bddb6785d..088f35fb2c92f2e9b7248557857af2839988d1aa 100644
--- a/package.json
+++ b/package.json
@@ -9,6 +9,7 @@
Expand Down
2 changes: 2 additions & 0 deletions packages/@uppy/core/src/locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default {
connectedToInternet: 'Connected to the Internet',
// Strings for remote providers
noFilesFound: 'You have no files or folders here',
noSearchResults: 'Unfortunately, there are no results for this search',
selectX: {
0: 'Select %{smart_count}',
1: 'Select %{smart_count}',
Expand All @@ -48,6 +49,7 @@ export default {
searchImages: 'Search for images',
enterTextToSearch: 'Enter text to search for images',
search: 'Search',
resetSearch: 'Reset search',
emptyFolderAdded: 'No files were added from empty folder',
folderAlreadyAdded: 'The folder "%{folder}" was already added',
folderAdded: {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { h } from 'preact'

export default function RenderMetaFields (props) {
const {
computedMetaFields,
requiredMetaFields,
updateMeta,
form,
formState,
} = props

const fieldCSSClasses = {
text: 'uppy-u-reset uppy-c-textInput uppy-Dashboard-FileCard-input',
}

return computedMetaFields.map((field) => {
const id = `uppy-Dashboard-FileCard-input-${field.id}`
const required = requiredMetaFields.includes(field.id)
return (
<fieldset key={field.id} className="uppy-Dashboard-FileCard-fieldset">
<label className="uppy-Dashboard-FileCard-label" htmlFor={id}>{field.name}</label>
{field.render !== undefined
? field.render({
value: formState[field.id],
onChange: (newVal) => updateMeta(newVal, field.id),
fieldCSSClasses,
required,
form: form.id,
}, h)
: (
<input
className={fieldCSSClasses.text}
id={id}
form={form.id}
type={field.type || 'text'}
required={required}
value={formState[field.id]}
placeholder={field.placeholder}
onInput={ev => updateMeta(ev.target.value, field.id)}
data-uppy-super-focusable
/>
)}
</fieldset>
)
})
}
Loading

0 comments on commit f9e9702

Please sign in to comment.