Skip to content

Commit a84d831

Browse files
authored
fix(slider): fix fill placement and tick styling when ranged (#9204)
**Related Issue:** #1631 ## Summary This ensures ranged sliders place the fill and style ticks within the range.
1 parent 27ac02d commit a84d831

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

packages/calcite-components/src/components/slider/slider.stories.ts

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,9 @@ export const spaceGroupSeparatorNoBreak_TestOnly = (): string => html`
447447
`;
448448

449449
export const fillPlacements = (): string => html`
450-
<label>start (default)</label>
450+
<h1>single</h1>
451+
452+
<h2>start (default)</h2>
451453
<calcite-slider min="0" max="100" value="0" fill-placement="start"></calcite-slider>
452454
<calcite-slider min="0" max="100" value="50" fill-placement="start"></calcite-slider>
453455
<calcite-slider min="0" max="100" value="100" fill-placement="start"></calcite-slider>
@@ -456,7 +458,7 @@ export const fillPlacements = (): string => html`
456458
<calcite-slider ticks="10" handle-ticks min="0" max="100" value="50" fill-placement="start"></calcite-slider>
457459
<calcite-slider ticks="10" handle-ticks min="0" max="100" value="100" fill-placement="start"></calcite-slider>
458460
<br />
459-
<label>none</label>
461+
<h2>none</h2>
460462
<calcite-slider min="0" max="100" value="0" fill-placement="none"></calcite-slider>
461463
<calcite-slider min="0" max="100" value="50" fill-placement="none"></calcite-slider>
462464
<calcite-slider min="0" max="100" value="100" fill-placement="none"></calcite-slider>
@@ -465,14 +467,43 @@ export const fillPlacements = (): string => html`
465467
<calcite-slider ticks="10" handle-ticks min="0" max="100" value="50" fill-placement="none"></calcite-slider>
466468
<calcite-slider ticks="10" handle-ticks min="0" max="100" value="100" fill-placement="none"></calcite-slider>
467469
<br />
468-
<label>end</label>
470+
<h2>end</h2>
469471
<calcite-slider min="0" max="100" value="0" fill-placement="end"></calcite-slider>
470472
<calcite-slider min="0" max="100" value="50" fill-placement="end"></calcite-slider>
471473
<calcite-slider min="0" max="100" value="100" fill-placement="end"></calcite-slider>
472474
<br />
473475
<calcite-slider ticks="10" handle-ticks min="0" max="100" value="0" fill-placement="end"></calcite-slider>
474476
<calcite-slider ticks="10" handle-ticks min="0" max="100" value="50" fill-placement="end"></calcite-slider>
475477
<calcite-slider ticks="10" handle-ticks min="0" max="100" value="100" fill-placement="end"></calcite-slider>
478+
479+
<h1>range</h1>
480+
481+
<h2>start (default)</h2>
482+
<calcite-slider min="0" max="100" min-value="0" max-value="25" fill-placement="start"></calcite-slider>
483+
<calcite-slider min="0" max="100" min-value=25" max-value="75" fill-placement="start"></calcite-slider>
484+
<calcite-slider min="0" max="100" min-value="75" max-value="100" fill-placement="start"></calcite-slider>
485+
<br />
486+
<calcite-slider ticks="10" handle-ticks min="0" max="100" min-value="0" max-value="25" fill-placement="start"></calcite-slider>
487+
<calcite-slider ticks="10" handle-ticks min="0" max="100" min-value=25" max-value="75" fill-placement="start"></calcite-slider>
488+
<calcite-slider ticks="10" handle-ticks min="0" max="100" min-value="75" max-value="100" fill-placement="start"></calcite-slider>
489+
<br />
490+
<h2>none</h2>
491+
<calcite-slider min="0" max="100" min-value="0" max-value="25" fill-placement="none"></calcite-slider>
492+
<calcite-slider min="0" max="100" min-value=25" max-value="75" fill-placement="none"></calcite-slider>
493+
<calcite-slider min="0" max="100" min-value="75" max-value="100" fill-placement="none"></calcite-slider>
494+
<br />
495+
<calcite-slider ticks="10" handle-ticks min="0" max="100" min-value="0" max-value="25" fill-placement="none"></calcite-slider>
496+
<calcite-slider ticks="10" handle-ticks min="0" max="100" min-value=25" max-value="75" fill-placement="none"></calcite-slider>
497+
<calcite-slider ticks="10" handle-ticks min="0" max="100" min-value="75" max-value="100" fill-placement="none"></calcite-slider>
498+
<br />
499+
<h2>end</h2>
500+
<calcite-slider min="0" max="100" min-value="0" max-value="25" fill-placement="end"></calcite-slider>
501+
<calcite-slider min="0" max="100" min-value=25" max-value="75" fill-placement="end"></calcite-slider>
502+
<calcite-slider min="0" max="100" min-value="75" max-value="100" fill-placement="end"></calcite-slider>
503+
<br />
504+
<calcite-slider ticks="10" handle-ticks min="0" max="100" min-value="0" max-value="25" fill-placement="end"></calcite-slider>
505+
<calcite-slider ticks="10" handle-ticks min="0" max="100" min-value=25" max-value="75" fill-placement="end"></calcite-slider>
506+
<calcite-slider ticks="10" handle-ticks min="0" max="100" min-value="75" max-value="100" fill-placement="end"></calcite-slider>
476507
`;
477508

478509
export const customLabelsAndTicks = (): string => html`

packages/calcite-components/src/components/slider/slider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ export class Slider
296296
mirror,
297297
});
298298

299-
const { fillPlacement } = this;
299+
const fillPlacement = valueIsRange ? "start" : this.fillPlacement;
300300
const trackRangePlacementStyles =
301301
fillPlacement === "none"
302302
? {

0 commit comments

Comments
 (0)