AlaskaAirlines / auro-input

Custom HTML element for inputting string data in forms
https://auro.alaskaair.com/components/auro/input
Apache License 2.0
2 stars 4 forks source link

feat: support additional date formats MM, YY, YYYY #359 #360

Closed jason-capsule42 closed 1 week ago

jason-capsule42 commented 1 week ago

Alaska Airlines Pull Request

Type of change:

Please delete options that are not relevant.

Checklist:

By submitting this Pull Request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Pull Requests will be evaluated by their quality of update and whether it is consistent with the goals and values of this project. Any submission is to be considered a conversation between the submitter and the maintainers of this project and may require changes to your submission.

Thank you for your submission!
-- Auro Design System Team

Summary by Sourcery

Add support for new date formats 'month', 'year', and 'fullYear' in the input component and update the documentation with examples for these formats.

New Features:

Documentation:

sourcery-ai[bot] commented 1 week ago

Reviewer's Guide by Sourcery

This PR adds support for three new date input formats: month (MM), year (YY), and full year (YYYY). The implementation extends the existing date input functionality by adding new type configurations, validation rules, and corresponding UI examples.

Class diagram for updated BaseInput class

classDiagram
    class BaseInput {
        +String[] supportedTypes
        +String[] autoFormattingTypes
        +String inputMode
        +String setCustomValidityForType
        +int dateStrLength
        +String helpText
        +String placeholder
        +void configureInput(String type)
        +void setCustomValidity(String type)
        +void setDateStrLength(String type)
        +void setHelpText(String type)
        +String getPlaceholder(String type)
    }
    note for BaseInput "Added support for 'month', 'year', and 'fullYear' types"

Class diagram for updated AuroInput class

classDiagram
    class AuroInput {
        +boolean isDateType()
        +void render()
    }
    AuroInput --|> BaseInput
    note for AuroInput "Added isDateType method to check for new date types"

File-Level Changes

Change Details Files
Added new date input types to the base configuration
  • Added 'month', 'year', and 'fullYear' to the list of valid input types
  • Added date pattern configurations for the new input types
  • Set numeric input mode for all new date types
src/base-input.js
Implemented validation and formatting logic for new date types
  • Added custom validation messages for MM, YY, and YYYY formats
  • Set appropriate date string lengths for each new format
  • Added placeholder text handling for new date types
  • Updated help text configuration for new formats
src/base-input.js
Updated component UI and documentation
  • Added new example components for month, year, and full year inputs
  • Created HTML examples for each new date format
  • Updated API documentation with new date type usage examples
demo/api.md
docs/partials/api.md
apiExamples/month.html
apiExamples/year.html
apiExamples/fullYear.html
Refactored date type detection logic
  • Added isDateType() helper method to centralize date type checking
  • Updated icon rendering logic to use the new date type detection method
src/auro-input.js

Tips and commands #### Interacting with Sourcery - **Trigger a new review:** Comment `@sourcery-ai review` on the pull request. - **Continue discussions:** Reply directly to Sourcery's review comments. - **Generate a GitHub issue from a review comment:** Ask Sourcery to create an issue from a review comment by replying to it. - **Generate a pull request title:** Write `@sourcery-ai` anywhere in the pull request title to generate a title at any time. - **Generate a pull request summary:** Write `@sourcery-ai summary` anywhere in the pull request body to generate a PR summary at any time. You can also use this command to specify where the summary should be inserted. #### Customizing Your Experience Access your [dashboard](https://app.sourcery.ai) to: - Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others. - Change the review language. - Add, remove or edit custom review instructions. - Adjust other review settings. #### Getting Help - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).
blackfalcon commented 1 week ago

:tada: This PR is included in version 4.2.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: