@flytedan/flytebot-design-system 0.1.1 → 0.1.3
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/index.cjs +32 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +32 -31
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/styles/components.css +42 -0
- package/styles/fonts/figtree-latin-ext.woff2 +0 -0
- package/styles/fonts/figtree-latin.woff2 +0 -0
- package/styles/foundations.css +44 -228
- package/styles/tokens.css +296 -264
package/dist/index.cjs
CHANGED
|
@@ -2195,7 +2195,8 @@ function SegmentedMeter({
|
|
|
2195
2195
|
const pct = safeTotal ? Math.min(100, Math.round(used / safeTotal * 100)) : 0;
|
|
2196
2196
|
const w = (v) => safeTotal ? Math.max(0, Math.min(100, Number(v) / safeTotal * 100)) : 0;
|
|
2197
2197
|
const fill = (s, i) => s.color || (s.variant ? VARIANT_FILL[s.variant] : void 0) || CHART[i % CHART.length];
|
|
2198
|
-
const
|
|
2198
|
+
const generatedId = React11.useId();
|
|
2199
|
+
const uid2 = id || generatedId;
|
|
2199
2200
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: ["fd-segmeter", className].filter(Boolean).join(" "), onClick, children: [
|
|
2200
2201
|
label || showTotal ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "fd-segmeter-head", children: [
|
|
2201
2202
|
label ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "fd-segmeter-label", id: uid2 + "-l", children: label }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", {}),
|
|
@@ -3489,6 +3490,36 @@ function RangeSlider({
|
|
|
3489
3490
|
className = "",
|
|
3490
3491
|
...rest
|
|
3491
3492
|
}) {
|
|
3493
|
+
const fmt2 = format || ((v) => String(v));
|
|
3494
|
+
const [a, b] = value || [min, max];
|
|
3495
|
+
const [drag, setDrag] = React20.useState(null);
|
|
3496
|
+
const [focus, setFocus] = React20.useState(null);
|
|
3497
|
+
const railRef = React20.useRef(null);
|
|
3498
|
+
const pct = (v) => max === min ? 0 : (v - min) / (max - min) * 100;
|
|
3499
|
+
const clampPair = (i, v) => {
|
|
3500
|
+
v = Math.min(max, Math.max(min, Math.round(v / step) * step));
|
|
3501
|
+
if (snap && marks.length) {
|
|
3502
|
+
const near = marks.reduce((best, m) => Math.abs(m.value - v) < Math.abs(best - v) ? m.value : best, Infinity);
|
|
3503
|
+
if (Math.abs(near - v) <= (max - min) * 0.015) v = near;
|
|
3504
|
+
}
|
|
3505
|
+
const pair = i === 0 ? [Math.min(v, b - minGap), b] : [a, Math.max(v, a + minGap)];
|
|
3506
|
+
return pair;
|
|
3507
|
+
};
|
|
3508
|
+
const fromEvent = (e) => {
|
|
3509
|
+
const r = railRef.current.getBoundingClientRect();
|
|
3510
|
+
return min + Math.min(1, Math.max(0, (e.clientX - r.left) / r.width)) * (max - min);
|
|
3511
|
+
};
|
|
3512
|
+
React20.useEffect(() => {
|
|
3513
|
+
if (drag === null) return;
|
|
3514
|
+
const mv = (e) => onChange && onChange(clampPair(drag, fromEvent(e)));
|
|
3515
|
+
const upH = () => setDrag(null);
|
|
3516
|
+
window.addEventListener("pointermove", mv);
|
|
3517
|
+
window.addEventListener("pointerup", upH);
|
|
3518
|
+
return () => {
|
|
3519
|
+
window.removeEventListener("pointermove", mv);
|
|
3520
|
+
window.removeEventListener("pointerup", upH);
|
|
3521
|
+
};
|
|
3522
|
+
}, [drag, a, b]);
|
|
3492
3523
|
if (stops && stops.length > 1) {
|
|
3493
3524
|
const S = stops.map((s) => typeof s === "object" ? s : { value: s });
|
|
3494
3525
|
const num = (v) => v === Infinity || v == null ? Number.MAX_SAFE_INTEGER : v;
|
|
@@ -3517,25 +3548,6 @@ function RangeSlider({
|
|
|
3517
3548
|
}
|
|
3518
3549
|
);
|
|
3519
3550
|
}
|
|
3520
|
-
const fmt2 = format || ((v) => String(v));
|
|
3521
|
-
const [a, b] = value || [min, max];
|
|
3522
|
-
const [drag, setDrag] = React20.useState(null);
|
|
3523
|
-
const [focus, setFocus] = React20.useState(null);
|
|
3524
|
-
const railRef = React20.useRef(null);
|
|
3525
|
-
const pct = (v) => max === min ? 0 : (v - min) / (max - min) * 100;
|
|
3526
|
-
const clampPair = (i, v) => {
|
|
3527
|
-
v = Math.min(max, Math.max(min, Math.round(v / step) * step));
|
|
3528
|
-
if (snap && marks.length) {
|
|
3529
|
-
const near = marks.reduce((best, m) => Math.abs(m.value - v) < Math.abs(best - v) ? m.value : best, Infinity);
|
|
3530
|
-
if (Math.abs(near - v) <= (max - min) * 0.015) v = near;
|
|
3531
|
-
}
|
|
3532
|
-
const pair = i === 0 ? [Math.min(v, b - minGap), b] : [a, Math.max(v, a + minGap)];
|
|
3533
|
-
return pair;
|
|
3534
|
-
};
|
|
3535
|
-
const fromEvent = (e) => {
|
|
3536
|
-
const r = railRef.current.getBoundingClientRect();
|
|
3537
|
-
return min + Math.min(1, Math.max(0, (e.clientX - r.left) / r.width)) * (max - min);
|
|
3538
|
-
};
|
|
3539
3551
|
const startDrag = (i) => (e) => {
|
|
3540
3552
|
e.preventDefault();
|
|
3541
3553
|
e.target.setPointerCapture && e.target.setPointerCapture(e.pointerId);
|
|
@@ -3547,17 +3559,6 @@ function RangeSlider({
|
|
|
3547
3559
|
onChange && onChange(clampPair(i, v));
|
|
3548
3560
|
setDrag(i);
|
|
3549
3561
|
};
|
|
3550
|
-
React20.useEffect(() => {
|
|
3551
|
-
if (drag === null) return;
|
|
3552
|
-
const mv = (e) => onChange && onChange(clampPair(drag, fromEvent(e)));
|
|
3553
|
-
const upH = () => setDrag(null);
|
|
3554
|
-
window.addEventListener("pointermove", mv);
|
|
3555
|
-
window.addEventListener("pointerup", upH);
|
|
3556
|
-
return () => {
|
|
3557
|
-
window.removeEventListener("pointermove", mv);
|
|
3558
|
-
window.removeEventListener("pointerup", upH);
|
|
3559
|
-
};
|
|
3560
|
-
}, [drag, a, b]);
|
|
3561
3562
|
const key = (i) => (e) => {
|
|
3562
3563
|
const big = (max - min) / 10;
|
|
3563
3564
|
let d = 0;
|