@expressive-ui/native 0.0.0-stage → 0.1.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.
Files changed (103) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +42 -2
  3. package/dist/Button.d.ts +48 -0
  4. package/dist/Button.d.ts.map +1 -0
  5. package/dist/Button.js +122 -0
  6. package/dist/Button.js.map +1 -0
  7. package/dist/Carousel.d.ts +13 -0
  8. package/dist/Carousel.d.ts.map +1 -0
  9. package/dist/Carousel.js +52 -0
  10. package/dist/Carousel.js.map +1 -0
  11. package/dist/Chips.d.ts +35 -0
  12. package/dist/Chips.d.ts.map +1 -0
  13. package/dist/Chips.js +138 -0
  14. package/dist/Chips.js.map +1 -0
  15. package/dist/Dialogs.d.ts +42 -0
  16. package/dist/Dialogs.d.ts.map +1 -0
  17. package/dist/Dialogs.js +115 -0
  18. package/dist/Dialogs.js.map +1 -0
  19. package/dist/ExpressiveCard.d.ts +20 -0
  20. package/dist/ExpressiveCard.d.ts.map +1 -0
  21. package/dist/ExpressiveCard.js +71 -0
  22. package/dist/ExpressiveCard.js.map +1 -0
  23. package/dist/Fab.d.ts +16 -0
  24. package/dist/Fab.d.ts.map +1 -0
  25. package/dist/Fab.js +104 -0
  26. package/dist/Fab.js.map +1 -0
  27. package/dist/Fields.d.ts +90 -0
  28. package/dist/Fields.d.ts.map +1 -0
  29. package/dist/Fields.js +211 -0
  30. package/dist/Fields.js.map +1 -0
  31. package/dist/Grid.d.ts +8 -0
  32. package/dist/Grid.d.ts.map +1 -0
  33. package/dist/Grid.js +16 -0
  34. package/dist/Grid.js.map +1 -0
  35. package/dist/Inputs.d.ts +33 -0
  36. package/dist/Inputs.d.ts.map +1 -0
  37. package/dist/Inputs.js +172 -0
  38. package/dist/Inputs.js.map +1 -0
  39. package/dist/List.d.ts +20 -0
  40. package/dist/List.d.ts.map +1 -0
  41. package/dist/List.js +222 -0
  42. package/dist/List.js.map +1 -0
  43. package/dist/Menu.d.ts +26 -0
  44. package/dist/Menu.d.ts.map +1 -0
  45. package/dist/Menu.js +117 -0
  46. package/dist/Menu.js.map +1 -0
  47. package/dist/Navigation.d.ts +34 -0
  48. package/dist/Navigation.d.ts.map +1 -0
  49. package/dist/Navigation.js +80 -0
  50. package/dist/Navigation.js.map +1 -0
  51. package/dist/Progress.d.ts +20 -0
  52. package/dist/Progress.d.ts.map +1 -0
  53. package/dist/Progress.js +93 -0
  54. package/dist/Progress.js.map +1 -0
  55. package/dist/Search.d.ts +50 -0
  56. package/dist/Search.d.ts.map +1 -0
  57. package/dist/Search.js +121 -0
  58. package/dist/Search.js.map +1 -0
  59. package/dist/Sheets.d.ts +44 -0
  60. package/dist/Sheets.d.ts.map +1 -0
  61. package/dist/Sheets.js +128 -0
  62. package/dist/Sheets.js.map +1 -0
  63. package/dist/Toolbar.d.ts +13 -0
  64. package/dist/Toolbar.d.ts.map +1 -0
  65. package/dist/Toolbar.js +38 -0
  66. package/dist/Toolbar.js.map +1 -0
  67. package/dist/Transition.d.ts +34 -0
  68. package/dist/Transition.d.ts.map +1 -0
  69. package/dist/Transition.js +93 -0
  70. package/dist/Transition.js.map +1 -0
  71. package/dist/index.d.ts +20 -0
  72. package/dist/index.d.ts.map +1 -0
  73. package/dist/index.js +20 -0
  74. package/dist/index.js.map +1 -0
  75. package/dist/primitives.d.ts +41 -0
  76. package/dist/primitives.d.ts.map +1 -0
  77. package/dist/primitives.js +55 -0
  78. package/dist/primitives.js.map +1 -0
  79. package/dist/theme.d.ts +57 -0
  80. package/dist/theme.d.ts.map +1 -0
  81. package/dist/theme.js +89 -0
  82. package/dist/theme.js.map +1 -0
  83. package/package.json +53 -4
  84. package/src/Button.tsx +347 -0
  85. package/src/Carousel.tsx +108 -0
  86. package/src/Chips.tsx +292 -0
  87. package/src/Dialogs.tsx +252 -0
  88. package/src/ExpressiveCard.tsx +205 -0
  89. package/src/Fab.tsx +187 -0
  90. package/src/Fields.tsx +556 -0
  91. package/src/Grid.tsx +29 -0
  92. package/src/Inputs.tsx +290 -0
  93. package/src/List.tsx +295 -0
  94. package/src/Menu.tsx +238 -0
  95. package/src/Navigation.tsx +198 -0
  96. package/src/Progress.tsx +192 -0
  97. package/src/Search.tsx +351 -0
  98. package/src/Sheets.tsx +273 -0
  99. package/src/Toolbar.tsx +88 -0
  100. package/src/Transition.tsx +155 -0
  101. package/src/index.ts +19 -0
  102. package/src/primitives.tsx +110 -0
  103. package/src/theme.tsx +125 -0
