@sincpro/mobile-ui 0.1.2
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 +32 -0
- package/lib/module/Dialog/BottomSheet/BottomSheet.Root.js +481 -0
- package/lib/module/Dialog/BottomSheet/BottomSheet.Root.js.map +1 -0
- package/lib/module/Dialog/BottomSheet/index.js +4 -0
- package/lib/module/Dialog/BottomSheet/index.js.map +1 -0
- package/lib/module/Dialog/Confirmation.context.js +108 -0
- package/lib/module/Dialog/Confirmation.context.js.map +1 -0
- package/lib/module/Dialog/Dialog.Confirmation.js +69 -0
- package/lib/module/Dialog/Dialog.Confirmation.js.map +1 -0
- package/lib/module/Dialog/Dialog.EditValue.js +115 -0
- package/lib/module/Dialog/Dialog.EditValue.js.map +1 -0
- package/lib/module/Dialog/index.js +14 -0
- package/lib/module/Dialog/index.js.map +1 -0
- package/lib/module/Display/Display.Avatar.js +58 -0
- package/lib/module/Display/Display.Avatar.js.map +1 -0
- package/lib/module/Display/Display.Badge.js +72 -0
- package/lib/module/Display/Display.Badge.js.map +1 -0
- package/lib/module/Display/Display.CopyableText.js +30 -0
- package/lib/module/Display/Display.CopyableText.js.map +1 -0
- package/lib/module/Display/Display.CountRecords.js +27 -0
- package/lib/module/Display/Display.CountRecords.js.map +1 -0
- package/lib/module/Display/Display.Date.js +35 -0
- package/lib/module/Display/Display.Date.js.map +1 -0
- package/lib/module/Display/Display.Divider.js +43 -0
- package/lib/module/Display/Display.Divider.js.map +1 -0
- package/lib/module/Display/Display.Icon.js +83 -0
- package/lib/module/Display/Display.Icon.js.map +1 -0
- package/lib/module/Display/Display.Logo.js +54 -0
- package/lib/module/Display/Display.Logo.js.map +1 -0
- package/lib/module/Display/Display.MenuButton.js +101 -0
- package/lib/module/Display/Display.MenuButton.js.map +1 -0
- package/lib/module/Display/Display.Monetary.js +36 -0
- package/lib/module/Display/Display.Monetary.js.map +1 -0
- package/lib/module/Display/index.js +28 -0
- package/lib/module/Display/index.js.map +1 -0
- package/lib/module/Feedback/ErrorBoundary.js +43 -0
- package/lib/module/Feedback/ErrorBoundary.js.map +1 -0
- package/lib/module/Feedback/Feedback.DomainSplashScreen.js +101 -0
- package/lib/module/Feedback/Feedback.DomainSplashScreen.js.map +1 -0
- package/lib/module/Feedback/Feedback.Empty.js +31 -0
- package/lib/module/Feedback/Feedback.Empty.js.map +1 -0
- package/lib/module/Feedback/Feedback.Error.js +53 -0
- package/lib/module/Feedback/Feedback.Error.js.map +1 -0
- package/lib/module/Feedback/Feedback.Loading.js +24 -0
- package/lib/module/Feedback/Feedback.Loading.js.map +1 -0
- package/lib/module/Feedback/Feedback.Spinner.js +28 -0
- package/lib/module/Feedback/Feedback.Spinner.js.map +1 -0
- package/lib/module/Feedback/Feedback.Splash.js +59 -0
- package/lib/module/Feedback/Feedback.Splash.js.map +1 -0
- package/lib/module/Feedback/index.js +17 -0
- package/lib/module/Feedback/index.js.map +1 -0
- package/lib/module/Form/Form.Button.js +442 -0
- package/lib/module/Form/Form.Button.js.map +1 -0
- package/lib/module/Form/Form.Checkbox.js +71 -0
- package/lib/module/Form/Form.Checkbox.js.map +1 -0
- package/lib/module/Form/Form.ControlledCheckbox.js +29 -0
- package/lib/module/Form/Form.ControlledCheckbox.js.map +1 -0
- package/lib/module/Form/Form.ControlledDropdown.js +7 -0
- package/lib/module/Form/Form.ControlledDropdown.js.map +1 -0
- package/lib/module/Form/Form.ControlledInput.js +43 -0
- package/lib/module/Form/Form.ControlledInput.js.map +1 -0
- package/lib/module/Form/Form.ControlledMonetaryInput.js +34 -0
- package/lib/module/Form/Form.ControlledMonetaryInput.js.map +1 -0
- package/lib/module/Form/Form.ControlledRadioButton.js +28 -0
- package/lib/module/Form/Form.ControlledRadioButton.js.map +1 -0
- package/lib/module/Form/Form.Dropdown.js +163 -0
- package/lib/module/Form/Form.Dropdown.js.map +1 -0
- package/lib/module/Form/Form.FilterButton.js +59 -0
- package/lib/module/Form/Form.FilterButton.js.map +1 -0
- package/lib/module/Form/Form.FractionalQuantityInput.js +166 -0
- package/lib/module/Form/Form.FractionalQuantityInput.js.map +1 -0
- package/lib/module/Form/Form.IconButton.js +97 -0
- package/lib/module/Form/Form.IconButton.js.map +1 -0
- package/lib/module/Form/Form.Input.js +77 -0
- package/lib/module/Form/Form.Input.js.map +1 -0
- package/lib/module/Form/Form.InputField.js +63 -0
- package/lib/module/Form/Form.InputField.js.map +1 -0
- package/lib/module/Form/Form.MonetaryInput.js +65 -0
- package/lib/module/Form/Form.MonetaryInput.js.map +1 -0
- package/lib/module/Form/Form.PasswordInput.js +37 -0
- package/lib/module/Form/Form.PasswordInput.js.map +1 -0
- package/lib/module/Form/Form.QuantitySelector.js +78 -0
- package/lib/module/Form/Form.QuantitySelector.js.map +1 -0
- package/lib/module/Form/Form.RadioButton.js +56 -0
- package/lib/module/Form/Form.RadioButton.js.map +1 -0
- package/lib/module/Form/Form.SearchBar.js +63 -0
- package/lib/module/Form/Form.SearchBar.js.map +1 -0
- package/lib/module/Form/Form.TextInput.js +19 -0
- package/lib/module/Form/Form.TextInput.js.map +1 -0
- package/lib/module/Form/index.js +45 -0
- package/lib/module/Form/index.js.map +1 -0
- package/lib/module/Navigation/Navigation.Header.js +46 -0
- package/lib/module/Navigation/Navigation.Header.js.map +1 -0
- package/lib/module/Navigation/Navigation.HeaderToolbar.js +79 -0
- package/lib/module/Navigation/Navigation.HeaderToolbar.js.map +1 -0
- package/lib/module/Navigation/Navigation.RowItem.js +35 -0
- package/lib/module/Navigation/Navigation.RowItem.js.map +1 -0
- package/lib/module/Navigation/Navigation.TabIcon.js +28 -0
- package/lib/module/Navigation/Navigation.TabIcon.js.map +1 -0
- package/lib/module/Navigation/Navigation.TabItem.js +27 -0
- package/lib/module/Navigation/Navigation.TabItem.js.map +1 -0
- package/lib/module/Navigation/index.js +16 -0
- package/lib/module/Navigation/index.js.map +1 -0
- package/lib/module/Typography/Typography.Heading.js +15 -0
- package/lib/module/Typography/Typography.Heading.js.map +1 -0
- package/lib/module/Typography/Typography.Text.js +51 -0
- package/lib/module/Typography/Typography.Text.js.map +1 -0
- package/lib/module/Typography/index.js +11 -0
- package/lib/module/Typography/index.js.map +1 -0
- package/lib/module/icons/AddItemIcon.js +53 -0
- package/lib/module/icons/AddItemIcon.js.map +1 -0
- package/lib/module/icons/ArrangeCircle.js +50 -0
- package/lib/module/icons/ArrangeCircle.js.map +1 -0
- package/lib/module/icons/ArrowDownIcon.js +37 -0
- package/lib/module/icons/ArrowDownIcon.js.map +1 -0
- package/lib/module/icons/ArrowUpIcon.js +37 -0
- package/lib/module/icons/ArrowUpIcon.js.map +1 -0
- package/lib/module/icons/BoxIcon.js +35 -0
- package/lib/module/icons/BoxIcon.js.map +1 -0
- package/lib/module/icons/BoxTimeIcon.js +29 -0
- package/lib/module/icons/BoxTimeIcon.js.map +1 -0
- package/lib/module/icons/CalendarIcon.js +81 -0
- package/lib/module/icons/CalendarIcon.js.map +1 -0
- package/lib/module/icons/CardIcon.js +46 -0
- package/lib/module/icons/CardIcon.js.map +1 -0
- package/lib/module/icons/CashierIcon.js +20 -0
- package/lib/module/icons/CashierIcon.js.map +1 -0
- package/lib/module/icons/CreditIcon.js +43 -0
- package/lib/module/icons/CreditIcon.js.map +1 -0
- package/lib/module/icons/DuoIcon.js +41 -0
- package/lib/module/icons/DuoIcon.js.map +1 -0
- package/lib/module/icons/HomeIcon.js +20 -0
- package/lib/module/icons/HomeIcon.js.map +1 -0
- package/lib/module/icons/HomeIconOutlined.js +29 -0
- package/lib/module/icons/HomeIconOutlined.js.map +1 -0
- package/lib/module/icons/LogoIcon.js +38 -0
- package/lib/module/icons/LogoIcon.js.map +1 -0
- package/lib/module/icons/MoneyReceiveIcon.js +47 -0
- package/lib/module/icons/MoneyReceiveIcon.js.map +1 -0
- package/lib/module/icons/OdooIcon.js +24 -0
- package/lib/module/icons/OdooIcon.js.map +1 -0
- package/lib/module/icons/PinIcon.js +20 -0
- package/lib/module/icons/PinIcon.js.map +1 -0
- package/lib/module/icons/PrinterIcon.js +48 -0
- package/lib/module/icons/PrinterIcon.js.map +1 -0
- package/lib/module/icons/ProfileIcon.js +23 -0
- package/lib/module/icons/ProfileIcon.js.map +1 -0
- package/lib/module/icons/SettingsIcon.js +65 -0
- package/lib/module/icons/SettingsIcon.js.map +1 -0
- package/lib/module/icons/SinpeIcon.js +37 -0
- package/lib/module/icons/SinpeIcon.js.map +1 -0
- package/lib/module/icons/ToggleOffIcon.js +29 -0
- package/lib/module/icons/ToggleOffIcon.js.map +1 -0
- package/lib/module/icons/WalletMoneyIcon.js +42 -0
- package/lib/module/icons/WalletMoneyIcon.js.map +1 -0
- package/lib/module/icons/icon_getters.js +53 -0
- package/lib/module/icons/icon_getters.js.map +1 -0
- package/lib/module/icons/props.js +2 -0
- package/lib/module/icons/props.js.map +1 -0
- package/lib/module/index.js +34 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/layouts/AuthContainer.js +66 -0
- package/lib/module/layouts/AuthContainer.js.map +1 -0
- package/lib/module/layouts/Container.js +31 -0
- package/lib/module/layouts/Container.js.map +1 -0
- package/lib/module/layouts/GradientContainer.js +20 -0
- package/lib/module/layouts/GradientContainer.js.map +1 -0
- package/lib/module/layouts/PlainLayout.js +16 -0
- package/lib/module/layouts/PlainLayout.js.map +1 -0
- package/lib/module/layouts/ScrollContainer.js +37 -0
- package/lib/module/layouts/ScrollContainer.js.map +1 -0
- package/lib/module/layouts/TabNavigatorLayout.js +132 -0
- package/lib/module/layouts/TabNavigatorLayout.js.map +1 -0
- package/lib/module/lib/date.js +127 -0
- package/lib/module/lib/date.js.map +1 -0
- package/lib/module/lib/icon.js +2 -0
- package/lib/module/lib/icon.js.map +1 -0
- package/lib/module/lib/monetary.js +31 -0
- package/lib/module/lib/monetary.js.map +1 -0
- package/lib/module/lib/quantity.js +46 -0
- package/lib/module/lib/quantity.js.map +1 -0
- package/lib/module/lib/serializer.js +47 -0
- package/lib/module/lib/serializer.js.map +1 -0
- package/lib/module/lib/timezone.js +2 -0
- package/lib/module/lib/timezone.js.map +1 -0
- package/lib/module/nativewind-env.d.js +3 -0
- package/lib/module/nativewind-env.d.js.map +1 -0
- package/lib/module/notifications/index.js +5 -0
- package/lib/module/notifications/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/primitives/BaseButton.js +391 -0
- package/lib/module/primitives/BaseButton.js.map +1 -0
- package/lib/module/primitives/Box.js +19 -0
- package/lib/module/primitives/Box.js.map +1 -0
- package/lib/module/primitives/Row.js +37 -0
- package/lib/module/primitives/Row.js.map +1 -0
- package/lib/module/primitives/Stack.js +27 -0
- package/lib/module/primitives/Stack.js.map +1 -0
- package/lib/module/primitives/index.js +6 -0
- package/lib/module/primitives/index.js.map +1 -0
- package/lib/module/providers/index.js +3 -0
- package/lib/module/providers/index.js.map +1 -0
- package/lib/module/theme/active.js +13 -0
- package/lib/module/theme/active.js.map +1 -0
- package/lib/module/theme/components/ThemedActivityIndicator.js +30 -0
- package/lib/module/theme/components/ThemedActivityIndicator.js.map +1 -0
- package/lib/module/theme/components/index.js +13 -0
- package/lib/module/theme/components/index.js.map +1 -0
- package/lib/module/theme/default.js +91 -0
- package/lib/module/theme/default.js.map +1 -0
- package/lib/module/theme/globals.css +67 -0
- package/lib/module/theme/index.js +6 -0
- package/lib/module/theme/index.js.map +1 -0
- package/lib/module/theme/theme.js +18 -0
- package/lib/module/theme/theme.js.map +1 -0
- package/lib/module/theme/tw.js +19 -0
- package/lib/module/theme/tw.js.map +1 -0
- package/lib/module/theme/types.js +2 -0
- package/lib/module/theme/types.js.map +1 -0
- package/lib/module/theme/typography.js +246 -0
- package/lib/module/theme/typography.js.map +1 -0
- package/lib/module/theme/useTheme.js +5 -0
- package/lib/module/theme/useTheme.js.map +1 -0
- package/lib/module/views/AuthFormView.js +46 -0
- package/lib/module/views/AuthFormView.js.map +1 -0
- package/lib/module/views/FormViewV2.context.js +47 -0
- package/lib/module/views/FormViewV2.context.js.map +1 -0
- package/lib/module/views/FormViewV2.js +220 -0
- package/lib/module/views/FormViewV2.js.map +1 -0
- package/lib/module/views/ListViewV2.context.js +51 -0
- package/lib/module/views/ListViewV2.context.js.map +1 -0
- package/lib/module/views/ListViewV2.js +503 -0
- package/lib/module/views/ListViewV2.js.map +1 -0
- package/lib/module/views/Wizard/Wizard.context.js +111 -0
- package/lib/module/views/Wizard/Wizard.context.js.map +1 -0
- package/lib/module/views/Wizard/Wizard.js +125 -0
- package/lib/module/views/Wizard/Wizard.js.map +1 -0
- package/lib/module/views/Wizard/index.js +5 -0
- package/lib/module/views/Wizard/index.js.map +1 -0
- package/lib/module/views/types/IFormView.js +4 -0
- package/lib/module/views/types/IFormView.js.map +1 -0
- package/lib/module/views/types/IListView.js +40 -0
- package/lib/module/views/types/IListView.js.map +1 -0
- package/lib/module/views/types/UIItem.js +2 -0
- package/lib/module/views/types/UIItem.js.map +1 -0
- package/lib/module/widgets/CircleButton.js +70 -0
- package/lib/module/widgets/CircleButton.js.map +1 -0
- package/lib/module/widgets/GeoPermissionCard.js +55 -0
- package/lib/module/widgets/GeoPermissionCard.js.map +1 -0
- package/lib/module/widgets/HomeHeader.js +42 -0
- package/lib/module/widgets/HomeHeader.js.map +1 -0
- package/lib/module/widgets/JSONViewer.js +196 -0
- package/lib/module/widgets/JSONViewer.js.map +1 -0
- package/lib/module/widgets/MenuCard.js +32 -0
- package/lib/module/widgets/MenuCard.js.map +1 -0
- package/lib/module/widgets/MenuGrid.js +20 -0
- package/lib/module/widgets/MenuGrid.js.map +1 -0
- package/lib/module/widgets/ScreenHeader.js +63 -0
- package/lib/module/widgets/ScreenHeader.js.map +1 -0
- package/lib/module/widgets/TimeZoneSelector.js +73 -0
- package/lib/module/widgets/TimeZoneSelector.js.map +1 -0
- package/lib/module/widgets/TimeZoneSelectorModal.js +187 -0
- package/lib/module/widgets/TimeZoneSelectorModal.js.map +1 -0
- package/lib/module/widgets/index.js +9 -0
- package/lib/module/widgets/index.js.map +1 -0
- package/lib/typescript/Dialog/BottomSheet/BottomSheet.Root.d.ts +321 -0
- package/lib/typescript/Dialog/BottomSheet/BottomSheet.Root.d.ts.map +1 -0
- package/lib/typescript/Dialog/BottomSheet/index.d.ts +2 -0
- package/lib/typescript/Dialog/BottomSheet/index.d.ts.map +1 -0
- package/lib/typescript/Dialog/Confirmation.context.d.ts +22 -0
- package/lib/typescript/Dialog/Confirmation.context.d.ts.map +1 -0
- package/lib/typescript/Dialog/Dialog.Confirmation.d.ts +13 -0
- package/lib/typescript/Dialog/Dialog.Confirmation.d.ts.map +1 -0
- package/lib/typescript/Dialog/Dialog.EditValue.d.ts +26 -0
- package/lib/typescript/Dialog/Dialog.EditValue.d.ts.map +1 -0
- package/lib/typescript/Dialog/index.d.ts +20 -0
- package/lib/typescript/Dialog/index.d.ts.map +1 -0
- package/lib/typescript/Display/Display.Avatar.d.ts +53 -0
- package/lib/typescript/Display/Display.Avatar.d.ts.map +1 -0
- package/lib/typescript/Display/Display.Badge.d.ts +109 -0
- package/lib/typescript/Display/Display.Badge.d.ts.map +1 -0
- package/lib/typescript/Display/Display.CopyableText.d.ts +14 -0
- package/lib/typescript/Display/Display.CopyableText.d.ts.map +1 -0
- package/lib/typescript/Display/Display.CountRecords.d.ts +9 -0
- package/lib/typescript/Display/Display.CountRecords.d.ts.map +1 -0
- package/lib/typescript/Display/Display.Date.d.ts +19 -0
- package/lib/typescript/Display/Display.Date.d.ts.map +1 -0
- package/lib/typescript/Display/Display.Divider.d.ts +45 -0
- package/lib/typescript/Display/Display.Divider.d.ts.map +1 -0
- package/lib/typescript/Display/Display.Icon.d.ts +16 -0
- package/lib/typescript/Display/Display.Icon.d.ts.map +1 -0
- package/lib/typescript/Display/Display.Logo.d.ts +56 -0
- package/lib/typescript/Display/Display.Logo.d.ts.map +1 -0
- package/lib/typescript/Display/Display.MenuButton.d.ts +104 -0
- package/lib/typescript/Display/Display.MenuButton.d.ts.map +1 -0
- package/lib/typescript/Display/Display.Monetary.d.ts +20 -0
- package/lib/typescript/Display/Display.Monetary.d.ts.map +1 -0
- package/lib/typescript/Display/index.d.ts +23 -0
- package/lib/typescript/Display/index.d.ts.map +1 -0
- package/lib/typescript/Feedback/ErrorBoundary.d.ts +19 -0
- package/lib/typescript/Feedback/ErrorBoundary.d.ts.map +1 -0
- package/lib/typescript/Feedback/Feedback.DomainSplashScreen.d.ts +12 -0
- package/lib/typescript/Feedback/Feedback.DomainSplashScreen.d.ts.map +1 -0
- package/lib/typescript/Feedback/Feedback.Empty.d.ts +7 -0
- package/lib/typescript/Feedback/Feedback.Empty.d.ts.map +1 -0
- package/lib/typescript/Feedback/Feedback.Error.d.ts +10 -0
- package/lib/typescript/Feedback/Feedback.Error.d.ts.map +1 -0
- package/lib/typescript/Feedback/Feedback.Loading.d.ts +10 -0
- package/lib/typescript/Feedback/Feedback.Loading.d.ts.map +1 -0
- package/lib/typescript/Feedback/Feedback.Spinner.d.ts +12 -0
- package/lib/typescript/Feedback/Feedback.Spinner.d.ts.map +1 -0
- package/lib/typescript/Feedback/Feedback.Splash.d.ts +12 -0
- package/lib/typescript/Feedback/Feedback.Splash.d.ts.map +1 -0
- package/lib/typescript/Feedback/index.d.ts +14 -0
- package/lib/typescript/Feedback/index.d.ts.map +1 -0
- package/lib/typescript/Form/Form.Button.d.ts +146 -0
- package/lib/typescript/Form/Form.Button.d.ts.map +1 -0
- package/lib/typescript/Form/Form.Checkbox.d.ts +14 -0
- package/lib/typescript/Form/Form.Checkbox.d.ts.map +1 -0
- package/lib/typescript/Form/Form.ControlledCheckbox.d.ts +10 -0
- package/lib/typescript/Form/Form.ControlledCheckbox.d.ts.map +1 -0
- package/lib/typescript/Form/Form.ControlledDropdown.d.ts +15 -0
- package/lib/typescript/Form/Form.ControlledDropdown.d.ts.map +1 -0
- package/lib/typescript/Form/Form.ControlledInput.d.ts +16 -0
- package/lib/typescript/Form/Form.ControlledInput.d.ts.map +1 -0
- package/lib/typescript/Form/Form.ControlledMonetaryInput.d.ts +13 -0
- package/lib/typescript/Form/Form.ControlledMonetaryInput.d.ts.map +1 -0
- package/lib/typescript/Form/Form.ControlledRadioButton.d.ts +10 -0
- package/lib/typescript/Form/Form.ControlledRadioButton.d.ts.map +1 -0
- package/lib/typescript/Form/Form.Dropdown.d.ts +15 -0
- package/lib/typescript/Form/Form.Dropdown.d.ts.map +1 -0
- package/lib/typescript/Form/Form.FilterButton.d.ts +13 -0
- package/lib/typescript/Form/Form.FilterButton.d.ts.map +1 -0
- package/lib/typescript/Form/Form.FractionalQuantityInput.d.ts +14 -0
- package/lib/typescript/Form/Form.FractionalQuantityInput.d.ts.map +1 -0
- package/lib/typescript/Form/Form.IconButton.d.ts +68 -0
- package/lib/typescript/Form/Form.IconButton.d.ts.map +1 -0
- package/lib/typescript/Form/Form.Input.d.ts +11 -0
- package/lib/typescript/Form/Form.Input.d.ts.map +1 -0
- package/lib/typescript/Form/Form.InputField.d.ts +11 -0
- package/lib/typescript/Form/Form.InputField.d.ts.map +1 -0
- package/lib/typescript/Form/Form.MonetaryInput.d.ts +9 -0
- package/lib/typescript/Form/Form.MonetaryInput.d.ts.map +1 -0
- package/lib/typescript/Form/Form.PasswordInput.d.ts +10 -0
- package/lib/typescript/Form/Form.PasswordInput.d.ts.map +1 -0
- package/lib/typescript/Form/Form.QuantitySelector.d.ts +12 -0
- package/lib/typescript/Form/Form.QuantitySelector.d.ts.map +1 -0
- package/lib/typescript/Form/Form.RadioButton.d.ts +8 -0
- package/lib/typescript/Form/Form.RadioButton.d.ts.map +1 -0
- package/lib/typescript/Form/Form.SearchBar.d.ts +10 -0
- package/lib/typescript/Form/Form.SearchBar.d.ts.map +1 -0
- package/lib/typescript/Form/Form.TextInput.d.ts +9 -0
- package/lib/typescript/Form/Form.TextInput.d.ts.map +1 -0
- package/lib/typescript/Form/index.d.ts +42 -0
- package/lib/typescript/Form/index.d.ts.map +1 -0
- package/lib/typescript/Navigation/Navigation.Header.d.ts +11 -0
- package/lib/typescript/Navigation/Navigation.Header.d.ts.map +1 -0
- package/lib/typescript/Navigation/Navigation.HeaderToolbar.d.ts +16 -0
- package/lib/typescript/Navigation/Navigation.HeaderToolbar.d.ts.map +1 -0
- package/lib/typescript/Navigation/Navigation.RowItem.d.ts +6 -0
- package/lib/typescript/Navigation/Navigation.RowItem.d.ts.map +1 -0
- package/lib/typescript/Navigation/Navigation.TabIcon.d.ts +15 -0
- package/lib/typescript/Navigation/Navigation.TabIcon.d.ts.map +1 -0
- package/lib/typescript/Navigation/Navigation.TabItem.d.ts +15 -0
- package/lib/typescript/Navigation/Navigation.TabItem.d.ts.map +1 -0
- package/lib/typescript/Navigation/index.d.ts +12 -0
- package/lib/typescript/Navigation/index.d.ts.map +1 -0
- package/lib/typescript/Typography/Typography.Heading.d.ts +13 -0
- package/lib/typescript/Typography/Typography.Heading.d.ts.map +1 -0
- package/lib/typescript/Typography/Typography.Text.d.ts +29 -0
- package/lib/typescript/Typography/Typography.Text.d.ts.map +1 -0
- package/lib/typescript/Typography/index.d.ts +8 -0
- package/lib/typescript/Typography/index.d.ts.map +1 -0
- package/lib/typescript/icons/AddItemIcon.d.ts +5 -0
- package/lib/typescript/icons/AddItemIcon.d.ts.map +1 -0
- package/lib/typescript/icons/ArrangeCircle.d.ts +5 -0
- package/lib/typescript/icons/ArrangeCircle.d.ts.map +1 -0
- package/lib/typescript/icons/ArrowDownIcon.d.ts +5 -0
- package/lib/typescript/icons/ArrowDownIcon.d.ts.map +1 -0
- package/lib/typescript/icons/ArrowUpIcon.d.ts +5 -0
- package/lib/typescript/icons/ArrowUpIcon.d.ts.map +1 -0
- package/lib/typescript/icons/BoxIcon.d.ts +5 -0
- package/lib/typescript/icons/BoxIcon.d.ts.map +1 -0
- package/lib/typescript/icons/BoxTimeIcon.d.ts +5 -0
- package/lib/typescript/icons/BoxTimeIcon.d.ts.map +1 -0
- package/lib/typescript/icons/CalendarIcon.d.ts +5 -0
- package/lib/typescript/icons/CalendarIcon.d.ts.map +1 -0
- package/lib/typescript/icons/CardIcon.d.ts +5 -0
- package/lib/typescript/icons/CardIcon.d.ts.map +1 -0
- package/lib/typescript/icons/CashierIcon.d.ts +5 -0
- package/lib/typescript/icons/CashierIcon.d.ts.map +1 -0
- package/lib/typescript/icons/CreditIcon.d.ts +8 -0
- package/lib/typescript/icons/CreditIcon.d.ts.map +1 -0
- package/lib/typescript/icons/DuoIcon.d.ts +5 -0
- package/lib/typescript/icons/DuoIcon.d.ts.map +1 -0
- package/lib/typescript/icons/HomeIcon.d.ts +5 -0
- package/lib/typescript/icons/HomeIcon.d.ts.map +1 -0
- package/lib/typescript/icons/HomeIconOutlined.d.ts +5 -0
- package/lib/typescript/icons/HomeIconOutlined.d.ts.map +1 -0
- package/lib/typescript/icons/LogoIcon.d.ts +5 -0
- package/lib/typescript/icons/LogoIcon.d.ts.map +1 -0
- package/lib/typescript/icons/MoneyReceiveIcon.d.ts +5 -0
- package/lib/typescript/icons/MoneyReceiveIcon.d.ts.map +1 -0
- package/lib/typescript/icons/OdooIcon.d.ts +7 -0
- package/lib/typescript/icons/OdooIcon.d.ts.map +1 -0
- package/lib/typescript/icons/PinIcon.d.ts +5 -0
- package/lib/typescript/icons/PinIcon.d.ts.map +1 -0
- package/lib/typescript/icons/PrinterIcon.d.ts +5 -0
- package/lib/typescript/icons/PrinterIcon.d.ts.map +1 -0
- package/lib/typescript/icons/ProfileIcon.d.ts +5 -0
- package/lib/typescript/icons/ProfileIcon.d.ts.map +1 -0
- package/lib/typescript/icons/SettingsIcon.d.ts +5 -0
- package/lib/typescript/icons/SettingsIcon.d.ts.map +1 -0
- package/lib/typescript/icons/SinpeIcon.d.ts +5 -0
- package/lib/typescript/icons/SinpeIcon.d.ts.map +1 -0
- package/lib/typescript/icons/ToggleOffIcon.d.ts +5 -0
- package/lib/typescript/icons/ToggleOffIcon.d.ts.map +1 -0
- package/lib/typescript/icons/WalletMoneyIcon.d.ts +5 -0
- package/lib/typescript/icons/WalletMoneyIcon.d.ts.map +1 -0
- package/lib/typescript/icons/icon_getters.d.ts +7 -0
- package/lib/typescript/icons/icon_getters.d.ts.map +1 -0
- package/lib/typescript/icons/props.d.ts +5 -0
- package/lib/typescript/icons/props.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +21 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/layouts/AuthContainer.d.ts +10 -0
- package/lib/typescript/layouts/AuthContainer.d.ts.map +1 -0
- package/lib/typescript/layouts/Container.d.ts +15 -0
- package/lib/typescript/layouts/Container.d.ts.map +1 -0
- package/lib/typescript/layouts/GradientContainer.d.ts +9 -0
- package/lib/typescript/layouts/GradientContainer.d.ts.map +1 -0
- package/lib/typescript/layouts/PlainLayout.d.ts +7 -0
- package/lib/typescript/layouts/PlainLayout.d.ts.map +1 -0
- package/lib/typescript/layouts/ScrollContainer.d.ts +9 -0
- package/lib/typescript/layouts/ScrollContainer.d.ts.map +1 -0
- package/lib/typescript/layouts/TabNavigatorLayout.d.ts +27 -0
- package/lib/typescript/layouts/TabNavigatorLayout.d.ts.map +1 -0
- package/lib/typescript/lib/date.d.ts +71 -0
- package/lib/typescript/lib/date.d.ts.map +1 -0
- package/lib/typescript/lib/icon.d.ts +2 -0
- package/lib/typescript/lib/icon.d.ts.map +1 -0
- package/lib/typescript/lib/monetary.d.ts +4 -0
- package/lib/typescript/lib/monetary.d.ts.map +1 -0
- package/lib/typescript/lib/quantity.d.ts +12 -0
- package/lib/typescript/lib/quantity.d.ts.map +1 -0
- package/lib/typescript/lib/serializer.d.ts +3 -0
- package/lib/typescript/lib/serializer.d.ts.map +1 -0
- package/lib/typescript/lib/timezone.d.ts +5 -0
- package/lib/typescript/lib/timezone.d.ts.map +1 -0
- package/lib/typescript/notifications/index.d.ts +2 -0
- package/lib/typescript/notifications/index.d.ts.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/primitives/BaseButton.d.ts +147 -0
- package/lib/typescript/primitives/BaseButton.d.ts.map +1 -0
- package/lib/typescript/primitives/Box.d.ts +8 -0
- package/lib/typescript/primitives/Box.d.ts.map +1 -0
- package/lib/typescript/primitives/Row.d.ts +12 -0
- package/lib/typescript/primitives/Row.d.ts.map +1 -0
- package/lib/typescript/primitives/Stack.d.ts +10 -0
- package/lib/typescript/primitives/Stack.d.ts.map +1 -0
- package/lib/typescript/primitives/index.d.ts +4 -0
- package/lib/typescript/primitives/index.d.ts.map +1 -0
- package/lib/typescript/providers/index.d.ts +1 -0
- package/lib/typescript/providers/index.d.ts.map +1 -0
- package/lib/typescript/theme/active.d.ts +4 -0
- package/lib/typescript/theme/active.d.ts.map +1 -0
- package/lib/typescript/theme/components/ThemedActivityIndicator.d.ts +22 -0
- package/lib/typescript/theme/components/ThemedActivityIndicator.d.ts.map +1 -0
- package/lib/typescript/theme/components/index.d.ts +10 -0
- package/lib/typescript/theme/components/index.d.ts.map +1 -0
- package/lib/typescript/theme/default.d.ts +3 -0
- package/lib/typescript/theme/default.d.ts.map +1 -0
- package/lib/typescript/theme/index.d.ts +5 -0
- package/lib/typescript/theme/index.d.ts.map +1 -0
- package/lib/typescript/theme/theme.d.ts +14 -0
- package/lib/typescript/theme/theme.d.ts.map +1 -0
- package/lib/typescript/theme/tw.d.ts +11 -0
- package/lib/typescript/theme/tw.d.ts.map +1 -0
- package/lib/typescript/theme/types.d.ts +93 -0
- package/lib/typescript/theme/types.d.ts.map +1 -0
- package/lib/typescript/theme/typography.d.ts +377 -0
- package/lib/typescript/theme/typography.d.ts.map +1 -0
- package/lib/typescript/theme/useTheme.d.ts +2 -0
- package/lib/typescript/theme/useTheme.d.ts.map +1 -0
- package/lib/typescript/views/AuthFormView.d.ts +10 -0
- package/lib/typescript/views/AuthFormView.d.ts.map +1 -0
- package/lib/typescript/views/FormViewV2.context.d.ts +33 -0
- package/lib/typescript/views/FormViewV2.context.d.ts.map +1 -0
- package/lib/typescript/views/FormViewV2.d.ts +61 -0
- package/lib/typescript/views/FormViewV2.d.ts.map +1 -0
- package/lib/typescript/views/ListViewV2.context.d.ts +37 -0
- package/lib/typescript/views/ListViewV2.context.d.ts.map +1 -0
- package/lib/typescript/views/ListViewV2.d.ts +132 -0
- package/lib/typescript/views/ListViewV2.d.ts.map +1 -0
- package/lib/typescript/views/Wizard/Wizard.context.d.ts +27 -0
- package/lib/typescript/views/Wizard/Wizard.context.d.ts.map +1 -0
- package/lib/typescript/views/Wizard/Wizard.d.ts +34 -0
- package/lib/typescript/views/Wizard/Wizard.d.ts.map +1 -0
- package/lib/typescript/views/Wizard/index.d.ts +5 -0
- package/lib/typescript/views/Wizard/index.d.ts.map +1 -0
- package/lib/typescript/views/types/IFormView.d.ts +23 -0
- package/lib/typescript/views/types/IFormView.d.ts.map +1 -0
- package/lib/typescript/views/types/IListView.d.ts +35 -0
- package/lib/typescript/views/types/IListView.d.ts.map +1 -0
- package/lib/typescript/views/types/UIItem.d.ts +22 -0
- package/lib/typescript/views/types/UIItem.d.ts.map +1 -0
- package/lib/typescript/widgets/CircleButton.d.ts +16 -0
- package/lib/typescript/widgets/CircleButton.d.ts.map +1 -0
- package/lib/typescript/widgets/GeoPermissionCard.d.ts +9 -0
- package/lib/typescript/widgets/GeoPermissionCard.d.ts.map +1 -0
- package/lib/typescript/widgets/HomeHeader.d.ts +10 -0
- package/lib/typescript/widgets/HomeHeader.d.ts.map +1 -0
- package/lib/typescript/widgets/JSONViewer.d.ts +6 -0
- package/lib/typescript/widgets/JSONViewer.d.ts.map +1 -0
- package/lib/typescript/widgets/MenuCard.d.ts +14 -0
- package/lib/typescript/widgets/MenuCard.d.ts.map +1 -0
- package/lib/typescript/widgets/MenuGrid.d.ts +18 -0
- package/lib/typescript/widgets/MenuGrid.d.ts.map +1 -0
- package/lib/typescript/widgets/ScreenHeader.d.ts +20 -0
- package/lib/typescript/widgets/ScreenHeader.d.ts.map +1 -0
- package/lib/typescript/widgets/TimeZoneSelector.d.ts +8 -0
- package/lib/typescript/widgets/TimeZoneSelector.d.ts.map +1 -0
- package/lib/typescript/widgets/TimeZoneSelectorModal.d.ts +10 -0
- package/lib/typescript/widgets/TimeZoneSelectorModal.d.ts.map +1 -0
- package/lib/typescript/widgets/index.d.ts +8 -0
- package/lib/typescript/widgets/index.d.ts.map +1 -0
- package/package.json +273 -0
- package/sincpro_mobile_ui/Dialog/BottomSheet/BottomSheet.Root.tsx +509 -0
- package/sincpro_mobile_ui/Dialog/BottomSheet/index.ts +1 -0
- package/sincpro_mobile_ui/Dialog/Confirmation.context.tsx +148 -0
- package/sincpro_mobile_ui/Dialog/Dialog.Confirmation.tsx +68 -0
- package/sincpro_mobile_ui/Dialog/Dialog.EditValue.tsx +134 -0
- package/sincpro_mobile_ui/Dialog/index.ts +23 -0
- package/sincpro_mobile_ui/Display/Display.Avatar.tsx +60 -0
- package/sincpro_mobile_ui/Display/Display.Badge.tsx +72 -0
- package/sincpro_mobile_ui/Display/Display.CopyableText.tsx +38 -0
- package/sincpro_mobile_ui/Display/Display.CountRecords.tsx +26 -0
- package/sincpro_mobile_ui/Display/Display.Date.tsx +59 -0
- package/sincpro_mobile_ui/Display/Display.Divider.tsx +40 -0
- package/sincpro_mobile_ui/Display/Display.Icon.tsx +69 -0
- package/sincpro_mobile_ui/Display/Display.Logo.tsx +51 -0
- package/sincpro_mobile_ui/Display/Display.MenuButton.tsx +103 -0
- package/sincpro_mobile_ui/Display/Display.Monetary.tsx +60 -0
- package/sincpro_mobile_ui/Display/index.ts +28 -0
- package/sincpro_mobile_ui/Feedback/ErrorBoundary.tsx +51 -0
- package/sincpro_mobile_ui/Feedback/Feedback.DomainSplashScreen.tsx +135 -0
- package/sincpro_mobile_ui/Feedback/Feedback.Empty.tsx +29 -0
- package/sincpro_mobile_ui/Feedback/Feedback.Error.tsx +47 -0
- package/sincpro_mobile_ui/Feedback/Feedback.Loading.tsx +27 -0
- package/sincpro_mobile_ui/Feedback/Feedback.Spinner.tsx +34 -0
- package/sincpro_mobile_ui/Feedback/Feedback.Splash.tsx +68 -0
- package/sincpro_mobile_ui/Feedback/index.ts +17 -0
- package/sincpro_mobile_ui/Form/Form.Button.tsx +461 -0
- package/sincpro_mobile_ui/Form/Form.Checkbox.tsx +89 -0
- package/sincpro_mobile_ui/Form/Form.ControlledCheckbox.tsx +34 -0
- package/sincpro_mobile_ui/Form/Form.ControlledDropdown.tsx +22 -0
- package/sincpro_mobile_ui/Form/Form.ControlledInput.tsx +53 -0
- package/sincpro_mobile_ui/Form/Form.ControlledMonetaryInput.tsx +41 -0
- package/sincpro_mobile_ui/Form/Form.ControlledRadioButton.tsx +33 -0
- package/sincpro_mobile_ui/Form/Form.Dropdown.tsx +171 -0
- package/sincpro_mobile_ui/Form/Form.FilterButton.tsx +59 -0
- package/sincpro_mobile_ui/Form/Form.FractionalQuantityInput.tsx +190 -0
- package/sincpro_mobile_ui/Form/Form.IconButton.tsx +102 -0
- package/sincpro_mobile_ui/Form/Form.Input.tsx +88 -0
- package/sincpro_mobile_ui/Form/Form.InputField.tsx +66 -0
- package/sincpro_mobile_ui/Form/Form.MonetaryInput.tsx +66 -0
- package/sincpro_mobile_ui/Form/Form.PasswordInput.tsx +42 -0
- package/sincpro_mobile_ui/Form/Form.QuantitySelector.tsx +81 -0
- package/sincpro_mobile_ui/Form/Form.RadioButton.tsx +52 -0
- package/sincpro_mobile_ui/Form/Form.SearchBar.tsx +64 -0
- package/sincpro_mobile_ui/Form/Form.TextInput.tsx +26 -0
- package/sincpro_mobile_ui/Form/index.ts +46 -0
- package/sincpro_mobile_ui/Navigation/Navigation.Header.tsx +50 -0
- package/sincpro_mobile_ui/Navigation/Navigation.HeaderToolbar.tsx +111 -0
- package/sincpro_mobile_ui/Navigation/Navigation.RowItem.tsx +33 -0
- package/sincpro_mobile_ui/Navigation/Navigation.TabIcon.tsx +45 -0
- package/sincpro_mobile_ui/Navigation/Navigation.TabItem.tsx +43 -0
- package/sincpro_mobile_ui/Navigation/index.ts +15 -0
- package/sincpro_mobile_ui/Typography/Typography.Heading.tsx +20 -0
- package/sincpro_mobile_ui/Typography/Typography.Text.tsx +78 -0
- package/sincpro_mobile_ui/Typography/index.ts +11 -0
- package/sincpro_mobile_ui/icons/AddItemIcon.tsx +46 -0
- package/sincpro_mobile_ui/icons/ArrangeCircle.tsx +50 -0
- package/sincpro_mobile_ui/icons/ArrowDownIcon.tsx +33 -0
- package/sincpro_mobile_ui/icons/ArrowUpIcon.tsx +33 -0
- package/sincpro_mobile_ui/icons/BoxIcon.tsx +32 -0
- package/sincpro_mobile_ui/icons/BoxTimeIcon.tsx +27 -0
- package/sincpro_mobile_ui/icons/CalendarIcon.tsx +85 -0
- package/sincpro_mobile_ui/icons/CardIcon.tsx +44 -0
- package/sincpro_mobile_ui/icons/CashierIcon.tsx +15 -0
- package/sincpro_mobile_ui/icons/CreditIcon.tsx +44 -0
- package/sincpro_mobile_ui/icons/DuoIcon.tsx +39 -0
- package/sincpro_mobile_ui/icons/HomeIcon.tsx +15 -0
- package/sincpro_mobile_ui/icons/HomeIconOutlined.tsx +24 -0
- package/sincpro_mobile_ui/icons/LogoIcon.tsx +39 -0
- package/sincpro_mobile_ui/icons/MoneyReceiveIcon.tsx +46 -0
- package/sincpro_mobile_ui/icons/OdooIcon.tsx +23 -0
- package/sincpro_mobile_ui/icons/PinIcon.tsx +15 -0
- package/sincpro_mobile_ui/icons/PrinterIcon.tsx +46 -0
- package/sincpro_mobile_ui/icons/ProfileIcon.tsx +19 -0
- package/sincpro_mobile_ui/icons/SettingsIcon.tsx +66 -0
- package/sincpro_mobile_ui/icons/SinpeIcon.tsx +29 -0
- package/sincpro_mobile_ui/icons/ToggleOffIcon.tsx +25 -0
- package/sincpro_mobile_ui/icons/WalletMoneyIcon.tsx +41 -0
- package/sincpro_mobile_ui/icons/icon_getters.tsx +27 -0
- package/sincpro_mobile_ui/icons/props.ts +4 -0
- package/sincpro_mobile_ui/index.ts +38 -0
- package/sincpro_mobile_ui/layouts/AuthContainer.tsx +73 -0
- package/sincpro_mobile_ui/layouts/Container.tsx +40 -0
- package/sincpro_mobile_ui/layouts/GradientContainer.tsx +22 -0
- package/sincpro_mobile_ui/layouts/PlainLayout.tsx +14 -0
- package/sincpro_mobile_ui/layouts/ScrollContainer.tsx +37 -0
- package/sincpro_mobile_ui/layouts/TabNavigatorLayout.tsx +154 -0
- package/sincpro_mobile_ui/lib/date.ts +149 -0
- package/sincpro_mobile_ui/lib/icon.ts +10 -0
- package/sincpro_mobile_ui/lib/monetary.ts +33 -0
- package/sincpro_mobile_ui/lib/quantity.ts +52 -0
- package/sincpro_mobile_ui/lib/serializer.ts +59 -0
- package/sincpro_mobile_ui/lib/timezone.ts +4 -0
- package/sincpro_mobile_ui/nativewind-env.d.ts +1 -0
- package/sincpro_mobile_ui/notifications/index.ts +2 -0
- package/sincpro_mobile_ui/primitives/BaseButton.tsx +404 -0
- package/sincpro_mobile_ui/primitives/Box.tsx +14 -0
- package/sincpro_mobile_ui/primitives/Row.tsx +55 -0
- package/sincpro_mobile_ui/primitives/Stack.tsx +29 -0
- package/sincpro_mobile_ui/primitives/index.ts +3 -0
- package/sincpro_mobile_ui/providers/index.ts +1 -0
- package/sincpro_mobile_ui/theme/active.ts +12 -0
- package/sincpro_mobile_ui/theme/components/ThemedActivityIndicator.tsx +29 -0
- package/sincpro_mobile_ui/theme/components/index.ts +10 -0
- package/sincpro_mobile_ui/theme/default.ts +81 -0
- package/sincpro_mobile_ui/theme/globals.css +67 -0
- package/sincpro_mobile_ui/theme/index.ts +4 -0
- package/sincpro_mobile_ui/theme/theme.ts +16 -0
- package/sincpro_mobile_ui/theme/tw.ts +16 -0
- package/sincpro_mobile_ui/theme/types.ts +109 -0
- package/sincpro_mobile_ui/theme/typography.ts +271 -0
- package/sincpro_mobile_ui/theme/useTheme.ts +3 -0
- package/sincpro_mobile_ui/views/AuthFormView.tsx +46 -0
- package/sincpro_mobile_ui/views/FormViewV2.context.tsx +79 -0
- package/sincpro_mobile_ui/views/FormViewV2.tsx +248 -0
- package/sincpro_mobile_ui/views/ListViewV2.context.tsx +87 -0
- package/sincpro_mobile_ui/views/ListViewV2.tsx +575 -0
- package/sincpro_mobile_ui/views/Wizard/Wizard.context.tsx +164 -0
- package/sincpro_mobile_ui/views/Wizard/Wizard.tsx +147 -0
- package/sincpro_mobile_ui/views/Wizard/index.ts +11 -0
- package/sincpro_mobile_ui/views/types/IFormView.ts +24 -0
- package/sincpro_mobile_ui/views/types/IListView.ts +78 -0
- package/sincpro_mobile_ui/views/types/UIItem.ts +23 -0
- package/sincpro_mobile_ui/widgets/CircleButton.tsx +63 -0
- package/sincpro_mobile_ui/widgets/GeoPermissionCard.tsx +62 -0
- package/sincpro_mobile_ui/widgets/HomeHeader.tsx +50 -0
- package/sincpro_mobile_ui/widgets/JSONViewer.tsx +192 -0
- package/sincpro_mobile_ui/widgets/MenuCard.tsx +37 -0
- package/sincpro_mobile_ui/widgets/MenuGrid.tsx +33 -0
- package/sincpro_mobile_ui/widgets/ScreenHeader.tsx +72 -0
- package/sincpro_mobile_ui/widgets/TimeZoneSelector.tsx +83 -0
- package/sincpro_mobile_ui/widgets/TimeZoneSelectorModal.tsx +179 -0
- package/sincpro_mobile_ui/widgets/index.ts +7 -0
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
import { createContext, type ReactNode, useContext, useEffect, useRef } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Animated,
|
|
4
|
+
Dimensions,
|
|
5
|
+
type GestureResponderHandlers,
|
|
6
|
+
Modal,
|
|
7
|
+
PanResponder,
|
|
8
|
+
Pressable,
|
|
9
|
+
ScrollView,
|
|
10
|
+
Text,
|
|
11
|
+
View,
|
|
12
|
+
} from "react-native";
|
|
13
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
14
|
+
|
|
15
|
+
import { theme } from "../../theme";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Available sizes for the BottomSheet.
|
|
19
|
+
* - `auto`: Fits content height (max 90% screen)
|
|
20
|
+
* - `small`: 30% of screen height
|
|
21
|
+
* - `medium`: 50% of screen height
|
|
22
|
+
* - `large`: 75% of screen height
|
|
23
|
+
* - `full`: 90% of screen height
|
|
24
|
+
*/
|
|
25
|
+
type BottomSheetSize = "auto" | "small" | "medium" | "large" | "full";
|
|
26
|
+
|
|
27
|
+
export interface BottomSheetContextValue {
|
|
28
|
+
close: () => void;
|
|
29
|
+
panHandlers: GestureResponderHandlers;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const BottomSheetContext = createContext<BottomSheetContextValue | null>(null);
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Hook to access BottomSheet context from compound components.
|
|
36
|
+
* Provides `close()` function and `panHandlers` for gesture support.
|
|
37
|
+
*
|
|
38
|
+
* @throws Error if used outside BottomSheet.Root
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* function CustomHeader() {
|
|
43
|
+
* const { close, panHandlers } = BottomSheet.useBottomSheet();
|
|
44
|
+
* return (
|
|
45
|
+
* <View {...panHandlers}>
|
|
46
|
+
* <Button onPress={close} title="Close" />
|
|
47
|
+
* </View>
|
|
48
|
+
* );
|
|
49
|
+
* }
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
function useBottomSheet() {
|
|
53
|
+
const context = useContext(BottomSheetContext);
|
|
54
|
+
if (!context) {
|
|
55
|
+
throw new Error("BottomSheet compound components must be used within BottomSheet.Root");
|
|
56
|
+
}
|
|
57
|
+
return context;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface RootProps {
|
|
61
|
+
visible: boolean;
|
|
62
|
+
onClose: () => void;
|
|
63
|
+
size?: BottomSheetSize;
|
|
64
|
+
dismissible?: boolean;
|
|
65
|
+
children: ReactNode;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const SIZE_MAP: Record<BottomSheetSize, number> = {
|
|
69
|
+
auto: 0,
|
|
70
|
+
small: 0.3,
|
|
71
|
+
medium: 0.5,
|
|
72
|
+
large: 0.75,
|
|
73
|
+
full: 0.9,
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Root container for the BottomSheet modal with swipe-to-dismiss gesture support.
|
|
78
|
+
*
|
|
79
|
+
* Features:
|
|
80
|
+
* - Spring animation on open/close
|
|
81
|
+
* - Swipe down to dismiss (configurable)
|
|
82
|
+
* - Backdrop tap to dismiss (configurable)
|
|
83
|
+
* - Safe area insets handling
|
|
84
|
+
* - Configurable sizes
|
|
85
|
+
*
|
|
86
|
+
* @param visible - Controls visibility of the bottom sheet
|
|
87
|
+
* @param onClose - Callback when sheet is dismissed (swipe, backdrop tap, or programmatic)
|
|
88
|
+
* @param size - Height preset: 'auto' | 'small' | 'medium' | 'large' | 'full'
|
|
89
|
+
* @param dismissible - If false, disables swipe and backdrop dismiss (default: true)
|
|
90
|
+
* @param children - Compound components (Header, Content, Actions, etc.)
|
|
91
|
+
*
|
|
92
|
+
* @example Basic usage with Header and Content
|
|
93
|
+
* ```tsx
|
|
94
|
+
* <BottomSheet.Root visible={isOpen} onClose={() => setIsOpen(false)}>
|
|
95
|
+
* <BottomSheet.Header>
|
|
96
|
+
* <BottomSheet.Title>Select Option</BottomSheet.Title>
|
|
97
|
+
* </BottomSheet.Header>
|
|
98
|
+
* <BottomSheet.Content>
|
|
99
|
+
* <Text>Your content here</Text>
|
|
100
|
+
* </BottomSheet.Content>
|
|
101
|
+
* </BottomSheet.Root>
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* @example With Actions footer
|
|
105
|
+
* ```tsx
|
|
106
|
+
* <BottomSheet.Root visible={isOpen} onClose={close} size="medium">
|
|
107
|
+
* <BottomSheet.Header>
|
|
108
|
+
* <BottomSheet.Title subtitle="Choose one">Options</BottomSheet.Title>
|
|
109
|
+
* </BottomSheet.Header>
|
|
110
|
+
* <BottomSheet.Content scrollable>
|
|
111
|
+
* {items.map(item => <ItemRow key={item.id} item={item} />)}
|
|
112
|
+
* </BottomSheet.Content>
|
|
113
|
+
* <BottomSheet.Actions layout="horizontal">
|
|
114
|
+
* <Button title="Cancel" onPress={close} />
|
|
115
|
+
* <Button title="Confirm" onPress={handleConfirm} />
|
|
116
|
+
* </BottomSheet.Actions>
|
|
117
|
+
* </BottomSheet.Root>
|
|
118
|
+
* ```
|
|
119
|
+
*
|
|
120
|
+
* @example Non-dismissible (must use button to close)
|
|
121
|
+
* ```tsx
|
|
122
|
+
* <BottomSheet.Root visible={isOpen} onClose={close} dismissible={false}>
|
|
123
|
+
* <BottomSheet.Content>
|
|
124
|
+
* <Text>You must tap the button to close</Text>
|
|
125
|
+
* <Button title="Close" onPress={close} />
|
|
126
|
+
* </BottomSheet.Content>
|
|
127
|
+
* </BottomSheet.Root>
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
function Root({ visible, onClose, size = "auto", dismissible = true, children }: RootProps) {
|
|
131
|
+
const insets = useSafeAreaInsets();
|
|
132
|
+
const screenHeight = Dimensions.get("window").height;
|
|
133
|
+
const translateY = useRef(new Animated.Value(screenHeight)).current;
|
|
134
|
+
|
|
135
|
+
const maxHeight = size === "auto" ? screenHeight * 0.9 : screenHeight * SIZE_MAP[size];
|
|
136
|
+
const minHeight = size === "auto" ? 0 : screenHeight * SIZE_MAP[size];
|
|
137
|
+
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
if (visible) {
|
|
140
|
+
Animated.spring(translateY, {
|
|
141
|
+
toValue: 0,
|
|
142
|
+
useNativeDriver: true,
|
|
143
|
+
damping: 20,
|
|
144
|
+
stiffness: 300,
|
|
145
|
+
}).start();
|
|
146
|
+
} else {
|
|
147
|
+
translateY.setValue(screenHeight);
|
|
148
|
+
}
|
|
149
|
+
}, [visible, screenHeight, translateY]);
|
|
150
|
+
|
|
151
|
+
const panResponder = useRef(
|
|
152
|
+
PanResponder.create({
|
|
153
|
+
onStartShouldSetPanResponder: () => dismissible,
|
|
154
|
+
onMoveShouldSetPanResponder: (_, gestureState) => {
|
|
155
|
+
return dismissible && Math.abs(gestureState.dy) > 10;
|
|
156
|
+
},
|
|
157
|
+
onPanResponderMove: (_, gestureState) => {
|
|
158
|
+
if (gestureState.dy > 0) {
|
|
159
|
+
translateY.setValue(gestureState.dy);
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
onPanResponderRelease: (_, gestureState) => {
|
|
163
|
+
if (gestureState.dy > 100 || gestureState.vy > 0.5) {
|
|
164
|
+
Animated.timing(translateY, {
|
|
165
|
+
toValue: screenHeight,
|
|
166
|
+
duration: 200,
|
|
167
|
+
useNativeDriver: true,
|
|
168
|
+
}).start(() => onClose());
|
|
169
|
+
} else {
|
|
170
|
+
Animated.spring(translateY, {
|
|
171
|
+
toValue: 0,
|
|
172
|
+
useNativeDriver: true,
|
|
173
|
+
damping: 20,
|
|
174
|
+
stiffness: 300,
|
|
175
|
+
}).start();
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
}),
|
|
179
|
+
).current;
|
|
180
|
+
|
|
181
|
+
function handleBackdropPress() {
|
|
182
|
+
if (dismissible) {
|
|
183
|
+
Animated.timing(translateY, {
|
|
184
|
+
toValue: screenHeight,
|
|
185
|
+
duration: 200,
|
|
186
|
+
useNativeDriver: true,
|
|
187
|
+
}).start(() => onClose());
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const contextValue: BottomSheetContextValue = {
|
|
192
|
+
close: onClose,
|
|
193
|
+
panHandlers: panResponder.panHandlers,
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
return (
|
|
197
|
+
<Modal
|
|
198
|
+
animationType="fade"
|
|
199
|
+
onRequestClose={onClose}
|
|
200
|
+
presentationStyle="overFullScreen"
|
|
201
|
+
transparent
|
|
202
|
+
visible={visible}
|
|
203
|
+
>
|
|
204
|
+
<View className="flex-1 bg-black/50">
|
|
205
|
+
<Pressable className="flex-1" onPress={handleBackdropPress} />
|
|
206
|
+
|
|
207
|
+
<Animated.View
|
|
208
|
+
className="rounded-t-3xl overflow-hidden"
|
|
209
|
+
style={{
|
|
210
|
+
backgroundColor: theme.bg.popover,
|
|
211
|
+
maxHeight,
|
|
212
|
+
minHeight: minHeight || undefined,
|
|
213
|
+
paddingBottom: insets.bottom,
|
|
214
|
+
transform: [{ translateY }],
|
|
215
|
+
}}
|
|
216
|
+
>
|
|
217
|
+
<BottomSheetContext.Provider value={contextValue}>
|
|
218
|
+
{children}
|
|
219
|
+
</BottomSheetContext.Provider>
|
|
220
|
+
</Animated.View>
|
|
221
|
+
</View>
|
|
222
|
+
</Modal>
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export interface HandleProps {
|
|
227
|
+
children?: ReactNode;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Standalone drag handle for minimal bottom sheets without a header.
|
|
232
|
+
* Includes the visual "pill" indicator and swipe gesture support.
|
|
233
|
+
*
|
|
234
|
+
* Use this when you want a simple drag indicator without a full header.
|
|
235
|
+
* For sheets with titles, use `BottomSheet.Header` instead.
|
|
236
|
+
*
|
|
237
|
+
* @param children - Optional content below the handle pill
|
|
238
|
+
*
|
|
239
|
+
* @example Minimal sheet with just a handle
|
|
240
|
+
* ```tsx
|
|
241
|
+
* <BottomSheet.Root visible={isOpen} onClose={close}>
|
|
242
|
+
* <BottomSheet.Handle />
|
|
243
|
+
* <BottomSheet.Content>
|
|
244
|
+
* <Text>Simple content</Text>
|
|
245
|
+
* </BottomSheet.Content>
|
|
246
|
+
* </BottomSheet.Root>
|
|
247
|
+
* ```
|
|
248
|
+
*/
|
|
249
|
+
function Handle({ children }: HandleProps) {
|
|
250
|
+
const { panHandlers } = useBottomSheet();
|
|
251
|
+
|
|
252
|
+
return (
|
|
253
|
+
<View {...panHandlers} className="items-center pt-3 pb-2">
|
|
254
|
+
<View className="w-10 h-1 bg-border-light rounded-full mb-2" />
|
|
255
|
+
{children}
|
|
256
|
+
</View>
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export interface HeaderProps {
|
|
261
|
+
children: ReactNode;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Header section with integrated drag handle and bottom border.
|
|
266
|
+
* Automatically includes the drag pill indicator and gesture support.
|
|
267
|
+
*
|
|
268
|
+
* Use with `BottomSheet.Title` for consistent styling, or provide custom content.
|
|
269
|
+
*
|
|
270
|
+
* @param children - Header content (typically BottomSheet.Title or custom layout)
|
|
271
|
+
*
|
|
272
|
+
* @example With Title component
|
|
273
|
+
* ```tsx
|
|
274
|
+
* <BottomSheet.Header>
|
|
275
|
+
* <BottomSheet.Title subtitle="Select your preference">
|
|
276
|
+
* Settings
|
|
277
|
+
* </BottomSheet.Title>
|
|
278
|
+
* </BottomSheet.Header>
|
|
279
|
+
* ```
|
|
280
|
+
*
|
|
281
|
+
* @example Custom header content
|
|
282
|
+
* ```tsx
|
|
283
|
+
* <BottomSheet.Header>
|
|
284
|
+
* <View className="flex-row justify-between px-4 py-2">
|
|
285
|
+
* <Text>Custom Title</Text>
|
|
286
|
+
* <TouchableOpacity onPress={close}>
|
|
287
|
+
* <Icon name="close" />
|
|
288
|
+
* </TouchableOpacity>
|
|
289
|
+
* </View>
|
|
290
|
+
* </BottomSheet.Header>
|
|
291
|
+
* ```
|
|
292
|
+
*/
|
|
293
|
+
function Header({ children }: HeaderProps) {
|
|
294
|
+
const { panHandlers } = useBottomSheet();
|
|
295
|
+
|
|
296
|
+
return (
|
|
297
|
+
<View {...panHandlers} className="border-b border-border-light">
|
|
298
|
+
<View className="items-center pt-3 pb-1">
|
|
299
|
+
<View className="w-10 h-1 bg-border-divider rounded-full" />
|
|
300
|
+
</View>
|
|
301
|
+
{children}
|
|
302
|
+
</View>
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export interface TitleProps {
|
|
307
|
+
children: ReactNode;
|
|
308
|
+
subtitle?: string;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Title component for use inside BottomSheet.Header.
|
|
313
|
+
* Provides consistent text styling with optional subtitle.
|
|
314
|
+
*
|
|
315
|
+
* @param children - Main title text (typically a string or Text component)
|
|
316
|
+
* @param subtitle - Optional secondary text below the title
|
|
317
|
+
*
|
|
318
|
+
* @example Simple title
|
|
319
|
+
* ```tsx
|
|
320
|
+
* <BottomSheet.Title>Select Device</BottomSheet.Title>
|
|
321
|
+
* ```
|
|
322
|
+
*
|
|
323
|
+
* @example Title with subtitle
|
|
324
|
+
* ```tsx
|
|
325
|
+
* <BottomSheet.Title subtitle="Choose from available devices">
|
|
326
|
+
* Bluetooth Printer
|
|
327
|
+
* </BottomSheet.Title>
|
|
328
|
+
* ```
|
|
329
|
+
*/
|
|
330
|
+
function Title({ children, subtitle }: TitleProps) {
|
|
331
|
+
return (
|
|
332
|
+
<View className="px-5 py-3">
|
|
333
|
+
<Text className="text-lg font-semibold text-text-primary">{children}</Text>
|
|
334
|
+
{subtitle && <Text className="text-sm text-text-secondary mt-1">{subtitle}</Text>}
|
|
335
|
+
</View>
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export interface ContentProps {
|
|
340
|
+
children: ReactNode;
|
|
341
|
+
scrollable?: boolean;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Main content area for the bottom sheet.
|
|
346
|
+
* Can be static or scrollable depending on content needs.
|
|
347
|
+
*
|
|
348
|
+
* @param children - Content to display
|
|
349
|
+
* @param scrollable - Enable ScrollView wrapper for long content (default: false)
|
|
350
|
+
*
|
|
351
|
+
* @example Static content
|
|
352
|
+
* ```tsx
|
|
353
|
+
* <BottomSheet.Content>
|
|
354
|
+
* <View className="p-4">
|
|
355
|
+
* <Text>Short content that fits</Text>
|
|
356
|
+
* </View>
|
|
357
|
+
* </BottomSheet.Content>
|
|
358
|
+
* ```
|
|
359
|
+
*
|
|
360
|
+
* @example Scrollable list
|
|
361
|
+
* ```tsx
|
|
362
|
+
* <BottomSheet.Content scrollable>
|
|
363
|
+
* {items.map(item => (
|
|
364
|
+
* <TouchableOpacity key={item.id} onPress={() => onSelect(item)}>
|
|
365
|
+
* <Text>{item.name}</Text>
|
|
366
|
+
* </TouchableOpacity>
|
|
367
|
+
* ))}
|
|
368
|
+
* </BottomSheet.Content>
|
|
369
|
+
* ```
|
|
370
|
+
*/
|
|
371
|
+
function Content({ children, scrollable = false }: ContentProps) {
|
|
372
|
+
if (scrollable) {
|
|
373
|
+
return (
|
|
374
|
+
<ScrollView bounces={false} className="flex-1" showsVerticalScrollIndicator={false}>
|
|
375
|
+
{children}
|
|
376
|
+
</ScrollView>
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
return <View className="flex-1">{children}</View>;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
export interface ActionsProps {
|
|
384
|
+
children: ReactNode;
|
|
385
|
+
layout?: "auto" | "horizontal" | "vertical";
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Action buttons section with top border, typically at the bottom of the sheet.
|
|
390
|
+
* Use for confirm/cancel buttons or multiple action options.
|
|
391
|
+
*
|
|
392
|
+
* @param children - Button components
|
|
393
|
+
* @param layout - Button arrangement: 'auto' | 'horizontal' | 'vertical' (default: 'auto')
|
|
394
|
+
*
|
|
395
|
+
* @example Vertical buttons (default)
|
|
396
|
+
* ```tsx
|
|
397
|
+
* <BottomSheet.Actions>
|
|
398
|
+
* <Button title="Option 1" onPress={handleOption1} />
|
|
399
|
+
* <Button title="Option 2" onPress={handleOption2} />
|
|
400
|
+
* <Button title="Cancel" variant="outline" onPress={close} />
|
|
401
|
+
* </BottomSheet.Actions>
|
|
402
|
+
* ```
|
|
403
|
+
*
|
|
404
|
+
* @example Horizontal buttons (confirm/cancel pattern)
|
|
405
|
+
* ```tsx
|
|
406
|
+
* <BottomSheet.Actions layout="horizontal">
|
|
407
|
+
* <Button title="Cancel" variant="outline" onPress={close} flex={1} />
|
|
408
|
+
* <Button title="Confirm" variant="primary" onPress={confirm} flex={1} />
|
|
409
|
+
* </BottomSheet.Actions>
|
|
410
|
+
* ```
|
|
411
|
+
*/
|
|
412
|
+
function Actions({ children, layout = "auto" }: ActionsProps) {
|
|
413
|
+
const containerClass = layout === "horizontal" ? "flex-row gap-3" : "gap-3";
|
|
414
|
+
|
|
415
|
+
return (
|
|
416
|
+
<View className="px-5 py-4 border-t border-border-light">
|
|
417
|
+
<View className={containerClass}>{children}</View>
|
|
418
|
+
</View>
|
|
419
|
+
);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
export interface FooterProps {
|
|
423
|
+
children: ReactNode;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Footer section with gray background, for secondary information or status.
|
|
428
|
+
* Different from Actions - use Footer for non-interactive content.
|
|
429
|
+
*
|
|
430
|
+
* @param children - Footer content (text, status indicators, etc.)
|
|
431
|
+
*
|
|
432
|
+
* @example Status footer
|
|
433
|
+
* ```tsx
|
|
434
|
+
* <BottomSheet.Footer>
|
|
435
|
+
* <Text className="text-gray-500 text-sm">
|
|
436
|
+
* Last updated: 5 minutes ago
|
|
437
|
+
* </Text>
|
|
438
|
+
* </BottomSheet.Footer>
|
|
439
|
+
* ```
|
|
440
|
+
*
|
|
441
|
+
* @example Help text footer
|
|
442
|
+
* ```tsx
|
|
443
|
+
* <BottomSheet.Footer>
|
|
444
|
+
* <View className="flex-row items-center">
|
|
445
|
+
* <Icon name="info" size={16} />
|
|
446
|
+
* <Text className="ml-2 text-gray-600">Swipe down to dismiss</Text>
|
|
447
|
+
* </View>
|
|
448
|
+
* </BottomSheet.Footer>
|
|
449
|
+
* ```
|
|
450
|
+
*/
|
|
451
|
+
function Footer({ children }: FooterProps) {
|
|
452
|
+
return (
|
|
453
|
+
<View className="px-5 py-3 border-t border-border-light bg-bg-hover">{children}</View>
|
|
454
|
+
);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* BottomSheet Compound Components
|
|
459
|
+
*
|
|
460
|
+
* A flexible, gesture-enabled bottom sheet modal system following compound component pattern.
|
|
461
|
+
* Supports swipe-to-dismiss, configurable sizes, and composable sections.
|
|
462
|
+
*
|
|
463
|
+
* ## Components
|
|
464
|
+
*
|
|
465
|
+
* | Component | Purpose |
|
|
466
|
+
* |-----------|---------|
|
|
467
|
+
* | `Root` | Container with gesture handling and animations |
|
|
468
|
+
* | `Handle` | Standalone drag pill (minimal sheets) |
|
|
469
|
+
* | `Header` | Header with integrated drag handle |
|
|
470
|
+
* | `Title` | Styled title with optional subtitle |
|
|
471
|
+
* | `Content` | Main content area (static or scrollable) |
|
|
472
|
+
* | `Actions` | Action buttons section |
|
|
473
|
+
* | `Footer` | Secondary info footer |
|
|
474
|
+
* | `useBottomSheet` | Hook for custom components |
|
|
475
|
+
*
|
|
476
|
+
* ## Basic Structure
|
|
477
|
+
*
|
|
478
|
+
* ```tsx
|
|
479
|
+
* <BottomSheet.Root visible={isOpen} onClose={close}>
|
|
480
|
+
* <BottomSheet.Header>
|
|
481
|
+
* <BottomSheet.Title>Title</BottomSheet.Title>
|
|
482
|
+
* </BottomSheet.Header>
|
|
483
|
+
* <BottomSheet.Content>
|
|
484
|
+
* {content}
|
|
485
|
+
* </BottomSheet.Content>
|
|
486
|
+
* <BottomSheet.Actions>
|
|
487
|
+
* {buttons}
|
|
488
|
+
* </BottomSheet.Actions>
|
|
489
|
+
* </BottomSheet.Root>
|
|
490
|
+
* ```
|
|
491
|
+
*
|
|
492
|
+
* ## Usage in Atomic Design
|
|
493
|
+
*
|
|
494
|
+
* - **Molecules**: Use BottomSheet to create selector modals (e.g., BluetoothDeviceSelectorModal)
|
|
495
|
+
* - **Organisms**: Compose Card + SelectorModal for complete features (e.g., BluetoothPrinterSelector)
|
|
496
|
+
*
|
|
497
|
+
* @see BluetoothDeviceSelectorModal - Example molecule implementation
|
|
498
|
+
* @see TimeZoneSelectorModal - Example molecule implementation
|
|
499
|
+
*/
|
|
500
|
+
export const BottomSheet = {
|
|
501
|
+
Root,
|
|
502
|
+
Handle,
|
|
503
|
+
Header,
|
|
504
|
+
Title,
|
|
505
|
+
Content,
|
|
506
|
+
Actions,
|
|
507
|
+
Footer,
|
|
508
|
+
useBottomSheet,
|
|
509
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BottomSheet } from "./BottomSheet.Root";
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
type ReactNode,
|
|
4
|
+
useCallback,
|
|
5
|
+
useContext,
|
|
6
|
+
useMemo,
|
|
7
|
+
useState,
|
|
8
|
+
} from "react";
|
|
9
|
+
|
|
10
|
+
import { BaseButton } from "../primitives/BaseButton";
|
|
11
|
+
import { BottomSheet } from "./BottomSheet";
|
|
12
|
+
import ConfirmationDialog from "./Dialog.Confirmation";
|
|
13
|
+
|
|
14
|
+
type ConfirmationVariant = "dialog" | "bottomSheet";
|
|
15
|
+
|
|
16
|
+
interface IConfirmationOptions {
|
|
17
|
+
variant?: ConfirmationVariant;
|
|
18
|
+
title?: string;
|
|
19
|
+
message?: string;
|
|
20
|
+
confirmText?: string;
|
|
21
|
+
cancelText?: string;
|
|
22
|
+
onConfirm?: () => void | Promise<void>;
|
|
23
|
+
onCancel?: () => void | Promise<void>;
|
|
24
|
+
render?: (close: () => void) => ReactNode;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface IConfirmationState extends IConfirmationOptions {
|
|
28
|
+
isVisible: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
type ConfirmationContextValue = {
|
|
32
|
+
show: (opts: IConfirmationOptions) => void;
|
|
33
|
+
hide: () => void;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const DEFAULT_STATE: IConfirmationState = {
|
|
37
|
+
isVisible: false,
|
|
38
|
+
variant: "dialog",
|
|
39
|
+
title: "Confirmación",
|
|
40
|
+
message: "¿Estás seguro de que quieres continuar?",
|
|
41
|
+
confirmText: "Confirmar",
|
|
42
|
+
cancelText: "Cancelar",
|
|
43
|
+
onConfirm: undefined,
|
|
44
|
+
onCancel: undefined,
|
|
45
|
+
render: undefined,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const ConfirmationContext = createContext<ConfirmationContextValue | null>(null);
|
|
49
|
+
|
|
50
|
+
export function ConfirmationProvider({ children }: { children: ReactNode }) {
|
|
51
|
+
const [state, setState] = useState<IConfirmationState>(DEFAULT_STATE);
|
|
52
|
+
|
|
53
|
+
const show = useCallback((opts: IConfirmationOptions) => {
|
|
54
|
+
setState((prev) => ({
|
|
55
|
+
...prev,
|
|
56
|
+
isVisible: true,
|
|
57
|
+
variant: opts.variant ?? DEFAULT_STATE.variant,
|
|
58
|
+
title: opts.title ?? DEFAULT_STATE.title,
|
|
59
|
+
message: opts.message ?? DEFAULT_STATE.message,
|
|
60
|
+
confirmText: opts.confirmText ?? DEFAULT_STATE.confirmText,
|
|
61
|
+
cancelText: opts.cancelText ?? DEFAULT_STATE.cancelText,
|
|
62
|
+
onConfirm: opts.onConfirm,
|
|
63
|
+
onCancel: opts.onCancel,
|
|
64
|
+
render: opts.render,
|
|
65
|
+
}));
|
|
66
|
+
}, []);
|
|
67
|
+
|
|
68
|
+
const hide = useCallback(() => {
|
|
69
|
+
setState(DEFAULT_STATE);
|
|
70
|
+
}, []);
|
|
71
|
+
|
|
72
|
+
const value = useMemo(() => ({ show, hide }), [show, hide]);
|
|
73
|
+
|
|
74
|
+
const handleConfirm = async () => {
|
|
75
|
+
try {
|
|
76
|
+
await state.onConfirm?.();
|
|
77
|
+
} finally {
|
|
78
|
+
hide();
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const handleCancel = async () => {
|
|
83
|
+
try {
|
|
84
|
+
await state.onCancel?.();
|
|
85
|
+
} finally {
|
|
86
|
+
hide();
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<ConfirmationContext.Provider value={value}>
|
|
92
|
+
{children}
|
|
93
|
+
|
|
94
|
+
{state.variant === "dialog" && (
|
|
95
|
+
<ConfirmationDialog
|
|
96
|
+
auxTitle={state.title}
|
|
97
|
+
cancelButtonText={state.cancelText}
|
|
98
|
+
confirmButtonText={state.confirmText}
|
|
99
|
+
onCancel={handleCancel}
|
|
100
|
+
onConfirm={handleConfirm}
|
|
101
|
+
subtitle={state.message}
|
|
102
|
+
visible={state.isVisible}
|
|
103
|
+
/>
|
|
104
|
+
)}
|
|
105
|
+
|
|
106
|
+
{state.variant === "bottomSheet" && (
|
|
107
|
+
<BottomSheet.Root onClose={handleCancel} visible={state.isVisible}>
|
|
108
|
+
{state.render ? (
|
|
109
|
+
state.render(hide)
|
|
110
|
+
) : (
|
|
111
|
+
<>
|
|
112
|
+
<BottomSheet.Header>
|
|
113
|
+
<BottomSheet.Title subtitle={state.message}>{state.title}</BottomSheet.Title>
|
|
114
|
+
</BottomSheet.Header>
|
|
115
|
+
<BottomSheet.Actions layout="horizontal">
|
|
116
|
+
<BaseButton
|
|
117
|
+
className="flex-1"
|
|
118
|
+
onPress={handleCancel}
|
|
119
|
+
title={state.cancelText ?? ""}
|
|
120
|
+
variant="outline"
|
|
121
|
+
/>
|
|
122
|
+
<BaseButton
|
|
123
|
+
className="flex-1"
|
|
124
|
+
onPress={handleConfirm}
|
|
125
|
+
title={state.confirmText ?? ""}
|
|
126
|
+
variant="primary"
|
|
127
|
+
/>
|
|
128
|
+
</BottomSheet.Actions>
|
|
129
|
+
</>
|
|
130
|
+
)}
|
|
131
|
+
</BottomSheet.Root>
|
|
132
|
+
)}
|
|
133
|
+
</ConfirmationContext.Provider>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function useConfirmationContext() {
|
|
138
|
+
const context = useContext(ConfirmationContext);
|
|
139
|
+
if (!context) {
|
|
140
|
+
// Return no-op functions during initial mount to avoid timing issues
|
|
141
|
+
console.warn("useConfirmationContext called before ConfirmationProvider mounted");
|
|
142
|
+
return {
|
|
143
|
+
show: () => {},
|
|
144
|
+
hide: () => {},
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
return context;
|
|
148
|
+
}
|