tfy-web-components 0.0.34 → 0.0.35
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/README.md +49 -58
- package/dist/Button-C77b7jpW.js +284 -0
- package/dist/Button-C77b7jpW.js.map +1 -0
- package/dist/CompositeItem-BGwD51jI.js +33 -0
- package/dist/CompositeItem-BGwD51jI.js.map +1 -0
- package/dist/CompositeList-D4xmSZ5V.js +291 -0
- package/dist/CompositeList-D4xmSZ5V.js.map +1 -0
- package/dist/CompositeRoot-BxrPc7F6.js +351 -0
- package/dist/CompositeRoot-BxrPc7F6.js.map +1 -0
- package/dist/DirectionContext-Pb9yafF5.js +11 -0
- package/dist/DirectionContext-Pb9yafF5.js.map +1 -0
- package/dist/FieldItemContext-DRVgx-D1.js +13 -0
- package/dist/FieldItemContext-DRVgx-D1.js.map +1 -0
- package/dist/{Input-BvwIpntS.js → Input-Dhmo6L2n.js} +100 -78
- package/dist/Input-Dhmo6L2n.js.map +1 -0
- package/dist/Modal-C4MUy9GD.js +696 -0
- package/dist/Modal-C4MUy9GD.js.map +1 -0
- package/dist/{MonacoEditorCore-xfpJ6z-E.js → MonacoEditorCore-n-df5f7I.js} +2 -2
- package/dist/{MonacoEditorCore-xfpJ6z-E.js.map → MonacoEditorCore-n-df5f7I.js.map} +1 -1
- package/dist/Popover-eC_vX5By.js +1074 -0
- package/dist/Popover-eC_vX5By.js.map +1 -0
- package/dist/ToolbarRootContext-B_HxjkNI.js +11 -0
- package/dist/ToolbarRootContext-B_HxjkNI.js.map +1 -0
- package/dist/Tooltip-BuGLP-PU.js +4096 -0
- package/dist/Tooltip-BuGLP-PU.js.map +1 -0
- package/dist/classNames-B1XpQHle.js +44 -0
- package/dist/classNames-B1XpQHle.js.map +1 -0
- package/dist/components/atoms/Accordion.d.ts +19 -37
- package/dist/components/atoms/Accordion.es.js +847 -78
- package/dist/components/atoms/Accordion.es.js.map +1 -1
- package/dist/components/atoms/AudioPlayer.es.js +9 -9
- package/dist/components/atoms/AudioPlayer.es.js.map +1 -1
- package/dist/components/atoms/Avatar.d.ts +42 -9
- package/dist/components/atoms/Avatar.es.js +491 -36
- package/dist/components/atoms/Avatar.es.js.map +1 -1
- package/dist/components/atoms/Badge.d.ts +40 -35
- package/dist/components/atoms/Badge.es.js +163 -53
- package/dist/components/atoms/Badge.es.js.map +1 -1
- package/dist/components/atoms/Button.d.ts +37 -16
- package/dist/components/atoms/Button.es.js +16 -221
- package/dist/components/atoms/Button.es.js.map +1 -1
- package/dist/components/atoms/ButtonGroup.d.ts +53 -0
- package/dist/components/atoms/ButtonGroup.es.js +349 -0
- package/dist/components/atoms/ButtonGroup.es.js.map +1 -0
- package/dist/components/atoms/IconButton.d.ts +23 -9
- package/dist/components/atoms/IconButton.es.js +82 -16
- package/dist/components/atoms/IconButton.es.js.map +1 -1
- package/dist/components/atoms/IconProvider.d.ts +1 -1
- package/dist/components/atoms/IconProvider.es.js +48 -7
- package/dist/components/atoms/IconProvider.es.js.map +1 -1
- package/dist/components/atoms/Modal.d.ts +27 -3
- package/dist/components/atoms/Modal.es.js +15 -16
- package/dist/components/atoms/Modal.es.js.map +1 -1
- package/dist/components/atoms/Notification.d.ts +1 -1
- package/dist/components/atoms/Notification.es.js +26 -3
- package/dist/components/atoms/Notification.es.js.map +1 -1
- package/dist/components/atoms/OutlinedRadio.d.ts +6 -2
- package/dist/components/atoms/OutlinedRadio.es.js +12 -25
- package/dist/components/atoms/OutlinedRadio.es.js.map +1 -1
- package/dist/components/atoms/Progress.d.ts +48 -0
- package/dist/components/atoms/Progress.es.js +279 -0
- package/dist/components/atoms/Progress.es.js.map +1 -0
- package/dist/components/atoms/Skeleton.d.ts +9 -3
- package/dist/components/atoms/Skeleton.es.js +33 -3
- package/dist/components/atoms/Skeleton.es.js.map +1 -1
- package/dist/components/atoms/Spinner.d.ts +15 -4
- package/dist/components/atoms/Spinner.es.js +86 -22
- package/dist/components/atoms/Spinner.es.js.map +1 -1
- package/dist/components/atoms/Switch.d.ts +19 -7
- package/dist/components/atoms/Switch.es.js +288 -50
- package/dist/components/atoms/Switch.es.js.map +1 -1
- package/dist/components/atoms/TabButton.d.ts +17 -3
- package/dist/components/atoms/TabButton.es.js +647 -25
- package/dist/components/atoms/TabButton.es.js.map +1 -1
- package/dist/components/atoms/TabPanel.es.js +1 -1
- package/dist/components/atoms/Tag.d.ts +43 -0
- package/dist/components/atoms/Tag.es.js +219 -0
- package/dist/components/atoms/Tag.es.js.map +1 -0
- package/dist/components/atoms/Tooltip.d.ts +36 -14
- package/dist/components/atoms/Tooltip.es.js +7 -114
- package/dist/components/atoms/Tooltip.es.js.map +1 -1
- package/dist/components/molecules/Alert.d.ts +1 -1
- package/dist/components/molecules/Alert.es.js +13 -9
- package/dist/components/molecules/Alert.es.js.map +1 -1
- package/dist/components/molecules/CopyField.d.ts +2 -2
- package/dist/components/molecules/CopyField.es.js +3 -4
- package/dist/components/molecules/CopyField.es.js.map +1 -1
- package/dist/components/molecules/CustomDrawer.d.ts +5 -4
- package/dist/components/molecules/CustomDrawer.es.js +141 -82
- package/dist/components/molecules/CustomDrawer.es.js.map +1 -1
- package/dist/components/molecules/Dialog.d.ts +16 -8
- package/dist/components/molecules/Dialog.es.js +33 -31
- package/dist/components/molecules/Dialog.es.js.map +1 -1
- package/dist/components/molecules/ImagesPreview.es.js +15 -11
- package/dist/components/molecules/ImagesPreview.es.js.map +1 -1
- package/dist/components/molecules/Input.d.ts +1 -1
- package/dist/components/molecules/Input.es.js +3 -5
- package/dist/components/molecules/Input.es.js.map +1 -1
- package/dist/components/molecules/Markdown/ExpandableMarkdown.d.ts +8 -8
- package/dist/components/molecules/Markdown/components.d.ts +12 -11
- package/dist/components/molecules/Markdown.es.js +26 -49
- package/dist/components/molecules/Markdown.es.js.map +1 -1
- package/dist/components/molecules/Notify.d.ts +30 -1
- package/dist/components/molecules/Notify.es.js +91 -36
- package/dist/components/molecules/Notify.es.js.map +1 -1
- package/dist/components/molecules/SimpleCodeEditor.es.js +32 -19
- package/dist/components/molecules/SimpleCodeEditor.es.js.map +1 -1
- package/dist/components/molecules/ToggleButton.d.ts +3 -2
- package/dist/components/molecules/ToggleButton.es.js +155 -57
- package/dist/components/molecules/ToggleButton.es.js.map +1 -1
- package/dist/components/molecules/agent-chat/UserMessage.es.js +2 -2
- package/dist/components/molecules/agent-chat/UserMessage.es.js.map +1 -1
- package/dist/components/molecules/agent-chat/UserMessageEdit.es.js +5 -5
- package/dist/components/molecules/agent-chat/UserMessageEdit.es.js.map +1 -1
- package/dist/components/molecules/agent-chat/index.d.ts +0 -6
- package/dist/components/molecules/agent-chat.es.js +76 -407
- package/dist/components/molecules/agent-chat.es.js.map +1 -1
- package/dist/components/molecules/monacoEditorCore/MonacoEditorCore.d.ts +0 -1
- package/dist/components/theme/colors.d.ts +17 -53
- package/dist/components/theme/colors.es.js +384 -180
- package/dist/components/theme/colors.es.js.map +1 -1
- package/dist/components/theme/theme.d.ts +14 -11
- package/dist/components/theme/theme.es.js +3 -64
- package/dist/components/theme/theme.es.js.map +1 -1
- package/dist/components/theme/useTheme.es.js +1 -4
- package/dist/components/theme/useTheme.es.js.map +1 -1
- package/dist/composite-CrCQWAKA.js +108 -0
- package/dist/composite-CrCQWAKA.js.map +1 -0
- package/dist/composite-DCpXNxz9.js +66 -0
- package/dist/composite-DCpXNxz9.js.map +1 -0
- package/dist/conversions-CbWPvHRE.js +14 -0
- package/dist/conversions-CbWPvHRE.js.map +1 -0
- package/dist/error-FX4R42W-.js +6 -0
- package/dist/error-FX4R42W-.js.map +1 -0
- package/dist/fonts.css +7 -0
- package/dist/hooks/useContainerDimensions.d.ts +1 -1
- package/dist/index-B806bfA-.js +257 -0
- package/dist/index-B806bfA-.js.map +1 -0
- package/dist/index-DSVg79g-.js +45 -0
- package/dist/index-DSVg79g-.js.map +1 -0
- package/dist/index.d.ts +19 -4
- package/dist/index.es.js +56 -9
- package/dist/index.es.js.map +1 -1
- package/dist/inertValue-IJM5NA30.js +11 -0
- package/dist/inertValue-IJM5NA30.js.map +1 -0
- package/dist/lib/utils.d.ts +1 -0
- package/dist/markdown.css +13 -14
- package/dist/new-components/atoms/Checkbox.d.ts +6 -0
- package/dist/new-components/atoms/Checkbox.es.js +423 -0
- package/dist/new-components/atoms/Checkbox.es.js.map +1 -0
- package/dist/new-components/atoms/Chip.d.ts +38 -0
- package/dist/new-components/atoms/Chip.es.js +269 -0
- package/dist/new-components/atoms/Chip.es.js.map +1 -0
- package/dist/new-components/atoms/Popover.d.ts +87 -0
- package/dist/new-components/atoms/Popover.es.js +21 -0
- package/dist/new-components/atoms/Popover.es.js.map +1 -0
- package/dist/new-components/atoms/Radio.d.ts +14 -0
- package/dist/new-components/atoms/Radio.es.js +536 -0
- package/dist/new-components/atoms/Radio.es.js.map +1 -0
- package/dist/new-components/atoms/SegmentedControl.d.ts +28 -0
- package/dist/new-components/atoms/SegmentedControl.es.js +326 -0
- package/dist/new-components/atoms/SegmentedControl.es.js.map +1 -0
- package/dist/new-components/atoms/Slider.d.ts +8 -0
- package/dist/new-components/atoms/Slider.es.js +1415 -0
- package/dist/new-components/atoms/Slider.es.js.map +1 -0
- package/dist/new-components/atoms/Toggletip.d.ts +43 -0
- package/dist/new-components/atoms/Toggletip.es.js +216 -0
- package/dist/new-components/atoms/Toggletip.es.js.map +1 -0
- package/dist/new-components/atoms/stories/ThemeComparison.d.ts +8 -0
- package/dist/shadowDom-Bq4g0Qeu.js +52 -0
- package/dist/shadowDom-Bq4g0Qeu.js.map +1 -0
- package/dist/style.css +1 -1
- package/dist/theme.css +9 -154
- package/dist/tokens.css +1136 -0
- package/dist/useAnimationFrame-DwhymJoW.js +108 -0
- package/dist/useAnimationFrame-DwhymJoW.js.map +1 -0
- package/dist/useAriaLabelledBy-B6n92QBS.js +49 -0
- package/dist/useAriaLabelledBy-B6n92QBS.js.map +1 -0
- package/dist/useBaseUiId-Ch7ujXpo.js +281 -0
- package/dist/useBaseUiId-Ch7ujXpo.js.map +1 -0
- package/dist/useButton-PUBhT4Vo.js +235 -0
- package/dist/useButton-PUBhT4Vo.js.map +1 -0
- package/dist/useControlled-BSyYkg5C.js +65 -0
- package/dist/useControlled-BSyYkg5C.js.map +1 -0
- package/dist/useIsoLayoutEffect-e9VA-ICd.js +499 -0
- package/dist/useIsoLayoutEffect-e9VA-ICd.js.map +1 -0
- package/dist/useLabelableId-DCLzrdD-.js +241 -0
- package/dist/useLabelableId-DCLzrdD-.js.map +1 -0
- package/dist/useOpenInteractionType-DGWLoAqp.js +1086 -0
- package/dist/useOpenInteractionType-DGWLoAqp.js.map +1 -0
- package/dist/usePopupHandleStore-BdS-xYID.js +2372 -0
- package/dist/usePopupHandleStore-BdS-xYID.js.map +1 -0
- package/dist/useTimeout-BXf1hDIL.js +46 -0
- package/dist/useTimeout-BXf1hDIL.js.map +1 -0
- package/dist/useTransitionStatus-C9gg_XJ-.js +202 -0
- package/dist/useTransitionStatus-C9gg_XJ-.js.map +1 -0
- package/dist/useValueAsRef-BfFRcMg6.js +28 -0
- package/dist/useValueAsRef-BfFRcMg6.js.map +1 -0
- package/dist/utils/classNames.d.ts +3 -2
- package/dist/visuallyHidden-B6H2X3_Y.js +26 -0
- package/dist/visuallyHidden-B6H2X3_Y.js.map +1 -0
- package/dist/vite-env.d.ts +18 -0
- package/package.json +30 -22
- package/dist/Input-BvwIpntS.js.map +0 -1
- package/dist/Notification-BT4CZ69U.js +0 -39
- package/dist/Notification-BT4CZ69U.js.map +0 -1
- package/dist/RootFontSizeContext-7vgn7Y_k.js +0 -22
- package/dist/RootFontSizeContext-7vgn7Y_k.js.map +0 -1
- package/dist/classNames-Dy-RXSjS.js +0 -9
- package/dist/classNames-Dy-RXSjS.js.map +0 -1
- package/dist/components/molecules/DropdownMenu.d.ts +0 -18
- package/dist/components/molecules/DropdownMenu.es.js +0 -104
- package/dist/components/molecules/DropdownMenu.es.js.map +0 -1
- package/dist/components/molecules/ThumbsFeedback.d.ts +0 -13
- package/dist/components/molecules/ThumbsFeedback.es.js +0 -98
- package/dist/components/molecules/ThumbsFeedback.es.js.map +0 -1
- package/dist/components/molecules/agent-chat/SandboxToolCall.d.ts +0 -15
- package/dist/components/molecules/agent-chat/ToolCallCard.d.ts +0 -26
- package/dist/components/molecules/agent-chat/ToolCallContentBlock.d.ts +0 -17
- package/dist/components/theme/lightColorPlugin.d.ts +0 -1
- package/dist/components/theme/lightColorPlugin.es.js +0 -92
- package/dist/components/theme/lightColorPlugin.es.js.map +0 -1
- package/dist/tailwindPreset.d.ts +0 -144
- package/dist/tailwindPreset.es.js +0 -100
- package/dist/tailwindPreset.es.js.map +0 -1
|
@@ -0,0 +1,1415 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c as classNames } from "../../classNames-B1XpQHle.js";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { o as ownerDocument, s as shimExports, m as matchesFocusVisible } from "../../index-B806bfA-.js";
|
|
5
|
+
import { u as useControlled } from "../../useControlled-BSyYkg5C.js";
|
|
6
|
+
import { f as formatErrorMessage, a as useStableCallback, w as warn, u as useIsoLayoutEffect, b as useRenderElement, i as isReactVersionAtLeast, m as mergeProps, c as useMergedRefs } from "../../useIsoLayoutEffect-e9VA-ICd.js";
|
|
7
|
+
import { u as useBaseUiId, n as none, c as createChangeEventDetails, k as createGenericEventDetails, l as keyboard, o as inputChange, g as getWindow, p as isElement, q as drag, r as trackPress } from "../../useBaseUiId-Ch7ujXpo.js";
|
|
8
|
+
import { f as fieldValidityMapping, u as useFormContext, a as useFieldRootContext, b as useLabelableContext, e as useRegisterFieldControl, g as useValueChanged, c as useSetFieldFocused, d as useLabelableId } from "../../useLabelableId-DCLzrdD-.js";
|
|
9
|
+
import { C as CompositeList, u as useCompositeListItem } from "../../CompositeList-D4xmSZ5V.js";
|
|
10
|
+
import { c as contains, a as activeElement, g as getTarget } from "../../shadowDom-Bq4g0Qeu.js";
|
|
11
|
+
import { u as useValueAsRef, a as addEventListener } from "../../useValueAsRef-BfFRcMg6.js";
|
|
12
|
+
import { u as useAnimationFrame } from "../../useAnimationFrame-DwhymJoW.js";
|
|
13
|
+
import { u as useDirection } from "../../DirectionContext-Pb9yafF5.js";
|
|
14
|
+
import { a as visuallyHidden } from "../../visuallyHidden-B6H2X3_Y.js";
|
|
15
|
+
import { C as COMPOSITE_KEYS, H as HOME, E as END, P as PAGE_DOWN, a as PAGE_UP, A as ARROW_LEFT, b as ARROW_DOWN, c as ARROW_RIGHT, d as ARROW_UP } from "../../composite-CrCQWAKA.js";
|
|
16
|
+
function clamp(val, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER) {
|
|
17
|
+
return Math.max(min, Math.min(val, max));
|
|
18
|
+
}
|
|
19
|
+
function areArraysEqual(array1, array2, itemComparer = Object.is) {
|
|
20
|
+
const {
|
|
21
|
+
length
|
|
22
|
+
} = array1;
|
|
23
|
+
if (length !== array2.length) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
for (let i = 0; i < length; i += 1) {
|
|
27
|
+
if (!itemComparer(array1[i], array2[i])) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
function getDefaultLabelId(id) {
|
|
34
|
+
return id == null ? void 0 : `${id}-label`;
|
|
35
|
+
}
|
|
36
|
+
function resolveAriaLabelledBy(fieldLabelId, localLabelId) {
|
|
37
|
+
return fieldLabelId ?? localLabelId;
|
|
38
|
+
}
|
|
39
|
+
function asc(a, b) {
|
|
40
|
+
return a - b;
|
|
41
|
+
}
|
|
42
|
+
function getSliderValue(valueInput, index2, min, max, range, values) {
|
|
43
|
+
const clamped = clamp(valueInput, min, max);
|
|
44
|
+
if (!range) {
|
|
45
|
+
return clamped;
|
|
46
|
+
}
|
|
47
|
+
const output = values.slice();
|
|
48
|
+
output[index2] = clamp(clamped, values[index2 - 1] ?? -Infinity, values[index2 + 1] ?? Infinity);
|
|
49
|
+
return output.sort(asc);
|
|
50
|
+
}
|
|
51
|
+
function validateMinimumDistance(values, step, minStepsBetweenValues) {
|
|
52
|
+
if (!Array.isArray(values)) {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
const minDistance = step * minStepsBetweenValues;
|
|
56
|
+
for (let i = 0; i < values.length - 1; i += 1) {
|
|
57
|
+
if (!(Math.abs(values[i] - values[i + 1]) >= minDistance)) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
const nullMapping = () => null;
|
|
64
|
+
const sliderStateAttributesMapping = {
|
|
65
|
+
activeThumbIndex: nullMapping,
|
|
66
|
+
max: nullMapping,
|
|
67
|
+
min: nullMapping,
|
|
68
|
+
minStepsBetweenValues: nullMapping,
|
|
69
|
+
step: nullMapping,
|
|
70
|
+
values: nullMapping,
|
|
71
|
+
...fieldValidityMapping
|
|
72
|
+
};
|
|
73
|
+
const SliderRootContext = /* @__PURE__ */ React.createContext(void 0);
|
|
74
|
+
if (process.env.NODE_ENV !== "production") SliderRootContext.displayName = "SliderRootContext";
|
|
75
|
+
function useSliderRootContext() {
|
|
76
|
+
const context = React.useContext(SliderRootContext);
|
|
77
|
+
if (context === void 0) {
|
|
78
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: SliderRootContext is missing. Slider parts must be placed within <Slider.Root>." : formatErrorMessage(62));
|
|
79
|
+
}
|
|
80
|
+
return context;
|
|
81
|
+
}
|
|
82
|
+
function areValuesEqual(newValue, oldValue) {
|
|
83
|
+
return newValue === oldValue || Array.isArray(newValue) && Array.isArray(oldValue) && areArraysEqual(newValue, oldValue);
|
|
84
|
+
}
|
|
85
|
+
const SliderRoot = /* @__PURE__ */ React.forwardRef(function SliderRoot2(componentProps, forwardedRef) {
|
|
86
|
+
const {
|
|
87
|
+
"aria-labelledby": ariaLabelledByProp,
|
|
88
|
+
className,
|
|
89
|
+
defaultValue,
|
|
90
|
+
disabled: disabledProp = false,
|
|
91
|
+
id: idProp,
|
|
92
|
+
format,
|
|
93
|
+
largeStep = 10,
|
|
94
|
+
locale,
|
|
95
|
+
render,
|
|
96
|
+
max = 100,
|
|
97
|
+
min = 0,
|
|
98
|
+
minStepsBetweenValues = 0,
|
|
99
|
+
form,
|
|
100
|
+
name: nameProp,
|
|
101
|
+
onValueChange: onValueChangeProp,
|
|
102
|
+
onValueCommitted: onValueCommittedProp,
|
|
103
|
+
orientation = "horizontal",
|
|
104
|
+
step = 1,
|
|
105
|
+
thumbCollisionBehavior = "push",
|
|
106
|
+
thumbAlignment = "center",
|
|
107
|
+
value: valueProp,
|
|
108
|
+
style,
|
|
109
|
+
...elementProps
|
|
110
|
+
} = componentProps;
|
|
111
|
+
const id = useBaseUiId(idProp);
|
|
112
|
+
const defaultLabelId = getDefaultLabelId(id);
|
|
113
|
+
const onValueChange = useStableCallback(onValueChangeProp);
|
|
114
|
+
const onValueCommitted = useStableCallback(onValueCommittedProp);
|
|
115
|
+
const {
|
|
116
|
+
clearErrors
|
|
117
|
+
} = useFormContext();
|
|
118
|
+
const {
|
|
119
|
+
state: fieldState,
|
|
120
|
+
disabled: fieldDisabled,
|
|
121
|
+
name: fieldName,
|
|
122
|
+
setTouched,
|
|
123
|
+
setDirty,
|
|
124
|
+
validityData,
|
|
125
|
+
validation
|
|
126
|
+
} = useFieldRootContext();
|
|
127
|
+
const {
|
|
128
|
+
labelId: fieldLabelId
|
|
129
|
+
} = useLabelableContext();
|
|
130
|
+
const [labelId, setLabelId] = React.useState();
|
|
131
|
+
const ariaLabelledby = ariaLabelledByProp ?? resolveAriaLabelledBy(fieldLabelId, labelId);
|
|
132
|
+
const disabled = fieldDisabled || disabledProp;
|
|
133
|
+
const name = fieldName ?? nameProp;
|
|
134
|
+
const [valueUnwrapped, setValueUnwrapped] = useControlled({
|
|
135
|
+
controlled: valueProp,
|
|
136
|
+
default: defaultValue ?? min,
|
|
137
|
+
name: "Slider"
|
|
138
|
+
});
|
|
139
|
+
const sliderRef = React.useRef(null);
|
|
140
|
+
const controlRef = React.useRef(null);
|
|
141
|
+
const thumbRefs = React.useRef([]);
|
|
142
|
+
const pressedThumbCenterOffsetRef = React.useRef(null);
|
|
143
|
+
const pressedThumbIndexRef = React.useRef(-1);
|
|
144
|
+
const pressedValuesRef = React.useRef(null);
|
|
145
|
+
const lastChangeReasonRef = React.useRef(none);
|
|
146
|
+
const [active, setActiveState] = React.useState(-1);
|
|
147
|
+
const [lastUsedThumbIndex, setLastUsedThumbIndex] = React.useState(-1);
|
|
148
|
+
const [dragging, setDragging] = React.useState(false);
|
|
149
|
+
const [thumbMap, setThumbMap] = React.useState(() => /* @__PURE__ */ new Map());
|
|
150
|
+
const [indicatorPosition, setIndicatorPosition] = React.useState([void 0, void 0]);
|
|
151
|
+
const setActive = useStableCallback((value) => {
|
|
152
|
+
setActiveState(value);
|
|
153
|
+
if (value !== -1) {
|
|
154
|
+
setLastUsedThumbIndex(value);
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
const registerFieldControlRef = useStableCallback((element2) => {
|
|
158
|
+
if (element2) {
|
|
159
|
+
controlRef.current = element2;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
const range = Array.isArray(valueUnwrapped);
|
|
163
|
+
const values = React.useMemo(() => {
|
|
164
|
+
if (!range) {
|
|
165
|
+
return [clamp(valueUnwrapped, min, max)];
|
|
166
|
+
}
|
|
167
|
+
return valueUnwrapped.map((value) => clamp(value, min, max)).sort(asc);
|
|
168
|
+
}, [max, min, range, valueUnwrapped]);
|
|
169
|
+
const fieldValue = range ? values : values[0];
|
|
170
|
+
useRegisterFieldControl(validation.inputRef, id, fieldValue, void 0, !disabled, nameProp);
|
|
171
|
+
useValueChanged(fieldValue, () => {
|
|
172
|
+
clearErrors(name);
|
|
173
|
+
validation.change(fieldValue);
|
|
174
|
+
const initialValue = validityData.initialValue;
|
|
175
|
+
let isDirty;
|
|
176
|
+
if (Array.isArray(fieldValue) && Array.isArray(initialValue)) {
|
|
177
|
+
isDirty = !areArraysEqual(fieldValue, initialValue);
|
|
178
|
+
} else {
|
|
179
|
+
isDirty = fieldValue !== initialValue;
|
|
180
|
+
}
|
|
181
|
+
setDirty(isDirty);
|
|
182
|
+
});
|
|
183
|
+
const setValue = useStableCallback((newValue, details) => {
|
|
184
|
+
if (Number.isNaN(newValue) || areValuesEqual(newValue, valueUnwrapped)) {
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
const nativeEvent = details.event;
|
|
188
|
+
const EventConstructor = nativeEvent.constructor;
|
|
189
|
+
const clonedEvent = new EventConstructor(nativeEvent.type, nativeEvent);
|
|
190
|
+
Object.defineProperty(clonedEvent, "target", {
|
|
191
|
+
writable: true,
|
|
192
|
+
value: {
|
|
193
|
+
value: newValue,
|
|
194
|
+
name
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
details.event = clonedEvent;
|
|
198
|
+
onValueChange(newValue, details);
|
|
199
|
+
if (details.isCanceled) {
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
lastChangeReasonRef.current = details.reason;
|
|
203
|
+
setValueUnwrapped(newValue);
|
|
204
|
+
return true;
|
|
205
|
+
});
|
|
206
|
+
const handleInputChange = useStableCallback((valueInput, index2, event) => {
|
|
207
|
+
const newValue = getSliderValue(valueInput, index2, min, max, range, values);
|
|
208
|
+
if (validateMinimumDistance(newValue, step, minStepsBetweenValues)) {
|
|
209
|
+
const reason = "key" in event ? keyboard : inputChange;
|
|
210
|
+
const applied = setValue(newValue, createChangeEventDetails(reason, event.nativeEvent, void 0, {
|
|
211
|
+
activeThumbIndex: index2
|
|
212
|
+
}));
|
|
213
|
+
setTouched(true);
|
|
214
|
+
if (applied) {
|
|
215
|
+
onValueCommitted(newValue, createGenericEventDetails(reason, event.nativeEvent));
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
if (process.env.NODE_ENV !== "production") {
|
|
220
|
+
if (min >= max) {
|
|
221
|
+
warn("Slider `max` must be greater than `min`.");
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
useIsoLayoutEffect(() => {
|
|
225
|
+
if (!disabled) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
const activeEl = activeElement(ownerDocument(sliderRef.current));
|
|
229
|
+
if (contains(sliderRef.current, activeEl)) {
|
|
230
|
+
activeEl.blur();
|
|
231
|
+
}
|
|
232
|
+
if (active !== -1) {
|
|
233
|
+
setActive(-1);
|
|
234
|
+
}
|
|
235
|
+
}, [active, disabled, setActive]);
|
|
236
|
+
const state = React.useMemo(() => ({
|
|
237
|
+
...fieldState,
|
|
238
|
+
activeThumbIndex: active,
|
|
239
|
+
disabled,
|
|
240
|
+
dragging,
|
|
241
|
+
orientation,
|
|
242
|
+
max,
|
|
243
|
+
min,
|
|
244
|
+
minStepsBetweenValues,
|
|
245
|
+
step,
|
|
246
|
+
values
|
|
247
|
+
}), [fieldState, active, disabled, dragging, max, min, minStepsBetweenValues, orientation, step, values]);
|
|
248
|
+
const contextValue = React.useMemo(() => ({
|
|
249
|
+
active,
|
|
250
|
+
controlRef,
|
|
251
|
+
disabled,
|
|
252
|
+
dragging,
|
|
253
|
+
validation,
|
|
254
|
+
format,
|
|
255
|
+
handleInputChange,
|
|
256
|
+
indicatorPosition,
|
|
257
|
+
inset: thumbAlignment !== "center",
|
|
258
|
+
isArrayValue: range,
|
|
259
|
+
labelId: ariaLabelledby,
|
|
260
|
+
rootLabelId: defaultLabelId,
|
|
261
|
+
largeStep,
|
|
262
|
+
lastUsedThumbIndex,
|
|
263
|
+
lastChangeReasonRef,
|
|
264
|
+
form,
|
|
265
|
+
locale,
|
|
266
|
+
max,
|
|
267
|
+
min,
|
|
268
|
+
minStepsBetweenValues,
|
|
269
|
+
name,
|
|
270
|
+
onValueCommitted,
|
|
271
|
+
orientation,
|
|
272
|
+
pressedThumbCenterOffsetRef,
|
|
273
|
+
pressedThumbIndexRef,
|
|
274
|
+
pressedValuesRef,
|
|
275
|
+
registerFieldControlRef,
|
|
276
|
+
renderBeforeHydration: thumbAlignment === "edge",
|
|
277
|
+
setActive,
|
|
278
|
+
setDragging,
|
|
279
|
+
setIndicatorPosition,
|
|
280
|
+
setLabelId,
|
|
281
|
+
setValue,
|
|
282
|
+
state,
|
|
283
|
+
step,
|
|
284
|
+
thumbCollisionBehavior,
|
|
285
|
+
thumbMap,
|
|
286
|
+
thumbRefs,
|
|
287
|
+
values
|
|
288
|
+
}), [active, ariaLabelledby, defaultLabelId, disabled, dragging, validation, format, handleInputChange, indicatorPosition, largeStep, lastUsedThumbIndex, form, locale, max, min, minStepsBetweenValues, name, onValueCommitted, orientation, range, registerFieldControlRef, setActive, setValue, state, step, thumbCollisionBehavior, thumbAlignment, thumbMap, values]);
|
|
289
|
+
const element = useRenderElement("div", componentProps, {
|
|
290
|
+
state,
|
|
291
|
+
ref: [forwardedRef, sliderRef],
|
|
292
|
+
props: [{
|
|
293
|
+
"aria-labelledby": ariaLabelledby,
|
|
294
|
+
id,
|
|
295
|
+
role: "group"
|
|
296
|
+
}, elementProps, (props) => validation.getValidationProps(disabled, props)],
|
|
297
|
+
stateAttributesMapping: sliderStateAttributesMapping
|
|
298
|
+
});
|
|
299
|
+
return /* @__PURE__ */ jsx(SliderRootContext.Provider, {
|
|
300
|
+
value: contextValue,
|
|
301
|
+
children: /* @__PURE__ */ jsx(CompositeList, {
|
|
302
|
+
elementsRef: thumbRefs,
|
|
303
|
+
onMapChange: setThumbMap,
|
|
304
|
+
children: element
|
|
305
|
+
})
|
|
306
|
+
});
|
|
307
|
+
});
|
|
308
|
+
if (process.env.NODE_ENV !== "production") SliderRoot.displayName = "SliderRoot";
|
|
309
|
+
function stringifyLocale(locale) {
|
|
310
|
+
if (Array.isArray(locale)) {
|
|
311
|
+
return locale.map((value) => stringifyLocale(value)).join(",");
|
|
312
|
+
}
|
|
313
|
+
if (locale == null) {
|
|
314
|
+
return "";
|
|
315
|
+
}
|
|
316
|
+
return String(locale);
|
|
317
|
+
}
|
|
318
|
+
const cache = /* @__PURE__ */ new Map();
|
|
319
|
+
function getFormatter(locale, options) {
|
|
320
|
+
const optionsString = JSON.stringify({
|
|
321
|
+
locale: stringifyLocale(locale),
|
|
322
|
+
options
|
|
323
|
+
});
|
|
324
|
+
const cachedFormatter = cache.get(optionsString);
|
|
325
|
+
if (cachedFormatter) {
|
|
326
|
+
return cachedFormatter;
|
|
327
|
+
}
|
|
328
|
+
const formatter = new Intl.NumberFormat(locale, options);
|
|
329
|
+
cache.set(optionsString, formatter);
|
|
330
|
+
return formatter;
|
|
331
|
+
}
|
|
332
|
+
function formatNumber(value, locale, options) {
|
|
333
|
+
if (value == null) {
|
|
334
|
+
return "";
|
|
335
|
+
}
|
|
336
|
+
return getFormatter(locale, options).format(value);
|
|
337
|
+
}
|
|
338
|
+
function isTouchLikePointerType(pointerType) {
|
|
339
|
+
return pointerType === "touch" || pointerType === "pen";
|
|
340
|
+
}
|
|
341
|
+
function getMidpoint(element, vertical) {
|
|
342
|
+
const rect = element.getBoundingClientRect();
|
|
343
|
+
return vertical ? (rect.top + rect.bottom) / 2 : (rect.left + rect.right) / 2;
|
|
344
|
+
}
|
|
345
|
+
function getDecimalPrecision(num) {
|
|
346
|
+
if (num === 0) {
|
|
347
|
+
return 0;
|
|
348
|
+
}
|
|
349
|
+
if (Math.abs(num) < 1) {
|
|
350
|
+
const parts = num.toExponential().split("e-");
|
|
351
|
+
const matissaDecimalPart = parts[0].split(".")[1];
|
|
352
|
+
return (matissaDecimalPart ? matissaDecimalPart.length : 0) + parseInt(parts[1], 10);
|
|
353
|
+
}
|
|
354
|
+
const decimalPart = num.toString().split(".")[1];
|
|
355
|
+
return decimalPart ? decimalPart.length : 0;
|
|
356
|
+
}
|
|
357
|
+
function roundValueToStep(value, step, min) {
|
|
358
|
+
const nearest = Math.round((value - min) / step) * step + min;
|
|
359
|
+
return Number(nearest.toFixed(Math.max(getDecimalPrecision(step), getDecimalPrecision(min))));
|
|
360
|
+
}
|
|
361
|
+
function getPushedThumbValues(values, index2, nextValue, min, max, step, minStepsBetweenValues, initialValues) {
|
|
362
|
+
const nextValues = values.slice();
|
|
363
|
+
const minValueDifference = step * minStepsBetweenValues;
|
|
364
|
+
const lastIndex = nextValues.length - 1;
|
|
365
|
+
const baseInitialValues = initialValues ?? values;
|
|
366
|
+
const indexMin = min + index2 * minValueDifference;
|
|
367
|
+
const indexMax = max - (lastIndex - index2) * minValueDifference;
|
|
368
|
+
nextValues[index2] = clamp(nextValue, indexMin, indexMax);
|
|
369
|
+
for (let i = index2 + 1; i <= lastIndex; i += 1) {
|
|
370
|
+
const minAllowed = nextValues[i - 1] + minValueDifference;
|
|
371
|
+
const maxAllowed = max - (lastIndex - i) * minValueDifference;
|
|
372
|
+
const initialValue = baseInitialValues[i];
|
|
373
|
+
let candidate = Math.max(nextValues[i], minAllowed);
|
|
374
|
+
if (initialValue < candidate) {
|
|
375
|
+
candidate = Math.max(initialValue, minAllowed);
|
|
376
|
+
}
|
|
377
|
+
nextValues[i] = clamp(candidate, minAllowed, maxAllowed);
|
|
378
|
+
}
|
|
379
|
+
for (let i = index2 - 1; i >= 0; i -= 1) {
|
|
380
|
+
const maxAllowed = nextValues[i + 1] - minValueDifference;
|
|
381
|
+
const minAllowed = min + i * minValueDifference;
|
|
382
|
+
const initialValue = baseInitialValues[i];
|
|
383
|
+
let candidate = Math.min(nextValues[i], maxAllowed);
|
|
384
|
+
if (initialValue > candidate) {
|
|
385
|
+
candidate = Math.min(initialValue, maxAllowed);
|
|
386
|
+
}
|
|
387
|
+
nextValues[i] = clamp(candidate, minAllowed, maxAllowed);
|
|
388
|
+
}
|
|
389
|
+
for (let i = 0; i <= lastIndex; i += 1) {
|
|
390
|
+
nextValues[i] = Number(nextValues[i].toFixed(12));
|
|
391
|
+
}
|
|
392
|
+
return nextValues;
|
|
393
|
+
}
|
|
394
|
+
function resolveThumbCollision(behavior, values, currentValues, initialValues, pressedIndex, nextValue, min, max, step, minStepsBetweenValues) {
|
|
395
|
+
const activeValues = currentValues ?? values;
|
|
396
|
+
const baselineValues = initialValues ?? values;
|
|
397
|
+
const range = activeValues.length > 1;
|
|
398
|
+
if (!range) {
|
|
399
|
+
return {
|
|
400
|
+
value: nextValue,
|
|
401
|
+
thumbIndex: 0,
|
|
402
|
+
didSwap: false
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
const minValueDifference = step * minStepsBetweenValues;
|
|
406
|
+
if (behavior === "push") {
|
|
407
|
+
return {
|
|
408
|
+
value: getPushedThumbValues(activeValues, pressedIndex, nextValue, min, max, step, minStepsBetweenValues),
|
|
409
|
+
thumbIndex: pressedIndex,
|
|
410
|
+
didSwap: false
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
const candidateValues = activeValues.slice();
|
|
414
|
+
const previousNeighbor = candidateValues[pressedIndex - 1];
|
|
415
|
+
const nextNeighbor = candidateValues[pressedIndex + 1];
|
|
416
|
+
const lowerBound = previousNeighbor != null ? previousNeighbor + minValueDifference : min;
|
|
417
|
+
const upperBound = nextNeighbor != null ? nextNeighbor - minValueDifference : max;
|
|
418
|
+
const pressedValueAfterClamp = Number(clamp(nextValue, lowerBound, upperBound).toFixed(12));
|
|
419
|
+
candidateValues[pressedIndex] = pressedValueAfterClamp;
|
|
420
|
+
switch (behavior) {
|
|
421
|
+
case "swap": {
|
|
422
|
+
const pressedInitialValue = activeValues[pressedIndex];
|
|
423
|
+
const epsilon = 1e-7;
|
|
424
|
+
const movingForward = nextValue > pressedInitialValue;
|
|
425
|
+
const movingBackward = nextValue < pressedInitialValue;
|
|
426
|
+
const shouldSwapForward = movingForward && nextNeighbor != null && nextValue >= nextNeighbor - epsilon;
|
|
427
|
+
const shouldSwapBackward = movingBackward && previousNeighbor != null && nextValue <= previousNeighbor + epsilon;
|
|
428
|
+
if (!shouldSwapForward && !shouldSwapBackward) {
|
|
429
|
+
return {
|
|
430
|
+
value: candidateValues,
|
|
431
|
+
thumbIndex: pressedIndex,
|
|
432
|
+
didSwap: false
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
const targetIndex = shouldSwapForward ? pressedIndex + 1 : pressedIndex - 1;
|
|
436
|
+
const initialValuesForPush = candidateValues.map((_, index2) => {
|
|
437
|
+
if (index2 === pressedIndex) {
|
|
438
|
+
return pressedValueAfterClamp;
|
|
439
|
+
}
|
|
440
|
+
const baseline = baselineValues[index2];
|
|
441
|
+
if (baseline != null) {
|
|
442
|
+
return baseline;
|
|
443
|
+
}
|
|
444
|
+
return activeValues[index2];
|
|
445
|
+
});
|
|
446
|
+
let nextValueForTarget = nextValue;
|
|
447
|
+
if (shouldSwapForward) {
|
|
448
|
+
nextValueForTarget = Math.max(nextValue, candidateValues[targetIndex]);
|
|
449
|
+
} else {
|
|
450
|
+
nextValueForTarget = Math.min(nextValue, candidateValues[targetIndex]);
|
|
451
|
+
}
|
|
452
|
+
const adjustedValues = getPushedThumbValues(candidateValues, targetIndex, nextValueForTarget, min, max, step, minStepsBetweenValues, initialValuesForPush);
|
|
453
|
+
const neighborIndex = shouldSwapForward ? targetIndex - 1 : targetIndex + 1;
|
|
454
|
+
const previousValue = adjustedValues[neighborIndex - 1];
|
|
455
|
+
const nextValueAfter = adjustedValues[neighborIndex + 1];
|
|
456
|
+
let neighborLowerBound = previousValue != null ? previousValue + minValueDifference : min;
|
|
457
|
+
neighborLowerBound = Math.max(neighborLowerBound, min + neighborIndex * minValueDifference);
|
|
458
|
+
let neighborUpperBound = nextValueAfter != null ? nextValueAfter - minValueDifference : max;
|
|
459
|
+
neighborUpperBound = Math.min(neighborUpperBound, max - (adjustedValues.length - 1 - neighborIndex) * minValueDifference);
|
|
460
|
+
const restoredValue = clamp(pressedValueAfterClamp, neighborLowerBound, neighborUpperBound);
|
|
461
|
+
adjustedValues[neighborIndex] = Number(restoredValue.toFixed(12));
|
|
462
|
+
return {
|
|
463
|
+
value: adjustedValues,
|
|
464
|
+
thumbIndex: targetIndex,
|
|
465
|
+
didSwap: true
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
case "none":
|
|
469
|
+
default: {
|
|
470
|
+
return {
|
|
471
|
+
value: candidateValues,
|
|
472
|
+
thumbIndex: pressedIndex,
|
|
473
|
+
didSwap: false
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
const INTENTIONAL_DRAG_COUNT_THRESHOLD = 2;
|
|
479
|
+
function getControlOffset(styles, vertical) {
|
|
480
|
+
if (!styles) {
|
|
481
|
+
return {
|
|
482
|
+
start: 0,
|
|
483
|
+
end: 0
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
function parseSize(value) {
|
|
487
|
+
const parsed = value != null ? parseFloat(value) : 0;
|
|
488
|
+
return Number.isNaN(parsed) ? 0 : parsed;
|
|
489
|
+
}
|
|
490
|
+
const start = !vertical ? "InlineStart" : "Top";
|
|
491
|
+
const end = !vertical ? "InlineEnd" : "Bottom";
|
|
492
|
+
return {
|
|
493
|
+
start: parseSize(styles[`border${start}Width`]) + parseSize(styles[`padding${start}`]),
|
|
494
|
+
end: parseSize(styles[`border${end}Width`]) + parseSize(styles[`padding${end}`])
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
function getFingerCoords(event, touchIdRef) {
|
|
498
|
+
if (touchIdRef.current != null && event.changedTouches) {
|
|
499
|
+
const touchEvent = event;
|
|
500
|
+
for (let i = 0; i < touchEvent.changedTouches.length; i += 1) {
|
|
501
|
+
const touch = touchEvent.changedTouches[i];
|
|
502
|
+
if (touch.identifier === touchIdRef.current) {
|
|
503
|
+
return {
|
|
504
|
+
x: touch.clientX,
|
|
505
|
+
y: touch.clientY
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
return null;
|
|
510
|
+
}
|
|
511
|
+
return {
|
|
512
|
+
x: event.clientX,
|
|
513
|
+
y: event.clientY
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
const SliderControl = /* @__PURE__ */ React.forwardRef(function SliderControl2(componentProps, forwardedRef) {
|
|
517
|
+
const {
|
|
518
|
+
render: renderProp,
|
|
519
|
+
className,
|
|
520
|
+
style,
|
|
521
|
+
...elementProps
|
|
522
|
+
} = componentProps;
|
|
523
|
+
const {
|
|
524
|
+
disabled,
|
|
525
|
+
dragging,
|
|
526
|
+
inset,
|
|
527
|
+
isArrayValue,
|
|
528
|
+
lastChangeReasonRef,
|
|
529
|
+
max,
|
|
530
|
+
min,
|
|
531
|
+
minStepsBetweenValues,
|
|
532
|
+
onValueCommitted,
|
|
533
|
+
orientation,
|
|
534
|
+
pressedThumbCenterOffsetRef,
|
|
535
|
+
pressedThumbIndexRef,
|
|
536
|
+
pressedValuesRef,
|
|
537
|
+
registerFieldControlRef,
|
|
538
|
+
renderBeforeHydration,
|
|
539
|
+
setActive,
|
|
540
|
+
setDragging,
|
|
541
|
+
setValue,
|
|
542
|
+
state,
|
|
543
|
+
step,
|
|
544
|
+
thumbCollisionBehavior,
|
|
545
|
+
thumbRefs,
|
|
546
|
+
values
|
|
547
|
+
} = useSliderRootContext();
|
|
548
|
+
const direction = useDirection();
|
|
549
|
+
const range = values.length > 1;
|
|
550
|
+
const vertical = orientation === "vertical";
|
|
551
|
+
const controlRef = React.useRef(null);
|
|
552
|
+
const stylesRef = React.useRef(null);
|
|
553
|
+
const setStylesRef = useStableCallback((element2) => {
|
|
554
|
+
if (element2 && stylesRef.current == null) {
|
|
555
|
+
stylesRef.current = getWindow(element2).getComputedStyle(element2);
|
|
556
|
+
}
|
|
557
|
+
});
|
|
558
|
+
const touchIdRef = React.useRef(null);
|
|
559
|
+
const moveCountRef = React.useRef(0);
|
|
560
|
+
const insetThumbOffsetRef = React.useRef(0);
|
|
561
|
+
const currentInteractionValueRef = React.useRef(null);
|
|
562
|
+
const pointerGestureRef = React.useRef(false);
|
|
563
|
+
const latestValuesRef = useValueAsRef(values);
|
|
564
|
+
function getThumbInput(el) {
|
|
565
|
+
return el == null ? void 0 : el.querySelector('input[type="range"]');
|
|
566
|
+
}
|
|
567
|
+
function updatePressedThumb(nextIndex) {
|
|
568
|
+
pressedThumbIndexRef.current = nextIndex;
|
|
569
|
+
if (!thumbRefs.current[nextIndex]) {
|
|
570
|
+
pressedThumbCenterOffsetRef.current = null;
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
function resetPressedThumb() {
|
|
574
|
+
pressedThumbIndexRef.current = -1;
|
|
575
|
+
pressedThumbCenterOffsetRef.current = null;
|
|
576
|
+
}
|
|
577
|
+
function isTargetDisabledThumb(target) {
|
|
578
|
+
if (!isElement(target)) {
|
|
579
|
+
return false;
|
|
580
|
+
}
|
|
581
|
+
return thumbRefs.current.some((thumbEl) => {
|
|
582
|
+
var _a;
|
|
583
|
+
if (!isElement(thumbEl) || !contains(thumbEl, target)) {
|
|
584
|
+
return false;
|
|
585
|
+
}
|
|
586
|
+
return ((_a = getThumbInput(thumbEl)) == null ? void 0 : _a.disabled) === true;
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
function getFingerState(fingerCoords) {
|
|
590
|
+
const control = controlRef.current;
|
|
591
|
+
const thumbIndex = pressedThumbIndexRef.current;
|
|
592
|
+
if (!control || thumbIndex < 0 || thumbIndex >= values.length) {
|
|
593
|
+
if (thumbIndex >= values.length) {
|
|
594
|
+
currentInteractionValueRef.current = null;
|
|
595
|
+
}
|
|
596
|
+
return null;
|
|
597
|
+
}
|
|
598
|
+
const {
|
|
599
|
+
width,
|
|
600
|
+
height,
|
|
601
|
+
bottom,
|
|
602
|
+
left,
|
|
603
|
+
right
|
|
604
|
+
} = control.getBoundingClientRect();
|
|
605
|
+
const controlOffset = getControlOffset(stylesRef.current, vertical);
|
|
606
|
+
const insetThumbOffset = insetThumbOffsetRef.current;
|
|
607
|
+
const controlSize = (vertical ? height : width) - controlOffset.start - controlOffset.end - insetThumbOffset * 2;
|
|
608
|
+
const thumbCenterOffset = pressedThumbCenterOffsetRef.current ?? 0;
|
|
609
|
+
const fingerX = fingerCoords.x - thumbCenterOffset;
|
|
610
|
+
const fingerY = fingerCoords.y - thumbCenterOffset;
|
|
611
|
+
const valueSize = vertical ? bottom - fingerY - controlOffset.end : (direction === "rtl" ? right - fingerX : fingerX - left) - controlOffset.start;
|
|
612
|
+
const valueRescaled = clamp((valueSize - insetThumbOffset) / controlSize, 0, 1);
|
|
613
|
+
let newValue = (max - min) * valueRescaled + min;
|
|
614
|
+
newValue = roundValueToStep(newValue, step, min);
|
|
615
|
+
newValue = clamp(newValue, min, max);
|
|
616
|
+
if (!range) {
|
|
617
|
+
return {
|
|
618
|
+
value: isArrayValue ? [newValue] : newValue,
|
|
619
|
+
thumbIndex,
|
|
620
|
+
didSwap: false
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
return resolveThumbCollision(thumbCollisionBehavior, values, latestValuesRef.current, pressedValuesRef.current, thumbIndex, newValue, min, max, step, minStepsBetweenValues);
|
|
624
|
+
}
|
|
625
|
+
function startPressing(fingerCoords) {
|
|
626
|
+
var _a;
|
|
627
|
+
pressedValuesRef.current = range ? values.slice() : null;
|
|
628
|
+
currentInteractionValueRef.current = null;
|
|
629
|
+
latestValuesRef.current = values;
|
|
630
|
+
const pressedThumbIndex = pressedThumbIndexRef.current;
|
|
631
|
+
let closestThumbIndex = pressedThumbIndex;
|
|
632
|
+
if (pressedThumbIndex > -1 && pressedThumbIndex < values.length) {
|
|
633
|
+
if (values[pressedThumbIndex] === max) {
|
|
634
|
+
let candidateIndex = pressedThumbIndex;
|
|
635
|
+
while (candidateIndex > 0 && values[candidateIndex - 1] === max) {
|
|
636
|
+
candidateIndex -= 1;
|
|
637
|
+
}
|
|
638
|
+
closestThumbIndex = candidateIndex;
|
|
639
|
+
}
|
|
640
|
+
} else {
|
|
641
|
+
const axis = !vertical ? "x" : "y";
|
|
642
|
+
let minDistance;
|
|
643
|
+
closestThumbIndex = -1;
|
|
644
|
+
for (let i = 0; i < thumbRefs.current.length; i += 1) {
|
|
645
|
+
const thumbEl = thumbRefs.current[i];
|
|
646
|
+
if (isElement(thumbEl) && !((_a = getThumbInput(thumbEl)) == null ? void 0 : _a.disabled)) {
|
|
647
|
+
const midpoint = getMidpoint(thumbEl, vertical);
|
|
648
|
+
const distance = Math.abs(fingerCoords[axis] - midpoint);
|
|
649
|
+
if (minDistance === void 0 || distance <= minDistance) {
|
|
650
|
+
closestThumbIndex = i;
|
|
651
|
+
minDistance = distance;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
if (closestThumbIndex > -1 && closestThumbIndex !== pressedThumbIndex) {
|
|
657
|
+
updatePressedThumb(closestThumbIndex);
|
|
658
|
+
}
|
|
659
|
+
if (inset) {
|
|
660
|
+
const thumbEl = thumbRefs.current[closestThumbIndex];
|
|
661
|
+
if (isElement(thumbEl)) {
|
|
662
|
+
const thumbRect = thumbEl.getBoundingClientRect();
|
|
663
|
+
const side = !vertical ? "width" : "height";
|
|
664
|
+
insetThumbOffsetRef.current = thumbRect[side] / 2;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
function focusThumb(thumbIndex) {
|
|
669
|
+
var _a;
|
|
670
|
+
const input = getThumbInput((_a = thumbRefs.current) == null ? void 0 : _a[thumbIndex]);
|
|
671
|
+
if (!input) {
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
input.focus({
|
|
675
|
+
preventScroll: true,
|
|
676
|
+
// Prevent pointer-driven focus rings in browsers that support this option.
|
|
677
|
+
// Supported in Chrome from 144+.
|
|
678
|
+
focusVisible: false
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
function setValueFromPointer(finger, reason, nativeEvent) {
|
|
682
|
+
const applied = setValue(finger.value, createChangeEventDetails(reason, nativeEvent, void 0, {
|
|
683
|
+
activeThumbIndex: finger.thumbIndex
|
|
684
|
+
}));
|
|
685
|
+
if (applied) {
|
|
686
|
+
currentInteractionValueRef.current = finger.value;
|
|
687
|
+
latestValuesRef.current = Array.isArray(finger.value) ? finger.value : [finger.value];
|
|
688
|
+
if (finger.didSwap) {
|
|
689
|
+
updatePressedThumb(finger.thumbIndex);
|
|
690
|
+
focusThumb(finger.thumbIndex);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
return applied;
|
|
694
|
+
}
|
|
695
|
+
const handleTouchMove = useStableCallback((nativeEvent) => {
|
|
696
|
+
const fingerCoords = getFingerCoords(nativeEvent, touchIdRef);
|
|
697
|
+
if (fingerCoords == null) {
|
|
698
|
+
return;
|
|
699
|
+
}
|
|
700
|
+
moveCountRef.current += 1;
|
|
701
|
+
if (nativeEvent.type === "pointermove" && nativeEvent.buttons === 0) {
|
|
702
|
+
handleTouchEnd(nativeEvent);
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
const finger = getFingerState(fingerCoords);
|
|
706
|
+
if (finger == null) {
|
|
707
|
+
return;
|
|
708
|
+
}
|
|
709
|
+
if (validateMinimumDistance(finger.value, step, minStepsBetweenValues)) {
|
|
710
|
+
if (!dragging && moveCountRef.current > INTENTIONAL_DRAG_COUNT_THRESHOLD) {
|
|
711
|
+
setDragging(true);
|
|
712
|
+
}
|
|
713
|
+
setValueFromPointer(finger, drag, nativeEvent);
|
|
714
|
+
}
|
|
715
|
+
});
|
|
716
|
+
const handleTouchEnd = useStableCallback((nativeEvent) => {
|
|
717
|
+
var _a, _b;
|
|
718
|
+
if (getFingerCoords(nativeEvent, touchIdRef) == null) {
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
setActive(-1);
|
|
722
|
+
setDragging(false);
|
|
723
|
+
pressedThumbCenterOffsetRef.current = null;
|
|
724
|
+
const interactionValue = currentInteractionValueRef.current;
|
|
725
|
+
if (Array.isArray(interactionValue) && interactionValue.length !== values.length) {
|
|
726
|
+
currentInteractionValueRef.current = null;
|
|
727
|
+
}
|
|
728
|
+
if (currentInteractionValueRef.current != null) {
|
|
729
|
+
const commitReason = lastChangeReasonRef.current;
|
|
730
|
+
onValueCommitted(currentInteractionValueRef.current, createGenericEventDetails(commitReason, nativeEvent));
|
|
731
|
+
}
|
|
732
|
+
if ("pointerType" in nativeEvent && ((_a = controlRef.current) == null ? void 0 : _a.hasPointerCapture(nativeEvent.pointerId))) {
|
|
733
|
+
(_b = controlRef.current) == null ? void 0 : _b.releasePointerCapture(nativeEvent.pointerId);
|
|
734
|
+
}
|
|
735
|
+
pressedThumbIndexRef.current = -1;
|
|
736
|
+
stopListening();
|
|
737
|
+
});
|
|
738
|
+
const handlePointerCancel = useStableCallback((nativeEvent) => {
|
|
739
|
+
if (touchIdRef.current != null) {
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
742
|
+
handleTouchEnd(nativeEvent);
|
|
743
|
+
});
|
|
744
|
+
const handleTouchStart = useStableCallback((nativeEvent) => {
|
|
745
|
+
const startedByPointer = pointerGestureRef.current;
|
|
746
|
+
pointerGestureRef.current = false;
|
|
747
|
+
if (disabled) {
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
750
|
+
if (isTargetDisabledThumb(getTarget(nativeEvent))) {
|
|
751
|
+
resetPressedThumb();
|
|
752
|
+
return;
|
|
753
|
+
}
|
|
754
|
+
const touch = nativeEvent.changedTouches[0];
|
|
755
|
+
if (touch == null) {
|
|
756
|
+
return;
|
|
757
|
+
}
|
|
758
|
+
touchIdRef.current = touch.identifier;
|
|
759
|
+
if (!startedByPointer) {
|
|
760
|
+
const fingerCoords = {
|
|
761
|
+
x: touch.clientX,
|
|
762
|
+
y: touch.clientY
|
|
763
|
+
};
|
|
764
|
+
startPressing(fingerCoords);
|
|
765
|
+
const finger = getFingerState(fingerCoords);
|
|
766
|
+
if (finger == null) {
|
|
767
|
+
return;
|
|
768
|
+
}
|
|
769
|
+
focusThumb(finger.thumbIndex);
|
|
770
|
+
setValueFromPointer(finger, trackPress, nativeEvent);
|
|
771
|
+
moveCountRef.current = 0;
|
|
772
|
+
}
|
|
773
|
+
const doc = ownerDocument(controlRef.current);
|
|
774
|
+
doc.addEventListener("touchmove", handleTouchMove, {
|
|
775
|
+
passive: true
|
|
776
|
+
});
|
|
777
|
+
doc.addEventListener("touchend", handleTouchEnd, {
|
|
778
|
+
passive: true
|
|
779
|
+
});
|
|
780
|
+
doc.addEventListener("touchcancel", handleTouchEnd, {
|
|
781
|
+
passive: true
|
|
782
|
+
});
|
|
783
|
+
});
|
|
784
|
+
const stopListening = useStableCallback(() => {
|
|
785
|
+
const doc = ownerDocument(controlRef.current);
|
|
786
|
+
doc.removeEventListener("pointermove", handleTouchMove);
|
|
787
|
+
doc.removeEventListener("pointerup", handleTouchEnd);
|
|
788
|
+
doc.removeEventListener("pointercancel", handlePointerCancel);
|
|
789
|
+
doc.removeEventListener("touchmove", handleTouchMove);
|
|
790
|
+
doc.removeEventListener("touchend", handleTouchEnd);
|
|
791
|
+
doc.removeEventListener("touchcancel", handleTouchEnd);
|
|
792
|
+
touchIdRef.current = null;
|
|
793
|
+
pressedValuesRef.current = null;
|
|
794
|
+
currentInteractionValueRef.current = null;
|
|
795
|
+
pointerGestureRef.current = false;
|
|
796
|
+
});
|
|
797
|
+
const focusFrame = useAnimationFrame();
|
|
798
|
+
React.useEffect(() => {
|
|
799
|
+
const control = controlRef.current;
|
|
800
|
+
if (!control) {
|
|
801
|
+
return () => stopListening();
|
|
802
|
+
}
|
|
803
|
+
const unsubscribeTouchStart = addEventListener(control, "touchstart", handleTouchStart, {
|
|
804
|
+
passive: true
|
|
805
|
+
});
|
|
806
|
+
return () => {
|
|
807
|
+
unsubscribeTouchStart();
|
|
808
|
+
focusFrame.cancel();
|
|
809
|
+
stopListening();
|
|
810
|
+
};
|
|
811
|
+
}, [stopListening, handleTouchStart, controlRef, focusFrame]);
|
|
812
|
+
React.useEffect(() => {
|
|
813
|
+
if (disabled) {
|
|
814
|
+
stopListening();
|
|
815
|
+
}
|
|
816
|
+
}, [disabled, stopListening]);
|
|
817
|
+
const element = useRenderElement("div", componentProps, {
|
|
818
|
+
state,
|
|
819
|
+
ref: [forwardedRef, registerFieldControlRef, controlRef, setStylesRef],
|
|
820
|
+
props: [{
|
|
821
|
+
["data-base-ui-slider-control"]: renderBeforeHydration ? "" : void 0,
|
|
822
|
+
onPointerDown(event) {
|
|
823
|
+
pointerGestureRef.current = false;
|
|
824
|
+
const control = controlRef.current;
|
|
825
|
+
const target = getTarget(event.nativeEvent);
|
|
826
|
+
if (!control || disabled || event.defaultPrevented || !isElement(target) || // Only handle left clicks
|
|
827
|
+
event.button !== 0) {
|
|
828
|
+
return;
|
|
829
|
+
}
|
|
830
|
+
if (isTargetDisabledThumb(target)) {
|
|
831
|
+
resetPressedThumb();
|
|
832
|
+
return;
|
|
833
|
+
}
|
|
834
|
+
const fingerCoords = {
|
|
835
|
+
x: event.clientX,
|
|
836
|
+
y: event.clientY
|
|
837
|
+
};
|
|
838
|
+
startPressing(fingerCoords);
|
|
839
|
+
const finger = getFingerState(fingerCoords);
|
|
840
|
+
if (finger == null) {
|
|
841
|
+
return;
|
|
842
|
+
}
|
|
843
|
+
const pressedOnFocusedThumb = contains(thumbRefs.current[finger.thumbIndex], activeElement(ownerDocument(control)));
|
|
844
|
+
if (pressedOnFocusedThumb) {
|
|
845
|
+
event.preventDefault();
|
|
846
|
+
} else {
|
|
847
|
+
focusFrame.request(() => {
|
|
848
|
+
focusThumb(finger.thumbIndex);
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
setDragging(true);
|
|
852
|
+
const pressedOnAnyThumb = pressedThumbCenterOffsetRef.current != null;
|
|
853
|
+
if (!pressedOnAnyThumb) {
|
|
854
|
+
setValueFromPointer(finger, trackPress, event.nativeEvent);
|
|
855
|
+
}
|
|
856
|
+
if (event.nativeEvent.pointerId) {
|
|
857
|
+
control.setPointerCapture(event.nativeEvent.pointerId);
|
|
858
|
+
}
|
|
859
|
+
moveCountRef.current = 0;
|
|
860
|
+
pointerGestureRef.current = isTouchLikePointerType(event.pointerType);
|
|
861
|
+
const doc = ownerDocument(control);
|
|
862
|
+
doc.addEventListener("pointermove", handleTouchMove, {
|
|
863
|
+
passive: true
|
|
864
|
+
});
|
|
865
|
+
doc.addEventListener("pointerup", handleTouchEnd, {
|
|
866
|
+
once: true
|
|
867
|
+
});
|
|
868
|
+
doc.addEventListener("pointercancel", handlePointerCancel, {
|
|
869
|
+
once: true
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
}, elementProps],
|
|
873
|
+
stateAttributesMapping: sliderStateAttributesMapping
|
|
874
|
+
});
|
|
875
|
+
return element;
|
|
876
|
+
});
|
|
877
|
+
if (process.env.NODE_ENV !== "production") SliderControl.displayName = "SliderControl";
|
|
878
|
+
const SliderTrack = /* @__PURE__ */ React.forwardRef(function SliderTrack2(componentProps, forwardedRef) {
|
|
879
|
+
const {
|
|
880
|
+
render,
|
|
881
|
+
className,
|
|
882
|
+
style,
|
|
883
|
+
...elementProps
|
|
884
|
+
} = componentProps;
|
|
885
|
+
const {
|
|
886
|
+
state
|
|
887
|
+
} = useSliderRootContext();
|
|
888
|
+
const element = useRenderElement("div", componentProps, {
|
|
889
|
+
state,
|
|
890
|
+
ref: forwardedRef,
|
|
891
|
+
props: [{
|
|
892
|
+
style: {
|
|
893
|
+
position: "relative"
|
|
894
|
+
}
|
|
895
|
+
}, elementProps],
|
|
896
|
+
stateAttributesMapping: sliderStateAttributesMapping
|
|
897
|
+
});
|
|
898
|
+
return element;
|
|
899
|
+
});
|
|
900
|
+
if (process.env.NODE_ENV !== "production") SliderTrack.displayName = "SliderTrack";
|
|
901
|
+
const script = "";
|
|
902
|
+
const emptySubscribe = () => () => {
|
|
903
|
+
};
|
|
904
|
+
const getTrue = () => true;
|
|
905
|
+
const getFalse = () => false;
|
|
906
|
+
function useIsHydratedModern() {
|
|
907
|
+
return shimExports.useSyncExternalStore(emptySubscribe, getTrue, getFalse);
|
|
908
|
+
}
|
|
909
|
+
function useIsHydratedLegacy() {
|
|
910
|
+
const [hydrated, setHydrated] = React.useState(false);
|
|
911
|
+
React.useEffect(() => {
|
|
912
|
+
setHydrated(true);
|
|
913
|
+
}, []);
|
|
914
|
+
return hydrated;
|
|
915
|
+
}
|
|
916
|
+
const useIsHydrated = isReactVersionAtLeast(18) ? useIsHydratedModern : useIsHydratedLegacy;
|
|
917
|
+
function useIsHydrating() {
|
|
918
|
+
return !useIsHydrated();
|
|
919
|
+
}
|
|
920
|
+
function valueToPercent(value, min, max) {
|
|
921
|
+
return (value - min) * 100 / (max - min);
|
|
922
|
+
}
|
|
923
|
+
const CSPContext = /* @__PURE__ */ React.createContext(void 0);
|
|
924
|
+
if (process.env.NODE_ENV !== "production") CSPContext.displayName = "CSPContext";
|
|
925
|
+
const DEFAULT_CSP_CONTEXT_VALUE = {
|
|
926
|
+
disableStyleElements: false
|
|
927
|
+
};
|
|
928
|
+
function useCSPContext() {
|
|
929
|
+
return React.useContext(CSPContext) ?? DEFAULT_CSP_CONTEXT_VALUE;
|
|
930
|
+
}
|
|
931
|
+
function PrehydrationScript(props) {
|
|
932
|
+
const {
|
|
933
|
+
script: script2
|
|
934
|
+
} = props;
|
|
935
|
+
const {
|
|
936
|
+
nonce
|
|
937
|
+
} = useCSPContext();
|
|
938
|
+
const isHydrating = useIsHydrating();
|
|
939
|
+
if (!isHydrating) {
|
|
940
|
+
return null;
|
|
941
|
+
}
|
|
942
|
+
return /* @__PURE__ */ jsx("script", {
|
|
943
|
+
nonce,
|
|
944
|
+
dangerouslySetInnerHTML: {
|
|
945
|
+
__html: script2
|
|
946
|
+
},
|
|
947
|
+
suppressHydrationWarning: true
|
|
948
|
+
});
|
|
949
|
+
}
|
|
950
|
+
const index = "data-index";
|
|
951
|
+
var _PrehydrationScript;
|
|
952
|
+
const ALL_KEYS = /* @__PURE__ */ new Set([...COMPOSITE_KEYS, PAGE_UP, PAGE_DOWN]);
|
|
953
|
+
function getDefaultAriaValueText(values, index2, format, locale) {
|
|
954
|
+
if (index2 < 0) {
|
|
955
|
+
return void 0;
|
|
956
|
+
}
|
|
957
|
+
if (values.length === 2) {
|
|
958
|
+
return `${formatNumber(values[index2], locale, format)} ${index2 === 0 ? "start" : "end"} range`;
|
|
959
|
+
}
|
|
960
|
+
return format ? formatNumber(values[index2], locale, format) : void 0;
|
|
961
|
+
}
|
|
962
|
+
function getNewValue(thumbValue, increment, direction, min, max) {
|
|
963
|
+
const value = thumbValue + increment * direction;
|
|
964
|
+
const roundedValue = Number(value.toFixed(Math.max(getDecimalPrecision(thumbValue), getDecimalPrecision(increment), getDecimalPrecision(min))));
|
|
965
|
+
return clamp(roundedValue, min, max);
|
|
966
|
+
}
|
|
967
|
+
const SliderThumb = /* @__PURE__ */ React.forwardRef(function SliderThumb2(componentProps, forwardedRef) {
|
|
968
|
+
const {
|
|
969
|
+
render,
|
|
970
|
+
children: childrenProp,
|
|
971
|
+
className,
|
|
972
|
+
"aria-describedby": ariaDescribedByProp,
|
|
973
|
+
"aria-label": ariaLabelProp,
|
|
974
|
+
"aria-labelledby": ariaLabelledByProp,
|
|
975
|
+
"aria-valuetext": ariaValueTextProp,
|
|
976
|
+
disabled: disabledProp = false,
|
|
977
|
+
getAriaLabel: getAriaLabelProp,
|
|
978
|
+
getAriaValueText: getAriaValueTextProp,
|
|
979
|
+
id: idProp,
|
|
980
|
+
index: indexProp,
|
|
981
|
+
inputRef: inputRefProp,
|
|
982
|
+
onBlur: onBlurProp,
|
|
983
|
+
onFocus: onFocusProp,
|
|
984
|
+
onKeyDown: onKeyDownProp,
|
|
985
|
+
tabIndex: tabIndexProp,
|
|
986
|
+
style,
|
|
987
|
+
...elementProps
|
|
988
|
+
} = componentProps;
|
|
989
|
+
const id = useBaseUiId(idProp);
|
|
990
|
+
const {
|
|
991
|
+
active: activeIndex,
|
|
992
|
+
lastUsedThumbIndex,
|
|
993
|
+
controlRef,
|
|
994
|
+
disabled: contextDisabled,
|
|
995
|
+
validation,
|
|
996
|
+
format,
|
|
997
|
+
handleInputChange,
|
|
998
|
+
inset,
|
|
999
|
+
isArrayValue,
|
|
1000
|
+
labelId,
|
|
1001
|
+
largeStep,
|
|
1002
|
+
locale,
|
|
1003
|
+
max,
|
|
1004
|
+
min,
|
|
1005
|
+
minStepsBetweenValues,
|
|
1006
|
+
form,
|
|
1007
|
+
name,
|
|
1008
|
+
orientation,
|
|
1009
|
+
pressedThumbCenterOffsetRef,
|
|
1010
|
+
pressedThumbIndexRef,
|
|
1011
|
+
renderBeforeHydration,
|
|
1012
|
+
setActive,
|
|
1013
|
+
setIndicatorPosition,
|
|
1014
|
+
state,
|
|
1015
|
+
step,
|
|
1016
|
+
thumbRefs,
|
|
1017
|
+
values: sliderValues
|
|
1018
|
+
} = useSliderRootContext();
|
|
1019
|
+
const direction = useDirection();
|
|
1020
|
+
const disabled = disabledProp || contextDisabled;
|
|
1021
|
+
const range = sliderValues.length > 1;
|
|
1022
|
+
const vertical = orientation === "vertical";
|
|
1023
|
+
const rtl = direction === "rtl";
|
|
1024
|
+
const {
|
|
1025
|
+
setTouched,
|
|
1026
|
+
validationMode
|
|
1027
|
+
} = useFieldRootContext();
|
|
1028
|
+
const thumbRef = React.useRef(null);
|
|
1029
|
+
const inputRef = React.useRef(null);
|
|
1030
|
+
const setFocused = useSetFieldFocused(disabled, inputRef);
|
|
1031
|
+
const restoringFocusVisibleRef = React.useRef(false);
|
|
1032
|
+
const handleFocusProp = useStableCallback((event) => {
|
|
1033
|
+
if (restoringFocusVisibleRef.current) {
|
|
1034
|
+
return;
|
|
1035
|
+
}
|
|
1036
|
+
onFocusProp == null ? void 0 : onFocusProp(event);
|
|
1037
|
+
});
|
|
1038
|
+
const handleBlurProp = useStableCallback((event) => {
|
|
1039
|
+
if (restoringFocusVisibleRef.current) {
|
|
1040
|
+
return;
|
|
1041
|
+
}
|
|
1042
|
+
onBlurProp == null ? void 0 : onBlurProp(event);
|
|
1043
|
+
});
|
|
1044
|
+
const defaultInputId = useBaseUiId();
|
|
1045
|
+
const labelableId = useLabelableId();
|
|
1046
|
+
const inputId = range ? defaultInputId : labelableId;
|
|
1047
|
+
const thumbMetadata = React.useMemo(() => ({
|
|
1048
|
+
inputId
|
|
1049
|
+
}), [inputId]);
|
|
1050
|
+
const {
|
|
1051
|
+
ref: listItemRef,
|
|
1052
|
+
index: compositeIndex
|
|
1053
|
+
} = useCompositeListItem({
|
|
1054
|
+
metadata: thumbMetadata
|
|
1055
|
+
});
|
|
1056
|
+
const index$1 = !range ? 0 : indexProp ?? compositeIndex;
|
|
1057
|
+
const last = index$1 === sliderValues.length - 1;
|
|
1058
|
+
const thumbValue = sliderValues[index$1];
|
|
1059
|
+
const thumbValuePercent = valueToPercent(thumbValue, min, max);
|
|
1060
|
+
const [positionPercent, setPositionPercent] = React.useState();
|
|
1061
|
+
const isHydrating = useIsHydrating();
|
|
1062
|
+
const safeLastUsedThumbIndex = lastUsedThumbIndex >= 0 && lastUsedThumbIndex < sliderValues.length ? lastUsedThumbIndex : -1;
|
|
1063
|
+
const getInsetPosition = useStableCallback(() => {
|
|
1064
|
+
const control = controlRef.current;
|
|
1065
|
+
const thumb = thumbRef.current;
|
|
1066
|
+
if (!control || !thumb) {
|
|
1067
|
+
return;
|
|
1068
|
+
}
|
|
1069
|
+
const thumbRect = thumb.getBoundingClientRect();
|
|
1070
|
+
const controlRect = control.getBoundingClientRect();
|
|
1071
|
+
const side = vertical ? "height" : "width";
|
|
1072
|
+
const controlSize = controlRect[side] - thumbRect[side];
|
|
1073
|
+
const thumbOffsetFromControlEdge = thumbRect[side] / 2 + controlSize * thumbValuePercent / 100;
|
|
1074
|
+
const nextPositionPercent = thumbOffsetFromControlEdge / controlRect[side] * 100;
|
|
1075
|
+
const nextInsetPosition = Number.isFinite(nextPositionPercent) ? nextPositionPercent : void 0;
|
|
1076
|
+
setPositionPercent(nextInsetPosition);
|
|
1077
|
+
if (index$1 === 0) {
|
|
1078
|
+
setIndicatorPosition((prevPosition) => [nextInsetPosition, prevPosition[1]]);
|
|
1079
|
+
} else if (last) {
|
|
1080
|
+
setIndicatorPosition((prevPosition) => [prevPosition[0], nextInsetPosition]);
|
|
1081
|
+
}
|
|
1082
|
+
});
|
|
1083
|
+
useIsoLayoutEffect(() => {
|
|
1084
|
+
if (inset) {
|
|
1085
|
+
queueMicrotask(getInsetPosition);
|
|
1086
|
+
}
|
|
1087
|
+
}, [getInsetPosition, inset]);
|
|
1088
|
+
useIsoLayoutEffect(() => {
|
|
1089
|
+
if (inset) {
|
|
1090
|
+
getInsetPosition();
|
|
1091
|
+
}
|
|
1092
|
+
}, [getInsetPosition, inset, thumbValuePercent]);
|
|
1093
|
+
useIsoLayoutEffect(() => {
|
|
1094
|
+
if (!inset) {
|
|
1095
|
+
return void 0;
|
|
1096
|
+
}
|
|
1097
|
+
const control = controlRef.current;
|
|
1098
|
+
const thumb = thumbRef.current;
|
|
1099
|
+
if (!control || !thumb) {
|
|
1100
|
+
return void 0;
|
|
1101
|
+
}
|
|
1102
|
+
const ResizeObserverCtor = getWindow(control).ResizeObserver;
|
|
1103
|
+
if (typeof ResizeObserverCtor !== "function") {
|
|
1104
|
+
return void 0;
|
|
1105
|
+
}
|
|
1106
|
+
const resizeObserver = new ResizeObserverCtor(getInsetPosition);
|
|
1107
|
+
resizeObserver.observe(control);
|
|
1108
|
+
resizeObserver.observe(thumb);
|
|
1109
|
+
return () => {
|
|
1110
|
+
resizeObserver.disconnect();
|
|
1111
|
+
};
|
|
1112
|
+
}, [controlRef, getInsetPosition, inset]);
|
|
1113
|
+
const startEdge = vertical ? "bottom" : "insetInlineStart";
|
|
1114
|
+
const crossOffsetProperty = vertical ? "left" : "top";
|
|
1115
|
+
let zIndex;
|
|
1116
|
+
if (range) {
|
|
1117
|
+
if (activeIndex === index$1) {
|
|
1118
|
+
zIndex = 2;
|
|
1119
|
+
} else if (safeLastUsedThumbIndex === index$1) {
|
|
1120
|
+
zIndex = 1;
|
|
1121
|
+
}
|
|
1122
|
+
} else if (activeIndex === index$1) {
|
|
1123
|
+
zIndex = 1;
|
|
1124
|
+
}
|
|
1125
|
+
let thumbStyle;
|
|
1126
|
+
if (!inset && !Number.isFinite(thumbValuePercent)) {
|
|
1127
|
+
thumbStyle = visuallyHidden;
|
|
1128
|
+
} else {
|
|
1129
|
+
thumbStyle = {
|
|
1130
|
+
position: "absolute",
|
|
1131
|
+
[startEdge]: inset ? "var(--position)" : `${thumbValuePercent}%`,
|
|
1132
|
+
[crossOffsetProperty]: "50%",
|
|
1133
|
+
translate: `${(vertical || !rtl ? -1 : 1) * 50}% ${(vertical ? 1 : -1) * 50}%`,
|
|
1134
|
+
zIndex,
|
|
1135
|
+
...inset && {
|
|
1136
|
+
["--position"]: `${positionPercent ?? 0}%`,
|
|
1137
|
+
visibility: renderBeforeHydration && isHydrating || positionPercent === void 0 ? "hidden" : void 0
|
|
1138
|
+
}
|
|
1139
|
+
};
|
|
1140
|
+
}
|
|
1141
|
+
let cssWritingMode;
|
|
1142
|
+
if (vertical) {
|
|
1143
|
+
cssWritingMode = rtl ? "vertical-rl" : "vertical-lr";
|
|
1144
|
+
}
|
|
1145
|
+
const ariaLabel = typeof getAriaLabelProp === "function" ? getAriaLabelProp(index$1) : ariaLabelProp;
|
|
1146
|
+
const inputProps = mergeProps({
|
|
1147
|
+
"aria-label": ariaLabel,
|
|
1148
|
+
"aria-labelledby": ariaLabelledByProp ?? (ariaLabel == null ? labelId : void 0),
|
|
1149
|
+
"aria-describedby": ariaDescribedByProp,
|
|
1150
|
+
"aria-orientation": orientation,
|
|
1151
|
+
"aria-valuenow": thumbValue,
|
|
1152
|
+
"aria-valuetext": typeof getAriaValueTextProp === "function" ? getAriaValueTextProp(formatNumber(thumbValue, locale, format), thumbValue, index$1) : ariaValueTextProp ?? getDefaultAriaValueText(sliderValues, index$1, format, locale),
|
|
1153
|
+
disabled,
|
|
1154
|
+
form,
|
|
1155
|
+
id: inputId,
|
|
1156
|
+
max,
|
|
1157
|
+
min,
|
|
1158
|
+
name,
|
|
1159
|
+
onChange(event) {
|
|
1160
|
+
handleInputChange(event.currentTarget.valueAsNumber, index$1, event);
|
|
1161
|
+
},
|
|
1162
|
+
onFocus(event) {
|
|
1163
|
+
const isRestoringFocusVisible = restoringFocusVisibleRef.current;
|
|
1164
|
+
restoringFocusVisibleRef.current = false;
|
|
1165
|
+
setActive(index$1);
|
|
1166
|
+
setFocused(true);
|
|
1167
|
+
if (isRestoringFocusVisible) {
|
|
1168
|
+
event.stopPropagation();
|
|
1169
|
+
}
|
|
1170
|
+
},
|
|
1171
|
+
onBlur(event) {
|
|
1172
|
+
if (restoringFocusVisibleRef.current) {
|
|
1173
|
+
event.stopPropagation();
|
|
1174
|
+
return;
|
|
1175
|
+
}
|
|
1176
|
+
setActive(-1);
|
|
1177
|
+
if (thumbRefs.current.some((thumb) => contains(thumb, event.relatedTarget))) {
|
|
1178
|
+
return;
|
|
1179
|
+
}
|
|
1180
|
+
setTouched(true);
|
|
1181
|
+
setFocused(false);
|
|
1182
|
+
if (validationMode === "onBlur") {
|
|
1183
|
+
validation.commit(getSliderValue(thumbValue, index$1, min, max, isArrayValue, sliderValues));
|
|
1184
|
+
}
|
|
1185
|
+
},
|
|
1186
|
+
onKeyDown(event) {
|
|
1187
|
+
if (event.defaultPrevented) {
|
|
1188
|
+
return;
|
|
1189
|
+
}
|
|
1190
|
+
if (!ALL_KEYS.has(event.key)) {
|
|
1191
|
+
return;
|
|
1192
|
+
}
|
|
1193
|
+
if (COMPOSITE_KEYS.has(event.key)) {
|
|
1194
|
+
event.stopPropagation();
|
|
1195
|
+
}
|
|
1196
|
+
let newValue = null;
|
|
1197
|
+
let direction2 = 0;
|
|
1198
|
+
let increment = event.shiftKey ? largeStep : step;
|
|
1199
|
+
const roundedValue = roundValueToStep(thumbValue, step, min);
|
|
1200
|
+
switch (event.key) {
|
|
1201
|
+
case ARROW_UP:
|
|
1202
|
+
direction2 = 1;
|
|
1203
|
+
break;
|
|
1204
|
+
case ARROW_RIGHT:
|
|
1205
|
+
direction2 = rtl ? -1 : 1;
|
|
1206
|
+
break;
|
|
1207
|
+
case ARROW_DOWN:
|
|
1208
|
+
direction2 = -1;
|
|
1209
|
+
break;
|
|
1210
|
+
case ARROW_LEFT:
|
|
1211
|
+
direction2 = rtl ? 1 : -1;
|
|
1212
|
+
break;
|
|
1213
|
+
case PAGE_UP:
|
|
1214
|
+
increment = largeStep;
|
|
1215
|
+
direction2 = 1;
|
|
1216
|
+
break;
|
|
1217
|
+
case PAGE_DOWN:
|
|
1218
|
+
increment = largeStep;
|
|
1219
|
+
direction2 = -1;
|
|
1220
|
+
break;
|
|
1221
|
+
case END:
|
|
1222
|
+
newValue = range && Number.isFinite(sliderValues[index$1 + 1]) ? sliderValues[index$1 + 1] - step * minStepsBetweenValues : max;
|
|
1223
|
+
break;
|
|
1224
|
+
case HOME:
|
|
1225
|
+
newValue = range && Number.isFinite(sliderValues[index$1 - 1]) ? sliderValues[index$1 - 1] + step * minStepsBetweenValues : min;
|
|
1226
|
+
break;
|
|
1227
|
+
}
|
|
1228
|
+
if (direction2 !== 0) {
|
|
1229
|
+
newValue = getNewValue(roundedValue, increment, direction2, min, max);
|
|
1230
|
+
}
|
|
1231
|
+
if (newValue !== null) {
|
|
1232
|
+
const input = event.currentTarget;
|
|
1233
|
+
if (!matchesFocusVisible(input)) {
|
|
1234
|
+
restoringFocusVisibleRef.current = true;
|
|
1235
|
+
input.blur();
|
|
1236
|
+
input.focus({
|
|
1237
|
+
preventScroll: true,
|
|
1238
|
+
// Show `:focus-visible` after keyboard interaction, even if the
|
|
1239
|
+
// thumb was previously focused by a pointer.
|
|
1240
|
+
focusVisible: true
|
|
1241
|
+
});
|
|
1242
|
+
}
|
|
1243
|
+
handleInputChange(newValue, index$1, event);
|
|
1244
|
+
event.preventDefault();
|
|
1245
|
+
}
|
|
1246
|
+
},
|
|
1247
|
+
step,
|
|
1248
|
+
style: {
|
|
1249
|
+
...visuallyHidden,
|
|
1250
|
+
// So that VoiceOver's focus indicator matches the thumb's dimensions
|
|
1251
|
+
width: "100%",
|
|
1252
|
+
height: "100%",
|
|
1253
|
+
writingMode: cssWritingMode
|
|
1254
|
+
},
|
|
1255
|
+
tabIndex: tabIndexProp,
|
|
1256
|
+
type: "range",
|
|
1257
|
+
value: thumbValue ?? ""
|
|
1258
|
+
}, (props) => validation.getValidationProps(disabled, props), {
|
|
1259
|
+
onFocus: handleFocusProp,
|
|
1260
|
+
onBlur: handleBlurProp,
|
|
1261
|
+
onKeyDown: onKeyDownProp
|
|
1262
|
+
});
|
|
1263
|
+
const mergedInputRef = useMergedRefs(inputRef, validation.inputRef, inputRefProp);
|
|
1264
|
+
const element = useRenderElement("div", componentProps, {
|
|
1265
|
+
state,
|
|
1266
|
+
ref: [forwardedRef, listItemRef, thumbRef],
|
|
1267
|
+
props: [{
|
|
1268
|
+
[index]: index$1,
|
|
1269
|
+
children: /* @__PURE__ */ jsxs(React.Fragment, {
|
|
1270
|
+
children: [childrenProp, /* @__PURE__ */ jsx("input", {
|
|
1271
|
+
ref: mergedInputRef,
|
|
1272
|
+
...inputProps,
|
|
1273
|
+
suppressHydrationWarning: true
|
|
1274
|
+
}), inset && last && renderBeforeHydration && (_PrehydrationScript || (_PrehydrationScript = /* @__PURE__ */ jsx(PrehydrationScript, {
|
|
1275
|
+
script
|
|
1276
|
+
})))]
|
|
1277
|
+
}),
|
|
1278
|
+
id,
|
|
1279
|
+
onPointerDown(event) {
|
|
1280
|
+
if (disabled) {
|
|
1281
|
+
return;
|
|
1282
|
+
}
|
|
1283
|
+
pressedThumbIndexRef.current = index$1;
|
|
1284
|
+
const midpoint = getMidpoint(event.currentTarget, vertical);
|
|
1285
|
+
pressedThumbCenterOffsetRef.current = (vertical ? event.clientY : event.clientX) - midpoint;
|
|
1286
|
+
},
|
|
1287
|
+
style: thumbStyle,
|
|
1288
|
+
suppressHydrationWarning: renderBeforeHydration || void 0
|
|
1289
|
+
}, elementProps],
|
|
1290
|
+
stateAttributesMapping: sliderStateAttributesMapping
|
|
1291
|
+
});
|
|
1292
|
+
return element;
|
|
1293
|
+
});
|
|
1294
|
+
if (process.env.NODE_ENV !== "production") SliderThumb.displayName = "SliderThumb";
|
|
1295
|
+
function getIndicatorStyles(vertical, range, inset, start, end, forceHidden) {
|
|
1296
|
+
const styles = {
|
|
1297
|
+
visibility: forceHidden || inset && (start === void 0 || range && end === void 0) ? "hidden" : void 0,
|
|
1298
|
+
position: vertical ? "absolute" : "relative",
|
|
1299
|
+
[vertical ? "width" : "height"]: "inherit"
|
|
1300
|
+
};
|
|
1301
|
+
let startValue = `${start ?? 0}%`;
|
|
1302
|
+
let sizeValue = `${(end ?? 0) - (start ?? 0)}%`;
|
|
1303
|
+
if (inset) {
|
|
1304
|
+
styles["--start-position"] = startValue;
|
|
1305
|
+
startValue = "var(--start-position)";
|
|
1306
|
+
if (range) {
|
|
1307
|
+
styles["--relative-size"] = sizeValue;
|
|
1308
|
+
sizeValue = "var(--relative-size)";
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
styles[vertical ? "bottom" : "insetInlineStart"] = range ? startValue : 0;
|
|
1312
|
+
styles[vertical ? "height" : "width"] = range ? sizeValue : startValue;
|
|
1313
|
+
return styles;
|
|
1314
|
+
}
|
|
1315
|
+
const SliderIndicator = /* @__PURE__ */ React.forwardRef(function SliderIndicator2(componentProps, forwardedRef) {
|
|
1316
|
+
const {
|
|
1317
|
+
render,
|
|
1318
|
+
className,
|
|
1319
|
+
style: styleProp,
|
|
1320
|
+
...elementProps
|
|
1321
|
+
} = componentProps;
|
|
1322
|
+
const {
|
|
1323
|
+
indicatorPosition,
|
|
1324
|
+
inset,
|
|
1325
|
+
max,
|
|
1326
|
+
min,
|
|
1327
|
+
orientation,
|
|
1328
|
+
renderBeforeHydration,
|
|
1329
|
+
state,
|
|
1330
|
+
values
|
|
1331
|
+
} = useSliderRootContext();
|
|
1332
|
+
const isHydrating = useIsHydrating();
|
|
1333
|
+
const vertical = orientation === "vertical";
|
|
1334
|
+
const range = values.length > 1;
|
|
1335
|
+
const style = getIndicatorStyles(vertical, range, inset, inset ? indicatorPosition[0] : valueToPercent(values[0], min, max), inset ? indicatorPosition[1] : valueToPercent(values[values.length - 1], min, max), inset && renderBeforeHydration && isHydrating);
|
|
1336
|
+
const element = useRenderElement("div", componentProps, {
|
|
1337
|
+
state,
|
|
1338
|
+
ref: forwardedRef,
|
|
1339
|
+
props: [{
|
|
1340
|
+
["data-base-ui-slider-indicator"]: renderBeforeHydration ? "" : void 0,
|
|
1341
|
+
style,
|
|
1342
|
+
suppressHydrationWarning: renderBeforeHydration || void 0
|
|
1343
|
+
}, elementProps],
|
|
1344
|
+
stateAttributesMapping: sliderStateAttributesMapping
|
|
1345
|
+
});
|
|
1346
|
+
return element;
|
|
1347
|
+
});
|
|
1348
|
+
if (process.env.NODE_ENV !== "production") SliderIndicator.displayName = "SliderIndicator";
|
|
1349
|
+
function Slider({
|
|
1350
|
+
className,
|
|
1351
|
+
orientation = "horizontal",
|
|
1352
|
+
value,
|
|
1353
|
+
defaultValue,
|
|
1354
|
+
thumbLabels,
|
|
1355
|
+
thumbClassName,
|
|
1356
|
+
...props
|
|
1357
|
+
}) {
|
|
1358
|
+
const configuredValue = value ?? defaultValue;
|
|
1359
|
+
const thumbCount = Array.isArray(configuredValue) ? configuredValue.length : 1;
|
|
1360
|
+
return /* @__PURE__ */ jsx(
|
|
1361
|
+
SliderRoot,
|
|
1362
|
+
{
|
|
1363
|
+
orientation,
|
|
1364
|
+
value,
|
|
1365
|
+
defaultValue,
|
|
1366
|
+
...props,
|
|
1367
|
+
"data-slot": "slider",
|
|
1368
|
+
className: classNames(
|
|
1369
|
+
"relative flex touch-none select-none items-center data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
1370
|
+
orientation === "horizontal" ? "h-3 w-full min-w-30" : "h-full min-h-30 w-3 flex-col",
|
|
1371
|
+
className
|
|
1372
|
+
),
|
|
1373
|
+
children: /* @__PURE__ */ jsxs(
|
|
1374
|
+
SliderControl,
|
|
1375
|
+
{
|
|
1376
|
+
"data-slot": "slider-control",
|
|
1377
|
+
className: classNames(
|
|
1378
|
+
"relative flex items-center justify-center",
|
|
1379
|
+
orientation === "horizontal" ? "h-3 w-full" : "h-full w-3"
|
|
1380
|
+
),
|
|
1381
|
+
children: [
|
|
1382
|
+
/* @__PURE__ */ jsx(
|
|
1383
|
+
SliderTrack,
|
|
1384
|
+
{
|
|
1385
|
+
"data-slot": "slider-track",
|
|
1386
|
+
className: classNames(
|
|
1387
|
+
"relative overflow-hidden rounded-pill bg-background-surface-input",
|
|
1388
|
+
orientation === "horizontal" ? "h-1 w-full" : "h-full w-1"
|
|
1389
|
+
),
|
|
1390
|
+
children: /* @__PURE__ */ jsx(SliderIndicator, { "data-slot": "slider-range", className: "rounded-pill bg-background-fill-brand" })
|
|
1391
|
+
}
|
|
1392
|
+
),
|
|
1393
|
+
Array.from({ length: thumbCount }, (_, index2) => /* @__PURE__ */ jsx(
|
|
1394
|
+
SliderThumb,
|
|
1395
|
+
{
|
|
1396
|
+
index: index2,
|
|
1397
|
+
"data-slot": "slider-thumb",
|
|
1398
|
+
getAriaLabel: () => (thumbLabels == null ? void 0 : thumbLabels[index2]) ?? (thumbCount > 1 ? index2 === 0 ? "Minimum" : "Maximum" : "Value"),
|
|
1399
|
+
className: classNames(
|
|
1400
|
+
"size-3 rounded-pill border border-border-subtle bg-icon-on-solid shadow-xs outline-none after:absolute after:-inset-1.5 after:rounded-pill after:content-[''] hover:border-border-brand-bold data-dragging:border-border-brand-bold has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-solid has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-border-focus",
|
|
1401
|
+
typeof thumbClassName === "function" ? thumbClassName(index2) : thumbClassName
|
|
1402
|
+
)
|
|
1403
|
+
},
|
|
1404
|
+
index2
|
|
1405
|
+
))
|
|
1406
|
+
]
|
|
1407
|
+
}
|
|
1408
|
+
)
|
|
1409
|
+
}
|
|
1410
|
+
);
|
|
1411
|
+
}
|
|
1412
|
+
export {
|
|
1413
|
+
Slider as default
|
|
1414
|
+
};
|
|
1415
|
+
//# sourceMappingURL=Slider.es.js.map
|