@tamagui/slider 1.13.3 → 1.14.0
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 +1 -481
- package/dist/cjs/Slider.js.map +2 -2
- package/dist/cjs/SliderImpl.js +1 -139
- package/dist/cjs/SliderImpl.js.map +2 -2
- package/dist/cjs/constants.js +1 -62
- package/dist/cjs/constants.js.map +2 -2
- package/dist/cjs/helpers.js +1 -101
- package/dist/cjs/helpers.js.map +2 -2
- package/dist/cjs/index.js +1 -32
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/types.js +1 -16
- package/dist/cjs/types.js.map +2 -2
- package/dist/esm/Slider.js +1 -462
- package/dist/esm/Slider.js.map +2 -2
- package/dist/esm/Slider.mjs +1 -462
- package/dist/esm/Slider.mjs.map +2 -2
- package/dist/esm/SliderImpl.js +1 -103
- package/dist/esm/SliderImpl.js.map +2 -2
- package/dist/esm/SliderImpl.mjs +1 -103
- package/dist/esm/SliderImpl.mjs.map +2 -2
- package/dist/esm/constants.js +1 -29
- package/dist/esm/constants.js.map +2 -2
- package/dist/esm/constants.mjs +1 -29
- package/dist/esm/constants.mjs.map +2 -2
- package/dist/esm/helpers.js +1 -69
- package/dist/esm/helpers.js.map +2 -2
- package/dist/esm/helpers.mjs +1 -69
- package/dist/esm/helpers.mjs.map +2 -2
- package/dist/esm/index.js +1 -6
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/index.mjs +1 -6
- package/dist/esm/index.mjs.map +2 -2
- package/dist/jsx/Slider.js +1 -428
- package/dist/jsx/Slider.js.map +2 -2
- package/dist/jsx/Slider.mjs +1 -428
- package/dist/jsx/Slider.mjs.map +2 -2
- package/dist/jsx/SliderImpl.js +1 -99
- package/dist/jsx/SliderImpl.js.map +2 -2
- package/dist/jsx/SliderImpl.mjs +1 -99
- package/dist/jsx/SliderImpl.mjs.map +2 -2
- package/dist/jsx/constants.js +1 -29
- package/dist/jsx/constants.js.map +2 -2
- package/dist/jsx/constants.mjs +1 -29
- package/dist/jsx/constants.mjs.map +2 -2
- package/dist/jsx/helpers.js +1 -69
- package/dist/jsx/helpers.js.map +2 -2
- package/dist/jsx/helpers.mjs +1 -69
- package/dist/jsx/helpers.mjs.map +2 -2
- package/dist/jsx/index.js +1 -6
- package/dist/jsx/index.js.map +2 -2
- package/dist/jsx/index.mjs +1 -6
- package/dist/jsx/index.mjs.map +2 -2
- package/package.json +10 -10
package/dist/cjs/SliderImpl.js
CHANGED
|
@@ -1,140 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var SliderImpl_exports = {};
|
|
30
|
-
__export(SliderImpl_exports, {
|
|
31
|
-
DirectionalYStack: () => DirectionalYStack,
|
|
32
|
-
SliderFrame: () => SliderFrame,
|
|
33
|
-
SliderImpl: () => SliderImpl
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(SliderImpl_exports);
|
|
36
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
-
var import_core = require("@tamagui/core");
|
|
38
|
-
var import_get_size = require("@tamagui/get-size");
|
|
39
|
-
var import_stacks = require("@tamagui/stacks");
|
|
40
|
-
var React = __toESM(require("react"));
|
|
41
|
-
var import_constants = require("./constants");
|
|
42
|
-
const DirectionalYStack = (0, import_core.styled)(import_stacks.YStack, {
|
|
43
|
-
variants: {
|
|
44
|
-
orientation: {
|
|
45
|
-
horizontal: {},
|
|
46
|
-
vertical: {}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
const SliderFrame = (0, import_core.styled)(DirectionalYStack, {
|
|
51
|
-
position: "relative",
|
|
52
|
-
variants: {
|
|
53
|
-
size: (val, extras) => {
|
|
54
|
-
const orientation = extras.props.orientation;
|
|
55
|
-
const size = Math.round((0, import_core.getVariableValue)((0, import_get_size.getSize)(val)) / 6);
|
|
56
|
-
if (orientation === "horizontal") {
|
|
57
|
-
return {
|
|
58
|
-
height: size,
|
|
59
|
-
borderRadius: size,
|
|
60
|
-
justifyContent: "center"
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
return {
|
|
64
|
-
width: size,
|
|
65
|
-
borderRadius: size,
|
|
66
|
-
alignItems: "center"
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
const SliderImpl = React.forwardRef(
|
|
72
|
-
(props, forwardedRef) => {
|
|
73
|
-
const {
|
|
74
|
-
__scopeSlider,
|
|
75
|
-
onSlideStart,
|
|
76
|
-
onSlideMove,
|
|
77
|
-
onSlideEnd,
|
|
78
|
-
onHomeKeyDown,
|
|
79
|
-
onEndKeyDown,
|
|
80
|
-
onStepKeyDown,
|
|
81
|
-
...sliderProps
|
|
82
|
-
} = props;
|
|
83
|
-
const context = (0, import_constants.useSliderContext)(import_constants.SLIDER_NAME, __scopeSlider);
|
|
84
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
85
|
-
SliderFrame,
|
|
86
|
-
{
|
|
87
|
-
size: "$4",
|
|
88
|
-
...sliderProps,
|
|
89
|
-
"data-orientation": sliderProps.orientation,
|
|
90
|
-
ref: forwardedRef,
|
|
91
|
-
...import_core.isWeb && {
|
|
92
|
-
onKeyDown: (event) => {
|
|
93
|
-
if (event.key === "Home") {
|
|
94
|
-
onHomeKeyDown(event);
|
|
95
|
-
event.preventDefault();
|
|
96
|
-
} else if (event.key === "End") {
|
|
97
|
-
onEndKeyDown(event);
|
|
98
|
-
event.preventDefault();
|
|
99
|
-
} else if (import_constants.PAGE_KEYS.concat(import_constants.ARROW_KEYS).includes(event.key)) {
|
|
100
|
-
onStepKeyDown(event);
|
|
101
|
-
event.preventDefault();
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
onMoveShouldSetResponderCapture: () => true,
|
|
106
|
-
onScrollShouldSetResponder: () => true,
|
|
107
|
-
onScrollShouldSetResponderCapture: () => true,
|
|
108
|
-
onMoveShouldSetResponder: () => true,
|
|
109
|
-
onStartShouldSetResponder: () => true,
|
|
110
|
-
onResponderTerminationRequest: () => {
|
|
111
|
-
return false;
|
|
112
|
-
},
|
|
113
|
-
onResponderGrant: (0, import_core.composeEventHandlers)(props.onResponderGrant, (event) => {
|
|
114
|
-
const target = event.target;
|
|
115
|
-
const isStartingOnThumb = context.thumbs.has(target);
|
|
116
|
-
if (import_core.isWeb && target instanceof HTMLElement) {
|
|
117
|
-
if (context.thumbs.has(target)) {
|
|
118
|
-
target.focus();
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
onSlideStart(event, isStartingOnThumb ? "thumb" : "track");
|
|
122
|
-
}),
|
|
123
|
-
onResponderMove: (0, import_core.composeEventHandlers)(props.onResponderMove, (event) => {
|
|
124
|
-
event.stopPropagation();
|
|
125
|
-
onSlideMove(event);
|
|
126
|
-
}),
|
|
127
|
-
onResponderRelease: (0, import_core.composeEventHandlers)(props.onResponderRelease, (event) => {
|
|
128
|
-
onSlideEnd(event);
|
|
129
|
-
})
|
|
130
|
-
}
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
);
|
|
134
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
135
|
-
0 && (module.exports = {
|
|
136
|
-
DirectionalYStack,
|
|
137
|
-
SliderFrame,
|
|
138
|
-
SliderImpl
|
|
139
|
-
});
|
|
1
|
+
"use strict";var M=Object.create;var l=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,z=Object.prototype.hasOwnProperty;var I=(e,t)=>{for(var r in t)l(e,r,{get:t[r],enumerable:!0})},u=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of P(t))!z.call(e,a)&&a!==r&&l(e,a,{get:()=>t[a],enumerable:!(i=g(t,a))||i.enumerable});return e};var K=(e,t,r)=>(r=e!=null?M(k(e)):{},u(t||!e||!e.__esModule?l(r,"default",{value:e,enumerable:!0}):r,e)),C=e=>u(l({},"__esModule",{value:!0}),e);var x={};I(x,{DirectionalYStack:()=>f,SliderFrame:()=>R,SliderImpl:()=>_});module.exports=C(x);var h=require("react/jsx-runtime"),n=require("@tamagui/core"),c=require("@tamagui/get-size"),m=require("@tamagui/stacks"),H=K(require("react")),s=require("./constants");const f=(0,n.styled)(m.YStack,{variants:{orientation:{horizontal:{},vertical:{}}}}),R=(0,n.styled)(f,{position:"relative",variants:{size:(e,t)=>{const r=t.props.orientation,i=Math.round((0,n.getVariableValue)((0,c.getSize)(e))/6);return r==="horizontal"?{height:i,borderRadius:i,justifyContent:"center"}:{width:i,borderRadius:i,alignItems:"center"}}}}),_=H.forwardRef((e,t)=>{const{__scopeSlider:r,onSlideStart:i,onSlideMove:a,onSlideEnd:E,onHomeKeyDown:b,onEndKeyDown:w,onStepKeyDown:y,...p}=e,S=(0,s.useSliderContext)(s.SLIDER_NAME,r);return(0,h.jsx)(R,{size:"$4",...p,"data-orientation":p.orientation,ref:t,...n.isWeb&&{onKeyDown:o=>{o.key==="Home"?(b(o),o.preventDefault()):o.key==="End"?(w(o),o.preventDefault()):s.PAGE_KEYS.concat(s.ARROW_KEYS).includes(o.key)&&(y(o),o.preventDefault())}},onMoveShouldSetResponderCapture:()=>!0,onScrollShouldSetResponder:()=>!0,onScrollShouldSetResponderCapture:()=>!0,onMoveShouldSetResponder:()=>!0,onStartShouldSetResponder:()=>!0,onResponderTerminationRequest:()=>!1,onResponderGrant:(0,n.composeEventHandlers)(e.onResponderGrant,o=>{const d=o.target,D=S.thumbs.has(d);n.isWeb&&d instanceof HTMLElement&&S.thumbs.has(d)&&d.focus(),i(o,D?"thumb":"track")}),onResponderMove:(0,n.composeEventHandlers)(e.onResponderMove,o=>{o.stopPropagation(),a(o)}),onResponderRelease:(0,n.composeEventHandlers)(e.onResponderRelease,o=>{E(o)})})});0&&(module.exports={DirectionalYStack,SliderFrame,SliderImpl});
|
|
140
2
|
//# sourceMappingURL=SliderImpl.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/SliderImpl.tsx"],
|
|
4
4
|
"sourcesContent": ["/* -------------------------------------------------------------------------------------------------\n * SliderImpl\n * -----------------------------------------------------------------------------------------------*/\n\nimport { composeEventHandlers, getVariableValue, isWeb, styled } from '@tamagui/core'\nimport { getSize } from '@tamagui/get-size'\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 } as const,\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 } as const,\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 unknown as HTMLElement | number\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.stopPropagation()\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": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,uBAAAE,EAAA,gBAAAC,EAAA,eAAAC,IAAA,eAAAC,EAAAL,GA2DM,IAAAM,EAAA,6BAvDNC,EAAsE,yBACtEC,EAAwB,6BACxBC,EAAuB,2BACvBC,EAAuB,oBAGvBC,EAAqE,uBAG9D,MAAMT,KAAoB,UAAO,SAAQ,CAC9C,SAAU,CACR,YAAa,CACX,WAAY,CAAC,EACb,SAAU,CAAC,CACb,CACF,CACF,CAAC,EAEYC,KAAc,UAAOD,EAAmB,CACnD,SAAU,WAEV,SAAU,CACR,KAAM,CAACU,EAAKC,IAAW,CACrB,MAAMC,EAAcD,EAAO,MAAM,YAC3BE,EAAO,KAAK,SAAM,uBAAiB,WAAQH,CAAG,CAAC,EAAI,CAAC,EAC1D,OAAIE,IAAgB,aACX,CACL,OAAQC,EACR,aAAcA,EACd,eAAgB,QAClB,EAEK,CACL,MAAOA,EACP,aAAcA,EACd,WAAY,QACd,CACF,CACF,CACF,CAAC,EAEYX,EAAaM,EAAM,WAC9B,CAACM,EAAqCC,IAAiB,CACrD,KAAM,CACJ,cAAAC,EACA,aAAAC,EACA,YAAAC,EACA,WAAAC,EACA,cAAAC,EACA,aAAAC,EACA,cAAAC,EACA,GAAGC,CACL,EAAIT,EACEU,KAAU,oBAAiB,cAAaR,CAAa,EAC3D,SACE,OAACf,EAAA,CACC,KAAK,KACJ,GAAGsB,EACJ,mBAAkBA,EAAY,YAC9B,IAAKR,EACJ,GAAI,SAAS,CACZ,UAAYU,GAAU,CAChBA,EAAM,MAAQ,QAChBL,EAAcK,CAAK,EAEnBA,EAAM,eAAe,GACZA,EAAM,MAAQ,OACvBJ,EAAaI,CAAK,EAElBA,EAAM,eAAe,GACZ,YAAU,OAAO,YAAU,EAAE,SAASA,EAAM,GAAG,IACxDH,EAAcG,CAAK,EAEnBA,EAAM,eAAe,EAEzB,CACF,EACA,gCAAiC,IAAM,GACvC,2BAA4B,IAAM,GAClC,kCAAmC,IAAM,GACzC,yBAA0B,IAAM,GAChC,0BAA2B,IAAM,GAEjC,8BAA+B,IACtB,GAET,oBAAkB,wBAAqBX,EAAM,iBAAmBW,GAAU,CACxE,MAAMC,EAASD,EAAM,OACfE,EAAoBH,EAAQ,OAAO,IAAIE,CAAM,EAI/C,SAASA,aAAkB,aACzBF,EAAQ,OAAO,IAAIE,CAAM,GAC3BA,EAAO,MAAM,EAGjBT,EAAaQ,EAAOE,EAAoB,QAAU,OAAO,CAC3D,CAAC,EACD,mBAAiB,wBAAqBb,EAAM,gBAAkBW,GAAU,CACtEA,EAAM,gBAAgB,EAEtBP,EAAYO,CAAK,CACnB,CAAC,EACD,sBAAoB,wBAAqBX,EAAM,mBAAqBW,GAAU,CAE5EN,EAAWM,CAAK,CAClB,CAAC,EACH,CAEJ,CACF",
|
|
6
|
+
"names": ["SliderImpl_exports", "__export", "DirectionalYStack", "SliderFrame", "SliderImpl", "__toCommonJS", "import_jsx_runtime", "import_core", "import_get_size", "import_stacks", "React", "import_constants", "val", "extras", "orientation", "size", "props", "forwardedRef", "__scopeSlider", "onSlideStart", "onSlideMove", "onSlideEnd", "onHomeKeyDown", "onEndKeyDown", "onStepKeyDown", "sliderProps", "context", "event", "target", "isStartingOnThumb"]
|
|
7
7
|
}
|
package/dist/cjs/constants.js
CHANGED
|
@@ -1,63 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var constants_exports = {};
|
|
20
|
-
__export(constants_exports, {
|
|
21
|
-
ARROW_KEYS: () => ARROW_KEYS,
|
|
22
|
-
BACK_KEYS: () => BACK_KEYS,
|
|
23
|
-
PAGE_KEYS: () => PAGE_KEYS,
|
|
24
|
-
SLIDER_NAME: () => SLIDER_NAME,
|
|
25
|
-
SliderOrientationProvider: () => SliderOrientationProvider,
|
|
26
|
-
SliderProvider: () => SliderProvider,
|
|
27
|
-
createSliderContext: () => createSliderContext,
|
|
28
|
-
createSliderScope: () => createSliderScope,
|
|
29
|
-
useSliderContext: () => useSliderContext,
|
|
30
|
-
useSliderOrientationContext: () => useSliderOrientationContext
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(constants_exports);
|
|
33
|
-
var import_create_context = require("@tamagui/create-context");
|
|
34
|
-
const SLIDER_NAME = "Slider";
|
|
35
|
-
const [createSliderContext, createSliderScope] = (0, import_create_context.createContextScope)(SLIDER_NAME);
|
|
36
|
-
const [SliderProvider, useSliderContext] = createSliderContext(SLIDER_NAME);
|
|
37
|
-
const [SliderOrientationProvider, useSliderOrientationContext] = createSliderContext(SLIDER_NAME, {
|
|
38
|
-
startEdge: "left",
|
|
39
|
-
endEdge: "right",
|
|
40
|
-
sizeProp: "width",
|
|
41
|
-
size: 0,
|
|
42
|
-
direction: 1
|
|
43
|
-
});
|
|
44
|
-
const PAGE_KEYS = ["PageUp", "PageDown"];
|
|
45
|
-
const ARROW_KEYS = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"];
|
|
46
|
-
const BACK_KEYS = {
|
|
47
|
-
ltr: ["ArrowDown", "Home", "ArrowLeft", "PageDown"],
|
|
48
|
-
rtl: ["ArrowDown", "Home", "ArrowRight", "PageDown"]
|
|
49
|
-
};
|
|
50
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
-
0 && (module.exports = {
|
|
52
|
-
ARROW_KEYS,
|
|
53
|
-
BACK_KEYS,
|
|
54
|
-
PAGE_KEYS,
|
|
55
|
-
SLIDER_NAME,
|
|
56
|
-
SliderOrientationProvider,
|
|
57
|
-
SliderProvider,
|
|
58
|
-
createSliderContext,
|
|
59
|
-
createSliderScope,
|
|
60
|
-
useSliderContext,
|
|
61
|
-
useSliderOrientationContext
|
|
62
|
-
});
|
|
1
|
+
"use strict";var n=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var w=(r,e)=>{for(var o in e)n(r,o,{get:e[o],enumerable:!0})},g=(r,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of S(e))!l.call(r,t)&&t!==o&&n(r,t,{get:()=>e[t],enumerable:!(s=p(e,t))||s.enumerable});return r};var a=r=>g(n({},"__esModule",{value:!0}),r);var C={};w(C,{ARROW_KEYS:()=>P,BACK_KEYS:()=>f,PAGE_KEYS:()=>D,SLIDER_NAME:()=>i,SliderOrientationProvider:()=>E,SliderProvider:()=>A,createSliderContext:()=>d,createSliderScope:()=>x,useSliderContext:()=>m,useSliderOrientationContext:()=>h});module.exports=a(C);var c=require("@tamagui/create-context");const i="Slider",[d,x]=(0,c.createContextScope)(i),[A,m]=d(i),[E,h]=d(i,{startEdge:"left",endEdge:"right",sizeProp:"width",size:0,direction:1}),D=["PageUp","PageDown"],P=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],f={ltr:["ArrowDown","Home","ArrowLeft","PageDown"],rtl:["ArrowDown","Home","ArrowRight","PageDown"]};0&&(module.exports={ARROW_KEYS,BACK_KEYS,PAGE_KEYS,SLIDER_NAME,SliderOrientationProvider,SliderProvider,createSliderContext,createSliderScope,useSliderContext,useSliderOrientationContext});
|
|
63
2
|
//# sourceMappingURL=constants.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/constants.tsx"],
|
|
4
4
|
"sourcesContent": ["import { SizeTokens } from '@tamagui/core'\nimport { createContextScope } from '@tamagui/create-context'\n\nimport { Direction, SliderContextValue } from './types'\n\nexport const SLIDER_NAME = 'Slider'\n\nexport const [createSliderContext, createSliderScope] =\n createContextScope(SLIDER_NAME)\n\nexport const [SliderProvider, useSliderContext] =\n createSliderContext<SliderContextValue>(SLIDER_NAME)\n\nexport const [SliderOrientationProvider, useSliderOrientationContext] =\n createSliderContext<{\n startEdge: 'bottom' | 'left' | 'right'\n endEdge: 'top' | 'right' | 'left'\n sizeProp: 'width' | 'height'\n size: number | SizeTokens\n direction: number\n }>(SLIDER_NAME, {\n startEdge: 'left',\n endEdge: 'right',\n sizeProp: 'width',\n size: 0,\n direction: 1,\n })\n\nexport const PAGE_KEYS = ['PageUp', 'PageDown']\nexport const ARROW_KEYS = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight']\nexport const BACK_KEYS: Record<Direction, string[]> = {\n ltr: ['ArrowDown', 'Home', 'ArrowLeft', 'PageDown'],\n rtl: ['ArrowDown', 'Home', 'ArrowRight', 'PageDown'],\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,EAAA,cAAAC,EAAA,cAAAC,EAAA,gBAAAC,EAAA,8BAAAC,EAAA,mBAAAC,EAAA,wBAAAC,EAAA,sBAAAC,EAAA,qBAAAC,EAAA,gCAAAC,IAAA,eAAAC,EAAAZ,GACA,IAAAa,EAAmC,mCAI5B,MAAMR,EAAc,SAEd,CAACG,EAAqBC,CAAiB,KAClD,sBAAmBJ,CAAW,EAEnB,CAACE,EAAgBG,CAAgB,EAC5CF,EAAwCH,CAAW,EAExC,CAACC,EAA2BK,CAA2B,EAClEH,EAMGH,EAAa,CACd,UAAW,OACX,QAAS,QACT,SAAU,QACV,KAAM,EACN,UAAW,CACb,CAAC,EAEUD,EAAY,CAAC,SAAU,UAAU,EACjCF,EAAa,CAAC,UAAW,YAAa,YAAa,YAAY,EAC/DC,EAAyC,CACpD,IAAK,CAAC,YAAa,OAAQ,YAAa,UAAU,EAClD,IAAK,CAAC,YAAa,OAAQ,aAAc,UAAU,CACrD",
|
|
6
|
+
"names": ["constants_exports", "__export", "ARROW_KEYS", "BACK_KEYS", "PAGE_KEYS", "SLIDER_NAME", "SliderOrientationProvider", "SliderProvider", "createSliderContext", "createSliderScope", "useSliderContext", "useSliderOrientationContext", "__toCommonJS", "import_create_context"]
|
|
7
7
|
}
|
package/dist/cjs/helpers.js
CHANGED
|
@@ -1,102 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var helpers_exports = {};
|
|
20
|
-
__export(helpers_exports, {
|
|
21
|
-
convertValueToPercentage: () => convertValueToPercentage,
|
|
22
|
-
getClosestValueIndex: () => getClosestValueIndex,
|
|
23
|
-
getDecimalCount: () => getDecimalCount,
|
|
24
|
-
getLabel: () => getLabel,
|
|
25
|
-
getNextSortedValues: () => getNextSortedValues,
|
|
26
|
-
getThumbInBoundsOffset: () => getThumbInBoundsOffset,
|
|
27
|
-
hasMinStepsBetweenValues: () => hasMinStepsBetweenValues,
|
|
28
|
-
linearScale: () => linearScale,
|
|
29
|
-
roundValue: () => roundValue
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(helpers_exports);
|
|
32
|
-
function getNextSortedValues(prevValues = [], nextValue, atIndex) {
|
|
33
|
-
const nextValues = [...prevValues];
|
|
34
|
-
nextValues[atIndex] = nextValue;
|
|
35
|
-
return nextValues.sort((a, b) => a - b);
|
|
36
|
-
}
|
|
37
|
-
function convertValueToPercentage(value, min, max) {
|
|
38
|
-
const maxSteps = max - min;
|
|
39
|
-
const percentPerStep = 100 / maxSteps;
|
|
40
|
-
return percentPerStep * (value - min);
|
|
41
|
-
}
|
|
42
|
-
function getLabel(index, totalValues) {
|
|
43
|
-
if (totalValues > 2) {
|
|
44
|
-
return `Value ${index + 1} of ${totalValues}`;
|
|
45
|
-
} else if (totalValues === 2) {
|
|
46
|
-
return ["Minimum", "Maximum"][index];
|
|
47
|
-
} else {
|
|
48
|
-
return void 0;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
function getClosestValueIndex(values, nextValue) {
|
|
52
|
-
if (values.length === 1)
|
|
53
|
-
return 0;
|
|
54
|
-
const distances = values.map((value) => Math.abs(value - nextValue));
|
|
55
|
-
const closestDistance = Math.min(...distances);
|
|
56
|
-
return distances.indexOf(closestDistance);
|
|
57
|
-
}
|
|
58
|
-
function getThumbInBoundsOffset(width, left, direction) {
|
|
59
|
-
const halfWidth = width / 2;
|
|
60
|
-
const halfPercent = 50;
|
|
61
|
-
const offset = linearScale([0, halfPercent], [0, halfWidth]);
|
|
62
|
-
return (halfWidth - offset(left) * direction) * direction;
|
|
63
|
-
}
|
|
64
|
-
function getStepsBetweenValues(values) {
|
|
65
|
-
return values.slice(0, -1).map((value, index) => values[index + 1] - value);
|
|
66
|
-
}
|
|
67
|
-
function hasMinStepsBetweenValues(values, minStepsBetweenValues) {
|
|
68
|
-
if (minStepsBetweenValues > 0) {
|
|
69
|
-
const stepsBetweenValues = getStepsBetweenValues(values);
|
|
70
|
-
const actualMinStepsBetweenValues = Math.min(...stepsBetweenValues);
|
|
71
|
-
return actualMinStepsBetweenValues >= minStepsBetweenValues;
|
|
72
|
-
}
|
|
73
|
-
return true;
|
|
74
|
-
}
|
|
75
|
-
function linearScale(input, output) {
|
|
76
|
-
return (value) => {
|
|
77
|
-
if (input[0] === input[1] || output[0] === output[1])
|
|
78
|
-
return output[0];
|
|
79
|
-
const ratio = (output[1] - output[0]) / (input[1] - input[0]);
|
|
80
|
-
return output[0] + ratio * (value - input[0]);
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
function getDecimalCount(value) {
|
|
84
|
-
return (String(value).split(".")[1] || "").length;
|
|
85
|
-
}
|
|
86
|
-
function roundValue(value, decimalCount) {
|
|
87
|
-
const rounder = Math.pow(10, decimalCount);
|
|
88
|
-
return Math.round(value * rounder) / rounder;
|
|
89
|
-
}
|
|
90
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
91
|
-
0 && (module.exports = {
|
|
92
|
-
convertValueToPercentage,
|
|
93
|
-
getClosestValueIndex,
|
|
94
|
-
getDecimalCount,
|
|
95
|
-
getLabel,
|
|
96
|
-
getNextSortedValues,
|
|
97
|
-
getThumbInBoundsOffset,
|
|
98
|
-
hasMinStepsBetweenValues,
|
|
99
|
-
linearScale,
|
|
100
|
-
roundValue
|
|
101
|
-
});
|
|
1
|
+
"use strict";var s=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var f=(n,e)=>{for(var r in e)s(n,r,{get:e[r],enumerable:!0})},i=(n,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let u of a(e))!b.call(n,u)&&u!==r&&s(n,u,{get:()=>e[u],enumerable:!(t=m(e,u))||t.enumerable});return n};var l=n=>i(s({},"__esModule",{value:!0}),n);var B={};f(B,{convertValueToPercentage:()=>p,getClosestValueIndex:()=>d,getDecimalCount:()=>V,getLabel:()=>h,getNextSortedValues:()=>x,getThumbInBoundsOffset:()=>g,hasMinStepsBetweenValues:()=>S,linearScale:()=>c,roundValue:()=>w});module.exports=l(B);function x(n=[],e,r){const t=[...n];return t[r]=e,t.sort((u,o)=>u-o)}function p(n,e,r){return 100/(r-e)*(n-e)}function h(n,e){return e>2?`Value ${n+1} of ${e}`:e===2?["Minimum","Maximum"][n]:void 0}function d(n,e){if(n.length===1)return 0;const r=n.map(u=>Math.abs(u-e)),t=Math.min(...r);return r.indexOf(t)}function g(n,e,r){const t=n/2,o=c([0,50],[0,t]);return(t-o(e)*r)*r}function M(n){return n.slice(0,-1).map((e,r)=>n[r+1]-e)}function S(n,e){if(e>0){const r=M(n);return Math.min(...r)>=e}return!0}function c(n,e){return r=>{if(n[0]===n[1]||e[0]===e[1])return e[0];const t=(e[1]-e[0])/(n[1]-n[0]);return e[0]+t*(r-n[0])}}function V(n){return(String(n).split(".")[1]||"").length}function w(n,e){const r=Math.pow(10,e);return Math.round(n*r)/r}0&&(module.exports={convertValueToPercentage,getClosestValueIndex,getDecimalCount,getLabel,getNextSortedValues,getThumbInBoundsOffset,hasMinStepsBetweenValues,linearScale,roundValue});
|
|
102
2
|
//# sourceMappingURL=helpers.js.map
|
package/dist/cjs/helpers.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/helpers.tsx"],
|
|
4
4
|
"sourcesContent": ["export function getNextSortedValues(\n prevValues: number[] = [],\n nextValue: number,\n atIndex: number,\n) {\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(\n width: number,\n left: number,\n direction: number,\n) {\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(\n values: number[],\n minStepsBetweenValues: number,\n) {\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(\n input: readonly [number, number],\n output: readonly [number, number],\n) {\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": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,EAAA,yBAAAC,EAAA,oBAAAC,EAAA,aAAAC,EAAA,wBAAAC,EAAA,2BAAAC,EAAA,6BAAAC,EAAA,gBAAAC,EAAA,eAAAC,IAAA,eAAAC,EAAAX,GAAO,SAASM,EACdM,EAAuB,CAAC,EACxBC,EACAC,EACA,CACA,MAAMC,EAAa,CAAC,GAAGH,CAAU,EACjC,OAAAG,EAAWD,CAAO,EAAID,EACfE,EAAW,KAAK,CAACC,EAAGC,IAAMD,EAAIC,CAAC,CACxC,CAEO,SAASf,EAAyBgB,EAAeC,EAAaC,EAAa,CAGhF,MADuB,MADNA,EAAMD,IAEED,EAAQC,EACnC,CAKO,SAASd,EAASgB,EAAeC,EAAqB,CAC3D,OAAIA,EAAc,EACT,SAASD,EAAQ,QAAQC,IACvBA,IAAgB,EAClB,CAAC,UAAW,SAAS,EAAED,CAAK,EAEnC,MAEJ,CAUO,SAASlB,EAAqBoB,EAAkBV,EAAmB,CACxE,GAAIU,EAAO,SAAW,EAAG,MAAO,GAChC,MAAMC,EAAYD,EAAO,IAAKL,GAAU,KAAK,IAAIA,EAAQL,CAAS,CAAC,EAC7DY,EAAkB,KAAK,IAAI,GAAGD,CAAS,EAC7C,OAAOA,EAAU,QAAQC,CAAe,CAC1C,CAMO,SAASlB,EACdmB,EACAC,EACAC,EACA,CACA,MAAMC,EAAYH,EAAQ,EAEpBI,EAASrB,EAAY,CAAC,EADR,EACsB,EAAG,CAAC,EAAGoB,CAAS,CAAC,EAC3D,OAAQA,EAAYC,EAAOH,CAAI,EAAIC,GAAaA,CAClD,CASA,SAASG,EAAsBR,EAAkB,CAC/C,OAAOA,EAAO,MAAM,EAAG,EAAE,EAAE,IAAI,CAACL,EAAOG,IAAUE,EAAOF,EAAQ,CAAC,EAAIH,CAAK,CAC5E,CAcO,SAASV,EACde,EACAS,EACA,CACA,GAAIA,EAAwB,EAAG,CAC7B,MAAMC,EAAqBF,EAAsBR,CAAM,EAEvD,OADoC,KAAK,IAAI,GAAGU,CAAkB,GAC5BD,CACxC,CACA,MAAO,EACT,CAGO,SAASvB,EACdyB,EACAC,EACA,CACA,OAAQjB,GAAkB,CACxB,GAAIgB,EAAM,CAAC,IAAMA,EAAM,CAAC,GAAKC,EAAO,CAAC,IAAMA,EAAO,CAAC,EAAG,OAAOA,EAAO,CAAC,EACrE,MAAMC,GAASD,EAAO,CAAC,EAAIA,EAAO,CAAC,IAAMD,EAAM,CAAC,EAAIA,EAAM,CAAC,GAC3D,OAAOC,EAAO,CAAC,EAAIC,GAASlB,EAAQgB,EAAM,CAAC,EAC7C,CACF,CAEO,SAAS9B,EAAgBc,EAAe,CAC7C,OAAQ,OAAOA,CAAK,EAAE,MAAM,GAAG,EAAE,CAAC,GAAK,IAAI,MAC7C,CAEO,SAASR,EAAWQ,EAAemB,EAAsB,CAC9D,MAAMC,EAAU,KAAK,IAAI,GAAID,CAAY,EACzC,OAAO,KAAK,MAAMnB,EAAQoB,CAAO,EAAIA,CACvC",
|
|
6
|
+
"names": ["helpers_exports", "__export", "convertValueToPercentage", "getClosestValueIndex", "getDecimalCount", "getLabel", "getNextSortedValues", "getThumbInBoundsOffset", "hasMinStepsBetweenValues", "linearScale", "roundValue", "__toCommonJS", "prevValues", "nextValue", "atIndex", "nextValues", "a", "b", "value", "min", "max", "index", "totalValues", "values", "distances", "closestDistance", "width", "left", "direction", "halfWidth", "offset", "getStepsBetweenValues", "minStepsBetweenValues", "stepsBetweenValues", "input", "output", "ratio", "decimalCount", "rounder"]
|
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,33 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var src_exports = {};
|
|
21
|
-
__export(src_exports, {
|
|
22
|
-
DirectionalYStack: () => import_SliderImpl.DirectionalYStack,
|
|
23
|
-
SliderFrame: () => import_SliderImpl.SliderFrame
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(src_exports);
|
|
26
|
-
__reExport(src_exports, require("./Slider"), module.exports);
|
|
27
|
-
var import_SliderImpl = require("./SliderImpl");
|
|
28
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
-
0 && (module.exports = {
|
|
30
|
-
DirectionalYStack,
|
|
31
|
-
SliderFrame
|
|
32
|
-
});
|
|
1
|
+
"use strict";var a=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var P=(e,r)=>{for(var o in r)a(e,o,{get:r[o],enumerable:!0})},l=(e,r,o,d)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of c(r))!m.call(e,i)&&i!==o&&a(e,i,{get:()=>r[i],enumerable:!(d=s(r,i))||d.enumerable});return e},S=(e,r,o)=>(l(e,r,"default"),o&&l(o,r,"default"));var f=e=>l(a({},"__esModule",{value:!0}),e);var p={};P(p,{DirectionalYStack:()=>t.DirectionalYStack,SliderFrame:()=>t.SliderFrame});module.exports=f(p);S(p,require("./Slider"),module.exports);var t=require("./SliderImpl");0&&(module.exports={DirectionalYStack,SliderFrame});
|
|
33
2
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
4
|
"sourcesContent": ["export * from './Slider'\n// for static extract to find, must export\nexport { SliderFrame, DirectionalYStack } from './SliderImpl'\nexport type {\n SliderProps,\n SliderHorizontalProps,\n SliderVerticalProps,\n SliderTrackProps,\n} from './types'\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "2dAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0FAAAE,EAAAF,GAAAG,EAAAH,EAAc,oBAAd,gBAEA,IAAAI,EAA+C",
|
|
6
|
+
"names": ["src_exports", "__export", "__toCommonJS", "__reExport", "import_SliderImpl"]
|
|
7
7
|
}
|
package/dist/cjs/types.js
CHANGED
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var types_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(types_exports);
|
|
1
|
+
"use strict";var n=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var p=(t,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of d(e))!l.call(t,r)&&r!==i&&n(t,r,{get:()=>e[r],enumerable:!(o=a(e,r))||o.enumerable});return t};var s=t=>p(n({},"__esModule",{value:!0}),t);var m={};module.exports=s(m);
|
|
17
2
|
//# sourceMappingURL=types.js.map
|
package/dist/cjs/types.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/types.ts"],
|
|
4
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
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["types_exports", "__toCommonJS"]
|
|
7
7
|
}
|