sit-onyx 1.4.0-dev-20251112133447 → 1.4.0-dev-20251118074438
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/components/OnyxSlider/types.d.ts +17 -50
- package/dist/i18n/locales/de-DE.json +3 -1
- package/dist/i18n/locales/en-US.json +3 -1
- package/dist/i18n/locales/en-US.json.d.ts +3 -1
- package/dist/index.esm-bundler.js +241 -570
- package/dist/index.esm-bundler.js.map +1 -1
- package/dist/index.js +4204 -4436
- package/dist/style.css +1 -1
- package/package.json +4 -4
|
@@ -356,7 +356,7 @@ const fileUpload = { "select": "Select", "clickToUpload": "Click to select", "or
|
|
|
356
356
|
const globalFAB = { "label": "Global actions" };
|
|
357
357
|
const calendar = { "todayButton": { "label": "Today", "tooltip": "Jump to today" }, "calendarWeek": "CW", "calendarWeekButtonLabel": "Select calendar week {weekNumber}", "previousMonthButton": "Previous month", "nextMonthButton": "Next month" };
|
|
358
358
|
const flyoutMenu = { "moreActions": "More actions", "toggleActions": { "click": "Click to toggle action visibility", "hover": "Hover/Focus to toggle action visibility" } };
|
|
359
|
-
const slider = { "decreaseValueBy": "Decrease value by {n}", "increaseValueBy": "Increase value by {n}", "changeValue": "Change value" };
|
|
359
|
+
const slider = { "decreaseValueBy": "Decrease value by {n}", "increaseValueBy": "Increase value by {n}", "changeValue": "Change value", "changeStartValue": "Change start value", "changeEndValue": "Change end value" };
|
|
360
360
|
const codeTabs = { "label": "Code snippets", "copySnippet": "Copy code", "copied": "Copied!", "failed": "Failed!", "tabLabel": "Code" };
|
|
361
361
|
const globalSearch = { "label": "Global search", "searchResults": "Search results", "input": { "label": "Search for content", "placeholder": "Search..." }, "shortcuts": { "move": "Navigate", "select": "Select" }, "system": "System" };
|
|
362
362
|
const enUS = {
|
|
@@ -1445,465 +1445,204 @@ const createNavigationMenu = createBuilder(({ navigationName }) => {
|
|
|
1445
1445
|
};
|
|
1446
1446
|
});
|
|
1447
1447
|
const areArraysEqual = (arrayA, arrayB, comparer = (a, b) => a === b) => arrayA.length === arrayB.length && arrayA.every((value, index) => comparer(value, arrayB[index]));
|
|
1448
|
-
const isFocusVisible = (element) => {
|
|
1449
|
-
try {
|
|
1450
|
-
return element.matches(":focus-visible");
|
|
1451
|
-
} catch {
|
|
1452
|
-
return false;
|
|
1453
|
-
}
|
|
1454
|
-
};
|
|
1455
|
-
const isTouchEvent = (event) => "touches" in event || "changedTouches" in event || "targetTouches" in event;
|
|
1456
|
-
const DRAG_MOVE_THRESHOLD = 2;
|
|
1457
|
-
const KEY = {
|
|
1458
|
-
Up: "ArrowUp",
|
|
1459
|
-
Down: "ArrowDown",
|
|
1460
|
-
Left: "ArrowLeft",
|
|
1461
|
-
Right: "ArrowRight",
|
|
1462
|
-
PageUp: "PageUp",
|
|
1463
|
-
PageDown: "PageDown",
|
|
1464
|
-
Home: "Home",
|
|
1465
|
-
End: "End"
|
|
1466
|
-
};
|
|
1467
1448
|
const NAVIGATION_KEYS = /* @__PURE__ */ new Set([
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1449
|
+
"ArrowUp",
|
|
1450
|
+
"ArrowDown",
|
|
1451
|
+
"ArrowLeft",
|
|
1452
|
+
"ArrowRight",
|
|
1453
|
+
"PageUp",
|
|
1454
|
+
"PageDown",
|
|
1455
|
+
"Home",
|
|
1456
|
+
"End"
|
|
1476
1457
|
]);
|
|
1477
|
-
const INCREMENT_KEYS = /* @__PURE__ */ new Set([
|
|
1478
|
-
const DECREMENT_KEYS = /* @__PURE__ */ new Set([
|
|
1479
|
-
const readThumbIndex = (event) => Number(event.currentTarget?.dataset.index ?? -1);
|
|
1480
|
-
const roundToStep = (value, step, min) => Number((Math.round((value - min) / step) * step + min).toFixed(MathUtils.decimalsCount(step)));
|
|
1481
|
-
const findClosestIndex = (values, currentValue) => {
|
|
1482
|
-
const result = values.reduce((acc, value, index) => {
|
|
1483
|
-
const distance = Math.abs(currentValue - value);
|
|
1484
|
-
if (!acc || distance <= acc.closestDistance) {
|
|
1485
|
-
return {
|
|
1486
|
-
closestIndex: index,
|
|
1487
|
-
closestDistance: distance
|
|
1488
|
-
};
|
|
1489
|
-
}
|
|
1490
|
-
return acc;
|
|
1491
|
-
}, null);
|
|
1492
|
-
return result?.closestIndex ?? -1;
|
|
1493
|
-
};
|
|
1494
|
-
const adjustValueByIndex = ({
|
|
1495
|
-
values,
|
|
1496
|
-
newValue,
|
|
1497
|
-
index
|
|
1498
|
-
}) => values.map((value, i) => i === index ? newValue : value).sort((a, b) => a - b);
|
|
1499
|
-
const asc = (a, b) => a - b;
|
|
1500
|
-
const valueToArray = (value) => Array.isArray(value) ? value : [value];
|
|
1458
|
+
const INCREMENT_KEYS = /* @__PURE__ */ new Set(["ArrowRight", "ArrowUp", "PageUp"]);
|
|
1459
|
+
const DECREMENT_KEYS = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowDown", "PageDown"]);
|
|
1501
1460
|
const _unstableCreateSlider = createBuilder(
|
|
1502
1461
|
(options) => {
|
|
1503
1462
|
const sliderRef = createElRef();
|
|
1504
|
-
const min = computed(() =>
|
|
1505
|
-
const max = computed(() =>
|
|
1506
|
-
const step = computed(() =>
|
|
1507
|
-
const
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
return arrayValues.map((value) => {
|
|
1512
|
-
const clamped = MathUtils.clamp(value, min.value, max.value);
|
|
1513
|
-
if (isDiscrete.value) {
|
|
1514
|
-
return roundToStep(clamped, step.value, min.value);
|
|
1515
|
-
}
|
|
1516
|
-
return clamped;
|
|
1517
|
-
});
|
|
1463
|
+
const min = computed(() => toValue(options.min) ?? 0);
|
|
1464
|
+
const max = computed(() => toValue(options.max) ?? 100);
|
|
1465
|
+
const step = computed(() => toValue(options.step) ?? 1);
|
|
1466
|
+
const draggingThumbIndex = ref();
|
|
1467
|
+
watch(draggingThumbIndex, (newThumbIndex) => {
|
|
1468
|
+
if (newThumbIndex == void 0) return;
|
|
1469
|
+
Array.from(sliderRef.value.querySelectorAll('[role="slider"]')).at(newThumbIndex)?.focus();
|
|
1518
1470
|
});
|
|
1519
1471
|
const shiftStep = computed(() => {
|
|
1520
|
-
const shiftStep2 =
|
|
1472
|
+
const shiftStep2 = toValue(options.shiftStep);
|
|
1521
1473
|
if (shiftStep2 != void 0) return shiftStep2;
|
|
1522
1474
|
const stepMultiple = Math.max(1, Math.round((max.value - min.value) * 0.1 / step.value));
|
|
1523
1475
|
return stepMultiple * step.value;
|
|
1524
1476
|
});
|
|
1525
|
-
const isDisabled = computed(() => unref(options.disabled) ?? false);
|
|
1526
|
-
const isDiscrete = computed(() => unref(options.discrete) ?? false);
|
|
1527
1477
|
const marks = computed(() => {
|
|
1528
|
-
const
|
|
1529
|
-
if (
|
|
1530
|
-
|
|
1478
|
+
const _marks = toValue(options.marks);
|
|
1479
|
+
if (!_marks) return [];
|
|
1480
|
+
if (_marks === true) {
|
|
1481
|
+
const markCount = Math.floor((max.value - min.value) / step.value) + 1;
|
|
1482
|
+
return Array.from({ length: markCount }, (_, index) => {
|
|
1483
|
+
return { value: min.value + step.value * index };
|
|
1484
|
+
});
|
|
1531
1485
|
}
|
|
1532
|
-
return
|
|
1486
|
+
return _marks.map((mark) => {
|
|
1487
|
+
if (typeof mark === "number") return { value: mark };
|
|
1488
|
+
return mark;
|
|
1489
|
+
}).sort((a, b) => a.value - b.value);
|
|
1533
1490
|
});
|
|
1534
|
-
const
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
if (marks.value === false) return [];
|
|
1547
|
-
if (marks.value && Array.isArray(marks.value)) {
|
|
1548
|
-
return marks.value.map((mark) => typeof mark === "number" ? { value: mark } : mark).filter((mark) => mark.value >= min.value && mark.value <= max.value).sort((a, b) => asc(a.value, b.value));
|
|
1549
|
-
}
|
|
1550
|
-
if (step.value && step.value > 0) {
|
|
1551
|
-
return [...Array(Math.floor((max.value - min.value) / step.value + 1))].map((_, index) => ({
|
|
1552
|
-
value: min.value + step.value * index
|
|
1553
|
-
}));
|
|
1554
|
-
}
|
|
1555
|
-
return [];
|
|
1556
|
-
});
|
|
1557
|
-
const marksValues = computed(() => marksList.value.map((mark) => mark.value));
|
|
1558
|
-
const emitChange = (next) => {
|
|
1559
|
-
if (!areArraysEqual(normalizedValues.value, next)) {
|
|
1560
|
-
const nextValue = isRange.value ? next : next[0];
|
|
1561
|
-
if (typeof nextValue !== "undefined") {
|
|
1562
|
-
options.onChange?.(nextValue);
|
|
1563
|
-
}
|
|
1564
|
-
}
|
|
1565
|
-
lastChangedValue = next;
|
|
1566
|
-
};
|
|
1567
|
-
const emitCommit = (fallback2) => {
|
|
1568
|
-
const valueWithFallback = lastChangedValue ?? fallback2;
|
|
1569
|
-
const nextValue = isRange.value ? valueWithFallback : valueWithFallback[0];
|
|
1570
|
-
if (typeof nextValue !== "undefined") {
|
|
1571
|
-
options.onCommit?.(nextValue);
|
|
1572
|
-
}
|
|
1573
|
-
};
|
|
1574
|
-
const ensureFocusOnThumb = (options2) => {
|
|
1575
|
-
const { index, shouldSetActive = false } = options2;
|
|
1576
|
-
const slider2 = sliderRef.value;
|
|
1577
|
-
if (!slider2) return;
|
|
1578
|
-
if (slider2.contains(document.activeElement) && Number(document.activeElement?.getAttribute("data-index")) !== index) {
|
|
1579
|
-
slider2.querySelector(`[type="range"][data-index="${index}"]`)?.focus();
|
|
1580
|
-
}
|
|
1581
|
-
if (shouldSetActive) {
|
|
1582
|
-
activeThumbIndex.value = index;
|
|
1583
|
-
}
|
|
1584
|
-
};
|
|
1585
|
-
const eventToCoords = (event, touchId2) => {
|
|
1586
|
-
if (touchId2 !== void 0 && isTouchEvent(event)) {
|
|
1587
|
-
for (let i = 0; i < event.changedTouches.length; i += 1) {
|
|
1588
|
-
const touch = event.changedTouches[i];
|
|
1589
|
-
if (touch && touch.identifier === touchId2) {
|
|
1590
|
-
return {
|
|
1591
|
-
x: touch.clientX,
|
|
1592
|
-
y: touch.clientY
|
|
1593
|
-
};
|
|
1594
|
-
}
|
|
1595
|
-
}
|
|
1596
|
-
return false;
|
|
1597
|
-
}
|
|
1598
|
-
const mouseEvent = event;
|
|
1599
|
-
return {
|
|
1600
|
-
x: mouseEvent.clientX,
|
|
1601
|
-
y: mouseEvent.clientY
|
|
1491
|
+
const getNormalizedValue = computed(() => {
|
|
1492
|
+
return (value) => {
|
|
1493
|
+
let values = typeof value === "number" ? [value] : value;
|
|
1494
|
+
values = values.map((value2) => MathUtils.clamp(value2, min.value, max.value)).map((value2) => {
|
|
1495
|
+
const stepDecimals = MathUtils.decimalsCount(step.value);
|
|
1496
|
+
return Number(
|
|
1497
|
+
(Math.round((value2 - min.value) / step.value) * step.value + min.value).toFixed(
|
|
1498
|
+
stepDecimals
|
|
1499
|
+
)
|
|
1500
|
+
);
|
|
1501
|
+
}).sort((a, b) => a - b);
|
|
1502
|
+
return values;
|
|
1602
1503
|
};
|
|
1603
|
-
};
|
|
1604
|
-
const
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
const
|
|
1609
|
-
|
|
1610
|
-
const
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
return { newValue: candidate, activeIndex: 0 };
|
|
1617
|
-
}
|
|
1618
|
-
const closestIndex = findClosestIndex(normalizedValues.value, candidate);
|
|
1619
|
-
const index = isMoving && previousActiveIndex != null ? previousActiveIndex : closestIndex;
|
|
1620
|
-
const adjustedValues = adjustValueByIndex({
|
|
1621
|
-
values: normalizedValues.value,
|
|
1622
|
-
newValue: candidate,
|
|
1623
|
-
index
|
|
1624
|
-
});
|
|
1625
|
-
const adjustedIndex = findClosestIndex(adjustedValues, candidate);
|
|
1626
|
-
previousActiveIndex = adjustedIndex;
|
|
1627
|
-
return { newValue: adjustedValues, activeIndex: adjustedIndex };
|
|
1628
|
-
};
|
|
1629
|
-
const commitValueFromEvent = (event, input2) => {
|
|
1630
|
-
const index = readThumbIndex(event);
|
|
1631
|
-
const current = normalizedValues.value[index];
|
|
1632
|
-
if (typeof current !== "number") {
|
|
1633
|
-
return;
|
|
1634
|
-
}
|
|
1635
|
-
const useMarks = isDiscrete.value && marksList.value.length > 0;
|
|
1636
|
-
const snapByMarks = (candidate) => {
|
|
1637
|
-
const list = marksList.value;
|
|
1638
|
-
const first = list[0];
|
|
1639
|
-
const last = list.at(-1);
|
|
1640
|
-
if (!first || !last) {
|
|
1641
|
-
return current;
|
|
1642
|
-
}
|
|
1643
|
-
if (candidate <= first.value) {
|
|
1644
|
-
return first.value;
|
|
1645
|
-
}
|
|
1646
|
-
if (candidate >= last.value) {
|
|
1647
|
-
return last.value;
|
|
1504
|
+
});
|
|
1505
|
+
const normalizedValue = computed(
|
|
1506
|
+
() => getNormalizedValue.value(toValue(options.value))
|
|
1507
|
+
);
|
|
1508
|
+
const updateValue = (value, index) => {
|
|
1509
|
+
const currentValue = normalizedValue.value.slice();
|
|
1510
|
+
const otherIndex = index === 0 ? 1 : 0;
|
|
1511
|
+
const otherValue = currentValue[otherIndex];
|
|
1512
|
+
if (otherValue != void 0) {
|
|
1513
|
+
if (index < otherIndex && value > otherValue) {
|
|
1514
|
+
value = otherValue;
|
|
1515
|
+
} else if (index > otherIndex && value < otherValue) {
|
|
1516
|
+
value = otherValue;
|
|
1648
1517
|
}
|
|
1649
|
-
const pos = marksValues.value.indexOf(current);
|
|
1650
|
-
const neighbor = candidate < current ? list[pos - 1] : list[pos + 1];
|
|
1651
|
-
return neighbor?.value ?? current;
|
|
1652
|
-
};
|
|
1653
|
-
const scalar = MathUtils.clamp(useMarks ? snapByMarks(input2) : input2, min.value, max.value);
|
|
1654
|
-
const nextValues = isRange.value ? adjustValueByIndex({ values: normalizedValues.value, newValue: scalar, index }) : [scalar];
|
|
1655
|
-
if (isRange.value) {
|
|
1656
|
-
const activeIndex = nextValues.indexOf(scalar);
|
|
1657
|
-
ensureFocusOnThumb({ index: activeIndex, shouldSetActive: true });
|
|
1658
|
-
}
|
|
1659
|
-
if (!areArraysEqual(normalizedValues.value, nextValues)) {
|
|
1660
|
-
emitChange(nextValues);
|
|
1661
|
-
}
|
|
1662
|
-
emitCommit(nextValues);
|
|
1663
|
-
};
|
|
1664
|
-
const handlePointerEnd = (event) => {
|
|
1665
|
-
const coords = eventToCoords(event, touchId);
|
|
1666
|
-
isDragging.value = false;
|
|
1667
|
-
if (!coords) {
|
|
1668
|
-
return;
|
|
1669
1518
|
}
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
activeThumbIndex.value = -1;
|
|
1676
|
-
emitCommit(valueToArray(newValue));
|
|
1677
|
-
movesSinceStart = 0;
|
|
1678
|
-
touchId = null;
|
|
1679
|
-
stopPointerListening();
|
|
1680
|
-
};
|
|
1681
|
-
const handlePointerMove = (event) => {
|
|
1682
|
-
const coords = eventToCoords(event, touchId);
|
|
1683
|
-
if (!coords) return;
|
|
1684
|
-
movesSinceStart += 1;
|
|
1685
|
-
if (event.type === "mousemove" && event.buttons === 0) {
|
|
1686
|
-
handlePointerEnd(event);
|
|
1687
|
-
return;
|
|
1688
|
-
}
|
|
1689
|
-
const nextState = getNextFromCoords({ coords, isMoving: true });
|
|
1690
|
-
if (!nextState) {
|
|
1691
|
-
handlePointerEnd(event);
|
|
1692
|
-
return;
|
|
1693
|
-
}
|
|
1694
|
-
const { newValue, activeIndex } = nextState;
|
|
1695
|
-
if (!isDragging.value && movesSinceStart > DRAG_MOVE_THRESHOLD) {
|
|
1696
|
-
isDragging.value = true;
|
|
1697
|
-
}
|
|
1698
|
-
ensureFocusOnThumb({ index: activeIndex, shouldSetActive: true });
|
|
1699
|
-
emitChange(valueToArray(newValue));
|
|
1700
|
-
isDragging.value = true;
|
|
1519
|
+
currentValue[index] = value;
|
|
1520
|
+
const normalized = getNormalizedValue.value(currentValue);
|
|
1521
|
+
const newValue = normalized.length > 1 ? normalized : normalized[0];
|
|
1522
|
+
if (areArraysEqual(normalized, normalizedValue.value)) return;
|
|
1523
|
+
options.onChange?.(newValue);
|
|
1701
1524
|
};
|
|
1702
|
-
const
|
|
1703
|
-
|
|
1704
|
-
|
|
1525
|
+
const getValueInPercentage = computed(() => {
|
|
1526
|
+
return (value) => {
|
|
1527
|
+
const percentage = MathUtils.valueToPercent(value, min.value, max.value);
|
|
1528
|
+
return MathUtils.clamp(percentage, 0, 100);
|
|
1529
|
+
};
|
|
1530
|
+
});
|
|
1531
|
+
const handleKeydown = (event, thumbIndex) => {
|
|
1532
|
+
if (!NAVIGATION_KEYS.has(event.key)) return;
|
|
1533
|
+
event.preventDefault();
|
|
1534
|
+
const currentValue = normalizedValue.value.slice();
|
|
1535
|
+
if (currentValue[thumbIndex] == void 0) return;
|
|
1536
|
+
const stepSize = event.shiftKey ? shiftStep.value : step.value;
|
|
1537
|
+
if (event.key === "Home") {
|
|
1538
|
+
return updateValue(min.value, thumbIndex);
|
|
1705
1539
|
}
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
touchId = touch.identifier;
|
|
1540
|
+
if (event.key === "End") {
|
|
1541
|
+
return updateValue(max.value, thumbIndex);
|
|
1709
1542
|
}
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
const { newValue, activeIndex } = nextState;
|
|
1715
|
-
ensureFocusOnThumb({ index: activeIndex, shouldSetActive: true });
|
|
1716
|
-
emitChange(valueToArray(newValue));
|
|
1717
|
-
}
|
|
1543
|
+
if (INCREMENT_KEYS.has(event.key)) {
|
|
1544
|
+
updateValue(currentValue[thumbIndex] + stepSize, thumbIndex);
|
|
1545
|
+
} else if (DECREMENT_KEYS.has(event.key)) {
|
|
1546
|
+
updateValue(currentValue[thumbIndex] - stepSize, thumbIndex);
|
|
1718
1547
|
}
|
|
1719
|
-
movesSinceStart = 0;
|
|
1720
|
-
document.addEventListener("touchmove", handlePointerMove, {
|
|
1721
|
-
passive: true
|
|
1722
|
-
});
|
|
1723
|
-
document.addEventListener("touchend", handlePointerEnd);
|
|
1724
|
-
};
|
|
1725
|
-
const stopPointerListening = () => {
|
|
1726
|
-
document.removeEventListener("mousemove", handlePointerMove);
|
|
1727
|
-
document.removeEventListener("mouseup", handlePointerEnd);
|
|
1728
|
-
document.removeEventListener("touchmove", handlePointerMove);
|
|
1729
|
-
document.removeEventListener("touchend", handlePointerEnd);
|
|
1730
1548
|
};
|
|
1731
|
-
const
|
|
1732
|
-
if (isDisabled.value) {
|
|
1733
|
-
return;
|
|
1734
|
-
}
|
|
1735
|
-
if (event.button !== 0) {
|
|
1736
|
-
return;
|
|
1737
|
-
}
|
|
1738
|
-
if (event.defaultPrevented) {
|
|
1739
|
-
return;
|
|
1740
|
-
}
|
|
1549
|
+
const handlePointerdown = (event) => {
|
|
1741
1550
|
event.preventDefault();
|
|
1742
|
-
const
|
|
1743
|
-
if (
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
const
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
}
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
});
|
|
1755
|
-
document.addEventListener("mouseup", handlePointerEnd);
|
|
1756
|
-
};
|
|
1757
|
-
const handleHiddenInputChange = (event) => {
|
|
1758
|
-
if (isDisabled.value) {
|
|
1759
|
-
return;
|
|
1760
|
-
}
|
|
1761
|
-
const value = event.target.valueAsNumber;
|
|
1762
|
-
commitValueFromEvent(event, value);
|
|
1763
|
-
};
|
|
1764
|
-
const handleHiddenInputFocus = (event) => {
|
|
1765
|
-
const index = readThumbIndex(event);
|
|
1766
|
-
if (isFocusVisible(event.target)) {
|
|
1767
|
-
activeThumbIndex.value = index;
|
|
1768
|
-
}
|
|
1551
|
+
const value = getValueFromCoordinates(event.x);
|
|
1552
|
+
if (value == void 0) return;
|
|
1553
|
+
const thumb = normalizedValue.value.reduce(
|
|
1554
|
+
(previous, thumbValue, index) => {
|
|
1555
|
+
const distance = Math.abs(thumbValue - value);
|
|
1556
|
+
if (distance < previous.distance) return { index, distance };
|
|
1557
|
+
return previous;
|
|
1558
|
+
},
|
|
1559
|
+
{ index: 0, distance: Number.POSITIVE_INFINITY }
|
|
1560
|
+
);
|
|
1561
|
+
updateValue(value, thumb.index);
|
|
1562
|
+
draggingThumbIndex.value = thumb.index;
|
|
1769
1563
|
};
|
|
1770
|
-
const
|
|
1771
|
-
if (
|
|
1772
|
-
|
|
1773
|
-
|
|
1564
|
+
const handlePointermove = (event) => {
|
|
1565
|
+
if (draggingThumbIndex.value == void 0) return;
|
|
1566
|
+
const value = getValueFromCoordinates(event.x);
|
|
1567
|
+
if (value == void 0) return;
|
|
1568
|
+
updateValue(value, draggingThumbIndex.value);
|
|
1774
1569
|
};
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
}
|
|
1783
|
-
if (!isDiscrete.value) {
|
|
1784
|
-
const stepSize = event.shiftKey ? shiftStep.value : step.value;
|
|
1785
|
-
if (event.key === "Home") return commitValueFromEvent(event, min.value);
|
|
1786
|
-
if (event.key === "End") return commitValueFromEvent(event, max.value);
|
|
1787
|
-
if (INCREMENT_KEYS.has(event.key)) {
|
|
1788
|
-
const next = MathUtils.clamp(value + stepSize, min.value, max.value);
|
|
1789
|
-
if (next !== value) commitValueFromEvent(event, next);
|
|
1790
|
-
return;
|
|
1791
|
-
}
|
|
1792
|
-
if (DECREMENT_KEYS.has(event.key)) {
|
|
1793
|
-
const next = MathUtils.clamp(value - stepSize, min.value, max.value);
|
|
1794
|
-
if (next !== value) commitValueFromEvent(event, next);
|
|
1795
|
-
return;
|
|
1796
|
-
}
|
|
1797
|
-
return;
|
|
1798
|
-
} else {
|
|
1799
|
-
const values = marksValues.value;
|
|
1800
|
-
const lastIndex = values.length - 1;
|
|
1801
|
-
const currentIndex = values.indexOf(value);
|
|
1802
|
-
const first = values[0];
|
|
1803
|
-
const last = values[lastIndex];
|
|
1804
|
-
if (event.key === "Home" && typeof first === "number")
|
|
1805
|
-
return commitValueFromEvent(event, first);
|
|
1806
|
-
if (event.key === "End" && typeof last === "number")
|
|
1807
|
-
return commitValueFromEvent(event, last);
|
|
1808
|
-
if (INCREMENT_KEYS.has(event.key)) {
|
|
1809
|
-
const nextIdx = currentIndex < 0 ? 0 : Math.min(lastIndex, currentIndex + 1);
|
|
1810
|
-
const next = values[nextIdx];
|
|
1811
|
-
if (next !== value && typeof next === "number") commitValueFromEvent(event, next);
|
|
1812
|
-
return;
|
|
1813
|
-
}
|
|
1814
|
-
if (DECREMENT_KEYS.has(event.key)) {
|
|
1815
|
-
const nextIdx = currentIndex < 0 ? 0 : Math.max(0, currentIndex - 1);
|
|
1816
|
-
const next = values[nextIdx];
|
|
1817
|
-
if (next !== value && typeof next === "number") commitValueFromEvent(event, next);
|
|
1818
|
-
return;
|
|
1819
|
-
}
|
|
1820
|
-
}
|
|
1570
|
+
useGlobalEventListener({
|
|
1571
|
+
type: "pointermove",
|
|
1572
|
+
listener: handlePointermove,
|
|
1573
|
+
disabled: computed(() => draggingThumbIndex.value == void 0)
|
|
1574
|
+
});
|
|
1575
|
+
const handlePointerup = () => {
|
|
1576
|
+
draggingThumbIndex.value = void 0;
|
|
1821
1577
|
};
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
const trackStyle = computed(() => ({
|
|
1833
|
-
left: `${trackOffset.value}%`,
|
|
1834
|
-
width: `${trackLength.value}%`
|
|
1835
|
-
}));
|
|
1836
|
-
onBeforeUnmount(stopPointerListening);
|
|
1837
|
-
watch(
|
|
1838
|
-
() => isDisabled.value,
|
|
1839
|
-
() => {
|
|
1840
|
-
if (isDisabled.value) {
|
|
1841
|
-
isDragging.value = false;
|
|
1842
|
-
activeThumbIndex.value = -1;
|
|
1843
|
-
stopPointerListening();
|
|
1844
|
-
}
|
|
1845
|
-
}
|
|
1846
|
-
);
|
|
1847
|
-
const adjustMarkPosition = (percentage, offset) => {
|
|
1848
|
-
if (offset && percentage <= 0) return offset;
|
|
1849
|
-
if (offset && percentage >= 100) return `calc(100% - ${offset})`;
|
|
1850
|
-
return `${percentage}%`;
|
|
1578
|
+
useGlobalEventListener({
|
|
1579
|
+
type: "pointerup",
|
|
1580
|
+
listener: handlePointerup,
|
|
1581
|
+
disabled: computed(() => draggingThumbIndex.value == void 0)
|
|
1582
|
+
});
|
|
1583
|
+
const getValueFromCoordinates = (x) => {
|
|
1584
|
+
const rect = sliderRef.value.getBoundingClientRect();
|
|
1585
|
+
if (rect.width <= 0) return;
|
|
1586
|
+
const percent = MathUtils.clamp((x - rect.left) / rect.width, 0, 1);
|
|
1587
|
+
return MathUtils.percentToValue(percent, min.value, max.value);
|
|
1851
1588
|
};
|
|
1852
1589
|
return {
|
|
1853
1590
|
elements: {
|
|
1854
1591
|
/**
|
|
1855
1592
|
* Root slider container element
|
|
1856
1593
|
*/
|
|
1857
|
-
root: computed(() =>
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1594
|
+
root: computed(() => {
|
|
1595
|
+
const events = {
|
|
1596
|
+
onPointerdown: handlePointerdown
|
|
1597
|
+
};
|
|
1598
|
+
return {
|
|
1599
|
+
ref: sliderRef,
|
|
1600
|
+
style: { touchAction: "pan-y" },
|
|
1601
|
+
...toValue(options.disabled) ? void 0 : events
|
|
1602
|
+
};
|
|
1603
|
+
}),
|
|
1863
1604
|
/**
|
|
1864
1605
|
* Individual thumb elements for each value (span)
|
|
1865
1606
|
*/
|
|
1866
1607
|
thumbContainer: computed(() => (data) => ({
|
|
1867
|
-
|
|
1868
|
-
style: {
|
|
1869
|
-
left: `${MathUtils.valueToPercent(data.value, min.value, max.value)}%`
|
|
1870
|
-
}
|
|
1608
|
+
style: { left: `${getValueInPercentage.value(data.value)}%` }
|
|
1871
1609
|
})),
|
|
1872
1610
|
/**
|
|
1873
|
-
*
|
|
1611
|
+
* Input inside each thumb for accessibility
|
|
1874
1612
|
*/
|
|
1875
|
-
thumbInput: computed(() => (data) =>
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
})
|
|
1613
|
+
thumbInput: computed(() => (data) => {
|
|
1614
|
+
const events = {
|
|
1615
|
+
onKeydown: (event) => handleKeydown(event, data.index)
|
|
1616
|
+
};
|
|
1617
|
+
return {
|
|
1618
|
+
min: min.value,
|
|
1619
|
+
max: max.value,
|
|
1620
|
+
value: data.value,
|
|
1621
|
+
role: "slider",
|
|
1622
|
+
type: "range",
|
|
1623
|
+
"aria-label": toValue(options.label),
|
|
1624
|
+
"aria-valuemin": min.value,
|
|
1625
|
+
"aria-valuemax": max.value,
|
|
1626
|
+
"aria-valuenow": data.value,
|
|
1627
|
+
"aria-orientation": "horizontal",
|
|
1628
|
+
step: step.value,
|
|
1629
|
+
disabled: toValue(options.disabled),
|
|
1630
|
+
...toValue(options.disabled) ? void 0 : events
|
|
1631
|
+
};
|
|
1632
|
+
}),
|
|
1895
1633
|
/**
|
|
1896
|
-
* Mark
|
|
1634
|
+
* Single Mark element inside the rail
|
|
1897
1635
|
*/
|
|
1898
1636
|
mark: computed(() => (data) => {
|
|
1899
|
-
const percentage =
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1637
|
+
const percentage = getValueInPercentage.value(data.value);
|
|
1638
|
+
let position = `${percentage}%`;
|
|
1639
|
+
if (data.positionOffset && percentage <= 0) {
|
|
1640
|
+
position = data.positionOffset;
|
|
1641
|
+
}
|
|
1642
|
+
if (data.positionOffset && percentage >= 100) {
|
|
1643
|
+
position = `calc(100% - ${data.positionOffset})`;
|
|
1644
|
+
}
|
|
1905
1645
|
return {
|
|
1906
|
-
"data-value": data.value,
|
|
1907
1646
|
"aria-hidden": true,
|
|
1908
1647
|
style: { left: position }
|
|
1909
1648
|
};
|
|
@@ -1911,83 +1650,46 @@ const _unstableCreateSlider = createBuilder(
|
|
|
1911
1650
|
/**
|
|
1912
1651
|
* Label for each mark
|
|
1913
1652
|
*/
|
|
1914
|
-
markLabel: computed(() => (data) =>
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1653
|
+
markLabel: computed(() => (data) => {
|
|
1654
|
+
const left = getValueInPercentage.value(data.value);
|
|
1655
|
+
let translate = "-50%";
|
|
1656
|
+
if (left === 0) {
|
|
1657
|
+
translate = "0%";
|
|
1658
|
+
} else if (left === 100) {
|
|
1659
|
+
translate = "-100%";
|
|
1660
|
+
}
|
|
1661
|
+
return {
|
|
1662
|
+
"aria-hidden": true,
|
|
1663
|
+
style: {
|
|
1664
|
+
left: `${left}%`,
|
|
1665
|
+
transform: translate ? `translateX(${translate})` : void 0
|
|
1666
|
+
}
|
|
1667
|
+
};
|
|
1668
|
+
}),
|
|
1921
1669
|
/**
|
|
1922
1670
|
* Track element representing the selected range
|
|
1923
1671
|
*/
|
|
1924
|
-
track: computed(() =>
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1672
|
+
track: computed(() => {
|
|
1673
|
+
const isRange = normalizedValue.value.length > 1;
|
|
1674
|
+
const offsetValue = isRange ? normalizedValue.value[0] : min.value;
|
|
1675
|
+
const left = getValueInPercentage.value(offsetValue);
|
|
1676
|
+
const lengthValue = normalizedValue.value.at(-1);
|
|
1677
|
+
const width = getValueInPercentage.value(lengthValue) - left;
|
|
1678
|
+
return {
|
|
1679
|
+
style: {
|
|
1680
|
+
left: `${left}%`,
|
|
1681
|
+
width: `${width}%`
|
|
1682
|
+
}
|
|
1683
|
+
};
|
|
1684
|
+
})
|
|
1936
1685
|
},
|
|
1937
1686
|
state: {
|
|
1938
|
-
|
|
1939
|
-
* True if the slider is currently being dragged.
|
|
1940
|
-
*/
|
|
1941
|
-
isDragging,
|
|
1942
|
-
/**
|
|
1943
|
-
* Index of the currently active thumb.
|
|
1944
|
-
* Thumb could be active even if not dragging (e.g. click on the rail to move the thumb there).
|
|
1945
|
-
* `-1` if no thumb is active.
|
|
1946
|
-
*/
|
|
1947
|
-
activeThumbIndex,
|
|
1948
|
-
/**
|
|
1949
|
-
* `true` if the slider is a range slider (with two or more thumbs).
|
|
1950
|
-
*/
|
|
1951
|
-
isRange,
|
|
1952
|
-
/**
|
|
1953
|
-
* Offset of the track as a percentage (0-100).
|
|
1954
|
-
*/
|
|
1955
|
-
trackOffset,
|
|
1956
|
-
/**
|
|
1957
|
-
* Length of the track as a percentage (0-100).
|
|
1958
|
-
*/
|
|
1959
|
-
trackLength,
|
|
1960
|
-
/**
|
|
1961
|
-
* List of marks to display on the slider.
|
|
1962
|
-
* - If marks option is `true`, marks are generated based on the step value.
|
|
1963
|
-
* - If marks option is an array of numbers or objects, it is used as provided (filtered to be within range).
|
|
1964
|
-
* - If marks option is `false`, no marks are shown.
|
|
1965
|
-
*/
|
|
1966
|
-
marksList,
|
|
1967
|
-
/**
|
|
1968
|
-
* Step size when holding shift key or using Page Up/Page Down keys.
|
|
1969
|
-
*/
|
|
1687
|
+
normalizedValue,
|
|
1970
1688
|
shiftStep,
|
|
1971
|
-
|
|
1972
|
-
* Normalized slider values (clamped to min/max and rounded to nearest step/mark).
|
|
1973
|
-
*/
|
|
1974
|
-
normalizedValues
|
|
1689
|
+
marks
|
|
1975
1690
|
},
|
|
1976
1691
|
internals: {
|
|
1977
|
-
|
|
1978
|
-
* Clamps a value to the slider's range.
|
|
1979
|
-
* @param value - value to clamp
|
|
1980
|
-
* @returns clamped value
|
|
1981
|
-
*/
|
|
1982
|
-
clampValue: computed(() => (value) => MathUtils.clamp(value, min.value, max.value)),
|
|
1983
|
-
/**
|
|
1984
|
-
* Rounds a value to the nearest valid step.
|
|
1985
|
-
* @param value - value to round
|
|
1986
|
-
* @returns rounded value
|
|
1987
|
-
*/
|
|
1988
|
-
roundToStep: computed(
|
|
1989
|
-
() => (value) => !isDiscrete.value ? roundToStep(value, step.value, min.value) : marksValues.value[findClosestIndex(marksValues.value, value)]
|
|
1990
|
-
)
|
|
1692
|
+
updateValue
|
|
1991
1693
|
}
|
|
1992
1694
|
};
|
|
1993
1695
|
}
|
|
@@ -13869,6 +13571,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
13869
13571
|
const displayValue = computed(() => getDisplayValue.value(modelValue.value));
|
|
13870
13572
|
const getFormattedValue = computed(() => {
|
|
13871
13573
|
return (value) => {
|
|
13574
|
+
if (value != void 0 && isNaN(value)) return "";
|
|
13872
13575
|
if (props.precision !== void 0 && value != void 0) {
|
|
13873
13576
|
return roundToPrecision(value, props.precision);
|
|
13874
13577
|
} else {
|
|
@@ -13915,7 +13618,8 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
13915
13618
|
return;
|
|
13916
13619
|
}
|
|
13917
13620
|
inputValue.value = getFormattedValue.value(parseFloat(inputValue.value));
|
|
13918
|
-
|
|
13621
|
+
const parsedValue = parseFloat(inputValue.value);
|
|
13622
|
+
modelValue.value = isNaN(parsedValue) ? void 0 : parsedValue;
|
|
13919
13623
|
};
|
|
13920
13624
|
const handleBlur = () => {
|
|
13921
13625
|
inputValue.value = getFormattedValue.value(modelValue.value);
|
|
@@ -14062,6 +13766,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
14062
13766
|
__expose();
|
|
14063
13767
|
const props = __props;
|
|
14064
13768
|
const emit = __emit;
|
|
13769
|
+
const { t } = injectI18n();
|
|
14065
13770
|
const { densityClass } = useDensity(props);
|
|
14066
13771
|
const modelValue = useVModel({
|
|
14067
13772
|
props,
|
|
@@ -14075,12 +13780,15 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
14075
13780
|
modelValue.value = newValue;
|
|
14076
13781
|
};
|
|
14077
13782
|
const handleStepperChange = (value) => {
|
|
14078
|
-
if (
|
|
14079
|
-
|
|
14080
|
-
}
|
|
13783
|
+
if (value == void 0) return;
|
|
13784
|
+
modelValue.value = value;
|
|
14081
13785
|
};
|
|
14082
|
-
const
|
|
14083
|
-
|
|
13786
|
+
const stepperLabel = computed(() => {
|
|
13787
|
+
if (props.direction === "increase") return t.value("slider.changeStartValue");
|
|
13788
|
+
else if (props.direction === "decrease") return t.value("slider.changeEndValue");
|
|
13789
|
+
return t.value("slider.changeValue");
|
|
13790
|
+
});
|
|
13791
|
+
const __returned__ = { props, emit, t, densityClass, modelValue, handleIconClick, handleStepperChange, stepperLabel, get iconMinusSmall() {
|
|
14084
13792
|
return iconMinusSmall;
|
|
14085
13793
|
}, get iconPlusSmall() {
|
|
14086
13794
|
return iconPlusSmall;
|
|
@@ -14119,7 +13827,6 @@ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
14119
13827
|
color: "neutral",
|
|
14120
13828
|
label: $setup.t("slider.decreaseValueBy", { n: $setup.props.shiftStep }),
|
|
14121
13829
|
icon: $setup.iconMinusSmall,
|
|
14122
|
-
tabindex: "0",
|
|
14123
13830
|
onClick: $setup.handleIconClick
|
|
14124
13831
|
}, null, 8, ["disabled", "label", "icon"])) : createCommentVNode("v-if", true),
|
|
14125
13832
|
$setup.props.direction === "increase" ? (openBlock(), createBlock($setup["OnyxIconButton"], {
|
|
@@ -14128,7 +13835,6 @@ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
14128
13835
|
color: "neutral",
|
|
14129
13836
|
label: $setup.t("slider.increaseValueBy", { n: $setup.props.shiftStep }),
|
|
14130
13837
|
icon: $setup.iconPlusSmall,
|
|
14131
|
-
tabindex: "0",
|
|
14132
13838
|
onClick: $setup.handleIconClick
|
|
14133
13839
|
}, null, 8, ["disabled", "label", "icon"])) : createCommentVNode("v-if", true)
|
|
14134
13840
|
],
|
|
@@ -14137,7 +13843,7 @@ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
14137
13843
|
)) : createCommentVNode("v-if", true),
|
|
14138
13844
|
$setup.props.control === "input" ? (openBlock(), createBlock($setup["OnyxStepper"], {
|
|
14139
13845
|
key: 2,
|
|
14140
|
-
label: $setup.
|
|
13846
|
+
label: $setup.stepperLabel,
|
|
14141
13847
|
"hide-label": "",
|
|
14142
13848
|
"hide-buttons": "",
|
|
14143
13849
|
disabled: $setup.props.disabled,
|
|
@@ -14177,8 +13883,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
14177
13883
|
shiftStep: { type: Number, required: false },
|
|
14178
13884
|
marks: { type: [Array, Boolean], required: false },
|
|
14179
13885
|
control: { type: null, required: false },
|
|
14180
|
-
disableTooltip: { type: Boolean, required: false }
|
|
14181
|
-
discrete: { type: Boolean, required: false }
|
|
13886
|
+
disableTooltip: { type: Boolean, required: false }
|
|
14182
13887
|
},
|
|
14183
13888
|
emits: ["update:modelValue", "validityChange"],
|
|
14184
13889
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -14197,51 +13902,29 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
14197
13902
|
const { disabled, showError } = useFormContext(props);
|
|
14198
13903
|
const errorClass = useErrorClass(showError);
|
|
14199
13904
|
const skeleton = useSkeletonContext(props);
|
|
14200
|
-
const { min, max, step,
|
|
13905
|
+
const { min, max, step, label } = toRefs(props);
|
|
14201
13906
|
const {
|
|
14202
|
-
elements: { root,
|
|
14203
|
-
state: {
|
|
14204
|
-
internals: {
|
|
13907
|
+
elements: { root, track, thumbContainer, thumbInput, mark, markLabel },
|
|
13908
|
+
state: { normalizedValue, marks, shiftStep },
|
|
13909
|
+
internals: { updateValue }
|
|
14205
13910
|
} = _unstableCreateSlider({
|
|
14206
13911
|
value: modelValue,
|
|
14207
13912
|
min,
|
|
14208
13913
|
max,
|
|
14209
13914
|
step,
|
|
14210
13915
|
label,
|
|
14211
|
-
marks,
|
|
14212
|
-
discrete,
|
|
13916
|
+
marks: toRef(props, "marks"),
|
|
14213
13917
|
disabled,
|
|
14214
13918
|
shiftStep: toRef(props, "shiftStep"),
|
|
14215
13919
|
onChange: (newValue) => modelValue.value = newValue
|
|
14216
13920
|
});
|
|
14217
|
-
const
|
|
14218
|
-
const rounded = roundToStep2.value(clampValue.value(value));
|
|
14219
|
-
if (rounded === void 0) return;
|
|
14220
|
-
if (Array.isArray(modelValue.value)) {
|
|
14221
|
-
if (index === 0 && rounded <= (modelValue.value[1] ?? props.max)) {
|
|
14222
|
-
modelValue.value = [rounded, modelValue.value[1]];
|
|
14223
|
-
return;
|
|
14224
|
-
}
|
|
14225
|
-
if (index === 1 && rounded >= (modelValue.value[0] ?? props.min)) {
|
|
14226
|
-
modelValue.value = [modelValue.value[0], rounded];
|
|
14227
|
-
return;
|
|
14228
|
-
}
|
|
14229
|
-
} else {
|
|
14230
|
-
modelValue.value = rounded;
|
|
14231
|
-
}
|
|
14232
|
-
};
|
|
14233
|
-
const handleSliderIconControlChange = (value) => {
|
|
14234
|
-
const rounded = roundToStep2.value(clampValue.value(value));
|
|
14235
|
-
if (rounded === void 0) return;
|
|
14236
|
-
modelValue.value = rounded;
|
|
14237
|
-
};
|
|
14238
|
-
const __returned__ = { props, emit, modelValue, vCustomValidity, errorMessages, formElementProps, messages, densityClass, disabled, showError, errorClass, skeleton, min, max, step, marks, label, discrete, root, rail, track, thumbContainer, thumbInput, mark, markLabel, activeThumbIndex, marksList, shiftStep, normalizedValues, roundToStep: roundToStep2, clampValue, handleSliderInputControlChange, handleSliderIconControlChange, OnyxFormElement, OnyxSkeleton, OnyxSliderControl, OnyxTooltip, OnyxVisuallyHidden };
|
|
13921
|
+
const __returned__ = { props, emit, modelValue, vCustomValidity, errorMessages, formElementProps, messages, densityClass, disabled, showError, errorClass, skeleton, min, max, step, label, root, track, thumbContainer, thumbInput, mark, markLabel, normalizedValue, marks, shiftStep, updateValue, OnyxFormElement, OnyxSkeleton, OnyxSliderControl, OnyxTooltip, OnyxVisuallyHidden };
|
|
14239
13922
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
14240
13923
|
return __returned__;
|
|
14241
13924
|
}
|
|
14242
13925
|
});
|
|
14243
13926
|
const _hoisted_1$6 = { class: "onyx-slider__container" };
|
|
14244
|
-
const _hoisted_2$5 = ["disabled", "aria-label", "autofocus"];
|
|
13927
|
+
const _hoisted_2$5 = ["id", "disabled", "aria-label", "autofocus"];
|
|
14245
13928
|
function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
14246
13929
|
return $setup.skeleton ? (openBlock(), createElementBlock(
|
|
14247
13930
|
"div",
|
|
@@ -14262,13 +13945,7 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
14262
13945
|
"div",
|
|
14263
13946
|
{
|
|
14264
13947
|
key: 1,
|
|
14265
|
-
class: normalizeClass([
|
|
14266
|
-
"onyx-component",
|
|
14267
|
-
"onyx-slider",
|
|
14268
|
-
{ "onyx-slider--active": $setup.activeThumbIndex !== -1 },
|
|
14269
|
-
$setup.densityClass,
|
|
14270
|
-
$setup.errorClass
|
|
14271
|
-
])
|
|
13948
|
+
class: normalizeClass(["onyx-component", "onyx-slider", $setup.densityClass, $setup.errorClass])
|
|
14272
13949
|
},
|
|
14273
13950
|
[
|
|
14274
13951
|
createVNode($setup["OnyxFormElement"], mergeProps({
|
|
@@ -14284,36 +13961,33 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
14284
13961
|
key: 0,
|
|
14285
13962
|
control: "value",
|
|
14286
13963
|
"model-value": $setup.props.min
|
|
14287
|
-
}, null, 8, ["model-value"])) :
|
|
14288
|
-
$setup.props.control === "icon" && $setup.props.mode === "single" ? (openBlock(), createBlock($setup["OnyxSliderControl"], {
|
|
13964
|
+
}, null, 8, ["model-value"])) : $setup.props.control === "icon" && $setup.props.mode === "single" ? (openBlock(), createBlock($setup["OnyxSliderControl"], {
|
|
14289
13965
|
key: 1,
|
|
14290
13966
|
control: "icon",
|
|
14291
13967
|
direction: "decrease",
|
|
14292
13968
|
"shift-step": $setup.shiftStep,
|
|
14293
|
-
"model-value": $setup.
|
|
14294
|
-
disabled: $setup.disabled || ($setup.
|
|
14295
|
-
"onUpdate:modelValue": $setup.
|
|
14296
|
-
}, null, 8, ["shift-step", "model-value", "disabled"])) :
|
|
14297
|
-
$setup.props.control === "input" && $setup.props.mode === "range" ? (openBlock(), createBlock($setup["OnyxSliderControl"], {
|
|
13969
|
+
"model-value": $setup.normalizedValue[0],
|
|
13970
|
+
disabled: $setup.disabled || ($setup.normalizedValue[0] ?? $setup.props.min) <= $setup.props.min,
|
|
13971
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $setup.updateValue($event, 0))
|
|
13972
|
+
}, null, 8, ["shift-step", "model-value", "disabled"])) : $setup.props.control === "input" && $setup.props.mode === "range" ? (openBlock(), createBlock($setup["OnyxSliderControl"], {
|
|
14298
13973
|
key: 2,
|
|
14299
13974
|
control: "input",
|
|
13975
|
+
direction: "increase",
|
|
14300
13976
|
disabled: $setup.disabled,
|
|
14301
|
-
"model-value": $setup.
|
|
14302
|
-
"onUpdate:modelValue": _cache[
|
|
13977
|
+
"model-value": $setup.normalizedValue[0] ?? 0,
|
|
13978
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $setup.updateValue($event, 0))
|
|
14303
13979
|
}, null, 8, ["disabled", "model-value"])) : createCommentVNode("v-if", true),
|
|
14304
13980
|
createElementVNode(
|
|
14305
13981
|
"span",
|
|
14306
|
-
mergeProps({ class: "onyx-slider__root" }, $setup.root,
|
|
14307
|
-
onTouchstartPassive: _cache[1] || (_cache[1] = (...args) => $setup.root.onTouchstart && $setup.root.onTouchstart(...args))
|
|
14308
|
-
}),
|
|
13982
|
+
mergeProps({ class: "onyx-slider__root" }, $setup.root),
|
|
14309
13983
|
[
|
|
14310
|
-
createElementVNode(
|
|
13984
|
+
_cache[4] || (_cache[4] = createElementVNode(
|
|
14311
13985
|
"span",
|
|
14312
|
-
|
|
13986
|
+
{ class: "onyx-slider__rail" },
|
|
14313
13987
|
null,
|
|
14314
|
-
|
|
14315
|
-
/*
|
|
14316
|
-
),
|
|
13988
|
+
-1
|
|
13989
|
+
/* CACHED */
|
|
13990
|
+
)),
|
|
14317
13991
|
createElementVNode(
|
|
14318
13992
|
"span",
|
|
14319
13993
|
mergeProps({ class: "onyx-slider__track" }, $setup.track),
|
|
@@ -14324,7 +13998,7 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
14324
13998
|
(openBlock(true), createElementBlock(
|
|
14325
13999
|
Fragment,
|
|
14326
14000
|
null,
|
|
14327
|
-
renderList($setup.
|
|
14001
|
+
renderList($setup.marks, (markItem) => {
|
|
14328
14002
|
return openBlock(), createElementBlock(
|
|
14329
14003
|
Fragment,
|
|
14330
14004
|
{
|
|
@@ -14363,18 +14037,13 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
14363
14037
|
(openBlock(true), createElementBlock(
|
|
14364
14038
|
Fragment,
|
|
14365
14039
|
null,
|
|
14366
|
-
renderList($setup.
|
|
14040
|
+
renderList($setup.normalizedValue, (value, index) => {
|
|
14367
14041
|
return openBlock(), createElementBlock(
|
|
14368
14042
|
"span",
|
|
14369
|
-
mergeProps({ key: index }, { ref_for: true }, $setup.thumbContainer({ value, index }), {
|
|
14370
|
-
class: [
|
|
14371
|
-
"onyx-slider__thumb",
|
|
14372
|
-
{ "onyx-slider__thumb--active": $setup.activeThumbIndex === index }
|
|
14373
|
-
]
|
|
14374
|
-
}),
|
|
14043
|
+
mergeProps({ key: index }, { ref_for: true }, $setup.thumbContainer({ value, index }), { class: "onyx-slider__thumb" }),
|
|
14375
14044
|
[
|
|
14376
14045
|
createVNode($setup["OnyxTooltip"], {
|
|
14377
|
-
open:
|
|
14046
|
+
open: $setup.props.disableTooltip ? false : void 0,
|
|
14378
14047
|
text: String(value),
|
|
14379
14048
|
position: "bottom",
|
|
14380
14049
|
class: "onyx-slider__thumb-tooltip"
|
|
@@ -14389,9 +14058,12 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
14389
14058
|
null,
|
|
14390
14059
|
{
|
|
14391
14060
|
default: withCtx(() => [
|
|
14392
|
-
withDirectives(createElementVNode("input", mergeProps({
|
|
14061
|
+
withDirectives(createElementVNode("input", mergeProps({
|
|
14062
|
+
id: index === 0 ? inputId : void 0,
|
|
14063
|
+
class: "onyx-slider__native"
|
|
14064
|
+
}, { ref_for: true }, $setup.thumbInput({ value, index }), {
|
|
14393
14065
|
disabled: $setup.disabled,
|
|
14394
|
-
"aria-label": $setup.props.label
|
|
14066
|
+
"aria-label": $setup.props.label,
|
|
14395
14067
|
autofocus: $setup.props.autofocus && index === 0
|
|
14396
14068
|
}), null, 16, _hoisted_2$5), [
|
|
14397
14069
|
[$setup["vCustomValidity"]]
|
|
@@ -14427,22 +14099,21 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
14427
14099
|
key: 3,
|
|
14428
14100
|
control: "value",
|
|
14429
14101
|
"model-value": $setup.props.max
|
|
14430
|
-
}, null, 8, ["model-value"])) :
|
|
14431
|
-
$setup.props.control === "icon" && $setup.props.mode === "single" ? (openBlock(), createBlock($setup["OnyxSliderControl"], {
|
|
14102
|
+
}, null, 8, ["model-value"])) : $setup.props.control === "icon" && $setup.props.mode === "single" ? (openBlock(), createBlock($setup["OnyxSliderControl"], {
|
|
14432
14103
|
key: 4,
|
|
14433
14104
|
control: "icon",
|
|
14434
14105
|
direction: "increase",
|
|
14435
14106
|
"shift-step": $setup.shiftStep,
|
|
14436
|
-
"model-value": $setup.
|
|
14437
|
-
"onUpdate:modelValue": $setup.
|
|
14438
|
-
}, null, 8, ["shift-step", "model-value"])) :
|
|
14439
|
-
$setup.props.control === "input" ? (openBlock(), createBlock($setup["OnyxSliderControl"], {
|
|
14107
|
+
"model-value": $setup.normalizedValue[0],
|
|
14108
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => $setup.updateValue($event, 0))
|
|
14109
|
+
}, null, 8, ["shift-step", "model-value"])) : $setup.props.control === "input" ? (openBlock(), createBlock($setup["OnyxSliderControl"], {
|
|
14440
14110
|
key: 5,
|
|
14441
14111
|
control: "input",
|
|
14112
|
+
direction: $setup.props.mode === "range" ? "decrease" : void 0,
|
|
14442
14113
|
disabled: $setup.disabled,
|
|
14443
|
-
"model-value": $setup.
|
|
14444
|
-
"onUpdate:modelValue": _cache[
|
|
14445
|
-
}, null, 8, ["disabled", "model-value"])) : createCommentVNode("v-if", true)
|
|
14114
|
+
"model-value": $setup.normalizedValue[1] ?? $setup.normalizedValue[0] ?? 0,
|
|
14115
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $setup.updateValue($event, $setup.props.mode === "range" ? 1 : 0))
|
|
14116
|
+
}, null, 8, ["direction", "disabled", "model-value"])) : createCommentVNode("v-if", true)
|
|
14446
14117
|
])
|
|
14447
14118
|
]),
|
|
14448
14119
|
_: 1
|