Closed riccardoperra closed 10 months ago
Latest commit: 08fd3b1c18711475249dd1641b25a88072bcac6b
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Hey @fabien-ml, I think I've finished the porting
Unfortunately on react-aria website there is no documentation about the pagination component, but I tried to write one in the README. The example follows the react-spectrum Pagination component.
Also, how should I handle the solid-aria i18n version since it will change? Currently i'm linking to the workspace package https://github.com/solidjs-community/solid-aria/blob/114ac940e7760182e567ba9b7fd1c071c2dc9efd/packages/pagination/package.json#L52
I've also pushed the updated script I made to fetch the intl strings from react-aria repository. Tell me if that's okay. Here what it does:
tmp
into scripts/folder and clone the react-aria repository theresyncIntl
property of root package.json, which is basically an object of localPackageName-remotePackageName in order to know which packages should fetch the intl folder
https://github.com/solidjs-community/solid-aria/blob/43207cfca1f31c67b03f61bd4e1a1e90cac44aad/package.json#L90-L92syncIntl.key
/intl to ./packages/syncIntl.value
/intltmp
folderThe script is runnable with pnpm sync:intl
which basically does npx tsx scripts/syncIntl.cts
https://github.com/solidjs-community/solid-aria/blob/114ac940e7760182e567ba9b7fd1c071c2dc9efd/scripts/syncIntl.cts Here the output: https://github.com/solidjs-community/solid-aria/tree/114ac940e7760182e567ba9b7fd1c071c2dc9efd/packages/pagination/intl
closes #64
Still not finished but I think the most of work it has been done. Something can already be checked
useLocalizedStringFormatter
in @solid-aria/i18nSome considerations:
Updates here: https://github.com/solidjs-community/solid-aria/pull/66#issuecomment-1229426275
We might use a script like this. It can definitely be improved 😄
uncontrolled state might be broken with the current implementationYou must define a defaultValue or state will never be updatedThere are some @ts-expect-error in createPagination.test.ts since the intersection of the JSX.DOMAttributes types break the function call signature 🤔
Typescript types could be improved, it seems they support a string value (probably set by the text input?) and handles the "" stringYou are now able to pass string | number | undefined to onChange, but the new value will be skipped like react-aria/pagination does. All returned values from onNext, onPrevious, onChange, value are numbers. Default value when the new page is invalid or "" or undefined is 1