Skip to content

feat(slider): S2 migration, new precision variant, embedded textfield #3945

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
wants to merge 32 commits into
base: spectrum-two
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5e3894c
feat(slider): wip track height and gap
aramos-adobe Jun 11, 2025
9975e73
Merge branch 'spectrum-two' into aramos-adobe/css1201-s2-slider-handl…
aramos-adobe Jun 11, 2025
4384a5f
Merge branch 'spectrum-two' into aramos-adobe/css1201-s2-slider-handl…
aramos-adobe Jun 11, 2025
af0af60
feat(slider): adding precision variant
aramos-adobe Jun 12, 2025
750cf36
feat(slider): added emphasized mode, updated ticks
aramos-adobe Jun 17, 2025
5f0b436
Merge branch 'spectrum-two' into aramos-adobe/css1201-s2-slider-handl…
aramos-adobe Jun 17, 2025
dacccde
feat(slider): adding changeset description
aramos-adobe Jun 17, 2025
1f0f24f
Merge branch 'spectrum-two' into aramos-adobe/css1201-s2-slider-handl…
aramos-adobe Jun 18, 2025
31cf9f1
feat(slider): adjust WHCM and typography
aramos-adobe Jun 18, 2025
b96ddfa
Merge branch 'spectrum-two' into aramos-adobe/css1201-s2-slider-handl…
aramos-adobe Jun 20, 2025
f061fd4
feat(slider): adding more test cases for emphasized range
aramos-adobe Jun 20, 2025
b998c67
Merge branch 'spectrum-two' into aramos-adobe/css1201-s2-slider-handl…
aramos-adobe Jun 27, 2025
48ae945
Merge branch 'spectrum-two' into aramos-adobe/css1201-s2-slider-handl…
aramos-adobe Jul 7, 2025
b3d3403
feat(slider): updating pr
aramos-adobe Jul 7, 2025
3bf6d0b
Merge branch 'aramos-adobe/css1201-s2-slider-handle-variant' of https…
aramos-adobe Jul 7, 2025
d2f9540
feat(slider): cleaning custom tokens, textfield focus state
aramos-adobe Jul 7, 2025
4d8db3b
feat(slider): update whcm, using dist tokens
aramos-adobe Jul 8, 2025
8178919
Merge branch 'spectrum-two' into aramos-adobe/css1201-s2-slider-handl…
aramos-adobe Jul 8, 2025
7d9ea7f
feat(slider): new reviews update focus states and tokens
aramos-adobe Jul 8, 2025
f80415b
feat(slider): update metadata
aramos-adobe Jul 8, 2025
e30230a
feat(slider): restoring base project files
aramos-adobe Jul 8, 2025
5c7b2b5
Merge branch 'spectrum-two' into aramos-adobe/css1201-s2-slider-handl…
aramos-adobe Jul 8, 2025
dde14d1
Merge branch 'spectrum-two' into aramos-adobe/css1201-s2-slider-handl…
aramos-adobe Jul 10, 2025
b7a3393
feat(slider): use field label passthrough for top padding
aramos-adobe Jul 10, 2025
7694835
Merge branch 'spectrum-two' into aramos-adobe/css1201-s2-slider-handl…
aramos-adobe Jul 11, 2025
cde957b
feat(slider): adding new changes and updates to story and css
aramos-adobe Jul 11, 2025
e0a7b6e
Merge branch 'spectrum-two' into aramos-adobe/css1201-s2-slider-handl…
rise-erpelding Jul 17, 2025
487f725
fix(slider): pr fixes
rise-erpelding Jul 17, 2025
cf6e418
fix(slider): Update components/slider/dist/metadata.json
rise-erpelding Jul 17, 2025
071e754
Update components/slider/dist/metadata.json
rise-erpelding Jul 17, 2025
e19b4b2
Update components/slider/dist/metadata.json
rise-erpelding Jul 17, 2025
d01e609
Update components/slider/dist/metadata.json
rise-erpelding Jul 17, 2025
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
78 changes: 78 additions & 0 deletions .changeset/shy-actors-behave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
@spectrum-css/slider: major
---

### S2 Slider Migration

#### New features

- Emphasized track fill color
- Precision control handle
- Large and thin track heights
- Embedded editable text field component

#### Visual changes

- No longer a gap between slider handle and the track
- Updated dimensions of slider handles for each size variant
- Updated WHCM for all variants


#### New tokens

