Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 5 additions & 0 deletions .changeset/five-rockets-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ultraviolet/ui": patch
---

`Slider`: Add prop `labelDescription`

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ describe('double slider', () => {
direction="row"
double
label="Label"
labelDescription="labeldescription"
name="Name"
value={[1, 14]}
/>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ describe('single slider', () => {

test('renders correctly', () => {
shouldMatchSnapshot(
<Slider helper="helper" label="Label" name="Name" value={1} />,
<Slider
helper="helper"
label="Label"
labelDescription="labeldescription"
name="Name"
value={1}
/>,
)
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const DoubleSlider = ({
required,
tooltipPosition,
'aria-label': ariaLabel,
labelDescription,
}: DoubleSliderProps) => {
const theme = useTheme()
const localId = useId()
Expand Down Expand Up @@ -274,7 +275,11 @@ export const DoubleSlider = ({
<Stack direction="column" gap={1} justifyContent="left">
{label ? (
<Stack direction="row" justifyContent="space-between">
<Label htmlFor={finalId} required={required}>
<Label
htmlFor={finalId}
labelDescription={labelDescription}
required={required}
>
{label}
</Label>
</Stack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const SingleSlider = ({
prefix,
suffix,
required,
labelDescription,
'aria-label': ariaLabel,
tooltipPosition,
}: SingleSliderProps) => {
Expand Down Expand Up @@ -193,7 +194,11 @@ export const SingleSlider = ({
direction="row"
justifyContent="space-between"
>
<Label htmlFor={finalId} required={required}>
<Label
htmlFor={finalId}
labelDescription={labelDescription}
required={required}
>
{label}
</Label>
{direction === 'column' ? styledValue(valueToShow) : null}
Expand Down
3 changes: 3 additions & 0 deletions packages/ui/src/components/Slider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const Slider = ({
className,
tooltipPosition = 'top',
style,
labelDescription,
'aria-label': ariaLabel,
}: SliderProps) => {
// we check if options exists if so we set the bounds to the length of the options
Expand Down Expand Up @@ -78,6 +79,7 @@ export const Slider = ({
id={id}
input={input}
label={label}
labelDescription={labelDescription}
max={correctedBounds.max}
min={correctedBounds.min}
name={name}
Expand Down Expand Up @@ -105,6 +107,7 @@ export const Slider = ({
id={id}
input={input}
label={label}
labelDescription={labelDescription}
max={correctedBounds.max}
min={correctedBounds.min}
name={name}
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/components/Slider/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type DefaultProps = {
*/
step?: number
required?: boolean
labelDescription?: ReactNode
/**
* Where to position the tooltip
*/
Expand Down
Loading