@neko-os/ui 0.2.3 → 0.4.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/dist/DynamicStyleTag.js +18 -2
- package/dist/DynamicStyleTag.native.js +3 -1
- package/dist/NekoUI.js +39 -1
- package/dist/abstractions/ActivityIndicator.js +19 -1
- package/dist/abstractions/ActivityIndicator.native.js +43 -1
- package/dist/abstractions/ActivityIndicator.web.js +43 -1
- package/dist/abstractions/AnimatedView.js +3 -1
- package/dist/abstractions/AnimatedView.native.js +5 -1
- package/dist/abstractions/AnimatedView.web.js +3 -1
- package/dist/abstractions/BlurView.js +43 -1
- package/dist/abstractions/BlurView.native.js +39 -1
- package/dist/abstractions/BlurView.web.js +39 -1
- package/dist/abstractions/DraggableSlideView.js +3 -1
- package/dist/abstractions/DraggableSlideView.native.js +62 -1
- package/dist/abstractions/FlatList.js +3 -1
- package/dist/abstractions/FlatList.native.js +37 -1
- package/dist/abstractions/FlatList.web.js +3 -1
- package/dist/abstractions/GradientView.js +5 -1
- package/dist/abstractions/GradientView.native.js +32 -1
- package/dist/abstractions/HiddenInput.js +3 -1
- package/dist/abstractions/HiddenInput.native.js +3 -1
- package/dist/abstractions/Icon.js +10 -1
- package/dist/abstractions/Icon.native.js +13 -1
- package/dist/abstractions/Icon.web.js +11 -1
- package/dist/abstractions/Image.js +12 -1
- package/dist/abstractions/Image.native.js +7 -1
- package/dist/abstractions/Image.web.js +7 -1
- package/dist/abstractions/ImageBackground.js +17 -1
- package/dist/abstractions/ImageBackground.native.js +27 -1
- package/dist/abstractions/ImageBackground.web.js +7 -1
- package/dist/abstractions/KeyboardAvoidingView.js +3 -1
- package/dist/abstractions/KeyboardAvoidingView.native.js +3 -1
- package/dist/abstractions/Platform.js +1 -1
- package/dist/abstractions/Platform.native.js +3 -1
- package/dist/abstractions/Platform.web.js +3 -1
- package/dist/abstractions/Pressable.js +4 -1
- package/dist/abstractions/Pressable.native.js +3 -1
- package/dist/abstractions/Pressable.web.js +3 -1
- package/dist/abstractions/SafeAreaView.js +3 -1
- package/dist/abstractions/SafeAreaView.native.js +3 -1
- package/dist/abstractions/ScrollView.js +3 -1
- package/dist/abstractions/ScrollView.native.js +5 -1
- package/dist/abstractions/ScrollView.web.js +3 -1
- package/dist/abstractions/StaticList.js +51 -1
- package/dist/abstractions/Switch.js +97 -1
- package/dist/abstractions/Switch.native.js +12 -1
- package/dist/abstractions/Table.js +29 -1
- package/dist/abstractions/Table.native.js +19 -1
- package/dist/abstractions/Text.js +14 -1
- package/dist/abstractions/Text.native.js +3 -1
- package/dist/abstractions/Text.web.js +18 -1
- package/dist/abstractions/TextInput.js +12 -1
- package/dist/abstractions/TextInput.native.js +5 -1
- package/dist/abstractions/TextInput.web.js +5 -1
- package/dist/abstractions/TouchableOpacity.js +4 -1
- package/dist/abstractions/TouchableOpacity.native.js +9 -1
- package/dist/abstractions/View.js +3 -1
- package/dist/abstractions/View.native.js +3 -1
- package/dist/abstractions/View.web.js +3 -1
- package/dist/abstractions/helpers/componentSize.js +13 -1
- package/dist/abstractions/helpers/componentSize.native.js +12 -1
- package/dist/abstractions/helpers/storage.js +32 -1
- package/dist/abstractions/helpers/storage.native.js +34 -1
- package/dist/abstractions/helpers/transformStyle.js +8 -1
- package/dist/abstractions/helpers/transformStyle.native.js +3 -1
- package/dist/abstractions/helpers/useSafeAreaInsets.js +3 -1
- package/dist/abstractions/helpers/useSafeAreaInsets.native.js +3 -1
- package/dist/abstractions/helpers/windowWidth.js +13 -1
- package/dist/abstractions/helpers/windowWidth.native.js +6 -1
- package/dist/abstractions/helpers/windowWidth.web.js +6 -1
- package/dist/components/actions/ActionsDrawer.js +81 -1
- package/dist/components/actions/Breadcrumb.js +47 -1
- package/dist/components/actions/Button.js +82 -1
- package/dist/components/actions/Dropdown.js +91 -1
- package/dist/components/actions/FloatingButton.js +87 -1
- package/dist/components/actions/FloatingMenu.js +39 -1
- package/dist/components/actions/Link.js +66 -1
- package/dist/components/actions/Pressable.js +38 -1
- package/dist/components/actions/index.js +9 -1
- package/dist/components/actions/menu/HorizontalMenu.js +98 -1
- package/dist/components/actions/menu/Menu.js +7 -1
- package/dist/components/actions/menu/SubmenuWrapper.js +16 -1
- package/dist/components/actions/menu/VerticalMenu.js +133 -1
- package/dist/components/animations/AnimatedTopBar.js +10 -1
- package/dist/components/animations/AnimatedTopBar.native.js +34 -1
- package/dist/components/animations/AnimatedTopBar.web.js +1 -1
- package/dist/components/animations/AnimatedView.js +45 -1
- package/dist/components/animations/DraggableSlideView.js +42 -1
- package/dist/components/animations/ParallaxHeader.js +9 -1
- package/dist/components/animations/ParallaxHeader.native.js +32 -1
- package/dist/components/animations/ParallaxHeader.web.js +32 -1
- package/dist/components/animations/ReanimatedScrollHandler.js +8 -1
- package/dist/components/animations/ReanimatedScrollHandler.native.js +24 -1
- package/dist/components/animations/ReanimatedScrollHandler.web.js +1 -1
- package/dist/components/animations/ReanimatedView.js +40 -1
- package/dist/components/animations/index.js +5 -1
- package/dist/components/calendar/CalendarNav.js +67 -1
- package/dist/components/calendar/WeekDaysBar.js +18 -1
- package/dist/components/calendar/_helpers/calendarDays.js +16 -1
- package/dist/components/calendar/_helpers/dateDisabled.js +24 -1
- package/dist/components/feedback/alerter.js +31 -1
- package/dist/components/feedback/confirmer.js +70 -1
- package/dist/components/feedback/index.js +3 -1
- package/dist/components/feedback/notifications/Notification.js +37 -1
- package/dist/components/feedback/notifications/NotificationsHandler.js +65 -1
- package/dist/components/filter/DateFilter.js +72 -0
- package/dist/components/filter/FilterGroup.js +17 -0
- package/dist/components/filter/FilterHandler.js +54 -0
- package/dist/components/filter/FilterItem.js +30 -0
- package/dist/components/filter/PopoverFilterItem.js +84 -0
- package/dist/components/filter/SearchInput.js +49 -0
- package/dist/components/filter/index.js +6 -0
- package/dist/components/form/Form.js +31 -1
- package/dist/components/form/FormGroup.js +21 -1
- package/dist/components/form/FormItem.js +118 -1
- package/dist/components/form/FormList.js +143 -1
- package/dist/components/form/FormWrapperComponent.js +52 -1
- package/dist/components/form/FormWrapperComponent.native.js +5 -1
- package/dist/components/form/SubmitButton.js +22 -1
- package/dist/components/form/index.js +9 -1
- package/dist/components/form/useNewForm.js +211 -1
- package/dist/components/form/useWatch.js +70 -1
- package/dist/components/form/validation/defaultMessages.js +20 -1
- package/dist/components/form/validation/index.js +5 -1
- package/dist/components/form/validation/normalizeRules.js +22 -1
- package/dist/components/form/validation/shouldValidateOn.js +21 -1
- package/dist/components/form/validation/validateRules.js +83 -1
- package/dist/components/form/validation/validators.js +82 -1
- package/dist/components/helpers/ConditionalLazyRender.js +6 -1
- package/dist/components/helpers/LazyAction.js +22 -1
- package/dist/components/helpers/LazyRender.js +55 -1
- package/dist/components/helpers/LazyRender.native.js +58 -1
- package/dist/components/helpers/Portal.js +21 -1
- package/dist/components/helpers/PortalHandler.js +32 -1
- package/dist/components/helpers/Responsive.js +18 -1
- package/dist/components/helpers/Separator.js +49 -1
- package/dist/components/helpers/VerticalView.js +34 -1
- package/dist/components/helpers/index.js +8 -1
- package/dist/components/index.js +20 -1
- package/dist/components/inputs/BooleanSelect.js +14 -0
- package/dist/components/inputs/Checkbox.js +56 -1
- package/dist/components/inputs/DateInput.js +123 -1
- package/dist/components/inputs/DateRangeInput.js +41 -0
- package/dist/components/inputs/Editable.js +129 -0
- package/dist/components/inputs/EnabledSelect.js +14 -0
- package/dist/components/inputs/InputWrapper.js +93 -1
- package/dist/components/inputs/LinkInput.js +17 -1
- package/dist/components/inputs/MaskInput.js +67 -1
- package/dist/components/inputs/NumberInput.js +111 -1
- package/dist/components/inputs/NumberRangeInput.js +41 -0
- package/dist/components/inputs/PasswordInput.js +24 -0
- package/dist/components/inputs/Picker.js +169 -1
- package/dist/components/inputs/Radio.js +55 -1
- package/dist/components/inputs/RateInput.js +62 -1
- package/dist/components/inputs/SegmentedPicker.js +62 -1
- package/dist/components/inputs/Select.js +219 -1
- package/dist/components/inputs/Switch.js +60 -1
- package/dist/components/inputs/TextArea.js +5 -0
- package/dist/components/inputs/TextInput.js +32 -1
- package/dist/components/inputs/UploadInput.js +140 -0
- package/dist/components/inputs/_DateInput.native.js +89 -1
- package/dist/components/inputs/datePicker/DatePicker.js +24 -1
- package/dist/components/inputs/datePicker/DayPicker.js +64 -1
- package/dist/components/inputs/datePicker/MonthPicker.js +62 -1
- package/dist/components/inputs/datePicker/QuarterPicker.js +65 -1
- package/dist/components/inputs/datePicker/WeekPicker.js +74 -1
- package/dist/components/inputs/datePicker/YearPicker.js +70 -1
- package/dist/components/inputs/index.js +23 -1
- package/dist/components/inputs/upload/Upload.js +99 -0
- package/dist/components/inputs/upload/Upload.native.js +154 -0
- package/dist/components/inputs/upload/useUploadState.js +143 -0
- package/dist/components/layout/Layout.js +40 -1
- package/dist/components/layout/LayoutContent.js +42 -1
- package/dist/components/layout/LayoutHeader.js +70 -1
- package/dist/components/layout/LayoutSider.js +64 -1
- package/dist/components/layout/index.js +4 -1
- package/dist/components/list/FlatList.js +91 -1
- package/dist/components/list/ScrollView.js +58 -1
- package/dist/components/list/index.js +2 -1
- package/dist/components/modals/bottomDrawer/index.js +3 -1
- package/dist/components/modals/bottomDrawer/index.native.js +5 -1
- package/dist/components/modals/bottomDrawer/index.web.js +5 -1
- package/dist/components/modals/bottomDrawer/native/BottomDrawer.js +239 -1
- package/dist/components/modals/bottomDrawer/native/DrawerContext.js +17 -1
- package/dist/components/modals/bottomDrawer/native/DrawerHandle.js +12 -1
- package/dist/components/modals/bottomDrawer/native/DrawerScrollView.js +5 -1
- package/dist/components/modals/bottomDrawer/native/createDrawerScrollComponent.js +139 -1
- package/dist/components/modals/bottomDrawer/native/utils.js +65 -1
- package/dist/components/modals/bottomDrawer/web/BottomDrawer.js +5 -1
- package/dist/components/modals/drawer/Drawer.js +5 -1
- package/dist/components/modals/drawer/Drawer.native.js +3 -1
- package/dist/components/modals/drawer/Drawer.web.js +3 -1
- package/dist/components/modals/drawer/index.js +1 -1
- package/dist/components/modals/index.js +4 -1
- package/dist/components/modals/modal/Modal.js +84 -1
- package/dist/components/modals/modal/Modal.native.js +83 -1
- package/dist/components/modals/modal/ModalBackdrop.js +58 -1
- package/dist/components/modals/modal/ModalContent.js +28 -1
- package/dist/components/modals/modal/ModalFooter.js +31 -1
- package/dist/components/modals/modal/ModalHeader.js +50 -1
- package/dist/components/modals/modal/handler/ModalsHandler.js +61 -1
- package/dist/components/modals/modal/index.js +6 -1
- package/dist/components/modals/router/ModalRoute.js +15 -1
- package/dist/components/modals/router/ModalsRouter.js +120 -1
- package/dist/components/modals/router/ModalsRouterContext.js +16 -1
- package/dist/components/modals/router/index.js +6 -1
- package/dist/components/modals/router/useAllModalsParams.js +6 -1
- package/dist/components/modals/router/useModalParams.js +6 -1
- package/dist/components/modals/router/useModalsNavigation.js +6 -1
- package/dist/components/modals/router/useUpdateModalContainer.js +6 -1
- package/dist/components/presentation/Avatar.js +79 -1
- package/dist/components/presentation/AvatarLabel.js +60 -1
- package/dist/components/presentation/AvatarsGroup.js +30 -0
- package/dist/components/presentation/Badge.js +91 -1
- package/dist/components/presentation/ContentLabel.js +43 -1
- package/dist/components/presentation/Icon.js +20 -1
- package/dist/components/presentation/IconLabel.js +40 -1
- package/dist/components/presentation/Image.js +33 -1
- package/dist/components/presentation/ImageBackground.js +38 -1
- package/dist/components/presentation/LabelValue.js +51 -1
- package/dist/components/presentation/Progress.js +20 -0
- package/dist/components/presentation/Rate.js +58 -1
- package/dist/components/presentation/RateTag.js +35 -1
- package/dist/components/presentation/Result.js +60 -1
- package/dist/components/presentation/ResultBar.js +56 -1
- package/dist/components/presentation/Tag.js +69 -1
- package/dist/components/presentation/Tooltip.js +44 -1
- package/dist/components/presentation/index.js +16 -1
- package/dist/components/sections/Section.js +50 -1
- package/dist/components/sections/SectionItem.js +24 -1
- package/dist/components/sections/SectionItemDropdown.js +68 -1
- package/dist/components/sections/SectionItemLink.js +35 -1
- package/dist/components/sections/index.js +4 -1
- package/dist/components/state/Loading.js +20 -1
- package/dist/components/state/LoadingView.js +37 -1
- package/dist/components/state/StatePresenter.js +41 -1
- package/dist/components/state/index.js +3 -1
- package/dist/components/steps/ActiveStepContent.js +16 -0
- package/dist/components/steps/StepsHandler.js +53 -0
- package/dist/components/steps/StepsMenu.js +14 -0
- package/dist/components/steps/StepsNavigation.js +37 -0
- package/dist/components/steps/index.js +4 -0
- package/dist/components/structure/Accordion.js +69 -1
- package/dist/components/structure/AccordionGroup.js +35 -1
- package/dist/components/structure/Affix.js +34 -0
- package/dist/components/structure/Affix.native.js +3 -0
- package/dist/components/structure/BlurView.js +59 -1
- package/dist/components/structure/Card.js +46 -1
- package/dist/components/structure/Col.js +22 -1
- package/dist/components/structure/GradientView.js +42 -1
- package/dist/components/structure/KeyboardAvoidingView.js +52 -1
- package/dist/components/structure/Row.js +50 -1
- package/dist/components/structure/SafeAreaView.js +42 -1
- package/dist/components/structure/Segment.js +51 -1
- package/dist/components/structure/TopBar.js +57 -1
- package/dist/components/structure/View.js +44 -1
- package/dist/components/structure/index.js +14 -1
- package/dist/components/structure/overlay/OverlayHandler.js +83 -1
- package/dist/components/structure/overlay/OverlayHandler.native.js +6 -1
- package/dist/components/structure/overlay/OverlayWrapper.js +52 -1
- package/dist/components/structure/overlay/calculatePosition.js +29 -1
- package/dist/components/structure/overlay/smartPlacement.js +32 -1
- package/dist/components/structure/popover/Popover.js +135 -1
- package/dist/components/structure/popover/Popover.native.js +105 -1
- package/dist/components/structure/popover/PopoverContent.js +18 -1
- package/dist/components/structure/popover/Popover_BU.js +157 -1
- package/dist/components/table/DataTable.js +62 -1
- package/dist/components/table/Pagination.js +128 -1
- package/dist/components/table/Table.js +66 -1
- package/dist/components/table/TableCol.js +67 -1
- package/dist/components/table/TableHeader.js +69 -1
- package/dist/components/table/TableHeaderRow.js +31 -1
- package/dist/components/table/TableRow.js +30 -1
- package/dist/components/table/index.js +7 -1
- package/dist/components/tabs/ActiveTabContent.js +38 -1
- package/dist/components/tabs/TabsHandler.js +16 -1
- package/dist/components/tabs/TabsMenu.js +15 -1
- package/dist/components/tabs/index.js +3 -1
- package/dist/components/text/DateText.js +24 -1
- package/dist/components/text/Text.js +32 -1
- package/dist/components/text/VerticalText.js +29 -1
- package/dist/components/text/index.js +3 -1
- package/dist/components/theme/ThemePicker.js +48 -1
- package/dist/components/theme/ThemePickerDrawer.js +12 -1
- package/dist/components/theme/ThemeStatusBar.js +3 -1
- package/dist/components/theme/ThemeStatusBar.native.js +9 -1
- package/dist/components/theme/ThemeThumb.js +98 -1
- package/dist/components/theme/index.js +3 -1
- package/dist/helpers/debounce.js +9 -1
- package/dist/helpers/index.js +5 -1
- package/dist/helpers/options.js +65 -1
- package/dist/helpers/random.js +5 -1
- package/dist/helpers/storage.js +76 -1
- package/dist/helpers/string.js +74 -1
- package/dist/i18n/I18n.js +96 -1
- package/dist/i18n/I18nProvider.js +40 -1
- package/dist/i18n/index.js +2 -1
- package/dist/index.js +8 -1
- package/dist/modifiers/_helpers.js +6 -1
- package/dist/modifiers/alignConverter.js +11 -1
- package/dist/modifiers/animation.js +18 -1
- package/dist/modifiers/animations/animatedEffects.js +64 -1
- package/dist/modifiers/animations/animatedEffects.native.js +55 -1
- package/dist/modifiers/animations/animatedEffects.web.js +55 -1
- package/dist/modifiers/animations/fadeEffect.js +46 -1
- package/dist/modifiers/animations/fadeEffect.native.js +33 -1
- package/dist/modifiers/animations/fadeEffect.web.js +3 -1
- package/dist/modifiers/animations/scaleEffect.js +46 -1
- package/dist/modifiers/animations/scaleEffect.native.js +33 -1
- package/dist/modifiers/animations/scrollEffect.web.js +3 -1
- package/dist/modifiers/animations/slideEffect.js +64 -1
- package/dist/modifiers/animations/slideEffect.native.js +53 -1
- package/dist/modifiers/animations/slideEffect.web.js +3 -1
- package/dist/modifiers/applyStyles.js +7 -1
- package/dist/modifiers/background.js +34 -1
- package/dist/modifiers/border.js +86 -1
- package/dist/modifiers/colorConverter.js +13 -1
- package/dist/modifiers/cursor.js +21 -1
- package/dist/modifiers/default.js +9 -1
- package/dist/modifiers/display.js +22 -1
- package/dist/modifiers/flex.js +20 -1
- package/dist/modifiers/flexWrapper.js +87 -1
- package/dist/modifiers/fullColor.js +32 -1
- package/dist/modifiers/grid.js +27 -1
- package/dist/modifiers/hover.js +28 -1
- package/dist/modifiers/logger.js +6 -1
- package/dist/modifiers/margin.js +25 -1
- package/dist/modifiers/overflow.js +28 -1
- package/dist/modifiers/padding.js +25 -1
- package/dist/modifiers/position.js +57 -1
- package/dist/modifiers/responsiveConverter.js +19 -1
- package/dist/modifiers/shadow.js +35 -1
- package/dist/modifiers/size.js +59 -1
- package/dist/modifiers/sizeConverter.js +12 -1
- package/dist/modifiers/state.js +33 -1
- package/dist/modifiers/text.js +62 -1
- package/dist/modifiers/textConverter.js +12 -1
- package/dist/modifiers/themeComponent.js +11 -1
- package/dist/responsive/ResponsiveHandler.js +28 -1
- package/dist/responsive/index.js +2 -1
- package/dist/responsive/responsiveHooks.js +67 -1
- package/dist/theme/ThemeHandler.js +81 -1
- package/dist/theme/default/base.js +95 -1
- package/dist/theme/default/blackTheme.js +47 -1
- package/dist/theme/default/cyberpunkTheme.js +36 -1
- package/dist/theme/default/darkTheme.js +35 -1
- package/dist/theme/default/hackerTheme.js +55 -1
- package/dist/theme/default/lightTheme.js +35 -1
- package/dist/theme/default/paperTheme.js +36 -1
- package/dist/theme/default/themes.js +15 -1
- package/dist/theme/format/colorsVariations.js +31 -1
- package/dist/theme/format/formatTheme.js +28 -1
- package/dist/theme/helpers/colorScale.js +12 -1
- package/dist/theme/helpers/contrastColor.js +18 -1
- package/dist/theme/helpers/dynamicColor.js +32 -1
- package/dist/theme/helpers/mergePreset.js +7 -1
- package/dist/theme/helpers/relatedScales.js +34 -1
- package/dist/theme/helpers/sizeScale.js +20 -1
- package/dist/theme/helpers/textScale.js +15 -1
- package/dist/theme/index.js +2 -1
- package/package.json +1 -3
- package/src/abstractions/Icon.js +1 -1
- package/src/abstractions/TextInput.js +10 -1
- package/src/abstractions/TouchableOpacity.native.js +8 -2
- package/src/components/actions/ActionsDrawer.js +1 -1
- package/src/components/actions/Button.js +3 -1
- package/src/components/actions/FloatingMenu.js +1 -1
- package/src/components/actions/menu/HorizontalMenu.js +2 -1
- package/src/components/actions/menu/VerticalMenu.js +2 -1
- package/src/components/filter/DateFilter.js +72 -0
- package/src/components/filter/FilterGroup.js +17 -0
- package/src/components/filter/FilterHandler.js +54 -0
- package/src/components/filter/FilterItem.js +30 -0
- package/src/components/filter/PopoverFilterItem.js +84 -0
- package/src/components/filter/SearchInput.js +49 -0
- package/src/components/filter/index.js +6 -0
- package/src/components/form/Form.js +9 -3
- package/src/components/form/FormItem.js +26 -1
- package/src/components/form/FormWrapperComponent.js +12 -3
- package/src/components/form/useNewForm.js +55 -4
- package/src/components/helpers/Separator.js +15 -11
- package/src/components/helpers/index.js +1 -0
- package/src/components/index.js +2 -0
- package/src/components/inputs/BooleanSelect.js +14 -0
- package/src/components/inputs/DateInput.js +3 -1
- package/src/components/inputs/DateRangeInput.js +41 -0
- package/src/components/inputs/Editable.js +129 -0
- package/src/components/inputs/EnabledSelect.js +14 -0
- package/src/components/inputs/InputWrapper.js +7 -4
- package/src/components/inputs/LinkInput.js +1 -1
- package/src/components/inputs/NumberInput.js +10 -5
- package/src/components/inputs/NumberRangeInput.js +41 -0
- package/src/components/inputs/PasswordInput.js +24 -0
- package/src/components/inputs/Picker.js +3 -3
- package/src/components/inputs/Select.js +61 -47
- package/src/components/inputs/TextArea.js +5 -0
- package/src/components/inputs/TextInput.js +14 -4
- package/src/components/inputs/UploadInput.js +140 -0
- package/src/components/inputs/index.js +9 -0
- package/src/components/inputs/upload/Upload.js +99 -0
- package/src/components/inputs/upload/Upload.native.js +154 -0
- package/src/components/inputs/upload/useUploadState.js +143 -0
- package/src/components/layout/LayoutHeader.js +1 -0
- package/src/components/presentation/AvatarLabel.js +1 -1
- package/src/components/presentation/AvatarsGroup.js +30 -0
- package/src/components/presentation/Badge.js +3 -2
- package/src/components/presentation/ContentLabel.js +1 -1
- package/src/components/presentation/IconLabel.js +1 -0
- package/src/components/presentation/Progress.js +20 -0
- package/src/components/presentation/index.js +2 -0
- package/src/components/sections/Section.js +1 -1
- package/src/components/sections/SectionItemLink.js +4 -2
- package/src/components/steps/ActiveStepContent.js +16 -0
- package/src/components/steps/StepsHandler.js +53 -0
- package/src/components/steps/StepsMenu.js +14 -0
- package/src/components/steps/StepsNavigation.js +37 -0
- package/src/components/steps/index.js +4 -0
- package/src/components/structure/Affix.js +34 -0
- package/src/components/structure/Affix.native.js +3 -0
- package/src/components/structure/Card.js +1 -0
- package/src/components/structure/TopBar.js +13 -1
- package/src/components/structure/index.js +1 -0
- package/src/components/structure/overlay/OverlayHandler.js +9 -1
- package/src/components/structure/popover/Popover.js +22 -5
- package/src/components/table/DataTable.js +7 -2
- package/src/components/table/Table.js +2 -1
- package/src/components/tabs/ActiveTabContent.js +4 -1
- package/src/components/text/DateText.js +15 -2
- package/src/modifiers/border.js +15 -9
- package/src/modifiers/size.js +8 -5
- package/src/theme/default/base.js +2 -0
- package/src/theme/default/hackerTheme.js +1 -10
- package/src/theme/default/paperTheme.js +1 -14
package/dist/i18n/I18n.js
CHANGED
|
@@ -1 +1,96 @@
|
|
|
1
|
-
|
|
1
|
+
var _excluded = ["ns", "context"];function _objectWithoutProperties(e, t) {if (null == e) return {};var o,r,i = _objectWithoutPropertiesLoose(e, t);if (Object.getOwnPropertySymbols) {var n = Object.getOwnPropertySymbols(e);for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);}return i;}function _objectWithoutPropertiesLoose(r, e) {if (null == r) return {};var t = {};for (var n in r) if ({}.hasOwnProperty.call(r, n)) {if (-1 !== e.indexOf(n)) continue;t[n] = r[n];}return t;}function asyncGeneratorStep(n, t, e, r, o, a, c) {try {var i = n[a](c),u = i.value;} catch (n) {return void e(n);}i.done ? t(u) : Promise.resolve(u).then(r, o);}function _asyncToGenerator(n) {return function () {var t = this,e = arguments;return new Promise(function (r, o) {var a = n.apply(t, e);function _next(n) {asyncGeneratorStep(a, r, o, _next, _throw, "next", n);}function _throw(n) {asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);}_next(void 0);});};}function _classCallCheck(a, n) {if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");}function _defineProperties(e, r) {for (var t = 0; t < r.length; t++) {var o = r[t];o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);}}function _createClass(e, r, t) {return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;}function _toPropertyKey(t) {var i = _toPrimitive(t, "string");return "symbol" == typeof i ? i : i + "";}function _toPrimitive(t, r) {if ("object" != typeof t || !t) return t;var e = t[Symbol.toPrimitive];if (void 0 !== e) {var i = e.call(t, r || "default");if ("object" != typeof i) return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return ("string" === r ? String : Number)(t);}export var I18n = function () {
|
|
2
|
+
function I18n() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};_classCallCheck(this, I18n);
|
|
3
|
+
this.language = options.language || 'en';
|
|
4
|
+
this.fallback = options.fallback || 'en';
|
|
5
|
+
this.onChangeLanguage = options.onChangeLanguage;
|
|
6
|
+
this.resources = options.resources || {};
|
|
7
|
+
this.loader = options.loader;
|
|
8
|
+
}return _createClass(I18n, [{ key: "addResources", value:
|
|
9
|
+
|
|
10
|
+
function addResources(lang, ns, data) {
|
|
11
|
+
if (!this.resources[lang]) this.resources[lang] = {};
|
|
12
|
+
this.resources[lang][ns] = Object.assign({}, this.resources[lang][ns], data);
|
|
13
|
+
} }, { key: "changeLanguage", value:
|
|
14
|
+
|
|
15
|
+
function changeLanguage(lang) {var _this$onChangeLanguag;
|
|
16
|
+
this.language = lang;
|
|
17
|
+
(_this$onChangeLanguag = this.onChangeLanguage) == null ? void 0 : _this$onChangeLanguag.call(this, lang);
|
|
18
|
+
} }, { key: "tAsync", value: function () {var _tAsync = _asyncToGenerator(
|
|
19
|
+
|
|
20
|
+
function* (key) {var _this$resources$this$;var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
21
|
+
var _opts$ns = opts.ns,ns = _opts$ns === void 0 ? 'common' : _opts$ns;
|
|
22
|
+
if (!((_this$resources$this$ = this.resources[this.language]) != null && _this$resources$this$[ns]) && this.loader) {
|
|
23
|
+
yield this._loadNamespace(this.language, ns);
|
|
24
|
+
}
|
|
25
|
+
return this.t(key, opts);
|
|
26
|
+
});function tAsync(_x) {return _tAsync.apply(this, arguments);}return tAsync;}() }, { key: "t", value:
|
|
27
|
+
|
|
28
|
+
function t(key) {var _this$resources$this$2;var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
29
|
+
var _opts$ns2 = opts.ns,ns = _opts$ns2 === void 0 ? 'common' : _opts$ns2,context = opts.context,vars = _objectWithoutProperties(opts, _excluded);
|
|
30
|
+
var count = vars == null ? void 0 : vars.count;
|
|
31
|
+
if (key.includes(':')) {
|
|
32
|
+
var splittedKey = key.split(':');
|
|
33
|
+
ns = splittedKey[0];
|
|
34
|
+
key = splittedKey[1];
|
|
35
|
+
}
|
|
36
|
+
var langData = (_this$resources$this$2 = this.resources[this.language]) == null ? void 0 : _this$resources$this$2[ns];
|
|
37
|
+
var value = this._resolveKey(langData, key, count, context);
|
|
38
|
+
if (context) console.log(context, value);
|
|
39
|
+
|
|
40
|
+
if (!value) {var _this$resources$this$3;
|
|
41
|
+
var fallbackData = (_this$resources$this$3 = this.resources[this.fallback]) == null ? void 0 : _this$resources$this$3[ns];
|
|
42
|
+
value = this._resolveKey(fallbackData, key, count, context) || key;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return this._interpolate(value, vars);
|
|
46
|
+
} }, { key: "_loadNamespace", value: function () {var _loadNamespace2 = _asyncToGenerator(
|
|
47
|
+
|
|
48
|
+
function* (lang, ns) {
|
|
49
|
+
if (!this.loader) return;
|
|
50
|
+
var data = yield this.loader(lang, ns);
|
|
51
|
+
this.addResources(lang, ns, data);
|
|
52
|
+
});function _loadNamespace(_x2, _x3) {return _loadNamespace2.apply(this, arguments);}return _loadNamespace;}() }, { key: "_resolveKey", value:
|
|
53
|
+
|
|
54
|
+
function _resolveKey(nsData, key, count, context) {
|
|
55
|
+
if (!nsData) return null;
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
var parts = key.split('.');
|
|
59
|
+
var basePath = parts.slice(0, -1);
|
|
60
|
+
var baseKey = parts[parts.length - 1];
|
|
61
|
+
var parent = basePath.reduce(function (acc, part) {return acc ? acc[part] : undefined;}, nsData) || nsData;
|
|
62
|
+
|
|
63
|
+
if (!parent) return null;
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
if (context) {
|
|
67
|
+
var contextKey = `${baseKey}_${context}`;
|
|
68
|
+
if (parent[contextKey] != null) {
|
|
69
|
+
return parent[contextKey];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
if (typeof count === 'number') {
|
|
75
|
+
if (count === 0) {
|
|
76
|
+
var singularKey = `${baseKey}_zero`;
|
|
77
|
+
if (parent[singularKey] != null) {
|
|
78
|
+
return parent[singularKey];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (count === 1) {
|
|
82
|
+
var _singularKey = `${baseKey}_one`;
|
|
83
|
+
if (parent[_singularKey] != null) {
|
|
84
|
+
return parent[_singularKey];
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
return parent[baseKey];
|
|
91
|
+
} }, { key: "_interpolate", value:
|
|
92
|
+
|
|
93
|
+
function _interpolate(str, vars) {
|
|
94
|
+
if (typeof str !== 'string') return str;
|
|
95
|
+
return str.replace(/\{\{(.*?)\}\}/g, function (_, v) {var _vars$v$trim;return (_vars$v$trim = vars[v.trim()]) != null ? _vars$v$trim : '';});
|
|
96
|
+
} }]);}();
|
|
@@ -1 +1,40 @@
|
|
|
1
|
-
|
|
1
|
+
var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/i18n/I18nProvider.js";function _slicedToArray(r, e) {return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r, a) {if (r) {if ("string" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}function _iterableToArrayLimit(r, l) {var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];if (null != t) {var e,n,i,u,a = [],f = !0,o = !1;try {if (i = (t = t.call(r)).next, 0 === l) {if (Object(t) !== t) return;f = !1;} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);} catch (r) {o = !0, n = r;} finally {try {if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;} finally {if (o) throw n;}}return a;}}function _arrayWithHoles(r) {if (Array.isArray(r)) return r;}import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { I18n } from "./I18n";import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
var I18nContext = React.createContext();
|
|
6
|
+
|
|
7
|
+
export function I18nProvider(_ref) {var children = _ref.children,i18n = _ref.i18n,config = _ref.config;
|
|
8
|
+
var i18nRef = React.useRef(i18n || new I18n(config));
|
|
9
|
+
var _React$useState = React.useState(0),_React$useState2 = _slicedToArray(_React$useState, 2),v = _React$useState2[0],setVersion = _React$useState2[1];
|
|
10
|
+
|
|
11
|
+
var forceUpdate = React.useCallback(function () {return setVersion(function (v) {return v + 1;});}, []);
|
|
12
|
+
|
|
13
|
+
var changeLanguage = React.useCallback(
|
|
14
|
+
function (lang) {
|
|
15
|
+
i18nRef.current.changeLanguage(lang);
|
|
16
|
+
forceUpdate();
|
|
17
|
+
},
|
|
18
|
+
[forceUpdate]
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
var value = React.useMemo(
|
|
22
|
+
function () {return {
|
|
23
|
+
t: function t() {var _i18nRef$current;return (_i18nRef$current = i18nRef.current).t.apply(_i18nRef$current, arguments);},
|
|
24
|
+
i18n: i18nRef.current,
|
|
25
|
+
v: v,
|
|
26
|
+
language: i18nRef.current.language,
|
|
27
|
+
changeLanguage: changeLanguage
|
|
28
|
+
};},
|
|
29
|
+
[v, forceUpdate, changeLanguage]
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
return _jsx(I18nContext.Provider, { value: value, children: children });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function useTranslation(namespace) {
|
|
36
|
+
var ctx = React.useContext(I18nContext);
|
|
37
|
+
if (!ctx) throw new Error('useTranslation must be used inside <I18nProvider>');
|
|
38
|
+
var t = function t(key) {var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};return ctx == null ? void 0 : ctx.t == null ? void 0 : ctx.t(key, Object.assign({ ns: namespace }, opts));};
|
|
39
|
+
return Object.assign({}, ctx, { t: t });
|
|
40
|
+
}
|
package/dist/i18n/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export*from"./I18nProvider";
|
|
1
|
+
export * from "./I18nProvider";
|
|
2
|
+
export * from "./I18n";
|
package/dist/index.js
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
-
export*from"./helpers";
|
|
1
|
+
export * from "./helpers";
|
|
2
|
+
export * from "./components";
|
|
3
|
+
export * from "./theme";
|
|
4
|
+
export * from "./responsive";
|
|
5
|
+
export * from "./i18n";
|
|
6
|
+
export * from "./NekoUI";
|
|
7
|
+
|
|
8
|
+
export var version = 41;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
function _toConsumableArray(r) {return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();}function _nonIterableSpread() {throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r, a) {if (r) {if ("string" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}function _iterableToArray(r) {if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);}function _arrayWithoutHoles(r) {if (Array.isArray(r)) return _arrayLikeToArray(r);}function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}import { pickBy } from 'ramda';
|
|
2
|
+
|
|
3
|
+
export var clearProps = pickBy(function (item) {return item !== undefined;});
|
|
4
|
+
|
|
5
|
+
export var flattenStyle = function flattenStyle(style) {return (
|
|
6
|
+
Array.isArray(style) ? Object.assign.apply(Object, [{}].concat(_toConsumableArray(style))) : style);};
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
function _slicedToArray(r, e) {return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r, a) {if (r) {if ("string" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}function _iterableToArrayLimit(r, l) {var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];if (null != t) {var e,n,i,u,a = [],f = !0,o = !1;try {if (i = (t = t.call(r)).next, 0 === l) {if (Object(t) !== t) return;f = !1;} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);} catch (r) {o = !0, n = r;} finally {try {if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;} finally {if (o) throw n;}}return a;}}function _arrayWithHoles(r) {if (Array.isArray(r)) return r;}export function useAlignConverter(defaultValue) {
|
|
2
|
+
return function (_ref) {var _ref2 = _slicedToArray(_ref, 2),values = _ref2[0],props = _ref2[1];
|
|
3
|
+
var align = props.align;
|
|
4
|
+
if (!align && props.center) align = 'center';
|
|
5
|
+
if (!align && props.toRight) align = 'right';
|
|
6
|
+
if (!align && props.toLeft) align = 'left';
|
|
7
|
+
if (!align) align = defaultValue;
|
|
8
|
+
|
|
9
|
+
return [{ align: align }, Object.assign({}, props, { align: align })];
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -1 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
var _excluded = ["transition"];function _objectWithoutProperties(e, t) {if (null == e) return {};var o,r,i = _objectWithoutPropertiesLoose(e, t);if (Object.getOwnPropertySymbols) {var n = Object.getOwnPropertySymbols(e);for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);}return i;}function _objectWithoutPropertiesLoose(r, e) {if (null == r) return {};var t = {};for (var n in r) if ({}.hasOwnProperty.call(r, n)) {if (-1 !== e.indexOf(n)) continue;t[n] = r[n];}return t;}function _slicedToArray(r, e) {return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r, a) {if (r) {if ("string" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}function _iterableToArrayLimit(r, l) {var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];if (null != t) {var e,n,i,u,a = [],f = !0,o = !1;try {if (i = (t = t.call(r)).next, 0 === l) {if (Object(t) !== t) return;f = !1;} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);} catch (r) {o = !0, n = r;} finally {try {if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;} finally {if (o) throw n;}}return a;}}function _arrayWithHoles(r) {if (Array.isArray(r)) return r;}import { clearProps, flattenStyle } from "./_helpers";
|
|
2
|
+
|
|
3
|
+
export function useAnimationModifier(_ref) {var _ref2 = _slicedToArray(_ref, 2),values = _ref2[0],props = _ref2[1];
|
|
4
|
+
var transition = props.transition,restProps = _objectWithoutProperties(props, _excluded);
|
|
5
|
+
|
|
6
|
+
var style = clearProps({ transition: transition });
|
|
7
|
+
|
|
8
|
+
return [
|
|
9
|
+
values, Object.assign({},
|
|
10
|
+
|
|
11
|
+
restProps, {
|
|
12
|
+
style: Object.assign({},
|
|
13
|
+
flattenStyle(props.style),
|
|
14
|
+
style) })];
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
}
|
|
@@ -1 +1,64 @@
|
|
|
1
|
-
|
|
1
|
+
var _excluded = ["open", "onClose", "lazy", "unmountOnClose"];function _toConsumableArray(r) {return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();}function _nonIterableSpread() {throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArray(r) {if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);}function _arrayWithoutHoles(r) {if (Array.isArray(r)) return _arrayLikeToArray(r);}function _objectWithoutProperties(e, t) {if (null == e) return {};var o,r,i = _objectWithoutPropertiesLoose(e, t);if (Object.getOwnPropertySymbols) {var n = Object.getOwnPropertySymbols(e);for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);}return i;}function _objectWithoutPropertiesLoose(r, e) {if (null == r) return {};var t = {};for (var n in r) if ({}.hasOwnProperty.call(r, n)) {if (-1 !== e.indexOf(n)) continue;t[n] = r[n];}return t;}function _slicedToArray(r, e) {return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r, a) {if (r) {if ("string" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}function _iterableToArrayLimit(r, l) {var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];if (null != t) {var e,n,i,u,a = [],f = !0,o = !1;try {if (i = (t = t.call(r)).next, 0 === l) {if (Object(t) !== t) return;f = !1;} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);} catch (r) {o = !0, n = r;} finally {try {if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;} finally {if (o) throw n;}}return a;}}function _arrayWithHoles(r) {if (Array.isArray(r)) return r;}import { pipe } from 'ramda';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import { useApplyStyles } from "../applyStyles";
|
|
5
|
+
import { useFadeEffect } from "./fadeEffect";
|
|
6
|
+
import { useScaleEffect } from "./scaleEffect";
|
|
7
|
+
import { useSlideEffect } from "./slideEffect";
|
|
8
|
+
|
|
9
|
+
export function useAnimatedEffects(_ref) {var _ref2 = _slicedToArray(_ref, 2),values = _ref2[0],_ref2$ = _ref2[1],open = _ref2$.open,onClose = _ref2$.onClose,_ref2$$lazy = _ref2$.lazy,lazy = _ref2$$lazy === void 0 ? false : _ref2$$lazy,_ref2$$unmountOnClose = _ref2$.unmountOnClose,unmountOnClose = _ref2$$unmountOnClose === void 0 ? false : _ref2$$unmountOnClose,props = _objectWithoutProperties(_ref2$, _excluded);
|
|
10
|
+
var unmountTimerRef = React.useRef();
|
|
11
|
+
var _React$useState = React.useState(0),_React$useState2 = _slicedToArray(_React$useState, 2),totalDuration = _React$useState2[0],setTotalDuration = _React$useState2[1];
|
|
12
|
+
var _React$useState3 = React.useState(''),_React$useState4 = _slicedToArray(_React$useState3, 2),transform = _React$useState4[0],setTransform = _React$useState4[1];
|
|
13
|
+
var _React$useState5 = React.useState([]),_React$useState6 = _slicedToArray(_React$useState5, 2),transitions = _React$useState6[0],setTransitions = _React$useState6[1];
|
|
14
|
+
var _React$useState7 = React.useState(open || !lazy),_React$useState8 = _slicedToArray(_React$useState7, 2),hasOpened = _React$useState8[0],setHasOpened = _React$useState8[1];
|
|
15
|
+
var _React$useState9 = React.useState(open || !lazy),_React$useState0 = _slicedToArray(_React$useState9, 2),render = _React$useState0[0],setRender = _React$useState0[1];
|
|
16
|
+
|
|
17
|
+
var useRegisterEffect = function useRegisterEffect(effect) {
|
|
18
|
+
React.useEffect(function () {
|
|
19
|
+
if (!(effect != null && effect.duration)) return;
|
|
20
|
+
setTotalDuration(function (v) {return v > effect.duration ? v : effect.duration;});
|
|
21
|
+
}, []);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
var useAddTransition = function useAddTransition(effect, transition) {
|
|
25
|
+
React.useEffect(function () {
|
|
26
|
+
if (!(effect != null && effect.duration)) return;
|
|
27
|
+
setTransitions(function (v) {return [].concat(_toConsumableArray(v), [transition]);});
|
|
28
|
+
}, []);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
React.useEffect(function () {
|
|
32
|
+
if (open) {
|
|
33
|
+
clearTimeout(unmountTimerRef == null ? void 0 : unmountTimerRef.current);
|
|
34
|
+
setHasOpened(true);
|
|
35
|
+
setRender(true);
|
|
36
|
+
} else if (unmountOnClose) {
|
|
37
|
+
unmountTimerRef.current = setTimeout(function () {return setRender(false);}, totalDuration);
|
|
38
|
+
}
|
|
39
|
+
}, [open]);
|
|
40
|
+
|
|
41
|
+
return pipe(
|
|
42
|
+
useFadeEffect,
|
|
43
|
+
useSlideEffect,
|
|
44
|
+
useScaleEffect,
|
|
45
|
+
useApplyStyles({ transition: transitions.join(',') })
|
|
46
|
+
)([Object.assign({},
|
|
47
|
+
|
|
48
|
+
values, {
|
|
49
|
+
useRegisterEffect: useRegisterEffect,
|
|
50
|
+
useAddTransition: useAddTransition,
|
|
51
|
+
open: open,
|
|
52
|
+
onClose: onClose,
|
|
53
|
+
lazy: lazy,
|
|
54
|
+
unmountOnClose: unmountOnClose,
|
|
55
|
+
transform: transform,
|
|
56
|
+
setTransform: setTransform,
|
|
57
|
+
hasOpened: hasOpened,
|
|
58
|
+
setHasOpened: setHasOpened,
|
|
59
|
+
render: render,
|
|
60
|
+
setRender: setRender }),
|
|
61
|
+
|
|
62
|
+
props]
|
|
63
|
+
);
|
|
64
|
+
}
|
|
@@ -1 +1,55 @@
|
|
|
1
|
-
|
|
1
|
+
var _excluded = ["open", "onClose", "lazy", "unmountOnClose"];function _objectWithoutProperties(e, t) {if (null == e) return {};var o,r,i = _objectWithoutPropertiesLoose(e, t);if (Object.getOwnPropertySymbols) {var n = Object.getOwnPropertySymbols(e);for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);}return i;}function _objectWithoutPropertiesLoose(r, e) {if (null == r) return {};var t = {};for (var n in r) if ({}.hasOwnProperty.call(r, n)) {if (-1 !== e.indexOf(n)) continue;t[n] = r[n];}return t;}function _slicedToArray(r, e) {return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r, a) {if (r) {if ("string" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}function _iterableToArrayLimit(r, l) {var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];if (null != t) {var e,n,i,u,a = [],f = !0,o = !1;try {if (i = (t = t.call(r)).next, 0 === l) {if (Object(t) !== t) return;f = !1;} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);} catch (r) {o = !0, n = r;} finally {try {if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;} finally {if (o) throw n;}}return a;}}function _arrayWithHoles(r) {if (Array.isArray(r)) return r;}import { pipe } from 'ramda';
|
|
2
|
+
import { useSharedValue } from 'react-native-reanimated';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
import { useFadeEffect } from "./fadeEffect";
|
|
6
|
+
import { useScaleEffect } from "./scaleEffect";
|
|
7
|
+
import { useSlideEffect } from "./slideEffect";
|
|
8
|
+
|
|
9
|
+
export function useAnimatedEffects(_ref) {var _ref2 = _slicedToArray(_ref, 2),values = _ref2[0],_ref2$ = _ref2[1],_ref2$$open = _ref2$.open,open = _ref2$$open === void 0 ? true : _ref2$$open,onClose = _ref2$.onClose,_ref2$$lazy = _ref2$.lazy,lazy = _ref2$$lazy === void 0 ? false : _ref2$$lazy,_ref2$$unmountOnClose = _ref2$.unmountOnClose,unmountOnClose = _ref2$$unmountOnClose === void 0 ? false : _ref2$$unmountOnClose,props = _objectWithoutProperties(_ref2$, _excluded);
|
|
10
|
+
var unmountTimerRef = React.useRef();
|
|
11
|
+
var _React$useState = React.useState(0),_React$useState2 = _slicedToArray(_React$useState, 2),totalDuration = _React$useState2[0],setTotalDuration = _React$useState2[1];
|
|
12
|
+
var _React$useState3 = React.useState(open || !lazy),_React$useState4 = _slicedToArray(_React$useState3, 2),hasOpened = _React$useState4[0],setHasOpened = _React$useState4[1];
|
|
13
|
+
var _React$useState5 = React.useState(open || !lazy),_React$useState6 = _slicedToArray(_React$useState5, 2),render = _React$useState6[0],setRender = _React$useState6[1];
|
|
14
|
+
|
|
15
|
+
var useRegisterEffect = function useRegisterEffect(effect) {
|
|
16
|
+
React.useEffect(function () {
|
|
17
|
+
if (!(effect != null && effect.duration)) return;
|
|
18
|
+
setTotalDuration(function (v) {return v > effect.duration ? v : effect.duration;});
|
|
19
|
+
}, []);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
var translate = useSharedValue(0);
|
|
23
|
+
|
|
24
|
+
React.useEffect(function () {
|
|
25
|
+
if (open) {
|
|
26
|
+
clearTimeout(unmountTimerRef == null ? void 0 : unmountTimerRef.current);
|
|
27
|
+
setHasOpened(true);
|
|
28
|
+
setRender(true);
|
|
29
|
+
} else if (unmountOnClose) {
|
|
30
|
+
unmountTimerRef.current = setTimeout(function () {return setRender(false);}, totalDuration);
|
|
31
|
+
}
|
|
32
|
+
}, [open]);
|
|
33
|
+
|
|
34
|
+
return pipe(
|
|
35
|
+
useFadeEffect,
|
|
36
|
+
useSlideEffect,
|
|
37
|
+
useScaleEffect
|
|
38
|
+
)([Object.assign({},
|
|
39
|
+
|
|
40
|
+
values, {
|
|
41
|
+
animatedStyles: [],
|
|
42
|
+
useRegisterEffect: useRegisterEffect,
|
|
43
|
+
useAddTransition: function useAddTransition() {},
|
|
44
|
+
open: open,
|
|
45
|
+
onClose: onClose,
|
|
46
|
+
lazy: lazy,
|
|
47
|
+
unmountOnClose: unmountOnClose,
|
|
48
|
+
hasOpened: hasOpened,
|
|
49
|
+
setHasOpened: setHasOpened,
|
|
50
|
+
render: render,
|
|
51
|
+
setRender: setRender }), Object.assign({},
|
|
52
|
+
|
|
53
|
+
props, { animatedStyles: [] })]
|
|
54
|
+
);
|
|
55
|
+
}
|
|
@@ -1 +1,55 @@
|
|
|
1
|
-
|
|
1
|
+
var _excluded = ["open", "onClose", "lazy", "unmountOnClose"];function _objectWithoutProperties(e, t) {if (null == e) return {};var o,r,i = _objectWithoutPropertiesLoose(e, t);if (Object.getOwnPropertySymbols) {var n = Object.getOwnPropertySymbols(e);for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);}return i;}function _objectWithoutPropertiesLoose(r, e) {if (null == r) return {};var t = {};for (var n in r) if ({}.hasOwnProperty.call(r, n)) {if (-1 !== e.indexOf(n)) continue;t[n] = r[n];}return t;}function _slicedToArray(r, e) {return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r, a) {if (r) {if ("string" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}function _iterableToArrayLimit(r, l) {var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];if (null != t) {var e,n,i,u,a = [],f = !0,o = !1;try {if (i = (t = t.call(r)).next, 0 === l) {if (Object(t) !== t) return;f = !1;} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);} catch (r) {o = !0, n = r;} finally {try {if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;} finally {if (o) throw n;}}return a;}}function _arrayWithHoles(r) {if (Array.isArray(r)) return r;}import { pipe } from 'ramda';
|
|
2
|
+
import { useSharedValue } from 'react-native-reanimated';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
import { useFadeEffect } from "./fadeEffect";
|
|
6
|
+
import { useScaleEffect } from "./scaleEffect";
|
|
7
|
+
import { useSlideEffect } from "./slideEffect";
|
|
8
|
+
|
|
9
|
+
export function useAnimatedEffects(_ref) {var _ref2 = _slicedToArray(_ref, 2),values = _ref2[0],_ref2$ = _ref2[1],_ref2$$open = _ref2$.open,open = _ref2$$open === void 0 ? true : _ref2$$open,onClose = _ref2$.onClose,_ref2$$lazy = _ref2$.lazy,lazy = _ref2$$lazy === void 0 ? false : _ref2$$lazy,_ref2$$unmountOnClose = _ref2$.unmountOnClose,unmountOnClose = _ref2$$unmountOnClose === void 0 ? false : _ref2$$unmountOnClose,props = _objectWithoutProperties(_ref2$, _excluded);
|
|
10
|
+
var unmountTimerRef = React.useRef();
|
|
11
|
+
var _React$useState = React.useState(0),_React$useState2 = _slicedToArray(_React$useState, 2),totalDuration = _React$useState2[0],setTotalDuration = _React$useState2[1];
|
|
12
|
+
var _React$useState3 = React.useState(open || !lazy),_React$useState4 = _slicedToArray(_React$useState3, 2),hasOpened = _React$useState4[0],setHasOpened = _React$useState4[1];
|
|
13
|
+
var _React$useState5 = React.useState(open || !lazy),_React$useState6 = _slicedToArray(_React$useState5, 2),render = _React$useState6[0],setRender = _React$useState6[1];
|
|
14
|
+
|
|
15
|
+
var useRegisterEffect = function useRegisterEffect(effect) {
|
|
16
|
+
React.useEffect(function () {
|
|
17
|
+
if (!(effect != null && effect.duration)) return;
|
|
18
|
+
setTotalDuration(function (v) {return v > effect.duration ? v : effect.duration;});
|
|
19
|
+
}, []);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
var translate = useSharedValue(0);
|
|
23
|
+
|
|
24
|
+
React.useEffect(function () {
|
|
25
|
+
if (open) {
|
|
26
|
+
clearTimeout(unmountTimerRef == null ? void 0 : unmountTimerRef.current);
|
|
27
|
+
setHasOpened(true);
|
|
28
|
+
setRender(true);
|
|
29
|
+
} else if (unmountOnClose) {
|
|
30
|
+
unmountTimerRef.current = setTimeout(function () {return setRender(false);}, totalDuration);
|
|
31
|
+
}
|
|
32
|
+
}, [open]);
|
|
33
|
+
|
|
34
|
+
return pipe(
|
|
35
|
+
useFadeEffect,
|
|
36
|
+
useSlideEffect,
|
|
37
|
+
useScaleEffect
|
|
38
|
+
)([Object.assign({},
|
|
39
|
+
|
|
40
|
+
values, {
|
|
41
|
+
animatedStyles: [],
|
|
42
|
+
useRegisterEffect: useRegisterEffect,
|
|
43
|
+
useAddTransition: function useAddTransition() {},
|
|
44
|
+
open: open,
|
|
45
|
+
onClose: onClose,
|
|
46
|
+
lazy: lazy,
|
|
47
|
+
unmountOnClose: unmountOnClose,
|
|
48
|
+
hasOpened: hasOpened,
|
|
49
|
+
setHasOpened: setHasOpened,
|
|
50
|
+
render: render,
|
|
51
|
+
setRender: setRender }), Object.assign({},
|
|
52
|
+
|
|
53
|
+
props, { animatedStyles: [] })]
|
|
54
|
+
);
|
|
55
|
+
}
|
|
@@ -1 +1,46 @@
|
|
|
1
|
-
|
|
1
|
+
var _excluded = ["fade"];function _objectWithoutProperties(e, t) {if (null == e) return {};var o,r,i = _objectWithoutPropertiesLoose(e, t);if (Object.getOwnPropertySymbols) {var n = Object.getOwnPropertySymbols(e);for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);}return i;}function _objectWithoutPropertiesLoose(r, e) {if (null == r) return {};var t = {};for (var n in r) if ({}.hasOwnProperty.call(r, n)) {if (-1 !== e.indexOf(n)) continue;t[n] = r[n];}return t;}function _slicedToArray(r, e) {return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r, a) {if (r) {if ("string" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}function _iterableToArrayLimit(r, l) {var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];if (null != t) {var e,n,i,u,a = [],f = !0,o = !1;try {if (i = (t = t.call(r)).next, 0 === l) {if (Object(t) !== t) return;f = !1;} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);} catch (r) {o = !0, n = r;} finally {try {if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;} finally {if (o) throw n;}}return a;}}function _arrayWithHoles(r) {if (Array.isArray(r)) return r;}import React from 'react';
|
|
2
|
+
import { flattenStyle } from "../_helpers";
|
|
3
|
+
|
|
4
|
+
var DEFAULT_EFFECT = { duration: 300 };
|
|
5
|
+
|
|
6
|
+
export function useFadeEffect(_ref) {var _ref2 = _slicedToArray(_ref, 2),values = _ref2[0],_ref2$ = _ref2[1],fade = _ref2$.fade,props = _objectWithoutProperties(_ref2$, _excluded);
|
|
7
|
+
if (fade === true) fade = DEFAULT_EFFECT;
|
|
8
|
+
if (!!fade) fade = Object.assign({}, DEFAULT_EFFECT, fade);
|
|
9
|
+
var _ref3 = fade || {},duration = _ref3.duration;
|
|
10
|
+
var open = values.open,useRegisterEffect = values.useRegisterEffect,useAddTransition = values.useAddTransition;
|
|
11
|
+
var _React$useState = React.useState(0),_React$useState2 = _slicedToArray(_React$useState, 2),opacity = _React$useState2[0],setOpacity = _React$useState2[1];
|
|
12
|
+
|
|
13
|
+
useRegisterEffect(fade);
|
|
14
|
+
useAddTransition(fade, `opacity ${duration}ms ease-in-out`);
|
|
15
|
+
|
|
16
|
+
React.useEffect(function () {
|
|
17
|
+
if (!fade) return;
|
|
18
|
+
|
|
19
|
+
if (open) {
|
|
20
|
+
setOpacity(0);
|
|
21
|
+
|
|
22
|
+
requestAnimationFrame(function () {
|
|
23
|
+
requestAnimationFrame(function () {
|
|
24
|
+
setOpacity(1);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
} else {
|
|
28
|
+
setOpacity(0);
|
|
29
|
+
}
|
|
30
|
+
}, [open]);
|
|
31
|
+
|
|
32
|
+
if (!fade) return [values, props];
|
|
33
|
+
|
|
34
|
+
var style = { opacity: opacity };
|
|
35
|
+
|
|
36
|
+
return [
|
|
37
|
+
values, Object.assign({},
|
|
38
|
+
|
|
39
|
+
props, {
|
|
40
|
+
style: Object.assign({},
|
|
41
|
+
flattenStyle(props.style),
|
|
42
|
+
style) })];
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
}
|
|
@@ -1 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
var _excluded = ["fade"];function _toConsumableArray(r) {return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();}function _nonIterableSpread() {throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArray(r) {if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);}function _arrayWithoutHoles(r) {if (Array.isArray(r)) return _arrayLikeToArray(r);}function _objectWithoutProperties(e, t) {if (null == e) return {};var o,r,i = _objectWithoutPropertiesLoose(e, t);if (Object.getOwnPropertySymbols) {var n = Object.getOwnPropertySymbols(e);for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);}return i;}function _objectWithoutPropertiesLoose(r, e) {if (null == r) return {};var t = {};for (var n in r) if ({}.hasOwnProperty.call(r, n)) {if (-1 !== e.indexOf(n)) continue;t[n] = r[n];}return t;}function _slicedToArray(r, e) {return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r, a) {if (r) {if ("string" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}function _iterableToArrayLimit(r, l) {var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];if (null != t) {var e,n,i,u,a = [],f = !0,o = !1;try {if (i = (t = t.call(r)).next, 0 === l) {if (Object(t) !== t) return;f = !1;} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);} catch (r) {o = !0, n = r;} finally {try {if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;} finally {if (o) throw n;}}return a;}}function _arrayWithHoles(r) {if (Array.isArray(r)) return r;}import { useSharedValue, withTiming, useAnimatedStyle } from 'react-native-reanimated';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
var DEFAULT_EFFECT = { duration: 300 };
|
|
5
|
+
|
|
6
|
+
export function useFadeEffect(_ref) {var _ref2 = _slicedToArray(_ref, 2),values = _ref2[0],_ref2$ = _ref2[1],fade = _ref2$.fade,props = _objectWithoutProperties(_ref2$, _excluded);
|
|
7
|
+
if (fade === true) fade = DEFAULT_EFFECT;
|
|
8
|
+
if (!!fade) fade = Object.assign({}, DEFAULT_EFFECT, fade);
|
|
9
|
+
var _ref3 = fade || {},duration = _ref3.duration;
|
|
10
|
+
var open = values.open,useRegisterEffect = values.useRegisterEffect;
|
|
11
|
+
var opacity = useSharedValue(0);
|
|
12
|
+
|
|
13
|
+
useRegisterEffect(fade);
|
|
14
|
+
|
|
15
|
+
React.useEffect(function () {
|
|
16
|
+
if (!fade) return;
|
|
17
|
+
|
|
18
|
+
if (open) {
|
|
19
|
+
opacity.value = 0;
|
|
20
|
+
opacity.value = withTiming(1, { duration: duration });
|
|
21
|
+
} else {
|
|
22
|
+
opacity.value = withTiming(0, { duration: duration });
|
|
23
|
+
}
|
|
24
|
+
}, [open]);
|
|
25
|
+
|
|
26
|
+
var animatedStyle = useAnimatedStyle(function () {
|
|
27
|
+
return { opacity: opacity.value };
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
if (!fade) return [values, props];
|
|
31
|
+
|
|
32
|
+
return [values, Object.assign({}, props, { animatedStyles: [].concat(_toConsumableArray(props.animatedStyles), [animatedStyle]) })];
|
|
33
|
+
}
|