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

Refactor Slider #3296

Merged
merged 45 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
7534b7d
init
lukeac123 Apr 18, 2024
a218aad
update calculation
lukeac123 May 29, 2024
c7f6a89
remove falty test
lukeac123 May 29, 2024
8d48004
fix tooltip logic
lukeac123 May 31, 2024
cbc6e35
docs (#3501)
lukeac123 May 31, 2024
a5dc5bb
fix type errors
lukeac123 Jun 3, 2024
f500d53
update for value to always be an array
lukeac123 Jun 3, 2024
ca4a9c4
fix test
lukeac123 Jun 3, 2024
1515296
add set value function
lukeac123 Jun 3, 2024
577a0e1
switching slider getValue to accept clientX rather than full event
tomhazledine Jun 13, 2024
0a76ab4
getNearestIndex util for Slider
tomhazledine Jun 19, 2024
7d138a0
unify usePointerDownThumb and usePointerDownTrack
tomhazledine Jun 19, 2024
c1070f9
rename usePointerDownThumb to usePointerDown
tomhazledine Jun 19, 2024
e904288
pointer event type fix
tomhazledine Jun 19, 2024
0dc7a58
Remove redundant bool check
tomhazledine Jun 19, 2024
90c1ae2
Tweaks to example copy to bring inline with styleguide
tomhazledine Jun 19, 2024
6b0de16
Ensure pointer events complete for Slider tests
tomhazledine Jun 20, 2024
e0c9adf
slider height fix
tomhazledine Jul 1, 2024
6ee748f
Fixing slider storybook form layouts
tomhazledine Jul 1, 2024
fb009c2
Consistent tooltip visibility on SliderThumb hover
tomhazledine Jul 1, 2024
d5fbd43
Slider docs update
tomhazledine Jul 1, 2024
a200586
Update usage.mdx
navkaur76 Jul 4, 2024
ccccb37
linting fixes for switch to biome
tomhazledine Jul 18, 2024
719031d
move event handlers from Thumb to Track
tomhazledine Jul 23, 2024
c429ddf
clean up layout for slider examples
tomhazledine Jul 23, 2024
1b3d2ff
smarter decimal rounding for step marks
tomhazledine Jul 23, 2024
98ab2ec
Slider track tooltip arrow
tomhazledine Jul 23, 2024
45f531e
refactor getNearestIndex util
tomhazledine Jul 23, 2024
f056c36
align step decimals with mark decimals
tomhazledine Jul 24, 2024
cdd6e01
Prevent NaN locking Slider examples (until StepperInput is available)
tomhazledine Jul 25, 2024
9e5ed37
Prevent NaN locking Slider examples (until StepperInput is available)
tomhazledine Jul 25, 2024
409055b
More detail for CustomStep example docs
tomhazledine Jul 25, 2024
0b6ca19
allow range steps to be equal
tomhazledine Jul 30, 2024
d3ea310
amending tests to match desired slider overlap behaviour
tomhazledine Jul 30, 2024
9bf29c3
stricter types for Slider value
tomhazledine Jul 30, 2024
ae7b0bf
input validation for Slider stories with inputs
tomhazledine Aug 2, 2024
f8c3805
input validation for Slider examples with inputs
tomhazledine Aug 2, 2024
7484556
rename NonZeroInput story to WithNegativeBounds for clarity
tomhazledine Aug 2, 2024
4319eb5
only run useKeyDownThumb for specific key presses
tomhazledine Aug 8, 2024
7b49302
cleaning up example layouts
tomhazledine Aug 8, 2024
efebc89
Slider docs updates
tomhazledine Aug 22, 2024
3d669b8
Slider docs updates
tomhazledine Aug 22, 2024
ee14235
clearer Slider examples
tomhazledine Aug 22, 2024
ed0b6c7
updating stories to include all examples
tomhazledine Aug 22, 2024
c2dcfde
switch SliderTrack pointermove listener from element to window
tomhazledine Aug 22, 2024
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
6 changes: 6 additions & 0 deletions .changeset/spotty-pants-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@salt-ds/lab": minor
---

Remove `Slider` props, `pageStep`, `pushable`, `pushDistance`, `disabled`, `hideMarks`
Updated `Marks` prop to recieve inline, bottom or all
28 changes: 13 additions & 15 deletions docs/components/ResponsiveContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { type ReactNode, type SyntheticEvent, useState } from "react";
import "./ResponsiveContainer.css";
import { ToggleButton, ToggleButtonGroup, Tooltip } from "@salt-ds/core";
import { Slider, StepperInput } from "@salt-ds/lab";
import { Slider, type SliderValue, StepperInput } from "@salt-ds/lab";

export const ResponsiveContainer = ({ children }: { children?: ReactNode }) => {
const [containerWidth, setWidth] = useState(90);
const [containerHeight, setHeight] = useState(70);
const [containerWidth, setWidth] = useState([90]);
const [containerHeight, setHeight] = useState([70]);
const [selected, setSelected] = useState<string>("vw/vh");
const inPixels = selected === "px";
const maxUnits = inPixels ? 1000 : 100;
Expand All @@ -28,42 +28,40 @@ export const ResponsiveContainer = ({ children }: { children?: ReactNode }) => {
</Tooltip>
</ToggleButtonGroup>
<StepperInput
value={containerWidth}
value={containerWidth[0]}
max={maxUnits}
min={10}
onChange={(nextValue) => setWidth(nextValue as number)}
onChange={(nextValue) => setWidth([nextValue] as number[])}
/>
<Slider
className="StoryContainer-slider"
id="width"
label="Container Width"
max={maxUnits}
min={10}
onChange={(nextValue) => setWidth(nextValue as number)}
value={containerWidth}
onChange={(value: SliderValue) => setWidth(value)}
value={containerWidth as SliderValue}
/>
<StepperInput
value={containerHeight}
value={containerHeight[0]}
max={maxUnits}
min={10}
onChange={(nextValue) => setHeight(nextValue as number)}
onChange={(nextValue) => setHeight([nextValue] as number[])}
/>
<Slider
className="StoryContainer-slider"
id="height"
label="Container Height"
max={maxUnits}
min={10}
onChange={(nextValue) => setHeight(nextValue as number)}
value={containerHeight}
onChange={(value: SliderValue) => setHeight(value)}
value={containerHeight as SliderValue}
/>
</div>

<div
className="StoryContainer-wrapper"
style={{
width: `${containerWidth}${inPixels ? "px" : "vw"}`,
height: `${containerHeight}${inPixels ? "px" : "vh"}`,
width: `${containerWidth[0]}${inPixels ? "px" : "vw"}`,
height: `${containerHeight[0]}${inPixels ? "px" : "vh"}`,
}}
>
{children}
Expand Down
Loading
Loading