From d91ec79201948fe996d6d2bd41390c99e10851ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20B=C5=82a=C5=BCejewicz=20=28Peter=20Blazejewicz=29?= Date: Thu, 26 Dec 2019 19:24:05 +0100 Subject: [PATCH] feat(nouislider): update `connect` property. Closes #41113 (#41151) Thanks! --- types/nouislider/index.d.ts | 11 ++++++----- types/nouislider/nouislider-tests.ts | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/types/nouislider/index.d.ts b/types/nouislider/index.d.ts index ab085d6376..4c0e02f244 100644 --- a/types/nouislider/index.d.ts +++ b/types/nouislider/index.d.ts @@ -24,12 +24,13 @@ declare namespace noUiSlider { */ range: { [key: string]: number | number[] }; /** - * The connect setting can be used to control the (green) bar between the handles, or the edges of the slider. - * Pass an array with a boolean for every connecting element, including the edges of the slider. - * The length of this array must match the handle count + 1. - * Setting true sets the bars between the handles, but not between the handles and the sliders edges. + * The connect option can be used to control the bar between the handles or the edges of the slider. + * If you are using one handle, set the value to either `upper` or `lower`. + * For sliders with 2 or more handles, pass an array with a boolean for every connecting element, + * including the edges of the slider. The length of this array must match the handle `count + 1`. + * Setting `true` sets the bars between the handles, but not between the handles and the sliders edges. */ - connect?: boolean | boolean[]; + connect?: 'lower' | 'upper' | boolean | boolean[]; /** * When using two handles, the minimum distance between the handles can be set using the margin option. * The margin value is relative to the value set in 'range'. diff --git a/types/nouislider/nouislider-tests.ts b/types/nouislider/nouislider-tests.ts index dc882d0a69..da3f3647d3 100644 --- a/types/nouislider/nouislider-tests.ts +++ b/types/nouislider/nouislider-tests.ts @@ -160,6 +160,22 @@ noUiSlider.create(testHtmlElement, { 'max': 80 } }); +noUiSlider.create(testHtmlElement, { + start: 40, + connect: 'lower', + range: { + 'min': 0, + 'max': 100 + } +}); +noUiSlider.create(testHtmlElement, { + start: 40, + connect: 'upper', + range: { + 'min': 0, + 'max': 100 + } +}); /** * Margin