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

framework/element: Add element's SELECTED, MULTIPLE, REQUIRED attributes handling #36

Open
OleksiyRudenko opened this issue May 17, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@OleksiyRudenko
Copy link
Member

... just like CHECKED and DISABLED

Consider adding SingleSelection component example based on <select> .

@f3d0t
Copy link

f3d0t commented May 18, 2021

take on a job

@OleksiyRudenko
Copy link
Member Author

@f3d0t thank you. Just please wait for a while. I gonna fix other issues.
Will let you know when you are all green for this

@OleksiyRudenko
Copy link
Member Author

OleksiyRudenko commented May 18, 2021

@f3d0t we're all green to go.

Updated 2021-05-19 08:54 EEST

Please do the following:

  1. Work on styled-checkbox branch
  2. Create a demo component based on select tag. The component will receive the following props:
  • Minimal (sufficient to test item 3):
    • isMultiple: optional, boolean, default is false; ; shouldn't be rendered if false
    • isRequired: optional, boolean, default is false; shouldn't be rendered if null
    • options: array, where index is used as an option id (option value attribute) and array element itself as an option UI representation visible to a user;
    • selectedOption: option value (string), default is null
    • onChange: optional, function that expects selected option id (value) as an argument
  • Extended:
    • label: optional, string, default is null; should not be rendered if null
    • name: optional, string, default is null; shouldn't be rendered if null
    • size: optional, number, default is 0
  • Advanced:
    • options is an array of option objects (see advanced option object spec below)
  1. Patch createElement to handle SELECTED and MULTIPLE attributes properly

Items 2 & 3 must be individual commits, so that item 3 could be cherry-picked elsewhere

Advanced Option Object Spec

Each option object has the following properties:

  • value: string; used as text if label property is not defined or falsy, or as optgroup label if object has options property defined
  • label: optional, string; if not defined or null or undefined then value is used as an option UI representation visible to a user; ignored when the object represents an optgroup
  • options: optional, array of option objects; if defined then current object is used to render an optgroup

Reference: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select

Let me know if you want to take on the minimal, extended or advanced implementation.
Those can be done at the next iterations or skipped completely.

Feel free asking anything

@OleksiyRudenko OleksiyRudenko changed the title framework/element: Add element's SELECTED attribute handling framework/element: Add element's SELECTED and MULTIPLE attributes handling May 18, 2021
@OleksiyRudenko OleksiyRudenko changed the title framework/element: Add element's SELECTED and MULTIPLE attributes handling framework/element: Add element's SELECTED, MULTIPLE, REQUIRED attributes handling May 18, 2021
@f3d0t
Copy link

f3d0t commented May 19, 2021

Resolving by pull request #41
Add handling of 'disabled' attribute to Select option object

zonzujiro added a commit that referenced this issue Jun 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants