-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(stark-ui): adapt stark-slider component to work with the latest …
…version of `nouislider` library breaking change: `StarkSliderConfig` extends nouislider `Options` therefore the start property is now required. In the next major release, the `StarkSliderConfig` interface may be removed.
- Loading branch information
Showing
10 changed files
with
19 additions
and
127 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,3 +1,2 @@ | ||
export * from "./components/slider.component"; | ||
export * from "./components/slider-config.intf"; | ||
export * from "./components/slider-pips.intf"; |
This file contains 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
81 changes: 3 additions & 78 deletions
81
packages/stark-ui/src/modules/slider/components/slider-config.intf.ts
This file contains 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 |
---|---|---|
@@ -1,84 +1,9 @@ | ||
import { StarkSliderPips } from "./slider-pips.intf"; | ||
|
||
/** | ||
* Interface to be used together with the {@link StarkSliderConfig} | ||
* when using advanced formatting options for the {@link StarkSliderComponent}. | ||
*/ | ||
export interface StarkSliderFormatter { | ||
/** | ||
* Function to convert a number to a string with a specific format | ||
*/ | ||
to(rawValue: number): string; // format a number | ||
|
||
/** | ||
* Function to parse the formatted string back to a number | ||
*/ | ||
from(formattedValue: string): number; // get a number back | ||
} | ||
import { Options } from "nouislider"; | ||
|
||
/** | ||
* @deprecated please use the `Options` interface from "nouislider" library directly | ||
* Interface to be implemented when using the {@link StarkSliderComponent}. | ||
* It is in fact a subset of the options supported by the {@link https://github.com/leongersen/noUiSlider/|noUiSlider} library. | ||
*/ | ||
export interface StarkSliderConfig { | ||
/** | ||
* Several ways to handle user interaction. | ||
* | ||
* See {@link https://refreshless.com/nouislider/behaviour-option/|noUiSlider API: Behaviour} | ||
*/ | ||
behaviour?: string; | ||
|
||
/** | ||
* This can be used to control the (green) bar between the handles, or the edges of the slider. | ||
* | ||
* See {@link https://refreshless.com/nouislider/slider-options/#section-connect|noUiSlider API: Connect} | ||
*/ | ||
connect?: boolean | boolean[]; | ||
|
||
/** | ||
* Formatter containing `to()` function to encode the values and a `from()` function to decode them. | ||
*/ | ||
format?: StarkSliderFormatter; | ||
|
||
/** | ||
* Slider's orientation: `"horizontal"` or `"vertical"`. | ||
* | ||
* **In case of vertical sliders, a default height is set via CSS rules which you can override if needed.** | ||
* | ||
* Default: `"horizontal"` | ||
*/ | ||
orientation?: "horizontal" | "vertical"; | ||
|
||
/** | ||
* Config object to define how the pips will be displayed in the slider. | ||
*/ | ||
pips?: StarkSliderPips; | ||
|
||
/** | ||
* All the values that are part of the range. The object should contain at least `min` and `max` properties. | ||
* | ||
* See {@link https://refreshless.com/nouislider/slider-values/#section-range|noUiSlider API: Range} | ||
*/ | ||
range: { | ||
min: number | number[]; | ||
max: number | number[]; | ||
[value: string]: number | number[]; | ||
}; | ||
|
||
/** | ||
* The minimum amount of units that an slider can change within the range. | ||
* | ||
* See {@link https://refreshless.com/nouislider/slider-values/#section-step|noUiSlider API: Step} | ||
*/ | ||
step?: number; | ||
|
||
/** | ||
* Enable/disable the display of tooltips. | ||
* You can also pass a formatter function to format the tooltips content. | ||
* | ||
* See: {@link https://refreshless.com/nouislider/slider-options/#section-tooltips|noUiSlider API: Tooltips} | ||
* | ||
* Default: `false` | ||
*/ | ||
tooltips?: boolean | boolean[] | StarkSliderFormatter; | ||
} | ||
export interface StarkSliderConfig extends Options {} |
13 changes: 0 additions & 13 deletions
13
packages/stark-ui/src/modules/slider/components/slider-pips.intf.ts
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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