@xaui/native 0.9.1-alpha.91 → 0.9.1-alpha.92
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/chunk-3A5RK2R7.js +40 -0
- package/dist/chunk-6JAGPPZU.cjs +788 -0
- package/dist/chunk-7NQL5DXY.js +302 -0
- package/dist/chunk-FTPPUTWL.cjs +40 -0
- package/dist/chunk-GGP2ERSV.js +487 -0
- package/dist/chunk-KPKEZWZM.js +517 -0
- package/dist/chunk-LKRQUQZQ.cjs +487 -0
- package/dist/{chunk-LIEXFWTN.js → chunk-P5M5URAB.js} +29 -126
- package/dist/chunk-UR37LVPU.cjs +382 -0
- package/dist/chunk-XWIPLZTD.cjs +302 -0
- package/dist/components/carousel/index.cjs +3 -2
- package/dist/components/carousel/index.js +2 -1
- package/dist/components/index.d.cts +3 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/number-pad/index.cjs +40 -0
- package/dist/components/number-pad/index.d.cts +60 -0
- package/dist/components/number-pad/index.d.ts +60 -0
- package/dist/components/number-pad/index.js +40 -0
- package/dist/components/number-pad/number-pad-action.d.cts +24 -0
- package/dist/components/number-pad/number-pad-action.d.ts +24 -0
- package/dist/components/number-pad/number-pad-backspace.d.cts +18 -0
- package/dist/components/number-pad/number-pad-backspace.d.ts +18 -0
- package/dist/components/number-pad/number-pad-cell.d.cts +7 -0
- package/dist/components/number-pad/number-pad-cell.d.ts +7 -0
- package/dist/components/number-pad/number-pad-icon.d.cts +13 -0
- package/dist/components/number-pad/number-pad-icon.d.ts +13 -0
- package/dist/components/number-pad/number-pad-key.d.cts +24 -0
- package/dist/components/number-pad/number-pad-key.d.ts +24 -0
- package/dist/components/number-pad/number-pad-label.d.cts +14 -0
- package/dist/components/number-pad/number-pad-label.d.ts +14 -0
- package/dist/components/number-pad/number-pad.context.d.cts +18 -0
- package/dist/components/number-pad/number-pad.context.d.ts +18 -0
- package/dist/components/number-pad/number-pad.d.cts +57 -0
- package/dist/components/number-pad/number-pad.d.ts +57 -0
- package/dist/components/number-pad/number-pad.recipe.d.cts +11 -0
- package/dist/components/number-pad/number-pad.recipe.d.ts +11 -0
- package/dist/components/number-pad/number-pad.style.d.cts +13 -0
- package/dist/components/number-pad/number-pad.style.d.ts +13 -0
- package/dist/components/number-pad/number-pad.type.d.cts +135 -0
- package/dist/components/number-pad/number-pad.type.d.ts +135 -0
- package/dist/components/number-pad/number-pad.utils.d.cts +34 -0
- package/dist/components/number-pad/number-pad.utils.d.ts +34 -0
- package/dist/components/pager/index.cjs +31 -0
- package/dist/components/pager/index.d.cts +60 -0
- package/dist/components/pager/index.d.ts +60 -0
- package/dist/components/pager/index.js +31 -0
- package/dist/components/pager/pager-content.d.cts +24 -0
- package/dist/components/pager/pager-content.d.ts +24 -0
- package/dist/components/pager/pager-indicator.d.cts +47 -0
- package/dist/components/pager/pager-indicator.d.ts +47 -0
- package/dist/components/pager/pager-page.d.cts +16 -0
- package/dist/components/pager/pager-page.d.ts +16 -0
- package/dist/components/pager/pager.context.d.cts +7 -0
- package/dist/components/pager/pager.context.d.ts +7 -0
- package/dist/components/pager/pager.d.cts +71 -0
- package/dist/components/pager/pager.d.ts +71 -0
- package/dist/components/pager/pager.recipe.d.cts +15 -0
- package/dist/components/pager/pager.recipe.d.ts +15 -0
- package/dist/components/pager/pager.type.d.cts +108 -0
- package/dist/components/pager/pager.type.d.ts +108 -0
- package/dist/components/rating/index.cjs +30 -0
- package/dist/components/rating/index.d.cts +41 -0
- package/dist/components/rating/index.d.ts +41 -0
- package/dist/components/rating/index.js +30 -0
- package/dist/components/rating/rating-icon.d.cts +16 -0
- package/dist/components/rating/rating-icon.d.ts +16 -0
- package/dist/components/rating/rating-item.d.cts +23 -0
- package/dist/components/rating/rating-item.d.ts +23 -0
- package/dist/components/rating/rating-star.d.cts +19 -0
- package/dist/components/rating/rating-star.d.ts +19 -0
- package/dist/components/rating/rating.context.d.cts +16 -0
- package/dist/components/rating/rating.context.d.ts +16 -0
- package/dist/components/rating/rating.d.cts +59 -0
- package/dist/components/rating/rating.d.ts +59 -0
- package/dist/components/rating/rating.recipe.d.cts +11 -0
- package/dist/components/rating/rating.recipe.d.ts +11 -0
- package/dist/components/rating/rating.style.d.cts +24 -0
- package/dist/components/rating/rating.style.d.ts +24 -0
- package/dist/components/rating/rating.type.d.cts +108 -0
- package/dist/components/rating/rating.type.d.ts +108 -0
- package/dist/components/rating/rating.utils.d.cts +28 -0
- package/dist/components/rating/rating.utils.d.ts +28 -0
- package/dist/index.cjs +90 -29
- package/dist/index.js +146 -85
- package/package.json +31 -1
- package/dist/chunk-K5UO3HBW.cjs +0 -1007
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { carouselMetrics, indexFromOffset, progressFromOffset, stepIndex } from "./chunk-3A5RK2R7.js";
|
|
1
2
|
import { useMergedRef } from "./chunk-NCTOTTVW.js";
|
|
2
3
|
import { useControllableState } from "./chunk-F6W3JQ7K.js";
|
|
3
4
|
import { PressableFeedback } from "./chunk-2AFA5HA2.js";
|
|
@@ -12,113 +13,15 @@ import { useStyleProps } from "./chunk-M63GFNKV.js";
|
|
|
12
13
|
import { Children, forwardRef, useEffect } from "react";
|
|
13
14
|
import Animated, { runOnJS, useAnimatedScrollHandler, useSharedValue } from "react-native-reanimated";
|
|
14
15
|
|
|
15
|
-
// src/utils/carousel.ts
|
|
16
|
-
const _worklet_14024102982305_init_data = {
|
|
17
|
-
code: "function clamp_chunkLIEXFWTNJs1(value,low,high){return Math.min(Math.max(value,low),high);}",
|
|
18
|
-
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-LIEXFWTN.js",
|
|
19
|
-
sourceMap: "{\"version\":3,\"names\":[\"clamp_chunkLIEXFWTNJs1\",\"value\",\"low\",\"high\",\"Math\",\"min\",\"max\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-LIEXFWTN.js\"],\"mappings\":\"AAsCA,SAAAA,uBAAAC,KAAA,CAAAC,GAAA,CAAAC,IAAA,SAAAC,IAAA,CAAAC,GAAA,CAAAD,IAAA,CAAAE,GAAA,CAAAL,KAAA,CAAAC,GAAA,EAAAC,IAAA,EACA\",\"ignoreList\":[]}"
|
|
20
|
-
};
|
|
21
|
-
const clamp = function clamp_chunkLIEXFWTNJs1Factory({
|
|
22
|
-
_worklet_14024102982305_init_data
|
|
23
|
-
}) {
|
|
24
|
-
const _e = [new global.Error(), 1, -27];
|
|
25
|
-
const clamp = function (value, low, high) {
|
|
26
|
-
return Math.min(Math.max(value, low), high);
|
|
27
|
-
};
|
|
28
|
-
clamp.__closure = {};
|
|
29
|
-
clamp.__workletHash = 14024102982305;
|
|
30
|
-
clamp.__pluginVersion = "0.7.4";
|
|
31
|
-
clamp.__initData = _worklet_14024102982305_init_data;
|
|
32
|
-
clamp.__stackDetails = _e;
|
|
33
|
-
return clamp;
|
|
34
|
-
}({
|
|
35
|
-
_worklet_14024102982305_init_data
|
|
36
|
-
});
|
|
37
|
-
function carouselMetrics({
|
|
38
|
-
width,
|
|
39
|
-
itemsPerView,
|
|
40
|
-
gap,
|
|
41
|
-
peek
|
|
42
|
-
}) {
|
|
43
|
-
const perView = Math.max(1, Math.floor(itemsPerView));
|
|
44
|
-
const inset = peek > 0 ? peek + gap : 0;
|
|
45
|
-
const between = gap * (perView - 1);
|
|
46
|
-
const itemWidth = Math.max(0, (width - 2 * inset - between) / perView);
|
|
47
|
-
return {
|
|
48
|
-
itemWidth,
|
|
49
|
-
step: itemWidth + gap,
|
|
50
|
-
gap,
|
|
51
|
-
inset
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
const _worklet_3187956754807_init_data = {
|
|
55
|
-
code: "function indexFromOffset_chunkLIEXFWTNJs2(offset,step,count){const{clamp}=this.__closure;if(step<=0||count<=0)return 0;return clamp(Math.round(offset/step),0,count-1);}",
|
|
56
|
-
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-LIEXFWTN.js",
|
|
57
|
-
sourceMap: "{\"version\":3,\"names\":[\"indexFromOffset_chunkLIEXFWTNJs2\",\"offset\",\"step\",\"count\",\"clamp\",\"__closure\",\"Math\",\"round\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-LIEXFWTN.js\"],\"mappings\":\"AAuDA,SAAAA,gCAAuCA,CAAAC,MAAO,CAAAC,IAAA,CAAAC,KAAA,QAAAC,KAAA,OAAAC,SAAA,CAE5C,GAAIH,IAAI,EAAI,CAAC,EAAIC,KAAK,EAAI,CAAC,CAAE,MAAO,EAAC,CACrC,MAAO,CAAAC,KAAK,CAACE,IAAI,CAACC,KAAK,CAACN,MAAM,CAAGC,IAAI,CAAC,CAAE,CAAC,CAAEC,KAAK,CAAG,CAAC,CAAC,CACvD\",\"ignoreList\":[]}"
|
|
58
|
-
};
|
|
59
|
-
const indexFromOffset = function indexFromOffset_chunkLIEXFWTNJs2Factory({
|
|
60
|
-
_worklet_3187956754807_init_data,
|
|
61
|
-
clamp
|
|
62
|
-
}) {
|
|
63
|
-
const _e = [new global.Error(), -2, -27];
|
|
64
|
-
const indexFromOffset = function (offset, step, count) {
|
|
65
|
-
if (step <= 0 || count <= 0) return 0;
|
|
66
|
-
return clamp(Math.round(offset / step), 0, count - 1);
|
|
67
|
-
};
|
|
68
|
-
indexFromOffset.__closure = {
|
|
69
|
-
clamp
|
|
70
|
-
};
|
|
71
|
-
indexFromOffset.__workletHash = 3187956754807;
|
|
72
|
-
indexFromOffset.__pluginVersion = "0.7.4";
|
|
73
|
-
indexFromOffset.__initData = _worklet_3187956754807_init_data;
|
|
74
|
-
indexFromOffset.__stackDetails = _e;
|
|
75
|
-
return indexFromOffset;
|
|
76
|
-
}({
|
|
77
|
-
_worklet_3187956754807_init_data,
|
|
78
|
-
clamp
|
|
79
|
-
});
|
|
80
|
-
const _worklet_11197815536232_init_data = {
|
|
81
|
-
code: "function progressFromOffset_chunkLIEXFWTNJs3(offset,step,count){const{clamp}=this.__closure;if(step<=0||count<=0)return 0;return clamp(offset/step,0,count-1);}",
|
|
82
|
-
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-LIEXFWTN.js",
|
|
83
|
-
sourceMap: "{\"version\":3,\"names\":[\"progressFromOffset_chunkLIEXFWTNJs3\",\"offset\",\"step\",\"count\",\"clamp\",\"__closure\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-LIEXFWTN.js\"],\"mappings\":\"AA4DA,SAAAA,mCAA0CA,CAAAC,MAAO,CAAAC,IAAA,CAAAC,KAAA,QAAAC,KAAA,OAAAC,SAAA,CAE/C,GAAIH,IAAI,EAAI,CAAC,EAAIC,KAAK,EAAI,CAAC,CAAE,MAAO,EAAC,CACrC,MAAO,CAAAC,KAAK,CAACH,MAAM,CAAGC,IAAI,CAAE,CAAC,CAAEC,KAAK,CAAG,CAAC,CAAC,CAC3C\",\"ignoreList\":[]}"
|
|
84
|
-
};
|
|
85
|
-
const progressFromOffset = function progressFromOffset_chunkLIEXFWTNJs3Factory({
|
|
86
|
-
_worklet_11197815536232_init_data,
|
|
87
|
-
clamp
|
|
88
|
-
}) {
|
|
89
|
-
const _e = [new global.Error(), -2, -27];
|
|
90
|
-
const progressFromOffset = function (offset, step, count) {
|
|
91
|
-
if (step <= 0 || count <= 0) return 0;
|
|
92
|
-
return clamp(offset / step, 0, count - 1);
|
|
93
|
-
};
|
|
94
|
-
progressFromOffset.__closure = {
|
|
95
|
-
clamp
|
|
96
|
-
};
|
|
97
|
-
progressFromOffset.__workletHash = 11197815536232;
|
|
98
|
-
progressFromOffset.__pluginVersion = "0.7.4";
|
|
99
|
-
progressFromOffset.__initData = _worklet_11197815536232_init_data;
|
|
100
|
-
progressFromOffset.__stackDetails = _e;
|
|
101
|
-
return progressFromOffset;
|
|
102
|
-
}({
|
|
103
|
-
_worklet_11197815536232_init_data,
|
|
104
|
-
clamp
|
|
105
|
-
});
|
|
106
|
-
function stepIndex(index, delta, count, hasLoop) {
|
|
107
|
-
if (count <= 0) return 0;
|
|
108
|
-
const next = index + delta;
|
|
109
|
-
if (hasLoop) return (next % count + count) % count;
|
|
110
|
-
return clamp(next, 0, count - 1);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
16
|
// src/components/carousel/carousel.context.ts
|
|
114
17
|
var [CarouselProvider, useCarousel] = createSlotContext("Carousel");
|
|
115
18
|
|
|
116
19
|
// src/components/carousel/carousel-content.tsx
|
|
117
20
|
import { jsx } from "react/jsx-runtime";
|
|
118
|
-
const
|
|
119
|
-
code: "function
|
|
120
|
-
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-
|
|
121
|
-
sourceMap: "{\"version\":3,\"names\":[\"
|
|
21
|
+
const _worklet_6244444199242_init_data = {
|
|
22
|
+
code: "function chunkP5M5URABJs1(event){const{offset,indexFromOffset,step,count,settled,runOnJS,onSettle}=this.__closure;offset.set(event.contentOffset.x);const next=indexFromOffset(event.contentOffset.x,step,count);if(next!==settled.get()){settled.set(next);runOnJS(onSettle)(next);}}",
|
|
23
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-P5M5URAB.js",
|
|
24
|
+
sourceMap: "{\"version\":3,\"names\":[\"chunkP5M5URABJs1\",\"event\",\"offset\",\"indexFromOffset\",\"step\",\"count\",\"settled\",\"runOnJS\",\"onSettle\",\"__closure\",\"set\",\"contentOffset\",\"x\",\"next\",\"get\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-P5M5URAB.js\"],\"mappings\":\"AA4E6C,SAAAA,gBAAUA,CAAAC,KAAA,QAAAC,MAAA,CAAAC,eAAA,CAAAC,IAAA,CAAAC,KAAA,CAAAC,OAAA,CAAAC,OAAA,CAAAC,QAAA,OAAAC,SAAA,CACjDP,MAAM,CAACQ,GAAG,CAACT,KAAK,CAACU,aAAa,CAACC,CAAC,CAAC,CACjC,KAAM,CAAAC,IAAI,CAAGV,eAAe,CAACF,KAAK,CAACU,aAAa,CAACC,CAAC,CAAER,IAAI,CAAEC,KAAK,CAAC,CAChE,GAAIQ,IAAI,GAAKP,OAAO,CAACQ,GAAG,CAAC,CAAC,CAAE,CAC1BR,OAAO,CAACI,GAAG,CAACG,IAAI,CAAC,CACjBN,OAAO,CAACC,QAAQ,CAAC,CAACK,IAAI,CAAC,CACzB,CACF\",\"ignoreList\":[]}"
|
|
122
25
|
};
|
|
123
26
|
var CarouselContent = forwardRef(function CarouselContent2({
|
|
124
27
|
children,
|
|
@@ -153,8 +56,8 @@ var CarouselContent = forwardRef(function CarouselContent2({
|
|
|
153
56
|
const {
|
|
154
57
|
step
|
|
155
58
|
} = metrics;
|
|
156
|
-
const scroll = useAnimatedScrollHandler(function
|
|
157
|
-
|
|
59
|
+
const scroll = useAnimatedScrollHandler(function chunkP5M5URABJs1Factory({
|
|
60
|
+
_worklet_6244444199242_init_data,
|
|
158
61
|
offset,
|
|
159
62
|
indexFromOffset,
|
|
160
63
|
step,
|
|
@@ -164,7 +67,7 @@ var CarouselContent = forwardRef(function CarouselContent2({
|
|
|
164
67
|
onSettle
|
|
165
68
|
}) {
|
|
166
69
|
const _e = [new global.Error(), -8, -27];
|
|
167
|
-
const
|
|
70
|
+
const chunkP5M5URABJs1 = function (event) {
|
|
168
71
|
offset.set(event.contentOffset.x);
|
|
169
72
|
const next = indexFromOffset(event.contentOffset.x, step, count);
|
|
170
73
|
if (next !== settled.get()) {
|
|
@@ -172,7 +75,7 @@ var CarouselContent = forwardRef(function CarouselContent2({
|
|
|
172
75
|
runOnJS(onSettle)(next);
|
|
173
76
|
}
|
|
174
77
|
};
|
|
175
|
-
|
|
78
|
+
chunkP5M5URABJs1.__closure = {
|
|
176
79
|
offset,
|
|
177
80
|
indexFromOffset,
|
|
178
81
|
step,
|
|
@@ -181,13 +84,13 @@ var CarouselContent = forwardRef(function CarouselContent2({
|
|
|
181
84
|
runOnJS,
|
|
182
85
|
onSettle
|
|
183
86
|
};
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
return
|
|
87
|
+
chunkP5M5URABJs1.__workletHash = 6244444199242;
|
|
88
|
+
chunkP5M5URABJs1.__pluginVersion = "0.7.4";
|
|
89
|
+
chunkP5M5URABJs1.__initData = _worklet_6244444199242_init_data;
|
|
90
|
+
chunkP5M5URABJs1.__stackDetails = _e;
|
|
91
|
+
return chunkP5M5URABJs1;
|
|
189
92
|
}({
|
|
190
|
-
|
|
93
|
+
_worklet_6244444199242_init_data,
|
|
191
94
|
offset,
|
|
192
95
|
indexFromOffset,
|
|
193
96
|
step,
|
|
@@ -276,10 +179,10 @@ var CarouselIndicator = forwardRef3(function CarouselIndicator2({
|
|
|
276
179
|
});
|
|
277
180
|
});
|
|
278
181
|
CarouselIndicator.displayName = "XAUI.Carousel.Indicator";
|
|
279
|
-
const
|
|
280
|
-
code: "function
|
|
281
|
-
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-
|
|
282
|
-
sourceMap: "{\"version\":3,\"names\":[\"
|
|
182
|
+
const _worklet_4615472245884_init_data = {
|
|
183
|
+
code: "function chunkP5M5URABJs2(){const{progressFromOffset,offset,step,count,index,width,pill,interpolateColor,restColor,active}=this.__closure;const distance=Math.abs(progressFromOffset(offset.get(),step,count)-index);const nearness=Math.max(0,1-distance);return{width:width+(pill-width)*nearness,backgroundColor:interpolateColor(nearness,[0,1],[restColor,active])};}",
|
|
184
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-P5M5URAB.js",
|
|
185
|
+
sourceMap: "{\"version\":3,\"names\":[\"chunkP5M5URABJs2\",\"progressFromOffset\",\"offset\",\"step\",\"count\",\"index\",\"width\",\"pill\",\"interpolateColor\",\"restColor\",\"active\",\"__closure\",\"distance\",\"Math\",\"abs\",\"get\",\"nearness\",\"max\",\"backgroundColor\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-P5M5URAB.js\"],\"mappings\":\"AA+JgC,SAAAA,gBAAMA,CAAA,QAAAC,kBAAA,CAAAC,MAAA,CAAAC,IAAA,CAAAC,KAAA,CAAAC,KAAA,CAAAC,KAAA,CAAAC,IAAA,CAAAC,gBAAA,CAAAC,SAAA,CAAAC,MAAA,OAAAC,SAAA,CAClC,KAAM,CAAAC,QAAQ,CAAGC,IAAI,CAACC,GAAG,CAACb,kBAAkB,CAACC,MAAM,CAACa,GAAG,CAAC,CAAC,CAAEZ,IAAI,CAAEC,KAAK,CAAC,CAAGC,KAAK,CAAC,CAChF,KAAM,CAAAW,QAAQ,CAAGH,IAAI,CAACI,GAAG,CAAC,CAAC,CAAE,CAAC,CAAGL,QAAQ,CAAC,CAC1C,MAAO,CACLN,KAAK,CAAEA,KAAK,CAAG,CAACC,IAAI,CAAGD,KAAK,EAAIU,QAAQ,CACxCE,eAAe,CAAEV,gBAAgB,CAACQ,QAAQ,CAAE,CAAC,CAAC,CAAE,CAAC,CAAC,CAAE,CAACP,SAAS,CAAEC,MAAM,CAAC,CACzE,CAAC,CACH\",\"ignoreList\":[]}"
|
|
283
186
|
};
|
|
284
187
|
var CarouselDot = forwardRef3(function CarouselDot2({
|
|
285
188
|
index,
|
|
@@ -308,8 +211,8 @@ var CarouselDot = forwardRef3(function CarouselDot2({
|
|
|
308
211
|
width,
|
|
309
212
|
pill
|
|
310
213
|
} = dotInk;
|
|
311
|
-
const grow = useAnimatedStyle(function
|
|
312
|
-
|
|
214
|
+
const grow = useAnimatedStyle(function chunkP5M5URABJs2Factory({
|
|
215
|
+
_worklet_4615472245884_init_data,
|
|
313
216
|
progressFromOffset,
|
|
314
217
|
offset,
|
|
315
218
|
step,
|
|
@@ -322,7 +225,7 @@ var CarouselDot = forwardRef3(function CarouselDot2({
|
|
|
322
225
|
active
|
|
323
226
|
}) {
|
|
324
227
|
const _e = [new global.Error(), -11, -27];
|
|
325
|
-
const
|
|
228
|
+
const chunkP5M5URABJs2 = function () {
|
|
326
229
|
const distance = Math.abs(progressFromOffset(offset.get(), step, count) - index);
|
|
327
230
|
const nearness = Math.max(0, 1 - distance);
|
|
328
231
|
return {
|
|
@@ -330,7 +233,7 @@ var CarouselDot = forwardRef3(function CarouselDot2({
|
|
|
330
233
|
backgroundColor: interpolateColor(nearness, [0, 1], [restColor, active])
|
|
331
234
|
};
|
|
332
235
|
};
|
|
333
|
-
|
|
236
|
+
chunkP5M5URABJs2.__closure = {
|
|
334
237
|
progressFromOffset,
|
|
335
238
|
offset,
|
|
336
239
|
step,
|
|
@@ -342,13 +245,13 @@ var CarouselDot = forwardRef3(function CarouselDot2({
|
|
|
342
245
|
restColor,
|
|
343
246
|
active
|
|
344
247
|
};
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
return
|
|
248
|
+
chunkP5M5URABJs2.__workletHash = 4615472245884;
|
|
249
|
+
chunkP5M5URABJs2.__pluginVersion = "0.7.4";
|
|
250
|
+
chunkP5M5URABJs2.__initData = _worklet_4615472245884_init_data;
|
|
251
|
+
chunkP5M5URABJs2.__stackDetails = _e;
|
|
252
|
+
return chunkP5M5URABJs2;
|
|
350
253
|
}({
|
|
351
|
-
|
|
254
|
+
_worklet_4615472245884_init_data,
|
|
352
255
|
progressFromOffset,
|
|
353
256
|
offset,
|
|
354
257
|
step,
|
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkFTPPUTWLcjs = require('./chunk-FTPPUTWL.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkWFEMJCXOcjs = require('./chunk-WFEMJCXO.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _chunk7EIHHOHPcjs = require('./chunk-7EIHHOHP.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
var _chunkSL3V7R2Ycjs = require('./chunk-SL3V7R2Y.cjs');
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
var _chunkCDRGTUYFcjs = require('./chunk-CDRGTUYF.cjs');
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _chunkIIAQISBGcjs = require('./chunk-IIAQISBG.cjs');
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
var _chunkTK44VBIEcjs = require('./chunk-TK44VBIE.cjs');
|
|
23
|
+
|
|
24
|
+
// src/components/pager/pager-content.tsx
|
|
25
|
+
var _react = require('react');
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
var _reactnativereanimated = require('react-native-reanimated'); var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
|
|
31
|
+
|
|
32
|
+
// src/components/pager/pager.context.ts
|
|
33
|
+
var [PagerProvider, usePager] = _chunkCDRGTUYFcjs.createSlotContext.call(void 0, "Pager");
|
|
34
|
+
|
|
35
|
+
// src/components/pager/pager-content.tsx
|
|
36
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
37
|
+
var PagerContent = _react.forwardRef.call(void 0,
|
|
38
|
+
function PagerContent2({ children, style, onLayout, ...props }, ref) {
|
|
39
|
+
const {
|
|
40
|
+
contentStyle,
|
|
41
|
+
orientation,
|
|
42
|
+
step,
|
|
43
|
+
track,
|
|
44
|
+
setTrack,
|
|
45
|
+
count,
|
|
46
|
+
setCount,
|
|
47
|
+
offset,
|
|
48
|
+
trackRef,
|
|
49
|
+
isDisabled,
|
|
50
|
+
onSettle
|
|
51
|
+
} = usePager();
|
|
52
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
53
|
+
const scroller = _chunkWFEMJCXOcjs.useMergedRef.call(void 0, ref, trackRef);
|
|
54
|
+
const given = _react.Children.count(children);
|
|
55
|
+
_react.useEffect.call(void 0, () => {
|
|
56
|
+
if (given !== count) setCount(given);
|
|
57
|
+
}, [count, given, setCount]);
|
|
58
|
+
const handleLayout = (event) => {
|
|
59
|
+
_optionalChain([onLayout, 'optionalCall', _2 => _2(event)]);
|
|
60
|
+
const { width, height } = event.nativeEvent.layout;
|
|
61
|
+
if (width !== track.width || height !== track.height)
|
|
62
|
+
setTrack({ width, height });
|
|
63
|
+
};
|
|
64
|
+
const settled = _reactnativereanimated.useSharedValue.call(void 0, 0);
|
|
65
|
+
const isHorizontal = orientation === "horizontal";
|
|
66
|
+
const scroll = _reactnativereanimated.useAnimatedScrollHandler.call(void 0, (event) => {
|
|
67
|
+
const travelled = isHorizontal ? event.contentOffset.x : event.contentOffset.y;
|
|
68
|
+
offset.set(travelled);
|
|
69
|
+
const next = _chunkFTPPUTWLcjs.indexFromOffset.call(void 0, travelled, step, count);
|
|
70
|
+
if (next !== settled.get()) {
|
|
71
|
+
settled.set(next);
|
|
72
|
+
_reactnativereanimated.runOnJS.call(void 0, onSettle)(next);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
76
|
+
_reactnativereanimated2.default.ScrollView,
|
|
77
|
+
{
|
|
78
|
+
ref: scroller,
|
|
79
|
+
horizontal: isHorizontal,
|
|
80
|
+
pagingEnabled: true,
|
|
81
|
+
showsHorizontalScrollIndicator: false,
|
|
82
|
+
showsVerticalScrollIndicator: false,
|
|
83
|
+
scrollEnabled: !isDisabled,
|
|
84
|
+
decelerationRate: "fast",
|
|
85
|
+
scrollEventThrottle: 16,
|
|
86
|
+
...rest,
|
|
87
|
+
style: [contentStyle, styleProps, style],
|
|
88
|
+
onLayout: handleLayout,
|
|
89
|
+
onScroll: scroll,
|
|
90
|
+
children: step > 0 ? children : null
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
PagerContent.displayName = "XAUI.Pager.Content";
|
|
96
|
+
|
|
97
|
+
// src/components/pager/pager-indicator.tsx
|
|
98
|
+
|
|
99
|
+
var _reactnative = require('react-native');
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
var HIT_SLOP = 8;
|
|
106
|
+
var AnimatedPressable = _reactnativereanimated2.default.createAnimatedComponent(_reactnative.Pressable);
|
|
107
|
+
var PagerIndicator = _react.forwardRef.call(void 0,
|
|
108
|
+
function PagerIndicator2({ children, style, ...props }, ref) {
|
|
109
|
+
const { indicatorStyle, count } = usePager();
|
|
110
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
111
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { ref, ...rest, style: [indicatorStyle, styleProps, style], children: _nullishCoalesce(children, () => ( Array.from({ length: count }, (_, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PagerDot, { index }, index)))) });
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
PagerIndicator.displayName = "XAUI.Pager.Indicator";
|
|
115
|
+
var PagerDot = _react.forwardRef.call(void 0, function PagerDot2({ index, children, style, ...props }, ref) {
|
|
116
|
+
const {
|
|
117
|
+
dotStyle,
|
|
118
|
+
dotInk,
|
|
119
|
+
offset,
|
|
120
|
+
step,
|
|
121
|
+
count,
|
|
122
|
+
index: current,
|
|
123
|
+
isDisabled,
|
|
124
|
+
goTo
|
|
125
|
+
} = usePager();
|
|
126
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
127
|
+
const { rest: restColor, active } = dotInk;
|
|
128
|
+
const travel = _reactnativereanimated.useAnimatedStyle.call(void 0, () => {
|
|
129
|
+
const distance = Math.abs(_chunkFTPPUTWLcjs.progressFromOffset.call(void 0, offset.get(), step, count) - index);
|
|
130
|
+
const nearness = Math.max(0, 1 - distance);
|
|
131
|
+
return {
|
|
132
|
+
backgroundColor: _reactnativereanimated.interpolateColor.call(void 0, nearness, [0, 1], [restColor, active])
|
|
133
|
+
};
|
|
134
|
+
});
|
|
135
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
136
|
+
AnimatedPressable,
|
|
137
|
+
{
|
|
138
|
+
ref,
|
|
139
|
+
accessibilityRole: "button",
|
|
140
|
+
accessibilityState: { selected: index === current, disabled: isDisabled },
|
|
141
|
+
accessibilityValue: { now: index + 1, min: 1, max: count },
|
|
142
|
+
disabled: isDisabled,
|
|
143
|
+
hitSlop: HIT_SLOP,
|
|
144
|
+
...rest,
|
|
145
|
+
style: [dotStyle, travel, styleProps, style],
|
|
146
|
+
onPress: () => goTo(index),
|
|
147
|
+
children
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
});
|
|
151
|
+
PagerDot.displayName = "XAUI.Pager.Dot";
|
|
152
|
+
|
|
153
|
+
// src/components/pager/pager-page.tsx
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
var PagerPage = _react.forwardRef.call(void 0, function PagerPage2({ children, style, ...props }, ref) {
|
|
158
|
+
const { pageStyle, track } = usePager();
|
|
159
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
160
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
161
|
+
_reactnative.View,
|
|
162
|
+
{
|
|
163
|
+
ref,
|
|
164
|
+
...rest,
|
|
165
|
+
style: [
|
|
166
|
+
pageStyle,
|
|
167
|
+
{ width: track.width, height: track.height },
|
|
168
|
+
styleProps,
|
|
169
|
+
style
|
|
170
|
+
],
|
|
171
|
+
children
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
});
|
|
175
|
+
PagerPage.displayName = "XAUI.Pager.Page";
|
|
176
|
+
|
|
177
|
+
// src/components/pager/pager.tsx
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
// src/components/pager/pager.recipe.ts
|
|
183
|
+
var SLOTS = ["root", "content", "page", "indicator", "dot", "dotActive"];
|
|
184
|
+
var VARIANT_TOKENS = {
|
|
185
|
+
primary: { bgSelected: "accent" },
|
|
186
|
+
secondary: { bgSelected: "defaultForeground" },
|
|
187
|
+
// The raised ground rather than the page's, which on a light theme is white: this is the
|
|
188
|
+
// pager over a photograph, where an accent dot disappears into whatever is behind it.
|
|
189
|
+
tertiary: { bgSelected: "surface" }
|
|
190
|
+
};
|
|
191
|
+
var SIZES = {
|
|
192
|
+
xs: { dot: 5, gap: 1 },
|
|
193
|
+
sm: { dot: 6, gap: 1.5 },
|
|
194
|
+
md: { dot: 7, gap: 1.5 },
|
|
195
|
+
lg: { dot: 8, gap: 2 }
|
|
196
|
+
};
|
|
197
|
+
function sizeAxis(step) {
|
|
198
|
+
const { dot, gap } = step;
|
|
199
|
+
return (theme) => ({
|
|
200
|
+
indicator: { gap: theme.spacing(gap) },
|
|
201
|
+
dot: { width: dot, height: dot, borderRadius: dot / 2 }
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
function orientationAxis(direction) {
|
|
205
|
+
return () => ({
|
|
206
|
+
indicator: { flexDirection: direction }
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
var pagerRecipe = _chunkSL3V7R2Ycjs.createRecipe.call(void 0, {
|
|
210
|
+
slots: SLOTS,
|
|
211
|
+
base: (theme) => ({
|
|
212
|
+
/**
|
|
213
|
+
* **The root has no size of its own**, and that is deliberate rather than missing.
|
|
214
|
+
*
|
|
215
|
+
* `flex: 1` here would have been the convenient default and it is a trap: React Native
|
|
216
|
+
* expands it to a zero flex-basis, which **overrides an explicit `height`** — so
|
|
217
|
+
* `<Pager height={240}>` would collapse to the height of its dots, and the prop the
|
|
218
|
+
* caller reached for would silently do nothing. It is the same reason there is no
|
|
219
|
+
* `fullWidth` on a `Button`: RN's own behaviour is the answer, and the caller says which
|
|
220
|
+
* of the two they want — `flex={1}` to fill a screen, `height={320}` inside a scroll
|
|
221
|
+
* view.
|
|
222
|
+
*
|
|
223
|
+
* The track keeps its `flex: 1`, so it takes whatever the root was given less the dots.
|
|
224
|
+
* Nothing sizes it from outside, which is why it is safe there and not here.
|
|
225
|
+
*/
|
|
226
|
+
content: { flex: 1 },
|
|
227
|
+
// A page is the size of the track on both axes, and that number is measured rather than
|
|
228
|
+
// named, so it arrives as an inline style instead of from here.
|
|
229
|
+
page: { overflow: "hidden" },
|
|
230
|
+
indicator: { alignItems: "center", justifyContent: "center" },
|
|
231
|
+
/**
|
|
232
|
+
* A neutral fill rather than a faint version of the current one: a pale tint of the
|
|
233
|
+
* accent under the pages reads as a control that has half failed to load. A raw `color`
|
|
234
|
+
* reaches the current dot, which is the one it should move.
|
|
235
|
+
*/
|
|
236
|
+
dot: { backgroundColor: theme.colors.default }
|
|
237
|
+
}),
|
|
238
|
+
variantTokens: VARIANT_TOKENS,
|
|
239
|
+
/**
|
|
240
|
+
* The current dot, **read as a value and never applied as a style**: the colour is
|
|
241
|
+
* interpolated on the UI thread, and `interpolateColor` needs a string rather than a
|
|
242
|
+
* `StyleSheet` id. The root flattens this slot into `dotInk`, so the recipe still owns it.
|
|
243
|
+
*/
|
|
244
|
+
paint: (_theme, colors) => ({
|
|
245
|
+
dotActive: { backgroundColor: colors.bgSelected }
|
|
246
|
+
}),
|
|
247
|
+
variants: {
|
|
248
|
+
size: {
|
|
249
|
+
xs: sizeAxis(SIZES.xs),
|
|
250
|
+
sm: sizeAxis(SIZES.sm),
|
|
251
|
+
md: sizeAxis(SIZES.md),
|
|
252
|
+
lg: sizeAxis(SIZES.lg)
|
|
253
|
+
},
|
|
254
|
+
orientation: {
|
|
255
|
+
horizontal: orientationAxis("row"),
|
|
256
|
+
vertical: orientationAxis("column")
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
states: {
|
|
260
|
+
disabled: (theme) => ({ indicator: { opacity: theme.opacity.disabled } })
|
|
261
|
+
},
|
|
262
|
+
defaultVariants: { variant: "primary", size: "md", orientation: "horizontal" }
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
// src/components/pager/pager.tsx
|
|
266
|
+
|
|
267
|
+
var PagerRoot = _react.forwardRef.call(void 0, function Pager({
|
|
268
|
+
children,
|
|
269
|
+
variant,
|
|
270
|
+
size,
|
|
271
|
+
color,
|
|
272
|
+
orientation = "horizontal",
|
|
273
|
+
index: indexProp,
|
|
274
|
+
defaultIndex = 0,
|
|
275
|
+
onIndexChange,
|
|
276
|
+
isDisabled = false,
|
|
277
|
+
style,
|
|
278
|
+
...props
|
|
279
|
+
}, ref) {
|
|
280
|
+
const theme = _chunkIIAQISBGcjs.useXAUITheme.call(void 0, );
|
|
281
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
282
|
+
const [index, setIndex] = _chunk7EIHHOHPcjs.useControllableState.call(void 0, {
|
|
283
|
+
value: indexProp,
|
|
284
|
+
defaultValue: defaultIndex,
|
|
285
|
+
onChange: onIndexChange
|
|
286
|
+
});
|
|
287
|
+
const [track, setTrack] = _react.useState.call(void 0, { width: 0, height: 0 });
|
|
288
|
+
const [count, setCount] = _react.useState.call(void 0, 0);
|
|
289
|
+
const trackRef = _reactnativereanimated.useAnimatedRef.call(void 0, );
|
|
290
|
+
const offset = _reactnativereanimated.useSharedValue.call(void 0, 0);
|
|
291
|
+
const selection = { variant, size, orientation };
|
|
292
|
+
const states = { disabled: isDisabled };
|
|
293
|
+
const styles = pagerRecipe.resolve({ theme, selection, states });
|
|
294
|
+
const tint = color ? pagerRecipe.tint({ theme, color, selection, states }) : void 0;
|
|
295
|
+
const step = orientation === "horizontal" ? track.width : track.height;
|
|
296
|
+
const goTo = _react.useCallback.call(void 0,
|
|
297
|
+
(next) => {
|
|
298
|
+
const distance = next * step;
|
|
299
|
+
_optionalChain([trackRef, 'access', _3 => _3.current, 'optionalAccess', _4 => _4.scrollTo, 'call', _5 => _5({
|
|
300
|
+
x: orientation === "horizontal" ? distance : 0,
|
|
301
|
+
y: orientation === "horizontal" ? 0 : distance,
|
|
302
|
+
animated: true
|
|
303
|
+
})]);
|
|
304
|
+
setIndex(next);
|
|
305
|
+
},
|
|
306
|
+
[orientation, setIndex, step, trackRef]
|
|
307
|
+
);
|
|
308
|
+
const context = _react.useMemo.call(void 0, () => {
|
|
309
|
+
const active = _reactnative.StyleSheet.flatten([styles.dotActive, _optionalChain([tint, 'optionalAccess', _6 => _6.dotActive])]);
|
|
310
|
+
const at = _reactnative.StyleSheet.flatten([styles.dot]);
|
|
311
|
+
return {
|
|
312
|
+
contentStyle: styles.content,
|
|
313
|
+
pageStyle: styles.page,
|
|
314
|
+
indicatorStyle: styles.indicator,
|
|
315
|
+
dotStyle: styles.dot,
|
|
316
|
+
// Values rather than styles: the colour is interpolated on the UI thread, and
|
|
317
|
+
// `interpolateColor` needs strings. The fallbacks are the tokens the recipe named, for
|
|
318
|
+
// the platform colours `ColorValue` also covers.
|
|
319
|
+
dotInk: {
|
|
320
|
+
rest: typeof at.backgroundColor === "string" ? at.backgroundColor : theme.colors.default,
|
|
321
|
+
active: typeof active.backgroundColor === "string" ? active.backgroundColor : theme.colors.accent
|
|
322
|
+
},
|
|
323
|
+
orientation,
|
|
324
|
+
index,
|
|
325
|
+
count,
|
|
326
|
+
setCount,
|
|
327
|
+
track,
|
|
328
|
+
setTrack,
|
|
329
|
+
step,
|
|
330
|
+
offset,
|
|
331
|
+
goTo,
|
|
332
|
+
onSettle: setIndex,
|
|
333
|
+
trackRef,
|
|
334
|
+
isDisabled
|
|
335
|
+
};
|
|
336
|
+
}, [
|
|
337
|
+
styles,
|
|
338
|
+
tint,
|
|
339
|
+
theme,
|
|
340
|
+
orientation,
|
|
341
|
+
index,
|
|
342
|
+
count,
|
|
343
|
+
track,
|
|
344
|
+
setTrack,
|
|
345
|
+
step,
|
|
346
|
+
offset,
|
|
347
|
+
goTo,
|
|
348
|
+
setIndex,
|
|
349
|
+
trackRef,
|
|
350
|
+
isDisabled
|
|
351
|
+
]);
|
|
352
|
+
const rootStyle = [styles.root, _optionalChain([tint, 'optionalAccess', _7 => _7.root]), styleProps, style];
|
|
353
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PagerProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
354
|
+
_reactnative.View,
|
|
355
|
+
{
|
|
356
|
+
ref,
|
|
357
|
+
...rest,
|
|
358
|
+
style: rootStyle,
|
|
359
|
+
children
|
|
360
|
+
}
|
|
361
|
+
) });
|
|
362
|
+
});
|
|
363
|
+
PagerRoot.displayName = "XAUI.Pager.Root";
|
|
364
|
+
|
|
365
|
+
// src/components/pager/index.ts
|
|
366
|
+
var Pager2 = Object.assign(PagerRoot, {
|
|
367
|
+
Content: PagerContent,
|
|
368
|
+
Page: PagerPage,
|
|
369
|
+
Indicator: PagerIndicator,
|
|
370
|
+
Dot: PagerDot
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
exports.usePager = usePager; exports.PagerContent = PagerContent; exports.PagerIndicator = PagerIndicator; exports.PagerDot = PagerDot; exports.PagerPage = PagerPage; exports.pagerRecipe = pagerRecipe; exports.PagerRoot = PagerRoot; exports.Pager = Pager2;
|