`--spectrum-slider-control-to-field-label-editable-extra-large`
`--spectrum-slider-control-to-field-label-editable-large`
`--spectrum-slider-control-to-field-label-editable-medium`
`--spectrum-slider-control-to-field-label-editable-small`
`--spectrum-slider-control-to-side-field-label-extra-large`
`--spectrum-slider-control-to-side-field-label-large`
`--spectrum-slider-control-to-side-field-label-medium`
`--spectrum-slider-control-to-side-field-label-small`
`--spectrum-slider-control-to-text-field-extra-large`
`--spectrum-slider-control-to-text-field-large`
`--spectrum-slider-control-to-text-field-medium`
`--spectrum-slider-control-to-text-field-small`
`--spectrum-slider-editable-control-to-field-label`
`--spectrum-slider-editable-control-to-text-field`
`--spectrum-slider-editable-field-inline-size-extra-large`
`--spectrum-slider-editable-field-inline-size-large`
`--spectrum-slider-editable-field-inline-size-medium`
`--spectrum-slider-editable-field-inline-size-small`
`--spectrum-slider-emphasized-track-fill-color`
`--spectrum-slider-precision-handle-height`
`--spectrum-slider-precision-handle-height-extra-large`
`--spectrum-slider-precision-handle-height-large`
`--spectrum-slider-precision-handle-height-medium`
`--spectrum-slider-precision-handle-height-small`
`--spectrum-slider-precision-handle-width`
`--spectrum-slider-handle-extra-large`
`--spectrum-slider-handle-large`
`--spectrum-slider-handle-medium`
`--spectrum-slider-handle-small`

#### New mods

`--mod-slider-editable-control-to-text-field`
`--mod-slider-editable-field-inline-size`
`--mod-slider-disabled-border-color`
`--mod-slider-emphasized-tick-mark-color`
`--mod-slider-emphasized-track-fill-color`
`--mod-slider-inline-size`
`--mod-slider-label-font-style`
`--mod-slider-label-font-weight`
`--mod-slider-ramp-track-fill-color`
`--mod-slider-tick-mark-color-filled-track`
`--mod-slider-track-height-medium`

#### Removed mods

`--mod-disabled-border-color`
`--mod-sectrum-slider-ramp-handle-border-color-active`
`--mod-slider-handle-border-width-down`
`--mod-slider-handle-gap`
`--mod-slider-ramp-handle-background-color`
`--mod-slider-tick-handle-background-color`
`--mod-slider-tick-mark-color-disabled`
`--mod-slider-track-handleoffset`
`--mod-slider-track-margin-offset`
`--mod-slider-track-middle-handleoffset`
170 changes: 116 additions & 54 deletions components/slider/dist/metadata.json

Large diffs are not rendered by default.

346 changes: 216 additions & 130 deletions components/slider/index.css

Large diffs are not rendered by default.

164 changes: 117 additions & 47 deletions components/slider/stories/slider.stories.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Sizes } from "@spectrum-css/preview/decorators";
import { disableDefaultModes } from "@spectrum-css/preview/modes";
import { isDisabled, isFocused, size } from "@spectrum-css/preview/types";
import { isActive, isDisabled, isEmphasized, isFocused, isHovered, size } from "@spectrum-css/preview/types";
import metadata from "../dist/metadata.json";
import packageJson from "../package.json";
import { SliderGroup } from "./slider.test.js";
Expand Down Expand Up @@ -71,8 +71,19 @@ export default {
control: "select",
options: ["ramp", "offset", "filled"],
},
trackHeight: {
name: "Track height",
type: { name: "string" },
table: {
type: { summary: "string" },
category: "Component",
},
control: "select",
options: ["medium", "large"],
if: { arg: "variant", neq: "ramp" },
},
labelPosition: {
name: "Label Position",
name: "Label position",
type: { name: "string" },
table: {
type: { summary: "string" },
Expand All @@ -81,8 +92,9 @@ export default {
control: "select",
options: ["top", "side"],
},
fillColor: {
name: "Fill color",
trackColor: {
name: "Track color",
description: "Supports standard color input or any valid input for the <code>background</code> property such as, <code>linear-gradient(red, blue)</code> or <code>transparent</code>. Not available for ramp variant.",
type: { name: "string" },
table: {
type: { summary: "string" },
Expand Down Expand Up @@ -112,26 +124,58 @@ export default {
control: "boolean",
if: { arg: "showTicks", truthy: true },
},
isPrecise: {
name: "Precise handle control",
description: "Provides precise control for accurate values.",
type: { name: "boolean" },
table: {
type: { summary: "boolean" },
category: "Component",
},
control: "boolean",
},
isEditable: {
name: "Editable text input",
description: "Enables text input to also control the slider value.",
type: { name: "boolean" },
table: {
type: { summary: "boolean" },
category: "Component",
},
control: "boolean",
},
isEmphasized,
isActive,
isHovered,
isDisabled,
isFocused: {
...isFocused,
if: { arg: "isDisabled", truthy: false },
},
values: { table: { disable: true } },
values: {
table: { disable: true }
},
},
args: {
rootClass: "spectrum-Slider",
isEmphasized: false,
isActive: false,
isHovered: false,
isDisabled: false,
isFocused: false,
showTicks: false,
showTickLabels: false,
labelPosition: "top",
label: "Slider label",
label: "Label",
size: "m",
min: 10,
max: 20,
values: [14],
step: 2,
min: 0,
max: 30,
values: [15],
step: 5,
trackHeight: "medium",
isPrecise: false,
isEditable: false,
variant: "filled",
},
parameters: {
actions: {
Expand All @@ -146,22 +190,30 @@ export default {
},
packageJson,
metadata,
status: {
type: "migrated",
},
},
tags: ["migrated"],
};

/**
* Sliders should always have a label. In rare cases where context is sufficient and an accessibility expert has reviewed the design, the label could be undefined. Top labels are the default and are recommended because they work better with long copy, localization, and responsive layouts.
* The track of the slider can have a fill. By default, the fill originates from the left side of the track when the global direction is LTR and from the right side of the track when the global direction is RTL.
*/
export const Default = SliderGroup.bind({});
Default.args = {};
Default.args = {
variant: "filled",
};

// ********* DOCS ONLY ********* //
/**
* If a slider's label is undefined, it should still include an aria-label in HTML (depending on the context, aria-label or aria-labelledby).
* If a slider's label is undefined, it should still include an aria-label in HTML (depending on the context, "aria-label" or "aria-labelledby").
*/
export const WithoutLabel = Template.bind({});
WithoutLabel.args = {
label: "",
variant: "filled",
};
WithoutLabel.tags = ["!dev"];
WithoutLabel.storyName = "Without label";
Expand All @@ -171,6 +223,18 @@ WithoutLabel.parameters = {
},
};

export const Editable = Template.bind({});
Editable.args = {
...Default.args,
isEditable: true,
};
Editable.tags = ["!dev"];
Editable.parameters = {
chromatic: {
disableSnapshot: true,
},
};

export const Sizing = (args, context) => Sizes({
Template,
withBorder: false,
Expand All @@ -186,31 +250,28 @@ Sizing.parameters = {
};

/**
* The track of the slider can have a fill. By default, the fill originates from the left side of the track.
* If the value represents an offset, the fill start or end can be set to represent the point of origin. This allows the slider fill to extend from the origin toward the handle, in either direction along the track.
*/
export const Filled = Template.bind({});
Filled.args = {
export const Offset = Template.bind({});
Offset.args = {
...Default.args,
variant: "filled",
variant: "offset",
values: [-15],
};
Filled.tags = ["!dev"];
Filled.parameters = {
Offset.tags = ["!dev"];
Offset.parameters = {
chromatic: {
disableSnapshot: true,
},
};

/**
* With fill and offset. If the value represents an offset, the fill start can be set to represent the point of origin. This allows the slider fill to start from inside the track.
*/
export const FilledOffset = Template.bind({});
FilledOffset.args = {
export const Precise = Template.bind({});
Precise.args = {
...Default.args,
min: 0,
variant: "offset",
isPrecise: true,
};
FilledOffset.tags = ["!dev"];
FilledOffset.parameters = {
Precise.tags = ["!dev"];
Precise.parameters = {
chromatic: {
disableSnapshot: true,
},
Expand All @@ -234,7 +295,7 @@ Ramp.parameters = {
export const Range = Template.bind({});
Range.args = {
...Default.args,
values: [14, 16],
values: [10, 20],
};
Range.tags = ["!dev"];
Range.parameters = {
Expand Down Expand Up @@ -275,6 +336,24 @@ TickWithLabels.parameters = {
};
TickWithLabels.storyName = "Tick with labels";

/**
* Large track height.
*/
export const TrackHeight = Template.bind({});
TrackHeight.args = {
...Default.args,
trackHeight: "large",
};
TrackHeight.tags = ["!dev"];
TrackHeight.parameters = {
chromatic: {
disableSnapshot: true,
},
};
TrackHeight.storyName = "Large track height";



export const Disabled = Template.bind({});
Disabled.args = {
...Default.args,
Expand All @@ -287,34 +366,25 @@ Disabled.parameters = {
},
};

export const Focused = Template.bind({});
Focused.args = {
export const Emphasized = Template.bind({});
Emphasized.args = {
...Default.args,
isFocused: true,
isEmphasized: true,
};
Focused.tags = ["!dev"];
Focused.parameters = {
Emphasized.tags = ["!dev"];
Emphasized.parameters = {
chromatic: {
disableSnapshot: true,
},
};

/**
* A gradient can be added to the track of any slider to give more meaning to the range of values. Tracks with a gradient can also have a fill. A gradient track should not be used for choosing a precise color; use a [color slider](/docs/components-color-slider--docs), [color area](/docs/components-color-area--docs), or [color wheel](/docs/components-color-wheel--docs) instead.
*/
export const Gradient = Template.bind({});
Gradient.args = {
export const Focused = Template.bind({});
Focused.args = {
...Default.args,
customStyles: {
"--spectrum-slider-track-color":
"linear-gradient(to right, red, green 100%)",
"--spectrum-slider-track-color-rtl":
"linear-gradient(to left, red, green 100%)",
},
label: "Slider label that is long and wraps to the next line",
isFocused: true,
};
Gradient.tags = ["!dev"];
Gradient.parameters = {
Focused.tags = ["!dev"];
Focused.parameters = {
chromatic: {
disableSnapshot: true,
},
Expand Down
Loading
Loading