react-native-ruler-date-picker 0.1.0 → 0.2.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/README.md +186 -60
- package/lib/commonjs/LensTick.js +83 -0
- package/lib/commonjs/LensTick.js.map +1 -0
- package/lib/commonjs/Ruler.js +38 -0
- package/lib/commonjs/Ruler.js.map +1 -0
- package/lib/commonjs/RulerContext.js +17 -0
- package/lib/commonjs/RulerContext.js.map +1 -0
- package/lib/commonjs/RulerDatePicker.js +38 -351
- package/lib/commonjs/RulerDatePicker.js.map +1 -1
- package/lib/commonjs/RulerDateRangePicker.js +56 -0
- package/lib/commonjs/RulerDateRangePicker.js.map +1 -0
- package/lib/commonjs/RulerHeader.js +106 -0
- package/lib/commonjs/RulerHeader.js.map +1 -0
- package/lib/commonjs/RulerIndicator.js +67 -0
- package/lib/commonjs/RulerIndicator.js.map +1 -0
- package/lib/commonjs/RulerLensTicks.js +55 -0
- package/lib/commonjs/RulerLensTicks.js.map +1 -0
- package/lib/commonjs/RulerLensTrack.js +52 -0
- package/lib/commonjs/RulerLensTrack.js.map +1 -0
- package/lib/commonjs/RulerRange.js +39 -0
- package/lib/commonjs/RulerRange.js.map +1 -0
- package/lib/commonjs/RulerRangeContext.js +17 -0
- package/lib/commonjs/RulerRangeContext.js.map +1 -0
- package/lib/commonjs/RulerRangeHeader.js +154 -0
- package/lib/commonjs/RulerRangeHeader.js.map +1 -0
- package/lib/commonjs/RulerRangeHighlight.js +50 -0
- package/lib/commonjs/RulerRangeHighlight.js.map +1 -0
- package/lib/commonjs/RulerRangeIndicator.js +71 -0
- package/lib/commonjs/RulerRangeIndicator.js.map +1 -0
- package/lib/commonjs/RulerRangeRoot.js +80 -0
- package/lib/commonjs/RulerRangeRoot.js.map +1 -0
- package/lib/commonjs/RulerRangeTicks.js +57 -0
- package/lib/commonjs/RulerRangeTicks.js.map +1 -0
- package/lib/commonjs/RulerRangeTrack.js +46 -0
- package/lib/commonjs/RulerRangeTrack.js.map +1 -0
- package/lib/commonjs/RulerResetButton.js +46 -0
- package/lib/commonjs/RulerResetButton.js.map +1 -0
- package/lib/commonjs/RulerRoot.js +87 -0
- package/lib/commonjs/RulerRoot.js.map +1 -0
- package/lib/commonjs/RulerTicks.js +51 -0
- package/lib/commonjs/RulerTicks.js.map +1 -0
- package/lib/commonjs/RulerTrack.js +46 -0
- package/lib/commonjs/RulerTrack.js.map +1 -0
- package/lib/commonjs/Tick.js +41 -36
- package/lib/commonjs/Tick.js.map +1 -1
- package/lib/commonjs/defaults.js +20 -19
- package/lib/commonjs/defaults.js.map +1 -1
- package/lib/commonjs/index.js +287 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/presets.js +108 -0
- package/lib/commonjs/presets.js.map +1 -0
- package/lib/commonjs/tickResolver.js +101 -0
- package/lib/commonjs/tickResolver.js.map +1 -0
- package/lib/commonjs/useHaptics.js +1 -1
- package/lib/commonjs/useHaptics.web.js +43 -0
- package/lib/commonjs/useHaptics.web.js.map +1 -0
- package/lib/commonjs/useRulerDatePicker.js +264 -0
- package/lib/commonjs/useRulerDatePicker.js.map +1 -0
- package/lib/commonjs/useRulerDateRangePicker.js +313 -0
- package/lib/commonjs/useRulerDateRangePicker.js.map +1 -0
- package/lib/commonjs/utils.js +61 -47
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/module/LensTick.js +77 -0
- package/lib/module/LensTick.js.map +1 -0
- package/lib/module/Ruler.js +35 -0
- package/lib/module/Ruler.js.map +1 -0
- package/lib/module/RulerContext.js +12 -0
- package/lib/module/RulerContext.js.map +1 -0
- package/lib/module/RulerDatePicker.js +38 -350
- package/lib/module/RulerDatePicker.js.map +1 -1
- package/lib/module/RulerDateRangePicker.js +52 -0
- package/lib/module/RulerDateRangePicker.js.map +1 -0
- package/lib/module/RulerHeader.js +101 -0
- package/lib/module/RulerHeader.js.map +1 -0
- package/lib/module/RulerIndicator.js +62 -0
- package/lib/module/RulerIndicator.js.map +1 -0
- package/lib/module/RulerLensTicks.js +50 -0
- package/lib/module/RulerLensTicks.js.map +1 -0
- package/lib/module/RulerLensTrack.js +47 -0
- package/lib/module/RulerLensTrack.js.map +1 -0
- package/lib/module/RulerRange.js +36 -0
- package/lib/module/RulerRange.js.map +1 -0
- package/lib/module/RulerRangeContext.js +12 -0
- package/lib/module/RulerRangeContext.js.map +1 -0
- package/lib/module/RulerRangeHeader.js +149 -0
- package/lib/module/RulerRangeHeader.js.map +1 -0
- package/lib/module/RulerRangeHighlight.js +45 -0
- package/lib/module/RulerRangeHighlight.js.map +1 -0
- package/lib/module/RulerRangeIndicator.js +66 -0
- package/lib/module/RulerRangeIndicator.js.map +1 -0
- package/lib/module/RulerRangeRoot.js +75 -0
- package/lib/module/RulerRangeRoot.js.map +1 -0
- package/lib/module/RulerRangeTicks.js +51 -0
- package/lib/module/RulerRangeTicks.js.map +1 -0
- package/lib/module/RulerRangeTrack.js +41 -0
- package/lib/module/RulerRangeTrack.js.map +1 -0
- package/lib/module/RulerResetButton.js +41 -0
- package/lib/module/RulerResetButton.js.map +1 -0
- package/lib/module/RulerRoot.js +82 -0
- package/lib/module/RulerRoot.js.map +1 -0
- package/lib/module/RulerTicks.js +45 -0
- package/lib/module/RulerTicks.js.map +1 -0
- package/lib/module/RulerTrack.js +41 -0
- package/lib/module/RulerTrack.js.map +1 -0
- package/lib/module/Tick.js +41 -36
- package/lib/module/Tick.js.map +1 -1
- package/lib/module/defaults.js +19 -18
- package/lib/module/defaults.js.map +1 -1
- package/lib/module/index.js +46 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/presets.js +103 -0
- package/lib/module/presets.js.map +1 -0
- package/lib/module/tickResolver.js +97 -0
- package/lib/module/tickResolver.js.map +1 -0
- package/lib/module/useHaptics.js +1 -1
- package/lib/module/useHaptics.js.map +1 -1
- package/lib/module/useHaptics.web.js +39 -0
- package/lib/module/useHaptics.web.js.map +1 -0
- package/lib/module/useRulerDatePicker.js +260 -0
- package/lib/module/useRulerDatePicker.js.map +1 -0
- package/lib/module/useRulerDateRangePicker.js +310 -0
- package/lib/module/useRulerDateRangePicker.js.map +1 -0
- package/lib/module/utils.js +59 -45
- package/lib/module/utils.js.map +1 -1
- package/lib/typescript/LensTick.d.ts +20 -0
- package/lib/typescript/LensTick.d.ts.map +1 -0
- package/lib/typescript/Ruler.d.ts +31 -0
- package/lib/typescript/Ruler.d.ts.map +1 -0
- package/lib/typescript/RulerContext.d.ts +11 -0
- package/lib/typescript/RulerContext.d.ts.map +1 -0
- package/lib/typescript/RulerDatePicker.d.ts +10 -7
- package/lib/typescript/RulerDatePicker.d.ts.map +1 -1
- package/lib/typescript/RulerDateRangePicker.d.ts +26 -0
- package/lib/typescript/RulerDateRangePicker.d.ts.map +1 -0
- package/lib/typescript/RulerHeader.d.ts +14 -0
- package/lib/typescript/RulerHeader.d.ts.map +1 -0
- package/lib/typescript/RulerIndicator.d.ts +17 -0
- package/lib/typescript/RulerIndicator.d.ts.map +1 -0
- package/lib/typescript/RulerLensTicks.d.ts +12 -0
- package/lib/typescript/RulerLensTicks.d.ts.map +1 -0
- package/lib/typescript/RulerLensTrack.d.ts +13 -0
- package/lib/typescript/RulerLensTrack.d.ts.map +1 -0
- package/lib/typescript/RulerRange.d.ts +32 -0
- package/lib/typescript/RulerRange.d.ts.map +1 -0
- package/lib/typescript/RulerRangeContext.d.ts +11 -0
- package/lib/typescript/RulerRangeContext.d.ts.map +1 -0
- package/lib/typescript/RulerRangeHeader.d.ts +12 -0
- package/lib/typescript/RulerRangeHeader.d.ts.map +1 -0
- package/lib/typescript/RulerRangeHighlight.d.ts +8 -0
- package/lib/typescript/RulerRangeHighlight.d.ts.map +1 -0
- package/lib/typescript/RulerRangeIndicator.d.ts +17 -0
- package/lib/typescript/RulerRangeIndicator.d.ts.map +1 -0
- package/lib/typescript/RulerRangeRoot.d.ts +7 -0
- package/lib/typescript/RulerRangeRoot.d.ts.map +1 -0
- package/lib/typescript/RulerRangeTicks.d.ts +14 -0
- package/lib/typescript/RulerRangeTicks.d.ts.map +1 -0
- package/lib/typescript/RulerRangeTrack.d.ts +8 -0
- package/lib/typescript/RulerRangeTrack.d.ts.map +1 -0
- package/lib/typescript/RulerResetButton.d.ts +10 -0
- package/lib/typescript/RulerResetButton.d.ts.map +1 -0
- package/lib/typescript/RulerRoot.d.ts +7 -0
- package/lib/typescript/RulerRoot.d.ts.map +1 -0
- package/lib/typescript/RulerTicks.d.ts +9 -0
- package/lib/typescript/RulerTicks.d.ts.map +1 -0
- package/lib/typescript/RulerTrack.d.ts +8 -0
- package/lib/typescript/RulerTrack.d.ts.map +1 -0
- package/lib/typescript/Tick.d.ts +3 -16
- package/lib/typescript/Tick.d.ts.map +1 -1
- package/lib/typescript/defaults.d.ts +6 -9
- package/lib/typescript/defaults.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +37 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/presets.d.ts +27 -0
- package/lib/typescript/presets.d.ts.map +1 -0
- package/lib/typescript/tickResolver.d.ts +10 -0
- package/lib/typescript/tickResolver.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +302 -85
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/useHaptics.web.d.ts +17 -0
- package/lib/typescript/useHaptics.web.d.ts.map +1 -0
- package/lib/typescript/useRulerDatePicker.d.ts +26 -0
- package/lib/typescript/useRulerDatePicker.d.ts.map +1 -0
- package/lib/typescript/useRulerDateRangePicker.d.ts +40 -0
- package/lib/typescript/useRulerDateRangePicker.d.ts.map +1 -0
- package/lib/typescript/utils.d.ts +14 -12
- package/lib/typescript/utils.d.ts.map +1 -1
- package/package.json +25 -7
- package/src/LensTick.tsx +90 -0
- package/src/Ruler.ts +32 -0
- package/src/RulerContext.tsx +20 -0
- package/src/RulerDatePicker.tsx +41 -439
- package/src/RulerDateRangePicker.tsx +53 -0
- package/src/RulerHeader.tsx +125 -0
- package/src/RulerIndicator.tsx +84 -0
- package/src/RulerLensTicks.tsx +50 -0
- package/src/RulerLensTrack.tsx +45 -0
- package/src/RulerRange.ts +33 -0
- package/src/RulerRangeContext.tsx +20 -0
- package/src/RulerRangeHeader.tsx +180 -0
- package/src/RulerRangeHighlight.tsx +47 -0
- package/src/RulerRangeIndicator.tsx +85 -0
- package/src/RulerRangeRoot.tsx +87 -0
- package/src/RulerRangeTicks.tsx +68 -0
- package/src/RulerRangeTrack.tsx +39 -0
- package/src/RulerResetButton.tsx +59 -0
- package/src/RulerRoot.tsx +93 -0
- package/src/RulerTicks.tsx +57 -0
- package/src/RulerTrack.tsx +39 -0
- package/src/Tick.tsx +60 -49
- package/src/defaults.ts +21 -19
- package/src/index.ts +83 -1
- package/src/presets.ts +108 -0
- package/src/tickResolver.ts +123 -0
- package/src/types.ts +354 -102
- package/src/useHaptics.web.ts +55 -0
- package/src/useRulerDatePicker.ts +373 -0
- package/src/useRulerDateRangePicker.ts +468 -0
- package/src/utils.ts +67 -68
- package/lib/commonjs/package.json +0 -1
- package/lib/module/package.json +0 -1
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { View, StyleSheet } from 'react-native';
|
|
5
|
+
import { useRulerContext } from "./RulerContext.js";
|
|
6
|
+
import { DEFAULTS } from "./defaults.js";
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
export function RulerIndicator({
|
|
9
|
+
children,
|
|
10
|
+
width: customWidth,
|
|
11
|
+
height: customHeight,
|
|
12
|
+
color: customColor,
|
|
13
|
+
offset: customOffset,
|
|
14
|
+
style,
|
|
15
|
+
render
|
|
16
|
+
} = {}) {
|
|
17
|
+
const {
|
|
18
|
+
indicatorConfig,
|
|
19
|
+
theme
|
|
20
|
+
} = useRulerContext();
|
|
21
|
+
const customRenderer = render ?? indicatorConfig?.render;
|
|
22
|
+
const offset = customOffset ?? indicatorConfig?.offset ?? [0, 0];
|
|
23
|
+
const [offsetX = 0, offsetY = 0] = offset;
|
|
24
|
+
const indicatorStyle = style ?? indicatorConfig?.style;
|
|
25
|
+
if (children || customRenderer) {
|
|
26
|
+
return /*#__PURE__*/_jsx(View, {
|
|
27
|
+
pointerEvents: "none",
|
|
28
|
+
style: [styles.indicator, {
|
|
29
|
+
bottom: offsetY,
|
|
30
|
+
transform: [{
|
|
31
|
+
translateX: offsetX
|
|
32
|
+
}]
|
|
33
|
+
}, indicatorStyle],
|
|
34
|
+
children: children ?? customRenderer?.()
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
const width = customWidth ?? indicatorConfig?.width ?? DEFAULTS.indicatorWidth;
|
|
38
|
+
const height = customHeight ?? indicatorConfig?.height ?? DEFAULTS.indicatorHeight;
|
|
39
|
+
const color = customColor ?? indicatorConfig?.color ?? theme.indicatorColor;
|
|
40
|
+
return /*#__PURE__*/_jsx(View, {
|
|
41
|
+
pointerEvents: "none",
|
|
42
|
+
style: [styles.indicator, {
|
|
43
|
+
bottom: offsetY,
|
|
44
|
+
transform: [{
|
|
45
|
+
translateX: offsetX
|
|
46
|
+
}],
|
|
47
|
+
width,
|
|
48
|
+
height,
|
|
49
|
+
backgroundColor: color,
|
|
50
|
+
borderRadius: width / 2
|
|
51
|
+
}, indicatorStyle]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
const styles = StyleSheet.create({
|
|
55
|
+
indicator: {
|
|
56
|
+
position: 'absolute',
|
|
57
|
+
zIndex: 10,
|
|
58
|
+
alignItems: 'center',
|
|
59
|
+
justifyContent: 'center'
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=RulerIndicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","View","StyleSheet","useRulerContext","DEFAULTS","jsx","_jsx","RulerIndicator","children","width","customWidth","height","customHeight","color","customColor","offset","customOffset","style","render","indicatorConfig","theme","customRenderer","offsetX","offsetY","indicatorStyle","pointerEvents","styles","indicator","bottom","transform","translateX","indicatorWidth","indicatorHeight","indicatorColor","backgroundColor","borderRadius","create","position","zIndex","alignItems","justifyContent"],"sourceRoot":"../../src","sources":["RulerIndicator.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,UAAU,QAAwC,cAAc;AAC/E,SAASC,eAAe,QAAQ,mBAAgB;AAChD,SAASC,QAAQ,QAAQ,eAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAgBtC,OAAO,SAASC,cAAcA,CAAC;EAC7BC,QAAQ;EACRC,KAAK,EAAEC,WAAW;EAClBC,MAAM,EAAEC,YAAY;EACpBC,KAAK,EAAEC,WAAW;EAClBC,MAAM,EAAEC,YAAY;EACpBC,KAAK;EACLC;AACmB,CAAC,GAAG,CAAC,CAAC,EAAE;EAC3B,MAAM;IAAEC,eAAe;IAAEC;EAAM,CAAC,GAAGjB,eAAe,CAAC,CAAC;EAEpD,MAAMkB,cAAc,GAAGH,MAAM,IAAIC,eAAe,EAAED,MAAM;EACxD,MAAMH,MAAM,GAAGC,YAAY,IAAIG,eAAe,EAAEJ,MAAM,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;EAChE,MAAM,CAACO,OAAO,GAAG,CAAC,EAAEC,OAAO,GAAG,CAAC,CAAC,GAAGR,MAAM;EACzC,MAAMS,cAAc,GAAGP,KAAK,IAAIE,eAAe,EAAEF,KAAK;EAEtD,IAAIT,QAAQ,IAAIa,cAAc,EAAE;IAC9B,oBACEf,IAAA,CAACL,IAAI;MACHwB,aAAa,EAAC,MAAM;MACpBR,KAAK,EAAE,CACLS,MAAM,CAACC,SAAS,EAChB;QACEC,MAAM,EAAEL,OAAO;QACfM,SAAS,EAAE,CAAC;UAAEC,UAAU,EAAER;QAAQ,CAAC;MACrC,CAAC,EACDE,cAAc,CACd;MAAAhB,QAAA,EAEDA,QAAQ,IAAIa,cAAc,GAAG;IAAC,CAC3B,CAAC;EAEX;EAEA,MAAMZ,KAAK,GAAGC,WAAW,IAAIS,eAAe,EAAEV,KAAK,IAAIL,QAAQ,CAAC2B,cAAc;EAC9E,MAAMpB,MAAM,GAAGC,YAAY,IAAIO,eAAe,EAAER,MAAM,IAAIP,QAAQ,CAAC4B,eAAe;EAClF,MAAMnB,KAAK,GAAGC,WAAW,IAAIK,eAAe,EAAEN,KAAK,IAAIO,KAAK,CAACa,cAAc;EAE3E,oBACE3B,IAAA,CAACL,IAAI;IACHwB,aAAa,EAAC,MAAM;IACpBR,KAAK,EAAE,CACLS,MAAM,CAACC,SAAS,EAChB;MACEC,MAAM,EAAEL,OAAO;MACfM,SAAS,EAAE,CAAC;QAAEC,UAAU,EAAER;MAAQ,CAAC,CAAC;MACpCb,KAAK;MACLE,MAAM;MACNuB,eAAe,EAAErB,KAAK;MACtBsB,YAAY,EAAE1B,KAAK,GAAG;IACxB,CAAC,EACDe,cAAc;EACd,CACH,CAAC;AAEN;AAEA,MAAME,MAAM,GAAGxB,UAAU,CAACkC,MAAM,CAAC;EAC/BT,SAAS,EAAE;IACTU,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,EAAE;IACVC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { StyleSheet, View } from 'react-native';
|
|
5
|
+
import { useRulerContext } from "./RulerContext.js";
|
|
6
|
+
import { LensTick } from "./LensTick.js";
|
|
7
|
+
import { DEFAULT_LENS_CONFIG } from "./defaults.js";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
/**
|
|
10
|
+
* Ticks container rendering ticks with dynamic non-linear fisheye lens spacing.
|
|
11
|
+
*/
|
|
12
|
+
export function RulerLensTicks({
|
|
13
|
+
style,
|
|
14
|
+
config: propConfig
|
|
15
|
+
} = {}) {
|
|
16
|
+
const {
|
|
17
|
+
translateX,
|
|
18
|
+
visibleTicks,
|
|
19
|
+
tickSpacing,
|
|
20
|
+
rulerHeight,
|
|
21
|
+
lensConfig: contextConfig
|
|
22
|
+
} = useRulerContext();
|
|
23
|
+
const config = propConfig ? {
|
|
24
|
+
...DEFAULT_LENS_CONFIG,
|
|
25
|
+
...propConfig
|
|
26
|
+
} : contextConfig ?? DEFAULT_LENS_CONFIG;
|
|
27
|
+
return /*#__PURE__*/_jsx(View, {
|
|
28
|
+
pointerEvents: "none",
|
|
29
|
+
style: [styles.ticksContainer, style],
|
|
30
|
+
children: visibleTicks.map(tick => /*#__PURE__*/_jsx(LensTick, {
|
|
31
|
+
tick: tick,
|
|
32
|
+
tickSpacing: tickSpacing,
|
|
33
|
+
rulerHeight: rulerHeight,
|
|
34
|
+
translateX: translateX,
|
|
35
|
+
magnification: config.magnification,
|
|
36
|
+
radius: config.radius,
|
|
37
|
+
scaleTicks: config.scaleTicks
|
|
38
|
+
}, tick.offset))
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
const styles = StyleSheet.create({
|
|
42
|
+
ticksContainer: {
|
|
43
|
+
position: 'absolute',
|
|
44
|
+
height: '100%',
|
|
45
|
+
width: '100%',
|
|
46
|
+
left: 0,
|
|
47
|
+
top: 0
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=RulerLensTicks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","StyleSheet","View","useRulerContext","LensTick","DEFAULT_LENS_CONFIG","jsx","_jsx","RulerLensTicks","style","config","propConfig","translateX","visibleTicks","tickSpacing","rulerHeight","lensConfig","contextConfig","pointerEvents","styles","ticksContainer","children","map","tick","magnification","radius","scaleTicks","offset","create","position","height","width","left","top"],"sourceRoot":"../../src","sources":["RulerLensTicks.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,EAAEC,IAAI,QAAwC,cAAc;AAC/E,SAASC,eAAe,QAA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
3
|
+
import React from 'react';
|
|
4
|
+
import { View, StyleSheet } from 'react-native';
|
|
5
|
+
import { GestureDetector } from 'react-native-gesture-handler';
|
|
6
|
+
import { useRulerContext } from "./RulerContext.js";
|
|
7
|
+
import { RulerIndicator } from "./RulerIndicator.js";
|
|
8
|
+
import { RulerLensTicks } from "./RulerLensTicks.js";
|
|
9
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
/**
|
|
11
|
+
* Horizontal ruler track with pan gesture detection and non-linear fisheye lens distortion.
|
|
12
|
+
*/
|
|
13
|
+
export function RulerLensTrack({
|
|
14
|
+
children,
|
|
15
|
+
style,
|
|
16
|
+
config
|
|
17
|
+
} = {}) {
|
|
18
|
+
const {
|
|
19
|
+
panGesture,
|
|
20
|
+
rulerHeight,
|
|
21
|
+
width
|
|
22
|
+
} = useRulerContext();
|
|
23
|
+
return /*#__PURE__*/_jsx(GestureDetector, {
|
|
24
|
+
gesture: panGesture,
|
|
25
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
26
|
+
style: [styles.rulerContainer, {
|
|
27
|
+
width,
|
|
28
|
+
height: rulerHeight
|
|
29
|
+
}, style],
|
|
30
|
+
children: children ? children : /*#__PURE__*/_jsxs(_Fragment, {
|
|
31
|
+
children: [/*#__PURE__*/_jsx(RulerIndicator, {}), /*#__PURE__*/_jsx(RulerLensTicks, {
|
|
32
|
+
config: config
|
|
33
|
+
})]
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
const styles = StyleSheet.create({
|
|
39
|
+
rulerContainer: {
|
|
40
|
+
position: 'relative',
|
|
41
|
+
flexDirection: 'row',
|
|
42
|
+
alignItems: 'flex-end',
|
|
43
|
+
justifyContent: 'center',
|
|
44
|
+
overflow: 'hidden'
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=RulerLensTrack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","View","StyleSheet","GestureDetector","useRulerContext","RulerIndicator","RulerLensTicks","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","RulerLensTrack","children","style","config","panGesture","rulerHeight","width","gesture","styles","rulerContainer","height","create","position","flexDirection","alignItems","justifyContent","overflow"],"sourceRoot":"../../src","sources":["RulerLensTrack.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,UAAU,QAAwC,cAAc;AAC/E,SAASC,eAAe,QAAQ,8BAA8B;AAC9D,SAASC,eAAe,QAAQ,mBAAgB;AAChD,SAASC,cAAc,QAAQ,qBAAkB;AACjD,SAASC,cAAc,QAAQ,qBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AASlD;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAC;EAAEC,QAAQ;EAAEC,KAAK;EAAEC;AAA4B,CAAC,GAAG,CAAC,CAAC,EAAE;EACpF,MAAM;IAAEC,UAAU;IAAEC,WAAW;IAAEC;EAAM,CAAC,GAAGf,eAAe,CAAC,CAAC;EAE5D,oBACEI,IAAA,CAACL,eAAe;IAACiB,OAAO,EAAEH,UAAW;IAAAH,QAAA,eACnCN,IAAA,CAACP,IAAI;MAACc,KAAK,EAAE,CAACM,MAAM,CAACC,cAAc,EAAE;QAAEH,KAAK;QAAEI,MAAM,EAAEL;MAAY,CAAC,EAAEH,KAAK,CAAE;MAAAD,QAAA,EACzEA,QAAQ,GACPA,QAAQ,gBAERF,KAAA,CAAAF,SAAA;QAAAI,QAAA,gBACEN,IAAA,CAACH,cAAc,IAAE,CAAC,eAClBG,IAAA,CAACF,cAAc;UAACU,MAAM,EAAEA;QAAO,CAAE,CAAC;MAAA,CAClC;IACH,CACG;EAAC,CACQ,CAAC;AAEtB;AAEA,MAAMK,MAAM,GAAGnB,UAAU,CAACsB,MAAM,CAAC;EAC/BF,cAAc,EAAE;IACdG,QAAQ,EAAE,UAAU;IACpBC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,UAAU;IACtBC,cAAc,EAAE,QAAQ;IACxBC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { RulerRangeRoot } from "./RulerRangeRoot.js";
|
|
4
|
+
import { RulerRangeTrack } from "./RulerRangeTrack.js";
|
|
5
|
+
import { RulerRangeHeader } from "./RulerRangeHeader.js";
|
|
6
|
+
import { RulerRangeIndicator } from "./RulerRangeIndicator.js";
|
|
7
|
+
import { RulerRangeHighlight } from "./RulerRangeHighlight.js";
|
|
8
|
+
import { RulerRangeTicks } from "./RulerRangeTicks.js";
|
|
9
|
+
import { Tick } from "./Tick.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Compound Anatomy API for Date Range Ruler Picker.
|
|
13
|
+
*
|
|
14
|
+
* @experimental This compound API is experimental and subject to breaking changes.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <RulerRange.Root value={range} onChange={setRange}>
|
|
19
|
+
* <RulerRange.Header />
|
|
20
|
+
* <RulerRange.Track>
|
|
21
|
+
* <RulerRange.Indicator />
|
|
22
|
+
* <RulerRange.Ticks />
|
|
23
|
+
* </RulerRange.Track>
|
|
24
|
+
* </RulerRange.Root>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export const RulerRange = {
|
|
28
|
+
Root: RulerRangeRoot,
|
|
29
|
+
Track: RulerRangeTrack,
|
|
30
|
+
Indicator: RulerRangeIndicator,
|
|
31
|
+
Header: RulerRangeHeader,
|
|
32
|
+
Highlight: RulerRangeHighlight,
|
|
33
|
+
Ticks: RulerRangeTicks,
|
|
34
|
+
Tick: Tick
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=RulerRange.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["RulerRangeRoot","RulerRangeTrack","RulerRangeHeader","RulerRangeIndicator","RulerRangeHighlight","RulerRangeTicks","Tick","RulerRange","Root","Track","Indicator","Header","Highlight","Ticks"],"sourceRoot":"../../src","sources":["RulerRange.ts"],"mappings":";;AAAA,SAASA,cAAc,QAAQ,qBAAkB;AACjD,SAASC,eAAe,QAAQ,sBAAmB;AACnD,SAASC,gBAAgB,QAAQ,uBAAoB;AACrD,SAASC,mBAAmB,QAAQ,0BAAuB;AAC3D,SAASC,mBAAmB,QAAQ,0BAAuB;AAC3D,SAASC,eAAe,QAAQ,sBAAmB;AACnD,SAASC,IAAI,QAAQ,WAAQ;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,GAAG;EACxBC,IAAI,EAAER,cAAc;EACpBS,KAAK,EAAER,eAAe;EACtBS,SAAS,EAAEP,mBAAmB;EAC9BQ,MAAM,EAAET,gBAAgB;EACxBU,SAAS,EAAER,mBAAmB;EAC9BS,KAAK,EAAER,eAAe;EACtBC,IAAI,EAAEA;AACR,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createContext, useContext } from 'react';
|
|
4
|
+
export const RulerRangeContext = /*#__PURE__*/createContext(null);
|
|
5
|
+
export function useRulerRangeContext() {
|
|
6
|
+
const context = useContext(RulerRangeContext);
|
|
7
|
+
if (!context) {
|
|
8
|
+
throw new Error('RulerRange compound subcomponents must be rendered within a <RulerRange.Root> provider.');
|
|
9
|
+
}
|
|
10
|
+
return context;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=RulerRangeContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","useContext","RulerRangeContext","useRulerRangeContext","context","Error"],"sourceRoot":"../../src","sources":["RulerRangeContext.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO;AAWjD,OAAO,MAAMC,iBAAiB,gBAAGF,aAAa,CAAgC,IAAI,CAAC;AAEnF,OAAO,SAASG,oBAAoBA,CAAA,EAA2B;EAC7D,MAAMC,OAAO,GAAGH,UAAU,CAACC,iBAAiB,CAAC;EAC7C,IAAI,CAACE,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CAAC,yFAAyF,CAAC;EAC5G;EACA,OAAOD,OAAO;AAChB","ignoreList":[]}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { View, Text, TouchableOpacity, StyleSheet } from 'react-native';
|
|
5
|
+
import { useRulerRangeContext } from "./RulerRangeContext.js";
|
|
6
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
export function RulerRangeHeader({
|
|
8
|
+
children,
|
|
9
|
+
style,
|
|
10
|
+
dateStyle,
|
|
11
|
+
format: customFormat,
|
|
12
|
+
render
|
|
13
|
+
} = {}) {
|
|
14
|
+
const {
|
|
15
|
+
startDate,
|
|
16
|
+
endDate,
|
|
17
|
+
spanDays,
|
|
18
|
+
activeHandle,
|
|
19
|
+
scrollToHandle,
|
|
20
|
+
theme,
|
|
21
|
+
headerConfig,
|
|
22
|
+
locale = 'default'
|
|
23
|
+
} = useRulerRangeContext();
|
|
24
|
+
const headerStyle = style ?? headerConfig?.style;
|
|
25
|
+
if (children) {
|
|
26
|
+
return /*#__PURE__*/_jsx(View, {
|
|
27
|
+
style: [styles.headerContainer, headerStyle],
|
|
28
|
+
children: children
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
const customRenderer = render ?? headerConfig?.render;
|
|
32
|
+
if (customRenderer) {
|
|
33
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
34
|
+
children: customRenderer({
|
|
35
|
+
start: startDate,
|
|
36
|
+
end: endDate,
|
|
37
|
+
spanDays,
|
|
38
|
+
activeHandle,
|
|
39
|
+
scrollToHandle
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
const formatFn = customFormat ?? headerConfig?.format;
|
|
44
|
+
const startFormatted = formatFn ? formatFn(startDate) : startDate.toLocaleDateString(locale, {
|
|
45
|
+
month: 'short',
|
|
46
|
+
day: 'numeric'
|
|
47
|
+
});
|
|
48
|
+
const endFormatted = formatFn ? formatFn(endDate) : endDate.toLocaleDateString(locale, {
|
|
49
|
+
month: 'short',
|
|
50
|
+
day: 'numeric'
|
|
51
|
+
});
|
|
52
|
+
const resolvedDateStyle = dateStyle ?? headerConfig?.dateStyle;
|
|
53
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
54
|
+
style: [styles.headerContainer, headerStyle],
|
|
55
|
+
children: [/*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
56
|
+
activeOpacity: 0.7,
|
|
57
|
+
onPress: () => scrollToHandle('start', true),
|
|
58
|
+
style: [styles.pill, activeHandle === 'start' && {
|
|
59
|
+
borderColor: theme.accentColor,
|
|
60
|
+
backgroundColor: `${theme.accentColor}15`
|
|
61
|
+
}],
|
|
62
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
63
|
+
style: [styles.subLabel, {
|
|
64
|
+
color: theme.labelColor
|
|
65
|
+
}],
|
|
66
|
+
children: "START"
|
|
67
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
68
|
+
style: [styles.dateLabel, {
|
|
69
|
+
color: activeHandle === 'start' ? theme.accentColor : theme.labelColor
|
|
70
|
+
}, resolvedDateStyle],
|
|
71
|
+
children: startFormatted
|
|
72
|
+
})]
|
|
73
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
74
|
+
style: styles.arrowContainer,
|
|
75
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
76
|
+
style: [styles.arrowText, {
|
|
77
|
+
color: theme.labelColor
|
|
78
|
+
}],
|
|
79
|
+
children: "\u2794"
|
|
80
|
+
}), /*#__PURE__*/_jsxs(Text, {
|
|
81
|
+
style: [styles.spanText, {
|
|
82
|
+
color: theme.accentColor
|
|
83
|
+
}],
|
|
84
|
+
children: [spanDays, " ", spanDays === 1 ? 'day' : 'days']
|
|
85
|
+
})]
|
|
86
|
+
}), /*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
87
|
+
activeOpacity: 0.7,
|
|
88
|
+
onPress: () => scrollToHandle('end', true),
|
|
89
|
+
style: [styles.pill, activeHandle === 'end' && {
|
|
90
|
+
borderColor: theme.accentColor,
|
|
91
|
+
backgroundColor: `${theme.accentColor}15`
|
|
92
|
+
}],
|
|
93
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
94
|
+
style: [styles.subLabel, {
|
|
95
|
+
color: theme.labelColor
|
|
96
|
+
}],
|
|
97
|
+
children: "END"
|
|
98
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
99
|
+
style: [styles.dateLabel, {
|
|
100
|
+
color: activeHandle === 'end' ? theme.accentColor : theme.labelColor
|
|
101
|
+
}, resolvedDateStyle],
|
|
102
|
+
children: endFormatted
|
|
103
|
+
})]
|
|
104
|
+
})]
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
const styles = StyleSheet.create({
|
|
108
|
+
headerContainer: {
|
|
109
|
+
flexDirection: 'row',
|
|
110
|
+
alignItems: 'center',
|
|
111
|
+
justifyContent: 'center',
|
|
112
|
+
width: '100%',
|
|
113
|
+
paddingHorizontal: 20,
|
|
114
|
+
marginBottom: 16,
|
|
115
|
+
minHeight: 48
|
|
116
|
+
},
|
|
117
|
+
pill: {
|
|
118
|
+
paddingVertical: 6,
|
|
119
|
+
paddingHorizontal: 14,
|
|
120
|
+
borderRadius: 20,
|
|
121
|
+
borderWidth: 1.5,
|
|
122
|
+
borderColor: 'transparent',
|
|
123
|
+
alignItems: 'center'
|
|
124
|
+
},
|
|
125
|
+
subLabel: {
|
|
126
|
+
fontSize: 9,
|
|
127
|
+
fontWeight: '700',
|
|
128
|
+
letterSpacing: 0.5,
|
|
129
|
+
marginBottom: 2
|
|
130
|
+
},
|
|
131
|
+
dateLabel: {
|
|
132
|
+
fontSize: 14,
|
|
133
|
+
fontWeight: '700'
|
|
134
|
+
},
|
|
135
|
+
arrowContainer: {
|
|
136
|
+
marginHorizontal: 12,
|
|
137
|
+
alignItems: 'center'
|
|
138
|
+
},
|
|
139
|
+
arrowText: {
|
|
140
|
+
fontSize: 12,
|
|
141
|
+
fontWeight: '600'
|
|
142
|
+
},
|
|
143
|
+
spanText: {
|
|
144
|
+
fontSize: 10,
|
|
145
|
+
fontWeight: '600',
|
|
146
|
+
marginTop: 2
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
//# sourceMappingURL=RulerRangeHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","View","Text","TouchableOpacity","StyleSheet","useRulerRangeContext","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","RulerRangeHeader","children","style","dateStyle","format","customFormat","render","startDate","endDate","spanDays","activeHandle","scrollToHandle","theme","headerConfig","locale","headerStyle","styles","headerContainer","customRenderer","start","end","formatFn","startFormatted","toLocaleDateString","month","day","endFormatted","resolvedDateStyle","activeOpacity","onPress","pill","borderColor","accentColor","backgroundColor","subLabel","color","labelColor","dateLabel","arrowContainer","arrowText","spanText","create","flexDirection","alignItems","justifyContent","width","paddingHorizontal","marginBottom","minHeight","paddingVertical","borderRadius","borderWidth","fontSize","fontWeight","letterSpacing","marginHorizontal","marginTop"],"sourceRoot":"../../src","sources":["RulerRangeHeader.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACEC,IAAI,EACJC,IAAI,EACJC,gBAAgB,EAChBC,UAAU,QAIL,cAAc;AACrB,SAASC,oBAAoB,QAAQ,wBAAqB;AAAC,SAAAC,GAAA,IAAAC,IAAA,E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,CAAC;EACDlB,IAAI,EAAE;IACJmB,eAAe,EAAE,CAAC;IAClBH,iBAAiB,EAAE,EAAE;IACrBI,YAAY,EAAE,EAAE;IAChBC,WAAW,EAAE,GAAG;IAChBpB,WAAW,EAAE,aAAa;IAC1BY,UAAU,EAAE;EACd,CAAC;EACDT,QAAQ,EAAE;IACRkB,QAAQ,EAAE,CAAC;IACXC,UAAU,EAAE,KAAK;IACjBC,aAAa,EAAE,GAAG;IAClBP,YAAY,EAAE;EAChB,CAAC;EACDV,SAAS,EAAE;IACTe,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd,CAAC;EACDf,cAAc,EAAE;IACdiB,gBAAgB,EAAE,EAAE;IACpBZ,UAAU,EAAE;EACd,CAAC;EACDJ,SAAS,EAAE;IACTa,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd,CAAC;EACDb,QAAQ,EAAE;IACRY,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,KAAK;IACjBG,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { View, StyleSheet } from 'react-native';
|
|
5
|
+
import { useRulerRangeContext } from "./RulerRangeContext.js";
|
|
6
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
export function RulerRangeHighlight({
|
|
8
|
+
style,
|
|
9
|
+
color
|
|
10
|
+
} = {}) {
|
|
11
|
+
const {
|
|
12
|
+
startOffset,
|
|
13
|
+
endOffset,
|
|
14
|
+
tickSpacing,
|
|
15
|
+
rulerHeight,
|
|
16
|
+
theme,
|
|
17
|
+
highlightConfig
|
|
18
|
+
} = useRulerRangeContext();
|
|
19
|
+
if (highlightConfig?.render) {
|
|
20
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
21
|
+
children: highlightConfig.render(startOffset, endOffset, tickSpacing)
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
const highlightColor = color ?? highlightConfig?.color ?? theme.rangeHighlightColor;
|
|
25
|
+
const left = startOffset * tickSpacing - tickSpacing / 2;
|
|
26
|
+
const width = Math.max(tickSpacing, (endOffset - startOffset + 1) * tickSpacing);
|
|
27
|
+
return /*#__PURE__*/_jsx(View, {
|
|
28
|
+
pointerEvents: "none",
|
|
29
|
+
style: [styles.highlight, {
|
|
30
|
+
left,
|
|
31
|
+
width,
|
|
32
|
+
height: rulerHeight,
|
|
33
|
+
backgroundColor: highlightColor
|
|
34
|
+
}, highlightConfig?.style, style]
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
const styles = StyleSheet.create({
|
|
38
|
+
highlight: {
|
|
39
|
+
position: 'absolute',
|
|
40
|
+
bottom: 0,
|
|
41
|
+
borderRadius: 8,
|
|
42
|
+
zIndex: 1
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=RulerRangeHighlight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","View","StyleSheet","useRulerRangeContext","Fragment","_Fragment","jsx","_jsx","RulerRangeHighlight","style","color","startOffset","endOffset","tickSpacing","rulerHeight","theme","highlightConfig","render","children","highlightColor","rangeHighlightColor","left","width","Math","max","pointerEvents","styles","highlight","height","backgroundColor","create","position","bottom","borderRadius","zIndex"],"sourceRoot":"../../src","sources":["RulerRangeHighlight.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,UAAU,QAAwC,cAAc;AAC/E,SAASC,oBAAoB,QAAQ,wBAAqB;AAAC,SAAAC,QAAA,IAAAC,SAAA,EAAAC,GAAA,IAAAC,IAAA;AAO3D,OAAO,SAASC,mBAAmBA,CAAC;EAAEC,KAAK;EAAEC;AAAgC,CAAC,GAAG,CAAC,CAAC,EAAE;EACnF,MAAM;IAAEC,WAAW;IAAEC,SAAS;IAAEC,WAAW;IAAEC,WAAW;IAAEC,KAAK;IAAEC;EAAgB,CAAC,GAChFb,oBAAoB,CAAC,CAAC;EAExB,IAAIa,eAAe,EAAEC,MAAM,EAAE;IAC3B,oBAAOV,IAAA,CAAAF,SAAA;MAAAa,QAAA,EAAGF,eAAe,CAACC,MAAM,CAACN,WAAW,EAAEC,SAAS,EAAEC,WAAW;IAAC,CAAG,CAAC;EAC3E;EAEA,MAAMM,cAAc,GAAGT,KAAK,IAAIM,eAAe,EAAEN,KAAK,IAAIK,KAAK,CAACK,mBAAmB;EACnF,MAAMC,IAAI,GAAGV,WAAW,GAAGE,WAAW,GAAGA,WAAW,GAAG,CAAC;EACxD,MAAMS,KAAK,GAAGC,IAAI,CAACC,GAAG,CAACX,WAAW,EAAE,CAACD,SAAS,GAAGD,WAAW,GAAG,CAAC,IAAIE,WAAW,CAAC;EAEhF,oBACEN,IAAA,CAACN,IAAI;IACHwB,aAAa,EAAC,MAAM;IACpBhB,KAAK,EAAE,CACLiB,MAAM,CAACC,SAAS,EAChB;MACEN,IAAI;MACJC,KAAK;MACLM,MAAM,EAAEd,WAAW;MACnBe,eAAe,EAAEV;IACnB,CAAC,EACDH,eAAe,EAAEP,KAAK,EACtBA,KAAK;EACL,CACH,CAAC;AAEN;AAEA,MAAMiB,MAAM,GAAGxB,UAAU,CAAC4B,MAAM,CAAC;EAC/BH,SAAS,EAAE;IACTI,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,CAAC;IACTC,YAAY,EAAE,CAAC;IACfC,MAAM,EAAE;EACV;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { View, StyleSheet } from 'react-native';
|
|
5
|
+
import { useRulerRangeContext } from "./RulerRangeContext.js";
|
|
6
|
+
import { DEFAULTS } from "./defaults.js";
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
export function RulerRangeIndicator({
|
|
9
|
+
children,
|
|
10
|
+
width: customWidth,
|
|
11
|
+
height: customHeight,
|
|
12
|
+
color: customColor,
|
|
13
|
+
offset: customOffset,
|
|
14
|
+
style,
|
|
15
|
+
render
|
|
16
|
+
} = {}) {
|
|
17
|
+
const {
|
|
18
|
+
indicatorConfig,
|
|
19
|
+
theme,
|
|
20
|
+
activeHandle,
|
|
21
|
+
startDate,
|
|
22
|
+
endDate
|
|
23
|
+
} = useRulerRangeContext();
|
|
24
|
+
const activeDate = activeHandle === 'start' ? startDate : endDate;
|
|
25
|
+
const customRenderer = render ?? indicatorConfig?.render;
|
|
26
|
+
const offset = customOffset ?? indicatorConfig?.offset ?? [0, 0];
|
|
27
|
+
const [offsetX = 0, offsetY = 0] = offset;
|
|
28
|
+
const indicatorStyle = style ?? indicatorConfig?.style;
|
|
29
|
+
if (children || customRenderer) {
|
|
30
|
+
return /*#__PURE__*/_jsx(View, {
|
|
31
|
+
pointerEvents: "none",
|
|
32
|
+
style: [styles.indicator, {
|
|
33
|
+
bottom: offsetY,
|
|
34
|
+
transform: [{
|
|
35
|
+
translateX: offsetX
|
|
36
|
+
}]
|
|
37
|
+
}, indicatorStyle],
|
|
38
|
+
children: children ?? customRenderer?.(activeHandle, activeDate)
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
const width = customWidth ?? indicatorConfig?.width ?? DEFAULTS.indicatorWidth;
|
|
42
|
+
const height = customHeight ?? indicatorConfig?.height ?? DEFAULTS.indicatorHeight;
|
|
43
|
+
const color = customColor ?? indicatorConfig?.color ?? theme.indicatorColor;
|
|
44
|
+
return /*#__PURE__*/_jsx(View, {
|
|
45
|
+
pointerEvents: "none",
|
|
46
|
+
style: [styles.indicator, {
|
|
47
|
+
bottom: offsetY,
|
|
48
|
+
transform: [{
|
|
49
|
+
translateX: offsetX
|
|
50
|
+
}],
|
|
51
|
+
width,
|
|
52
|
+
height,
|
|
53
|
+
backgroundColor: color,
|
|
54
|
+
borderRadius: width / 2
|
|
55
|
+
}, indicatorStyle]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
const styles = StyleSheet.create({
|
|
59
|
+
indicator: {
|
|
60
|
+
position: 'absolute',
|
|
61
|
+
zIndex: 10,
|
|
62
|
+
alignItems: 'center',
|
|
63
|
+
justifyContent: 'center'
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=RulerRangeIndicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","View","StyleSheet","useRulerRangeContext","DEFAULTS","jsx","_jsx","RulerRangeIndicator","children","width","customWidth","height","customHeight","color","customColor","offset","customOffset","style","render","indicatorConfig","theme","activeHandle","startDate","endDate","activeDate","customRenderer","offsetX","offsetY","indicatorStyle","pointerEvents","styles","indicator","bottom","transform","translateX","indicatorWidth","indicatorHeight","indicatorColor","backgroundColor","borderRadius","create","position","zIndex","alignItems","justifyContent"],"sourceRoot":"../../src","sources":["RulerRangeIndicator.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,UAAU,QAAwC,cAAc;AAC/E,SAASC,oBAAoB,QAAQ,wBAAqB;AAC1D,SAASC,QAAQ,QAAQ,eAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAgBtC,OAAO,SAASC,mBAAmBA,CAAC;EAClCC,QAAQ;EACRC,KAAK,EAAEC,WAAW;EAClBC,MAAM,EAAEC,YAAY;EACpBC,KAAK,EAAEC,WAAW;EAClBC,MAAM,EAAEC,YAAY;EACpBC,KAAK;EACLC;AACwB,CAAC,GAAG,CAAC,CAAC,EAAE;EAChC,MAAM;IAAEC,eAAe;IAAEC,KAAK;IAAEC,YAAY;IAAEC,SAAS;IAAEC;EAAQ,CAAC,GAAGpB,oBAAoB,CAAC,CAAC;EAE3F,MAAMqB,UAAU,GAAGH,YAAY,KAAK,OAAO,GAAGC,SAAS,GAAGC,OAAO;EACjE,MAAME,cAAc,GA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AAME,MAAM,GAAG5B,UAAU,CAACsC,MAAM,CAAC;EAC/BT,SAAS,EAAE;IACTU,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,EAAE;IACVC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { View, StyleSheet } from 'react-native';
|
|
5
|
+
import { useRulerDateRangePicker } from "./useRulerDateRangePicker.js";
|
|
6
|
+
import { RulerRangeContext } from "./RulerRangeContext.js";
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
export function RulerRangeRoot(props) {
|
|
9
|
+
const {
|
|
10
|
+
children,
|
|
11
|
+
style,
|
|
12
|
+
indicator,
|
|
13
|
+
highlight,
|
|
14
|
+
testID
|
|
15
|
+
} = props;
|
|
16
|
+
const rangeRuler = useRulerDateRangePicker(props);
|
|
17
|
+
const indicatorConfig = typeof indicator === 'object' ? indicator : undefined;
|
|
18
|
+
const headerConfig = typeof props.header === 'object' ? props.header : undefined;
|
|
19
|
+
const highlightConfig = typeof highlight === 'object' ? highlight : undefined;
|
|
20
|
+
const contextValue = {
|
|
21
|
+
...rangeRuler,
|
|
22
|
+
indicatorConfig,
|
|
23
|
+
headerConfig,
|
|
24
|
+
highlightConfig,
|
|
25
|
+
locale: props.locale
|
|
26
|
+
};
|
|
27
|
+
return /*#__PURE__*/_jsx(RulerRangeContext.Provider, {
|
|
28
|
+
value: contextValue,
|
|
29
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
30
|
+
testID: testID,
|
|
31
|
+
accessible: true,
|
|
32
|
+
accessibilityRole: "adjustable",
|
|
33
|
+
accessibilityLabel: props.accessibilityLabel ?? 'Date range picker',
|
|
34
|
+
accessibilityValue: {
|
|
35
|
+
text: `${rangeRuler.startDateStr} to ${rangeRuler.endDateStr}`
|
|
36
|
+
},
|
|
37
|
+
accessibilityActions: [{
|
|
38
|
+
name: 'increment',
|
|
39
|
+
label: `Next day for ${rangeRuler.activeHandle} date`
|
|
40
|
+
}, {
|
|
41
|
+
name: 'decrement',
|
|
42
|
+
label: `Previous day for ${rangeRuler.activeHandle} date`
|
|
43
|
+
}],
|
|
44
|
+
onAccessibilityAction: event => {
|
|
45
|
+
const isStart = rangeRuler.activeHandle === 'start';
|
|
46
|
+
const target = new Date(isStart ? rangeRuler.startDate : rangeRuler.endDate);
|
|
47
|
+
if (event.nativeEvent.actionName === 'increment') {
|
|
48
|
+
target.setDate(target.getDate() + 1);
|
|
49
|
+
} else if (event.nativeEvent.actionName === 'decrement') {
|
|
50
|
+
target.setDate(target.getDate() - 1);
|
|
51
|
+
}
|
|
52
|
+
if (isStart) {
|
|
53
|
+
rangeRuler.setRange(target, rangeRuler.endDate);
|
|
54
|
+
} else {
|
|
55
|
+
rangeRuler.setRange(rangeRuler.startDate, target);
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
style: [styles.container, {
|
|
59
|
+
minHeight: rangeRuler.height,
|
|
60
|
+
backgroundColor: rangeRuler.theme.background
|
|
61
|
+
}, style],
|
|
62
|
+
children: children
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
const styles = StyleSheet.create({
|
|
67
|
+
container: {
|
|
68
|
+
justifyContent: 'center',
|
|
69
|
+
alignItems: 'center',
|
|
70
|
+
position: 'relative',
|
|
71
|
+
width: '100%',
|
|
72
|
+
paddingVertical: 8
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
//# sourceMappingURL=RulerRangeRoot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","View","StyleSheet","useRulerDateRangePicker","RulerRangeContext","jsx","_jsx","RulerRangeRoot","props","children","style","indicator","highlight","testID","rangeRuler","indicatorConfig","undefined","headerConfig","header","highlightConfig","contextValue","locale","Provider","value","accessible","accessibilityRole","accessibilityLabel","accessibilityValue","text","startDateStr","endDateStr","accessibilityActions","name","label","activeHandle","onAccessibilityAction","event","isStart","target","Date","startDate","endDate","nativeEvent","actionName","setDate","getDate","setRange","styles","container","minHeight","height","backgroundColor","theme","background","create","justifyContent","alignItems","position","width","paddingVertical"],"sourceRoot":"../../src","sources":["RulerRangeRoot.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AAE/C,SAASC,uBAAuB,QAAQ,8BAA2B;AACnE,SAASC,iBAAiB,QAAQ,wBAAqB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAMxD,OAAO,SAASC,cAAcA,CAACC,KAA0B,EAAE;EACzD,MAAM;IACJC,QAAQ;IACRC,KAAK;IACLC,SAAS;IACTC,SAAS;IACTC;EACF,CAAC,GAAGL,KAAK;EAET,MAAMM,UAAU,GAAGX,uBAAuB,CAACK,KAAK,CAAC;EACjD,MAAMO,eAAiD,GACrD,OAAOJ,SAAS,KAAK,QAAQ,GAAGA,SAAS,GAAGK,SAAS;EACvD,MAAMC,YAAY,GAChB,OAAOT,KAAK,CAACU,MAAM,KAAK,QAAQ,GAAGV,KAAK,CAACU,MAAM,GAAGF,SAAS;EAC7D,MAAMG,eAAe,GACnB,OAAOP,SAAS,KAAK,QAAQ,GAAGA,SAAS,GAAGI,SAAS;EAEvD,MAAMI,YAAY,GAAG;IACnB,GAAGN,UAAU;IACbC,eAAe;IACfE,YAAY;IACZE,eAAe;IACfE,MAAM,EAAEb,KAAK,CAACa;EAChB,CAAC;EAED,oBACEf,IAAA,CAACF,iBAAiB,CAACkB,QAAQ;IAACC,KAAK,EAAEH,YAAa;IAAAX,QAAA,eAC9CH,IAAA,CAACL,IAAI;MACHY,MAAM,EAAEA,MAAO;MACfW,UAAU,EAAE,IAAK;MACjBC,iBAAiB,EAAC,YAAY;MAC9BC,kBAAkB,EAAElB,KAAK,CAACkB,kBAAkB,IAAI,mBA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Q,CACL;EAAC,CACmB,CAAC;AAEjC;AAEA,MAAMsC,MAAM,GAAG7C,UAAU,CAACoD,MAAM,CAAC;EAC/BN,SAAS,EAAE;IACTO,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE,QAAQ;IACpBC,QAAQ,EAAE,UAAU;IACpBC,KAAK,EAAE,MAAM;IACbC,eAAe,EAAE;EACnB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { StyleSheet } from 'react-native';
|
|
5
|
+
import Animated, { useAnimatedStyle } from 'react-native-reanimated';
|
|
6
|
+
import { useRulerRangeContext } from "./RulerRangeContext.js";
|
|
7
|
+
import { RulerRangeHighlight } from "./RulerRangeHighlight.js";
|
|
8
|
+
import { Tick } from "./Tick.js";
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
/**
|
|
11
|
+
* Animated ticks container for the date range picker with Reanimated transform
|
|
12
|
+
* and connected highlight span.
|
|
13
|
+
*/
|
|
14
|
+
export function RulerRangeTicks({
|
|
15
|
+
style,
|
|
16
|
+
renderTick,
|
|
17
|
+
showHighlight = true
|
|
18
|
+
} = {}) {
|
|
19
|
+
const {
|
|
20
|
+
translateX,
|
|
21
|
+
visibleTicks,
|
|
22
|
+
tickSpacing,
|
|
23
|
+
rulerHeight,
|
|
24
|
+
width
|
|
25
|
+
} = useRulerRangeContext();
|
|
26
|
+
const animatedStyle = useAnimatedStyle(() => ({
|
|
27
|
+
transform: [{
|
|
28
|
+
translateX: translateX.value
|
|
29
|
+
}]
|
|
30
|
+
}), [translateX]);
|
|
31
|
+
return /*#__PURE__*/_jsxs(Animated.View, {
|
|
32
|
+
style: [styles.ticksWrapper, {
|
|
33
|
+
left: width / 2
|
|
34
|
+
}, animatedStyle, style],
|
|
35
|
+
children: [showHighlight && /*#__PURE__*/_jsx(RulerRangeHighlight, {}), visibleTicks.map(tick => renderTick ? /*#__PURE__*/_jsx(React.Fragment, {
|
|
36
|
+
children: renderTick(tick, tickSpacing, rulerHeight)
|
|
37
|
+
}, tick.offset) : /*#__PURE__*/_jsx(Tick, {
|
|
38
|
+
tick: tick,
|
|
39
|
+
tickSpacing: tickSpacing,
|
|
40
|
+
rulerHeight: rulerHeight
|
|
41
|
+
}, tick.offset))]
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
const styles = StyleSheet.create({
|
|
45
|
+
ticksWrapper: {
|
|
46
|
+
position: 'absolute',
|
|
47
|
+
height: '100%',
|
|
48
|
+
width: 0
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=RulerRangeTicks.js.map
|