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

New Component: Time picker #738

Closed
haworku opened this issue Dec 22, 2020 · 0 comments · Fixed by #1082
Closed

New Component: Time picker #738

haworku opened this issue Dec 22, 2020 · 0 comments · Fixed by #1082
Assignees
Labels
type: feature New feature or request
Milestone

Comments

@haworku
Copy link
Contributor

haworku commented Dec 22, 2020

Time Picker

Description

A time picker helps users select a specific time. It is a specialized combo box, see the combo box documentation for complete usability guidance.
Screen Shot 2020-12-28 at 2 39 22 PM

Requirements (proposed)

Prop Interface

Props = {
  id: string
  name: string
  defaultValue?: string
  disabled?: boolean
  onChange: (val?: string) => void
  minTime: string // hh:mm format
  maxTime: string // hh:mm format
  step? : number //The number of minutes between options. Defaults to 30.
  hint?: string 

}

Render

  return (
  <FormGroup>
      <Label htmlFor={id}>{label}</Label>
      {hint && (
        <div className="usa-hint" id={`${id}-hint`}>
          {hint}
        </div>
      )}

      <div class="usa-time-picker">
        <ComboBox
          options={optionsList}
          {...ComboBoxProps}
        />
      </div>
    </FormGroup>

Example Implementation (proposed)

<TimePicker
   id="appointment-time"
   name="appointment-time"
   defaultValue="10:00"
   onChange: someFunction
   minTime="08:00"
   maxTime="15:00"
   step={60}
/>

More Details

  • The react-uswds FormGroup is the root element
  • The options list, a required prop for ComboBox, should be dynamically created using the minTime, maxTime and step.
  • Some small refactors to ComboBox may be needed. For example, surfacing a prop on ComboBox to pass in custom filter logic, for example a regular expression, to match numbers or hh:mm formated times.
@haworku haworku added type: feature New feature or request status: needs requirements This issue is NOT ready for development - it needs further scope clarification or questions answered labels Dec 22, 2020
@haworku haworku added this to the USWDS 2.9.0 milestone Dec 22, 2020
@haworku haworku changed the title New Component: Time Picker New Component: Time picker Dec 22, 2020
@haworku haworku removed the status: needs requirements This issue is NOT ready for development - it needs further scope clarification or questions answered label Dec 28, 2020
@brandonlenz brandonlenz self-assigned this Mar 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants