Repository navigation
Version Packages - #25
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
@javaabu/forms@0.1.0
Minor Changes
@javaabu/forms/testing:testAdapter(myAdapter)runs conformance tests that render every component through an adapter and check labels, values, native submission, errors and ARIA. The adapter contract is typed (defineAdapter,FormsComponentsand a…SlotPropstype per slot) and documented indocs/advanced-usage/adapters.md.@testing-library/reactis an optional peer dependency.useForm(), a JSON 422 response, theerrorsprop orFormsProvider errors. Fields match them in dot or bracket notation, and array fields (tags[]) also collect their items' errors (tags.0). Error bags work witherrorBag. New:ErrorSummary,ValidationError,errorsFor,selectErrorBaganduseFormState(). Invalid fields getaria-invalidandaria-describedby, and the first one is focused when errors arrive.startIcon,endIconand the newIconcomponent take Blade's 30 bundled Lucide names (pencil,trash-2,eye,check, …) or icon font classes. The Onu adapter maps them to Onu's icon names.closeanderrorstay as aliases ofxandcircle-alert. AddsBUNDLED_ICONS,ICON_ALIASESandresolveIconName()for adapters.useFieldState,splitFieldPropsandusePublishField(withFieldStateOptions,UseFieldOptions,FieldEntryandFieldKind) are exported from the package root, so fields from other packages get InertiauseForm()data, reset,ConditionalWrapperand errors like the built-in ones. New docs page: Custom fields.@javaabu/i18nunder the Blade package's keys (forms::strings.nothing_selected), so apps change them inlang/vendor/forms/{locale}/strings.phpas they do for the Blade components. Generated labels go through__()by default. The locale follows@javaabu/i18n(<html lang>,setLocale()) instead of Onu's.FormsProvider messagesis gone, and the string keys are now snake_case like Blade's (t("nothing_selected")).@javaabu/forms/inertia.<FormsProvider router={inertia}>submits every form as an Inertia visit, with files, method spoofing, error bags, progress,preserveScroll/preserveState(default"errors") andresetOnSuccess. Errors and old input come from the page props.<Form form={useForm(…)}>binds the fields touseFormdata, nested names and checkbox groups included.inertiaLinksputs Inertia'sLinkin theLinkslot. Without Inertia,fetchRoutersubmits JSON requests and shows 422 errors.@inertiajs/react(v2 or v3) is an optional peer dependency.Filter,PerPage,SearchForm,BulkActions,Pagination) no longer readwindow.locationwhile rendering, so Inertia SSR pages hydrate without a mismatch. They read the URL from the router's newuseUrl()hook (the Inertia router returnsusePage().url) or the newFormsProvider url, else the browser's URL after hydration.usePageUrl()andusePageQuery()expose it.Form summarynow defaults tofalse, as in Blade; a general message (a failed submit) still shows at the top.ErrorsandErrorSummarytakebag.Textarea wysiwygrenders the rich text editor. New strings:per_page(thePerPagedefault label),export_titleandexport_options. The parity matrix is indocs/parity.md.@javaabu/react-formsto@javaabu/forms. The package now ships CommonJS next to ESM, and builds itself when installed from Git (github:Javaabu/react-forms#next-gen).<script>tag build,dist/forms.iife.js(also the package'sunpkg/jsdelivrfile and@javaabu/forms/browser). It puts every component and the plain HTML adapter onwindow.JavaabuForms, with React, ReactDOM and@javaabu/i18nbundled in, plush(React.createElement) andmount(target, node, providerProps), so pages without a bundler can use the forms.examples/script-tag.htmlshows it in Dhivehi.@javaabu/forms/shadcn:createShadcnAdapter({ Button, Input, Label, … })makes an adapter from the app's own shadcn/ui components. Slots whose components are missing fall back to plain HTML. Searchable, multiple, tag and server-searched selects use the shadcn combobox (Popover+Command). Radios in a group now update together with any adapter, Radix's button radios included.useTableSelection()gives content inside aTable(itsbulkForm, rows, …) the selected and page row ids andsetSelected().bulkFormcontent is now inside the table's context.<FormsProvider ui={onu}>withonufrom@javaabu/forms/onu, andcomponents={{ Select: MySelect }}replaces single components for the whole app or one form. Without an adapter, components render plain HTML (@javaabu/forms/html).WysiwygandMapInputare now in the main entry. Onu's editor and maps come from@javaabu/forms/onu/editorand/onu/maps, combined withmergeAdapters(onu, onuEditor, onuMaps). The./editorand./mapsentries are gone. Onu is now an optional peer dependency (^0.2.1).Form actionaccepts Laravel Wayfinder routes: route objects (store()), form variants (update.form(user)) and route functions (update, called with the form'smodel). The route's method is used unlessmethodis set, with_methodspoofing forPUT,PATCHandDELETE. Nothing extra is needed to install.Patch Changes
nullold values), nested and array names, checkbox groups, radio groups, relations and date formats follow javaabu/forms. Radios in a group now update together when one is picked.parent=no longer loses its saved value on mount: it waits for the parent's value, and clears only when that value changes.2024-05-01T00:00:00.000000Z) into the browser's time zone.Datekeeps the date as written, and the newapp_timezonesetting (FormsProvider settings) shows every date field in the app's time zone.TabPanelanduseReveal.Textarea wysiwygpassesclassNameandonChangeon. The docs are rewritten for the adapter-based API, withllms.txt, an API reference, an upgrade guide from@javaabu/react-forms, and a Laravel Boost guideline and skill (javaabu-react-forms).FilterSubmit export={["csv", "xlsx"]}submits the format (download=csv) instead of the list index.Icon(andstartIcon/endIcon) no longer crashes on names likeconstructorortoString: they render as icon font classes.animate. While loading, they usearia-disabledand ignore clicks instead ofdisabled, because a button disabled during its own click doesn't submit the form. The shadcn adapter now stylesForm,DescriptionList,DescriptionItemandEmptyState, and lays outinlinefields side by side. New example pages for Inertia and fetch, with a mock Laravel endpoint.MapInputfollows a model that loads later and changedlat,lng,radiusandpolygonprops, and returns to its starting values when the form resets.Number,LatitudeandLongitudewithdecimalsnow submit the rounded value they report: the HTML and shadcn adapters show it once the input loses focus, and the Onu adapter rounds what it reports. The conformance kit checks it.MULTIPOLYGONboundary can be edited, not just the first. A single boundary still draws one polygon, as in Blade.items.0.name) and open the tab or accordion item that holds the field, like the other adapters.node_modules(TS2883 during thepreparebuild).Wysiwyg, and the Onu editor and maps slots, have explicit return types.resetOnSuccesslist leaves out keeps its value, even after an earlier reset of every field.thaana) is documented and tested for every adapter. Dhivehi lines that need a native speaker's review are listed indocs/advanced-usage/dhivehi-and-rtl.md.items[0][name]create arrays inuseForm()data ({ items: [{ name }] }) instead of objects keyed"0".Select(an optional one with a placeholder, orclearable) shows a Clear button beside the trigger.Radiowithvalue=""is no longer always checked.Modal'striggeropens it whenDialogTriggerisn't passed tocreateShadcnAdapter, instead of not rendering.isAjax) select keeps the picked option's label after the search changes, instead of showing its id.Submit's spinner no longer sticks when a native submit doesn't leave the page: it stops onpageshow(back-forward cache) and when a handler prevented the submit.useTableSelection().selectedno longer keeps the ids of rows that left the table (pagination with the table still mounted).Urlnow reports thehttps://it adds on blur throughonChange.default(or bound model value) no longer overrides data thatuseForm()already holds. The store wins, as it does for value fields.File,Image,HiddenandMapInputnow write touseForm()data, so<Form form={useForm(…)}>uploads picked files and submits hidden fields (a multi-select'ssync_<name>,MapInput's coordinates and boundary). Controlled fields write theirvaluetoo, and a reset clears a picked file.<Form form={useForm(…)}>no longer replaces yourform.transform()on every submit. It sets a transform only to add_methodto a multipartPUT/PATCH/DELETE.