@multiplatform.one/forms 7.35.0 → 7.37.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/Wheel/{WheelEdgeFade.cjs → NativeWheel.cjs} +5 -5
- package/dist/cjs/Wheel/NativeWheel.native.js +408 -0
- package/dist/cjs/Wheel/NativeWheel.native.js.map +1 -0
- package/dist/cjs/Wheel/haptic.cjs +3 -4
- package/dist/cjs/Wheel/haptic.native.js +4 -5
- package/dist/cjs/Wheel/haptic.native.js.map +1 -1
- package/dist/cjs/Wheel/index.cjs +62 -218
- package/dist/cjs/Wheel/index.native.js +54 -228
- package/dist/cjs/Wheel/index.native.js.map +1 -1
- package/dist/cjs/Wheel/wheelShared.cjs +156 -0
- package/dist/cjs/Wheel/wheelShared.native.js +169 -0
- package/dist/cjs/Wheel/wheelShared.native.js.map +1 -0
- package/dist/cjs/shared/TimeColumn.cjs +0 -9
- package/dist/cjs/shared/TimeColumn.native.js +0 -9
- package/dist/cjs/shared/TimeColumn.native.js.map +1 -1
- package/dist/esm/Wheel/NativeWheel.mjs +5 -0
- package/dist/esm/Wheel/NativeWheel.mjs.map +1 -0
- package/dist/esm/Wheel/NativeWheel.native.js +380 -0
- package/dist/esm/Wheel/NativeWheel.native.js.map +1 -0
- package/dist/esm/Wheel/haptic.mjs +3 -4
- package/dist/esm/Wheel/haptic.mjs.map +1 -1
- package/dist/esm/Wheel/haptic.native.js +4 -5
- package/dist/esm/Wheel/haptic.native.js.map +1 -1
- package/dist/esm/Wheel/index.mjs +49 -205
- package/dist/esm/Wheel/index.mjs.map +1 -1
- package/dist/esm/Wheel/index.native.js +41 -215
- package/dist/esm/Wheel/index.native.js.map +1 -1
- package/dist/esm/Wheel/wheelShared.mjs +119 -0
- package/dist/esm/Wheel/wheelShared.mjs.map +1 -0
- package/dist/esm/Wheel/wheelShared.native.js +129 -0
- package/dist/esm/Wheel/wheelShared.native.js.map +1 -0
- package/dist/esm/shared/TimeColumn.mjs +0 -9
- package/dist/esm/shared/TimeColumn.mjs.map +1 -1
- package/dist/esm/shared/TimeColumn.native.js +0 -9
- package/dist/esm/shared/TimeColumn.native.js.map +1 -1
- package/dist/jsx/Wheel/NativeWheel.mjs +5 -0
- package/dist/jsx/Wheel/NativeWheel.mjs.map +1 -0
- package/dist/jsx/Wheel/NativeWheel.native.js +408 -0
- package/dist/jsx/Wheel/NativeWheel.native.js.map +1 -0
- package/dist/jsx/Wheel/haptic.mjs +3 -4
- package/dist/jsx/Wheel/haptic.mjs.map +1 -1
- package/dist/jsx/Wheel/haptic.native.js +4 -5
- package/dist/jsx/Wheel/haptic.native.js.map +1 -1
- package/dist/jsx/Wheel/index.mjs +49 -205
- package/dist/jsx/Wheel/index.mjs.map +1 -1
- package/dist/jsx/Wheel/index.native.js +54 -228
- package/dist/jsx/Wheel/index.native.js.map +1 -1
- package/dist/jsx/Wheel/wheelShared.mjs +119 -0
- package/dist/jsx/Wheel/wheelShared.mjs.map +1 -0
- package/dist/jsx/Wheel/wheelShared.native.js +169 -0
- package/dist/jsx/Wheel/wheelShared.native.js.map +1 -0
- package/dist/jsx/shared/TimeColumn.mjs +0 -9
- package/dist/jsx/shared/TimeColumn.mjs.map +1 -1
- package/dist/jsx/shared/TimeColumn.native.js +0 -9
- package/dist/jsx/shared/TimeColumn.native.js.map +1 -1
- package/package.json +8 -8
- package/src/Wheel/NativeWheel.native.spec.tsx +181 -0
- package/src/Wheel/NativeWheel.native.tsx +430 -0
- package/src/Wheel/NativeWheel.tsx +6 -0
- package/src/Wheel/haptic.ts +9 -8
- package/src/Wheel/index.tsx +121 -363
- package/src/Wheel/wheelShared.spec.ts +53 -0
- package/src/Wheel/wheelShared.ts +222 -0
- package/src/shared/TimeColumn.tsx +0 -7
- package/types/Wheel/NativeWheel.d.ts +4 -0
- package/types/Wheel/NativeWheel.d.ts.map +1 -0
- package/types/Wheel/NativeWheel.native.d.ts +9 -0
- package/types/Wheel/NativeWheel.native.d.ts.map +1 -0
- package/types/Wheel/haptic.d.ts +4 -2
- package/types/Wheel/haptic.d.ts.map +1 -1
- package/types/Wheel/index.d.ts +4 -49
- package/types/Wheel/index.d.ts.map +1 -1
- package/types/Wheel/wheelShared.d.ts +87 -0
- package/types/Wheel/wheelShared.d.ts.map +1 -0
- package/types/shared/TimeColumn.d.ts.map +1 -1
- package/dist/cjs/Wheel/WheelEdgeFade.native.js +0 -116
- package/dist/cjs/Wheel/WheelEdgeFade.native.js.map +0 -1
- package/dist/esm/Wheel/WheelEdgeFade.mjs +0 -5
- package/dist/esm/Wheel/WheelEdgeFade.mjs.map +0 -1
- package/dist/esm/Wheel/WheelEdgeFade.native.js +0 -88
- package/dist/esm/Wheel/WheelEdgeFade.native.js.map +0 -1
- package/dist/jsx/Wheel/WheelEdgeFade.mjs +0 -5
- package/dist/jsx/Wheel/WheelEdgeFade.mjs.map +0 -1
- package/dist/jsx/Wheel/WheelEdgeFade.native.js +0 -116
- package/dist/jsx/Wheel/WheelEdgeFade.native.js.map +0 -1
- package/src/Wheel/WheelEdgeFade.native.tsx +0 -67
- package/src/Wheel/WheelEdgeFade.spec.tsx +0 -141
- package/src/Wheel/WheelEdgeFade.tsx +0 -7
- package/types/Wheel/WheelEdgeFade.d.ts +0 -8
- package/types/Wheel/WheelEdgeFade.d.ts.map +0 -1
- package/types/Wheel/WheelEdgeFade.native.d.ts +0 -8
- package/types/Wheel/WheelEdgeFade.native.d.ts.map +0 -1
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode } from "react";
|
|
2
|
+
import { motionDurationMs, sizeTokenStep, useResolvedKnobs } from "@multiplatform.one/theme";
|
|
3
|
+
import type { SizeTokens } from "tamagui";
|
|
4
|
+
import { getConfig, getTokens } from "tamagui";
|
|
5
|
+
|
|
6
|
+
export interface WheelItem<T = string | number> {
|
|
7
|
+
value: T;
|
|
8
|
+
label?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** iOS 14 multi-column highlight joining (CupertinoPicker capStart/capEnd). */
|
|
12
|
+
export type WheelHighlightEdges = "all" | "start" | "end" | "none";
|
|
13
|
+
|
|
14
|
+
export interface WheelProps<T = string | number> {
|
|
15
|
+
/** Array of items to display */
|
|
16
|
+
items: (T | WheelItem<T>)[];
|
|
17
|
+
/** Currently selected value */
|
|
18
|
+
value?: T;
|
|
19
|
+
/** Called when selection changes */
|
|
20
|
+
onChange?: (value: T) => void;
|
|
21
|
+
/** Number of visible items (should be odd for center alignment) */
|
|
22
|
+
visibleItems?: 3 | 5 | 7;
|
|
23
|
+
/** Height of each item. Defaults to the font's line height plus the $1 space token. */
|
|
24
|
+
itemHeight?: number;
|
|
25
|
+
/** Column width in px. Items are absolutely positioned, so this is the painted width. */
|
|
26
|
+
width?: number;
|
|
27
|
+
/** Custom render function for items */
|
|
28
|
+
renderItem?: (item: T, index: number, isSelected: boolean) => ReactNode;
|
|
29
|
+
/** Whether the wheel is disabled */
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
/** Size token for text */
|
|
32
|
+
size?: SizeTokens;
|
|
33
|
+
/**
|
|
34
|
+
* When true (and there are at least 2 items), scrolling wraps at the ends
|
|
35
|
+
* instead of rubber-banding. Uses virtual rows with modulo item indexing.
|
|
36
|
+
*/
|
|
37
|
+
loop?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* How the iOS selection fill rounds and insets. `"all"` is a standalone
|
|
40
|
+
* column; `"start"` / `"end"` / `"none"` join adjacent columns into one band.
|
|
41
|
+
*/
|
|
42
|
+
highlightEdges?: WheelHighlightEdges;
|
|
43
|
+
/** Stretch inside a row of columns (time picker). */
|
|
44
|
+
flex?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Fires once each time a different item crosses the centre band (drag,
|
|
47
|
+
* flick, or snap). Native wires this to a selection haptic.
|
|
48
|
+
*/
|
|
49
|
+
onItemCross?: (value: T, index: number) => void;
|
|
50
|
+
/** Accessible name for the picker (web renders role="slider", native "adjustable"). */
|
|
51
|
+
"aria-label"?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export const defaultColumnWidth = 88;
|
|
55
|
+
|
|
56
|
+
/** Type scale for wheel numerals — iOS UIPickerView is ~21pt at default size. */
|
|
57
|
+
const wheelFontByStep: Record<-1 | 0 | 1, SizeTokens> = {
|
|
58
|
+
[-1]: "$6",
|
|
59
|
+
0: "$8",
|
|
60
|
+
1: "$9",
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The frame edge sits at this drum angle, so the outermost painted rows are
|
|
65
|
+
* nearly edge-on like UIPickerView's, instead of being cut flat at 90°.
|
|
66
|
+
*/
|
|
67
|
+
const edgeAngle = (80 * Math.PI) / 180;
|
|
68
|
+
|
|
69
|
+
export function normalizeItem<T>(item: T | WheelItem<T>): WheelItem<T> {
|
|
70
|
+
if (typeof item === "object" && item !== null && "value" in item) {
|
|
71
|
+
return item as WheelItem<T>;
|
|
72
|
+
}
|
|
73
|
+
return { value: item as T, label: String(item) };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function getItemLabel<T>(item: T | WheelItem<T>): string {
|
|
77
|
+
const normalized = normalizeItem(item);
|
|
78
|
+
return normalized.label ?? String(normalized.value);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function getItemValue<T>(item: T | WheelItem<T>): T {
|
|
82
|
+
return normalizeItem(item).value;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Non-negative modulo (JavaScript % can be negative for negative lhs). */
|
|
86
|
+
export function modIndex(row: number, n: number): number {
|
|
87
|
+
if (n <= 0) return 0;
|
|
88
|
+
return ((row % n) + n) % n;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** Shortest steps on the item circle from current row to target data index. */
|
|
92
|
+
export function nearestRowForDataIndex(
|
|
93
|
+
currentRow: number,
|
|
94
|
+
targetDataIndex: number,
|
|
95
|
+
n: number,
|
|
96
|
+
): number {
|
|
97
|
+
const currentMod = modIndex(currentRow, n);
|
|
98
|
+
let delta = targetDataIndex - currentMod;
|
|
99
|
+
if (delta > n / 2) delta -= n;
|
|
100
|
+
if (delta < -n / 2) delta += n;
|
|
101
|
+
return currentRow + delta;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function drumRadius(frameHeight: number): number {
|
|
105
|
+
return frameHeight / 2 / Math.sin(edgeAngle);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** Rows from the centre at which a row turns edge-on (90°) and stops painting. */
|
|
109
|
+
export function drumReachRows(itemHeight: number, frameHeight: number): number {
|
|
110
|
+
return (drumRadius(frameHeight) * (Math.PI / 2)) / Math.max(itemHeight, 1);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface DrumPose {
|
|
114
|
+
/** Distance of the row's centre from the frame's centre, in px. */
|
|
115
|
+
offset: number;
|
|
116
|
+
rotateX: number;
|
|
117
|
+
scale: number;
|
|
118
|
+
opacity: number;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Pose of a row `rowsFromCenter` rows away from the band on the UIPickerView
|
|
123
|
+
* drum. The arc length between rows equals the row height, so neighbours can
|
|
124
|
+
* never overlap: each row's projected height shrinks by cos θ exactly as fast
|
|
125
|
+
* as the gap between rows does.
|
|
126
|
+
*/
|
|
127
|
+
export function drumPose(
|
|
128
|
+
rowsFromCenter: number,
|
|
129
|
+
itemHeight: number,
|
|
130
|
+
frameHeight: number,
|
|
131
|
+
): DrumPose {
|
|
132
|
+
const radius = drumRadius(frameHeight);
|
|
133
|
+
const theta = (rowsFromCenter * itemHeight) / Math.max(radius, 1);
|
|
134
|
+
const clamped = Math.max(-Math.PI / 2, Math.min(Math.PI / 2, theta));
|
|
135
|
+
const cos = Math.cos(clamped);
|
|
136
|
+
return {
|
|
137
|
+
offset: radius * Math.sin(clamped),
|
|
138
|
+
rotateX: -(clamped * 180) / Math.PI,
|
|
139
|
+
scale: 1.5 / (2.5 - cos),
|
|
140
|
+
opacity: Math.abs(theta) >= Math.PI / 2 ? 0 : Math.pow(cos, 2),
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
type FontTable = Record<string, number | { val?: number } | undefined>;
|
|
145
|
+
|
|
146
|
+
function tableValue(table: FontTable | undefined, key: string): number | undefined {
|
|
147
|
+
const raw = table?.[key];
|
|
148
|
+
if (typeof raw === "number") return raw;
|
|
149
|
+
if (raw && typeof raw === "object" && typeof raw.val === "number") return raw.val;
|
|
150
|
+
return undefined;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export function fontLineHeightPx(size: SizeTokens, fontFamily: unknown): number {
|
|
154
|
+
const key = String(size).replace(/^\$/, "");
|
|
155
|
+
const fonts = (getConfig()?.fonts ?? {}) as Record<
|
|
156
|
+
string,
|
|
157
|
+
{ lineHeight?: FontTable; size?: FontTable }
|
|
158
|
+
>;
|
|
159
|
+
const familyKey = typeof fontFamily === "string" ? fontFamily.replace(/^\$/, "") : "body";
|
|
160
|
+
const font = fonts[familyKey] ?? fonts.body ?? Object.values(fonts)[0];
|
|
161
|
+
const lineHeight = tableValue(font?.lineHeight, key);
|
|
162
|
+
if (lineHeight) return lineHeight;
|
|
163
|
+
const fontSize = tableValue(font?.size, key);
|
|
164
|
+
return fontSize ? Math.ceil(fontSize * 1.2) : 28;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export function tokenPx(token: string | number, scale: "radius" | "space"): number {
|
|
168
|
+
if (typeof token === "number") return token;
|
|
169
|
+
const key = String(token).replace(/^\$/, "");
|
|
170
|
+
const val = (getTokens() as { [k: string]: Record<string, { val?: number }> })[scale]?.[key]?.val;
|
|
171
|
+
if (typeof val === "number") return val;
|
|
172
|
+
return scale === "radius" ? 9 : 8;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export function highlightBandStyle(
|
|
176
|
+
edges: WheelHighlightEdges,
|
|
177
|
+
radiusToken: string | number,
|
|
178
|
+
pointy: boolean,
|
|
179
|
+
): CSSProperties {
|
|
180
|
+
const r = pointy ? 0 : tokenPx(radiusToken, "radius");
|
|
181
|
+
const inset = tokenPx("$2", "space");
|
|
182
|
+
const capStart = edges === "all" || edges === "start";
|
|
183
|
+
const capEnd = edges === "all" || edges === "end";
|
|
184
|
+
return {
|
|
185
|
+
borderStartStartRadius: capStart ? r : 0,
|
|
186
|
+
borderStartEndRadius: capEnd ? r : 0,
|
|
187
|
+
borderEndStartRadius: capStart ? r : 0,
|
|
188
|
+
borderEndEndRadius: capEnd ? r : 0,
|
|
189
|
+
marginInlineStart: capStart ? inset : 0,
|
|
190
|
+
marginInlineEnd: capEnd ? inset : 0,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/** Geometry and knob-derived styling both renderers share. */
|
|
195
|
+
export function useWheelLayout<T>({
|
|
196
|
+
visibleItems = 5,
|
|
197
|
+
itemHeight: itemHeightProp,
|
|
198
|
+
size: sizeProp,
|
|
199
|
+
highlightEdges = "all",
|
|
200
|
+
}: Pick<WheelProps<T>, "visibleItems" | "itemHeight" | "size" | "highlightEdges">) {
|
|
201
|
+
const { knobProps } = useResolvedKnobs();
|
|
202
|
+
const size = sizeProp ?? wheelFontByStep[sizeTokenStep(knobProps.sizeToken)];
|
|
203
|
+
const bodyFont = (knobProps.body as { fontFamily?: unknown }).fontFamily;
|
|
204
|
+
const itemHeight =
|
|
205
|
+
itemHeightProp ?? Math.ceil(fontLineHeightPx(size, bodyFont) + tokenPx("$1", "space"));
|
|
206
|
+
const frameHeight = itemHeight * visibleItems;
|
|
207
|
+
const motionTransition = knobProps.motion.control.transition as string | undefined;
|
|
208
|
+
const radiusToken = knobProps.borderRadius.borderRadius as string | number;
|
|
209
|
+
return {
|
|
210
|
+
knobProps,
|
|
211
|
+
size,
|
|
212
|
+
itemHeight,
|
|
213
|
+
frameHeight,
|
|
214
|
+
paddingItems: Math.floor(visibleItems / 2),
|
|
215
|
+
snapDurationMs: motionDurationMs(motionTransition),
|
|
216
|
+
highlightStyle: highlightBandStyle(highlightEdges, radiusToken, Boolean(knobProps.pointy)),
|
|
217
|
+
highlightClassName:
|
|
218
|
+
"className" in knobProps.borderRadius && typeof knobProps.borderRadius.className === "string"
|
|
219
|
+
? knobProps.borderRadius.className
|
|
220
|
+
: undefined,
|
|
221
|
+
};
|
|
222
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { useResolvedKnobs } from "@multiplatform.one/theme";
|
|
2
1
|
import { useCallback, useMemo } from "react";
|
|
3
2
|
import { View } from "tamagui";
|
|
4
3
|
import { Wheel, type WheelHighlightEdges } from "../Wheel";
|
|
@@ -67,8 +66,6 @@ export function TimeWheels({
|
|
|
67
66
|
showSeconds,
|
|
68
67
|
onChange,
|
|
69
68
|
}: TimeWheelsProps) {
|
|
70
|
-
const { knobProps } = useResolvedKnobs();
|
|
71
|
-
const itemHeight = knobProps.nestedControl.px;
|
|
72
69
|
const minutes = useMemo(() => generateRange(0, 59, minuteStep), [minuteStep]);
|
|
73
70
|
const { h: hour12, period } = to12Hour(hour24);
|
|
74
71
|
const showPeriod = timeFormat === "12h";
|
|
@@ -102,7 +99,6 @@ export function TimeWheels({
|
|
|
102
99
|
}
|
|
103
100
|
loop
|
|
104
101
|
visibleItems={5}
|
|
105
|
-
itemHeight={itemHeight}
|
|
106
102
|
flex={1}
|
|
107
103
|
highlightEdges={hourEdge}
|
|
108
104
|
aria-label={t("Hour")}
|
|
@@ -113,7 +109,6 @@ export function TimeWheels({
|
|
|
113
109
|
onChange={(next) => emit(hour24, next, second)}
|
|
114
110
|
loop
|
|
115
111
|
visibleItems={5}
|
|
116
|
-
itemHeight={itemHeight}
|
|
117
112
|
flex={1}
|
|
118
113
|
highlightEdges={minuteEdge}
|
|
119
114
|
aria-label={t("Min")}
|
|
@@ -125,7 +120,6 @@ export function TimeWheels({
|
|
|
125
120
|
onChange={(next) => emit(hour24, minute, next)}
|
|
126
121
|
loop
|
|
127
122
|
visibleItems={5}
|
|
128
|
-
itemHeight={itemHeight}
|
|
129
123
|
flex={1}
|
|
130
124
|
highlightEdges={secondEdge}
|
|
131
125
|
aria-label={t("Sec")}
|
|
@@ -138,7 +132,6 @@ export function TimeWheels({
|
|
|
138
132
|
onChange={(next) => emit(to24Hour(hour12, next), minute, second)}
|
|
139
133
|
loop={false}
|
|
140
134
|
visibleItems={5}
|
|
141
|
-
itemHeight={itemHeight}
|
|
142
135
|
flex={1}
|
|
143
136
|
highlightEdges={periodEdge}
|
|
144
137
|
aria-label={t("AM/PM")}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeWheel.d.ts","sourceRoot":"","sources":["../../src/Wheel/NativeWheel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,oFAAoF;AACpF,wBAAgB,WAAW,CAAC,CAAC,GAAG,MAAM,GAAG,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,QAErE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type WheelProps } from "./wheelShared";
|
|
2
|
+
/**
|
|
3
|
+
* UIPickerView on a real UIScrollView: the platform's own momentum, rubber
|
|
4
|
+
* band and paging (snapToInterval) drive the wheel, and nested inside a
|
|
5
|
+
* screen's ScrollView the inner one owns the drag, so the column never drags
|
|
6
|
+
* its page along with it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function NativeWheel<T = string | number>(props: WheelProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=NativeWheel.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeWheel.native.d.ts","sourceRoot":"","sources":["../../src/Wheel/NativeWheel.native.tsx"],"names":[],"mappings":"AAaA,OAAO,EAUL,KAAK,UAAU,EAChB,MAAM,eAAe,CAAC;AA0EvB;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,GAAG,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,2CAqUpE"}
|
package/types/Wheel/haptic.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* iOS UIPickerView
|
|
3
|
-
*
|
|
2
|
+
* iOS UIPickerView ticks with UISelectionFeedbackGenerator. The native module
|
|
3
|
+
* is looked up in the Expo registry instead of importing expo-haptics, so a
|
|
4
|
+
* binary built without it (the Kitchen Sink) stays silent and the wheel still
|
|
5
|
+
* ships over the air.
|
|
4
6
|
*/
|
|
5
7
|
export declare function fireSelectionHaptic(): void;
|
|
6
8
|
//# sourceMappingURL=haptic.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"haptic.d.ts","sourceRoot":"","sources":["../../src/Wheel/haptic.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"haptic.d.ts","sourceRoot":"","sources":["../../src/Wheel/haptic.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAK1C"}
|
package/types/Wheel/index.d.ts
CHANGED
|
@@ -1,57 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import
|
|
3
|
-
export
|
|
4
|
-
value: T;
|
|
5
|
-
label?: string;
|
|
6
|
-
}
|
|
7
|
-
/** iOS 14 multi-column highlight joining (CupertinoPicker capStart/capEnd). */
|
|
8
|
-
export type WheelHighlightEdges = "all" | "start" | "end" | "none";
|
|
9
|
-
export interface WheelProps<T = string | number> {
|
|
10
|
-
/** Array of items to display */
|
|
11
|
-
items: (T | WheelItem<T>)[];
|
|
12
|
-
/** Currently selected value */
|
|
13
|
-
value?: T;
|
|
14
|
-
/** Called when selection changes */
|
|
15
|
-
onChange?: (value: T) => void;
|
|
16
|
-
/** Number of visible items (should be odd for center alignment) */
|
|
17
|
-
visibleItems?: 3 | 5 | 7;
|
|
18
|
-
/** Height of each item */
|
|
19
|
-
itemHeight?: number;
|
|
20
|
-
/** Column width in px. Items are absolutely positioned, so this is the painted width. */
|
|
21
|
-
width?: number;
|
|
22
|
-
/** Custom render function for items */
|
|
23
|
-
renderItem?: (item: T, index: number, isSelected: boolean) => ReactNode;
|
|
24
|
-
/** Whether the wheel is disabled */
|
|
25
|
-
disabled?: boolean;
|
|
26
|
-
/** Size token for text */
|
|
27
|
-
size?: SizeTokens;
|
|
28
|
-
/**
|
|
29
|
-
* When true (and there are at least 2 items), scrolling wraps at the ends
|
|
30
|
-
* instead of rubber-banding. Uses virtual rows with modulo item indexing.
|
|
31
|
-
*/
|
|
32
|
-
loop?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* How the iOS selection fill rounds and insets. `"all"` is a standalone
|
|
35
|
-
* column; `"start"` / `"end"` / `"none"` join adjacent columns into one band.
|
|
36
|
-
*/
|
|
37
|
-
highlightEdges?: WheelHighlightEdges;
|
|
38
|
-
/** Stretch inside a row of columns (time picker). */
|
|
39
|
-
flex?: number;
|
|
40
|
-
/**
|
|
41
|
-
* Fires once each time a different item crosses the centre band (drag,
|
|
42
|
-
* flick, or snap). Native wires this to a selection haptic.
|
|
43
|
-
*/
|
|
44
|
-
onItemCross?: (value: T, index: number) => void;
|
|
45
|
-
/** Accessible name for the picker (web renders role="slider"). */
|
|
46
|
-
"aria-label"?: string;
|
|
47
|
-
}
|
|
1
|
+
import type { GetProps } from "tamagui";
|
|
2
|
+
import { type WheelProps } from "./wheelShared";
|
|
3
|
+
export type { WheelHighlightEdges, WheelItem, WheelProps } from "./wheelShared";
|
|
48
4
|
declare const WheelContainer: import("tamagui").TamaguiComponent<import("@tamagui/web").TamaDefer, import("tamagui").TamaguiElement, import("@tamagui/core").RNTamaguiViewNonStyleProps, import("@tamagui/web").StackStyleBase, {}, import("@tamagui/web").StaticConfigPublic>;
|
|
49
5
|
declare const WheelItemContainer: import("tamagui").TamaguiComponent<import("@tamagui/web").TamaDefer, import("tamagui").TamaguiElement, import("@tamagui/core").RNTamaguiViewNonStyleProps, import("@tamagui/web").StackStyleBase, {}, import("@tamagui/web").StaticConfigPublic>;
|
|
50
|
-
export declare function Wheel<T = string | number>(
|
|
6
|
+
export declare function Wheel<T = string | number>(props: WheelProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
51
7
|
export declare namespace Wheel {
|
|
52
8
|
var Item: import("tamagui").TamaguiComponent<import("@tamagui/web").TamaDefer, import("tamagui").TamaguiElement, import("@tamagui/core").RNTamaguiViewNonStyleProps, import("@tamagui/web").StackStyleBase, {}, import("@tamagui/web").StaticConfigPublic>;
|
|
53
9
|
}
|
|
54
10
|
export type WheelContainerProps = GetProps<typeof WheelContainer>;
|
|
55
11
|
export type WheelItemProps = GetProps<typeof WheelItemContainer>;
|
|
56
|
-
export {};
|
|
57
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Wheel/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Wheel/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAKxC,OAAO,EASL,KAAK,UAAU,EAChB,MAAM,eAAe,CAAC;AAEvB,YAAY,EAAE,mBAAmB,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA2ChF,QAAA,MAAM,cAAc,kPAKlB,CAAC;AAEH,QAAA,MAAM,kBAAkB,kPAQtB,CAAC;AA6DH,wBAAgB,KAAK,CAAC,CAAC,GAAG,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,2CAE9D;yBAFe,KAAK;;;AA4mBrB,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,OAAO,cAAc,CAAC,CAAC;AAClE,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode } from "react";
|
|
2
|
+
import type { SizeTokens } from "tamagui";
|
|
3
|
+
export interface WheelItem<T = string | number> {
|
|
4
|
+
value: T;
|
|
5
|
+
label?: string;
|
|
6
|
+
}
|
|
7
|
+
/** iOS 14 multi-column highlight joining (CupertinoPicker capStart/capEnd). */
|
|
8
|
+
export type WheelHighlightEdges = "all" | "start" | "end" | "none";
|
|
9
|
+
export interface WheelProps<T = string | number> {
|
|
10
|
+
/** Array of items to display */
|
|
11
|
+
items: (T | WheelItem<T>)[];
|
|
12
|
+
/** Currently selected value */
|
|
13
|
+
value?: T;
|
|
14
|
+
/** Called when selection changes */
|
|
15
|
+
onChange?: (value: T) => void;
|
|
16
|
+
/** Number of visible items (should be odd for center alignment) */
|
|
17
|
+
visibleItems?: 3 | 5 | 7;
|
|
18
|
+
/** Height of each item. Defaults to the font's line height plus the $1 space token. */
|
|
19
|
+
itemHeight?: number;
|
|
20
|
+
/** Column width in px. Items are absolutely positioned, so this is the painted width. */
|
|
21
|
+
width?: number;
|
|
22
|
+
/** Custom render function for items */
|
|
23
|
+
renderItem?: (item: T, index: number, isSelected: boolean) => ReactNode;
|
|
24
|
+
/** Whether the wheel is disabled */
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
/** Size token for text */
|
|
27
|
+
size?: SizeTokens;
|
|
28
|
+
/**
|
|
29
|
+
* When true (and there are at least 2 items), scrolling wraps at the ends
|
|
30
|
+
* instead of rubber-banding. Uses virtual rows with modulo item indexing.
|
|
31
|
+
*/
|
|
32
|
+
loop?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* How the iOS selection fill rounds and insets. `"all"` is a standalone
|
|
35
|
+
* column; `"start"` / `"end"` / `"none"` join adjacent columns into one band.
|
|
36
|
+
*/
|
|
37
|
+
highlightEdges?: WheelHighlightEdges;
|
|
38
|
+
/** Stretch inside a row of columns (time picker). */
|
|
39
|
+
flex?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Fires once each time a different item crosses the centre band (drag,
|
|
42
|
+
* flick, or snap). Native wires this to a selection haptic.
|
|
43
|
+
*/
|
|
44
|
+
onItemCross?: (value: T, index: number) => void;
|
|
45
|
+
/** Accessible name for the picker (web renders role="slider", native "adjustable"). */
|
|
46
|
+
"aria-label"?: string;
|
|
47
|
+
}
|
|
48
|
+
export declare const defaultColumnWidth = 88;
|
|
49
|
+
export declare function normalizeItem<T>(item: T | WheelItem<T>): WheelItem<T>;
|
|
50
|
+
export declare function getItemLabel<T>(item: T | WheelItem<T>): string;
|
|
51
|
+
export declare function getItemValue<T>(item: T | WheelItem<T>): T;
|
|
52
|
+
/** Non-negative modulo (JavaScript % can be negative for negative lhs). */
|
|
53
|
+
export declare function modIndex(row: number, n: number): number;
|
|
54
|
+
/** Shortest steps on the item circle from current row to target data index. */
|
|
55
|
+
export declare function nearestRowForDataIndex(currentRow: number, targetDataIndex: number, n: number): number;
|
|
56
|
+
export declare function drumRadius(frameHeight: number): number;
|
|
57
|
+
/** Rows from the centre at which a row turns edge-on (90°) and stops painting. */
|
|
58
|
+
export declare function drumReachRows(itemHeight: number, frameHeight: number): number;
|
|
59
|
+
export interface DrumPose {
|
|
60
|
+
/** Distance of the row's centre from the frame's centre, in px. */
|
|
61
|
+
offset: number;
|
|
62
|
+
rotateX: number;
|
|
63
|
+
scale: number;
|
|
64
|
+
opacity: number;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Pose of a row `rowsFromCenter` rows away from the band on the UIPickerView
|
|
68
|
+
* drum. The arc length between rows equals the row height, so neighbours can
|
|
69
|
+
* never overlap: each row's projected height shrinks by cos θ exactly as fast
|
|
70
|
+
* as the gap between rows does.
|
|
71
|
+
*/
|
|
72
|
+
export declare function drumPose(rowsFromCenter: number, itemHeight: number, frameHeight: number): DrumPose;
|
|
73
|
+
export declare function fontLineHeightPx(size: SizeTokens, fontFamily: unknown): number;
|
|
74
|
+
export declare function tokenPx(token: string | number, scale: "radius" | "space"): number;
|
|
75
|
+
export declare function highlightBandStyle(edges: WheelHighlightEdges, radiusToken: string | number, pointy: boolean): CSSProperties;
|
|
76
|
+
/** Geometry and knob-derived styling both renderers share. */
|
|
77
|
+
export declare function useWheelLayout<T>({ visibleItems, itemHeight: itemHeightProp, size: sizeProp, highlightEdges, }: Pick<WheelProps<T>, "visibleItems" | "itemHeight" | "size" | "highlightEdges">): {
|
|
78
|
+
knobProps: import("@multiplatform.one/theme").KnobProps;
|
|
79
|
+
size: SizeTokens;
|
|
80
|
+
itemHeight: number;
|
|
81
|
+
frameHeight: number;
|
|
82
|
+
paddingItems: number;
|
|
83
|
+
snapDurationMs: number;
|
|
84
|
+
highlightStyle: CSSProperties;
|
|
85
|
+
highlightClassName: string | undefined;
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=wheelShared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wheelShared.d.ts","sourceRoot":"","sources":["../../src/Wheel/wheelShared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAG1C,MAAM,WAAW,SAAS,CAAC,CAAC,GAAG,MAAM,GAAG,MAAM;IAC5C,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,+EAA+E;AAC/E,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AAEnE,MAAM,WAAW,UAAU,CAAC,CAAC,GAAG,MAAM,GAAG,MAAM;IAC7C,gCAAgC;IAChC,KAAK,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5B,+BAA+B;IAC/B,KAAK,CAAC,EAAE,CAAC,CAAC;IACV,oCAAoC;IACpC,QAAQ,CAAC,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ourceRoot":"","sources":["../../src/shared/TimeColumn.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TimeColumn.d.ts","sourceRoot":"","sources":["../../src/shared/TimeColumn.tsx"],"names":[],"mappings":"AAKA,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,KAAK,CAAC;AAEvC,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,SAAI,GAAG,MAAM,EAAE,CAO1E;AA+BD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACpE;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACzB,MAAM,EACN,MAAM,EACN,MAAM,EACN,UAAU,EACV,UAAU,EACV,WAAW,EACX,QAAQ,GACT,EAAE,eAAe,2CA0EjB"}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all) __defProp(target, name, {
|
|
9
|
-
get: all[name],
|
|
10
|
-
enumerable: true
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
-
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
-
get: () => from[key],
|
|
17
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
-
value: true
|
|
24
|
-
}), mod);
|
|
25
|
-
var WheelEdgeFade_native_exports = {};
|
|
26
|
-
__export(WheelEdgeFade_native_exports, {
|
|
27
|
-
WheelEdgeFade: () => WheelEdgeFade
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(WheelEdgeFade_native_exports);
|
|
30
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
|
-
var import_expo_linear_gradient = require("expo-linear-gradient");
|
|
32
|
-
var import_react_native = require("react-native");
|
|
33
|
-
var import_tamagui = require("tamagui");
|
|
34
|
-
function toTransparent(color) {
|
|
35
|
-
var fnMatch = color.match(/^(rgb|hsl)a?\(([^)]+)\)$/i);
|
|
36
|
-
if (fnMatch) {
|
|
37
|
-
var parts = fnMatch[2].split(",").map(function (part) {
|
|
38
|
-
return part.trim();
|
|
39
|
-
});
|
|
40
|
-
var [a, b, c] = parts;
|
|
41
|
-
return `${fnMatch[1].toLowerCase()}a(${a}, ${b}, ${c}, 0)`;
|
|
42
|
-
}
|
|
43
|
-
var hexMatch = color.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);
|
|
44
|
-
if (hexMatch) {
|
|
45
|
-
var hex = hexMatch[1];
|
|
46
|
-
if (hex.length === 3) {
|
|
47
|
-
hex = hex.split("").map(function (char) {
|
|
48
|
-
return char + char;
|
|
49
|
-
}).join("");
|
|
50
|
-
}
|
|
51
|
-
var r = Number.parseInt(hex.slice(0, 2), 16);
|
|
52
|
-
var g = Number.parseInt(hex.slice(2, 4), 16);
|
|
53
|
-
var b1 = Number.parseInt(hex.slice(4, 6), 16);
|
|
54
|
-
return `rgba(${r}, ${g}, ${b1}, 0)`;
|
|
55
|
-
}
|
|
56
|
-
return "transparent";
|
|
57
|
-
}
|
|
58
|
-
function WheelEdgeFade(param) {
|
|
59
|
-
var {
|
|
60
|
-
height
|
|
61
|
-
} = param;
|
|
62
|
-
var _ref;
|
|
63
|
-
var _theme_background;
|
|
64
|
-
var theme = (0, import_tamagui.useTheme)();
|
|
65
|
-
var background = (_ref = (_theme_background = theme.background) === null || _theme_background === void 0 ? void 0 : _theme_background.val) !== null && _ref !== void 0 ? _ref : "#ffffff";
|
|
66
|
-
var transparent = toTransparent(background);
|
|
67
|
-
if (height <= 0) return null;
|
|
68
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
69
|
-
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react_native.View, {
|
|
70
|
-
pointerEvents: "none",
|
|
71
|
-
style: [styles.band, {
|
|
72
|
-
top: 0,
|
|
73
|
-
height
|
|
74
|
-
}],
|
|
75
|
-
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_expo_linear_gradient.LinearGradient, {
|
|
76
|
-
colors: [background, transparent],
|
|
77
|
-
start: {
|
|
78
|
-
x: 0.5,
|
|
79
|
-
y: 0
|
|
80
|
-
},
|
|
81
|
-
end: {
|
|
82
|
-
x: 0.5,
|
|
83
|
-
y: 1
|
|
84
|
-
},
|
|
85
|
-
style: import_react_native.StyleSheet.absoluteFill
|
|
86
|
-
})
|
|
87
|
-
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react_native.View, {
|
|
88
|
-
pointerEvents: "none",
|
|
89
|
-
style: [styles.band, {
|
|
90
|
-
bottom: 0,
|
|
91
|
-
height
|
|
92
|
-
}],
|
|
93
|
-
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_expo_linear_gradient.LinearGradient, {
|
|
94
|
-
colors: [transparent, background],
|
|
95
|
-
start: {
|
|
96
|
-
x: 0.5,
|
|
97
|
-
y: 0
|
|
98
|
-
},
|
|
99
|
-
end: {
|
|
100
|
-
x: 0.5,
|
|
101
|
-
y: 1
|
|
102
|
-
},
|
|
103
|
-
style: import_react_native.StyleSheet.absoluteFill
|
|
104
|
-
})
|
|
105
|
-
})]
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
var styles = import_react_native.StyleSheet.create({
|
|
109
|
-
band: {
|
|
110
|
-
position: "absolute",
|
|
111
|
-
left: 0,
|
|
112
|
-
right: 0,
|
|
113
|
-
zIndex: 2
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
//# sourceMappingURL=WheelEdgeFade.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["WheelEdgeFade_native_exports","__export","WheelEdgeFade","module","exports","__toCommonJS","import_jsx_runtime","require","import_expo_linear_gradient","import_react_native","import_tamagui","toTransparent","color","fnMatch","match","parts","split","map","part","trim","a","b","c","toLowerCase","hexMatch","hex","length","char","join","r","Number","parseInt","slice","g","b1","param","height","_ref","_theme_background","theme","useTheme","background","val","transparent","jsxs","Fragment","children","jsx","View","pointerEvents","style","styles","band","top","LinearGradient","colors","start","x","y","end","StyleSheet","absoluteFill","bottom","create","position","left","right","zIndex"],"sources":["../../../src/Wheel/WheelEdgeFade.native.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,4BAAA;AAAAC,QAAA,CAAAD,4BAAA;EAAAE,aAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,CAAAL,4BAAA;AAAA,IAAAM,kBAAA,GAAkEC,OAAA;AAClE,IAAAC,2BAAA,GAA+BD,OAAA;AAC/B,IAAAE,mBAAA,GAA2CF,OAAA;AAC3C,IAAAG,cAAA,GAAyBH,OAAA;AACzB,SAASI,cAAcC,KAAA,EAAO;EAC1B,IAAIC,OAAA,GAAUD,KAAA,CAAME,KAAA,CAAM,2BA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AAG;UACHC,CAAA,EAAG;QACP;QACAC,GAAA,EAAK;UACDF,CAAA,EAAG;UACHC,CAAA,EAAG;QACP;QACAR,KAAA,EAAOzC,mBAAA,CAAAmD,UAAA,CAAWC;MACtB,CAAC;IACL,CAAC;EAET,CAAC;AACL;AACA,IAAIV,MAAA,GAAS1C,mBAAA,CAAAmD,UAAA,CAAWG,MAAA,CAAO;EAC3BX,IAAA,EAAM;IACFY,QAAA,EAAU;IACVC,IAAA,EAAM;IACNC,KAAA,EAAO;IACPC,MAAA,EAAQ;EACZ;AACJ,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["WheelEdgeFade","_props"],"sources":["../../../src/Wheel/WheelEdgeFade.tsx"],"sourcesContent":[null],"mappings":"AAIO,SAASA,cAAcC,MAAA,EAA4B;EACxD,OAAO;AACT","ignoreList":[]}
|