@expressive-ui/native 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -43,3 +43,9 @@ MIT
43
43
  ## App bars, feedback e intervalos
44
44
 
45
45
  `AppBar` (`TopAppBar`), `Divider`, `Snackbar`/`SnackbarProvider`/`useSnackbar` e `RangeSlider` estão disponíveis no runtime. `DatePicker` e `DateRangePicker` aceitam `variant="docked"`; `Toolbar` aceita `scrollBehavior="collapse" | "hide"` e `scrollOffset`. Veja [contratos e exemplos](../../docs/09-barras-feedback-intervalos.md).
46
+
47
+ ## Formulários, dados e feedback
48
+
49
+ Select, Autocomplete/Combobox, NumberField, Skeleton, Alert/InlineMessage, FileUpload e EmptyState estão disponíveis em Web e React Native. DataTable está disponível inicialmente na Web. A seleção rolável de Menu continua compatível; Select fornece o contrato de campo de formulário. FileUpload recebe adaptadores de envio e, no Native, de escolha de arquivos.
50
+
51
+ Veja os contratos, exemplos e diferenças de plataforma em [docs/10-formularios-dados-feedback.md](../../docs/10-formularios-dados-feedback.md).
@@ -0,0 +1,42 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type DimensionValue, type StyleProp, type ViewStyle } from 'react-native';
3
+ import { type AlertSeverity } from '@expressive-ui/core';
4
+ export type SkeletonProps = {
5
+ variant?: 'text' | 'rectangular' | 'circular';
6
+ width?: DimensionValue;
7
+ height?: number;
8
+ lines?: number;
9
+ animation?: boolean;
10
+ label?: string;
11
+ style?: StyleProp<ViewStyle>;
12
+ };
13
+ export declare function Skeleton({ variant, width, height, lines, animation, label, style }: SkeletonProps): import("react").JSX.Element;
14
+ export type AlertProps = {
15
+ severity?: AlertSeverity;
16
+ title?: string;
17
+ children: ReactNode;
18
+ icon?: string | false;
19
+ action?: {
20
+ label: string;
21
+ onPress: () => void;
22
+ };
23
+ onClose?: () => void;
24
+ live?: boolean;
25
+ style?: StyleProp<ViewStyle>;
26
+ };
27
+ export declare function Alert({ severity, title, children, icon, action, onClose, live, style }: AlertProps): import("react").JSX.Element;
28
+ export declare const InlineMessage: typeof Alert;
29
+ export type EmptyStateProps = {
30
+ title: string;
31
+ description?: string;
32
+ icon?: string;
33
+ illustration?: ReactNode;
34
+ action?: {
35
+ label: string;
36
+ onPress: () => void;
37
+ };
38
+ children?: ReactNode;
39
+ style?: StyleProp<ViewStyle>;
40
+ };
41
+ export declare function EmptyState({ title, description, icon, illustration, action, children, style }: EmptyStateProps): import("react").JSX.Element;
42
+ //# sourceMappingURL=Feedback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Feedback.d.ts","sourceRoot":"","sources":["../src/Feedback.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,EAAgD,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACjI,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIrE,MAAM,MAAM,aAAa,GAAC;IAAC,OAAO,CAAC,EAAC,MAAM,GAAC,aAAa,GAAC,UAAU,CAAC;IAAA,KAAK,CAAC,EAAC,cAAc,CAAC;IAAA,MAAM,CAAC,EAAC,MAAM,CAAC;IAAA,KAAK,CAAC,EAAC,MAAM,CAAC;IAAA,SAAS,CAAC,EAAC,OAAO,CAAC;IAAA,KAAK,CAAC,EAAC,MAAM,CAAC;IAAA,KAAK,CAAC,EAAC,SAAS,CAAC,SAAS,CAAC,CAAA;CAAC,CAAC;AACrL,wBAAgB,QAAQ,CAAC,EAAC,OAAc,EAAC,KAAY,EAAC,MAAM,EAAC,KAAO,EAAC,SAAc,EAAC,KAAK,EAAC,KAAK,EAAC,EAAC,aAAa,+BAK7G;AACD,MAAM,MAAM,UAAU,GAAC;IAAC,QAAQ,CAAC,EAAC,aAAa,CAAC;IAAA,KAAK,CAAC,EAAC,MAAM,CAAC;IAAA,QAAQ,EAAC,SAAS,CAAC;IAAA,IAAI,CAAC,EAAC,MAAM,GAAC,KAAK,CAAC;IAAA,MAAM,CAAC,EAAC;QAAC,KAAK,EAAC,MAAM,CAAC;QAAA,OAAO,EAAC,MAAI,IAAI,CAAA;KAAC,CAAC;IAAA,OAAO,CAAC,EAAC,MAAI,IAAI,CAAC;IAAA,IAAI,CAAC,EAAC,OAAO,CAAC;IAAA,KAAK,CAAC,EAAC,SAAS,CAAC,SAAS,CAAC,CAAA;CAAC,CAAC;AACzM,wBAAgB,KAAK,CAAC,EAAC,QAAe,EAAC,KAAK,EAAC,QAAQ,EAAC,IAAI,EAAC,MAAM,EAAC,OAAO,EAAC,IAAS,EAAC,KAAK,EAAC,EAAC,UAAU,+BAKpG;AACD,eAAO,MAAM,aAAa,cAAM,CAAC;AACjC,MAAM,MAAM,eAAe,GAAC;IAAC,KAAK,EAAC,MAAM,CAAC;IAAA,WAAW,CAAC,EAAC,MAAM,CAAC;IAAA,IAAI,CAAC,EAAC,MAAM,CAAC;IAAA,YAAY,CAAC,EAAC,SAAS,CAAC;IAAA,MAAM,CAAC,EAAC;QAAC,KAAK,EAAC,MAAM,CAAC;QAAA,OAAO,EAAC,MAAI,IAAI,CAAA;KAAC,CAAC;IAAA,QAAQ,CAAC,EAAC,SAAS,CAAC;IAAA,KAAK,CAAC,EAAC,SAAS,CAAC,SAAS,CAAC,CAAA;CAAC,CAAC;AAC5L,wBAAgB,UAAU,CAAC,EAAC,KAAK,EAAC,WAAW,EAAC,IAAY,EAAC,YAAY,EAAC,MAAM,EAAC,QAAQ,EAAC,KAAK,EAAC,EAAC,eAAe,+BAAgnB"}
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useRef, useState } from 'react';
3
+ import { AccessibilityInfo, Animated, Pressable, View } from 'react-native';
4
+ import { alertIcons } from '@expressive-ui/core';
5
+ import { Button } from './Button.js';
6
+ import { Icon, T } from './primitives.js';
7
+ import { useExpressiveTheme } from './theme.js';
8
+ export function Skeleton({ variant = 'text', width = '100%', height, lines = 1, animation = true, label, style }) {
9
+ const { colors } = useExpressiveTheme(), opacity = useRef(new Animated.Value(1)).current, [reduced, setReduced] = useState(true);
10
+ useEffect(() => { let active = true; AccessibilityInfo.isReduceMotionEnabled().then(value => { if (active)
11
+ setReduced(value); }); const listener = AccessibilityInfo.addEventListener('reduceMotionChanged', setReduced); return () => { active = false; listener.remove(); }; }, []);
12
+ useEffect(() => { if (!animation || reduced) {
13
+ opacity.setValue(1);
14
+ return;
15
+ } const loop = Animated.loop(Animated.sequence([Animated.timing(opacity, { toValue: .45, duration: 750, useNativeDriver: true }), Animated.timing(opacity, { toValue: 1, duration: 750, useNativeDriver: true })])); loop.start(); return () => loop.stop(); }, [animation, reduced, opacity]);
16
+ return _jsx(View, { accessible: !!label, accessibilityLabel: label, accessibilityLiveRegion: label ? 'polite' : undefined, accessibilityElementsHidden: !label, importantForAccessibility: label ? 'yes' : 'no-hide-descendants', style: [{ width, gap: 10 }, style], children: Array.from({ length: Math.max(1, Math.floor(lines)) }, (_, index) => _jsx(Animated.View, { style: { height: height ?? (variant === 'text' ? 16 : 48), width: variant === 'circular' ? height ?? 48 : index === Math.floor(lines) - 1 && lines > 1 ? '72%' : '100%', borderRadius: variant === 'circular' ? 999 : 8, backgroundColor: colors.surfaceContainerHighest, opacity } }, index)) });
17
+ }
18
+ export function Alert({ severity = 'info', title, children, icon, action, onClose, live = true, style }) {
19
+ const { colors, labels } = useExpressiveTheme();
20
+ const background = severity === 'error' ? colors.errorContainer : severity === 'success' ? colors.tertiaryContainer : severity === 'warning' ? colors.primaryContainer : colors.secondaryContainer;
21
+ const content = severity === 'error' ? 'onErrorContainer' : severity === 'success' ? 'onTertiaryContainer' : severity === 'warning' ? 'onPrimaryContainer' : 'onSecondaryContainer';
22
+ return _jsxs(View, { accessibilityLiveRegion: live ? severity === 'error' ? 'assertive' : 'polite' : 'none', style: [{ flexDirection: 'row', gap: 14, padding: 18, borderRadius: 16, backgroundColor: background }, style], children: [icon !== false ? _jsx(Icon, { name: icon ?? alertIcons[severity], color: content }) : null, _jsxs(View, { style: { flex: 1, gap: 6 }, children: [title ? _jsx(T, { variant: "titleSmall", color: content, children: title }) : null, typeof children === 'string' ? _jsx(T, { color: content, children: children }) : children, action ? _jsx(Button, { variant: "text", action: { id: 'alert.action', label: action.label }, onPress: action.onPress }) : null] }), onClose ? _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: labels.close, onPress: onClose, style: { minWidth: 40, minHeight: 40, alignItems: 'center', justifyContent: 'center' }, children: _jsx(Icon, { name: "close", color: content }) }) : null] });
23
+ }
24
+ export const InlineMessage = Alert;
25
+ export function EmptyState({ title, description, icon = 'inbox', illustration, action, children, style }) { const { colors } = useExpressiveTheme(); return _jsxs(View, { style: [{ alignItems: 'center', gap: 16, padding: 24 }, style], children: [_jsx(View, { style: { width: 96, height: 96, borderRadius: 32, backgroundColor: colors.secondaryContainer, alignItems: 'center', justifyContent: 'center' }, children: illustration ?? _jsx(Icon, { name: icon, size: 48, color: "onSecondaryContainer" }) }), _jsx(T, { variant: "titleLarge", accessibilityRole: "header", style: { textAlign: 'center' }, children: title }), description ? _jsx(T, { color: "onSurfaceVariant", style: { textAlign: 'center' }, children: description }) : null, action ? _jsx(Button, { action: { id: 'empty.action', label: action.label }, onPress: action.onPress }) : null, children] }); }
26
+ //# sourceMappingURL=Feedback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Feedback.js","sourceRoot":"","sources":["../src/Feedback.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAuD,MAAM,cAAc,CAAC;AACjI,OAAO,EAAE,UAAU,EAAsB,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,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C,CAAA,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { type StyleProp, type ViewStyle } from 'react-native';
2
+ import { type FileUploadOptions, type NativeUploadFile } from '@expressive-ui/core';
3
+ export type { NativeUploadFile } from '@expressive-ui/core';
4
+ /** Inject an Expo DocumentPicker or platform picker adapter; this package does not install a picker dependency. */
5
+ export type FileUploadProps = FileUploadOptions<NativeUploadFile> & {
6
+ label: string;
7
+ pickFiles: () => Promise<readonly NativeUploadFile[]>;
8
+ supportingText?: string;
9
+ disabled?: boolean;
10
+ style?: StyleProp<ViewStyle>;
11
+ };
12
+ export declare function FileUpload({ label, pickFiles, supportingText, disabled, style, ...options }: FileUploadProps): import("react").JSX.Element;
13
+ //# sourceMappingURL=FileUpload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileUpload.d.ts","sourceRoot":"","sources":["../src/FileUpload.tsx"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,EAAiB,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAInG,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,mHAAmH;AACnH,MAAM,MAAM,eAAe,GAAC,iBAAiB,CAAC,gBAAgB,CAAC,GAAC;IAAC,KAAK,EAAC,MAAM,CAAC;IAAA,SAAS,EAAC,MAAI,OAAO,CAAC,SAAS,gBAAgB,EAAE,CAAC,CAAC;IAAA,cAAc,CAAC,EAAC,MAAM,CAAC;IAAA,QAAQ,CAAC,EAAC,OAAO,CAAC;IAAA,KAAK,CAAC,EAAC,SAAS,CAAC,SAAS,CAAC,CAAA;CAAC,CAAC;AACvM,wBAAgB,UAAU,CAAC,EAAC,KAAK,EAAC,SAAS,EAAC,cAAc,EAAC,QAAQ,EAAC,KAAK,EAAC,GAAG,OAAO,EAAC,EAAC,eAAe,+BAMpG"}
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useRef, useState } from 'react';
3
+ import { Image, View } from 'react-native';
4
+ import { useFileUpload } from '@expressive-ui/core';
5
+ import { Button } from './Button.js';
6
+ import { Icon, T } from './primitives.js';
7
+ import { useExpressiveTheme } from './theme.js';
8
+ export function FileUpload({ label, pickFiles, supportingText, disabled, style, ...options }) {
9
+ const { colors, locale } = useExpressiveTheme(), pt = locale.startsWith('pt'), [picking, setPicking] = useState(false), [error, setError] = useState(''), mounted = useRef(true), inflight = useRef(false);
10
+ useEffect(() => { mounted.current = true; return () => { mounted.current = false; }; }, []);
11
+ const queue = useFileUpload({ ...options, onReject: rejected => { setError(rejected.map(item => `${item.file.name}: ${item.reason}`).join(', ')); options.onReject?.(rejected); } });
12
+ const choose = async () => { if (inflight.current || disabled)
13
+ return; inflight.current = true; setPicking(true); setError(''); try {
14
+ const files = await pickFiles();
15
+ if (mounted.current)
16
+ queue.add(files);
17
+ }
18
+ catch (error) {
19
+ if (mounted.current)
20
+ setError(error instanceof Error ? error.message : String(error));
21
+ }
22
+ finally {
23
+ inflight.current = false;
24
+ if (mounted.current)
25
+ setPicking(false);
26
+ } };
27
+ return _jsxs(View, { style: [{ gap: 14 }, style], children: [_jsx(T, { variant: "titleSmall", children: label }), supportingText ? _jsx(T, { color: "onSurfaceVariant", children: supportingText }) : null, _jsxs(View, { style: { padding: 24, borderWidth: 2, borderStyle: 'dashed', borderColor: colors.outlineVariant, borderRadius: 20, alignItems: 'center', gap: 12 }, children: [_jsx(Icon, { name: "upload", size: 32 }), _jsx(Button, { action: { id: 'upload.choose', label: pt ? 'Escolher arquivos' : 'Choose files' }, loading: picking, disabled: disabled || picking, onPress: choose })] }), error ? _jsx(T, { accessibilityRole: "alert", color: "error", children: error }) : null, queue.entries.map(entry => _jsxs(View, { style: { padding: 12, borderRadius: 16, backgroundColor: colors.surfaceContainer, gap: 8 }, children: [_jsxs(View, { style: { flexDirection: 'row', alignItems: 'center', gap: 12 }, children: [entry.file.type.startsWith('image/') ? _jsx(Image, { source: { uri: entry.file.uri }, accessibilityIgnoresInvertColors: true, style: { width: 48, height: 48, borderRadius: 8 } }) : _jsx(Icon, { name: "description" }), _jsxs(View, { style: { flex: 1 }, children: [_jsx(T, { children: entry.file.name }), _jsxs(T, { variant: "bodySmall", color: "onSurfaceVariant", children: [Math.ceil(entry.file.size / 1024), " KB \u00B7 ", entry.status] })] })] }), entry.status === 'uploading' ? _jsx(View, { accessibilityRole: "progressbar", accessibilityLabel: entry.file.name, accessibilityValue: { min: 0, max: 100, now: entry.progress }, style: { height: 4, borderRadius: 2, backgroundColor: colors.outlineVariant }, children: _jsx(View, { style: { height: 4, width: `${entry.progress}%`, backgroundColor: colors.primary } }) }) : null, entry.error ? _jsx(T, { accessibilityRole: "alert", color: "error", children: entry.error }) : null, _jsxs(View, { style: { flexDirection: 'row', flexWrap: 'wrap', gap: 8 }, children: [entry.status === 'uploading' ? _jsx(Button, { variant: "text", action: { id: 'upload.cancel', label: pt ? 'Cancelar' : 'Cancel' }, onPress: () => queue.cancel(entry.id) }) : null, options.onUpload && ['error', 'cancelled'].includes(entry.status) ? _jsx(Button, { variant: "text", disabled: disabled, action: { id: 'upload.retry', label: pt ? 'Tentar novamente' : 'Retry' }, onPress: () => queue.retry(entry.id) }) : null, _jsx(Button, { variant: "text", disabled: disabled, action: { id: 'upload.remove', label: pt ? 'Remover' : 'Remove' }, onPress: () => queue.remove(entry.id) })] })] }, entry.id))] });
28
+ }
29
+ //# sourceMappingURL=FileUpload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileUpload.js","sourceRoot":"","sources":["../src/FileUpload.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAkC,MAAM,cAAc,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAi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CAAA,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAA,CAAC,CAAA,IAAI,EAAE,OAAO,CAAC,QAAQ,IAAE,CAAC,OAAO,EAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA,CAAC,CAAA,KAAC,MAAM,IAAC,OAAO,EAAC,MAAM,EAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAC,EAAE,EAAC,cAAc,EAAC,KAAK,EAAC,EAAE,CAAA,CAAC,CAAA,kBAAkB,CAAA,CAAC,CAAA,OAAO,EAAC,EAAE,OAAO,EAAE,GAAE,EAAE,CAAA,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAA,CAAC,CAAA,IAAI,EAAC,KAAC,MAAM,IAAC,OAAO,EAAC,MAAM,EAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAC,EAAE,EAAC,eAAe,EAAC,KAAK,EAAC,EAAE,CAAA,CAAC,CAAA,SAAS,CAAA,CAAC,CAAA,QAAQ,EAAC,EAAE,OAAO,EAAE,GAAE,EAAE,CAAA,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,IAAO,KAA38C,KAAK,CAAC,EAAE,CAA08C,CAAC,IAAQ,CAAC;AACzhE,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { type StyleProp, type ViewStyle } from 'react-native';
2
+ import { type NumberFieldOptions } from '@expressive-ui/core';
3
+ export type NumberFieldProps = NumberFieldOptions & {
4
+ label: string;
5
+ disabled?: boolean;
6
+ required?: boolean;
7
+ readOnly?: boolean;
8
+ variant?: 'filled' | 'outlined';
9
+ controlsPosition?: 'split' | 'end';
10
+ controlsOrientation?: 'horizontal' | 'vertical';
11
+ prefix?: string;
12
+ suffix?: string;
13
+ supportingText?: string;
14
+ error?: string | boolean;
15
+ style?: StyleProp<ViewStyle>;
16
+ };
17
+ export declare function NumberField({ label, disabled, required, readOnly, variant, controlsPosition, controlsOrientation, prefix, suffix, supportingText, error, style, ...options }: NumberFieldProps): import("react").JSX.Element;
18
+ //# sourceMappingURL=NumberField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NumberField.d.ts","sourceRoot":"","sources":["../src/NumberField.tsx"],"names":[],"mappings":"AACA,OAAO,EAA8B,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG9E,MAAM,MAAM,gBAAgB,GAAC,kBAAkB,GAAC;IAAC,KAAK,EAAC,MAAM,CAAC;IAAA,QAAQ,CAAC,EAAC,OAAO,CAAC;IAAA,QAAQ,CAAC,EAAC,OAAO,CAAC;IAAA,QAAQ,CAAC,EAAC,OAAO,CAAC;IAAA,OAAO,CAAC,EAAC,QAAQ,GAAC,UAAU,CAAC;IAAA,gBAAgB,CAAC,EAAC,OAAO,GAAC,KAAK,CAAC;IAAA,mBAAmB,CAAC,EAAC,YAAY,GAAC,UAAU,CAAC;IAAA,MAAM,CAAC,EAAC,MAAM,CAAC;IAAA,MAAM,CAAC,EAAC,MAAM,CAAC;IAAA,cAAc,CAAC,EAAC,MAAM,CAAC;IAAA,KAAK,CAAC,EAAC,MAAM,GAAC,OAAO,CAAC;IAAA,KAAK,CAAC,EAAC,SAAS,CAAC,SAAS,CAAC,CAAA;CAAC,CAAC;AACtU,wBAAgB,WAAW,CAAC,EAAC,KAAK,EAAC,QAAQ,EAAC,QAAQ,EAAC,QAAQ,EAAC,OAAkB,EAAC,gBAAwB,EAAC,mBAAgC,EAAC,MAAM,EAAC,MAAM,EAAC,cAAc,EAAC,KAAK,EAAC,KAAK,EAAC,GAAG,OAAO,EAAC,EAAC,gBAAgB,+BAM/M"}
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useId, useState } from 'react';
3
+ import { Pressable, TextInput, View } from 'react-native';
4
+ import { useNumberField } from '@expressive-ui/core';
5
+ import { Icon, T } from './primitives.js';
6
+ import { useExpressiveTheme } from './theme.js';
7
+ export function NumberField({ label, disabled, required, readOnly, variant = 'outlined', controlsPosition = 'split', controlsOrientation = 'horizontal', prefix, suffix, supportingText, error, style, ...options }) {
8
+ const { colors, locale } = useExpressiveTheme(), state = useNumberField({ locale, ...options }), pt = locale.startsWith('pt'), id = useId();
9
+ const [selection, setSelection] = useState();
10
+ const vertical = controlsPosition === 'end' && controlsOrientation === 'vertical';
11
+ const stepButton = (direction) => _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: `${direction === 1 ? (pt ? 'Aumentar' : 'Increase') : (pt ? 'Diminuir' : 'Decrease')} ${label}`, disabled: disabled || readOnly || options.value !== null && (direction === 1 ? options.value >= (options.max ?? Infinity) : options.value <= (options.min ?? -Infinity)), onPress: () => state.increment(direction), style: ({ pressed }) => ({ width: vertical ? 48 : 44, height: vertical ? 48 : 44, borderRadius: vertical ? 0 : 22, borderTopWidth: vertical && direction === -1 ? 1 : 0, borderTopColor: colors.outlineVariant, alignItems: 'center', justifyContent: 'center', backgroundColor: vertical ? 'transparent' : colors.secondaryContainer, opacity: disabled || readOnly ? .38 : pressed ? .7 : 1 }), children: _jsx(Icon, { name: direction === 1 ? 'add' : 'remove' }) });
12
+ return _jsxs(View, { style: [{ gap: 6, opacity: disabled ? .38 : 1 }, style], children: [_jsxs(T, { variant: "labelMedium", nativeID: `${id}-label`, children: [label, required ? ' *' : ''] }), _jsxs(View, { style: { flexDirection: 'row', alignItems: 'center', gap: 8, minHeight: 56, padding: 6, borderWidth: variant === 'outlined' ? 1 : 0, borderBottomWidth: 1, borderColor: error ? colors.error : colors.outline, borderRadius: 12, backgroundColor: variant === 'filled' ? colors.surfaceContainerHighest : colors.surface }, children: [controlsPosition === 'split' ? stepButton(-1) : null, prefix ?? state.currencySymbol ? _jsx(T, { children: prefix ?? state.currencySymbol }) : null, _jsx(TextInput, { accessibilityLabel: label, accessibilityRole: "adjustable", accessibilityValue: { ...(options.min !== undefined ? { min: options.min } : {}), ...(options.max !== undefined ? { max: options.max } : {}), ...(options.value !== null ? { now: options.value } : {}), text: state.text }, accessibilityState: { disabled: !!disabled }, accessibilityActions: [{ name: 'increment' }, { name: 'decrement' }], onAccessibilityAction: event => { if (!disabled && !readOnly)
13
+ state.increment(event.nativeEvent.actionName === 'increment' ? 1 : -1); }, editable: !disabled && !readOnly, value: state.text, selection: options.format === 'currency' ? selection : undefined, onSelectionChange: event => { if (options.format === 'currency')
14
+ setSelection(event.nativeEvent.selection); }, onFocus: () => { if (options.format === 'currency' && (options.value === null || options.value === 0)) {
15
+ const point = state.text.indexOf(state.decimalSeparator);
16
+ setSelection({ start: 0, end: point < 0 ? state.text.length : point });
17
+ } }, onChangeText: text => { const result = state.editText(text); if (options.format === 'currency')
18
+ setSelection({ start: result.caret, end: result.caret }); }, onEndEditing: state.commit, keyboardType: "numbers-and-punctuation", style: { flex: 1, minWidth: 0, padding: 10, textAlign: controlsPosition === 'end' ? 'auto' : 'center', color: colors.onSurface, fontSize: 16 } }), suffix ? _jsx(T, { children: suffix }) : null, controlsPosition === 'end' ? _jsx(View, { style: { flexDirection: vertical ? 'column' : 'row', flexShrink: 0, gap: vertical ? 0 : 6, borderWidth: vertical ? 1 : 0, borderColor: colors.outlineVariant, borderRadius: vertical ? 16 : 0, overflow: 'hidden', backgroundColor: vertical ? colors.secondaryContainer : undefined }, children: vertical ? _jsxs(_Fragment, { children: [stepButton(1), stepButton(-1)] }) : _jsxs(_Fragment, { children: [stepButton(-1), stepButton(1)] }) }) : stepButton(1)] }), error || supportingText ? _jsx(T, { variant: "bodySmall", color: error ? 'error' : 'onSurfaceVariant', children: typeof error === 'string' ? error : supportingText }) : null] });
19
+ }
20
+ //# sourceMappingURL=NumberField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NumberField.js","sourceRoot":"","sources":["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CAAA,CAAC,CAAA,CAAC,CAAA,CAAC,EAAC,WAAW,EAAC,QAAQ,CAAA,CAAC,CAAA,CAAC,CAAA,CAAC,CAAA,CAAC,EAAC,WAAW,EAAC,MAAM,CAAC,cAAc,EAAC,YAAY,EAAC,QAAQ,CAAA,CAAC,CAAA,EAAE,CAAA,CAAC,CAAA,CAAC,EAAC,QAAQ,EAAC,QAAQ,EAAC,eAAe,EAAC,QAAQ,CAAA,CAAC,CAAA,MAAM,CAAC,kBAAkB,CAAA,CAAC,CAAA,SAAS,EAAC,YAAG,QAAQ,CAAA,CAAC,CAAA,8BAAG,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA,CAAC,CAAA,8BAAG,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,IAAI,GAAQ,CAAA,CAAC,CAAA,UAAU,CAAC,CAAC,CAAC,IAAQ,EAAC,KAAK,IAAE,cAAc,CAAA,CAAC,CAAA,KAAC,CAAC,IAAC,OAAO,EAAC,WAAW,EAAC,KAAK,EAAE,KAAK,CAAA,CAAC,CAAA,OAAO,CAAA,CAAC,CAAA,kBAAkB,YAAG,OAAO,KAAK,KAAG,QAAQ,CAAA,CAAC,CAAA,KAAK,CAAA,CAAC,CAAA,cAAc,GAAK,CAAA,CAAC,CAAA,IAAI,IAAQ,CAAC;AACvzE,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { type StyleProp, type ViewStyle } from 'react-native';
2
+ import { type SelectOption, type OptionLoader } from '@expressive-ui/core';
3
+ export type { SelectOption, OptionLoader } from '@expressive-ui/core';
4
+ export type SelectProps = {
5
+ label: string;
6
+ options: readonly SelectOption[];
7
+ value?: string;
8
+ defaultValue?: string;
9
+ onChange?: (value: string, option: SelectOption) => void;
10
+ variant?: 'filled' | 'outlined';
11
+ placeholder?: string;
12
+ supportingText?: string;
13
+ error?: string | boolean;
14
+ required?: boolean;
15
+ disabled?: boolean;
16
+ leadingIcon?: string;
17
+ maxHeight?: number;
18
+ style?: StyleProp<ViewStyle>;
19
+ };
20
+ export type AutocompleteProps = SelectProps & {
21
+ loadOptions?: OptionLoader;
22
+ onQueryChange?: (query: string) => void;
23
+ debounce?: number;
24
+ emptyText?: string;
25
+ loadingText?: string;
26
+ loadErrorText?: string;
27
+ };
28
+ export declare function Select(props: SelectProps): import("react").JSX.Element;
29
+ export declare function Autocomplete(props: AutocompleteProps): import("react").JSX.Element;
30
+ export declare const Combobox: typeof Autocomplete;
31
+ //# sourceMappingURL=Select.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../src/Select.tsx"],"names":[],"mappings":"AACA,OAAO,EAA+B,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC3F,OAAO,EAAmB,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAM5F,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACtE,MAAM,MAAM,WAAW,GAAG;IAAE,KAAK,EAAC,MAAM,CAAC;IAAC,OAAO,EAAC,SAAS,YAAY,EAAE,CAAC;IAAC,KAAK,CAAC,EAAC,MAAM,CAAC;IAAC,YAAY,CAAC,EAAC,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAC,CAAC,KAAK,EAAC,MAAM,EAAC,MAAM,EAAC,YAAY,KAAG,IAAI,CAAC;IAAC,OAAO,CAAC,EAAC,QAAQ,GAAC,UAAU,CAAC;IAAC,WAAW,CAAC,EAAC,MAAM,CAAC;IAAC,cAAc,CAAC,EAAC,MAAM,CAAC;IAAC,KAAK,CAAC,EAAC,MAAM,GAAC,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAC,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAC,OAAO,CAAC;IAAC,WAAW,CAAC,EAAC,MAAM,CAAC;IAAC,SAAS,CAAC,EAAC,MAAM,CAAC;IAAC,KAAK,CAAC,EAAC,SAAS,CAAC,SAAS,CAAC,CAAA;CAAE,CAAC;AAClX,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG;IAAE,WAAW,CAAC,EAAC,YAAY,CAAC;IAAC,aAAa,CAAC,EAAC,CAAC,KAAK,EAAC,MAAM,KAAG,IAAI,CAAC;IAAC,QAAQ,CAAC,EAAC,MAAM,CAAC;IAAC,SAAS,CAAC,EAAC,MAAM,CAAC;IAAC,WAAW,CAAC,EAAC,MAAM,CAAC;IAAC,aAAa,CAAC,EAAC,MAAM,CAAA;CAAE,CAAC;AAClM,wBAAgB,MAAM,CAAC,KAAK,EAAC,WAAW,+BAAwD;AAChG,wBAAgB,YAAY,CAAC,KAAK,EAAC,iBAAiB,+BAAgD;AACpG,eAAO,MAAM,QAAQ,qBAAa,CAAC"}
package/dist/Select.js ADDED
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useRef, useState } from 'react';
3
+ import { Pressable, ScrollView, View } from 'react-native';
4
+ import { useOptionSearch } from '@expressive-ui/core';
5
+ import { Dialog } from './Dialogs.js';
6
+ import { TextField } from './Fields.js';
7
+ import { Button } from './Button.js';
8
+ import { Icon, T } from './primitives.js';
9
+ import { useExpressiveTheme } from './theme.js';
10
+ export function Select(props) { return _jsx(SelectionField, { ...props, editable: false }); }
11
+ export function Autocomplete(props) { return _jsx(SelectionField, { ...props, editable: true }); }
12
+ export const Combobox = Autocomplete;
13
+ function SelectionField({ label, options, value: controlled, defaultValue = '', onChange, variant = 'outlined', placeholder, supportingText, error, required, disabled, leadingIcon, maxHeight = 320, style, editable, loadOptions, onQueryChange, debounce, emptyText, loadingText, loadErrorText }) {
14
+ const { colors, locale, labels } = useExpressiveTheme(), pt = locale.startsWith('pt');
15
+ const [inner, setInner] = useState(defaultValue), value = controlled ?? inner, [open, setOpen] = useState(false), [query, setQuery] = useState('');
16
+ const cached = useRef(undefined), selected = options.find(option => option.value === value) ?? (cached.current?.value === value ? cached.current : undefined);
17
+ const result = useOptionSearch(editable && open ? query : '', options, editable ? loadOptions : undefined, debounce), shown = editable ? result.options : options;
18
+ useEffect(() => { if (disabled)
19
+ setOpen(false); }, [disabled]);
20
+ return _jsxs(View, { style: [{ gap: 6, opacity: disabled ? .38 : 1 }, style], children: [_jsxs(T, { variant: "labelMedium", children: [label, required ? ' *' : ''] }), _jsxs(Pressable, { accessibilityRole: "combobox", accessibilityLabel: `${label}${required ? (pt ? ', obrigatório' : ', required') : ''}`, accessibilityValue: { text: selected?.label ?? '' }, accessibilityState: { expanded: open, disabled: !!disabled }, accessibilityHint: typeof error === 'string' ? error : supportingText, disabled: disabled, onPress: () => { setQuery(''); setOpen(true); }, style: { minHeight: 56, padding: 14, borderWidth: variant === 'outlined' ? 1 : 0, borderBottomWidth: 1, borderColor: error ? colors.error : colors.outline, borderRadius: 12, backgroundColor: variant === 'filled' ? colors.surfaceContainerHighest : colors.surface, flexDirection: 'row', alignItems: 'center', gap: 12 }, children: [leadingIcon ? _jsx(Icon, { name: leadingIcon }) : null, _jsx(T, { style: { flex: 1 }, children: selected?.label ?? placeholder ?? (pt ? 'Selecione' : 'Select') }), _jsx(Icon, { name: "arrow_drop_down" })] }), error || supportingText ? _jsx(T, { variant: "bodySmall", color: error ? 'error' : 'onSurfaceVariant', children: typeof error === 'string' ? error : supportingText }) : null, _jsxs(Dialog, { open: open, onClose: () => setOpen(false), headline: label, actions: [{ label: labels.close, onPress: () => setOpen(false) }], children: [editable ? _jsx(TextField, { label: label, value: query, onChange: next => { setQuery(next); onQueryChange?.(next); }, placeholder: placeholder }) : null, _jsx(ScrollView, { style: { maxHeight }, keyboardShouldPersistTaps: "handled", children: result.loading ? _jsx(T, { accessibilityLiveRegion: "polite", children: loadingText ?? (pt ? 'Carregando…' : 'Loading…') }) : result.error ? _jsxs(View, { children: [_jsx(T, { accessibilityRole: "alert", children: loadErrorText ?? (pt ? 'Não foi possível carregar.' : 'Could not load options.') }), _jsx(Button, { variant: "text", action: { id: 'select.retry', label: pt ? 'Tentar novamente' : 'Retry' }, onPress: result.retry })] }) : !shown.length ? _jsx(T, { accessibilityLiveRegion: "polite", children: emptyText ?? (pt ? 'Nenhum resultado.' : 'No results.') }) : shown.map(option => _jsxs(Pressable, { accessibilityRole: "button", accessibilityState: { selected: option.value === value, disabled: !!option.disabled }, disabled: option.disabled, onPress: () => { cached.current = option; setInner(option.value); onChange?.(option.value, option); setOpen(false); }, style: { minHeight: 48, padding: 14, marginVertical: 2, borderRadius: 12, flexDirection: 'row', alignItems: 'center', gap: 12, opacity: option.disabled ? .38 : 1, backgroundColor: option.value === value ? colors.secondaryContainer : colors.surface }, children: [option.icon ? _jsx(Icon, { name: option.icon }) : null, _jsxs(View, { style: { flex: 1 }, children: [_jsx(T, { children: option.label }), option.supportingText ? _jsx(T, { variant: "bodySmall", color: "onSurfaceVariant", children: option.supportingText }) : null] }), option.value === value ? _jsx(Icon, { name: "check" }) : null] }, option.value)) })] })] });
21
+ }
22
+ //# sourceMappingURL=Select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Select.js","sourceRoot":"","sources":["../src/Select.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAkC,MAAM,cAAc,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAwC,MAAM,qBAAqB,CAAC;AAC5F,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAIhD,MAAM,UAAU,M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I,EAAC,CAAC,EAAC,aAAE,KAAC,CAAC,cAAE,MAAM,CAAC,KAAK,GAAK,EAAC,MAAM,CAAC,cAAc,CAAA,CAAC,CAAA,KAAC,CAAC,IAAC,OAAO,EAAC,WAAW,EAAC,KAAK,EAAC,kBAAkB,YAAE,MAAM,CAAC,cAAc,GAAK,CAAA,CAAC,CAAA,IAAI,IAAQ,EAAC,MAAM,CAAC,KAAK,KAAG,KAAK,CAAA,CAAC,CAAA,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,GAAE,CAAA,CAAC,CAAA,IAAI,KADgP,MAAM,CAAC,KAAK,CAEze,CAAC,GACF,IACN,IACJ,CAAC;AACV,CAAC"}
package/dist/index.d.ts CHANGED
@@ -22,4 +22,8 @@ export * from './AppBar.js';
22
22
  export * from './Divider.js';