@@ -0,0 +1,205 @@
1
+ import { useId, useState, type ReactNode } from 'react';
2
+ import { Animated, Image, Pressable, StyleSheet, View, type StyleProp, type ViewStyle } from 'react-native';
3
+ import Svg, { Defs, LinearGradient, Rect, Stop } from 'react-native-svg';
4
+ import { cardSurfaceInfo, resolveCard, SurfaceContext, useInteraction, useSiblingIndex, type CardSpec, type RuntimeProps } from '@expressive-ui/core';
5
+ import type { ExpressiveCardData } from '@expressive-ui/schema';
6
+ import { elevation, tokens } from '@expressive-ui/tokens';
7
+ import { Button } from './Button.js';
8
+ import { CardEmphasisContext, Icon, ShapeIcon, T } from './primitives.js';
9
+ import { useExpressiveTheme, useSpringValue } from './theme.js';
10
+
11
+ export type ExpressiveCardProps = ExpressiveCardData &
12
+ RuntimeProps & {
13
+ onPress?: () => void;
14
+ style?: StyleProp<ViewStyle>;
15
+ };
16
+
17
+ /** Superfície do ExpressiveCard: container, morph de forma, elevação e camada de estado. */
18
+ export function CardSurface({
19
+ spec,
20
+ pressLabel,
21
+ onPress,
22
+ padding = spec.padding,
23
+ gap = spec.gap,
24
+ style,
25
+ children,
26
+ }: {
27
+ spec: CardSpec;
28
+ pressLabel?: string;
29
+ onPress?: () => void;
30
+ padding?: number;
31
+ gap?: number;
32
+ style?: StyleProp<ViewStyle>;
33
+ children: ReactNode;
34
+ }) {
35
+ const { colors, mode } = useExpressiveTheme();
36
+ const { state, handlers } = useInteraction(!spec.interactive);
37
+ const phase = state.pressed ? 'pressed' : state.hovered ? 'hover' : 'rest';
38
+ const layerTarget = phase === 'pressed' ? tokens.state.pressed : phase === 'hover' ? tokens.state.hover : 0;
39
+
40
+ const radius = useSpringValue(spec.radius[phase], 'spatialDefault');
41
+ const scale = useSpringValue(phase === 'pressed' ? spec.pressedScale : 1, 'spatialFast');
42
+ const layer = useSpringValue(layerTarget, 'effectsDefault');
43
+ const emphasis = useSpringValue(phase === 'rest' ? 0 : 1, 'spatialSlow');
44
+ const gradientId = `xui-${useId().replace(/[^a-zA-Z0-9]/g, '')}`;
45
+
46
+ const surface = (
47
+ // A sombra fica na view externa (sem overflow), o recorte dos cantos na interna.
48
+ <Animated.View style={[{ borderRadius: radius, boxShadow: elevation(mode, spec.elevation[phase]), transform: [{ scale }] }, style]}>
49
+ <Animated.View
50
+ style={{
51
+ borderRadius: radius,
52
+ overflow: 'hidden',
53
+ padding,
54
+ gap,
55
+ backgroundColor: spec.container ? colors[spec.container] : undefined,
56
+ borderWidth: spec.border ? StyleSheet.hairlineWidth * 2 : 0,
57
+ borderColor: spec.border ? colors[spec.border] : undefined,
58
+ }}
59
+ >
60
+ {spec.gradient ? (
61
+ <Svg style={StyleSheet.absoluteFill} pointerEvents="none">
62
+ <Defs>
63
+ <LinearGradient id={gradientId} x1="0" y1="0" x2="1" y2="1">
64
+ <Stop offset="0" stopColor={colors[spec.gradient[0]]} />
65
+ <Stop offset="1" stopColor={colors[spec.gradient[1]]} />
66
+ </LinearGradient>
67
+ </Defs>
68
+ <Rect width="100%" height="100%" fill={`url(#${gradientId})`} />
69
+ </Svg>
70
+ ) : null}
71
+ {spec.interactive ? (
72
+ <Animated.View pointerEvents="none" style={[StyleSheet.absoluteFill, { backgroundColor: colors[spec.stateLayer], opacity: layer }]} />
73
+ ) : null}
74
+ <CardEmphasisContext.Provider value={emphasis}>{children}</CardEmphasisContext.Provider>
75
+ </Animated.View>
76
+ </Animated.View>
77
+ );
78
+
79
+ if (!spec.interactive) return surface;
80
+ return (
81
+ <Pressable accessibilityRole="button" accessibilityLabel={pressLabel} onPress={onPress} {...handlers}>
82
+ {surface}
83
+ </Pressable>
84
+ );
85
+ }
86
+
87
+ export function ExpressiveCard({ onPress, onAction, index, style, children, ...data }: ExpressiveCardProps) {
88
+ const { colors } = useExpressiveTheme();
89
+ const position = useSiblingIndex(index);
90
+ const spec = resolveCard(data, { index: position, interactive: Boolean(data.pressAction || onPress) });
91
+ const { eyebrow, title, subtitle, body, icon, headerAction, pressAction } = data;
92
+ const press = onPress ?? (pressAction && onAction ? () => onAction(pressAction) : undefined);
93
+ const hasHeader = Boolean(icon || eyebrow || title || subtitle || headerAction);
94
+
95
+ const [width, setWidth] = useState(0);
96
+ const tinted = spec.variant === 'tonal' || spec.variant === 'hero';
97
+ const content = (
98
+ <View style={[styles.content, { gap: spec.gap }]}>
99
+ {hasHeader ? (
100
+ <View style={styles.header}>
101
+ {icon ? (
102
+ <ShapeIcon shape={spec.accent.shape} icon={icon} size={spec.icon.size} container={spec.icon.container} content={spec.icon.content} />
103
+ ) : null}
104
+ <View style={styles.titles}>
105
+ {eyebrow ? (
106
+ <T variant="labelMedium" emphasized color={spec.supporting} style={styles.eyebrow}>
107
+ {eyebrow}
108
+ </T>
109
+ ) : null}
110
+ {title ? (
111
+ <T variant={spec.type.title} color={spec.content} accessibilityRole="header">
112
+ {title}
113
+ </T>
114
+ ) : null}
115
+ {subtitle ? (
116
+ <T variant={spec.type.subtitle} color={spec.type.subtitleColor} style={spec.type.subtitle === 'titleMedium' ? styles.subhead : styles.subtitle}>
117
+ {subtitle}
118
+ </T>
119
+ ) : null}
120
+ </View>
121
+ {headerAction ? (
122
+ <Pressable
123
+ accessibilityRole="button"
124
+ onPress={() => onAction?.(headerAction)}
125
+ hitSlop={8}
126
+ style={({ pressed }) => [
127
+ styles.link,
128
+ pressed && { backgroundColor: colors[spec.content] + '1A' },
129
+ ]}
130
+ >
131
+ <T variant="labelLarge" color={tinted ? spec.content : 'primary'}>
132
+ {headerAction.label}
133
+ </T>
134
+ <Icon name="arrow_forward" size={18} color={tinted ? spec.content : 'primary'} />
135
+ </Pressable>
136
+ ) : null}
137
+ </View>
138
+ ) : null}
139
+ {body ? (
140
+ <T variant="bodyMedium" color={spec.supporting}>
141
+ {body}
142
+ </T>
143
+ ) : null}
144
+ {children ? <SurfaceContext.Provider value={cardSurfaceInfo(spec)}>{children}</SurfaceContext.Provider> : null}
145
+ {spec.actions.length ? (
146
+ <View style={[styles.actions, spec.actionsAlign === 'end' && { justifyContent: 'flex-end' }]}>
147
+ {spec.actions.map((action) => (
148
+ <Button
149
+ key={action.id}
150
+ action={{ id: action.id, label: action.label }}
151
+ variant={action.variant}
152
+ icon={action.icon ?? undefined}
153
+ onPress={() => onAction?.({ id: action.id, label: action.label })}
154
+ />
155
+ ))}
156
+ </View>
157
+ ) : null}
158
+ </View>
159
+ );
160
+
161
+ // Horizontal só com espaço (≥ 440dp, como a container query do web); estreito, a mídia volta para cima.
162
+ const row = spec.layout === 'horizontal' && width >= 440;
163
+ const pad = spec.padding;
164
+ return (
165
+ <CardSurface spec={spec} pressLabel={pressAction?.label ?? title} onPress={press} style={style}>
166
+ <View onLayout={(e) => setWidth(e.nativeEvent.layout.width + pad * 2)} style={row ? [styles.row, { gap: pad * 0.75 }] : { gap: spec.gap }}>
167
+ {spec.media ? (
168
+ <View
169
+ accessible={Boolean(spec.media.src && spec.media.alt)}
170
+ accessibilityRole={spec.media.src ? 'image' : undefined}
171
+ accessibilityLabel={spec.media.alt || undefined}
172
+ style={[
173
+ styles.media,
174
+ { backgroundColor: colors[spec.media.container], borderRadius: spec.media.radius },
175
+ row
176
+ ? { width: '40%', maxWidth: 280, minHeight: 160, marginTop: -pad, marginBottom: -pad, marginLeft: -pad }
177
+ : { aspectRatio: spec.media.ratio, marginTop: -pad, marginHorizontal: -pad },
178
+ ]}
179
+ >
180
+ {spec.media.src ? (
181
+ <Image source={{ uri: spec.media.src }} style={StyleSheet.absoluteFill} resizeMode="cover" />
182
+ ) : spec.media.icon ? (
183
+ <Icon name={spec.media.icon} size={48} color={spec.media.content} filled />
184
+ ) : null}
185
+ </View>
186
+ ) : null}
187
+ {content}
188
+ </View>
189
+ </CardSurface>
190
+ );
191
+ }
192
+
193
+ const styles = StyleSheet.create({
194
+ header: { flexDirection: 'row', flexWrap: 'wrap', alignItems: 'center', columnGap: 16, rowGap: 8 },
195
+ // Em cards estreitos o link desce para a linha de baixo em vez de esmagar o título.
196
+ titles: { flexGrow: 1, flexShrink: 1, flexBasis: 96, minWidth: 0 },
197
+ eyebrow: { textTransform: 'uppercase', marginBottom: 2 },
198
+ subtitle: { marginTop: 2 },
199
+ subhead: { marginTop: 8 },
200
+ content: { flex: 1, minWidth: 0 },
201
+ row: { flexDirection: 'row' },
202
+ media: { overflow: 'hidden', alignItems: 'center', justifyContent: 'center' },
203
+ actions: { flexDirection: 'row', flexWrap: 'wrap', gap: 8, paddingTop: 8 },
204
+ link: { flexDirection: 'row', alignItems: 'center', gap: 4, minHeight: 40, paddingHorizontal: 12, marginRight: -12, borderRadius: 999 },
205
+ });
package/src/Fab.tsx ADDED
@@ -0,0 +1,187 @@
1
+ import { useEffect, useRef, useState } from 'react';
2
+ import { Animated, Pressable, StyleSheet, Text, View, type StyleProp, type ViewStyle } from 'react-native';
3
+ import { resolveFab, resolveFabMenu, springConfig, useInteraction, type RuntimeProps } from '@expressive-ui/core';
4
+ import type { FabData, FabMenuItem } from '@expressive-ui/schema';
5
+ import { elevation, tokens } from '@expressive-ui/tokens';
6
+ import { Icon, typeStyle } from './primitives.js';
7
+ import { exitTiming, useExpressiveTheme, useSpringValue } from './theme.js';
8
+
9
+ export type FabProps = FabData &
10
+ RuntimeProps & {
11
+ onPress?: () => void;
12
+ /** Extended FAB: false recolhe o texto (ex.: ao rolar para baixo), com a largura animada. */
13
+ expanded?: boolean;
14
+ /** FAB menu controlado; sem isso o menu guarda o próprio estado. */
15
+ open?: boolean;
16
+ onOpenChange?: (open: boolean) => void;
17
+ onMenuSelect?: (item: FabMenuItem) => void;
18
+ style?: StyleProp<ViewStyle>;
19
+ };
20
+
21
+ /** FAB, Extended FAB e, com `menu`, o FAB menu do M3 Expressive. */
22
+ export function Fab(props: FabProps) {
23
+ return props.menu ? <FabMenu {...props} menu={props.menu} /> : <FabButton {...props} />;
24
+ }
25
+
26
+ type CloseState = { open: boolean; container: string; content: string; size: number; label: string };
27
+
28
+ /** FAB e Extended FAB. Pressionado arredonda, como o Fab do mobile-app-rhosse (16 → círculo). */
29
+ function FabButton({ onPress, onAction, index: _, children: __, expanded = true, style, close, ...data }: FabProps & { close?: CloseState }) {
30
+ const { colors, mode } = useExpressiveTheme();
31
+ const spec = resolveFab(data, { expanded });
32
+ const press = onPress ?? (onAction ? () => onAction(data.action) : undefined);
33
+ const { state, handlers } = useInteraction();
34
+ const phase = state.pressed ? 'pressed' : state.hovered ? 'hover' : 'rest';
35
+ const opened = close?.open ?? false;
36
+ const size = opened ? close!.size : spec.size;
37
+ const radius = useSpringValue(opened ? size / 2 : spec.radius[state.pressed ? 'pressed' : 'rest'], 'spatialDefault');
38
+ const height = useSpringValue(size, 'spatialDefault');
39
+ const turn = useSpringValue(opened ? 1 : 0, 'spatialDefault');
40
+ const rotate = turn.interpolate({ inputRange: [0, 1], outputRange: ['0deg', '90deg'] });
41
+ const layer = useSpringValue(phase === 'pressed' ? tokens.state.pressed : phase === 'hover' ? tokens.state.hover : 0, 'effectsDefault');
42
+
43
+ // Largura natural do texto medida fora do fluxo; a visível anima entre 0 e ela.
44
+ const [labelWidth, setLabelWidth] = useState(0);
45
+ const open = useSpringValue(spec.extended ? 1 : 0, 'spatialDefault');
46
+ const inset = (spec.size - spec.iconSize) / 2;
47
+ const content = opened ? close!.content : colors[spec.content];
48
+ const label = [typeStyle(spec.type), { color: content }];
49
+
50
+ return (
51
+ <Pressable
52
+ accessibilityRole="button"
53
+ accessibilityLabel={close?.label ?? data.action.label}
54
+ accessibilityState={close ? { expanded: opened } : undefined}
55
+ onPress={press}
56
+ {...handlers}
57
+ style={style}
58
+ >
59
+ <Animated.View style={{ borderRadius: radius, boxShadow: elevation(mode, spec.elevation[phase]) }}>
60
+ <Animated.View
61
+ style={{
62
+ height,
63
+ minWidth: height,
64
+ flexDirection: 'row',
65
+ alignItems: 'center',
66
+ overflow: 'hidden',
67
+ borderRadius: radius,
68
+ backgroundColor: opened ? close!.container : colors[spec.container],
69
+ paddingHorizontal: open.interpolate({ inputRange: [0, 1], outputRange: [opened ? (size - spec.iconSize) / 2 : inset, spec.paddingX] }),
70
+ }}
71
+ >
72
+ <Animated.View pointerEvents="none" style={[StyleSheet.absoluteFill, { backgroundColor: content, opacity: layer }]} />
73
+ <Animated.View style={{ transform: [{ rotate }] }}>
74
+ <Icon name={opened ? 'close' : data.icon} size={spec.iconSize} tint={content} />
75
+ </Animated.View>
76
+ {data.extended ? (
77
+ <>
78
+ <View style={styles.measure} pointerEvents="none" onLayout={(e) => setLabelWidth(e.nativeEvent.layout.width)}>
79
+ <Text style={label}>{data.action.label}</Text>
80
+ </View>
81
+ <Animated.View
82
+ importantForAccessibility="no-hide-descendants"
83
+ style={{
84
+ overflow: 'hidden',
85
+ width: open.interpolate({ inputRange: [0, 1], outputRange: [0, labelWidth] }),
86
+ marginLeft: open.interpolate({ inputRange: [0, 1], outputRange: [0, spec.gap] }),
87
+ opacity: open,
88
+ }}
89
+ >
90
+ <Text numberOfLines={1} style={label}>
91
+ {data.action.label}
92
+ </Text>
93
+ </Animated.View>
94
+ </>
95
+ ) : null}
96
+ </Animated.View>
97
+ </Animated.View>
98
+ </Pressable>
99
+ );
100
+ }
101
+
102
+ /** Aberto: o FAB vira fechar circular na cor cheia e os itens sobem em cascata (o mais próximo primeiro). */
103
+ function FabMenu({ menu, open: controlled, onOpenChange, onMenuSelect, onAction, style, ...props }: FabProps & { menu: FabMenuItem[] }) {
104
+ const { labels } = useExpressiveTheme();
105
+ const { colors, mode, reduceMotion, motion } = useExpressiveTheme();
106
+ const [inner, setInner] = useState(false);
107
+ const open = controlled ?? inner;
108
+ const setOpen = (next: boolean) => {
109
+ if (controlled === undefined) setInner(next);
110
+ onOpenChange?.(next);
111
+ };
112
+ const spec = resolveFabMenu(props);
113
+ // Um valor por item, na ordem de entrada (do FAB para cima).
114
+ const values = useRef(menu.map(() => new Animated.Value(0))).current;
115
+ useEffect(() => {
116
+ const nearestFirst = [...values].reverse();
117
+ const animations = nearestFirst.map((value) =>
118
+ reduceMotion
119
+ ? Animated.timing(value, { toValue: open ? 1 : 0, duration: 0, useNativeDriver: true })
120
+ : open
121
+ ? Animated.spring(value, { toValue: 1, ...springConfig('spatialDefault', motion), useNativeDriver: true })
122
+ : exitTiming(value),
123
+ );
124
+ const run = open ? Animated.stagger(spec.staggerMs, animations) : Animated.parallel(animations);
125
+ run.start();
126
+ return () => run.stop();
127
+ }, [open, values, reduceMotion, motion, spec.staggerMs]);
128
+
129
+ const choose = (item: FabMenuItem) => {
130
+ onMenuSelect?.(item);
131
+ onAction?.({ id: item.id, label: item.label });
132
+ setOpen(false);
133
+ };
134
+ return (
135
+ <View style={[styles.menu, style]}>
136
+ <View accessibilityRole="menu" style={[styles.items, { gap: spec.gap }]} pointerEvents={open ? 'box-none' : 'none'} importantForAccessibility={open ? 'auto' : 'no-hide-descendants'}>
137
+ {menu.map((item, i) => {
138
+ const v = values[i]!;
139
+ return (
140
+ <Animated.View
141
+ key={item.id}
142
+ style={{
143
+ opacity: v.interpolate({ inputRange: [0, 1], outputRange: [0, 1], extrapolate: 'clamp' }),
144
+ transform: [{ translateY: v.interpolate({ inputRange: [0, 1], outputRange: [12, 0] }) }, { scale: v.interpolate({ inputRange: [0, 1], outputRange: [0.6, 1] }) }],
145
+ }}
146
+ >
147
+ <Pressable
148
+ accessibilityRole="menuitem"
149
+ accessibilityLabel={item.label}
150
+ onPress={() => choose(item)}
151
+ style={({ pressed }) => [
152
+ styles.item,
153
+ {
154
+ height: spec.item.height,
155
+ paddingLeft: spec.item.paddingX - 4,
156
+ paddingRight: spec.item.paddingX,
157
+ gap: spec.item.gap,
158
+ borderRadius: pressed ? 16 : spec.item.height / 2,
159
+ backgroundColor: colors[spec.item.container],
160
+ boxShadow: tokens.elevation[mode][3],
161
+ },
162
+ ]}
163
+ >
164
+ <Icon name={item.icon} size={spec.item.iconSize} color={spec.item.content} />
165
+ <Text style={[typeStyle(spec.item.type), { color: colors[spec.item.content] }]}>{item.label}</Text>
166
+ </Pressable>
167
+ </Animated.View>
168
+ );
169
+ })}
170
+ </View>
171
+ <FabButton
172
+ {...props}
173
+ expanded={!open && props.expanded !== false}
174
+ onPress={() => setOpen(!open)}
175
+ close={{ open, container: colors[spec.close.container], content: colors[spec.close.content], size: spec.close.size, label: open ? labels.closeMenu : props.action.label }}
176
+ />
177
+ </View>
178
+ );
179
+ }
180
+
181
+ const styles = StyleSheet.create({
182
+ measure: { position: 'absolute', opacity: 0, left: 0, top: 0 },
183
+ menu: { alignItems: 'flex-end' },
184
+ // Acima do FAB sem ocupar espaço, como no web.
185
+ items: { position: 'absolute', right: 0, bottom: '100%', marginBottom: 8, alignItems: 'flex-end' },
186
+ item: { flexDirection: 'row', alignItems: 'center' },
187
+ });