Compare commits
3 Commits
v0.1.3
...
3da99a7214
| Author | SHA1 | Date | |
|---|---|---|---|
| 3da99a7214 | |||
| 3b9d3f908d | |||
| 37f0592464 |
@@ -15,7 +15,7 @@ Old-iOS skeuomorphism × macOS Sequoia neatness × Ubuntu warmth.
|
|||||||
Distributed via self-hosted git — install straight from the repo:
|
Distributed via self-hosted git — install straight from the repo:
|
||||||
|
|
||||||
```bash
|
```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.
|
`react` and `react-dom` (>=18) are peer dependencies — your app provides them.
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "modern-sk",
|
"name": "modern-sk",
|
||||||
"version": "0.1.0",
|
"version": "0.1.2",
|
||||||
"description": "ModernSK — tactile, dark-first React component library built on Radix primitives.",
|
"description": "ModernSK — tactile, dark-first React component library built on Radix primitives.",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -22,6 +22,11 @@ type SliderProps = Omit<ComponentPropsWithoutRef<typeof RSlider.Root>, 'classNam
|
|||||||
notches?: NotchPlacement;
|
notches?: NotchPlacement;
|
||||||
/** Thumb shape. `'square'` (default) has a small border-radius; `'round'` is a full circle. */
|
/** Thumb shape. `'square'` (default) has a small border-radius; `'round'` is a full circle. */
|
||||||
knobStyle?: KnobStyle;
|
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;
|
className?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -73,6 +78,7 @@ export const Slider = ({
|
|||||||
marks,
|
marks,
|
||||||
notches = 'bottom',
|
notches = 'bottom',
|
||||||
knobStyle = 'square',
|
knobStyle = 'square',
|
||||||
|
animated,
|
||||||
min = 0,
|
min = 0,
|
||||||
max = 100,
|
max = 100,
|
||||||
step = 1,
|
step = 1,
|
||||||
@@ -84,10 +90,12 @@ export const Slider = ({
|
|||||||
const hasLabels = resolved.some((m) => m.label != null);
|
const hasLabels = resolved.some((m) => m.label != null);
|
||||||
const showTop = hasMarks && (notches === 'top' || notches === 'both');
|
const showTop = hasMarks && (notches === 'top' || notches === 'both');
|
||||||
const showBottom = hasMarks && (notches === 'bottom' || notches === 'both');
|
const showBottom = hasMarks && (notches === 'bottom' || notches === 'both');
|
||||||
|
const isAnimated = animated !== undefined ? animated : hasMarks;
|
||||||
|
|
||||||
const cls = [
|
const cls = [
|
||||||
'modern-sk-slider',
|
'modern-sk-slider',
|
||||||
`modern-sk-slider--knob-${knobStyle}`,
|
`modern-sk-slider--knob-${knobStyle}`,
|
||||||
|
isAnimated && 'modern-sk-slider--animated',
|
||||||
hasMarks && 'modern-sk-slider--has-marks',
|
hasMarks && 'modern-sk-slider--has-marks',
|
||||||
hasLabels && 'modern-sk-slider--has-labels',
|
hasLabels && 'modern-sk-slider--has-labels',
|
||||||
showTop && 'modern-sk-slider--notch-top',
|
showTop && 'modern-sk-slider--notch-top',
|
||||||
|
|||||||
@@ -626,8 +626,10 @@ textarea.modern-sk-field {
|
|||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
background: linear-gradient(90deg, var(--lime-deep), var(--lime));
|
background: linear-gradient(90deg, var(--lime-deep), var(--lime));
|
||||||
box-shadow: 0 0 10px rgba(190, 242, 100, 0.4);
|
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. */
|
so the fill glides between discrete steps while dragging. */
|
||||||
|
.modern-sk-slider--animated .modern-sk-slider__range {
|
||||||
transition:
|
transition:
|
||||||
left 0.12s ease-out,
|
left 0.12s ease-out,
|
||||||
right 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
|
/* 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
|
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. */
|
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;
|
transition: left 0.12s ease-out;
|
||||||
}
|
}
|
||||||
@media (prefers-reduced-motion: reduce) {
|
@media (prefers-reduced-motion: reduce) {
|
||||||
.modern-sk-slider > span:not(.modern-sk-slider__track),
|
.modern-sk-slider--animated > span:not(.modern-sk-slider__track),
|
||||||
.modern-sk-slider__range {
|
.modern-sk-slider--animated .modern-sk-slider__range {
|
||||||
transition: none;
|
transition: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user