@expressive-ui/native 0.1.0 → 0.1.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/README.md +4 -6
- package/dist/Pickers.d.ts +16 -0
- package/dist/Pickers.d.ts.map +1 -0
- package/dist/Pickers.js +100 -0
- package/dist/Pickers.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/Pickers.tsx +151 -0
- package/src/index.ts +1 -0
package/README.md
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
# @expressive-ui/native
|
|
1
|
+
# @expressive-ui/native
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Status experimental
|
|
3
|
+
[Veja e teste os componentes em expressive-ui.com](https://expressive-ui.com).
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
Componentes React Native (Expo) do **ExpressiveUI**, em Material 3 Expressive. Mesma API e mesmos tokens do `@expressive-ui/react`, com animações nativas e acessibilidade do RN.
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
O pacote é o renderer React Native oficial do ExpressiveUI para aplicações Expo. A API continua na série `0.x`, portanto pode evoluir entre versões minor.
|
|
10
8
|
|
|
11
9
|
## Instalação
|
|
12
10
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
2
|
+
import { type DatePickerOptions, type DateRangePickerOptions, type TimePickerOptions } from '@expressive-ui/core';
|
|
3
|
+
export type DatePickerProps = DatePickerOptions & {
|
|
4
|
+
style?: StyleProp<ViewStyle>;
|
|
5
|
+
};
|
|
6
|
+
export type DateRangePickerProps = DateRangePickerOptions & {
|
|
7
|
+
style?: StyleProp<ViewStyle>;
|
|
8
|
+
};
|
|
9
|
+
export type { DateRange } from '@expressive-ui/core';
|
|
10
|
+
export declare function DatePicker(props: DatePickerProps): import("react").JSX.Element;
|
|
11
|
+
export declare function DateRangePicker(props: DateRangePickerProps): import("react").JSX.Element;
|
|
12
|
+
export type TimePickerProps = TimePickerOptions & {
|
|
13
|
+
style?: StyleProp<ViewStyle>;
|
|
14
|
+
};
|
|
15
|
+
export declare function TimePicker(props: TimePickerProps): import("react").JSX.Element;
|
|
16
|
+
//# sourceMappingURL=Pickers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pickers.d.ts","sourceRoot":"","sources":["../src/Pickers.tsx"],"names":[],"mappings":"AACA,OAAO,EAAqF,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEjJ,OAAO,EAE4D,KAAK,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,KAAK,iBAAiB,EAC7I,MAAM,qBAAqB,CAAC;AAwB7B,MAAM,MAAM,eAAe,GAAG,iBAAiB,GAAG;IAAE,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAAE,CAAC;AACnF,MAAM,MAAM,oBAAoB,GAAG,sBAAsB,GAAG;IAAE,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAAE,CAAC;AAC7F,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,+BAKhD;AACD,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,+BAK1D;AAwDD,MAAM,MAAM,eAAe,GAAG,iBAAiB,GAAG;IAAE,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAAE,CAAC;AACnF,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,+BAsChD"}
|
package/dist/Pickers.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, useEffect, useRef } from 'react';
|
|
3
|
+
import { Keyboard, Pressable, ScrollView, StyleSheet, TextInput, useWindowDimensions, View } from 'react-native';
|
|
4
|
+
import Svg, { Circle, Line, Path, Rect } from 'react-native-svg';
|
|
5
|
+
import { resolveTimePickerLayout, calendarDays, dateInputPattern, dateKey, dialValueAt, padTime, parseDate, pickerLabels, pickerYears, useDatePickerState, useDateRangePickerState, useTimePickerState, } from '@expressive-ui/core';
|
|
6
|
+
import { Dialog } from './Dialogs.js';
|
|
7
|
+
import { Button } from './Button.js';
|
|
8
|
+
import { TextField } from './Fields.js';
|
|
9
|
+
import { Icon, T } from './primitives.js';
|
|
10
|
+
import { useExpressiveTheme } from './theme.js';
|
|
11
|
+
function PickerIcon({ name, label, onPress, disabled }) {
|
|
12
|
+
const { colors } = useExpressiveTheme();
|
|
13
|
+
return _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: label, accessibilityState: { disabled }, disabled: disabled, onPress: onPress, style: ({ pressed }) => [styles.icon, { opacity: disabled ? .38 : 1, backgroundColor: pressed ? colors.surfaceContainerHighest : undefined }], children: _jsx(Icon, { name: name, color: "onSurfaceVariant" }) });
|
|
14
|
+
}
|
|
15
|
+
function PickerActions({ cancel, confirm, onClose, onConfirm, valid, toggle }) {
|
|
16
|
+
return _jsxs(View, { style: styles.actions, children: [toggle, _jsx(View, { style: { flex: 1 } }), _jsx(Button, { variant: "text", action: { id: 'cancel', label: cancel }, onPress: onClose }), _jsx(Button, { variant: "text", action: { id: 'confirm', label: confirm }, disabled: !valid, onPress: onConfirm })] });
|
|
17
|
+
}
|
|
18
|
+
function TimeModeToggle({ input, label, onPress }) {
|
|
19
|
+
const { colors } = useExpressiveTheme();
|
|
20
|
+
return _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: label, accessibilityState: { selected: input }, onPress: () => { if (input)
|
|
21
|
+
Keyboard.dismiss(); onPress(); }, style: ({ pressed }) => ({ width: 48, height: 48, borderRadius: 24, alignItems: 'center', justifyContent: 'center', backgroundColor: pressed ? colors.surfaceContainerHighest : undefined }), children: _jsx(Svg, { width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", stroke: colors.onSurfaceVariant, strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round", accessible: false, children: input ? _jsxs(_Fragment, { children: [_jsx(Circle, { cx: 12, cy: 12, r: 9 }), _jsx(Path, { d: "M12 7v5l3 2" })] }) : _jsxs(_Fragment, { children: [_jsx(Rect, { x: 2, y: 5, width: 20, height: 14, rx: 2 }), _jsx(Path, { d: "M5 9h1m3 0h1m3 0h1m3 0h1M5 12h1m3 0h1m3 0h1m3 0h1M7 15h10" })] }) }) });
|
|
22
|
+
}
|
|
23
|
+
export function DatePicker(props) {
|
|
24
|
+
const { locale: themeLocale } = useExpressiveTheme();
|
|
25
|
+
const locale = props.locale ?? themeLocale;
|
|
26
|
+
const state = useDatePickerState({ ...props, locale });
|
|
27
|
+
return _jsx(DatePickerSurface, { ...props, locale: locale, state: state });
|
|
28
|
+
}
|
|
29
|
+
export function DateRangePicker(props) {
|
|
30
|
+
const { locale: themeLocale } = useExpressiveTheme();
|
|
31
|
+
const locale = props.locale ?? themeLocale;
|
|
32
|
+
const range = useDateRangePickerState({ ...props, locale });
|
|
33
|
+
return _jsx(DatePickerSurface, { ...props, locale: locale, state: range, range: range });
|
|
34
|
+
}
|
|
35
|
+
function DatePickerSurface(props) {
|
|
36
|
+
const { colors } = useExpressiveTheme();
|
|
37
|
+
const { open, onClose, title, fieldLabel, cancelLabel, confirmLabel, min, max, style, locale, state, range, startLabel, endLabel } = props;
|
|
38
|
+
const labels = pickerLabels(locale);
|
|
39
|
+
const rangeEnd = range?.range.end ?? '';
|
|
40
|
+
const shortDate = (date) => parseDate(date)?.toLocaleDateString(locale, { month: 'short', day: 'numeric' });
|
|
41
|
+
const list = useRef(null);
|
|
42
|
+
const years = pickerYears(state.month, min, max);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
const index = state.view === 'months' ? state.month.getMonth() : years.indexOf(state.month.getFullYear());
|
|
45
|
+
if (state.view !== 'days')
|
|
46
|
+
list.current?.scrollTo({ y: Math.max(0, index * 48 - 96), animated: false });
|
|
47
|
+
}, [state.view]);
|
|
48
|
+
const monthName = (m, long = false) => new Date(2024, m, 1).toLocaleDateString(locale, { month: long ? 'long' : 'short' });
|
|
49
|
+
const menu = (view, label, text) => _jsxs(Pressable, { accessibilityRole: "button", accessibilityLabel: label, accessibilityState: { expanded: state.view === view, disabled: state.view !== 'days' && state.view !== view }, disabled: state.view !== 'days' && state.view !== view, onPress: () => state.setView(state.view === view ? 'days' : view), style: [styles.menuTrigger, { opacity: state.view !== 'days' && state.view !== view ? .38 : 1 }], children: [_jsx(T, { variant: "labelLarge", color: state.view === view ? 'primary' : 'onSurfaceVariant', children: text }), _jsx(Icon, { name: "arrow_drop_down", size: 18 })] });
|
|
50
|
+
return _jsx(Dialog, { open: open, onClose: onClose, style: [{ maxWidth: 360, borderRadius: 28 }, style], children: _jsxs(View, { style: { gap: 16 }, children: [_jsx(T, { variant: "labelLarge", color: "onSurfaceVariant", children: title ?? (range ? labels.range : labels.date) }), _jsxs(View, { style: [styles.headline, { borderBottomColor: colors.outlineVariant, borderBottomWidth: 1, paddingBottom: 12 }], children: [_jsx(T, { variant: range ? "headlineSmall" : "headlineLarge", style: { flex: 1 }, children: range ? `${shortDate(range.range.start) ?? labels.start} – ${shortDate(range.range.end) ?? labels.end}` : parseDate(state.draft)?.toLocaleDateString(locale, { weekday: 'short', month: 'short', day: 'numeric' }) ?? '—' }), _jsx(PickerIcon, { name: state.mode === 'calendar' ? 'edit' : 'calendar_today', label: state.mode === 'calendar' ? labels.input : labels.calendar, onPress: () => { state.setMode(state.mode === 'calendar' ? 'input' : 'calendar'); state.setView('days'); } })] }), state.mode === 'input' ? range ? _jsx(View, { style: { gap: 16 }, children: ['start', 'end'].map(part => _jsx(TextField, { variant: "outlined", label: part === 'start' ? startLabel ?? labels.start : endLabel ?? labels.end, value: part === 'start' ? range.startText : range.endText, onChange: text => range.editPart(text, part), keyboardType: "numbers-and-punctuation", placeholder: dateInputPattern(locale), supportingText: dateInputPattern(locale), error: (part === 'start' ? range.startText : range.endText) && (!range.available(range.range[part]) || !!(range.range.start && range.range.end && !range.valid)) ? labels.rangeInvalid : undefined }, part)) }) : _jsx(TextField, { variant: "outlined", label: fieldLabel ?? labels.dateField, value: state.text, onChange: state.edit, keyboardType: "numbers-and-punctuation", placeholder: dateInputPattern(locale), supportingText: dateInputPattern(locale), error: state.text && !state.valid ? labels.invalid : undefined }) : _jsxs(View, { children: [_jsxs(View, { style: styles.navigation, children: [_jsxs(View, { style: styles.navGroup, children: [_jsx(PickerIcon, { name: "chevron_left", label: labels.previous, disabled: state.view === 'years' || !state.canNavigate(-1), onPress: () => state.navigate(-1) }), menu('months', labels.month, monthName(state.month.getMonth())), _jsx(PickerIcon, { name: "chevron_right", label: labels.next, disabled: state.view === 'years' || !state.canNavigate(1), onPress: () => state.navigate(1) })] }), _jsxs(View, { style: styles.navGroup, children: [_jsx(PickerIcon, { name: "chevron_left", label: labels.previousYear, disabled: state.view === 'months' || !state.canNavigate(-12), onPress: () => state.navigate(-12) }), menu('years', labels.year, String(state.month.getFullYear())), _jsx(PickerIcon, { name: "chevron_right", label: labels.nextYear, disabled: state.view === 'months' || !state.canNavigate(12), onPress: () => state.navigate(12) })] })] }), state.view === 'days' ? _jsxs(View, { style: styles.calendar, children: [Array.from({ length: 7 }, (_, i) => _jsx(View, { style: styles.day, children: _jsx(T, { variant: "labelSmall", color: "onSurfaceVariant", children: new Date(2024, 0, 7 + i).toLocaleDateString(locale, { weekday: 'narrow' }) }) }, i)), calendarDays(state.month).map(date => {
|
|
51
|
+
const start = !!range && date === range.range.start, end = !!range && date === range.range.end;
|
|
52
|
+
const selected = range ? start || end : state.draft === date, today = dateKey(new Date()) === date, enabled = state.available(date);
|
|
53
|
+
const inRange = !!(range?.range.start && rangeEnd && date >= range.range.start && date <= rangeEnd);
|
|
54
|
+
return _jsxs(Pressable, { accessibilityRole: "button", accessibilityLabel: `${parseDate(date).toLocaleDateString(locale, { dateStyle: 'full' })}${start ? `, ${startLabel ?? labels.start}` : ''}${end ? `, ${endLabel ?? labels.end}` : ''}`, accessibilityHint: range ? labels.rangeHelp : undefined, accessibilityState: { selected, disabled: !enabled }, disabled: !enabled, onPress: () => state.select(date), style: [styles.day, { opacity: !enabled ? .38 : selected || inRange ? 1 : parseDate(date).getMonth() !== state.month.getMonth() ? .38 : 1 }], children: [inRange && !(start && end) ? _jsx(View, { pointerEvents: "none", style: { position: 'absolute', top: 5, bottom: 5, left: start ? '50%' : 0, right: end ? '50%' : 0, backgroundColor: colors.secondaryContainer } }) : null, _jsx(View, { style: { width: 34, height: 34, borderRadius: 17, alignItems: 'center', justifyContent: 'center', backgroundColor: selected ? colors.primary : undefined, borderWidth: today ? 1 : 0, borderColor: colors.primary }, children: _jsx(T, { color: selected ? 'onPrimary' : today ? 'primary' : inRange ? 'onSecondaryContainer' : 'onSurface', children: parseDate(date).getDate() }) })] }, date);
|
|
55
|
+
})] }) : _jsx(ScrollView, { ref: list, style: { height: 308, borderTopWidth: 1, borderColor: colors.outlineVariant }, nestedScrollEnabled: true, children: (state.view === 'months' ? Array.from({ length: 12 }, (_, i) => i) : years).map(n => {
|
|
56
|
+
const selected = n === (state.view === 'months' ? state.month.getMonth() : state.month.getFullYear());
|
|
57
|
+
const start = new Date(state.month);
|
|
58
|
+
start.setDate(1);
|
|
59
|
+
state.view === 'months' ? start.setMonth(n) : start.setFullYear(n, 0, 1);
|
|
60
|
+
const end = new Date(start);
|
|
61
|
+
state.view === 'months' ? end.setMonth(end.getMonth() + 1, 0) : end.setFullYear(n + 1, 0, 0);
|
|
62
|
+
const disabled = !!((min && dateKey(end) < min) || (max && dateKey(start) > max));
|
|
63
|
+
return _jsxs(Pressable, { accessibilityRole: "button", accessibilityState: { selected, disabled }, disabled: disabled, onPress: () => state.view === 'months' ? state.chooseMonth(n) : state.chooseYear(n), style: { minHeight: 48, paddingHorizontal: 16, flexDirection: 'row', alignItems: 'center', gap: 16, opacity: disabled ? .38 : 1, backgroundColor: selected ? colors.secondaryContainer : undefined }, children: [_jsx(View, { style: { width: 20 }, children: selected ? _jsx(Icon, { name: "check", size: 20, color: "onSecondaryContainer" }) : null }), _jsx(T, { color: selected ? 'onSecondaryContainer' : 'onSurface', children: state.view === 'months' ? monthName(n, true) : n })] }, n);
|
|
64
|
+
}) })] }), range ? _jsx(T, { variant: "bodySmall", color: "onSurfaceVariant", accessibilityLiveRegion: "polite", children: range.range.start && !range.range.end ? labels.end : range.range.end && !range.valid ? labels.rangeInvalid : labels.rangeHelp }) : null, _jsx(PickerActions, { cancel: cancelLabel ?? labels.cancel, confirm: confirmLabel ?? labels.confirm, onClose: onClose, onConfirm: state.confirm, valid: state.valid })] }) });
|
|
65
|
+
}
|
|
66
|
+
export function TimePicker(props) {
|
|
67
|
+
const { locale, colors } = useExpressiveTheme();
|
|
68
|
+
const { open, onClose, title, cancelLabel, confirmLabel, format = '24h', layout = 'auto', style } = props;
|
|
69
|
+
const labels = pickerLabels(props.locale ?? locale), state = useTimePickerState(props);
|
|
70
|
+
const hourInput = useRef(null), minuteInput = useRef(null);
|
|
71
|
+
const { width, height } = useWindowDimensions();
|
|
72
|
+
const inputMode = state.mode === 'input';
|
|
73
|
+
const horizontal = resolveTimePickerLayout(layout, width, height, state.mode) === 'horizontal';
|
|
74
|
+
const size = horizontal ? Math.min(256, (Math.min(560, width - 48) - 72) * 1.1 / 2.1) : Math.min(256, width - 96), scale = size / 256, center = size / 2;
|
|
75
|
+
useEffect(() => { if (open && inputMode)
|
|
76
|
+
(state.part === 'hour' ? hourInput : minuteInput).current?.focus(); }, [inputMode, open]);
|
|
77
|
+
const angle = (state.part === 'minute' ? state.minute / 60 : state.h24 % 12 / 12) * Math.PI * 2;
|
|
78
|
+
const radius = (state.h24 >= 12 && format === '24h' && state.part === 'hour' ? 65 : 100) * scale;
|
|
79
|
+
const selected = state.part === 'hour' ? state.hour : state.minute;
|
|
80
|
+
const periodSelector = format === '12h' ? _jsx(View, { style: { borderWidth: 1, borderColor: colors.outline, borderRadius: 8, overflow: 'hidden', flexDirection: horizontal ? 'row' : 'column', width: horizontal ? '100%' : 52 }, children: ['AM', 'PM'].map((period, i) => _jsx(Pressable, { accessibilityRole: "button", accessibilityState: { selected: state.period === i }, onPress: () => state.setPeriod(i), style: { minWidth: 46, flex: horizontal ? 1 : undefined, height: 39, alignItems: 'center', justifyContent: 'center', borderTopWidth: horizontal ? 0 : i, borderLeftWidth: horizontal ? i : 0, borderColor: colors.outline, backgroundColor: state.period === i ? colors.tertiaryContainer : undefined }, children: _jsx(T, { color: state.period === i ? 'onTertiaryContainer' : 'onSurfaceVariant', children: period }) }, period)) }) : null;
|
|
81
|
+
return _jsx(Dialog, { open: open, onClose: onClose, style: [{ maxWidth: horizontal ? 560 : 360, borderRadius: 28 }, style], children: _jsxs(View, { style: { gap: 24 }, children: [_jsx(T, { variant: "labelLarge", color: "onSurfaceVariant", children: title ?? (inputMode ? labels.enterTime : labels.time) }), _jsxs(View, { style: { flexDirection: horizontal ? 'row' : 'column', gap: 24, alignItems: 'center' }, children: [_jsxs(View, { style: { flex: horizontal ? 1 : undefined, width: horizontal ? undefined : '100%' }, children: [_jsxs(View, { style: { gap: 16, width: '100%', maxWidth: format === '12h' && !horizontal ? 284 : 256, alignSelf: 'center' }, children: [_jsxs(View, { style: [styles.time, { gap: format === '12h' ? 8 : 4 }], children: [['hour', 'minute'].map((part, i) => _jsxs(Fragment, { children: [i ? _jsx(T, { accessible: false, style: { width: 16, height: 80, fontSize: 56, lineHeight: 80, textAlign: 'center' }, children: ":" }) : null, _jsxs(View, { style: { gap: 7, flex: 1, minWidth: 0 }, children: [inputMode ? _jsx(TextInput, { ref: part === 'hour' ? hourInput : minuteInput, accessibilityLabel: labels[part], keyboardType: "number-pad", selectTextOnFocus: true, maxLength: 2, value: part === 'hour' ? state.hourText : state.minuteText, onFocus: () => state.setPart(part), onBlur: () => state.normalize(part), onChangeText: text => state.edit(text, part), onSubmitEditing: () => part === 'hour' ? minuteInput.current?.focus() : state.confirm(), style: { width: '100%', height: 80, fontSize: 56, textAlign: 'center', borderRadius: 8, borderWidth: 2, borderColor: !(part === 'hour' ? state.hourValid : state.minuteValid) ? colors.error : state.part === part ? colors.primary : 'transparent', color: state.part === part ? colors.onPrimaryContainer : colors.onSurface, backgroundColor: state.part === part ? colors.primaryContainer : colors.surfaceContainerHighest } }) : _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: labels[part], accessibilityState: { selected: state.part === part }, onPress: () => state.setPart(part), onLongPress: () => { state.setPart(part); state.setMode('input'); }, style: { width: '100%', height: 80, justifyContent: 'center', alignItems: 'center', borderRadius: 8, backgroundColor: state.part === part ? colors.primaryContainer : colors.surfaceContainerHighest }, children: _jsx(T, { style: { fontSize: 56, lineHeight: 68 }, color: state.part === part ? 'onPrimaryContainer' : 'onSurface', children: padTime(part === 'hour' ? state.hour : state.minute) }) }), inputMode ? _jsx(T, { variant: "labelSmall", color: "onSurfaceVariant", children: labels[part] }) : null] })] }, part)), !horizontal ? periodSelector : null] }), horizontal ? periodSelector : null] }), inputMode && !state.valid ? _jsx(T, { color: "error", accessibilityRole: "alert", children: labels.invalid }) : null] }), !inputMode ? _jsxs(View, { accessibilityLabel: labels[state.part], style: { width: size, height: size, alignSelf: 'center', borderRadius: center, backgroundColor: colors.surfaceContainerHighest }, children: [_jsx(View, { style: StyleSheet.absoluteFill, onStartShouldSetResponder: () => true, onMoveShouldSetResponder: () => true, onResponderGrant: event => state.select(dialValueAt(event.nativeEvent.locationX, event.nativeEvent.locationY, size, state.part, format)), onResponderMove: event => state.select(dialValueAt(event.nativeEvent.locationX, event.nativeEvent.locationY, size, state.part, format)), onResponderRelease: () => { if (state.part === 'hour')
|
|
82
|
+
state.setPart('minute'); } }), _jsxs(Svg, { width: size, height: size, style: StyleSheet.absoluteFill, pointerEvents: "none", children: [_jsx(Line, { x1: center, y1: center, x2: center + Math.sin(angle) * radius, y2: center - Math.cos(angle) * radius, stroke: colors.primary, strokeWidth: 2 }), _jsx(Circle, { cx: center, cy: center, r: 4, fill: colors.primary }), _jsx(Circle, { cx: center + Math.sin(angle) * radius, cy: center - Math.cos(angle) * radius, r: 20 * scale, fill: colors.primary })] }), Array.from({ length: state.part === 'hour' && format === '24h' ? 24 : 12 }, (_, i) => {
|
|
83
|
+
const n = state.part === 'minute' ? i * 5 : format === '12h' ? i || 12 : i;
|
|
84
|
+
const a = i % 12 / 12 * Math.PI * 2, r = (i >= 12 ? 65 : 100) * scale;
|
|
85
|
+
return _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: `${labels[state.part]} ${n}`, accessibilityState: { selected: selected === n }, onPress: () => { state.select(n); if (state.part === 'hour')
|
|
86
|
+
state.setPart('minute'); }, style: { position: 'absolute', left: center - 20 * scale + Math.sin(a) * r, top: center - 20 * scale - Math.cos(a) * r, width: 40 * scale, height: 40 * scale, borderRadius: 20, alignItems: 'center', justifyContent: 'center' }, children: _jsx(T, { variant: i >= 12 ? 'labelSmall' : 'bodyLarge', color: selected === n ? 'onPrimary' : 'onSurface', children: state.part === 'minute' || format === '24h' && n === 0 ? padTime(n) : n }) }, n);
|
|
87
|
+
})] }) : null] }), _jsx(PickerActions, { cancel: cancelLabel ?? labels.cancel, confirm: confirmLabel ?? labels.confirm, onClose: onClose, onConfirm: state.confirm, valid: state.valid, toggle: _jsx(TimeModeToggle, { input: inputMode, label: inputMode ? labels.dial : labels.input, onPress: state.toggle }) })] }) });
|
|
88
|
+
}
|
|
89
|
+
const styles = StyleSheet.create({
|
|
90
|
+
icon: { width: 28, minHeight: 48, borderRadius: 24, alignItems: 'center', justifyContent: 'center' },
|
|
91
|
+
actions: { flexDirection: 'row', alignItems: 'center', gap: 8 },
|
|
92
|
+
headline: { flexDirection: 'row', alignItems: 'center', gap: 8 },
|
|
93
|
+
navigation: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', minHeight: 48 },
|
|
94
|
+
navGroup: { flexDirection: 'row', alignItems: 'center', flexShrink: 1 },
|
|
95
|
+
menuTrigger: { flexDirection: 'row', alignItems: 'center', gap: 2, minHeight: 48 },
|
|
96
|
+
calendar: { flexDirection: 'row', flexWrap: 'wrap' },
|
|
97
|
+
day: { width: '14.285714%', height: 44, alignItems: 'center', justifyContent: 'center' },
|
|
98
|
+
time: { flexDirection: 'row', gap: 8, justifyContent: 'center', alignItems: 'flex-start' },
|
|
99
|
+
});
|
|
100
|
+
//# sourceMappingURL=Pickers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pickers.js","sourceRoot":"","sources":["../src/Pickers.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAkB,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,mBAAmB,EAAE,IAAI,EAAkC,MAAM,cAAc,CAAC;AACjJ,OAAO,GAAG,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EACL,uBAAuB,EAAE,YAAY,EAAE,gBAAgB,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAC5H,kBAAkB,EAAE,uBAAuB,EAAE,kBAAkB,GAChE,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,SAAS,UAAU,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE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,IAAI,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE;CAC3F,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -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"}
|
|
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"}
|
package/dist/index.js
CHANGED
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;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"}
|
|
1
|
+
{"version":3,"file":"index.js","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"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expressive-ui/native",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"homepage": "https://expressive-ui.com",
|
|
5
|
+
"description": "Componentes React Native (Expo) do ExpressiveUI em Material 3 Expressive.",
|
|
5
6
|
"keywords": [
|
|
6
7
|
"material-3",
|
|
7
8
|
"material-you",
|
|
@@ -10,8 +11,7 @@
|
|
|
10
11
|
"react-native",
|
|
11
12
|
"expo",
|
|
12
13
|
"components",
|
|
13
|
-
"ui"
|
|
14
|
-
"experimental"
|
|
14
|
+
"ui"
|
|
15
15
|
],
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"author": "Murilo Cunha",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"build": "tsc -b"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@expressive-ui/core": "0.1.
|
|
38
|
-
"@expressive-ui/schema": "0.1.
|
|
39
|
-
"@expressive-ui/tokens": "0.1.
|
|
37
|
+
"@expressive-ui/core": "0.1.1",
|
|
38
|
+
"@expressive-ui/schema": "0.1.1",
|
|
39
|
+
"@expressive-ui/tokens": "0.1.1"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"react": ">=19",
|
package/src/Pickers.tsx
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { Fragment, useEffect, useRef, type ReactNode } from 'react';
|
|
2
|
+
import { Keyboard, Pressable, ScrollView, StyleSheet, TextInput, useWindowDimensions, View, type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import Svg, { Circle, Line, Path, Rect } from 'react-native-svg';
|
|
4
|
+
import {
|
|
5
|
+
resolveTimePickerLayout, calendarDays, dateInputPattern, dateKey, dialValueAt, padTime, parseDate, pickerLabels, pickerYears,
|
|
6
|
+
useDatePickerState, useDateRangePickerState, useTimePickerState, type DatePickerOptions, type DateRangePickerOptions, type TimePickerOptions,
|
|
7
|
+
} from '@expressive-ui/core';
|
|
8
|
+
import { Dialog } from './Dialogs.js';
|
|
9
|
+
import { Button } from './Button.js';
|
|
10
|
+
import { TextField } from './Fields.js';
|
|
11
|
+
import { Icon, T } from './primitives.js';
|
|
12
|
+
import { useExpressiveTheme } from './theme.js';
|
|
13
|
+
|
|
14
|
+
function PickerIcon({ name, label, onPress, disabled }: { name: string; label: string; onPress: () => void; disabled?: boolean }) {
|
|
15
|
+
const { colors } = useExpressiveTheme();
|
|
16
|
+
return <Pressable accessibilityRole="button" accessibilityLabel={label} accessibilityState={{ disabled }} disabled={disabled} onPress={onPress} style={({ pressed }) => [styles.icon, { opacity: disabled ? .38 : 1, backgroundColor: pressed ? colors.surfaceContainerHighest : undefined }]}><Icon name={name} color="onSurfaceVariant" /></Pressable>;
|
|
17
|
+
}
|
|
18
|
+
function PickerActions({ cancel, confirm, onClose, onConfirm, valid, toggle }: { cancel: string; confirm: string; onClose: () => void; onConfirm: () => void; valid: boolean; toggle?: ReactNode }) {
|
|
19
|
+
return <View style={styles.actions}>{toggle}<View style={{ flex: 1 }} /><Button variant="text" action={{ id: 'cancel', label: cancel }} onPress={onClose} /><Button variant="text" action={{ id: 'confirm', label: confirm }} disabled={!valid} onPress={onConfirm} /></View>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function TimeModeToggle({ input, label, onPress }: { input: boolean; label: string; onPress: () => void }) {
|
|
23
|
+
const { colors } = useExpressiveTheme();
|
|
24
|
+
return <Pressable accessibilityRole="button" accessibilityLabel={label} accessibilityState={{ selected: input }} onPress={() => { if (input) Keyboard.dismiss(); onPress(); }} style={({ pressed }) => ({ width: 48, height: 48, borderRadius: 24, alignItems: 'center', justifyContent: 'center', backgroundColor: pressed ? colors.surfaceContainerHighest : undefined })}>
|
|
25
|
+
<Svg width={24} height={24} viewBox="0 0 24 24" fill="none" stroke={colors.onSurfaceVariant} strokeWidth={1.8} strokeLinecap="round" strokeLinejoin="round" accessible={false}>
|
|
26
|
+
{input ? <><Circle cx={12} cy={12} r={9} /><Path d="M12 7v5l3 2" /></> : <><Rect x={2} y={5} width={20} height={14} rx={2} /><Path d="M5 9h1m3 0h1m3 0h1m3 0h1M5 12h1m3 0h1m3 0h1m3 0h1M7 15h10" /></>}
|
|
27
|
+
</Svg>
|
|
28
|
+
</Pressable>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type DatePickerProps = DatePickerOptions & { style?: StyleProp<ViewStyle> };
|
|
32
|
+
export type DateRangePickerProps = DateRangePickerOptions & { style?: StyleProp<ViewStyle> };
|
|
33
|
+
export type { DateRange } from '@expressive-ui/core';
|
|
34
|
+
export function DatePicker(props: DatePickerProps) {
|
|
35
|
+
const { locale: themeLocale } = useExpressiveTheme();
|
|
36
|
+
const locale = props.locale ?? themeLocale;
|
|
37
|
+
const state = useDatePickerState({ ...props, locale });
|
|
38
|
+
return <DatePickerSurface {...props} locale={locale} state={state} />;
|
|
39
|
+
}
|
|
40
|
+
export function DateRangePicker(props: DateRangePickerProps) {
|
|
41
|
+
const { locale: themeLocale } = useExpressiveTheme();
|
|
42
|
+
const locale = props.locale ?? themeLocale;
|
|
43
|
+
const range = useDateRangePickerState({ ...props, locale });
|
|
44
|
+
return <DatePickerSurface {...props} locale={locale} state={range} range={range} />;
|
|
45
|
+
}
|
|
46
|
+
type DatePickerSurfaceProps = Omit<DatePickerProps, 'value' | 'onConfirm'> & {
|
|
47
|
+
locale: string;
|
|
48
|
+
state: ReturnType<typeof useDatePickerState>;
|
|
49
|
+
range?: ReturnType<typeof useDateRangePickerState>;
|
|
50
|
+
startLabel?: string;
|
|
51
|
+
endLabel?: string;
|
|
52
|
+
};
|
|
53
|
+
function DatePickerSurface(props: DatePickerSurfaceProps) {
|
|
54
|
+
const { colors } = useExpressiveTheme();
|
|
55
|
+
const { open, onClose, title, fieldLabel, cancelLabel, confirmLabel, min, max, style, locale, state, range, startLabel, endLabel } = props;
|
|
56
|
+
const labels = pickerLabels(locale);
|
|
57
|
+
const rangeEnd = range?.range.end ?? '';
|
|
58
|
+
const shortDate = (date: string) => parseDate(date)?.toLocaleDateString(locale, { month: 'short', day: 'numeric' });
|
|
59
|
+
const list = useRef<ScrollView>(null);
|
|
60
|
+
const years = pickerYears(state.month, min, max);
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
const index = state.view === 'months' ? state.month.getMonth() : years.indexOf(state.month.getFullYear());
|
|
63
|
+
if (state.view !== 'days') list.current?.scrollTo({ y: Math.max(0, index * 48 - 96), animated: false });
|
|
64
|
+
}, [state.view]);
|
|
65
|
+
const monthName = (m: number, long = false) => new Date(2024, m, 1).toLocaleDateString(locale, { month: long ? 'long' : 'short' });
|
|
66
|
+
const menu = (view: 'months' | 'years', label: string, text: string) => <Pressable accessibilityRole="button" accessibilityLabel={label} accessibilityState={{ expanded: state.view === view, disabled: state.view !== 'days' && state.view !== view }} disabled={state.view !== 'days' && state.view !== view} onPress={() => state.setView(state.view === view ? 'days' : view)} style={[styles.menuTrigger, { opacity: state.view !== 'days' && state.view !== view ? .38 : 1 }]}><T variant="labelLarge" color={state.view === view ? 'primary' : 'onSurfaceVariant'}>{text}</T><Icon name="arrow_drop_down" size={18} /></Pressable>;
|
|
67
|
+
return <Dialog open={open} onClose={onClose} style={[{ maxWidth: 360, borderRadius: 28 }, style]}>
|
|
68
|
+
<View style={{ gap: 16 }}>
|
|
69
|
+
<T variant="labelLarge" color="onSurfaceVariant">{title ?? (range ? labels.range : labels.date)}</T>
|
|
70
|
+
<View style={[styles.headline, { borderBottomColor: colors.outlineVariant, borderBottomWidth: 1, paddingBottom: 12 }]}><T variant={range ? "headlineSmall" : "headlineLarge"} style={{ flex: 1 }}>{range ? `${shortDate(range.range.start) ?? labels.start} – ${shortDate(range.range.end) ?? labels.end}` : parseDate(state.draft)?.toLocaleDateString(locale, { weekday: 'short', month: 'short', day: 'numeric' }) ?? '—'}</T><PickerIcon name={state.mode === 'calendar' ? 'edit' : 'calendar_today'} label={state.mode === 'calendar' ? labels.input : labels.calendar} onPress={() => { state.setMode(state.mode === 'calendar' ? 'input' : 'calendar'); state.setView('days'); }} /></View>
|
|
71
|
+
{state.mode === 'input' ? range ? <View style={{ gap: 16 }}>{(['start', 'end'] as const).map(part => <TextField key={part} variant="outlined" label={part === 'start' ? startLabel ?? labels.start : endLabel ?? labels.end} value={part === 'start' ? range.startText : range.endText} onChange={text => range.editPart(text, part)} keyboardType="numbers-and-punctuation" placeholder={dateInputPattern(locale)} supportingText={dateInputPattern(locale)} error={(part === 'start' ? range.startText : range.endText) && (!range.available(range.range[part]) || !!(range.range.start && range.range.end && !range.valid)) ? labels.rangeInvalid : undefined} />)}</View> : <TextField variant="outlined" label={fieldLabel ?? labels.dateField} value={state.text} onChange={state.edit} keyboardType="numbers-and-punctuation" placeholder={dateInputPattern(locale)} supportingText={dateInputPattern(locale)} error={state.text && !state.valid ? labels.invalid : undefined} /> : <View>
|
|
72
|
+
<View style={styles.navigation}>
|
|
73
|
+
<View style={styles.navGroup}><PickerIcon name="chevron_left" label={labels.previous} disabled={state.view === 'years' || !state.canNavigate(-1)} onPress={() => state.navigate(-1)} />{menu('months', labels.month, monthName(state.month.getMonth()))}<PickerIcon name="chevron_right" label={labels.next} disabled={state.view === 'years' || !state.canNavigate(1)} onPress={() => state.navigate(1)} /></View>
|
|
74
|
+
<View style={styles.navGroup}><PickerIcon name="chevron_left" label={labels.previousYear} disabled={state.view === 'months' || !state.canNavigate(-12)} onPress={() => state.navigate(-12)} />{menu('years', labels.year, String(state.month.getFullYear()))}<PickerIcon name="chevron_right" label={labels.nextYear} disabled={state.view === 'months' || !state.canNavigate(12)} onPress={() => state.navigate(12)} /></View>
|
|
75
|
+
</View>
|
|
76
|
+
{state.view === 'days' ? <View style={styles.calendar}>
|
|
77
|
+
{Array.from({ length: 7 }, (_, i) => <View key={i} style={styles.day}><T variant="labelSmall" color="onSurfaceVariant">{new Date(2024, 0, 7 + i).toLocaleDateString(locale, { weekday: 'narrow' })}</T></View>)}
|
|
78
|
+
{calendarDays(state.month).map(date => {
|
|
79
|
+
const start = !!range && date === range.range.start, end = !!range && date === range.range.end;
|
|
80
|
+
const selected = range ? start || end : state.draft === date, today = dateKey(new Date()) === date, enabled = state.available(date);
|
|
81
|
+
const inRange = !!(range?.range.start && rangeEnd && date >= range.range.start && date <= rangeEnd);
|
|
82
|
+
return <Pressable key={date} accessibilityRole="button" accessibilityLabel={`${parseDate(date)!.toLocaleDateString(locale, { dateStyle: 'full' })}${start ? `, ${startLabel ?? labels.start}` : ''}${end ? `, ${endLabel ?? labels.end}` : ''}`}
|
|
83
|
+
accessibilityHint={range ? labels.rangeHelp : undefined} accessibilityState={{ selected, disabled: !enabled }} disabled={!enabled} onPress={() => state.select(date)} style={[styles.day, { opacity: !enabled ? .38 : selected || inRange ? 1 : parseDate(date)!.getMonth() !== state.month.getMonth() ? .38 : 1 }]}>{inRange && !(start && end) ? <View pointerEvents="none" style={{ position: 'absolute', top: 5, bottom: 5, left: start ? '50%' : 0, right: end ? '50%' : 0, backgroundColor: colors.secondaryContainer }} /> : null}<View style={{ width: 34, height: 34, borderRadius: 17, alignItems: 'center', justifyContent: 'center', backgroundColor: selected ? colors.primary : undefined, borderWidth: today ? 1 : 0, borderColor: colors.primary }}><T color={selected ? 'onPrimary' : today ? 'primary' : inRange ? 'onSecondaryContainer' : 'onSurface'}>{parseDate(date)!.getDate()}</T></View></Pressable>;
|
|
84
|
+
})}
|
|
85
|
+
</View> : <ScrollView ref={list} style={{ height: 308, borderTopWidth: 1, borderColor: colors.outlineVariant }} nestedScrollEnabled>
|
|
86
|
+
{(state.view === 'months' ? Array.from({ length: 12 }, (_, i) => i) : years).map(n => {
|
|
87
|
+
const selected = n === (state.view === 'months' ? state.month.getMonth() : state.month.getFullYear());
|
|
88
|
+
const start = new Date(state.month); start.setDate(1); state.view === 'months' ? start.setMonth(n) : start.setFullYear(n, 0, 1);
|
|
89
|
+
const end = new Date(start); state.view === 'months' ? end.setMonth(end.getMonth() + 1, 0) : end.setFullYear(n + 1, 0, 0);
|
|
90
|
+
const disabled = !!((min && dateKey(end) < min) || (max && dateKey(start) > max));
|
|
91
|
+
return <Pressable key={n} accessibilityRole="button" accessibilityState={{ selected, disabled }} disabled={disabled} onPress={() => state.view === 'months' ? state.chooseMonth(n) : state.chooseYear(n)} style={{ minHeight: 48, paddingHorizontal: 16, flexDirection: 'row', alignItems: 'center', gap: 16, opacity: disabled ? .38 : 1, backgroundColor: selected ? colors.secondaryContainer : undefined }}><View style={{ width: 20 }}>{selected ? <Icon name="check" size={20} color="onSecondaryContainer" /> : null}</View><T color={selected ? 'onSecondaryContainer' : 'onSurface'}>{state.view === 'months' ? monthName(n, true) : n}</T></Pressable>;
|
|
92
|
+
})}
|
|
93
|
+
</ScrollView>}
|
|
94
|
+
</View>}
|
|
95
|
+
{range ? <T variant="bodySmall" color="onSurfaceVariant" accessibilityLiveRegion="polite">{range.range.start && !range.range.end ? labels.end : range.range.end && !range.valid ? labels.rangeInvalid : labels.rangeHelp}</T> : null}
|
|
96
|
+
<PickerActions cancel={cancelLabel ?? labels.cancel} confirm={confirmLabel ?? labels.confirm} onClose={onClose} onConfirm={state.confirm} valid={state.valid} />
|
|
97
|
+
</View>
|
|
98
|
+
</Dialog>;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export type TimePickerProps = TimePickerOptions & { style?: StyleProp<ViewStyle> };
|
|
102
|
+
export function TimePicker(props: TimePickerProps) {
|
|
103
|
+
const { locale, colors } = useExpressiveTheme();
|
|
104
|
+
const { open, onClose, title, cancelLabel, confirmLabel, format = '24h', layout = 'auto', style } = props;
|
|
105
|
+
const labels = pickerLabels(props.locale ?? locale), state = useTimePickerState(props);
|
|
106
|
+
const hourInput = useRef<TextInput>(null), minuteInput = useRef<TextInput>(null);
|
|
107
|
+
const { width, height } = useWindowDimensions();
|
|
108
|
+
const inputMode = state.mode === 'input';
|
|
109
|
+
const horizontal = resolveTimePickerLayout(layout, width, height, state.mode) === 'horizontal';
|
|
110
|
+
const size = horizontal ? Math.min(256, (Math.min(560, width - 48) - 72) * 1.1 / 2.1) : Math.min(256, width - 96), scale = size / 256, center = size / 2;
|
|
111
|
+
useEffect(() => { if (open && inputMode) (state.part === 'hour' ? hourInput : minuteInput).current?.focus(); }, [inputMode, open]);
|
|
112
|
+
const angle = (state.part === 'minute' ? state.minute / 60 : state.h24 % 12 / 12) * Math.PI * 2;
|
|
113
|
+
const radius = (state.h24 >= 12 && format === '24h' && state.part === 'hour' ? 65 : 100) * scale;
|
|
114
|
+
const selected = state.part === 'hour' ? state.hour : state.minute;
|
|
115
|
+
const periodSelector = format === '12h' ? <View style={{ borderWidth: 1, borderColor: colors.outline, borderRadius: 8, overflow: 'hidden', flexDirection: horizontal ? 'row' : 'column', width: horizontal ? '100%' : 52 }}>{['AM', 'PM'].map((period, i) => <Pressable key={period} accessibilityRole="button" accessibilityState={{ selected: state.period === i }} onPress={() => state.setPeriod(i)} style={{ minWidth: 46, flex: horizontal ? 1 : undefined, height: 39, alignItems: 'center', justifyContent: 'center', borderTopWidth: horizontal ? 0 : i, borderLeftWidth: horizontal ? i : 0, borderColor: colors.outline, backgroundColor: state.period === i ? colors.tertiaryContainer : undefined }}><T color={state.period === i ? 'onTertiaryContainer' : 'onSurfaceVariant'}>{period}</T></Pressable>)}</View> : null;
|
|
116
|
+
return <Dialog open={open} onClose={onClose} style={[{ maxWidth: horizontal ? 560 : 360, borderRadius: 28 }, style]}>
|
|
117
|
+
<View style={{ gap: 24 }}>
|
|
118
|
+
<T variant="labelLarge" color="onSurfaceVariant">{title ?? (inputMode ? labels.enterTime : labels.time)}</T>
|
|
119
|
+
<View style={{ flexDirection: horizontal ? 'row' : 'column', gap: 24, alignItems: 'center' }}><View style={{ flex: horizontal ? 1 : undefined, width: horizontal ? undefined : '100%' }}><View style={{ gap: 16, width: '100%', maxWidth: format === '12h' && !horizontal ? 284 : 256, alignSelf: 'center' }}><View style={[styles.time, { gap: format === '12h' ? 8 : 4 }]}>
|
|
120
|
+
{(['hour', 'minute'] as const).map((part, i) => <Fragment key={part}>{i ? <T accessible={false} style={{ width: 16, height: 80, fontSize: 56, lineHeight: 80, textAlign: 'center' }}>:</T> : null}<View style={{ gap: 7, flex: 1, minWidth: 0 }}>
|
|
121
|
+
{inputMode ? <TextInput ref={part === 'hour' ? hourInput : minuteInput} accessibilityLabel={labels[part]} keyboardType="number-pad" selectTextOnFocus maxLength={2} value={part === 'hour' ? state.hourText : state.minuteText} onFocus={() => state.setPart(part)} onBlur={() => state.normalize(part)} onChangeText={text => state.edit(text, part)} onSubmitEditing={() => part === 'hour' ? minuteInput.current?.focus() : state.confirm()} style={{ width: '100%', height: 80, fontSize: 56, textAlign: 'center', borderRadius: 8, borderWidth: 2, borderColor: !(part === 'hour' ? state.hourValid : state.minuteValid) ? colors.error : state.part === part ? colors.primary : 'transparent', color: state.part === part ? colors.onPrimaryContainer : colors.onSurface, backgroundColor: state.part === part ? colors.primaryContainer : colors.surfaceContainerHighest }} /> : <Pressable accessibilityRole="button" accessibilityLabel={labels[part]} accessibilityState={{ selected: state.part === part }} onPress={() => state.setPart(part)} onLongPress={() => { state.setPart(part); state.setMode('input'); }} style={{ width: '100%', height: 80, justifyContent: 'center', alignItems: 'center', borderRadius: 8, backgroundColor: state.part === part ? colors.primaryContainer : colors.surfaceContainerHighest }}><T style={{ fontSize: 56, lineHeight: 68 }} color={state.part === part ? 'onPrimaryContainer' : 'onSurface'}>{padTime(part === 'hour' ? state.hour : state.minute)}</T></Pressable>}
|
|
122
|
+
{inputMode ? <T variant="labelSmall" color="onSurfaceVariant">{labels[part]}</T> : null}
|
|
123
|
+
</View></Fragment>)}
|
|
124
|
+
{!horizontal ? periodSelector : null}
|
|
125
|
+
</View>{horizontal ? periodSelector : null}</View>
|
|
126
|
+
{inputMode && !state.valid ? <T color="error" accessibilityRole="alert">{labels.invalid}</T> : null}</View>
|
|
127
|
+
{!inputMode ? <View accessibilityLabel={labels[state.part]} style={{ width: size, height: size, alignSelf: 'center', borderRadius: center, backgroundColor: colors.surfaceContainerHighest }}>
|
|
128
|
+
<View style={StyleSheet.absoluteFill} onStartShouldSetResponder={() => true} onMoveShouldSetResponder={() => true} onResponderGrant={event => state.select(dialValueAt(event.nativeEvent.locationX, event.nativeEvent.locationY, size, state.part, format))} onResponderMove={event => state.select(dialValueAt(event.nativeEvent.locationX, event.nativeEvent.locationY, size, state.part, format))} onResponderRelease={() => { if (state.part === 'hour') state.setPart('minute'); }} />
|
|
129
|
+
<Svg width={size} height={size} style={StyleSheet.absoluteFill} pointerEvents="none"><Line x1={center} y1={center} x2={center + Math.sin(angle) * radius} y2={center - Math.cos(angle) * radius} stroke={colors.primary} strokeWidth={2} /><Circle cx={center} cy={center} r={4} fill={colors.primary} /><Circle cx={center + Math.sin(angle) * radius} cy={center - Math.cos(angle) * radius} r={20 * scale} fill={colors.primary} /></Svg>
|
|
130
|
+
{Array.from({ length: state.part === 'hour' && format === '24h' ? 24 : 12 }, (_, i) => {
|
|
131
|
+
const n = state.part === 'minute' ? i * 5 : format === '12h' ? i || 12 : i;
|
|
132
|
+
const a = i % 12 / 12 * Math.PI * 2, r = (i >= 12 ? 65 : 100) * scale;
|
|
133
|
+
return <Pressable key={n} accessibilityRole="button" accessibilityLabel={`${labels[state.part]} ${n}`} accessibilityState={{ selected: selected === n }} onPress={() => { state.select(n); if (state.part === 'hour') state.setPart('minute'); }} style={{ position: 'absolute', left: center - 20 * scale + Math.sin(a) * r, top: center - 20 * scale - Math.cos(a) * r, width: 40 * scale, height: 40 * scale, borderRadius: 20, alignItems: 'center', justifyContent: 'center' }}><T variant={i >= 12 ? 'labelSmall' : 'bodyLarge'} color={selected === n ? 'onPrimary' : 'onSurface'}>{state.part === 'minute' || format === '24h' && n === 0 ? padTime(n) : n}</T></Pressable>;
|
|
134
|
+
})}
|
|
135
|
+
</View> : null}
|
|
136
|
+
</View>
|
|
137
|
+
<PickerActions cancel={cancelLabel ?? labels.cancel} confirm={confirmLabel ?? labels.confirm} onClose={onClose} onConfirm={state.confirm} valid={state.valid} toggle={<TimeModeToggle input={inputMode} label={inputMode ? labels.dial : labels.input} onPress={state.toggle} />} />
|
|
138
|
+
</View>
|
|
139
|
+
</Dialog>;
|
|
140
|
+
}
|
|
141
|
+
const styles = StyleSheet.create({
|
|
142
|
+
icon: { width: 28, minHeight: 48, borderRadius: 24, alignItems: 'center', justifyContent: 'center' },
|
|
143
|
+
actions: { flexDirection: 'row', alignItems: 'center', gap: 8 },
|
|
144
|
+
headline: { flexDirection: 'row', alignItems: 'center', gap: 8 },
|
|
145
|
+
navigation: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', minHeight: 48 },
|
|
146
|
+
navGroup: { flexDirection: 'row', alignItems: 'center', flexShrink: 1 },
|
|
147
|
+
menuTrigger: { flexDirection: 'row', alignItems: 'center', gap: 2, minHeight: 48 },
|
|
148
|
+
calendar: { flexDirection: 'row', flexWrap: 'wrap' },
|
|
149
|
+
day: { width: '14.285714%', height: 44, alignItems: 'center', justifyContent: 'center' },
|
|
150
|
+
time: { flexDirection: 'row', gap: 8, justifyContent: 'center', alignItems: 'flex-start' },
|
|
151
|
+
});
|
package/src/index.ts
CHANGED