Esri / calcite-design-system

A monorepo containing the packages for Esri's Calcite Design System
https://developers.arcgis.com/calcite-design-system/
Other
289 stars 76 forks source link

Component: Radio Group #5

Closed patrickarlt closed 5 years ago

patrickarlt commented 5 years ago

https://github.com/Esri/calcite-web/issues/1030

Also See: https://ionicframework.com/docs/api/radio-group, https://ionicframework.com/docs/api/radio

jcfranco commented 5 years ago

@julio8a @patrickarlt I started looking into this and wanted to ask if you had additional comps or examples of how this component would be used? Ionic's radio-group implementation depends on a user providing items where each item has a label and a radio component:

<ion-radio-group>
  <ion-item>
    <ion-label>Cord</ion-label>
    <ion-radio value="cord"></ion-radio>
  </ion-item>

  <ion-item>
    <ion-label>Duesenberg</ion-label>
    <ion-radio value="duesenberg"></ion-radio>
  </ion-item>

  <ion-item>
    <ion-label>Hudson</ion-label>
    <ion-radio value="hudson"></ion-radio>
  </ion-item>

  <ion-item>
    <ion-label>Packard</ion-label>
    <ion-radio value="packard"></ion-radio>
  </ion-item>

  <ion-item>
    <ion-label>Studebaker</ion-label>
    <ion-radio value="studebaker"></ion-radio>
  </ion-item>
</ion-radio-group>

Not sure if we wanted something similar or something a little more simple like:

<calcite-radio-group>
  <calcite-radio-group-item value="cord">Cord</calcite-radio-group-item>
  <calcite-radio-group-item value="duesenberg">Duesenberg</calcite-radio-group-item>
  <calcite-radio-group-item value="hudson">Hudson</calcite-radio-group-item>
  <calcite-radio-group-item value="packard">Packard</calcite-radio-group-item>
  <calcite-radio-group-item value="studebaker">Studebaker</calcite-radio-group-item>
</calcite-radio-group>
julio8a commented 5 years ago

the calcite-radio-group definitely seems a lot simpler. Here are some comps of the Radio visual design (along with checkboxes #1 @paulcpederson is working on.):

image

patrickarlt commented 5 years ago

@jcfranco it might be good to follow what @kumarGayu did for <calcite-switch> for this. The big thing would be to wrap an existing form element for the reasons I gave in https://github.com/ArcGIS/calcite-components/pull/24#issuecomment-495786705. We have to have some way for this to hook into default browser <form> behaviors and for frameworks to work with the input in a standardized way. This would probally look like:

<calcite-radio-group>
  <calcite-radio-group-item value="cord">
    Cord <!-- Optional Label-->
    <input slot="input" type="radio" name="foo"> <!-- Hidden element for <form> and frameworks to interact with. Can be hidden by the calcite component. -->
   </calcite-radio-group-item>
  <calcite-radio-group-item value="cord">
    Duesenberg <!-- Optional Label-->
    <input slot="input" type="radio" name="foo"> <!-- Hidden element for <form> and frameworks to interact with. Can be hidden by the calcite component. -->
   </calcite-radio-group-item>
</calcite-radio-group>
jcfranco commented 5 years ago

@julio8a Per our discussion, I will hold off on this until I get a more detailed spec.

jcfranco commented 5 years ago

Very belated update: Spoke w/ @julio8a and this will follow Calcite Web's radio group implementation.

jcfranco commented 5 years ago

@julio8a Could you help provide focus states? Currently, Calcite Web radio group styling does not have any, so there is no indicator on which is one is active when you tab between groups.

Screen Shot 2019-06-13 at 10 43 05 AM
julio8a commented 5 years ago

@jcfranco, there's a conversation about that here: https://github.com/ArcGIS/calcite-components/issues/20

For now, you can use the default browser default? image

jcfranco commented 5 years ago

@julio8a 👌

patrickarlt commented 5 years ago

@julio8a @jcfranco There seems to be quite a bit of difference between the designs in https://github.com/ArcGIS/calcite-components/issues/5#issuecomment-501809327 and the designs in https://github.com/ArcGIS/calcite-components/issues/5#issuecomment-496720647. Do we need to reconcile those? I do really like the "pillbox" style design from @jcfranco. We use similar stuff all over Vector Tile Style Editor:

Screenshot 2019-06-20 08 41 01

jcfranco commented 5 years ago

@patrickarlt @julio8a I'll leave it up to you. 😉

@patrickarlt On a related note, how are you labeling your radio groups? Wrapping in <label>s?

paulcpederson commented 5 years ago

I think @julio8a was showing the designs from radio button, not radio group. The pills-type UI is what we need/use in Online as well: http://esri.github.io/calcite-web/documentation/components/#radio-group

julio8a commented 5 years ago

Yes, I mean radio button, not radio group. 😊

asangma commented 5 years ago

📻

julio8a commented 5 years ago

Some styling updates to the radio-group:

image

jcfranco commented 5 years ago

@julio8a Awesome! Can you share which colors variables/values are being used?

julio8a commented 5 years ago

The active color is now: $blue hover color is: $off-white

paulcpederson commented 5 years ago

Closing for now, any further work can be opened as new issues. Nice work @jcfranco :+1: