3 Commits

Author SHA1 Message Date
olly 3da99a7214 Merge branch 'master' of ssh://git.ollyhearn.ru:49239/olly/modern-sk 2026-06-02 15:27:01 +03:00
olly 3b9d3f908d feat: animated slider 2026-06-02 15:26:32 +03:00
olly 37f0592464 chore: update readme 2026-06-01 18:17:14 +03:00
4 changed files with 17 additions and 7 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ Old-iOS skeuomorphism × macOS Sequoia neatness × Ubuntu warmth.
Distributed via self-hosted git — install straight from the repo:
```bash
npm i git+ssh://git@git.ollyhearn.ru:49239/olly/modern-sk.git
npm i git+https://git.ollyhearn.ru/olly/modern-sk.git
```
`react` and `react-dom` (>=18) are peer dependencies — your app provides them.
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "modern-sk",
"version": "0.1.0",
"version": "0.1.2",
"description": "ModernSK — tactile, dark-first React component library built on Radix primitives.",
"license": "MIT",
"type": "module",
+8
View File
@@ -22,6 +22,11 @@ type SliderProps = Omit<ComponentPropsWithoutRef<typeof RSlider.Root>, 'classNam
notches?: NotchPlacement;
/** Thumb shape. `'square'` (default) has a small border-radius; `'round'` is a full circle. */
knobStyle?: KnobStyle;
/**
* Enable step-glide animation. Defaults to `true` when `marks` is set, `false` otherwise.
* Explicitly setting this always overrides the default.
*/
animated?: boolean;
className?: string;
};
@@ -73,6 +78,7 @@ export const Slider = ({
marks,
notches = 'bottom',
knobStyle = 'square',
animated,
min = 0,
max = 100,
step = 1,
@@ -84,10 +90,12 @@ export const Slider = ({
const hasLabels = resolved.some((m) => m.label != null);
const showTop = hasMarks && (notches === 'top' || notches === 'both');
const showBottom = hasMarks && (notches === 'bottom' || notches === 'both');
const isAnimated = animated !== undefined ? animated : hasMarks;
const cls = [
'modern-sk-slider',
`modern-sk-slider--knob-${knobStyle}`,
isAnimated && 'modern-sk-slider--animated',
hasMarks && 'modern-sk-slider--has-marks',
hasLabels && 'modern-sk-slider--has-labels',
showTop && 'modern-sk-slider--notch-top',
+6 -4
View File
@@ -626,8 +626,10 @@ textarea.modern-sk-field {
border-radius: 3px;
background: linear-gradient(90deg, var(--lime-deep), var(--lime));
box-shadow: 0 0 10px rgba(190, 242, 100, 0.4);
/* Radix positions the range via left/right offsets (not width); ease those
}
/* Radix positions the range via left/right offsets (not width); ease those
so the fill glides between discrete steps while dragging. */
.modern-sk-slider--animated .modern-sk-slider__range {
transition:
left 0.12s ease-out,
right 0.12s ease-out;
@@ -647,12 +649,12 @@ textarea.modern-sk-field {
/* Radix sets the step position (left) on a WRAPPER span around the thumb, not on
the thumb element itself — so the transition must live on that wrapper. The
wrapper is the slider's direct child span that isn't the track. */
.modern-sk-slider > span:not(.modern-sk-slider__track) {
.modern-sk-slider--animated > span:not(.modern-sk-slider__track) {
transition: left 0.12s ease-out;
}
@media (prefers-reduced-motion: reduce) {
.modern-sk-slider > span:not(.modern-sk-slider__track),
.modern-sk-slider__range {
.modern-sk-slider--animated > span:not(.modern-sk-slider__track),
.modern-sk-slider--animated .modern-sk-slider__range {
transition: none;
}
}