@sincpro/mobile-ui 0.7.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +575 -230
- package/dist/Actions/Actions.Button.d.ts +98 -93
- package/dist/Actions/Actions.Button.js +58 -52
- package/dist/Actions/Actions.FAB.d.ts +3 -1
- package/dist/Actions/Actions.FAB.js +12 -8
- package/dist/Actions/Actions.FilterButton.d.ts +10 -2
- package/dist/Actions/Actions.FilterButton.js +23 -8
- package/dist/Actions/Actions.IconButton.d.ts +36 -33
- package/dist/Actions/Actions.IconButton.js +10 -6
- package/dist/Actions/index.d.ts +12 -12
- package/dist/Actions/index.js +6 -6
- package/dist/Dialog/BottomSheet/BottomSheet.Root.js +1 -1
- package/dist/Dialog/BottomSheet/index.d.ts +1 -1
- package/dist/Dialog/BottomSheet/index.js +1 -1
- package/dist/Dialog/Confirmation.context.js +3 -3
- package/dist/Dialog/Dialog.ActionSheet.d.ts +2 -1
- package/dist/Dialog/Dialog.ActionSheet.js +19 -9
- package/dist/Dialog/Dialog.Confirmation.js +7 -7
- package/dist/Dialog/Dialog.EditValue.js +4 -4
- package/dist/Dialog/Dialog.NativeSheet.d.ts +10 -0
- package/dist/Dialog/Dialog.NativeSheet.js +21 -0
- package/dist/Dialog/Dialog.Sheet.d.ts +5 -1
- package/dist/Dialog/Dialog.Sheet.js +19 -11
- package/dist/Dialog/index.d.ts +5 -5
- package/dist/Dialog/index.js +5 -5
- package/dist/Display/Display.Accordion.js +5 -5
- package/dist/Display/Display.Avatar.d.ts +30 -30
- package/dist/Display/Display.Avatar.js +2 -2
- package/dist/Display/Display.AvatarGroup.js +3 -3
- package/dist/Display/Display.Badge.d.ts +3 -3
- package/dist/Display/Display.Badge.js +1 -1
- package/dist/Display/Display.Card.d.ts +15 -15
- package/dist/Display/Display.Card.js +4 -4
- package/dist/Display/Display.Carousel.js +2 -2
- package/dist/Display/Display.Chip.d.ts +3 -3
- package/dist/Display/Display.Chip.js +12 -12
- package/dist/Display/Display.CircleButton.d.ts +1 -1
- package/dist/Display/Display.CircleButton.js +3 -3
- package/dist/Display/Display.CopyableText.d.ts +9 -2
- package/dist/Display/Display.CopyableText.js +76 -8
- package/dist/Display/Display.CountRecords.js +2 -2
- package/dist/Display/Display.DataTable.js +2 -2
- package/dist/Display/Display.Date.d.ts +1 -1
- package/dist/Display/Display.Date.js +5 -5
- package/dist/Display/Display.Divider.d.ts +24 -24
- package/dist/Display/Display.Divider.js +1 -1
- package/dist/Display/Display.GradientSurface.d.ts +58 -39
- package/dist/Display/Display.GradientSurface.js +31 -15
- package/dist/Display/Display.Icon.d.ts +1 -1
- package/dist/Display/Display.Icon.js +2 -1
- package/dist/Display/Display.IconBadge.js +3 -3
- package/dist/Display/Display.Image.js +4 -4
- package/dist/Display/Display.KeyValue.d.ts +11 -4
- package/dist/Display/Display.KeyValue.js +8 -6
- package/dist/Display/Display.ListGroup.d.ts +23 -0
- package/dist/Display/Display.ListGroup.js +17 -0
- package/dist/Display/Display.ListItem.d.ts +16 -2
- package/dist/Display/Display.ListItem.js +29 -12
- package/dist/Display/Display.Logo.d.ts +3 -3
- package/dist/Display/Display.Logo.js +2 -2
- package/dist/Display/Display.MediaCard.js +4 -4
- package/dist/Display/Display.MediaEmbed.js +7 -7
- package/dist/Display/Display.MenuButton.d.ts +4 -4
- package/dist/Display/Display.MenuButton.js +6 -6
- package/dist/Display/Display.MenuCard.d.ts +1 -1
- package/dist/Display/Display.MenuCard.js +3 -3
- package/dist/Display/Display.MenuGrid.d.ts +1 -1
- package/dist/Display/Display.MenuGrid.js +1 -1
- package/dist/Display/Display.Monetary.d.ts +1 -1
- package/dist/Display/Display.Monetary.js +2 -2
- package/dist/Display/Display.Pattern.d.ts +33 -12
- package/dist/Display/Display.Pattern.js +60 -14
- package/dist/Display/Display.PriceTag.js +2 -2
- package/dist/Display/Display.ProductCard.js +7 -7
- package/dist/Display/Display.Rating.js +3 -3
- package/dist/Display/Display.SearchHistory.js +6 -6
- package/dist/Display/Display.SectionHeader.d.ts +11 -1
- package/dist/Display/Display.SectionHeader.js +14 -5
- package/dist/Display/Display.Stat.js +2 -2
- package/dist/Display/Display.StatCard.js +4 -4
- package/dist/Display/Display.StatusDot.js +3 -3
- package/dist/Display/Display.Story.js +3 -3
- package/dist/Display/Display.StoryTray.js +5 -5
- package/dist/Display/Display.StoryViewer.js +4 -4
- package/dist/Display/Display.SwipeableRow.d.ts +3 -1
- package/dist/Display/Display.SwipeableRow.js +7 -7
- package/dist/Display/Display.Tag.js +2 -2
- package/dist/Display/Display.Timeline.js +4 -4
- package/dist/Display/Display.Tooltip.js +3 -3
- package/dist/Display/index.d.ts +49 -45
- package/dist/Display/index.js +44 -42
- package/dist/Feedback/ErrorBoundary.d.ts +1 -1
- package/dist/Feedback/ErrorBoundary.js +1 -1
- package/dist/Feedback/Feedback.Banner.d.ts +3 -3
- package/dist/Feedback/Feedback.Banner.js +6 -6
- package/dist/Feedback/Feedback.DomainSplashScreen.js +5 -4
- package/dist/Feedback/Feedback.Empty.js +3 -3
- package/dist/Feedback/Feedback.EmptyState.d.ts +2 -1
- package/dist/Feedback/Feedback.EmptyState.js +7 -7
- package/dist/Feedback/Feedback.Error.d.ts +3 -1
- package/dist/Feedback/Feedback.Error.js +7 -6
- package/dist/Feedback/Feedback.Loading.d.ts +1 -1
- package/dist/Feedback/Feedback.Loading.js +2 -2
- package/dist/Feedback/Feedback.PermissionCard.js +5 -5
- package/dist/Feedback/Feedback.Progress.js +2 -2
- package/dist/Feedback/Feedback.ProgressCircle.js +1 -1
- package/dist/Feedback/Feedback.Skeleton.js +2 -2
- package/dist/Feedback/Feedback.Spinner.js +3 -3
- package/dist/Feedback/Feedback.Splash.d.ts +1 -1
- package/dist/Feedback/Feedback.Splash.js +7 -6
- package/dist/Feedback/Toast.context.js +7 -7
- package/dist/Feedback/index.d.ts +13 -13
- package/dist/Feedback/index.js +13 -13
- package/dist/Form/Form.Button.d.ts +2 -2
- package/dist/Form/Form.Button.js +1 -1
- package/dist/Form/Form.Checkbox.d.ts +4 -1
- package/dist/Form/Form.Checkbox.js +5 -5
- package/dist/Form/Form.ControlledCheckbox.js +1 -1
- package/dist/Form/Form.ControlledInput.js +1 -1
- package/dist/Form/Form.ControlledMonetaryInput.js +1 -1
- package/dist/Form/Form.ControlledRadioButton.js +1 -1
- package/dist/Form/Form.DatePicker.d.ts +2 -1
- package/dist/Form/Form.DatePicker.js +8 -7
- package/dist/Form/Form.Dropdown.js +7 -7
- package/dist/Form/Form.FAB.d.ts +2 -2
- package/dist/Form/Form.FAB.js +1 -1
- package/dist/Form/Form.FilterButton.d.ts +2 -2
- package/dist/Form/Form.FilterButton.js +1 -1
- package/dist/Form/Form.FractionalQuantityInput.js +4 -4
- package/dist/Form/Form.IconButton.d.ts +2 -2
- package/dist/Form/Form.IconButton.js +1 -1
- package/dist/Form/Form.Input.d.ts +5 -3
- package/dist/Form/Form.Input.js +5 -5
- package/dist/Form/Form.InputField.d.ts +1 -1
- package/dist/Form/Form.InputField.js +3 -3
- package/dist/Form/Form.KeyboardForm.d.ts +11 -0
- package/dist/Form/Form.KeyboardForm.js +9 -0
- package/dist/Form/Form.KeyboardToolbar.d.ts +21 -0
- package/dist/Form/Form.KeyboardToolbar.js +70 -0
- package/dist/Form/Form.MonetaryInput.js +5 -4
- package/dist/Form/Form.PasswordInput.d.ts +1 -1
- package/dist/Form/Form.PasswordInput.js +3 -3
- package/dist/Form/Form.PinInput.js +5 -5
- package/dist/Form/Form.QuantitySelector.js +3 -3
- package/dist/Form/Form.RadioButton.js +4 -4
- package/dist/Form/Form.SearchBar.js +4 -4
- package/dist/Form/Form.Select.d.ts +3 -1
- package/dist/Form/Form.Select.js +27 -14
- package/dist/Form/Form.Slider.js +3 -3
- package/dist/Form/Form.Switch.js +4 -4
- package/dist/Form/Form.TextInput.js +3 -3
- package/dist/Form/index.d.ts +33 -27
- package/dist/Form/index.js +29 -25
- package/dist/Navigation/Navigation.AppBar.d.ts +11 -6
- package/dist/Navigation/Navigation.AppBar.js +16 -16
- package/dist/Navigation/Navigation.BottomNav.d.ts +4 -2
- package/dist/Navigation/Navigation.BottomNav.js +34 -21
- package/dist/Navigation/Navigation.CollapsingHeader.d.ts +1 -1
- package/dist/Navigation/Navigation.CollapsingHeader.js +3 -3
- package/dist/Navigation/Navigation.FloatingBar.js +2 -2
- package/dist/Navigation/Navigation.Header.js +6 -6
- package/dist/Navigation/Navigation.HeaderToolbar.js +5 -5
- package/dist/Navigation/Navigation.Menu.js +6 -6
- package/dist/Navigation/Navigation.MenuSection.js +2 -2
- package/dist/Navigation/Navigation.RowItem.d.ts +2 -2
- package/dist/Navigation/Navigation.RowItem.js +4 -4
- package/dist/Navigation/Navigation.SearchBar.d.ts +6 -1
- package/dist/Navigation/Navigation.SearchBar.js +33 -12
- package/dist/Navigation/Navigation.SearchSuggestions.d.ts +14 -0
- package/dist/Navigation/Navigation.SearchSuggestions.js +7 -0
- package/dist/Navigation/Navigation.SegmentedControl.d.ts +3 -1
- package/dist/Navigation/Navigation.SegmentedControl.js +6 -5
- package/dist/Navigation/Navigation.Steps.js +5 -5
- package/dist/Navigation/Navigation.TabIcon.js +2 -2
- package/dist/Navigation/Navigation.TabItem.js +2 -2
- package/dist/Navigation/Navigation.Tabs.js +5 -5
- package/dist/Navigation/index.d.ts +23 -19
- package/dist/Navigation/index.js +17 -15
- package/dist/Typography/Typography.Heading.d.ts +1 -1
- package/dist/Typography/Typography.Heading.js +2 -2
- package/dist/Typography/Typography.SelectableText.d.ts +10 -0
- package/dist/Typography/Typography.SelectableText.js +16 -0
- package/dist/Typography/Typography.Text.d.ts +2 -2
- package/dist/Typography/Typography.Text.js +5 -19
- package/dist/Typography/index.d.ts +5 -2
- package/dist/Typography/index.js +5 -2
- package/dist/branding.d.ts +22 -0
- package/dist/branding.js +20 -3
- package/dist/icons/AddItemIcon.d.ts +1 -1
- package/dist/icons/ArrangeCircle.d.ts +1 -1
- package/dist/icons/ArrowDownIcon.d.ts +1 -1
- package/dist/icons/ArrowUpIcon.d.ts +1 -1
- package/dist/icons/BoxIcon.d.ts +1 -1
- package/dist/icons/BoxTimeIcon.d.ts +1 -1
- package/dist/icons/CalendarIcon.d.ts +1 -1
- package/dist/icons/CardIcon.d.ts +1 -1
- package/dist/icons/CashierIcon.d.ts +1 -1
- package/dist/icons/DuoIcon.d.ts +1 -1
- package/dist/icons/HomeIcon.d.ts +1 -1
- package/dist/icons/HomeIconOutlined.d.ts +1 -1
- package/dist/icons/LogoIcon.d.ts +1 -1
- package/dist/icons/MoneyReceiveIcon.d.ts +1 -1
- package/dist/icons/PinIcon.d.ts +1 -1
- package/dist/icons/PrinterIcon.d.ts +1 -1
- package/dist/icons/ProfileIcon.d.ts +1 -1
- package/dist/icons/SettingsIcon.d.ts +1 -1
- package/dist/icons/SinpeIcon.d.ts +1 -1
- package/dist/icons/ToggleOffIcon.d.ts +1 -1
- package/dist/icons/WalletMoneyIcon.d.ts +1 -1
- package/dist/index.d.ts +24 -23
- package/dist/index.js +26 -24
- package/dist/layouts/AuthContainer.d.ts +9 -3
- package/dist/layouts/AuthContainer.js +8 -8
- package/dist/layouts/Container.js +1 -1
- package/dist/layouts/GradientContainer.js +1 -1
- package/dist/layouts/ScrollContainer.js +1 -1
- package/dist/layouts/TabNavigatorLayout.js +4 -4
- package/dist/primitives/AspectRatio.js +1 -1
- package/dist/primitives/BaseButton.d.ts +92 -87
- package/dist/primitives/BaseButton.js +52 -54
- package/dist/primitives/Box.js +1 -1
- package/dist/primitives/Pressable.js +1 -1
- package/dist/primitives/Row.js +1 -1
- package/dist/primitives/Stack.js +1 -1
- package/dist/primitives/index.d.ts +6 -6
- package/dist/primitives/index.js +6 -6
- package/dist/theme/active.d.ts +1 -1
- package/dist/theme/active.js +14 -1
- package/dist/theme/build.d.ts +33 -0
- package/dist/theme/build.js +118 -0
- package/dist/theme/color.d.ts +26 -0
- package/dist/theme/color.js +109 -0
- package/dist/theme/components/index.d.ts +1 -1
- package/dist/theme/components/index.js +1 -1
- package/dist/theme/contrast.d.ts +29 -0
- package/dist/theme/contrast.js +57 -0
- package/dist/theme/css-vars.d.ts +3 -1
- package/dist/theme/css-vars.js +29 -3
- package/dist/theme/dark.d.ts +3 -4
- package/dist/theme/dark.js +91 -48
- package/dist/theme/default.d.ts +5 -1
- package/dist/theme/default.js +89 -41
- package/dist/theme/define.d.ts +4 -1
- package/dist/theme/define.js +4 -1
- package/dist/theme/globals.css +61 -46
- package/dist/theme/index.d.ts +14 -10
- package/dist/theme/index.js +13 -9
- package/dist/theme/theme.d.ts +1 -1
- package/dist/theme/theme.js +2 -2
- package/dist/theme/types.d.ts +77 -16
- package/dist/theme/types.js +13 -3
- package/dist/theme/typography.d.ts +19 -4
- package/dist/theme/typography.js +45 -28
- package/dist/theme/useTheme.d.ts +1 -1
- package/dist/theme/useTheme.js +1 -1
- package/dist/theme/validate.d.ts +16 -0
- package/dist/theme/validate.js +200 -0
- package/dist/tokens/index.d.ts +2 -2
- package/dist/tokens/index.js +2 -2
- package/dist/utils/criteria.d.ts +56 -0
- package/dist/utils/criteria.js +99 -0
- package/dist/utils/reorder.d.ts +4 -0
- package/dist/utils/reorder.js +32 -0
- package/dist/views/AppSplashView.d.ts +2 -2
- package/dist/views/AppSplashView.js +3 -3
- package/dist/views/AuthFormView.d.ts +5 -2
- package/dist/views/AuthFormView.js +5 -5
- package/dist/views/FormViewV2.d.ts +9 -4
- package/dist/views/FormViewV2.js +44 -25
- package/dist/views/ListViewV2.d.ts +12 -9
- package/dist/views/ListViewV2.js +49 -36
- package/dist/views/Wizard/Wizard.context.js +1 -1
- package/dist/views/Wizard/Wizard.d.ts +1 -1
- package/dist/views/Wizard/Wizard.js +1 -1
- package/dist/views/Wizard/index.d.ts +4 -4
- package/dist/views/Wizard/index.js +2 -2
- package/dist/views/types/IFormView.d.ts +1 -1
- package/dist/views/types/IListView.d.ts +1 -1
- package/dist/widgets/CircleButton.d.ts +2 -2
- package/dist/widgets/CircleButton.js +1 -1
- package/dist/widgets/CollectionOptions.d.ts +15 -0
- package/dist/widgets/CollectionOptions.js +127 -0
- package/dist/widgets/FilterBar.d.ts +21 -0
- package/dist/widgets/FilterBar.js +14 -0
- package/dist/widgets/FilterBuilder.d.ts +10 -0
- package/dist/widgets/FilterBuilder.js +115 -0
- package/dist/widgets/GeoPermissionCard.js +3 -3
- package/dist/widgets/HomeHeader.js +3 -3
- package/dist/widgets/JSONViewer.js +2 -2
- package/dist/widgets/MenuCard.d.ts +2 -2
- package/dist/widgets/MenuCard.js +1 -1
- package/dist/widgets/MenuGrid.d.ts +3 -3
- package/dist/widgets/MenuGrid.js +1 -1
- package/dist/widgets/MenuSection.d.ts +2 -2
- package/dist/widgets/MenuSection.js +1 -1
- package/dist/widgets/PromoBanner.js +3 -3
- package/dist/widgets/PromoModal.js +3 -3
- package/dist/widgets/QueryChoice.d.ts +10 -0
- package/dist/widgets/QueryChoice.js +13 -0
- package/dist/widgets/QuickActions.js +3 -3
- package/dist/widgets/ReorderableList.d.ts +51 -0
- package/dist/widgets/ReorderableList.js +138 -0
- package/dist/widgets/ScreenHeader.js +2 -2
- package/dist/widgets/TimeZoneSelector.d.ts +1 -1
- package/dist/widgets/TimeZoneSelector.js +4 -4
- package/dist/widgets/TimeZoneSelectorModal.d.ts +1 -1
- package/dist/widgets/TimeZoneSelectorModal.js +5 -5
- package/dist/widgets/index.d.ts +20 -16
- package/dist/widgets/index.js +13 -10
- package/package.json +70 -50
- package/tailwind.preset.js +19 -0
- package/dist/icons/icon_getters.d.ts +0 -6
- package/dist/icons/icon_getters.js +0 -23
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "nativewind/jsx-runtime";
|
|
2
|
+
import Button from "../Actions/Actions.Button.js";
|
|
3
|
+
import DatePicker from "../Form/Form.DatePicker.js";
|
|
4
|
+
import Input from "../Form/Form.Input.js";
|
|
5
|
+
import { Typography } from "../Typography/index.js";
|
|
6
|
+
import { describeCriteria, parseCriteriaDate, replaceCriteria, validateCondition, } from "../utils/criteria.js";
|
|
7
|
+
import QueryChoice from "./QueryChoice.js";
|
|
8
|
+
import { useEffect, useState } from "react";
|
|
9
|
+
import { View } from "react-native";
|
|
10
|
+
export default function FilterBuilder({ fields, value, onChange, onEditingChange, className, testID, }) {
|
|
11
|
+
const [path, setPath] = useState([]);
|
|
12
|
+
const [editing, setEditing] = useState(null);
|
|
13
|
+
const [error, setError] = useState();
|
|
14
|
+
const isEditing = editing !== null;
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
onEditingChange?.(isEditing);
|
|
17
|
+
return () => onEditingChange?.(false);
|
|
18
|
+
}, [isEditing, onEditingChange]);
|
|
19
|
+
let current = value;
|
|
20
|
+
for (const index of path) {
|
|
21
|
+
current = current?.kind === "group" ? current.children[index] : undefined;
|
|
22
|
+
}
|
|
23
|
+
if (current?.kind !== "group")
|
|
24
|
+
return (_jsxs(View, { className: className, testID: testID, children: [_jsx(Typography.Text, { accessibilityLiveRegion: "polite", children: "Este grupo ya no est\u00E1 disponible. La configuraci\u00F3n cambi\u00F3." }), _jsx(Button, { accessibleSizing: true, onPress: () => {
|
|
25
|
+
setPath([]);
|
|
26
|
+
setEditing(null);
|
|
27
|
+
}, title: "Volver a condiciones", variant: "secondary" })] }));
|
|
28
|
+
const group = current;
|
|
29
|
+
const changeGroup = (next) => onChange(replaceCriteria(value, path, next));
|
|
30
|
+
const condition = editing?.condition;
|
|
31
|
+
const field = fields.find((item) => item.id === condition?.field);
|
|
32
|
+
const operator = field?.operators.find((item) => item.id === condition?.operator);
|
|
33
|
+
const changeCondition = (next) => {
|
|
34
|
+
setError(undefined);
|
|
35
|
+
setEditing((current) => (current ? { ...current, condition: next } : null));
|
|
36
|
+
};
|
|
37
|
+
const addCondition = () => {
|
|
38
|
+
const first = fields.find((item) => item.operators.length);
|
|
39
|
+
if (!first)
|
|
40
|
+
throw new Error("No configurable filter fields");
|
|
41
|
+
setError(undefined);
|
|
42
|
+
setEditing({
|
|
43
|
+
index: null,
|
|
44
|
+
condition: {
|
|
45
|
+
kind: "condition",
|
|
46
|
+
field: first.id,
|
|
47
|
+
operator: first.operators[0].id,
|
|
48
|
+
values: [],
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
return (_jsxs(View, { className: className, style: { gap: 16 }, testID: testID, children: [_jsx(Typography.Text, { accessibilityRole: "header", semibold: true, variant: "bodyReadable", children: path.length ? `Grupo ${path.map((index) => index + 1).join(" › ")}` : "Condiciones" }), editing && condition ? (_jsxs(_Fragment, { children: [_jsx(QueryChoice, { label: "Campo", onChange: (id) => {
|
|
53
|
+
const next = fields.find((item) => item.id === id);
|
|
54
|
+
if (!next?.operators.length)
|
|
55
|
+
throw new Error("Field has no operators");
|
|
56
|
+
changeCondition({
|
|
57
|
+
...condition,
|
|
58
|
+
field: id,
|
|
59
|
+
operator: next.operators[0].id,
|
|
60
|
+
values: [],
|
|
61
|
+
});
|
|
62
|
+
}, options: fields
|
|
63
|
+
.filter((item) => item.operators.length)
|
|
64
|
+
.map((item) => ({ label: item.label, value: item.id })), value: condition.field }), _jsx(QueryChoice, { label: "Comparaci\u00F3n", onChange: (id) => changeCondition({ ...condition, operator: id, values: [] }), options: (field?.operators ?? []).map((item) => ({
|
|
65
|
+
label: item.label,
|
|
66
|
+
value: item.id,
|
|
67
|
+
})), value: condition.operator }), Array.from({ length: operator?.arity === "range" ? 2 : operator?.arity === "one" ? 1 : 0 }, (_, index) => {
|
|
68
|
+
const label = operator?.arity === "range" ? (index === 0 ? "Desde" : "Hasta") : "Valor";
|
|
69
|
+
const update = (next) => {
|
|
70
|
+
const values = [...condition.values];
|
|
71
|
+
values[index] = next;
|
|
72
|
+
changeCondition({ ...condition, values });
|
|
73
|
+
};
|
|
74
|
+
return field?.type === "choice" ? (_jsx(QueryChoice, { label: label, onChange: update, options: field.options ?? [], value: condition.values[index] }, index)) : field?.type === "date" ? (_jsx(DatePicker, { accessibleSizing: true, label: label, onChange: (date) => update(`${String(date.getFullYear()).padStart(4, "0")}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`), value: parseCriteriaDate(condition.values[index]) }, index)) : (_jsx(Input, { accessibleSizing: true, keyboardType: field?.type === "number" ? "numbers-and-punctuation" : "default", label: label, onChangeText: update, testID: `criteria-value-${index}`, value: condition.values[index] === undefined ||
|
|
75
|
+
Number.isNaN(condition.values[index])
|
|
76
|
+
? ""
|
|
77
|
+
: String(condition.values[index]) }, index));
|
|
78
|
+
}), error ? (_jsx(Typography.Text, { accessibilityLiveRegion: "polite", className: "text-danger", children: error })) : null, _jsx(Button, { accessibleSizing: true, onPress: () => {
|
|
79
|
+
const next = {
|
|
80
|
+
...condition,
|
|
81
|
+
values: field?.type === "number"
|
|
82
|
+
? Array.from(condition.values, (value) => typeof value === "string" && !value.trim() ? NaN : Number(value))
|
|
83
|
+
: condition.values,
|
|
84
|
+
};
|
|
85
|
+
const problem = validateCondition(next, fields);
|
|
86
|
+
if (problem) {
|
|
87
|
+
setError(problem);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const children = [...group.children];
|
|
91
|
+
if (editing.index === null)
|
|
92
|
+
children.push(next);
|
|
93
|
+
else
|
|
94
|
+
children[editing.index] = next;
|
|
95
|
+
changeGroup({ ...group, children });
|
|
96
|
+
setEditing(null);
|
|
97
|
+
}, title: "Guardar condici\u00F3n" }), _jsx(Button, { accessibleSizing: true, onPress: () => setEditing(null), title: "Cancelar condici\u00F3n", variant: "secondary" })] })) : (_jsxs(_Fragment, { children: [path.length ? (_jsx(Button, { accessibleSizing: true, onPress: () => setPath(path.slice(0, -1)), title: "Volver al grupo anterior", variant: "link" })) : null, _jsx(QueryChoice, { label: "Coinciden", onChange: (join) => changeGroup({ ...group, join }), options: [
|
|
98
|
+
{ label: "Todas las condiciones", value: "all" },
|
|
99
|
+
{ label: "Cualquiera de las condiciones", value: "any" },
|
|
100
|
+
{ label: "Ninguna de las condiciones", value: "none" },
|
|
101
|
+
], value: group.join }), !group.children.length ? (_jsx(Typography.Text, { className: "text-text-secondary", children: "Sin condiciones en este grupo." })) : null, group.children.map((child, index) => (_jsxs(View, { className: "border-b border-border-light pb-3 gap-2", children: [_jsx(Typography.Text, { variant: "bodyReadable", children: describeCriteria(child, fields) }), _jsxs(View, { className: "flex-row flex-wrap gap-2", children: [_jsx(Button, { accessibleSizing: true, onPress: () => child.kind === "group"
|
|
102
|
+
? setPath([...path, index])
|
|
103
|
+
: (setError(undefined), setEditing({ index, condition: child })), title: child.kind === "group"
|
|
104
|
+
? `Abrir grupo ${index + 1}`
|
|
105
|
+
: `Editar condición ${index + 1}`, variant: "secondary" }), _jsx(Button, { accessibleSizing: true, onPress: () => changeGroup({
|
|
106
|
+
...group,
|
|
107
|
+
children: group.children.filter((_, position) => position !== index),
|
|
108
|
+
}), title: `Eliminar ${child.kind === "group" ? "grupo" : "condición"} ${index + 1}`, variant: "link" })] })] }, index))), _jsx(Button, { accessibleSizing: true, disabled: !fields.some((item) => item.operators.length), onPress: addCondition, title: "A\u00F1adir condici\u00F3n", variant: "secondary" }), _jsx(Button, { accessibleSizing: true, onPress: () => {
|
|
109
|
+
changeGroup({
|
|
110
|
+
...group,
|
|
111
|
+
children: [...group.children, { kind: "group", join: "any", children: [] }],
|
|
112
|
+
});
|
|
113
|
+
setPath([...path, group.children.length]);
|
|
114
|
+
}, title: "A\u00F1adir grupo", variant: "secondary" })] }))] }));
|
|
115
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "nativewind/jsx-runtime";
|
|
2
|
-
import { Display, Form } from "../index";
|
|
3
|
-
import { theme } from "../theme";
|
|
4
|
-
import { Typography } from "../Typography";
|
|
2
|
+
import { Display, Form } from "../index.js";
|
|
3
|
+
import { theme } from "../theme/index.js";
|
|
4
|
+
import { Typography } from "../Typography/index.js";
|
|
5
5
|
import { View } from "react-native";
|
|
6
6
|
import { tv } from "tailwind-variants";
|
|
7
7
|
const statusTextVariants = tv({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "nativewind/jsx-runtime";
|
|
2
|
-
import { Display, Typography } from "../index";
|
|
3
|
-
import GradientContainer from "../layouts/GradientContainer";
|
|
4
|
-
import { theme } from "../theme";
|
|
2
|
+
import { Display, Typography } from "../index.js";
|
|
3
|
+
import GradientContainer from "../layouts/GradientContainer.js";
|
|
4
|
+
import { theme } from "../theme/index.js";
|
|
5
5
|
import { TouchableOpacity, View } from "react-native";
|
|
6
6
|
/**
|
|
7
7
|
* @deprecated Legacy style (gradient). For new top bars use `Navigation.AppBar`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "nativewind/jsx-runtime";
|
|
2
|
-
import { ThemedActivityIndicator } from "../theme";
|
|
3
|
-
import { fontFamilies } from "../theme/typography";
|
|
2
|
+
import { ThemedActivityIndicator } from "../theme/index.js";
|
|
3
|
+
import { fontFamilies } from "../theme/typography.js";
|
|
4
4
|
import { useEffect, useMemo, useState } from "react";
|
|
5
5
|
import { Text, View } from "react-native";
|
|
6
6
|
const parseDeepJson = (value) => {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** @deprecated Import from `@sincpro/mobile-ui/Display` → `Display.MenuCard` instead. */
|
|
2
|
-
export type { MenuCardProps } from "../Display/Display.MenuCard";
|
|
3
|
-
export { MenuCard } from "../Display/Display.MenuCard";
|
|
2
|
+
export type { MenuCardProps } from "../Display/Display.MenuCard.js";
|
|
3
|
+
export { MenuCard } from "../Display/Display.MenuCard.js";
|
package/dist/widgets/MenuCard.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { MenuCard } from "../Display/Display.MenuCard";
|
|
1
|
+
export { MenuCard } from "../Display/Display.MenuCard.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @deprecated Import from `@sincpro/mobile-ui/Display` → `Display.MenuGrid` instead. */
|
|
2
|
-
export type { MenuGridItem, MenuGridProps, } from "../Display/Display.MenuGrid";
|
|
3
|
-
export { MenuGrid } from "../Display/Display.MenuGrid";
|
|
2
|
+
export type { MenuGridItem, MenuGridProps, } from "../Display/Display.MenuGrid.js";
|
|
3
|
+
export { MenuGrid } from "../Display/Display.MenuGrid.js";
|
|
4
4
|
/** @deprecated Renamed to `MenuGridItem`. */
|
|
5
|
-
export type { MenuGridItem as MenuItem } from "../Display/Display.MenuGrid";
|
|
5
|
+
export type { MenuGridItem as MenuItem } from "../Display/Display.MenuGrid.js";
|
package/dist/widgets/MenuGrid.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { MenuGrid } from "../Display/Display.MenuGrid";
|
|
1
|
+
export { MenuGrid } from "../Display/Display.MenuGrid.js";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** @deprecated Import from `@sincpro/mobile-ui/Navigation` → `Navigation.MenuSection` instead. */
|
|
2
|
-
export type { MenuSectionProps } from "../Navigation/Navigation.MenuSection";
|
|
3
|
-
export { MenuSection } from "../Navigation/Navigation.MenuSection";
|
|
2
|
+
export type { MenuSectionProps } from "../Navigation/Navigation.MenuSection.js";
|
|
3
|
+
export { MenuSection } from "../Navigation/Navigation.MenuSection.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { MenuSection } from "../Navigation/Navigation.MenuSection";
|
|
1
|
+
export { MenuSection } from "../Navigation/Navigation.MenuSection.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "nativewind/jsx-runtime";
|
|
2
|
-
import GradientSurface from "../Display/Display.GradientSurface";
|
|
3
|
-
import { useTheme } from "../theme";
|
|
4
|
-
import { Typography } from "../Typography";
|
|
2
|
+
import GradientSurface from "../Display/Display.GradientSurface.js";
|
|
3
|
+
import { useTheme } from "../theme/index.js";
|
|
4
|
+
import { Typography } from "../Typography/index.js";
|
|
5
5
|
import { ScrollView, TouchableOpacity, View } from "react-native";
|
|
6
6
|
function BannerCard({ item }) {
|
|
7
7
|
const theme = useTheme();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "nativewind/jsx-runtime";
|
|
2
|
-
import GradientSurface from "../Display/Display.GradientSurface";
|
|
3
|
-
import { useTheme } from "../theme";
|
|
4
|
-
import { Typography } from "../Typography";
|
|
2
|
+
import GradientSurface from "../Display/Display.GradientSurface.js";
|
|
3
|
+
import { useTheme } from "../theme/index.js";
|
|
4
|
+
import { Typography } from "../Typography/index.js";
|
|
5
5
|
import { Modal, TouchableOpacity, TouchableWithoutFeedback, View } from "react-native";
|
|
6
6
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
7
7
|
/**
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface QueryChoiceProps<T extends string | number | boolean> {
|
|
2
|
+
label: string;
|
|
3
|
+
value: T | undefined;
|
|
4
|
+
options: readonly {
|
|
5
|
+
label: string;
|
|
6
|
+
value: T;
|
|
7
|
+
}[];
|
|
8
|
+
onChange: (value: T) => void;
|
|
9
|
+
}
|
|
10
|
+
export default function QueryChoice<T extends string | number | boolean>({ label, value, options, onChange, }: QueryChoiceProps<T>): import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "nativewind/jsx-runtime";
|
|
2
|
+
import Pressable from "../primitives/Pressable.js";
|
|
3
|
+
import { Typography } from "../Typography/index.js";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { View } from "react-native";
|
|
6
|
+
export default function QueryChoice({ label, value, options, onChange, }) {
|
|
7
|
+
const [open, setOpen] = useState(false);
|
|
8
|
+
const selected = options.find((option) => option.value === value);
|
|
9
|
+
return (_jsxs(View, { className: "gap-1", children: [_jsxs(Pressable, { accessibilityLabel: `${label}: ${selected?.label ?? "Seleccionar"}`, accessibilityState: { expanded: open }, className: "rounded-lg border border-input px-3 py-2", onPress: () => setOpen(!open), style: { minHeight: 48, justifyContent: "center" }, children: [_jsx(Typography.Text, { className: "text-text-secondary", variant: "bodySmall", children: label }), _jsxs(Typography.Text, { variant: "bodyReadable", children: [selected?.label ?? "Seleccionar", " ", open ? "−" : "+"] })] }), open ? (_jsx(View, { accessibilityRole: "radiogroup", className: "border-l border-border-default pl-3", children: options.map((option) => (_jsx(Pressable, { accessibilityLabel: option.label, accessibilityRole: "radio", accessibilityState: { checked: option.value === value }, onPress: () => {
|
|
10
|
+
onChange(option.value);
|
|
11
|
+
setOpen(false);
|
|
12
|
+
}, style: { minHeight: 48, justifyContent: "center" }, children: _jsxs(Typography.Text, { className: option.value === value ? "text-text-accent" : "text-text-primary", variant: "bodyReadable", children: [option.value === value ? "✓ " : "", option.label] }) }, String(option.value)))) })) : null] }));
|
|
13
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "nativewind/jsx-runtime";
|
|
2
|
-
import Icon from "../Display/Display.Icon";
|
|
3
|
-
import { useTheme } from "../theme";
|
|
4
|
-
import { Typography } from "../Typography";
|
|
2
|
+
import Icon from "../Display/Display.Icon.js";
|
|
3
|
+
import { useTheme } from "../theme/index.js";
|
|
4
|
+
import { Typography } from "../Typography/index.js";
|
|
5
5
|
import { ScrollView, TouchableOpacity, View } from "react-native";
|
|
6
6
|
/**
|
|
7
7
|
* Horizontal scrollable row of small icon+label shortcuts ("Acciones Rápidas").
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type StyleProp, type ViewStyle } from "react-native";
|
|
3
|
+
import { type SortableGridProps } from "react-native-sortables";
|
|
4
|
+
export interface ReorderEvent {
|
|
5
|
+
key: string;
|
|
6
|
+
fromIndex: number;
|
|
7
|
+
toIndex: number;
|
|
8
|
+
source: "drag" | "button";
|
|
9
|
+
}
|
|
10
|
+
export interface ReorderItemContext<T> {
|
|
11
|
+
item: T;
|
|
12
|
+
index: number;
|
|
13
|
+
canMoveUp: boolean;
|
|
14
|
+
canMoveDown: boolean;
|
|
15
|
+
moveUp: () => void;
|
|
16
|
+
moveDown: () => void;
|
|
17
|
+
}
|
|
18
|
+
export interface ReorderControlsContext<T> extends ReorderItemContext<T> {
|
|
19
|
+
dragHandle: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
export interface ReorderableListProps<T> {
|
|
22
|
+
items: readonly T[];
|
|
23
|
+
keyExtractor: (item: T) => string;
|
|
24
|
+
getItemLabel: (item: T) => string;
|
|
25
|
+
onChange: (items: T[], event: ReorderEvent) => void;
|
|
26
|
+
renderItem: (context: ReorderItemContext<T>) => ReactNode;
|
|
27
|
+
renderControls?: (context: ReorderControlsContext<T>) => ReactNode;
|
|
28
|
+
renderHandleContent?: (context: ReorderItemContext<T>) => ReactNode;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
className?: string;
|
|
31
|
+
style?: StyleProp<ViewStyle>;
|
|
32
|
+
itemStyle?: StyleProp<ViewStyle>;
|
|
33
|
+
contentStyle?: StyleProp<ViewStyle>;
|
|
34
|
+
controlsStyle?: StyleProp<ViewStyle>;
|
|
35
|
+
handleStyle?: StyleProp<ViewStyle>;
|
|
36
|
+
actionStyle?: StyleProp<ViewStyle>;
|
|
37
|
+
testID?: string;
|
|
38
|
+
labels?: {
|
|
39
|
+
drag?: (label: string) => string;
|
|
40
|
+
up?: (label: string) => string;
|
|
41
|
+
down?: (label: string) => string;
|
|
42
|
+
moved?: (label: string, position: number, count: number) => string;
|
|
43
|
+
changedDuringDrag?: string;
|
|
44
|
+
disabledDuringDrag?: string;
|
|
45
|
+
};
|
|
46
|
+
onDragStart?: (key: string) => void;
|
|
47
|
+
onDragEnd?: () => void;
|
|
48
|
+
onReorderRejected?: (reason: "data-changed" | "disabled") => void;
|
|
49
|
+
sortableProps?: Omit<SortableGridProps<T>, "data" | "renderItem" | "keyExtractor" | "rows" | "rowHeight" | "columns" | "onDragStart" | "onDragEnd" | "onOrderChange" | "sortEnabled" | "customHandle" | "strategy">;
|
|
50
|
+
}
|
|
51
|
+
export default function ReorderableList<T>({ items, keyExtractor, getItemLabel, onChange, renderItem, renderControls, renderHandleContent, disabled, className, style, itemStyle, contentStyle, controlsStyle, handleStyle, actionStyle, testID, labels, onDragStart, onDragEnd, onReorderRejected, sortableProps, }: ReorderableListProps<T>): import("react").JSX.Element;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "nativewind/jsx-runtime";
|
|
2
|
+
import Icon from "../Display/Display.Icon.js";
|
|
3
|
+
import Pressable from "../primitives/Pressable.js";
|
|
4
|
+
import { cn } from "../theme/tw.js";
|
|
5
|
+
import { Typography } from "../Typography/index.js";
|
|
6
|
+
import { moveCollectionEntry } from "../utils/criteria.js";
|
|
7
|
+
import { applyReorder, moveReorderItem, reorderKeys, sameOrder, } from "../utils/reorder.js";
|
|
8
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
9
|
+
import { AccessibilityInfo, useWindowDimensions, View, } from "react-native";
|
|
10
|
+
import Sortable from "react-native-sortables";
|
|
11
|
+
export default function ReorderableList({ items, keyExtractor, getItemLabel, onChange, renderItem, renderControls, renderHandleContent, disabled = false, className, style, itemStyle, contentStyle, controlsStyle, handleStyle, actionStyle, testID, labels, onDragStart, onDragEnd, onReorderRejected, sortableProps, }) {
|
|
12
|
+
const { fontScale } = useWindowDimensions();
|
|
13
|
+
const keys = useMemo(() => reorderKeys(items, keyExtractor), [items, keyExtractor]);
|
|
14
|
+
const data = useMemo(() => [...items], [items]);
|
|
15
|
+
const dragOrder = useRef(null);
|
|
16
|
+
const [dragging, setDragging] = useState(false);
|
|
17
|
+
const [error, setError] = useState();
|
|
18
|
+
const [revision, setRevision] = useState(0);
|
|
19
|
+
const busy = disabled || dragging;
|
|
20
|
+
const commit = (order, event) => {
|
|
21
|
+
if (sameOrder(keys, order))
|
|
22
|
+
return;
|
|
23
|
+
const next = applyReorder(items, keyExtractor, order);
|
|
24
|
+
onChange(next, event);
|
|
25
|
+
AccessibilityInfo.announceForAccessibility(labels?.moved?.(getItemLabel(next[event.toIndex]), event.toIndex + 1, items.length) ??
|
|
26
|
+
`${getItemLabel(next[event.toIndex])}, posición ${event.toIndex + 1} de ${items.length}`);
|
|
27
|
+
};
|
|
28
|
+
const reject = useCallback((reason) => {
|
|
29
|
+
const message = reason === "disabled"
|
|
30
|
+
? (labels?.disabledDuringDrag ??
|
|
31
|
+
"El orden se bloqueó durante el arrastre. No se aplicó el cambio.")
|
|
32
|
+
: (labels?.changedDuringDrag ??
|
|
33
|
+
"La lista cambió durante el arrastre. Revisa el orden e inténtalo de nuevo.");
|
|
34
|
+
setError(message);
|
|
35
|
+
setRevision((value) => value + 1);
|
|
36
|
+
AccessibilityInfo.announceForAccessibility(message);
|
|
37
|
+
onReorderRejected?.(reason);
|
|
38
|
+
}, [labels?.changedDuringDrag, labels?.disabledDuringDrag, onReorderRejected]);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (dragOrder.current && (disabled || !sameOrder(dragOrder.current, keys))) {
|
|
41
|
+
dragOrder.current = null;
|
|
42
|
+
setDragging(false);
|
|
43
|
+
reject(disabled ? "disabled" : "data-changed");
|
|
44
|
+
onDragEnd?.();
|
|
45
|
+
}
|
|
46
|
+
}, [disabled, keys, onDragEnd, reject]);
|
|
47
|
+
return (_jsxs(View, { className: cn("gap-2", className), style: style, testID: testID, children: [_jsx(Sortable.Grid, { activeItemScale: 1, activeItemShadowOpacity: 0, rowGap: 8, ...sortableProps, columns: 1, customHandle: true, data: data, keyExtractor: keyExtractor, onDragEnd: ({ fromIndex, toIndex }) => {
|
|
48
|
+
const started = dragOrder.current;
|
|
49
|
+
if (!started)
|
|
50
|
+
return;
|
|
51
|
+
dragOrder.current = null;
|
|
52
|
+
setDragging(false);
|
|
53
|
+
if (started && !sameOrder(started, keys))
|
|
54
|
+
reject("data-changed");
|
|
55
|
+
else if (disabled)
|
|
56
|
+
reject("disabled");
|
|
57
|
+
else if (started)
|
|
58
|
+
commit(moveReorderItem(keys, fromIndex, toIndex), {
|
|
59
|
+
key: keys[fromIndex],
|
|
60
|
+
fromIndex,
|
|
61
|
+
toIndex,
|
|
62
|
+
source: "drag",
|
|
63
|
+
});
|
|
64
|
+
onDragEnd?.();
|
|
65
|
+
}, onDragStart: ({ fromIndex }) => {
|
|
66
|
+
dragOrder.current = keys;
|
|
67
|
+
setDragging(true);
|
|
68
|
+
setError(undefined);
|
|
69
|
+
onDragStart?.(keys[fromIndex]);
|
|
70
|
+
}, renderItem: ({ item, index }) => {
|
|
71
|
+
const key = keys[index];
|
|
72
|
+
const label = getItemLabel(item);
|
|
73
|
+
const move = (direction) => {
|
|
74
|
+
if (busy || index + direction < 0 || index + direction >= items.length)
|
|
75
|
+
return;
|
|
76
|
+
setError(undefined);
|
|
77
|
+
commit(moveCollectionEntry(keys, index, direction), {
|
|
78
|
+
key,
|
|
79
|
+
fromIndex: index,
|
|
80
|
+
toIndex: index + direction,
|
|
81
|
+
source: "button",
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
const context = {
|
|
85
|
+
item,
|
|
86
|
+
index,
|
|
87
|
+
canMoveUp: !busy && index > 0,
|
|
88
|
+
canMoveDown: !busy && index < items.length - 1,
|
|
89
|
+
moveUp: () => move(-1),
|
|
90
|
+
moveDown: () => move(1),
|
|
91
|
+
};
|
|
92
|
+
const dragHandle = (_jsx(Sortable.Handle, { mode: disabled ? "non-draggable" : "draggable", children: _jsx(View, { accessibilityActions: [
|
|
93
|
+
...(context.canMoveUp ? [{ name: "decrement" }] : []),
|
|
94
|
+
...(context.canMoveDown ? [{ name: "increment" }] : []),
|
|
95
|
+
], accessibilityLabel: labels?.drag?.(label) ?? `Arrastrar ${label}`, accessibilityRole: "adjustable", accessibilityState: { disabled, busy: dragging }, accessibilityValue: { min: 1, max: items.length, now: index + 1 }, accessible: true, onAccessibilityAction: ({ nativeEvent }) => {
|
|
96
|
+
if (nativeEvent.actionName === "increment")
|
|
97
|
+
move(1);
|
|
98
|
+
if (nativeEvent.actionName === "decrement")
|
|
99
|
+
move(-1);
|
|
100
|
+
}, style: [
|
|
101
|
+
{
|
|
102
|
+
minHeight: 48,
|
|
103
|
+
minWidth: 48,
|
|
104
|
+
alignItems: "center",
|
|
105
|
+
justifyContent: "center",
|
|
106
|
+
},
|
|
107
|
+
handleStyle,
|
|
108
|
+
], testID: testID ? `${testID}-handle-${key}` : undefined, children: renderHandleContent ? (renderHandleContent(context)) : (_jsx(Icon, { name: "reorder-two-outline", size: 20 })) }) }));
|
|
109
|
+
return (_jsxs(View, { style: [
|
|
110
|
+
{
|
|
111
|
+
width: "100%",
|
|
112
|
+
flexDirection: fontScale > 1.3 ? "column" : "row",
|
|
113
|
+
alignItems: "center",
|
|
114
|
+
gap: 8,
|
|
115
|
+
},
|
|
116
|
+
itemStyle,
|
|
117
|
+
], testID: testID ? `${testID}-item-${key}` : undefined, children: [_jsx(View, { style: [
|
|
118
|
+
fontScale > 1.3 ? { alignSelf: "stretch" } : { flex: 1, minWidth: 0 },
|
|
119
|
+
contentStyle,
|
|
120
|
+
], children: renderItem(context) }), _jsx(View, { style: [{ flexDirection: "row", alignItems: "center" }, controlsStyle], children: renderControls ? (renderControls({ ...context, dragHandle })) : (_jsxs(_Fragment, { children: [dragHandle, _jsx(Pressable, { accessibilityLabel: labels?.up?.(label) ?? `Subir ${label}`, disabled: !context.canMoveUp, onPress: context.moveUp, style: [
|
|
121
|
+
{
|
|
122
|
+
minWidth: 48,
|
|
123
|
+
minHeight: 48,
|
|
124
|
+
alignItems: "center",
|
|
125
|
+
justifyContent: "center",
|
|
126
|
+
},
|
|
127
|
+
actionStyle,
|
|
128
|
+
], children: _jsx(Icon, { name: "arrow-up-outline", size: 18 }) }), _jsx(Pressable, { accessibilityLabel: labels?.down?.(label) ?? `Bajar ${label}`, disabled: !context.canMoveDown, onPress: context.moveDown, style: [
|
|
129
|
+
{
|
|
130
|
+
minWidth: 48,
|
|
131
|
+
minHeight: 48,
|
|
132
|
+
alignItems: "center",
|
|
133
|
+
justifyContent: "center",
|
|
134
|
+
},
|
|
135
|
+
actionStyle,
|
|
136
|
+
], children: _jsx(Icon, { name: "arrow-down-outline", size: 18 }) })] })) })] }, key));
|
|
137
|
+
}, sortEnabled: !disabled, strategy: "insert" }, revision), error ? (_jsx(Typography.Text, { accessibilityRole: "alert", className: "text-danger", children: error })) : null] }));
|
|
138
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "nativewind/jsx-runtime";
|
|
2
|
-
import GradientContainer from "../layouts/GradientContainer";
|
|
3
|
-
import { Navigation } from "../Navigation";
|
|
2
|
+
import GradientContainer from "../layouts/GradientContainer.js";
|
|
3
|
+
import { Navigation } from "../Navigation/index.js";
|
|
4
4
|
import { View } from "react-native";
|
|
5
5
|
const Header = Navigation.Header;
|
|
6
6
|
const HeaderToolbar = Navigation.HeaderToolbar;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "nativewind/jsx-runtime";
|
|
2
|
-
import { Display, Form } from "../index";
|
|
3
|
-
import { theme } from "../theme/useTheme";
|
|
4
|
-
import { Typography } from "../Typography";
|
|
5
|
-
import { TimeZoneSelectorModal } from "
|
|
2
|
+
import { Display, Form } from "../index.js";
|
|
3
|
+
import { theme } from "../theme/useTheme.js";
|
|
4
|
+
import { Typography } from "../Typography/index.js";
|
|
5
|
+
import { TimeZoneSelectorModal } from "./TimeZoneSelectorModal.js";
|
|
6
6
|
import { useState } from "react";
|
|
7
7
|
import { View } from "react-native";
|
|
8
8
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "nativewind/jsx-runtime";
|
|
2
|
-
import { BottomSheet } from "../Dialog/BottomSheet";
|
|
3
|
-
import { Display, Form } from "../index";
|
|
4
|
-
import { theme } from "../theme";
|
|
5
|
-
import { Typography } from "../Typography";
|
|
2
|
+
import { BottomSheet } from "../Dialog/BottomSheet/index.js";
|
|
3
|
+
import { Display, Form } from "../index.js";
|
|
4
|
+
import { theme } from "../theme/index.js";
|
|
5
|
+
import { Typography } from "../Typography/index.js";
|
|
6
6
|
import { useMemo, useState } from "react";
|
|
7
7
|
import { FlatList, TextInput, TouchableOpacity, View } from "react-native";
|
|
8
8
|
const TIMEZONES_LOCALES = {
|
|
@@ -57,6 +57,6 @@ function TimeZoneSelectorModal({ visible, onClose, onSelect, currentTimezone, })
|
|
|
57
57
|
onClose();
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
return (_jsxs(BottomSheet.Root, { onClose: onClose, size: "large", visible: visible, children: [_jsxs(BottomSheet.Header, { children: [_jsxs(View, { className: "px-5 pb-3", children: [_jsx(Typography.Text, { bold: true, variant: "subtitle", children: "Zona Horaria" }), _jsx(Typography.Text, { className: "text-text-secondary text-xs", children: "Selecciona tu zona horaria" })] }), _jsx(View, { className: "px-5 pb-3", children: _jsx(TextInput, { className: "bg-bg-muted px-4 py-3 rounded-xl", onChangeText: setQuery, placeholder: "Buscar zona horaria...", placeholderTextColor: theme.text.tertiary, value: query }) })] }), _jsx(BottomSheet.Content, { scrollable: true, children: filteredTimezones.length === 0 ? (_jsx(EmptyState, {})) : (_jsx(FlatList, { data: filteredTimezones, keyExtractor: (item) => item.timezone, renderItem: ({ item }) => (_jsx(TimezoneRow, { isSelected: selectedTimezone === item.timezone, item: item, onSelect: () => setSelectedTimezone(item.timezone) })), scrollEnabled: false })) }), _jsxs(BottomSheet.Actions, { layout: "horizontal", children: [_jsx(View, { className: "flex-1", children: _jsx(Form.Button, { onPress: onClose, title: "Cancelar", variant: "outline" }) }), selectedTimezone && (_jsx(View, { className: "flex-1", children: _jsx(Form.Button, { onPress: handleConfirm, title: "Confirmar", variant: "primary" }) }))] })] }));
|
|
60
|
+
return (_jsxs(BottomSheet.Root, { onClose: onClose, size: "large", visible: visible, children: [_jsxs(BottomSheet.Header, { children: [_jsxs(View, { className: "px-5 pb-3", children: [_jsx(Typography.Text, { bold: true, variant: "subtitle", children: "Zona Horaria" }), _jsx(Typography.Text, { className: "text-text-secondary text-xs", children: "Selecciona tu zona horaria" })] }), _jsx(View, { className: "px-5 pb-3", children: _jsx(TextInput, { className: "bg-bg-muted px-4 py-3 rounded-xl", onChangeText: setQuery, placeholder: "Buscar zona horaria...", placeholderTextColor: theme.text.tertiary, selectionColor: theme.primary, underlineColorAndroid: "transparent", value: query }) })] }), _jsx(BottomSheet.Content, { scrollable: true, children: filteredTimezones.length === 0 ? (_jsx(EmptyState, {})) : (_jsx(FlatList, { data: filteredTimezones, keyExtractor: (item) => item.timezone, renderItem: ({ item }) => (_jsx(TimezoneRow, { isSelected: selectedTimezone === item.timezone, item: item, onSelect: () => setSelectedTimezone(item.timezone) })), scrollEnabled: false })) }), _jsxs(BottomSheet.Actions, { layout: "horizontal", children: [_jsx(View, { className: "flex-1", children: _jsx(Form.Button, { onPress: onClose, title: "Cancelar", variant: "outline" }) }), selectedTimezone && (_jsx(View, { className: "flex-1", children: _jsx(Form.Button, { onPress: handleConfirm, title: "Confirmar", variant: "primary" }) }))] })] }));
|
|
61
61
|
}
|
|
62
62
|
export { TimeZoneSelectorModal };
|
package/dist/widgets/index.d.ts
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export
|
|
1
|
+
export type { CollectionField, CollectionQuery, CollectionSort, CriteriaCondition, CriteriaField, CriteriaGroup, CriteriaNode, CriteriaOperator, CriteriaValue, SavedCollectionQuery, } from "../utils/criteria.js";
|
|
2
|
+
export { CircleButton } from "./CircleButton.js";
|
|
3
|
+
export { default as CollectionOptions, type CollectionOptionsProps, } from "./CollectionOptions.js";
|
|
4
|
+
export { FilterBar, type FilterBarOption, type FilterBarProps, } from "./FilterBar.js";
|
|
5
|
+
export { default as FilterBuilder, type FilterBuilderProps, } from "./FilterBuilder.js";
|
|
6
|
+
export { default as GeoPermissionCard } from "./GeoPermissionCard.js";
|
|
7
|
+
export { HomeHeader } from "./HomeHeader.js";
|
|
8
|
+
export { MenuCard } from "./MenuCard.js";
|
|
9
|
+
export type { MenuGridItem, MenuGridProps } from "./MenuGrid.js";
|
|
6
10
|
/** @deprecated Renamed to `MenuGridItem`. */
|
|
7
|
-
export type { MenuGridItem as MenuItem } from "
|
|
8
|
-
export { MenuGrid } from "
|
|
9
|
-
export type { MenuSectionProps } from "
|
|
10
|
-
export { MenuSection } from "
|
|
11
|
-
export type { PromoBannerItem, PromoBannerProps, } from "
|
|
12
|
-
export { PromoBanner } from "
|
|
13
|
-
export type { PromoModalProps } from "
|
|
14
|
-
export { PromoModal } from "
|
|
15
|
-
export type { QuickActionItem, QuickActionsProps, } from "
|
|
16
|
-
export { QuickActions } from "
|
|
17
|
-
export { TimeZoneSelector } from "
|
|
11
|
+
export type { MenuGridItem as MenuItem } from "./MenuGrid.js";
|
|
12
|
+
export { MenuGrid } from "./MenuGrid.js";
|
|
13
|
+
export type { MenuSectionProps } from "./MenuSection.js";
|
|
14
|
+
export { MenuSection } from "./MenuSection.js";
|
|
15
|
+
export type { PromoBannerItem, PromoBannerProps, } from "./PromoBanner.js";
|
|
16
|
+
export { PromoBanner } from "./PromoBanner.js";
|
|
17
|
+
export type { PromoModalProps } from "./PromoModal.js";
|
|
18
|
+
export { PromoModal } from "./PromoModal.js";
|
|
19
|
+
export type { QuickActionItem, QuickActionsProps, } from "./QuickActions.js";
|
|
20
|
+
export { QuickActions } from "./QuickActions.js";
|
|
21
|
+
export { TimeZoneSelector } from "./TimeZoneSelector.js";
|
package/dist/widgets/index.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
export { CircleButton } from "
|
|
2
|
-
export { default as
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
1
|
+
export { CircleButton } from "./CircleButton.js";
|
|
2
|
+
export { default as CollectionOptions, } from "./CollectionOptions.js";
|
|
3
|
+
export { FilterBar, } from "./FilterBar.js";
|
|
4
|
+
export { default as FilterBuilder, } from "./FilterBuilder.js";
|
|
5
|
+
export { default as GeoPermissionCard } from "./GeoPermissionCard.js";
|
|
6
|
+
export { HomeHeader } from "./HomeHeader.js";
|
|
7
|
+
export { MenuCard } from "./MenuCard.js";
|
|
8
|
+
export { MenuGrid } from "./MenuGrid.js";
|
|
9
|
+
export { MenuSection } from "./MenuSection.js";
|
|
10
|
+
export { PromoBanner } from "./PromoBanner.js";
|
|
11
|
+
export { PromoModal } from "./PromoModal.js";
|
|
12
|
+
export { QuickActions } from "./QuickActions.js";
|
|
13
|
+
export { TimeZoneSelector } from "./TimeZoneSelector.js";
|