@recordair/ui-core 0.3.26 → 0.3.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Range.d.ts.map +1 -1
- package/dist/Range.js +12 -3
- package/dist/Range.js.map +1 -1
- package/package.json +1 -1
package/dist/Range.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Range.d.ts","sourceRoot":"","sources":["../src/Range.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAGhE,KAAK,UAAU,GAAG,IAAI,CACpB,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAC3C,GAAG;IACF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,QAAA,MAAM,KAAK,GAAI,yCAMZ,UAAU,
|
|
1
|
+
{"version":3,"file":"Range.d.ts","sourceRoot":"","sources":["../src/Range.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAGhE,KAAK,UAAU,GAAG,IAAI,CACpB,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAC3C,GAAG;IACF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,QAAA,MAAM,KAAK,GAAI,yCAMZ,UAAU,gCA+CZ,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,CAAC;AACjB,YAAY,EAAE,UAAU,EAAE,CAAC"}
|
package/dist/Range.js
CHANGED
|
@@ -3,9 +3,18 @@ import { classNames } from "./classNames";
|
|
|
3
3
|
const Range = ({ className, max = 100, min = 0, value, ...rest }) => {
|
|
4
4
|
const normalizedValue = Math.min(max, Math.max(min, value));
|
|
5
5
|
const interval = max - min;
|
|
6
|
-
const progress = interval === 0 ? 0 : (
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const progress = interval === 0 ? 0 : (normalizedValue - min) / interval;
|
|
7
|
+
// Le thumb d'un <input type="range"> ne peut pas visuellement atteindre les
|
|
8
|
+
// bords du champ : son centre est borné à [thumbRadius, largeur-thumbRadius].
|
|
9
|
+
// On applique le même retrait (moitié de size-6 = 12px) à la piste visuelle
|
|
10
|
+
// pour que ses extrémités tombent exactement sous les positions min/max
|
|
11
|
+
// réellement atteignables par le curseur.
|
|
12
|
+
const style = {
|
|
13
|
+
"--range-progress-fraction": progress,
|
|
14
|
+
};
|
|
15
|
+
return (_jsxs("span", { className: "relative h-9 w-full", style: style, children: [_jsx("span", { "aria-hidden": true, className: "pointer-events-none absolute inset-x-3 top-1/2 h-1.5 -translate-y-1/2 rounded-full bg-line-subtle" }), _jsx("span", { "aria-hidden": true, className: "pointer-events-none absolute left-3 top-1/2 h-1.5 -translate-y-1/2 rounded-full bg-gradient-to-r from-brand-gradient-from to-brand-gradient-to transition-[width] duration-150", style: {
|
|
16
|
+
width: "calc((100% - 24px) * var(--range-progress-fraction))",
|
|
17
|
+
} }), _jsx("input", { type: "range", min: min, max: max, value: normalizedValue, className: classNames("absolute inset-0 h-full w-full cursor-pointer appearance-none bg-transparent focus:outline-none", "[&::-webkit-slider-runnable-track]:h-6 [&::-webkit-slider-runnable-track]:rounded-full [&::-webkit-slider-runnable-track]:bg-transparent", "[&::-moz-range-track]:h-6 [&::-moz-range-track]:rounded-full [&::-moz-range-track]:bg-transparent", "[&::-webkit-slider-thumb]:size-6 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:border-[3px] [&::-webkit-slider-thumb]:border-surface-elevated [&::-webkit-slider-thumb]:bg-brand-primary [&::-webkit-slider-thumb]:shadow-brand [&::-webkit-slider-thumb]:transition-transform [&::-webkit-slider-thumb]:duration-150", "[&::-moz-range-thumb]:size-6 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-[3px] [&::-moz-range-thumb]:border-surface-elevated [&::-moz-range-thumb]:bg-brand-primary [&::-moz-range-thumb]:shadow-brand [&::-moz-range-thumb]:transition-transform [&::-moz-range-thumb]:duration-150", "[&:hover::-webkit-slider-thumb]:scale-110 [&:hover::-moz-range-thumb]:scale-110", "[&:active::-webkit-slider-thumb]:scale-95 [&:active::-moz-range-thumb]:scale-95", "[&:focus-visible::-webkit-slider-thumb]:shadow-focus [&:focus-visible::-moz-range-thumb]:shadow-focus", "disabled:cursor-not-allowed disabled:opacity-50", className), ...rest })] }));
|
|
9
18
|
};
|
|
10
19
|
export { Range };
|
|
11
20
|
//# sourceMappingURL=Range.js.map
|
package/dist/Range.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Range.js","sourceRoot":"","sources":["../src/Range.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAW1C,MAAM,KAAK,GAAG,CAAC,EACb,SAAS,EACT,GAAG,GAAG,GAAG,EACT,GAAG,GAAG,CAAC,EACP,KAAK,EACL,GAAG,IAAI,EACI,EAAE,EAAE;IACf,MAAM,eAAe,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;IAC5D,MAAM,QAAQ,GAAG,GAAG,GAAG,GAAG,CAAC;IAC3B,MAAM,QAAQ,GAAG,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"Range.js","sourceRoot":"","sources":["../src/Range.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU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