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

[Core] MultiSlider component #2536

Merged
merged 65 commits into from
Jun 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
f1666d8
Multi range slider
Apr 19, 2018
d892981
Lint and oops
Apr 19, 2018
e4680a2
Use children instead of array of props
Apr 19, 2018
6aeab97
Fix lint?
jscheiny Apr 19, 2018
f2c3530
Merge remote-tracking branch 'upstream/develop' into review/js/multi-…
jscheiny Apr 20, 2018
07d872c
Simplify intent coloring
jscheiny Apr 20, 2018
c8ac5e9
Fix track filling on single slider
jscheiny Apr 20, 2018
7d1aa5a
Fix border radius bug
jscheiny Apr 20, 2018
13ccec6
Add todo
jscheiny Apr 20, 2018
f7e69ae
Change lower/upper -> start/end and below/above -> before/after
jscheiny Apr 20, 2018
b079378
Fix range slider
jscheiny Apr 20, 2018
daccaf8
Example component
jscheiny Apr 20, 2018
5977d41
Fix lint
jscheiny Apr 20, 2018
32208ba
Minor fixes
jscheiny Apr 20, 2018
191425e
Refactor default props
jscheiny Apr 20, 2018
2f9d274
Remove import
jscheiny Apr 24, 2018
621d193
Address comments
jscheiny Apr 25, 2018
cb10803
Use utils function
jscheiny Apr 26, 2018
813c082
Refactor slider tests
jscheiny Apr 30, 2018
fbfef2c
Merge branch 'develop' into js/multi-range-slider
jscheiny May 1, 2018
3549691
Tests
jscheiny May 1, 2018
fbb187e
Merge branch 'js/multi-range-slider' of github.com:jscheiny/blueprint…
jscheiny May 1, 2018
0d12368
Fixes for out of order handles
jscheiny May 1, 2018
bbdc8ff
Improvements to the example
jscheiny May 1, 2018
159c87d
Add default track intent
jscheiny May 1, 2018
8b5f387
Fix vertical track border radii
jscheiny May 2, 2018
0ba20e8
Fix lint
jscheiny May 3, 2018
c63994f
Merge branch 'develop' of github.com:palantir/blueprint into js/multi…
May 22, 2018
ce288a8
convert to new Example component
May 22, 2018
004259d
const/type pair for SliderHandleType
May 22, 2018
77c248b
children type
May 22, 2018
19e472f
Fix example
jscheiny May 23, 2018
9a0fe6b
Move mixin to common
jscheiny May 23, 2018
daca6da
Motivating example for including trackIntent{before,after}
jscheiny May 23, 2018
236ffe2
Rename multiSliderExample.tsx
jscheiny May 23, 2018
eb0ee50
Slider handle interaction kinds
jscheiny May 23, 2018
f58d9ac
MultiRangeSlider -> MultiSlider
jscheiny May 23, 2018
54d0fb3
Use safeInvoke instead of isFunction
jscheiny May 24, 2018
306b183
Memoize sorted handle props
jscheiny May 24, 2018
fbf69e9
Smoother push and less buggy lock behavior
jscheiny May 24, 2018
67536fb
Fix bug with moving sliders across locked boundaries
jscheiny May 24, 2018
2cc1afe
Remove vscode settings
jscheiny May 24, 2018
0f85101
Remove unnecessary indirection
jscheiny May 24, 2018
f5b826b
Simplify example
jscheiny May 24, 2018
b55548c
Starting to implement track stops
jscheiny May 24, 2018
f0d98c3
Fix track stop styling issues
jscheiny May 24, 2018
41eaa11
Refactor existing sliders to use multi-slider
jscheiny May 25, 2018
ef4fb18
Remove CoreSlider quickly
jscheiny Jun 1, 2018
b966b9a
Refactor multislider to be more logically grouped
jscheiny Jun 1, 2018
c225c64
Extract slider utils
jscheiny Jun 1, 2018
1231aa8
Address comments
jscheiny Jun 1, 2018
a23d78c
Fix tests
jscheiny Jun 1, 2018
66c394a
Fix example
jscheiny Jun 1, 2018
5ffe867
Replace track stops with no interaction handles
jscheiny Jun 4, 2018
9fa33e8
fix compiler errors, a few refactors
Jun 4, 2018
04fc607
renames, props, docs
Jun 4, 2018
fa3c176
only one track element, remove some classes
Jun 4, 2018
f700b5e
fix test import
Jun 5, 2018
019d41d
MultiSlider tests (#2576)
giladgray Jun 7, 2018
751e193
Merge branch 'develop' of github.com:palantir/blueprint into js/multi…
Jun 7, 2018
6295ae8
MultiSlider refactors (#2569)
giladgray Jun 7, 2018
ec44d17
MultiSlider docs (#2577)
giladgray Jun 7, 2018
1258fcf
SliderHandle => MultiSlider.Handle (#2578)
giladgray Jun 8, 2018
e4681e6
MultiSlider fixes (#2588)
jscheiny Jun 12, 2018
0b4e7a6
default prop values in docs
Jun 12, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/core/src/common/classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,13 @@ export const SELECT = `${NS}-select`;
export const SKELETON = `${NS}-skeleton`;

export const SLIDER = `${NS}-slider`;
export const SLIDER_AXIS = `${SLIDER}-axis`;
export const SLIDER_HANDLE = `${SLIDER}-handle`;
export const SLIDER_LABEL = `${SLIDER}-label`;
export const SLIDER_TRACK = `${SLIDER}-track`;
export const SLIDER_PROGRESS = `${SLIDER}-progress`;
export const RANGE_SLIDER = `${NS}-range-slider`;
export const START = `${NS}-start`;
export const END = `${NS}-end`;

export const SPINNER = `${NS}-spinner`;
export const SPINNER_HEAD = `${SPINNER}-head`;
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/common/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export const RADIOGROUP_WARN_CHILDREN_OPTIONS_MUTEX =
export const SLIDER_ZERO_STEP = ns + ` <Slider> stepSize must be greater than zero.`;
export const SLIDER_ZERO_LABEL_STEP = ns + ` <Slider> labelStepSize must be greater than zero.`;
export const RANGESLIDER_NULL_VALUE = ns + ` <RangeSlider> value prop must be an array of two non-null numbers.`;
export const MULTISLIDER_INVALID_CHILD = ns + ` <MultiSlider> children must be <SliderHandle>s or <SliderTrackStop>s`;

export const TOASTER_CREATE_NULL =
ns +
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ export interface INamed {
name?: string;
}

export function getDisplayName(ComponentClass: React.ComponentClass | INamed) {
return (ComponentClass as React.ComponentClass).displayName || (ComponentClass as INamed).name || "Unknown";
export function getDisplayName(ComponentClass: React.ComponentType | INamed) {
return (ComponentClass as React.ComponentType).displayName || (ComponentClass as INamed).name || "Unknown";
}

export function isElementOfType<P = {}>(
element: any,
ComponentClass: React.ComponentClass<P>,
ComponentClass: React.ComponentType<P>,
): element is React.ReactElement<P> {
return element != null && element.type === React.createElement(ComponentClass).type;
}
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ export * from "./text/text";
export * from "./popover/popover";
export * from "./portal/portal";
export * from "./progress-bar/progressBar";
export * from "./slider/handleProps";
export * from "./slider/multiSlider";
export * from "./slider/rangeSlider";
export * from "./slider/slider";
export * from "./spinner/spinner";
Expand Down
78 changes: 38 additions & 40 deletions packages/core/src/components/slider/_slider.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,25 @@ $track-height: $track-size !default;
.#{$ns}-slider-progress {
@include slider-track-orientation($handle-size, $track-size, $vertical: false);
position: absolute;
}

.#{$ns}-slider-track {
border-radius: $pt-border-radius;
overflow: hidden;
}

.#{$ns}-slider-progress {
background: rgba($gray1, 0.2);

.#{$ns}-dark & {
background: rgba($black, 0.5);
}
}

.#{$ns}-slider-progress,
.#{$ns}-dark .#{$ns}-slider-progress {
background: $pt-intent-primary;
@each $intent, $color in $pt-intent-colors {
&.#{$ns}-intent-#{$intent} {
background-color: $color;
}
}
}

