You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These changes make it so that you can now create resuable components to handle specific actions. i.e.
functionCreateNewFolder(): ReactElement{return<MenuItemonClick={()=>/* some click behavior */}>Folder</MenuItem>;}functionExample(): ReactElement{return(<DropdownMenuid="some-menu-id"buttonChildren="New"><CreateNewFolder/><AnotherAction/><AndAnotherAction/></DropdownMenu>);}
Additional changes:
There will be some new hooks to handle creating custom menus
Support hover mode by default
v6.0.0 Release Target
Improved Select API and Behavior
What I'm mostly trying to accomplish with these changes are:
fix the terrible typescript types so that you don't need to do: onChange={(value) => setValue(value as SomeTypeUnion)}
Allow the Select to handle validation like the TextField and TextArea components
mostly want the required behavior to start working
The Select component will now render an invisible <select> element and all the <option>s instead of using an <input type="hidden" value={CURRENT_VALUE} />. This change makes it so that the Select component can now correctly handle form validation.
I'm still working out the API, but I think it'll mimic the new Menu API since it follows how you'd use a native <select> and allows for elements to be rendered without first creating a list of options:
<Select{...props}>{options.map(({ label, value })=><Optionvalue={value}>{label}</Option></Select>
const[value,setValue]=useState("");<Select{...props}><OptGrouplabel="A">
// the `label` might be optional since I can automatically pull the text content via refs
<Optionlabel="Alabama"value="AL"/><Optionvalue="AK"><strong>Alaska</strong></Option></OptGroup><Divider/><OptGrouplabel={<span>C</span>}><Optionlabel="California"value="CA"disabled/></OptGroup><Optionlabel="Delaware"value="DE"/></Select>
Another alternative is something like this (less preferred now):
interfaceSearchableListboxOption{label: string;value: string;// this would be rendered instead of the `label` if exists. The `label` string is required since this is how the "type to focus" behavior is implemented to mimic the native `<select>` elementchildren?: ReactNode;disabled?: boolean;// Like other places if any of these keys are part of the `ListItemProps`, they will be passed correctly and rendered (like addons, secondaryText, etc)[key: string]: unknown;}typeIgnoredListboxOption=Record<string,unknown>|ReactElement;typeListboxOption=SearchableListboxOption|IgnoredListboxOption;constoptions: readonlyListboxOption[]=[{label: "Some label",value: "a"},{label: "Another Label', value: "b" },<Dividerkey="divider-1"/>,{label: "Final Label",value: "c",disabled: true},];const[value,setValue]=useState("");<Selectid="some-select-id"options={options}label="Some label"value={value}setValue={setValue}required// this is optional (ha) if the default behavior doesn't work for your use-case. IrenderOptions={(option)=>{// this will pretty much be the default implementationreturn<Option{...option}>{option.children??option.label}</Option>}}/>
Quick video example of changes:
Screen.Recording.2021-11-24.at.12.30.20.PM.mov
Remove @react-md/autocomplete package
With all the new Select changes listed above, I think it would be better just to integrate the AutoComplete component into the @react-md/form package with a new useAutoComplete hook and AutoComplete component.
The text was updated successfully, but these errors were encountered:
Due to the already large size of the v4.0.0 release, I'm going to move some of the targeted changes for the v5.0.0 release target instead.
v5.0.0 Release Target
Improved
@react-md/menu
APIA new and improved
@react-md/menu
API. Instead of passing a list ofitems
, directly use the<MenuItem>
components within the children.These changes make it so that you can now create resuable components to handle specific actions. i.e.
Additional changes:
v6.0.0 Release Target
Improved
Select
API and BehaviorWhat I'm mostly trying to accomplish with these changes are:
onChange={(value) => setValue(value as SomeTypeUnion)}
Select
to handle validation like theTextField
andTextArea
componentsrequired
behavior to start workingThe
Select
component will now render an invisible<select>
element and all the<option>
s instead of using an<input type="hidden" value={CURRENT_VALUE} />
. This change makes it so that theSelect
component can now correctly handle form validation.I'm still working out the API, but I think it'll mimic the new
Menu
API since it follows how you'd use a native<select>
and allows for elements to be rendered without first creating a list of options:Another alternative is something like this (less preferred now):
Quick video example of changes:
Screen.Recording.2021-11-24.at.12.30.20.PM.mov
Remove
@react-md/autocomplete
packageWith all the new
Select
changes listed above, I think it would be better just to integrate theAutoComplete
component into the@react-md/form
package with a newuseAutoComplete
hook andAutoComplete
component.The text was updated successfully, but these errors were encountered: