You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(slider): S2 migration, new precision variant, embedded textfield (#3945)
S2 slider migration changes:
- New default and precision handles
- Track fill for ramp, offset, range and default filled have emphasized states
- More expansive grid for visual testing
- Embedded textfield component for editable variant
- Adjustable track heights ie. thin vs thick
- Updated offset variant (ie. the track starts at the center)
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.",
86
98
type: {name: "string"},
87
99
table: {
88
100
type: {summary: "string"},
@@ -112,26 +124,58 @@ export default {
112
124
control: "boolean",
113
125
if: {arg: "showTicks",truthy: true},
114
126
},
127
+
isPrecise: {
128
+
name: "Precise handle control",
129
+
description: "Provides precise control for accurate values.",
130
+
type: {name: "boolean"},
131
+
table: {
132
+
type: {summary: "boolean"},
133
+
category: "Component",
134
+
},
135
+
control: "boolean",
136
+
},
137
+
isEditable: {
138
+
name: "Editable text input",
139
+
description: "Enables text input to also control the slider value.",
140
+
type: {name: "boolean"},
141
+
table: {
142
+
type: {summary: "boolean"},
143
+
category: "Component",
144
+
},
145
+
control: "boolean",
146
+
},
147
+
isEmphasized,
148
+
isActive,
149
+
isHovered,
115
150
isDisabled,
116
151
isFocused: {
117
152
...isFocused,
118
153
if: {arg: "isDisabled",truthy: false},
119
154
},
120
-
values: {table: {disable: true}},
155
+
values: {
156
+
table: {disable: true}
157
+
},
121
158
},
122
159
args: {
123
160
rootClass: "spectrum-Slider",
161
+
isEmphasized: false,
162
+
isActive: false,
163
+
isHovered: false,
124
164
isDisabled: false,
125
165
isFocused: false,
126
166
showTicks: false,
127
167
showTickLabels: false,
128
168
labelPosition: "top",
129
-
label: "Slider label",
169
+
label: "Label",
130
170
size: "m",
131
-
min: 10,
132
-
max: 20,
133
-
values: [14],
134
-
step: 2,
171
+
min: 0,
172
+
max: 30,
173
+
values: [15],
174
+
step: 5,
175
+
trackHeight: "medium",
176
+
isPrecise: false,
177
+
isEditable: false,
178
+
variant: "filled",
135
179
},
136
180
parameters: {
137
181
actions: {
@@ -146,22 +190,30 @@ export default {
146
190
},
147
191
packageJson,
148
192
metadata,
193
+
status: {
194
+
type: "migrated",
195
+
},
149
196
},
197
+
tags: ["migrated"],
150
198
};
151
199
152
200
/**
153
201
* 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.
202
+
* 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.
154
203
*/
155
204
exportconstDefault=SliderGroup.bind({});
156
-
Default.args={};
205
+
Default.args={
206
+
variant: "filled",
207
+
};
157
208
158
209
// ********* DOCS ONLY ********* //
159
210
/**
160
-
* 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”).
211
+
* 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").
161
212
*/
162
213
exportconstWithoutLabel=Template.bind({});
163
214
WithoutLabel.args={
164
215
label: "",
216
+
variant: "filled",
165
217
};
166
218
WithoutLabel.tags=["!dev"];
167
219
WithoutLabel.storyName="Without label";
@@ -171,6 +223,18 @@ WithoutLabel.parameters = {
171
223
},
172
224
};
173
225
226
+
exportconstEditable=Template.bind({});
227
+
Editable.args={
228
+
...Default.args,
229
+
isEditable: true,
230
+
};
231
+
Editable.tags=["!dev"];
232
+
Editable.parameters={
233
+
chromatic: {
234
+
disableSnapshot: true,
235
+
},
236
+
};
237
+
174
238
exportconstSizing=(args,context)=>Sizes({
175
239
Template,
176
240
withBorder: false,
@@ -186,31 +250,28 @@ Sizing.parameters = {
186
250
};
187
251
188
252
/**
189
-
* The track of the slider can have a fill. By default, the fill originates from the left side of the track.
253
+
* 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.
190
254
*/
191
-
exportconstFilled=Template.bind({});
192
-
Filled.args={
255
+
exportconstOffset=Template.bind({});
256
+
Offset.args={
193
257
...Default.args,
194
-
variant: "filled",
258
+
variant: "offset",
259
+
values: [-15],
195
260
};
196
-
Filled.tags=["!dev"];
197
-
Filled.parameters={
261
+
Offset.tags=["!dev"];
262
+
Offset.parameters={
198
263
chromatic: {
199
264
disableSnapshot: true,
200
265
},
201
266
};
202
267
203
-
/**
204
-
* 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.
* 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.
304
-
*/
305
-
exportconstGradient=Template.bind({});
306
-
Gradient.args={
381
+
exportconstFocused=Template.bind({});
382
+
Focused.args={
307
383
...Default.args,
308
-
customStyles: {
309
-
"--spectrum-slider-track-color":
310
-
"linear-gradient(to right, red, green 100%)",
311
-
"--spectrum-slider-track-color-rtl":
312
-
"linear-gradient(to left, red, green 100%)",
313
-
},
314
-
label: "Slider label that is long and wraps to the next line",
0 commit comments