.#{$ns}-slider-handle {
Expand Down Expand Up @@ -126,6 +134,26 @@ $track-height: $track-size !default;
box-shadow: none;
}
}

&.#{$ns}-start,
&.#{$ns}-end {
width: $handle-size / 2;
}

&.#{$ns}-start {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}

&.#{$ns}-end {
margin-left: $handle-size / 2;
border-top-left-radius: 0;
border-bottom-left-radius: 0;

.#{$ns}-slider-label {
margin-left: 0;
}
}
}

.#{$ns}-slider-label {
Expand All @@ -138,31 +166,6 @@ $track-height: $track-size !default;
font-size: $pt-font-size-small;
}

.#{$ns}-range-slider {
.#{$ns}-slider-handle {
width: $handle-size / 2;

&:first-of-type {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}

&:last-of-type {
margin-left: $handle-size / 2;
border-top-left-radius: 0;
border-bottom-left-radius: 0;

.#{$ns}-slider-label {
margin-left: 0;
}
}
}

.#{$ns}-slider-progress {
border-radius: 0;
}
}

.#{$ns}-slider.#{$ns}-vertical {
@include slider-orientation($pt-input-height-large, $vertical: true);

Expand All @@ -186,20 +189,15 @@ $track-height: $track-size !default;
margin-top: -$handle-size / 2;
margin-left: 0;
}
}
}

.#{$ns}-range-slider.#{$ns}-vertical {
.#{$ns}-slider-handle {
margin-left: 0;
width: $handle-size;
height: $handle-size / 2;

.#{$ns}-slider-label {
&.#{$ns}-end,
&.#{$ns}-start {
margin-left: 0;
width: $handle-size;
height: $handle-size / 2;
}

&:first-of-type {
&.#{$ns}-start {
border-top-left-radius: 0;
border-bottom-right-radius: $pt-border-radius;

Expand All @@ -208,7 +206,7 @@ $track-height: $track-size !default;
}
}

&:last-of-type {
&.#{$ns}-end {
margin-bottom: $handle-size / 2;
border-top-left-radius: $pt-border-radius;
border-bottom-left-radius: 0;
Expand Down
Loading