@expokit/cli 0.4.0 → 0.4.1
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/bin/lib.mjs +1 -1
- package/package.json +1 -1
- package/registry/_docs/accordion.json +1 -1
- package/registry/_docs/avatar.json +6 -6
- package/registry/_docs/badge.json +3 -3
- package/registry/_docs/bottom-nav.json +6 -6
- package/registry/_docs/bottom-sheet.json +3 -3
- package/registry/_docs/bullet.json +6 -0
- package/registry/_docs/button-3d.json +2 -2
- package/registry/_docs/button.json +2 -2
- package/registry/_docs/calendar.json +5 -5
- package/registry/_docs/card.json +1 -1
- package/registry/_docs/chip-group.json +1 -1
- package/registry/_docs/confetti.json +3 -3
- package/registry/_docs/date-picker.json +4 -4
- package/registry/_docs/drawer.json +4 -4
- package/registry/_docs/flip-card.json +4 -4
- package/registry/_docs/floating-input.json +1 -1
- package/registry/_docs/grain.json +2 -2
- package/registry/_docs/isometric-bar.json +6 -0
- package/registry/_docs/liquidglass-tab.json +1 -1
- package/registry/_docs/otp-input.json +1 -1
- package/registry/_docs/payment-card.json +3 -3
- package/registry/_docs/pixel-bar.json +6 -0
- package/registry/_docs/polar-area.json +6 -0
- package/registry/_docs/progress-steps.json +4 -4
- package/registry/_docs/progress.json +2 -2
- package/registry/_docs/radio-group.json +1 -1
- package/registry/_docs/search-bar.json +3 -3
- package/registry/_docs/segmented-control.json +1 -1
- package/registry/_docs/select.json +6 -6
- package/registry/_docs/skeleton.json +1 -1
- package/registry/_docs/slider.json +6 -6
- package/registry/_docs/spinner.json +2 -2
- package/registry/_docs/stateful-button.json +1 -1
- package/registry/_docs/stepper.json +3 -3
- package/registry/_docs/tabs.json +2 -2
- package/registry/_docs/text-animation.json +4 -4
- package/registry/_docs/textarea.json +1 -1
- package/registry/_docs/tilt-card.json +3 -3
- package/registry/_docs/time-picker.json +6 -6
- package/registry/_docs/timeline-chart.json +6 -0
- package/registry/_docs/timeline.json +4 -4
- package/registry/_docs/treemap.json +6 -0
- package/registry/_docs/waterfall.json +6 -0
- package/registry/accordion/files/src/components/ui/accordion.tsx +31 -3
- package/registry/action-sheet/files/src/components/ui/action-sheet.tsx +4 -1
- package/registry/alert/files/src/components/ui/alert.tsx +5 -2
- package/registry/alert/files/src/components/ui/button.tsx +32 -4
- package/registry/badge/files/src/components/ui/badge.tsx +2 -2
- package/registry/bottom-nav/files/src/components/ui/bottom-nav.tsx +11 -5
- package/registry/button/files/src/components/ui/button.tsx +32 -4
- package/registry/button-3d/files/src/components/ui/button-3d.tsx +33 -6
- package/registry/calendar/files/src/components/ui/calendar.tsx +62 -17
- package/registry/card/files/src/components/ui/card.tsx +25 -5
- package/registry/checkbox/files/src/components/ui/checkbox.tsx +26 -4
- package/registry/chip-group/files/src/components/ui/chip-group.tsx +35 -5
- package/registry/coupon/files/src/components/ui/coupon.tsx +45 -21
- package/registry/coupon/files/src/components/ui/flip-card.tsx +22 -3
- package/registry/coupon/files/src/components/ui/tilt-card.tsx +57 -16
- package/registry/date-picker/files/src/components/ui/calendar.tsx +62 -17
- package/registry/date-picker/files/src/components/ui/date-picker.tsx +96 -42
- package/registry/dialog/files/src/components/ui/dialog.tsx +9 -5
- package/registry/drawer/files/src/components/ui/drawer.tsx +8 -4
- package/registry/flip-card/files/src/components/ui/flip-card.tsx +22 -3
- package/registry/floating-input/files/src/components/ui/floating-input.tsx +75 -26
- package/registry/liquidglass-tab/files/src/components/GlassTabBar.tsx +1 -1
- package/registry/list-item/files/src/components/ui/list-item.tsx +10 -3
- package/registry/otp-input/files/src/components/ui/otp-input.tsx +50 -19
- package/registry/password-input/files/src/components/ui/floating-input.tsx +75 -26
- package/registry/password-input/files/src/components/ui/password-input.tsx +53 -19
- package/registry/payment-card/files/src/components/ui/flip-card.tsx +22 -3
- package/registry/payment-card/files/src/components/ui/payment-card.tsx +19 -15
- package/registry/payment-card/files/src/components/ui/tilt-card.tsx +57 -16
- package/registry/progress/files/src/components/ui/progress.tsx +9 -2
- package/registry/progress-steps/files/src/components/ui/progress-steps.tsx +11 -4
- package/registry/radio-group/files/src/components/ui/radio-group.tsx +39 -9
- package/registry/search-bar/files/src/components/ui/search-bar.tsx +70 -17
- package/registry/segmented-control/files/src/components/ui/segmented-control.tsx +37 -9
- package/registry/select/files/src/components/ui/select.tsx +158 -83
- package/registry/slider/files/src/components/ui/slider.tsx +53 -25
- package/registry/stateful-button/files/src/components/ui/stateful-button.tsx +12 -4
- package/registry/stepper/files/src/components/ui/stepper.tsx +76 -26
- package/registry/switch/files/src/components/ui/switch.tsx +56 -19
- package/registry/tabs/files/src/components/ui/tabs.tsx +7 -4
- package/registry/text-animation/files/src/components/ui/text-animation.tsx +7 -2
- package/registry/textarea/files/src/components/ui/textarea.tsx +104 -36
- package/registry/tilt-card/files/src/components/ui/tilt-card.tsx +57 -16
- package/registry/time-picker/files/src/components/ui/time-picker.tsx +154 -73
- package/registry/timeline/files/src/components/ui/timeline.tsx +9 -4
- package/registry/toast/files/src/components/ui/button.tsx +32 -4
- package/registry/toast/files/src/components/ui/toast.tsx +15 -6
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as Haptics from 'expo-haptics';
|
|
2
2
|
import React, { useEffect, useId, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import {
|
|
4
|
+
AccessibilityInfo,
|
|
4
5
|
Animated,
|
|
5
6
|
PanResponder,
|
|
6
7
|
Pressable,
|
|
@@ -48,6 +49,10 @@ export interface SegmentedControlProps {
|
|
|
48
49
|
style?: StyleProp<ViewStyle>;
|
|
49
50
|
}
|
|
50
51
|
|
|
52
|
+
// Controls stop growing at iOS's largest standard text size (xxxL ≈ 1.35×) so they keep their shape;
|
|
53
|
+
// content text scales all the way.
|
|
54
|
+
const FONT_CAP = 1.35;
|
|
55
|
+
|
|
51
56
|
const SIZES: Record<SegmentedControlSize, { h: number; font: number; px: number; icon: number }> = {
|
|
52
57
|
sm: { h: 32, font: 13, px: 12, icon: 14 },
|
|
53
58
|
md: { h: 40, font: 14.5, px: 16, icon: 16 },
|
|
@@ -81,6 +86,7 @@ export function SegmentedControl({
|
|
|
81
86
|
}: SegmentedControlProps) {
|
|
82
87
|
const { colors, radius, dark } = useKit();
|
|
83
88
|
const gid = 'sc' + useId().replace(/[^a-zA-Z0-9]/g, '');
|
|
89
|
+
const reduce = useReduceMotion();
|
|
84
90
|
const items: SegmentOption[] = options.map((o) => (typeof o === 'string' ? { value: o, label: o } : o));
|
|
85
91
|
const [inner, setInner] = useState(defaultValue ?? items[0]?.value);
|
|
86
92
|
const selected = value ?? inner;
|
|
@@ -98,7 +104,8 @@ export function SegmentedControl({
|
|
|
98
104
|
useEffect(() => {
|
|
99
105
|
const l = layouts.current[index];
|
|
100
106
|
if (!l) return;
|
|
101
|
-
|
|
107
|
+
// Reduce Motion: the indicator jumps to the new segment instead of sliding.
|
|
108
|
+
if (!placed.current || reduce) {
|
|
102
109
|
lx.setValue(l.x);
|
|
103
110
|
rx.setValue(l.x + l.width);
|
|
104
111
|
placed.current = true;
|
|
@@ -111,7 +118,7 @@ export function SegmentedControl({
|
|
|
111
118
|
Animated.spring(lx, { toValue: l.x, useNativeDriver: false, ...(right ? TRAIL : LEAD) }),
|
|
112
119
|
Animated.spring(rx, { toValue: l.x + l.width, useNativeDriver: false, ...(right ? LEAD : TRAIL) }),
|
|
113
120
|
]).start();
|
|
114
|
-
}, [index, measured, lx, rx]);
|
|
121
|
+
}, [index, measured, reduce, lx, rx]);
|
|
115
122
|
|
|
116
123
|
const onSegmentLayout = (i: number) => (e: LayoutChangeEvent) => {
|
|
117
124
|
const { x: lx, width } = e.nativeEvent.layout;
|
|
@@ -253,6 +260,7 @@ export function SegmentedControl({
|
|
|
253
260
|
activeFg={activeFg}
|
|
254
261
|
idleFg={idleFg}
|
|
255
262
|
disabled={disabled || o.disabled}
|
|
263
|
+
reduce={reduce}
|
|
256
264
|
/>
|
|
257
265
|
))}
|
|
258
266
|
</View>
|
|
@@ -271,9 +279,10 @@ interface SegmentProps {
|
|
|
271
279
|
activeFg: string;
|
|
272
280
|
idleFg: string;
|
|
273
281
|
disabled?: boolean;
|
|
282
|
+
reduce: boolean;
|
|
274
283
|
}
|
|
275
284
|
|
|
276
|
-
function Segment({ option, active, onPress, onPressIn, onLayout, fullWidth, size, height, activeFg, idleFg, disabled }: SegmentProps) {
|
|
285
|
+
function Segment({ option, active, onPress, onPressIn, onLayout, fullWidth, size, height, activeFg, idleFg, disabled, reduce }: SegmentProps) {
|
|
277
286
|
const { font } = useKit();
|
|
278
287
|
const ff = font.family ? { fontFamily: font.family } : null;
|
|
279
288
|
// a: text colour (JS). press: content squish, pop: little bounce on selection (native, same view).
|
|
@@ -283,16 +292,19 @@ function Segment({ option, active, onPress, onPressIn, onLayout, fullWidth, size
|
|
|
283
292
|
const mounted = useRef(false);
|
|
284
293
|
|
|
285
294
|
useEffect(() => {
|
|
286
|
-
Animated.timing(a, { toValue: active ? 1 : 0, duration: 180, useNativeDriver: false }).start();
|
|
287
|
-
|
|
295
|
+
Animated.timing(a, { toValue: active ? 1 : 0, duration: reduce ? 150 : 180, useNativeDriver: false }).start();
|
|
296
|
+
// Reduce Motion: no selection pop and no press squish; the label colour still fades.
|
|
297
|
+
if (active && mounted.current && !reduce) {
|
|
288
298
|
pop.setValue(0.9);
|
|
289
299
|
Animated.spring(pop, { toValue: 1, useNativeDriver: true, ...motion.bouncy }).start();
|
|
290
300
|
}
|
|
291
301
|
mounted.current = true;
|
|
292
|
-
}, [active, a, pop]);
|
|
302
|
+
}, [active, reduce, a, pop]);
|
|
293
303
|
|
|
294
|
-
const pressTo = (to: number) =>
|
|
304
|
+
const pressTo = (to: number) => {
|
|
305
|
+
if (reduce) return press.setValue(1);
|
|
295
306
|
Animated.spring(press, { toValue: to, useNativeDriver: true, ...(to < 1 ? motion.snappy : motion.bouncy) }).start();
|
|
307
|
+
};
|
|
296
308
|
|
|
297
309
|
const color = a.interpolate({ inputRange: [0, 1], outputRange: [idleFg, activeFg] });
|
|
298
310
|
const icon =
|
|
@@ -312,12 +324,12 @@ function Segment({ option, active, onPress, onPressIn, onLayout, fullWidth, size
|
|
|
312
324
|
onPressOut={() => pressTo(1)}
|
|
313
325
|
onLayout={onLayout}
|
|
314
326
|
hitSlop={height < 44 ? { top: (44 - height) / 2, bottom: (44 - height) / 2 } : undefined}
|
|
315
|
-
style={[styles.segment, fullWidth && styles.flex, { height, paddingHorizontal: size.px }]}
|
|
327
|
+
style={[styles.segment, fullWidth && styles.flex, { minHeight: height, paddingHorizontal: size.px }]}
|
|
316
328
|
>
|
|
317
329
|
<Animated.View style={[styles.content, { transform: [{ scale: Animated.multiply(press, pop) }] }]}>
|
|
318
330
|
{icon ? <View style={{ minWidth: size.icon, alignItems: 'center' }}>{icon}</View> : null}
|
|
319
331
|
{option.label ? (
|
|
320
|
-
<Animated.Text numberOfLines={1} style={[styles.label, ff, { fontSize: size.font, color }]}>
|
|
332
|
+
<Animated.Text numberOfLines={1} maxFontSizeMultiplier={FONT_CAP} style={[styles.label, ff, { fontSize: size.font, color }]}>
|
|
321
333
|
{option.label}
|
|
322
334
|
</Animated.Text>
|
|
323
335
|
) : null}
|
|
@@ -326,6 +338,22 @@ function Segment({ option, active, onPress, onPressIn, onLayout, fullWidth, size
|
|
|
326
338
|
);
|
|
327
339
|
}
|
|
328
340
|
|
|
341
|
+
function useReduceMotion() {
|
|
342
|
+
const [reduce, setReduce] = useState(false);
|
|
343
|
+
useEffect(() => {
|
|
344
|
+
let alive = true;
|
|
345
|
+
AccessibilityInfo.isReduceMotionEnabled()
|
|
346
|
+
.then((r) => alive && setReduce(r))
|
|
347
|
+
.catch(() => {});
|
|
348
|
+
const sub = AccessibilityInfo.addEventListener('reduceMotionChanged', setReduce);
|
|
349
|
+
return () => {
|
|
350
|
+
alive = false;
|
|
351
|
+
sub.remove();
|
|
352
|
+
};
|
|
353
|
+
}, []);
|
|
354
|
+
return reduce;
|
|
355
|
+
}
|
|
356
|
+
|
|
329
357
|
const styles = StyleSheet.create({
|
|
330
358
|
track: { flexDirection: 'row', alignItems: 'center' },
|
|
331
359
|
flex: { flex: 1 },
|