23
23
  export * from './Snackbar.js';
24
24
  export * from './RangeSlider.js';
25
+ export * from './Select.js';
26
+ export * from './Feedback.js';
27
+ export * from './NumberField.js';
28
+ export * from './FileUpload.js';
25
29
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAE7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAE7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AAEjC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC"}
package/dist/index.js CHANGED
@@ -22,4 +22,8 @@ export * from './AppBar.js';
22
22
  export * from './Divider.js';
23
23
  export * from './Snackbar.js';
24
24
  export * from './RangeSlider.js';
25
+ export * from './Select.js';
26
+ export * from './Feedback.js';
27
+ export * from './NumberField.js';
28
+ export * from './FileUpload.js';
25
29
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3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C9B,cAAc,kBAAkB,CAAC;AAEjC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expressive-ui/native",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "homepage": "https://expressive-ui.com",
5
5
  "description": "Componentes React Native (Expo) do ExpressiveUI em Material 3 Expressive.",
6
6
  "keywords": [
@@ -34,9 +34,9 @@
34
34
  "build": "tsc -b"
35
35
  },
36
36
  "dependencies": {
37
- "@expressive-ui/core": "0.1.2",
38
- "@expressive-ui/schema": "0.1.2",
39
- "@expressive-ui/tokens": "0.1.2"
37
+ "@expressive-ui/core": "0.2.0",
38
+ "@expressive-ui/schema": "0.2.0",
39
+ "@expressive-ui/tokens": "0.2.0"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "react": ">=19",
@@ -0,0 +1,23 @@
1
+ import { useEffect, useRef, useState, type ReactNode } from 'react';
2
+ import { AccessibilityInfo, Animated, Pressable, View, type DimensionValue, type StyleProp, type ViewStyle } from 'react-native';
3
+ import { alertIcons, type AlertSeverity } from '@expressive-ui/core';
4
+ import { Button } from './Button.js';
5
+ import { Icon, T } from './primitives.js';
6
+ import { useExpressiveTheme } from './theme.js';
7
+ export type SkeletonProps={variant?:'text'|'rectangular'|'circular';width?:DimensionValue;height?:number;lines?:number;animation?:boolean;label?:string;style?:StyleProp<ViewStyle>};
8
+ export function Skeleton({variant='text',width='100%',height,lines=1,animation=true,label,style}:SkeletonProps){
9
+ const {colors}=useExpressiveTheme(),opacity=useRef(new Animated.Value(1)).current,[reduced,setReduced]=useState(true);
10
+ useEffect(()=>{let active=true;AccessibilityInfo.isReduceMotionEnabled().then(value=>{if(active)setReduced(value);});const listener=AccessibilityInfo.addEventListener('reduceMotionChanged',setReduced);return()=>{active=false;listener.remove();};},[]);
11
+ useEffect(()=>{if(!animation||reduced){opacity.setValue(1);return;}const loop=Animated.loop(Animated.sequence([Animated.timing(opacity,{toValue:.45,duration:750,useNativeDriver:true}),Animated.timing(opacity,{toValue:1,duration:750,useNativeDriver:true})]));loop.start();return()=>loop.stop();},[animation,reduced,opacity]);
12
+ return <View accessible={!!label} accessibilityLabel={label} accessibilityLiveRegion={label?'polite':undefined} accessibilityElementsHidden={!label} importantForAccessibility={label?'yes':'no-hide-descendants'} style={[{width,gap:10},style]}>{Array.from({length:Math.max(1,Math.floor(lines))},(_,index)=><Animated.View key={index} style={{height:height??(variant==='text'?16:48),width:variant==='circular'?height??48:index===Math.floor(lines)-1&&lines>1?'72%':'100%',borderRadius:variant==='circular'?999:8,backgroundColor:colors.surfaceContainerHighest,opacity}}/>)}</View>;
13
+ }
14
+ export type AlertProps={severity?:AlertSeverity;title?:string;children:ReactNode;icon?:string|false;action?:{label:string;onPress:()=>void};onClose?:()=>void;live?:boolean;style?:StyleProp<ViewStyle>};
15
+ export function Alert({severity='info',title,children,icon,action,onClose,live=true,style}:AlertProps){
16
+ const {colors,labels}=useExpressiveTheme();
17
+ const background=severity==='error'?colors.errorContainer:severity==='success'?colors.tertiaryContainer:severity==='warning'?colors.primaryContainer:colors.secondaryContainer;
18
+ const content=severity==='error'?'onErrorContainer':severity==='success'?'onTertiaryContainer':severity==='warning'?'onPrimaryContainer':'onSecondaryContainer';
19
+ return <View accessibilityLiveRegion={live?severity==='error'?'assertive':'polite':'none'} style={[{flexDirection:'row',gap:14,padding:18,borderRadius:16,backgroundColor:background},style]}>{icon!==false?<Icon name={icon??alertIcons[severity]} color={content}/>:null}<View style={{flex:1,gap:6}}>{title?<T variant="titleSmall" color={content}>{title}</T>:null}{typeof children==='string'?<T color={content}>{children}</T>:children}{action?<Button variant="text" action={{id:'alert.action',label:action.label}} onPress={action.onPress}/>:null}</View>{onClose?<Pressable accessibilityRole="button" accessibilityLabel={labels.close} onPress={onClose} style={{minWidth:40,minHeight:40,alignItems:'center',justifyContent:'center'}}><Icon name="close" color={content}/></Pressable>:null}</View>;
20
+ }
21
+ export const InlineMessage=Alert;
22
+ export type EmptyStateProps={title:string;description?:string;icon?:string;illustration?:ReactNode;action?:{label:string;onPress:()=>void};children?:ReactNode;style?:StyleProp<ViewStyle>};
23
+ export function EmptyState({title,description,icon='inbox',illustration,action,children,style}:EmptyStateProps){const {colors}=useExpressiveTheme();return <View style={[{alignItems:'center',gap:16,padding:24},style]}><View style={{width:96,height:96,borderRadius:32,backgroundColor:colors.secondaryContainer,alignItems:'center',justifyContent:'center'}}>{illustration??<Icon name={icon} size={48} color="onSecondaryContainer"/>}</View><T variant="titleLarge" accessibilityRole="header" style={{textAlign:'center'}}>{title}</T>{description?<T color="onSurfaceVariant" style={{textAlign:'center'}}>{description}</T>:null}{action?<Button action={{id:'empty.action',label:action.label}} onPress={action.onPress}/>:null}{children}</View>;}
@@ -0,0 +1,16 @@
1
+ import { useEffect, useRef, useState } from 'react';
2
+ import { Image, View, type StyleProp, type ViewStyle } from 'react-native';
3
+ import { useFileUpload, type FileUploadOptions, type NativeUploadFile } from '@expressive-ui/core';
4
+ import { Button } from './Button.js';
5
+ import { Icon, T } from './primitives.js';
6
+ import { useExpressiveTheme } from './theme.js';
7
+ export type { NativeUploadFile } from '@expressive-ui/core';
8
+ /** Inject an Expo DocumentPicker or platform picker adapter; this package does not install a picker dependency. */
9
+ export type FileUploadProps=FileUploadOptions<NativeUploadFile>&{label:string;pickFiles:()=>Promise<readonly NativeUploadFile[]>;supportingText?:string;disabled?:boolean;style?:StyleProp<ViewStyle>};
10
+ export function FileUpload({label,pickFiles,supportingText,disabled,style,...options}:FileUploadProps){
11
+ const {colors,locale}=useExpressiveTheme(),pt=locale.startsWith('pt'),[picking,setPicking]=useState(false),[error,setError]=useState(''),mounted=useRef(true),inflight=useRef(false);
12
+ useEffect(()=>{mounted.current=true;return()=>{mounted.current=false;};},[]);
13
+ const queue=useFileUpload({...options,onReject:rejected=>{setError(rejected.map(item=>`${item.file.name}: ${item.reason}`).join(', '));options.onReject?.(rejected);}});
14
+ const choose=async()=>{if(inflight.current||disabled)return;inflight.current=true;setPicking(true);setError('');try{const files=await pickFiles();if(mounted.current)queue.add(files);}catch(error){if(mounted.current)setError(error instanceof Error?error.message:String(error));}finally{inflight.current=false;if(mounted.current)setPicking(false);}};
15
+ return <View style={[{gap:14},style]}><T variant="titleSmall">{label}</T>{supportingText?<T color="onSurfaceVariant">{supportingText}</T>:null}<View style={{padding:24,borderWidth:2,borderStyle:'dashed',borderColor:colors.outlineVariant,borderRadius:20,alignItems:'center',gap:12}}><Icon name="upload" size={32}/><Button action={{id:'upload.choose',label:pt?'Escolher arquivos':'Choose files'}} loading={picking} disabled={disabled||picking} onPress={choose}/></View>{error?<T accessibilityRole="alert" color="error">{error}</T>:null}{queue.entries.map(entry=><View key={entry.id} style={{padding:12,borderRadius:16,backgroundColor:colors.surfaceContainer,gap:8}}><View style={{flexDirection:'row',alignItems:'center',gap:12}}>{entry.file.type.startsWith('image/')?<Image source={{uri:entry.file.uri}} accessibilityIgnoresInvertColors style={{width:48,height:48,borderRadius:8}}/>:<Icon name="description"/>}<View style={{flex:1}}><T>{entry.file.name}</T><T variant="bodySmall" color="onSurfaceVariant">{Math.ceil(entry.file.size/1024)} KB · {entry.status}</T></View></View>{entry.status==='uploading'?<View accessibilityRole="progressbar" accessibilityLabel={entry.file.name} accessibilityValue={{min:0,max:100,now:entry.progress}} style={{height:4,borderRadius:2,backgroundColor:colors.outlineVariant}}><View style={{height:4,width:`${entry.progress}%`,backgroundColor:colors.primary}}/></View>:null}{entry.error?<T accessibilityRole="alert" color="error">{entry.error}</T>:null}<View style={{flexDirection:'row',flexWrap:'wrap',gap:8}}>{entry.status==='uploading'?<Button variant="text" action={{id:'upload.cancel',label:pt?'Cancelar':'Cancel'}} onPress={()=>queue.cancel(entry.id)}/>:null}{options.onUpload&&['error','cancelled'].includes(entry.status)?<Button variant="text" disabled={disabled} action={{id:'upload.retry',label:pt?'Tentar novamente':'Retry'}} onPress={()=>queue.retry(entry.id)}/>:null}<Button variant="text" disabled={disabled} action={{id:'upload.remove',label:pt?'Remover':'Remove'}} onPress={()=>queue.remove(entry.id)}/></View></View>)}</View>;
16
+ }
@@ -0,0 +1,13 @@
1
+ import { useId, useState } from 'react';
2
+ import { Pressable, TextInput, View, type StyleProp, type ViewStyle } from 'react-native';
3
+ import { useNumberField, type NumberFieldOptions } from '@expressive-ui/core';
4
+ import { Icon, T } from './primitives.js';
5
+ import { useExpressiveTheme } from './theme.js';
6
+ export type NumberFieldProps=NumberFieldOptions&{label:string;disabled?:boolean;required?:boolean;readOnly?:boolean;variant?:'filled'|'outlined';controlsPosition?:'split'|'end';controlsOrientation?:'horizontal'|'vertical';prefix?:string;suffix?:string;supportingText?:string;error?:string|boolean;style?:StyleProp<ViewStyle>};
7
+ export function NumberField({label,disabled,required,readOnly,variant='outlined',controlsPosition='split',controlsOrientation='horizontal',prefix,suffix,supportingText,error,style,...options}:NumberFieldProps){
8
+ const {colors,locale}=useExpressiveTheme(),state=useNumberField({locale,...options}),pt=locale.startsWith('pt'),id=useId();
9
+ const [selection,setSelection]=useState<{start:number;end:number}|undefined>();
10
+ const vertical=controlsPosition==='end'&&controlsOrientation==='vertical';
11
+ const stepButton=(direction:1|-1)=><Pressable accessibilityRole="button" accessibilityLabel={`${direction===1?(pt?'Aumentar':'Increase'):(pt?'Diminuir':'Decrease')} ${label}`} disabled={disabled||readOnly||options.value!==null&&(direction===1?options.value>=(options.max??Infinity):options.value<=(options.min??-Infinity))} onPress={()=>state.increment(direction)} style={({pressed})=>({width:vertical?48:44,height:vertical?48:44,borderRadius:vertical?0:22,borderTopWidth:vertical&&direction===-1?1:0,borderTopColor:colors.outlineVariant,alignItems:'center',justifyContent:'center',backgroundColor:vertical?'transparent':colors.secondaryContainer,opacity:disabled||readOnly? .38 :pressed? .7 :1})}><Icon name={direction===1?'add':'remove'}/></Pressable>;
12
+ return <View style={[{gap:6,opacity:disabled? .38 :1},style]}><T variant="labelMedium" nativeID={`${id}-label`}>{label}{required?' *':''}</T><View style={{flexDirection:'row',alignItems:'center',gap:8,minHeight:56,padding:6,borderWidth:variant==='outlined'?1:0,borderBottomWidth:1,borderColor:error?colors.error:colors.outline,borderRadius:12,backgroundColor:variant==='filled'?colors.surfaceContainerHighest:colors.surface}}>{controlsPosition==='split'?stepButton(-1):null}{prefix??state.currencySymbol?<T>{prefix??state.currencySymbol}</T>:null}<TextInput accessibilityLabel={label} accessibilityRole="adjustable" accessibilityValue={{...(options.min!==undefined?{min:options.min}:{}),...(options.max!==undefined?{max:options.max}:{}),...(options.value!==null?{now:options.value}:{}),text:state.text}} accessibilityState={{disabled:!!disabled}} accessibilityActions={[{name:'increment'},{name:'decrement'}]} onAccessibilityAction={event=>{if(!disabled&&!readOnly)state.increment(event.nativeEvent.actionName==='increment'?1:-1);}} editable={!disabled&&!readOnly} value={state.text} selection={options.format==='currency'?selection:undefined} onSelectionChange={event=>{if(options.format==='currency')setSelection(event.nativeEvent.selection);}} onFocus={()=>{if(options.format==='currency'&&(options.value===null||options.value===0)){const point=state.text.indexOf(state.decimalSeparator);setSelection({start:0,end:point<0?state.text.length:point});}}} onChangeText={text=>{const result=state.editText(text);if(options.format==='currency')setSelection({start:result.caret,end:result.caret});}} onEndEditing={state.commit} keyboardType="numbers-and-punctuation" style={{flex:1,minWidth:0,padding:10,textAlign:controlsPosition==='end'?'auto':'center',color:colors.onSurface,fontSize:16}}/>{suffix?<T>{suffix}</T>:null}{controlsPosition==='end'?<View style={{flexDirection:vertical?'column':'row',flexShrink:0,gap:vertical?0:6,borderWidth:vertical?1:0,borderColor:colors.outlineVariant,borderRadius:vertical?16:0,overflow:'hidden',backgroundColor:vertical?colors.secondaryContainer:undefined}}>{vertical?<>{stepButton(1)}{stepButton(-1)}</>:<>{stepButton(-1)}{stepButton(1)}</>}</View>:stepButton(1)}</View>{error||supportingText?<T variant="bodySmall" color={error?'error':'onSurfaceVariant'}>{typeof error==='string'?error:supportingText}</T>:null}</View>;
13
+ }
package/src/Select.tsx ADDED
@@ -0,0 +1,36 @@
1
+ import { useEffect, useRef, useState } from 'react';
2
+ import { Pressable, ScrollView, View, type StyleProp, type ViewStyle } from 'react-native';
3
+ import { useOptionSearch, type SelectOption, type OptionLoader } from '@expressive-ui/core';
4
+ import { Dialog } from './Dialogs.js';
5
+ import { TextField } from './Fields.js';
6
+ import { Button } from './Button.js';
7
+ import { Icon, T } from './primitives.js';
8
+ import { useExpressiveTheme } from './theme.js';
9
+ export type { SelectOption, OptionLoader } from '@expressive-ui/core';
10
+ export type SelectProps = { label:string; options:readonly SelectOption[]; value?:string; defaultValue?:string; onChange?:(value:string,option:SelectOption)=>void; variant?:'filled'|'outlined'; placeholder?:string; supportingText?:string; error?:string|boolean; required?:boolean; disabled?:boolean; leadingIcon?:string; maxHeight?:number; style?:StyleProp<ViewStyle> };
11
+ export type AutocompleteProps = SelectProps & { loadOptions?:OptionLoader; onQueryChange?:(query:string)=>void; debounce?:number; emptyText?:string; loadingText?:string; loadErrorText?:string };
12
+ export function Select(props:SelectProps){return <SelectionField {...props} editable={false}/>;}
13
+ export function Autocomplete(props:AutocompleteProps){return <SelectionField {...props} editable/>;}
14
+ export const Combobox=Autocomplete;
15
+ function SelectionField({label,options,value:controlled,defaultValue='',onChange,variant='outlined',placeholder,supportingText,error,required,disabled,leadingIcon,maxHeight=320,style,editable,loadOptions,onQueryChange,debounce,emptyText,loadingText,loadErrorText}:AutocompleteProps&{editable:boolean}){
16
+ const {colors,locale,labels}=useExpressiveTheme(),pt=locale.startsWith('pt');
17
+ const [inner,setInner]=useState(defaultValue),value=controlled??inner,[open,setOpen]=useState(false),[query,setQuery]=useState('');
18
+ const cached=useRef<SelectOption|undefined>(undefined),selected=options.find(option=>option.value===value)??(cached.current?.value===value?cached.current:undefined);
19
+ const result=useOptionSearch(editable&&open?query:'',options,editable?loadOptions:undefined,debounce),shown=editable?result.options:options;
20
+ useEffect(()=>{if(disabled)setOpen(false);},[disabled]);
21
+ return <View style={[{gap:6,opacity:disabled? .38 :1},style]}>
22
+ <T variant="labelMedium">{label}{required?' *':''}</T>
23
+ <Pressable accessibilityRole="combobox" accessibilityLabel={`${label}${required ? (pt ? ', obrigatório' : ', required') : ''}`} accessibilityValue={{text:selected?.label??''}} accessibilityState={{expanded:open,disabled:!!disabled}} accessibilityHint={typeof error==='string'?error:supportingText} disabled={disabled} onPress={()=>{setQuery('');setOpen(true);}} style={{minHeight:56,padding:14,borderWidth:variant==='outlined'?1:0,borderBottomWidth:1,borderColor:error?colors.error:colors.outline,borderRadius:12,backgroundColor:variant==='filled'?colors.surfaceContainerHighest:colors.surface,flexDirection:'row',alignItems:'center',gap:12}}>
24
+ {leadingIcon?<Icon name={leadingIcon}/>:null}<T style={{flex:1}}>{selected?.label??placeholder??(pt?'Selecione':'Select')}</T><Icon name="arrow_drop_down"/>
25
+ </Pressable>
26
+ {error||supportingText?<T variant="bodySmall" color={error?'error':'onSurfaceVariant'}>{typeof error==='string'?error:supportingText}</T>:null}
27
+ <Dialog open={open} onClose={()=>setOpen(false)} headline={label} actions={[{label:labels.close,onPress:()=>setOpen(false)}]}>
28
+ {editable?<TextField label={label} value={query} onChange={next=>{setQuery(next);onQueryChange?.(next);}} placeholder={placeholder}/>:null}
29
+ <ScrollView style={{maxHeight}} keyboardShouldPersistTaps="handled">
30
+ {result.loading?<T accessibilityLiveRegion="polite">{loadingText??(pt?'Carregando…':'Loading…')}</T>:result.error?<View><T accessibilityRole="alert">{loadErrorText??(pt?'Não foi possível carregar.':'Could not load options.')}</T><Button variant="text" action={{id:'select.retry',label:pt?'Tentar novamente':'Retry'}} onPress={result.retry}/></View>:!shown.length?<T accessibilityLiveRegion="polite">{emptyText??(pt?'Nenhum resultado.':'No results.')}</T>:shown.map(option=><Pressable key={option.value} accessibilityRole="button" accessibilityState={{selected:option.value===value,disabled:!!option.disabled}} disabled={option.disabled} onPress={()=>{cached.current=option;setInner(option.value);onChange?.(option.value,option);setOpen(false);}} style={{minHeight:48,padding:14,marginVertical:2,borderRadius:12,flexDirection:'row',alignItems:'center',gap:12,opacity:option.disabled? .38 :1,backgroundColor:option.value===value?colors.secondaryContainer:colors.surface}}>
31
+ {option.icon?<Icon name={option.icon}/>:null}<View style={{flex:1}}><T>{option.label}</T>{option.supportingText?<T variant="bodySmall" color="onSurfaceVariant">{option.supportingText}</T>:null}</View>{option.value===value?<Icon name="check"/>:null}
32
+ </Pressable>)}
33
+ </ScrollView>
34
+ </Dialog>
35
+ </View>;
36
+ }
package/src/index.ts CHANGED
@@ -23,3 +23,8 @@ export * from './AppBar.js';
23
23
  export * from './Divider.js';
24
24
  export * from './Snackbar.js';
25
25
  export * from './RangeSlider.js';
26
+
27
+ export * from './Select.js';
28
+ export * from './Feedback.js';
29
+ export * from './NumberField.js';
30
+ export * from './FileUpload.js';