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

feat: add new input type - SliderComponent + tests #4144

Merged
merged 27 commits into from
Oct 16, 2024

Conversation

Cristhianzl
Copy link
Collaborator

This PR introduces a new input type, SliderComponent, designed to provide a more interactive way for users to input numerical values by sliding a handle along a defined range.

Changes:

  • Added SliderComponent to the available input types.
  • SliderComponent supports configuration for:
  • Min and Max values.
  • Step value for controlling the increment/decrement.
  • Default value for initial setup.
  • Labels for displaying values alongside the slider.

…rt slider input type in parameter rendering

🔧 (parameterRenderComponent/index.tsx): import SliderComponent and add logic to render slider input type based on template data type
…ider functionality in the frontend, including support for dark mode, customizable labels, icons, and button options.
…he frontend to enhance user experience and interactivity.
… number values in addition to strings for better flexibility and type safety

📝 (index.ts): add new optional properties minLabel, maxLabel, minLabelIcon, maxLabelIcon, sliderButtons, and sliderButtonsOptions to FloatComponentType for enhanced customization options
…de readability and add support for different slider input configurations.
…th value, disabled state, onChange function, and range specification. Add sliderInput flag to FloatComponentType to indicate the presence of a slider input.
…ionality to ensure users can interact with the slider input and perform various actions on the page.
…e input classes

✨ (inputs/input_mixin.py): Introduce SliderMixin class to handle slider input type in the application
…h slider functionality in language flow inputs.
…gent string for better browser compatibility handling

📝 (sliderComponent.spec.ts): Add additional functionality to handle slider input based on user agent OS information
📝 (sliderComponent.spec.ts): Update code to replace FloatInput with SliderInput and add additional input options for slider customization
📝 (sliderComponent.spec.ts): Add new test cases and functions for mutual validation and slider movement in the UI
…alue to ensure value falls within specified min and max range
…or max value based on input value, min, and max to improve code readability and maintainability

♻️ (sliderComponent/index.tsx): Refactor code to use the new utility function to calculate valueAsNumber based on input value, min, and max instead of directly converting the value to a number and setting step afterwards. This improves code clarity and maintainability.
…ist of strings instead of a list of dictionaries to simplify the data structure and improve readability
…LOR_BACKGROUND, DARK_COLOR_TEXT, LIGHT_COLOR_BACKGROUND, and LIGHT_COLOR_TEXT for better readability and maintainability

🐛 (sliderComponent/index.tsx): fix sliderButtons default value to be true instead of false for consistency and expected behavior
♻️ (sliderComponent/index.tsx): refactor code to use the newly added constants for dark and light colors instead of hardcoding values
…orted types in LANGFLOW_SUPPORTED_TYPES for frontend functionality.
…erRenderComponent and SliderComponent

📝 (frontend): update SliderComponent to use default slider buttons options if none provided
📝 (frontend): update SliderComponentType to use 'id' instead of 'value' for slider buttons options
…n_label_icon, and max_label_icon in SliderMixin class

🔧 (index.tsx): refactor SliderComponent to use constants for default labels and icons, and ensure sliderButtonsOptions is properly set when sliderButtons is true
@Cristhianzl Cristhianzl self-assigned this Oct 14, 2024
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. enhancement New feature or request labels Oct 14, 2024
@Cristhianzl Cristhianzl changed the title feat: add new input type - SliderComponent feat: add new input type - SliderComponent + TESTS Oct 14, 2024
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Oct 14, 2024
@github-actions github-actions bot added the enhancement New feature or request label Oct 14, 2024
src/frontend/src/components/sliderComponent/index.tsx Outdated Show resolved Hide resolved
Copy link
Collaborator

@lucaseduoli lucaseduoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Oct 15, 2024
@Cristhianzl Cristhianzl enabled auto-merge (squash) October 16, 2024 10:19
@ogabrielluiz ogabrielluiz changed the title feat: add new input type - SliderComponent + TESTS feat: add new input type - SliderComponent + tests Oct 16, 2024
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Oct 16, 2024
@Cristhianzl Cristhianzl merged commit 51b3909 into main Oct 16, 2024
28 checks passed
@Cristhianzl Cristhianzl deleted the cz/slider-component branch October 16, 2024 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lgtm This PR has been approved by a maintainer size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants