@tamagui/slider 1.0.1-beta.95 → 1.0.1-beta.98
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/cjs/Slider.js +29 -29
- package/dist/cjs/Slider.js.map +2 -2
- package/dist/cjs/SliderImpl.js +2 -4
- package/dist/cjs/SliderImpl.js.map +2 -2
- package/dist/cjs/constants.js +0 -0
- package/dist/cjs/constants.js.map +0 -0
- package/dist/cjs/helpers.js +0 -0
- package/dist/cjs/helpers.js.map +2 -2
- package/dist/cjs/index.js +0 -0
- package/dist/cjs/index.js.map +0 -0
- package/dist/cjs/types.js +0 -0
- package/dist/cjs/types.js.map +1 -1
- package/dist/esm/Slider.js +30 -30
- package/dist/esm/Slider.js.map +2 -2
- package/dist/esm/SliderImpl.js +2 -4
- package/dist/esm/SliderImpl.js.map +2 -2
- package/dist/esm/constants.js +0 -0
- package/dist/esm/constants.js.map +0 -0
- package/dist/esm/helpers.js +0 -0
- package/dist/esm/helpers.js.map +2 -2
- package/dist/esm/index.js +0 -0
- package/dist/esm/index.js.map +0 -0
- package/dist/esm/types.js +0 -0
- package/dist/esm/types.js.map +0 -0
- package/dist/jsx/Slider.js +26 -26
- package/dist/jsx/Slider.js.map +2 -2
- package/dist/jsx/SliderImpl.js +3 -4
- package/dist/jsx/SliderImpl.js.map +2 -2
- package/dist/jsx/constants.js +0 -0
- package/dist/jsx/constants.js.map +0 -0
- package/dist/jsx/helpers.js +0 -0
- package/dist/jsx/helpers.js.map +2 -2
- package/dist/jsx/index.js +0 -0
- package/dist/jsx/index.js.map +0 -0
- package/dist/jsx/types.js +0 -0
- package/dist/jsx/types.js.map +0 -0
- package/package.json +8 -8
- package/src/Slider.tsx +43 -55
- package/src/SliderImpl.tsx +6 -6
- package/src/helpers.tsx +0 -2
- package/src/types.ts +0 -3
- package/types/Slider.d.ts +184 -46
- package/types/Slider.d.ts.map +1 -1
- package/types/SliderImpl.d.ts +17 -16
- package/types/SliderImpl.d.ts.map +1 -1
- package/types/constants.d.ts +0 -1
- package/types/constants.d.ts.map +1 -1
- package/types/helpers.d.ts +0 -0
- package/types/helpers.d.ts.map +1 -1
- package/types/index.d.ts +0 -0
- package/types/index.d.ts.map +0 -0
- package/types/types.d.ts +0 -2
- package/types/types.d.ts.map +1 -1
package/dist/cjs/Slider.js
CHANGED
|
@@ -75,13 +75,10 @@ const SliderHorizontal = React.forwardRef((props, forwardedRef) => {
|
|
|
75
75
|
const _a = props, { min, max, dir, onSlideStart, onSlideMove, onStepKeyDown } = _a, sliderProps = __objRest(_a, ["min", "max", "dir", "onSlideStart", "onSlideMove", "onStepKeyDown"]);
|
|
76
76
|
const direction = (0, import_use_direction.useDirection)(dir);
|
|
77
77
|
const isDirectionLTR = direction === "ltr";
|
|
78
|
-
const
|
|
79
|
-
const [
|
|
78
|
+
const sliderRef = React.useRef(null);
|
|
79
|
+
const [state, setState] = React.useState(() => ({ size: 0, offset: 0 }));
|
|
80
80
|
function getValueFromPointer(pointerPosition) {
|
|
81
|
-
const
|
|
82
|
-
if (!layout)
|
|
83
|
-
return;
|
|
84
|
-
const input = [0, layout.width];
|
|
81
|
+
const input = [0, state.size];
|
|
85
82
|
const output = isDirectionLTR ? [min, max] : [max, min];
|
|
86
83
|
const value = (0, import_helpers2.linearScale)(input, output);
|
|
87
84
|
return value(pointerPosition);
|
|
@@ -92,16 +89,20 @@ const SliderHorizontal = React.forwardRef((props, forwardedRef) => {
|
|
|
92
89
|
endEdge: isDirectionLTR ? "right" : "left",
|
|
93
90
|
direction: isDirectionLTR ? 1 : -1,
|
|
94
91
|
sizeProp: "width",
|
|
95
|
-
size
|
|
92
|
+
size: state.size
|
|
96
93
|
}, /* @__PURE__ */ React.createElement(import_SliderImpl.SliderImpl, __spreadProps(__spreadValues({
|
|
97
|
-
ref: forwardedRef,
|
|
94
|
+
ref: (0, import_compose_refs.composeRefs)(forwardedRef, sliderRef),
|
|
98
95
|
dir: direction
|
|
99
96
|
}, sliderProps), {
|
|
100
97
|
orientation: "horizontal",
|
|
101
|
-
onLayout: (
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
98
|
+
onLayout: () => {
|
|
99
|
+
var _a2;
|
|
100
|
+
(_a2 = sliderRef.current) == null ? void 0 : _a2.measure((_x, _y, width, _height, pageX, _pageY) => {
|
|
101
|
+
setState({
|
|
102
|
+
size: width,
|
|
103
|
+
offset: pageX
|
|
104
|
+
});
|
|
105
|
+
});
|
|
105
106
|
},
|
|
106
107
|
onSlideStart: (event, target) => {
|
|
107
108
|
const value = getValueFromPointer(event.nativeEvent.locationX);
|
|
@@ -110,7 +111,7 @@ const SliderHorizontal = React.forwardRef((props, forwardedRef) => {
|
|
|
110
111
|
}
|
|
111
112
|
},
|
|
112
113
|
onSlideMove: (event) => {
|
|
113
|
-
const value = getValueFromPointer(event.nativeEvent.
|
|
114
|
+
const value = getValueFromPointer(event.nativeEvent.pageX - state.offset);
|
|
114
115
|
if (value) {
|
|
115
116
|
onSlideMove == null ? void 0 : onSlideMove(value);
|
|
116
117
|
}
|
|
@@ -125,13 +126,10 @@ const SliderHorizontal = React.forwardRef((props, forwardedRef) => {
|
|
|
125
126
|
});
|
|
126
127
|
const SliderVertical = React.forwardRef((props, forwardedRef) => {
|
|
127
128
|
const _a = props, { min, max, onSlideStart, onSlideMove, onStepKeyDown } = _a, sliderProps = __objRest(_a, ["min", "max", "onSlideStart", "onSlideMove", "onStepKeyDown"]);
|
|
128
|
-
const
|
|
129
|
-
const
|
|
129
|
+
const [state, setState] = React.useState(() => ({ size: 0, offset: 0 }));
|
|
130
|
+
const sliderRef = React.useRef(null);
|
|
130
131
|
function getValueFromPointer(pointerPosition) {
|
|
131
|
-
const
|
|
132
|
-
if (!layout)
|
|
133
|
-
return;
|
|
134
|
-
const input = [0, layout.height];
|
|
132
|
+
const input = [0, state.size];
|
|
135
133
|
const output = [max, min];
|
|
136
134
|
const value = (0, import_helpers2.linearScale)(input, output);
|
|
137
135
|
return value(pointerPosition);
|
|
@@ -141,16 +139,20 @@ const SliderVertical = React.forwardRef((props, forwardedRef) => {
|
|
|
141
139
|
startEdge: "bottom",
|
|
142
140
|
endEdge: "top",
|
|
143
141
|
sizeProp: "height",
|
|
144
|
-
size,
|
|
142
|
+
size: state.size,
|
|
145
143
|
direction: 1
|
|
146
144
|
}, /* @__PURE__ */ React.createElement(import_SliderImpl.SliderImpl, __spreadProps(__spreadValues({
|
|
147
|
-
ref: forwardedRef
|
|
145
|
+
ref: (0, import_compose_refs.composeRefs)(forwardedRef, sliderRef)
|
|
148
146
|
}, sliderProps), {
|
|
149
147
|
orientation: "vertical",
|
|
150
|
-
onLayout: (
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
148
|
+
onLayout: () => {
|
|
149
|
+
var _a2;
|
|
150
|
+
(_a2 = sliderRef.current) == null ? void 0 : _a2.measure((_x, _y, _width, height, _pageX, pageY) => {
|
|
151
|
+
setState({
|
|
152
|
+
size: height,
|
|
153
|
+
offset: pageY
|
|
154
|
+
});
|
|
155
|
+
});
|
|
154
156
|
},
|
|
155
157
|
onSlideStart: (event, target) => {
|
|
156
158
|
const value = getValueFromPointer(event.nativeEvent.locationY);
|
|
@@ -159,7 +161,7 @@ const SliderVertical = React.forwardRef((props, forwardedRef) => {
|
|
|
159
161
|
}
|
|
160
162
|
},
|
|
161
163
|
onSlideMove: (event) => {
|
|
162
|
-
const value = getValueFromPointer(event.nativeEvent.
|
|
164
|
+
const value = getValueFromPointer(event.nativeEvent.pageY - state.offset);
|
|
163
165
|
if (value) {
|
|
164
166
|
onSlideMove == null ? void 0 : onSlideMove(value);
|
|
165
167
|
}
|
|
@@ -276,7 +278,7 @@ const SliderThumb = React.forwardRef((props, forwardedRef) => {
|
|
|
276
278
|
};
|
|
277
279
|
}
|
|
278
280
|
}, [thumb, context.thumbs]);
|
|
279
|
-
return /* @__PURE__ */ React.createElement(SliderThumbFrame,
|
|
281
|
+
return /* @__PURE__ */ React.createElement(SliderThumbFrame, __spreadProps(__spreadValues(__spreadProps(__spreadValues(__spreadValues({
|
|
280
282
|
ref: composedRefs,
|
|
281
283
|
role: "slider",
|
|
282
284
|
"aria-label": props["aria-label"] || label,
|
|
@@ -312,8 +314,6 @@ const SliderThumb = React.forwardRef((props, forwardedRef) => {
|
|
|
312
314
|
onFocus: (0, import_helpers.composeEventHandlers)(props.onFocus, () => {
|
|
313
315
|
context.valueIndexToChangeRef.current = index;
|
|
314
316
|
})
|
|
315
|
-
}), !import_core.isWeb && {
|
|
316
|
-
pointerEvents: "none"
|
|
317
317
|
}));
|
|
318
318
|
});
|
|
319
319
|
SliderThumb.displayName = THUMB_NAME;
|
package/dist/cjs/Slider.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Slider.tsx"],
|
|
4
|
-
"sourcesContent": ["// forked from radix-ui\n\nimport { useComposedRefs } from '@tamagui/compose-refs'\nimport {\n SizeTokens,\n getSize,\n getVariableValue,\n isWeb,\n styled,\n withStaticProperties,\n} from '@tamagui/core'\nimport { clamp, composeEventHandlers } from '@tamagui/helpers'\nimport { SizableStackProps, ThemeableStack, YStackProps } from '@tamagui/stacks'\nimport { useControllableState } from '@tamagui/use-controllable-state'\nimport { useDirection } from '@tamagui/use-direction'\nimport * as React from 'react'\nimport { LayoutRectangle, View } from 'react-native'\n\nimport {\n ARROW_KEYS,\n BACK_KEYS,\n PAGE_KEYS,\n SLIDER_NAME,\n SliderOrientationProvider,\n SliderProvider,\n useSliderContext,\n useSliderOrientationContext,\n} from './constants'\nimport {\n convertValueToPercentage,\n getClosestValueIndex,\n getDecimalCount,\n getLabel,\n getNextSortedValues,\n getThumbInBoundsOffset,\n hasMinStepsBetweenValues,\n linearScale,\n roundValue,\n} from './helpers'\nimport { SliderFrame, SliderImpl } from './SliderImpl'\nimport {\n ScopedProps,\n SliderContextValue,\n SliderHorizontalProps,\n SliderImplElement,\n SliderProps,\n SliderTrackProps,\n SliderVerticalProps,\n} from './types'\n\n/* -------------------------------------------------------------------------------------------------\n * SliderHorizontal\n * -----------------------------------------------------------------------------------------------*/\n\ntype SliderHorizontalElement = SliderImplElement\n\nconst SliderHorizontal = React.forwardRef<SliderHorizontalElement, SliderHorizontalProps>(\n (props: ScopedProps<SliderHorizontalProps>, forwardedRef) => {\n const { min, max, dir, onSlideStart, onSlideMove, onStepKeyDown, ...sliderProps } = props\n const direction = useDirection(dir)\n const isDirectionLTR = direction === 'ltr'\n const layoutRef = React.useRef<LayoutRectangle | null>(null)\n const [size, setSize] = React.useState(0)\n\n function getValueFromPointer(pointerPosition: number) {\n const layout = layoutRef.current\n if (!layout) return\n const input: [number, number] = [0, layout.width]\n const output: [number, number] = isDirectionLTR ? [min, max] : [max, min]\n const value = linearScale(input, output)\n return value(pointerPosition)\n }\n\n return (\n <SliderOrientationProvider\n scope={props.__scopeSlider}\n startEdge={isDirectionLTR ? 'left' : 'right'}\n endEdge={isDirectionLTR ? 'right' : 'left'}\n direction={isDirectionLTR ? 1 : -1}\n sizeProp=\"width\"\n size={size}\n >\n <SliderImpl\n ref={forwardedRef}\n dir={direction}\n {...sliderProps}\n orientation=\"horizontal\"\n onLayout={(e) => {\n const layout = e.nativeEvent.layout\n layoutRef.current = layout\n setSize(layout.height)\n }}\n onSlideStart={(event, target) => {\n const value = getValueFromPointer(event.nativeEvent.locationX)\n if (value) {\n onSlideStart?.(value, target)\n }\n }}\n onSlideMove={(event) => {\n const value = getValueFromPointer(event.nativeEvent.locationX)\n if (value) {\n onSlideMove?.(value)\n }\n }}\n onSlideEnd={() => {}}\n onStepKeyDown={(event) => {\n const isBackKey = BACK_KEYS[direction].includes(event.key)\n onStepKeyDown?.({ event, direction: isBackKey ? -1 : 1 })\n }}\n />\n </SliderOrientationProvider>\n )\n }\n)\n\n/* -------------------------------------------------------------------------------------------------\n * SliderVertical\n * -----------------------------------------------------------------------------------------------*/\n\ntype SliderVerticalElement = SliderImplElement\n\nconst SliderVertical = React.forwardRef<SliderVerticalElement, SliderVerticalProps>(\n (props: ScopedProps<SliderVerticalProps>, forwardedRef) => {\n const { min, max, onSlideStart, onSlideMove, onStepKeyDown, ...sliderProps } = props\n const layoutRef = React.useRef<LayoutRectangle | null>(null)\n const [size, setSize] = React.useState(0)\n\n function getValueFromPointer(pointerPosition: number) {\n const layout = layoutRef.current\n if (!layout) return\n const input: [number, number] = [0, layout.height]\n const output: [number, number] = [max, min]\n const value = linearScale(input, output)\n return value(pointerPosition)\n }\n\n return (\n <SliderOrientationProvider\n scope={props.__scopeSlider}\n startEdge=\"bottom\"\n endEdge=\"top\"\n sizeProp=\"height\"\n size={size}\n direction={1}\n >\n <SliderImpl\n ref={forwardedRef}\n {...sliderProps}\n orientation=\"vertical\"\n onLayout={(e) => {\n const layout = e.nativeEvent.layout\n layoutRef.current = layout\n setSize(layout.height)\n }}\n onSlideStart={(event, target) => {\n const value = getValueFromPointer(event.nativeEvent.locationY)\n if (value) {\n onSlideStart?.(value, target)\n }\n }}\n onSlideMove={(event) => {\n const value = getValueFromPointer(event.nativeEvent.locationY)\n if (value) {\n onSlideMove?.(value)\n }\n }}\n onSlideEnd={() => {}}\n onStepKeyDown={(event) => {\n const isBackKey = BACK_KEYS.ltr.includes(event.key)\n onStepKeyDown?.({ event, direction: isBackKey ? -1 : 1 })\n }}\n />\n </SliderOrientationProvider>\n )\n }\n)\n\n/* -------------------------------------------------------------------------------------------------\n * SliderTrack\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRACK_NAME = 'SliderTrack'\n\ntype SliderTrackElement = HTMLElement | View\n\nexport const SliderTrackFrame = styled(SliderFrame, {\n name: 'SliderTrack',\n height: '100%',\n width: '100%',\n backgroundColor: '$background',\n position: 'relative',\n borderRadius: 100_000,\n overflow: 'hidden',\n})\n\nconst SliderTrack = React.forwardRef<SliderTrackElement, SliderTrackProps>(\n (props: ScopedProps<SliderTrackProps>, forwardedRef) => {\n const { __scopeSlider, ...trackProps } = props\n const context = useSliderContext(TRACK_NAME, __scopeSlider)\n return (\n <SliderTrackFrame\n data-disabled={context.disabled ? '' : undefined}\n data-orientation={context.orientation}\n orientation={context.orientation}\n size={context.size}\n {...trackProps}\n ref={forwardedRef}\n />\n )\n }\n)\n\nSliderTrack.displayName = TRACK_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SliderTrackActive\n * -----------------------------------------------------------------------------------------------*/\n\nconst RANGE_NAME = 'SliderTrackActive'\n\ntype SliderTrackActiveElement = HTMLElement | View\ninterface SliderTrackActiveProps extends YStackProps {}\n\nexport const SliderTrackActiveFrame = styled(SliderFrame, {\n name: 'SliderTrackActive',\n backgroundColor: '$background',\n position: 'absolute',\n})\n\nconst SliderTrackActive = React.forwardRef<SliderTrackActiveElement, SliderTrackActiveProps>(\n (props: ScopedProps<SliderTrackActiveProps>, forwardedRef) => {\n const { __scopeSlider, ...rangeProps } = props\n const context = useSliderContext(RANGE_NAME, __scopeSlider)\n const orientation = useSliderOrientationContext(RANGE_NAME, __scopeSlider)\n const ref = React.useRef<HTMLSpanElement>(null)\n const composedRefs = useComposedRefs(forwardedRef, ref)\n const valuesCount = context.values.length\n const percentages = context.values.map((value) =>\n convertValueToPercentage(value, context.min, context.max)\n )\n const offsetStart = valuesCount > 1 ? Math.min(...percentages) : 0\n const offsetEnd = 100 - Math.max(...percentages)\n\n return (\n <SliderTrackActiveFrame\n orientation={context.orientation}\n data-orientation={context.orientation}\n data-disabled={context.disabled ? '' : undefined}\n size={context.size}\n {...rangeProps}\n ref={composedRefs}\n {...{\n [orientation.startEdge]: offsetStart + '%',\n [orientation.endEdge]: offsetEnd + '%',\n }}\n {...(orientation.sizeProp === 'width'\n ? {\n height: '100%',\n }\n : {\n left: 0,\n right: 0,\n })}\n />\n )\n }\n)\n\nSliderTrackActive.displayName = RANGE_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SliderThumb\n * -----------------------------------------------------------------------------------------------*/\n\nconst THUMB_NAME = 'SliderThumb'\n\n// TODO make this customizable through tamagui\n// so we can accurately use it for estimatedSize below\nconst getThumbSize = (val?: SizeTokens | number) => {\n const size = typeof val === 'number' ? val : getSize(val, -1)\n return {\n width: size,\n height: size,\n minWidth: size,\n minHeight: size,\n }\n}\n\nexport const SliderThumbFrame = styled(ThemeableStack, {\n name: 'SliderThumb',\n position: 'absolute',\n // TODO not taking up 2\n bordered: 2,\n // OR THIS\n borderWidth: 2,\n backgrounded: true,\n pressTheme: isWeb,\n focusTheme: isWeb,\n hoverTheme: isWeb,\n\n variants: {\n size: {\n '...size': getThumbSize,\n },\n },\n})\n\ntype SliderThumbElement = HTMLElement | View\ninterface SliderThumbProps extends SizableStackProps {\n index: number\n}\n\nconst SliderThumb = React.forwardRef<SliderThumbElement, SliderThumbProps>(\n (props: ScopedProps<SliderThumbProps>, forwardedRef) => {\n const { __scopeSlider, index, size: sizeProp, ...thumbProps } = props\n const context = useSliderContext(THUMB_NAME, __scopeSlider)\n const orientation = useSliderOrientationContext(THUMB_NAME, __scopeSlider)\n const [thumb, setThumb] = React.useState<View | HTMLElement | null>(null)\n const composedRefs = useComposedRefs(forwardedRef, (node) => setThumb(node))\n\n // We cast because index could be `-1` which would return undefined\n const value = context.values[index] as number | undefined\n const percent =\n value === undefined ? 0 : convertValueToPercentage(value, context.min, context.max)\n const label = getLabel(index, context.values.length)\n const [size, setSize] = React.useState(() => {\n // for SSR\n const estimatedSize = getVariableValue(getThumbSize(sizeProp).width)\n return estimatedSize\n })\n\n const thumbInBoundsOffset = size\n ? getThumbInBoundsOffset(size, percent, orientation.direction)\n : 0\n\n React.useEffect(() => {\n if (thumb) {\n context.thumbs.add(thumb)\n return () => {\n context.thumbs.delete(thumb)\n }\n }\n }, [thumb, context.thumbs])\n\n return (\n <SliderThumbFrame\n ref={composedRefs}\n // TODO\n // @ts-ignore\n role=\"slider\"\n aria-label={props['aria-label'] || label}\n aria-valuemin={context.min}\n aria-valuenow={value}\n aria-valuemax={context.max}\n aria-orientation={context.orientation}\n data-orientation={context.orientation}\n data-disabled={context.disabled ? '' : undefined}\n // TODO\n // @ts-ignore\n tabIndex={context.disabled ? undefined : 0}\n {...thumbProps}\n {...(context.orientation === 'horizontal'\n ? {\n x: thumbInBoundsOffset - size / 2,\n y: -size / 2,\n top: '50%',\n ...(size === 0 && {\n top: 'auto',\n bottom: 'auto',\n }),\n }\n : {\n x: -size / 2,\n y: size / 2,\n left: '50%',\n ...(size === 0 && {\n left: 'auto',\n right: 'auto',\n }),\n })}\n size={sizeProp ?? context.size ?? '$4'}\n onLayout={(e) => {\n setSize(e.nativeEvent.layout[orientation.sizeProp])\n }}\n {...{\n [orientation.startEdge]: `${percent}%`,\n }}\n /**\n * There will be no value on initial render while we work out the index so we hide thumbs\n * without a value, otherwise SSR will render them in the wrong position before they\n * snap into the correct position during hydration which would be visually jarring for\n * slower connections.\n */\n // style={value === undefined ? { display: 'none' } : props.style}\n onFocus={composeEventHandlers(props.onFocus, () => {\n context.valueIndexToChangeRef.current = index\n })}\n // temp fix to make slider work nicely on native\n // we just let the events propagate to the track\n {...(!isWeb && {\n pointerEvents: 'none',\n })}\n />\n )\n }\n)\n\nSliderThumb.displayName = THUMB_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * Slider\n * -----------------------------------------------------------------------------------------------*/\n\ntype SliderElement = SliderHorizontalElement | SliderVerticalElement\n\nconst Slider = withStaticProperties(\n React.forwardRef<SliderElement, SliderProps>((props: ScopedProps<SliderProps>, forwardedRef) => {\n const {\n name,\n min = 0,\n max = 100,\n step = 1,\n orientation = 'horizontal',\n disabled = false,\n minStepsBetweenThumbs = 0,\n defaultValue = [min],\n value,\n onValueChange = () => {},\n size: sizeProp,\n ...sliderProps\n } = props\n const sliderRef = React.useRef<SliderImplElement>(null)\n const composedRefs = useComposedRefs(sliderRef, forwardedRef)\n const thumbRefs = React.useRef<SliderContextValue['thumbs']>(new Set())\n const valueIndexToChangeRef = React.useRef<number>(0)\n const isHorizontal = orientation === 'horizontal'\n // We set this to true by default so that events bubble to forms without JS (SSR)\n // TODO\n // const isFormControl = slider ? Boolean(slider.closest('form')) : true\n\n const [values = [], setValues] = useControllableState({\n prop: value,\n defaultProp: defaultValue,\n onChange: (value) => {\n if (isWeb) {\n const thumbs = [...thumbRefs.current]\n thumbs[valueIndexToChangeRef.current]?.focus()\n }\n onValueChange(value)\n },\n })\n\n if (isWeb) {\n React.useEffect(() => {\n const node = sliderRef.current as HTMLElement\n if (!node) return\n const preventDefault = (e) => {\n e.preventDefault()\n }\n node.addEventListener('touchstart', preventDefault)\n return () => {\n node.removeEventListener('touchstart', preventDefault)\n }\n }, [])\n }\n\n function handleSlideMove(value: number) {\n updateValues(value, valueIndexToChangeRef.current)\n }\n\n function updateValues(value: number, atIndex: number) {\n const decimalCount = getDecimalCount(step)\n const snapToStep = roundValue(Math.round((value - min) / step) * step + min, decimalCount)\n const nextValue = clamp(snapToStep, [min, max])\n setValues((prevValues = []) => {\n const nextValues = getNextSortedValues(prevValues, nextValue, atIndex)\n if (hasMinStepsBetweenValues(nextValues, minStepsBetweenThumbs * step)) {\n valueIndexToChangeRef.current = nextValues.indexOf(nextValue)\n return String(nextValues) === String(prevValues) ? prevValues : nextValues\n } else {\n return prevValues\n }\n })\n }\n\n const SliderOriented = isHorizontal ? SliderHorizontal : SliderVertical\n\n return (\n <SliderProvider\n scope={props.__scopeSlider}\n disabled={disabled}\n min={min}\n max={max}\n valueIndexToChangeRef={valueIndexToChangeRef}\n thumbs={thumbRefs.current}\n values={values}\n orientation={orientation}\n size={sizeProp}\n >\n <SliderOriented\n aria-disabled={disabled}\n data-disabled={disabled ? '' : undefined}\n {...sliderProps}\n ref={composedRefs}\n min={min}\n max={max}\n onSlideStart={\n disabled\n ? undefined\n : (value: number, target) => {\n // when starting on the track, move it right away\n // when starting on thumb, dont jump until movemenet as it feels weird\n if (target !== 'thumb') {\n const closestIndex = getClosestValueIndex(values, value)\n updateValues(value, closestIndex)\n }\n }\n }\n onSlideMove={disabled ? undefined : handleSlideMove}\n onHomeKeyDown={() => !disabled && updateValues(min, 0)}\n onEndKeyDown={() => !disabled && updateValues(max, values.length - 1)}\n onStepKeyDown={({ event, direction: stepDirection }) => {\n if (!disabled) {\n const isPageKey = PAGE_KEYS.includes(event.key)\n const isSkipKey = isPageKey || (event.shiftKey && ARROW_KEYS.includes(event.key))\n const multiplier = isSkipKey ? 10 : 1\n const atIndex = valueIndexToChangeRef.current\n const value = values[atIndex]\n const stepInDirection = step * multiplier * stepDirection\n updateValues(value + stepInDirection, atIndex)\n }\n }}\n />\n {/* {isFormControl &&\n values.map((value, index) => (\n <BubbleInput\n key={index}\n name={name ? name + (values.length > 1 ? '[]' : '') : undefined}\n value={value}\n />\n ))} */}\n </SliderProvider>\n )\n }),\n {\n Track: SliderTrack,\n TrackActive: SliderTrackActive,\n Thumb: SliderThumb,\n }\n)\n\nSlider.displayName = SLIDER_NAME\n\n/* -----------------------------------------------------------------------------------------------*/\n\n// TODO\n// const BubbleInput = (props: any) => {\n// const { value, ...inputProps } = props\n// const ref = React.useRef<HTMLInputElement>(null)\n// const prevValue = usePrevious(value)\n\n// // Bubble value change to parents (e.g form change event)\n// React.useEffect(() => {\n// const input = ref.current!\n// const inputProto = window.HTMLInputElement.prototype\n// const descriptor = Object.getOwnPropertyDescriptor(inputProto, 'value') as PropertyDescriptor\n// const setValue = descriptor.set\n// if (prevValue !== value && setValue) {\n// const event = new Event('input', { bubbles: true })\n// setValue.call(input, value)\n// input.dispatchEvent(event)\n// }\n// }, [prevValue, value])\n\n// /**\n// * We purposefully do not use `type=\"hidden\"` here otherwise forms that\n// * wrap it will not be able to access its value via the FormData API.\n// *\n// * We purposefully do not add the `value` attribute here to allow the value\n// * to be set programatically and bubble to any parent form `onChange` event.\n// * Adding the `value` will cause React to consider the programatic\n// * dispatch a duplicate and it will get swallowed.\n// */\n// return <input style={{ display: 'none' }} {...inputProps} ref={ref} defaultValue={value} />\n// }\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Track = SliderTrack\nconst Range = SliderTrackActive\nconst Thumb = SliderThumb\n\nexport {\n Slider,\n SliderTrack,\n SliderTrackActive,\n SliderThumb,\n //\n Track,\n Range,\n Thumb,\n}\n\nexport type { SliderProps, SliderTrackProps, SliderTrackActiveProps, SliderThumbProps }\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,
|
|
4
|
+
"sourcesContent": ["// forked from radix-ui\n\nimport { composeRefs, useComposedRefs } from '@tamagui/compose-refs'\nimport {\n GetProps,\n SizeTokens,\n getSize,\n getVariableValue,\n isWeb,\n styled,\n withStaticProperties,\n} from '@tamagui/core'\nimport { clamp, composeEventHandlers } from '@tamagui/helpers'\nimport { SizableStackProps, ThemeableStack } from '@tamagui/stacks'\nimport { useControllableState } from '@tamagui/use-controllable-state'\nimport { useDirection } from '@tamagui/use-direction'\nimport * as React from 'react'\nimport { View } from 'react-native'\n\nimport {\n ARROW_KEYS,\n BACK_KEYS,\n PAGE_KEYS,\n SLIDER_NAME,\n SliderOrientationProvider,\n SliderProvider,\n useSliderContext,\n useSliderOrientationContext,\n} from './constants'\nimport {\n convertValueToPercentage,\n getClosestValueIndex,\n getDecimalCount,\n getLabel,\n getNextSortedValues,\n getThumbInBoundsOffset,\n hasMinStepsBetweenValues,\n linearScale,\n roundValue,\n} from './helpers'\nimport { SliderFrame, SliderImpl } from './SliderImpl'\nimport {\n ScopedProps,\n SliderContextValue,\n SliderHorizontalProps,\n SliderProps,\n SliderTrackProps,\n SliderVerticalProps,\n} from './types'\n\n/* -------------------------------------------------------------------------------------------------\n * SliderHorizontal\n * -----------------------------------------------------------------------------------------------*/\n\nconst SliderHorizontal = React.forwardRef<View, SliderHorizontalProps>(\n (props: ScopedProps<SliderHorizontalProps>, forwardedRef) => {\n const { min, max, dir, onSlideStart, onSlideMove, onStepKeyDown, ...sliderProps } = props\n const direction = useDirection(dir)\n const isDirectionLTR = direction === 'ltr'\n const sliderRef = React.useRef<View>(null)\n const [state, setState] = React.useState(() => ({ size: 0, offset: 0 }))\n\n function getValueFromPointer(pointerPosition: number) {\n const input: [number, number] = [0, state.size]\n const output: [number, number] = isDirectionLTR ? [min, max] : [max, min]\n const value = linearScale(input, output)\n return value(pointerPosition)\n }\n\n return (\n <SliderOrientationProvider\n scope={props.__scopeSlider}\n startEdge={isDirectionLTR ? 'left' : 'right'}\n endEdge={isDirectionLTR ? 'right' : 'left'}\n direction={isDirectionLTR ? 1 : -1}\n sizeProp=\"width\"\n size={state.size}\n >\n <SliderImpl\n ref={composeRefs(forwardedRef, sliderRef)}\n dir={direction}\n {...sliderProps}\n orientation=\"horizontal\"\n onLayout={() => {\n sliderRef.current?.measure((_x, _y, width, _height, pageX, _pageY) => {\n setState({\n size: width,\n offset: pageX,\n })\n })\n }}\n onSlideStart={(event, target) => {\n const value = getValueFromPointer(event.nativeEvent.locationX)\n if (value) {\n onSlideStart?.(value, target)\n }\n }}\n onSlideMove={(event) => {\n const value = getValueFromPointer(event.nativeEvent.pageX - state.offset)\n if (value) {\n onSlideMove?.(value)\n }\n }}\n onSlideEnd={() => {}}\n onStepKeyDown={(event) => {\n const isBackKey = BACK_KEYS[direction].includes(event.key)\n onStepKeyDown?.({ event, direction: isBackKey ? -1 : 1 })\n }}\n />\n </SliderOrientationProvider>\n )\n }\n)\n\n/* -------------------------------------------------------------------------------------------------\n * SliderVertical\n * -----------------------------------------------------------------------------------------------*/\n\nconst SliderVertical = React.forwardRef<View, SliderVerticalProps>(\n (props: ScopedProps<SliderVerticalProps>, forwardedRef) => {\n const { min, max, onSlideStart, onSlideMove, onStepKeyDown, ...sliderProps } = props\n const [state, setState] = React.useState(() => ({ size: 0, offset: 0 }))\n const sliderRef = React.useRef<View>(null)\n\n function getValueFromPointer(pointerPosition: number) {\n const input: [number, number] = [0, state.size]\n const output: [number, number] = [max, min]\n const value = linearScale(input, output)\n return value(pointerPosition)\n }\n\n return (\n <SliderOrientationProvider\n scope={props.__scopeSlider}\n startEdge=\"bottom\"\n endEdge=\"top\"\n sizeProp=\"height\"\n size={state.size}\n direction={1}\n >\n <SliderImpl\n ref={composeRefs(forwardedRef, sliderRef)}\n {...sliderProps}\n orientation=\"vertical\"\n onLayout={() => {\n sliderRef.current?.measure((_x, _y, _width, height, _pageX, pageY) => {\n setState({\n size: height,\n offset: pageY,\n })\n })\n }}\n onSlideStart={(event, target) => {\n const value = getValueFromPointer(event.nativeEvent.locationY)\n if (value) {\n onSlideStart?.(value, target)\n }\n }}\n onSlideMove={(event) => {\n const value = getValueFromPointer(event.nativeEvent.pageY - state.offset)\n if (value) {\n onSlideMove?.(value)\n }\n }}\n onSlideEnd={() => {}}\n onStepKeyDown={(event) => {\n const isBackKey = BACK_KEYS.ltr.includes(event.key)\n onStepKeyDown?.({ event, direction: isBackKey ? -1 : 1 })\n }}\n />\n </SliderOrientationProvider>\n )\n }\n)\n\n/* -------------------------------------------------------------------------------------------------\n * SliderTrack\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRACK_NAME = 'SliderTrack'\n\ntype SliderTrackElement = HTMLElement | View\n\nexport const SliderTrackFrame = styled(SliderFrame, {\n name: 'SliderTrack',\n height: '100%',\n width: '100%',\n backgroundColor: '$background',\n position: 'relative',\n borderRadius: 100_000,\n overflow: 'hidden',\n})\n\nconst SliderTrack = React.forwardRef<SliderTrackElement, SliderTrackProps>(\n (props: ScopedProps<SliderTrackProps>, forwardedRef) => {\n const { __scopeSlider, ...trackProps } = props\n const context = useSliderContext(TRACK_NAME, __scopeSlider)\n return (\n <SliderTrackFrame\n data-disabled={context.disabled ? '' : undefined}\n data-orientation={context.orientation}\n orientation={context.orientation}\n size={context.size}\n {...trackProps}\n ref={forwardedRef}\n />\n )\n }\n)\n\nSliderTrack.displayName = TRACK_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SliderTrackActive\n * -----------------------------------------------------------------------------------------------*/\n\nconst RANGE_NAME = 'SliderTrackActive'\n\nexport const SliderTrackActiveFrame = styled(SliderFrame, {\n name: 'SliderTrackActive',\n backgroundColor: '$background',\n position: 'absolute',\n})\n\ntype SliderTrackActiveProps = GetProps<typeof SliderTrackActiveFrame>\n\nconst SliderTrackActive = React.forwardRef<View, SliderTrackActiveProps>(\n (props: ScopedProps<SliderTrackActiveProps>, forwardedRef) => {\n const { __scopeSlider, ...rangeProps } = props\n const context = useSliderContext(RANGE_NAME, __scopeSlider)\n const orientation = useSliderOrientationContext(RANGE_NAME, __scopeSlider)\n const ref = React.useRef<View>(null)\n const composedRefs = useComposedRefs(forwardedRef, ref)\n const valuesCount = context.values.length\n const percentages = context.values.map((value) =>\n convertValueToPercentage(value, context.min, context.max)\n )\n const offsetStart = valuesCount > 1 ? Math.min(...percentages) : 0\n const offsetEnd = 100 - Math.max(...percentages)\n\n return (\n <SliderTrackActiveFrame\n orientation={context.orientation}\n data-orientation={context.orientation}\n data-disabled={context.disabled ? '' : undefined}\n size={context.size}\n {...rangeProps}\n ref={composedRefs}\n {...{\n [orientation.startEdge]: offsetStart + '%',\n [orientation.endEdge]: offsetEnd + '%',\n }}\n {...(orientation.sizeProp === 'width'\n ? {\n height: '100%',\n }\n : {\n left: 0,\n right: 0,\n })}\n />\n )\n }\n)\n\nSliderTrackActive.displayName = RANGE_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * SliderThumb\n * -----------------------------------------------------------------------------------------------*/\n\nconst THUMB_NAME = 'SliderThumb'\n\n// TODO make this customizable through tamagui\n// so we can accurately use it for estimatedSize below\nconst getThumbSize = (val?: SizeTokens | number) => {\n const size = typeof val === 'number' ? val : getSize(val, -1)\n return {\n width: size,\n height: size,\n minWidth: size,\n minHeight: size,\n }\n}\n\nexport const SliderThumbFrame = styled(ThemeableStack, {\n name: 'SliderThumb',\n position: 'absolute',\n // TODO not taking up 2\n bordered: 2,\n // OR THIS\n borderWidth: 2,\n backgrounded: true,\n pressTheme: isWeb,\n focusTheme: isWeb,\n hoverTheme: isWeb,\n\n variants: {\n size: {\n '...size': getThumbSize,\n },\n },\n})\n\ninterface SliderThumbProps extends SizableStackProps {\n index: number\n}\n\nconst SliderThumb = React.forwardRef<View, SliderThumbProps>(\n (props: ScopedProps<SliderThumbProps>, forwardedRef) => {\n const { __scopeSlider, index, size: sizeProp, ...thumbProps } = props\n const context = useSliderContext(THUMB_NAME, __scopeSlider)\n const orientation = useSliderOrientationContext(THUMB_NAME, __scopeSlider)\n const [thumb, setThumb] = React.useState<View | HTMLElement | null>(null)\n const composedRefs = useComposedRefs(forwardedRef, (node) => setThumb(node))\n\n // We cast because index could be `-1` which would return undefined\n const value = context.values[index] as number | undefined\n const percent =\n value === undefined ? 0 : convertValueToPercentage(value, context.min, context.max)\n const label = getLabel(index, context.values.length)\n const [size, setSize] = React.useState(() => {\n // for SSR\n const estimatedSize = getVariableValue(getThumbSize(sizeProp).width)\n return estimatedSize\n })\n\n const thumbInBoundsOffset = size\n ? getThumbInBoundsOffset(size, percent, orientation.direction)\n : 0\n\n React.useEffect(() => {\n if (thumb) {\n context.thumbs.add(thumb)\n return () => {\n context.thumbs.delete(thumb)\n }\n }\n }, [thumb, context.thumbs])\n\n return (\n <SliderThumbFrame\n ref={composedRefs}\n // TODO\n // @ts-ignore\n role=\"slider\"\n aria-label={props['aria-label'] || label}\n aria-valuemin={context.min}\n aria-valuenow={value}\n aria-valuemax={context.max}\n aria-orientation={context.orientation}\n data-orientation={context.orientation}\n data-disabled={context.disabled ? '' : undefined}\n tabIndex={context.disabled ? undefined : 0}\n {...thumbProps}\n {...(context.orientation === 'horizontal'\n ? {\n x: thumbInBoundsOffset - size / 2,\n y: -size / 2,\n top: '50%',\n ...(size === 0 && {\n top: 'auto',\n bottom: 'auto',\n }),\n }\n : {\n x: -size / 2,\n y: size / 2,\n left: '50%',\n ...(size === 0 && {\n left: 'auto',\n right: 'auto',\n }),\n })}\n size={sizeProp ?? context.size ?? '$4'}\n onLayout={(e) => {\n setSize(e.nativeEvent.layout[orientation.sizeProp])\n }}\n {...{\n [orientation.startEdge]: `${percent}%`,\n }}\n /**\n * There will be no value on initial render while we work out the index so we hide thumbs\n * without a value, otherwise SSR will render them in the wrong position before they\n * snap into the correct position during hydration which would be visually jarring for\n * slower connections.\n */\n // style={value === undefined ? { display: 'none' } : props.style}\n onFocus={composeEventHandlers(props.onFocus, () => {\n context.valueIndexToChangeRef.current = index\n })}\n />\n )\n }\n)\n\nSliderThumb.displayName = THUMB_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * Slider\n * -----------------------------------------------------------------------------------------------*/\n\nconst Slider = withStaticProperties(\n React.forwardRef<View, SliderProps>((props: ScopedProps<SliderProps>, forwardedRef) => {\n const {\n name,\n min = 0,\n max = 100,\n step = 1,\n orientation = 'horizontal',\n disabled = false,\n minStepsBetweenThumbs = 0,\n defaultValue = [min],\n value,\n onValueChange = () => {},\n size: sizeProp,\n ...sliderProps\n } = props\n const sliderRef = React.useRef<View>(null)\n const composedRefs = useComposedRefs(sliderRef, forwardedRef)\n const thumbRefs = React.useRef<SliderContextValue['thumbs']>(new Set())\n const valueIndexToChangeRef = React.useRef<number>(0)\n const isHorizontal = orientation === 'horizontal'\n // We set this to true by default so that events bubble to forms without JS (SSR)\n // const isFormControl =\n // sliderRef.current instanceof HTMLElement ? Boolean(sliderRef.current.closest('form')) : true\n\n const [values = [], setValues] = useControllableState({\n prop: value,\n defaultProp: defaultValue,\n onChange: (value) => {\n if (isWeb) {\n const thumbs = [...thumbRefs.current]\n thumbs[valueIndexToChangeRef.current]?.focus()\n }\n onValueChange(value)\n },\n })\n\n if (isWeb) {\n React.useEffect(() => {\n // @ts-ignore\n const node = sliderRef.current as HTMLElement\n if (!node) return\n const preventDefault = (e) => {\n e.preventDefault()\n }\n node.addEventListener('touchstart', preventDefault)\n return () => {\n node.removeEventListener('touchstart', preventDefault)\n }\n }, [])\n }\n\n function handleSlideMove(value: number) {\n updateValues(value, valueIndexToChangeRef.current)\n }\n\n function updateValues(value: number, atIndex: number) {\n const decimalCount = getDecimalCount(step)\n const snapToStep = roundValue(Math.round((value - min) / step) * step + min, decimalCount)\n const nextValue = clamp(snapToStep, [min, max])\n setValues((prevValues = []) => {\n const nextValues = getNextSortedValues(prevValues, nextValue, atIndex)\n if (hasMinStepsBetweenValues(nextValues, minStepsBetweenThumbs * step)) {\n valueIndexToChangeRef.current = nextValues.indexOf(nextValue)\n return String(nextValues) === String(prevValues) ? prevValues : nextValues\n } else {\n return prevValues\n }\n })\n }\n\n const SliderOriented = isHorizontal ? SliderHorizontal : SliderVertical\n\n return (\n <SliderProvider\n scope={props.__scopeSlider}\n disabled={disabled}\n min={min}\n max={max}\n valueIndexToChangeRef={valueIndexToChangeRef}\n thumbs={thumbRefs.current}\n values={values}\n orientation={orientation}\n size={sizeProp}\n >\n <SliderOriented\n aria-disabled={disabled}\n data-disabled={disabled ? '' : undefined}\n {...sliderProps}\n ref={composedRefs}\n min={min}\n max={max}\n onSlideStart={\n disabled\n ? undefined\n : (value: number, target) => {\n // when starting on the track, move it right away\n // when starting on thumb, dont jump until movemenet as it feels weird\n if (target !== 'thumb') {\n const closestIndex = getClosestValueIndex(values, value)\n updateValues(value, closestIndex)\n }\n }\n }\n onSlideMove={disabled ? undefined : handleSlideMove}\n onHomeKeyDown={() => !disabled && updateValues(min, 0)}\n onEndKeyDown={() => !disabled && updateValues(max, values.length - 1)}\n onStepKeyDown={({ event, direction: stepDirection }) => {\n if (!disabled) {\n const isPageKey = PAGE_KEYS.includes(event.key)\n const isSkipKey = isPageKey || (event.shiftKey && ARROW_KEYS.includes(event.key))\n const multiplier = isSkipKey ? 10 : 1\n const atIndex = valueIndexToChangeRef.current\n const value = values[atIndex]\n const stepInDirection = step * multiplier * stepDirection\n updateValues(value + stepInDirection, atIndex)\n }\n }}\n />\n {/* {isFormControl &&\n values.map((value, index) => (\n <BubbleInput\n key={index}\n name={name ? name + (values.length > 1 ? '[]' : '') : undefined}\n value={value}\n />\n ))} */}\n </SliderProvider>\n )\n }),\n {\n Track: SliderTrack,\n TrackActive: SliderTrackActive,\n Thumb: SliderThumb,\n }\n)\n\nSlider.displayName = SLIDER_NAME\n\n/* -----------------------------------------------------------------------------------------------*/\n\n// // TODO\n// const BubbleInput = (props: any) => {\n// const { value, ...inputProps } = props\n// const ref = React.useRef<HTMLInputElement>(null)\n// const prevValue = usePrevious(value)\n\n// // Bubble value change to parents (e.g form change event)\n// React.useEffect(() => {\n// const input = ref.current!\n// const inputProto = window.HTMLInputElement.prototype\n// const descriptor = Object.getOwnPropertyDescriptor(inputProto, 'value') as PropertyDescriptor\n// const setValue = descriptor.set\n// if (prevValue !== value && setValue) {\n// const event = new Event('input', { bubbles: true })\n// setValue.call(input, value)\n// input.dispatchEvent(event)\n// }\n// }, [prevValue, value])\n\n// /**\n// * We purposefully do not use `type=\"hidden\"` here otherwise forms that\n// * wrap it will not be able to access its value via the FormData API.\n// *\n// * We purposefully do not add the `value` attribute here to allow the value\n// * to be set programatically and bubble to any parent form `onChange` event.\n// * Adding the `value` will cause React to consider the programatic\n// * dispatch a duplicate and it will get swallowed.\n// */\n// return <input style={{ display: 'none' }} {...inputProps} ref={ref} defaultValue={value} />\n// }\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Track = SliderTrack\nconst Range = SliderTrackActive\nconst Thumb = SliderThumb\n\nexport {\n Slider,\n SliderTrack,\n SliderTrackActive,\n SliderThumb,\n //\n Track,\n Range,\n Thumb,\n}\n\nexport type { SliderProps, SliderTrackProps, SliderTrackActiveProps, SliderThumbProps }\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,0BAA6C;AAC7C,kBAQO;AACP,qBAA4C;AAC5C,oBAAkD;AAClD,oCAAqC;AACrC,2BAA6B;AAC7B,YAA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ardedRef) => {
|
|
|
130
130
|
onScrollShouldSetResponderCapture: () => true,
|
|
131
131
|
onMoveShouldSetResponder: () => true,
|
|
132
132
|
onStartShouldSetResponder: () => true,
|
|
133
|
-
onStartShouldSetResponderCapture: () => true,
|
|
134
133
|
onResponderTerminationRequest: () => {
|
|
135
|
-
console.log("got??/");
|
|
136
134
|
return false;
|
|
137
135
|
},
|
|
138
136
|
onResponderGrant: (0, import_core.composeEventHandlers)(props.onResponderGrant, (event) => {
|
|
139
137
|
const target = event.target;
|
|
140
|
-
|
|
138
|
+
console.log("target", target, context.thumbs.has(target), context.thumbs);
|
|
139
|
+
const isStartingOnThumb = context.thumbs.has(target);
|
|
141
140
|
if (import_core.isWeb && target instanceof HTMLElement) {
|
|
142
141
|
if (context.thumbs.has(target)) {
|
|
143
142
|
target.focus();
|
|
@@ -146,7 +145,6 @@ const SliderImpl = React.forwardRef((props, forwardedRef) => {
|
|
|
146
145
|
onSlideStart(event, isStartingOnThumb ? "thumb" : "track");
|
|
147
146
|
}),
|
|
148
147
|
onResponderMove: (0, import_core.composeEventHandlers)(props.onResponderMove, (event) => {
|
|
149
|
-
console.log("gogo");
|
|
150
148
|
event.preventDefault();
|
|
151
149
|
event.stopPropagation();
|
|
152
150
|
onSlideMove(event);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/SliderImpl.tsx"],
|
|
4
|
-
"sourcesContent": ["/* -------------------------------------------------------------------------------------------------\n * SliderImpl\n * -----------------------------------------------------------------------------------------------*/\n\nimport { composeEventHandlers, getSize, getVariableValue, isWeb, styled } from '@tamagui/core'\nimport { YStack } from '@tamagui/stacks'\nimport * as React from 'react'\n\nimport { ARROW_KEYS, PAGE_KEYS, SLIDER_NAME, useSliderContext } from './constants'\nimport { ScopedProps,
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,kBAA+E;AAC/E,oBAAuB;AACvB,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* -------------------------------------------------------------------------------------------------\n * SliderImpl\n * -----------------------------------------------------------------------------------------------*/\n\nimport { composeEventHandlers, getSize, getVariableValue, isWeb, styled } from '@tamagui/core'\nimport { YStack } from '@tamagui/stacks'\nimport * as React from 'react'\nimport { View } from 'react-native'\n\nimport { ARROW_KEYS, PAGE_KEYS, SLIDER_NAME, useSliderContext } from './constants'\nimport { ScopedProps, SliderImplProps } from './types'\n\nexport const DirectionalYStack = styled(YStack, {\n variants: {\n orientation: {\n horizontal: {},\n vertical: {},\n },\n },\n})\n\nexport const SliderFrame = styled(DirectionalYStack, {\n position: 'relative',\n\n variants: {\n size: (val, extras) => {\n const orientation = extras.props.orientation\n const size = Math.round(getVariableValue(getSize(val)) / 6)\n if (orientation === 'horizontal') {\n return {\n height: size,\n borderRadius: size,\n justifyContent: 'center',\n }\n }\n return {\n width: size,\n borderRadius: size,\n alignItems: 'center',\n }\n },\n },\n})\n\nexport const SliderImpl = React.forwardRef<View, SliderImplProps>(\n (props: ScopedProps<SliderImplProps>, forwardedRef) => {\n const {\n __scopeSlider,\n onSlideStart,\n onSlideMove,\n onSlideEnd,\n onHomeKeyDown,\n onEndKeyDown,\n onStepKeyDown,\n ...sliderProps\n } = props\n const context = useSliderContext(SLIDER_NAME, __scopeSlider)\n return (\n <SliderFrame\n size=\"$4\"\n {...sliderProps}\n data-orientation={sliderProps.orientation}\n ref={forwardedRef}\n {...(isWeb && {\n onKeyDown: (event) => {\n if (event.key === 'Home') {\n onHomeKeyDown(event)\n // Prevent scrolling to page start\n event.preventDefault()\n } else if (event.key === 'End') {\n onEndKeyDown(event)\n // Prevent scrolling to page end\n event.preventDefault()\n } else if (PAGE_KEYS.concat(ARROW_KEYS).includes(event.key)) {\n onStepKeyDown(event)\n // Prevent scrolling for directional key presses\n event.preventDefault()\n }\n },\n })}\n onMoveShouldSetResponderCapture={() => true}\n onScrollShouldSetResponder={() => true}\n onScrollShouldSetResponderCapture={() => true}\n onMoveShouldSetResponder={() => true}\n onStartShouldSetResponder={() => true}\n // onStartShouldSetResponderCapture={() => true}\n onResponderTerminationRequest={() => {\n return false\n }}\n onResponderGrant={composeEventHandlers(props.onResponderGrant, (event) => {\n const target = event.target as HTMLElement | number\n console.log('target', target, context.thumbs.has(target), context.thumbs)\n const isStartingOnThumb = context.thumbs.has(target)\n // // Prevent browser focus behaviour because we focus a thumb manually when values change.\n // Touch devices have a delay before focusing so won't focus if touch immediately moves\n // away from target (sliding). We want thumb to focus regardless.\n if (isWeb && target instanceof HTMLElement) {\n if (context.thumbs.has(target)) {\n target.focus()\n }\n }\n onSlideStart(event, isStartingOnThumb ? 'thumb' : 'track')\n })}\n onResponderMove={composeEventHandlers(props.onResponderMove, (event) => {\n event.preventDefault()\n event.stopPropagation()\n\n // const target = event.target as HTMLElement\n onSlideMove(event)\n })}\n onResponderRelease={composeEventHandlers(props.onResponderRelease, (event) => {\n // const target = event.target as HTMLElement\n onSlideEnd(event)\n })}\n />\n )\n }\n)\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,kBAA+E;AAC/E,oBAAuB;AACvB,YAAuB;AAGvB,uBAAqE;AAG9D,MAAM,oBAAoB,wBAAO,sBAAQ;AAAA,EAC9C,UAAU;AAAA,IACR,aAAa;AAAA,MACX,YAAY,CAAC;AAAA,MACb,UAAU,CAAC;AAAA,IACb;AAAA,EACF;AACF,CAAC;AAEM,MAAM,cAAc,wBAAO,mBAAmB;AAAA,EACnD,UAAU;AAAA,EAEV,UAAU;AAAA,IACR,MAAM,CAAC,KAAK,WAAW;AACrB,YAAM,cAAc,OAAO,MAAM;AACjC,YAAM,OAAO,KAAK,MAAM,kCAAiB,yBAAQ,GAAG,CAAC,IAAI,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,IAAI,UAAU,QAAQ,QAAQ,OAAO,IAAI,MAAM,GAAG,QAAQ,MAAM;AACxE,YAAM,oBAAoB,QAAQ,OAAO,IAAI,MAAM;AAInD,UAAI,qBAAS,kBAAkB,aAAa;AAC1C,YAAI,QAAQ,OAAO,IAAI,MAAM,GAAG;AAC9B,iBAAO,MAAM;AAAA,QACf;AAAA,MACF;AACA,mBAAa,OAAO,oBAAoB,UAAU,OAAO;AAAA,IAC3D,CAAC;AAAA,IACD,iBAAiB,sCAAqB,MAAM,iBAAiB,CAAC,UAAU;AACtE,YAAM,eAAe;AACrB,YAAM,gBAAgB;AAGtB,kBAAY,KAAK;AAAA,IACnB,CAAC;AAAA,IACD,oBAAoB,sCAAqB,MAAM,oBAAoB,CAAC,UAAU;AAE5E,iBAAW,KAAK;AAAA,IAClB,CAAC;AAAA,IACH;AAEJ,CACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/constants.js
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/cjs/helpers.js
CHANGED
|
File without changes
|
package/dist/cjs/helpers.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/helpers.tsx"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["export function getNextSortedValues(prevValues: number[] = [], nextValue: number, atIndex: number) {\n const nextValues = [...prevValues]\n nextValues[atIndex] = nextValue\n return nextValues.sort((a, b) => a - b)\n}\n\nexport function convertValueToPercentage(value: number, min: number, max: number) {\n const maxSteps = max - min\n const percentPerStep = 100 / maxSteps\n return percentPerStep * (value - min)\n}\n\n/**\n * Returns a label for each thumb when there are two or more thumbs\n */\nexport function getLabel(index: number, totalValues: number) {\n if (totalValues > 2) {\n return `Value ${index + 1} of ${totalValues}`\n } else if (totalValues === 2) {\n return ['Minimum', 'Maximum'][index]\n } else {\n return undefined\n }\n}\n\n/**\n * Given a `values` array and a `nextValue`, determine which value in\n * the array is closest to `nextValue` and return its index.\n *\n * @example\n * // returns 1\n * getClosestValueIndex([10, 30], 25);\n */\nexport function getClosestValueIndex(values: number[], nextValue: number) {\n if (values.length === 1) return 0\n const distances = values.map((value) => Math.abs(value - nextValue))\n const closestDistance = Math.min(...distances)\n return distances.indexOf(closestDistance)\n}\n\n/**\n * Offsets the thumb centre point while sliding to ensure it remains\n * within the bounds of the slider when reaching the edges\n */\nexport function getThumbInBoundsOffset(width: number, left: number, direction: number) {\n const halfWidth = width / 2\n const halfPercent = 50\n const offset = linearScale([0, halfPercent], [0, halfWidth])\n return (halfWidth - offset(left) * direction) * direction\n}\n\n/**\n * Gets an array of steps between each value.\n *\n * @example\n * // returns [1, 9]\n * getStepsBetweenValues([10, 11, 20]);\n */\nfunction getStepsBetweenValues(values: number[]) {\n return values.slice(0, -1).map((value, index) => values[index + 1] - value)\n}\n\n/**\n * Verifies the minimum steps between all values is greater than or equal\n * to the expected minimum steps.\n *\n * @example\n * // returns false\n * hasMinStepsBetweenValues([1,2,3], 2);\n *\n * @example\n * // returns true\n * hasMinStepsBetweenValues([1,2,3], 1);\n */\nexport function hasMinStepsBetweenValues(values: number[], minStepsBetweenValues: number) {\n if (minStepsBetweenValues > 0) {\n const stepsBetweenValues = getStepsBetweenValues(values)\n const actualMinStepsBetweenValues = Math.min(...stepsBetweenValues)\n return actualMinStepsBetweenValues >= minStepsBetweenValues\n }\n return true\n}\n\n// https://github.com/tmcw-up-for-adoption/simple-linear-scale/blob/master/index.js\nexport function linearScale(input: readonly [number, number], output: readonly [number, number]) {\n return (value: number) => {\n if (input[0] === input[1] || output[0] === output[1]) return output[0]\n const ratio = (output[1] - output[0]) / (input[1] - input[0])\n return output[0] + ratio * (value - input[0])\n }\n}\n\nexport function getDecimalCount(value: number) {\n return (String(value).split('.')[1] || '').length\n}\n\nexport function roundValue(value: number, decimalCount: number) {\n const rounder = Math.pow(10, decimalCount)\n return Math.round(value * rounder) / rounder\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,6BAA6B,aAAuB,CAAC,GAAG,WAAmB,SAAiB;AACjG,QAAM,aAAa,CAAC,GAAG,UAAU;AACjC,aAAW,WAAW;AACtB,SAAO,WAAW,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC;AACxC;AAEO,kCAAkC,OAAe,KAAa,KAAa;AAChF,QAAM,WAAW,MAAM;AACvB,QAAM,iBAAiB,MAAM;AAC7B,SAAO,iBAAkB,SAAQ;AACnC;AAKO,kBAAkB,OAAe,aAAqB;AAC3D,MAAI,cAAc,GAAG;AACnB,WAAO,SAAS,QAAQ,QAAQ;AAAA,EAClC,WAAW,gBAAgB,GAAG;AAC5B,WAAO,CAAC,WAAW,SAAS,EAAE;AAAA,EAChC,OAAO;AACL,WAAO;AAAA,EACT;AACF;AAUO,8BAA8B,QAAkB,WAAmB;AACxE,MAAI,OAAO,WAAW;AAAG,WAAO;AAChC,QAAM,YAAY,OAAO,IAAI,CAAC,UAAU,KAAK,IAAI,QAAQ,SAAS,CAAC;AACnE,QAAM,kBAAkB,KAAK,IAAI,GAAG,SAAS;AAC7C,SAAO,UAAU,QAAQ,eAAe;AAC1C;AAMO,gCAAgC,OAAe,MAAc,WAAmB;AACrF,QAAM,YAAY,QAAQ;AAC1B,QAAM,cAAc;AACpB,QAAM,SAAS,YAAY,CAAC,GAAG,WAAW,GAAG,CAAC,GAAG,SAAS,CAAC;AAC3D,SAAQ,aAAY,OAAO,IAAI,IAAI,aAAa;AAClD;AASA,+BAA+B,QAAkB;AAC/C,SAAO,OAAO,MAAM,GAAG,EAAE,EAAE,IAAI,CAAC,OAAO,UAAU,OAAO,QAAQ,KAAK,KAAK;AAC5E;AAcO,kCAAkC,QAAkB,uBAA+B;AACxF,MAAI,wBAAwB,GAAG;AAC7B,UAAM,qBAAqB,sBAAsB,MAAM;AACvD,UAAM,8BAA8B,KAAK,IAAI,GAAG,kBAAkB;AAClE,WAAO,+BAA+B;AAAA,EACxC;AACA,SAAO;AACT;AAGO,qBAAqB,OAAkC,QAAmC;AAC/F,SAAO,CAAC,UAAkB;AACxB,QAAI,MAAM,OAAO,MAAM,MAAM,OAAO,OAAO,OAAO;AAAI,aAAO,OAAO;AACpE,UAAM,QAAS,QAAO,KAAK,OAAO,MAAO,OAAM,KAAK,MAAM;AAC1D,WAAO,OAAO,KAAK,QAAS,SAAQ,MAAM;AAAA,EAC5C;AACF;AAEO,yBAAyB,OAAe;AAC7C,SAAQ,QAAO,KAAK,EAAE,MAAM,GAAG,EAAE,MAAM,IAAI;AAC7C;AAEO,oBAAoB,OAAe,cAAsB;AAC9D,QAAM,UAAU,KAAK,IAAI,IAAI,YAAY;AACzC,SAAO,KAAK,MAAM,QAAQ,OAAO,IAAI;AACvC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
|
File without changes
|
package/dist/cjs/index.js.map
CHANGED
|
File without changes
|
package/dist/cjs/types.js
CHANGED
|
File without changes
|
package/dist/cjs/types.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/types.ts"],
|
|
4
|
-
"sourcesContent": ["import type { GestureReponderEvent, SizeTokens } from '@tamagui/core'\nimport type { Scope } from '@tamagui/create-context'\nimport type { SizableStackProps } from '@tamagui/stacks'\
|
|
4
|
+
"sourcesContent": ["import type { GestureReponderEvent, SizeTokens } from '@tamagui/core'\nimport type { Scope } from '@tamagui/create-context'\nimport type { SizableStackProps } from '@tamagui/stacks'\n\nexport type ScopedProps<P> = P & { __scopeSlider?: Scope }\n\nexport type Direction = 'ltr' | 'rtl'\n\ntype SliderImplPrivateProps = {\n onSlideStart(event: GestureReponderEvent, target: 'thumb' | 'track'): void\n onSlideMove(event: GestureReponderEvent): void\n onSlideEnd(event: GestureReponderEvent): void\n onHomeKeyDown(event: React.KeyboardEvent): void\n onEndKeyDown(event: React.KeyboardEvent): void\n onStepKeyDown(event: React.KeyboardEvent): void\n}\n\nexport interface SliderTrackProps extends SizableStackProps {}\n\nexport interface SliderImplProps extends SliderTrackProps, SliderImplPrivateProps {\n dir?: Direction\n orientation: 'horizontal' | 'vertical'\n}\n\ntype SliderOrientationPrivateProps = {\n min: number\n max: number\n onSlideStart?(value: number, target: 'thumb' | 'track'): void\n onSlideMove?(value: number): void\n onHomeKeyDown(event: React.KeyboardEvent): void\n onEndKeyDown(event: React.KeyboardEvent): void\n onStepKeyDown(step: { event: React.KeyboardEvent; direction: number }): void\n}\n\ninterface SliderOrientationProps\n extends Omit<SliderImplProps, keyof SliderImplPrivateProps | 'orientation'>,\n SliderOrientationPrivateProps {}\n\nexport interface SliderHorizontalProps extends SliderOrientationProps {\n dir?: Direction\n}\n\nexport interface SliderVerticalProps extends SliderOrientationProps {\n dir?: Direction\n}\n\nexport interface SliderProps\n extends Omit<\n SliderHorizontalProps | SliderVerticalProps,\n keyof SliderOrientationPrivateProps | 'defaultValue'\n > {\n size?: SizeTokens\n name?: string\n disabled?: boolean\n orientation?: React.AriaAttributes['aria-orientation']\n dir?: Direction\n min?: number\n max?: number\n step?: number\n minStepsBetweenThumbs?: number\n value?: number[]\n defaultValue?: number[]\n onValueChange?(value: number[]): void\n}\n\nexport type SliderContextValue = {\n size?: SizeTokens | number | null\n disabled?: boolean\n min: number\n max: number\n values: number[]\n valueIndexToChangeRef: React.MutableRefObject<number>\n thumbs: Set<any>\n orientation: SliderProps['orientation']\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/Slider.js
CHANGED
|
@@ -29,7 +29,7 @@ var __objRest = (source, exclude) => {
|
|
|
29
29
|
}
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
|
-
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
32
|
+
import { composeRefs, useComposedRefs } from "@tamagui/compose-refs";
|
|
33
33
|
import {
|
|
34
34
|
getSize,
|
|
35
35
|
getVariableValue,
|
|
@@ -68,13 +68,10 @@ const SliderHorizontal = React.forwardRef((props, forwardedRef) => {
|
|
|
68
68
|
const _a = props, { min, max, dir, onSlideStart, onSlideMove, onStepKeyDown } = _a, sliderProps = __objRest(_a, ["min", "max", "dir", "onSlideStart", "onSlideMove", "onStepKeyDown"]);
|
|
69
69
|
const direction = useDirection(dir);
|
|
70
70
|
const isDirectionLTR = direction === "ltr";
|
|
71
|
-
const
|
|
72
|
-
const [
|
|
71
|
+
const sliderRef = React.useRef(null);
|
|
72
|
+
const [state, setState] = React.useState(() => ({ size: 0, offset: 0 }));
|
|
73
73
|
function getValueFromPointer(pointerPosition) {
|
|
74
|
-
const
|
|
75
|
-
if (!layout)
|
|
76
|
-
return;
|
|
77
|
-
const input = [0, layout.width];
|
|
74
|
+
const input = [0, state.size];
|
|
78
75
|
const output = isDirectionLTR ? [min, max] : [max, min];
|
|
79
76
|
const value = linearScale(input, output);
|
|
80
77
|
return value(pointerPosition);
|
|
@@ -85,16 +82,20 @@ const SliderHorizontal = React.forwardRef((props, forwardedRef) => {
|
|
|
85
82
|
endEdge: isDirectionLTR ? "right" : "left",
|
|
86
83
|
direction: isDirectionLTR ? 1 : -1,
|
|
87
84
|
sizeProp: "width",
|
|
88
|
-
size
|
|
85
|
+
size: state.size
|
|
89
86
|
}, /* @__PURE__ */ React.createElement(SliderImpl, __spreadProps(__spreadValues({
|
|
90
|
-
ref: forwardedRef,
|
|
87
|
+
ref: composeRefs(forwardedRef, sliderRef),
|
|
91
88
|
dir: direction
|
|
92
89
|
}, sliderProps), {
|
|
93
90
|
orientation: "horizontal",
|
|
94
|
-
onLayout: (
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
91
|
+
onLayout: () => {
|
|
92
|
+
var _a2;
|
|
93
|
+
(_a2 = sliderRef.current) == null ? void 0 : _a2.measure((_x, _y, width, _height, pageX, _pageY) => {
|
|
94
|
+
setState({
|
|
95
|
+
size: width,
|
|
96
|
+
offset: pageX
|
|
97
|
+
});
|
|
98
|
+
});
|
|
98
99
|
},
|
|
99
100
|
onSlideStart: (event, target) => {
|
|
100
101
|
const value = getValueFromPointer(event.nativeEvent.locationX);
|
|
@@ -103,7 +104,7 @@ const SliderHorizontal = React.forwardRef((props, forwardedRef) => {
|
|
|
103
104
|
}
|
|
104
105
|
},
|
|
105
106
|
onSlideMove: (event) => {
|
|
106
|
-
const value = getValueFromPointer(event.nativeEvent.
|
|
107
|
+
const value = getValueFromPointer(event.nativeEvent.pageX - state.offset);
|
|
107
108
|
if (value) {
|
|
108
109
|
onSlideMove == null ? void 0 : onSlideMove(value);
|
|
109
110
|
}
|
|
@@ -118,13 +119,10 @@ const SliderHorizontal = React.forwardRef((props, forwardedRef) => {
|
|
|
118
119
|
});
|
|
119
120
|
const SliderVertical = React.forwardRef((props, forwardedRef) => {
|
|
120
121
|
const _a = props, { min, max, onSlideStart, onSlideMove, onStepKeyDown } = _a, sliderProps = __objRest(_a, ["min", "max", "onSlideStart", "onSlideMove", "onStepKeyDown"]);
|
|
121
|
-
const
|
|
122
|
-
const
|
|
122
|
+
const [state, setState] = React.useState(() => ({ size: 0, offset: 0 }));
|
|
123
|
+
const sliderRef = React.useRef(null);
|
|
123
124
|
function getValueFromPointer(pointerPosition) {
|
|
124
|
-
const
|
|
125
|
-
if (!layout)
|
|
126
|
-
return;
|
|
127
|
-
const input = [0, layout.height];
|
|
125
|
+
const input = [0, state.size];
|
|
128
126
|
const output = [max, min];
|
|
129
127
|
const value = linearScale(input, output);
|
|
130
128
|
return value(pointerPosition);
|
|
@@ -134,16 +132,20 @@ const SliderVertical = React.forwardRef((props, forwardedRef) => {
|
|
|
134
132
|
startEdge: "bottom",
|
|
135
133
|
endEdge: "top",
|
|
136
134
|
sizeProp: "height",
|
|
137
|
-
size,
|
|
135
|
+
size: state.size,
|
|
138
136
|
direction: 1
|
|
139
137
|
}, /* @__PURE__ */ React.createElement(SliderImpl, __spreadProps(__spreadValues({
|
|
140
|
-
ref: forwardedRef
|
|
138
|
+
ref: composeRefs(forwardedRef, sliderRef)
|
|
141
139
|
}, sliderProps), {
|
|
142
140
|
orientation: "vertical",
|
|
143
|
-
onLayout: (
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
141
|
+
onLayout: () => {
|
|
142
|
+
var _a2;
|
|
143
|
+
(_a2 = sliderRef.current) == null ? void 0 : _a2.measure((_x, _y, _width, height, _pageX, pageY) => {
|
|
144
|
+
setState({
|
|
145
|
+
size: height,
|
|
146
|
+
offset: pageY
|
|
147
|
+
});
|
|
148
|
+
});
|
|
147
149
|
},
|
|
148
150
|
onSlideStart: (event, target) => {
|
|
149
151
|
const value = getValueFromPointer(event.nativeEvent.locationY);
|
|
@@ -152,7 +154,7 @@ const SliderVertical = React.forwardRef((props, forwardedRef) => {
|
|
|
152
154
|
}
|
|
153
155
|
},
|
|
154
156
|
onSlideMove: (event) => {
|
|
155
|
-
const value = getValueFromPointer(event.nativeEvent.
|
|
157
|
+
const value = getValueFromPointer(event.nativeEvent.pageY - state.offset);
|
|
156
158
|
if (value) {
|
|
157
159
|
onSlideMove == null ? void 0 : onSlideMove(value);
|
|
158
160
|
}
|
|
@@ -269,7 +271,7 @@ const SliderThumb = React.forwardRef((props, forwardedRef) => {
|
|
|
269
271
|
};
|
|
270
272
|
}
|
|
271
273
|
}, [thumb, context.thumbs]);
|
|
272
|
-
return /* @__PURE__ */ React.createElement(SliderThumbFrame,
|
|
274
|
+
return /* @__PURE__ */ React.createElement(SliderThumbFrame, __spreadProps(__spreadValues(__spreadProps(__spreadValues(__spreadValues({
|
|
273
275
|
ref: composedRefs,
|
|
274
276
|
role: "slider",
|
|
275
277
|
"aria-label": props["aria-label"] || label,
|
|
@@ -305,8 +307,6 @@ const SliderThumb = React.forwardRef((props, forwardedRef) => {
|
|
|
305
307
|
onFocus: composeEventHandlers(props.onFocus, () => {
|
|
306
308
|
context.valueIndexToChangeRef.current = index;
|
|
307
309
|
})
|
|
308
|
-
}), !isWeb && {
|
|
309
|
-
pointerEvents: "none"
|
|
310
310
|
}));
|
|
311
311
|
});
|
|
312
312
|
SliderThumb.displayName = THUMB_NAME;
|