-
Notifications
You must be signed in to change notification settings - Fork 127
feat(slider-component): slider component adr #1039
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
Open
oguzergul
wants to merge
1
commit into
next
Choose a base branch
from
slider-component
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| ## Figma Design Document | ||
|
|
||
| The design specifications are available at: | ||
|
|
||
| https://www.figma.com/design/lSvX6Qe0jc8b4CaIK7egXR/Baklava-Component-Library?node-id=16904-2220&p=f&t=ha2Q6ZmSpIAmUmUM-0 | ||
|
|
||
| ## Implementation | ||
|
|
||
| Basic Usage | ||
|
|
||
| ```html | ||
| <bl-slider value="75"></bl-slider> | ||
| ``` | ||
| ### Usage Examples | ||
|
|
||
| With Label | ||
|
|
||
| ```html | ||
| <bl-slider label="Brightness" value="75"></bl-slider> | ||
| ``` | ||
|
|
||
| With Helper Text | ||
|
|
||
| ```html | ||
| <bl-slider label="Brightness" helpText="Adjust screen brightness" value="75"></bl-slider> | ||
| ``` | ||
|
|
||
| With Marks (Discrete Slider) | ||
|
|
||
| ```html | ||
| <bl-slider | ||
| label="Size" | ||
| value="50" | ||
| step="25" | ||
| marks='[{"value":0,"label":"xs"},{"value":25,"label":"sm"},{"value":50,"label":"md"},{"value":75,"label":"lg"},{"value":100,"label":"xl"}]' | ||
| </bl-slider> | ||
| ``` | ||
|
|
||
| With Tooltip | ||
|
|
||
| ```html | ||
| <bl-slider label="Progress" tooltip value="60"></bl-slider> | ||
| ``` | ||
|
|
||
| With Custom Min/Max Values | ||
|
|
||
| ```html | ||
| <bl-slider label="Temperature" min="-20" max="40" value="22"></bl-slider> | ||
| ``` | ||
|
|
||
| With Decimal Step | ||
|
|
||
| ```html | ||
| <bl-slider label="Animation Speed" min="0.5" max="2" step="0.1" value="1.0" tooltip></bl-slider> | ||
| ``` | ||
|
|
||
| With Event Handling | ||
|
|
||
| ```js | ||
| const handleSliderChange = (event) => { | ||
| console.log('Slider value changed:', event.detail.value); | ||
| // Update your state or perform actions with the new value | ||
| } | ||
|
|
||
| <bl-slider label="Brightness" value="75" @bl-slider-change="handleSliderChange"></bl-slider> | ||
| ``` | ||
|
|
||
| ### Rules | ||
|
|
||
| Some rules about how this component should behave and implemented | ||
|
|
||
AykutSarac marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| * Slider has only one size and hence no size attribute has been provided | ||
| * When using both `marks` and `step` together, consider matching the step values with mark positions for consistent behavior | ||
| * The slider value is always constrained between the min and max values | ||
|
|
||
| ## API Reference: | ||
|
|
||
| #### Attributes | ||
|
|
||
| | Attribute | Description | Default Value | | ||
| |----------------------|-------------------------------------------------------------------------------------------|---------------| | ||
| | label (`string`) | Label for the slider | - | | ||
| | disabled (`boolean`) | Makes slider disabled | false | | ||
| | value (`string`) | Sets sliders value | - | | ||
| | helpText (`string`) | Sets help text for the slider | - | | ||
| | min (`string`) | Sets min value for the slider | '0' | | ||
| | max (`string`) | Sets max value for the slider | '100' | | ||
| | step (`string`) | Sets step increment for the slider | '1' | | ||
| | tooltip (`boolean`) | Shows value tooltip during slider interaction | false | | ||
| | marks (`string`) | JSON string of objects with `value` and `label` properties to display marks on the slider | - | | ||
|
|
||
| #### Events | ||
|
|
||
| | Event | Description | Payload | | ||
| |--------------------|--------------------------------------------------------------------------|-------------------| | ||
| | `bl-slider-change` | Will be triggered when the slider value changes through user interaction | `{value: number}` | | ||
|
|
||
| #### CSS Custom Properties | ||
|
|
||
| | Property | Description | Default | | ||
| |---------------------------|-----------------------------------|-------------------------------| | ||
| | `--bl-slider-color` | Color of the active track & thumb | `--bl-color-primary` | | ||
| | `--bl-slider-track-color` | Color of the inactive track | `--bl-color-neutral-lightest` | | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1- Can we rename the
tooltipattribute to more actionable name likeshowLabelOnHover?2-
marksshould be an array, it says "string" in the document3- value should be number