@neko-os/ui 0.0.4 → 0.0.6
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/NekoUI.js +1 -1
- package/dist/abstractions/ActivityIndicator.js +1 -0
- package/dist/abstractions/ActivityIndicator.native.js +1 -0
- package/dist/abstractions/AnimatedView.js +1 -0
- package/dist/abstractions/AnimatedView.native.js +1 -0
- package/dist/abstractions/BKTouchableOpacity.js +0 -0
- package/dist/abstractions/DraggableSlideView.js +1 -0
- package/dist/abstractions/DraggableSlideView.native.js +1 -0
- package/dist/abstractions/HiddenInput.js +1 -0
- package/dist/abstractions/HiddenInput.native.js +1 -0
- package/dist/abstractions/Icon.js +1 -1
- package/dist/abstractions/Icon.native.js +1 -1
- package/dist/abstractions/Icon.web.js +1 -1
- package/dist/abstractions/Image.js +1 -0
- package/dist/abstractions/Image.native.js +1 -0
- package/dist/abstractions/Image.web.js +1 -0
- package/dist/abstractions/Platform.js +1 -0
- package/dist/abstractions/Platform.native.js +1 -0
- package/dist/abstractions/Platform.web.js +1 -0
- package/dist/abstractions/SafeAreaView.js +1 -0
- package/dist/abstractions/SafeAreaView.native.js +1 -0
- package/dist/abstractions/Switch.js +1 -0
- package/dist/abstractions/Switch.native.js +1 -0
- package/dist/abstractions/Table.js +1 -0
- package/dist/abstractions/Table.native.js +1 -0
- package/dist/abstractions/Text.js +1 -1
- package/dist/abstractions/TextInput.js +1 -0
- package/dist/abstractions/TextInput.native.js +1 -0
- package/dist/abstractions/TextInput.web.js +1 -0
- package/dist/abstractions/TouchableOpacity.js +1 -1
- package/dist/abstractions/TouchableOpacity.native.js +1 -0
- package/dist/abstractions/TouchableOpacity.web.js +1 -0
- package/dist/abstractions/View.js +1 -1
- package/dist/abstractions/helpers/componentSize.js +1 -0
- package/dist/abstractions/helpers/componentSize.native.js +1 -0
- package/dist/abstractions/helpers/transformStyle.js +1 -0
- package/dist/abstractions/helpers/transformStyle.native.js +1 -0
- package/dist/abstractions/helpers/windowWidth.js +1 -0
- package/dist/abstractions/helpers/windowWidth.native.js +1 -0
- package/dist/abstractions/helpers/windowWidth.web.js +1 -0
- package/dist/components/actions/Breadcrumb.js +1 -0
- package/dist/components/actions/Button.js +1 -0
- package/dist/components/actions/Dropdown.js +1 -0
- package/dist/components/actions/Link.js +1 -0
- package/dist/components/actions/index.js +1 -0
- package/dist/components/actions/menu/HorizontalMenu.js +1 -0
- package/dist/components/actions/menu/Menu.js +1 -0
- package/dist/components/actions/menu/SubmenuWrapper.js +1 -0
- package/dist/components/actions/menu/VerticalMenu.js +1 -0
- package/dist/components/animations/AnimatedView.js +1 -0
- package/dist/components/animations/DraggableSlideView.js +1 -0
- package/dist/components/animations/index.js +1 -0
- package/dist/components/calendar/DayPicker.js +1 -0
- package/dist/components/calendar/_helpers/calendarDays.js +1 -0
- package/dist/components/calendar/index.js +1 -0
- package/dist/components/feedback/index.js +1 -0
- package/dist/components/feedback/notifications/Notification.js +1 -0
- package/dist/components/feedback/notifications/NotificationsHandler.js +1 -0
- package/dist/components/form/Form.js +1 -0
- package/dist/components/form/FormGroup.js +1 -0
- package/dist/components/form/FormItem.js +1 -0
- package/dist/components/form/FormList.js +1 -0
- package/dist/components/form/FormWrapperComponent.js +1 -0
- package/dist/components/form/FormWrapperComponent.native.js +1 -0
- package/dist/components/form/SubmitButton.js +1 -0
- package/dist/{form → components/form}/index.js +1 -1
- package/dist/components/form/useNewForm.js +1 -0
- package/dist/components/form/useWatch.js +1 -0
- package/dist/components/helpers/LazyRender.js +1 -0
- package/dist/components/helpers/LazyRender.native.js +1 -0
- package/dist/components/helpers/Portal.js +1 -0
- package/dist/components/helpers/PortalHandler.js +1 -0
- package/dist/components/helpers/Responsive.js +1 -0
- package/dist/components/helpers/Separator.js +1 -0
- package/dist/components/helpers/VerticalView.js +1 -0
- package/dist/components/helpers/index.js +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/inputs/Checkbox.js +1 -0
- package/dist/components/inputs/InputWrapper.js +1 -0
- package/dist/components/inputs/Picker.js +1 -0
- package/dist/components/inputs/Radio.js +1 -0
- package/dist/components/inputs/Switch.js +1 -0
- package/dist/components/inputs/TextInput.js +1 -0
- package/dist/components/inputs/index.js +1 -0
- package/dist/components/layout/Layout.js +1 -0
- package/dist/components/layout/LayoutContent.js +1 -0
- package/dist/components/layout/LayoutHeader.js +1 -0
- package/dist/components/layout/LayoutSider.js +1 -0
- package/dist/components/layout/index.js +1 -0
- package/dist/components/presentation/Avatar.js +1 -0
- package/dist/components/presentation/AvatarLabel.js +1 -0
- package/dist/components/presentation/Badge.js +1 -0
- package/dist/components/presentation/ContentLabel.js +1 -0
- package/dist/components/presentation/Icon.js +1 -0
- package/dist/components/presentation/IconLabel.js +1 -0
- package/dist/components/presentation/Image.js +1 -0
- package/dist/components/presentation/LabelValue.js +1 -0
- package/dist/components/presentation/Result.js +1 -0
- package/dist/components/presentation/ResultBar.js +1 -0
- package/dist/components/presentation/Tag.js +1 -0
- package/dist/components/presentation/Tooltip.js +1 -0
- package/dist/components/presentation/index.js +1 -0
- package/dist/components/state/Loading.js +1 -0
- package/dist/components/state/LoadingView.js +1 -0
- package/dist/components/state/index.js +1 -0
- package/dist/components/structure/Accordion.js +1 -0
- package/dist/components/structure/AccordionGroup.js +1 -0
- package/dist/components/structure/Card.js +1 -0
- package/dist/components/structure/Col.js +1 -0
- package/dist/components/structure/Row.js +1 -0
- package/dist/components/structure/SafeAreaView.js +1 -0
- package/dist/components/structure/View.js +1 -0
- package/dist/components/structure/index.js +1 -0
- package/dist/components/structure/overlay/OverlayHandler.js +1 -0
- package/dist/components/structure/overlay/OverlayHandler.native.js +1 -0
- package/dist/components/structure/overlay/OverlayWrapper.js +1 -0
- package/dist/components/structure/overlay/calculatePosition.js +1 -0
- package/dist/components/structure/overlay/smartPlacement.js +1 -0
- package/dist/components/structure/popover/Popover.js +1 -0
- package/dist/components/structure/popover/Popover.native.js +1 -0
- package/dist/components/structure/popover/PopoverContent.js +1 -0
- package/dist/components/table/DataTable.js +1 -0
- package/dist/components/table/Pagination.js +1 -0
- package/dist/components/table/Table.js +1 -0
- package/dist/components/table/TableCol.js +1 -0
- package/dist/components/table/TableHeader.js +1 -0
- package/dist/components/table/TableHeaderRow.js +1 -0
- package/dist/components/table/TableRow.js +1 -0
- package/dist/components/table/index.js +1 -0
- package/dist/components/text/Text.js +1 -0
- package/dist/components/text/VerticalText.js +1 -0
- package/dist/components/text/index.js +1 -0
- package/dist/helpers/debounce.js +1 -0
- package/dist/helpers/index.js +1 -0
- package/dist/helpers/options.js +1 -0
- package/dist/helpers/random.js +1 -0
- package/dist/index.css +15 -0
- package/dist/index.js +1 -1
- package/dist/modifiers/alignConverter.js +1 -0
- package/dist/modifiers/animation.js +1 -0
- package/dist/modifiers/animations/animatedEffects.js +1 -0
- package/dist/modifiers/animations/animatedEffects.native.js +1 -0
- package/dist/modifiers/animations/animatedEffects.web.js +1 -0
- package/dist/modifiers/animations/fadeEffect.js +1 -0
- package/dist/modifiers/animations/fadeEffect.native.js +1 -0
- package/dist/modifiers/animations/slideEffect.js +1 -0
- package/dist/modifiers/animations/slideEffect.native.js +1 -0
- package/dist/modifiers/applyStyles.js +1 -0
- package/dist/modifiers/background.js +1 -1
- package/dist/modifiers/border.js +1 -1
- package/dist/modifiers/colorConverter.js +1 -0
- package/dist/modifiers/default.js +1 -0
- package/dist/modifiers/display.js +1 -0
- package/dist/modifiers/flex.js +1 -1
- package/dist/modifiers/flexWrapper.js +1 -1
- package/dist/modifiers/fullColor.js +1 -0
- package/dist/modifiers/grid.js +1 -0
- package/dist/modifiers/logger.js +1 -0
- package/dist/modifiers/margin.js +1 -1
- package/dist/modifiers/overflow.js +1 -0
- package/dist/modifiers/padding.js +1 -1
- package/dist/modifiers/position.js +1 -1
- package/dist/modifiers/responsiveConverter.js +1 -0
- package/dist/modifiers/shadow.js +1 -1
- package/dist/modifiers/size.js +1 -1
- package/dist/modifiers/sizeConverter.js +1 -0
- package/dist/modifiers/state.js +1 -0
- package/dist/modifiers/text.js +1 -1
- package/dist/modifiers/textConverter.js +1 -0
- package/dist/modifiers/themeComponent.js +1 -0
- package/dist/responsive/ResponsiveHandler.js +1 -0
- package/dist/responsive/index.js +1 -0
- package/dist/responsive/responsiveHooks.js +1 -0
- package/dist/theme/ThemeHandler.js +1 -1
- package/dist/theme/default/base.js +1 -1
- package/dist/theme/default/cyberpunkTheme.js +1 -1
- package/dist/theme/default/darkTheme.js +1 -1
- package/dist/theme/default/deepWoodsTheme.js +1 -1
- package/dist/theme/default/forestTheme.js +1 -1
- package/dist/theme/default/hackerTheme.js +1 -0
- package/dist/theme/default/lightTheme.js +1 -1
- package/dist/theme/default/midnightTheme.js +1 -1
- package/dist/theme/default/msdosTheme.js +1 -0
- package/dist/theme/default/oceanTheme.js +1 -1
- package/dist/theme/default/pastelTheme.js +1 -1
- package/dist/theme/default/sunsetTheme.js +1 -1
- package/dist/theme/default/themes.js +1 -1
- package/dist/theme/helpers/colorScale.js +1 -0
- package/dist/theme/helpers/contrastColor.js +1 -0
- package/dist/theme/helpers/dynamicColor.js +1 -0
- package/dist/theme/helpers/mergePreset.js +1 -0
- package/dist/theme/helpers/relatedScales.js +1 -0
- package/dist/theme/helpers/sizeScale.js +1 -1
- package/dist/theme/helpers/textScale.js +1 -0
- package/package.json +8 -4
- package/src/NekoUI.js +15 -1
- package/src/abstractions/ActivityIndicator.js +31 -0
- package/src/abstractions/ActivityIndicator.native.js +44 -0
- package/src/abstractions/AnimatedView.js +3 -0
- package/src/abstractions/AnimatedView.native.js +6 -0
- package/src/abstractions/BKTouchableOpacity.js +12 -0
- package/src/abstractions/DraggableSlideView.js +85 -0
- package/src/abstractions/DraggableSlideView.native.js +62 -0
- package/src/abstractions/HiddenInput.js +3 -0
- package/src/abstractions/HiddenInput.native.js +3 -0
- package/src/abstractions/Icon.js +4 -20
- package/src/abstractions/Icon.native.js +11 -2
- package/src/abstractions/Icon.web.js +11 -2
- package/src/abstractions/Image.js +12 -0
- package/src/abstractions/Image.native.js +7 -0
- package/src/abstractions/Image.web.js +7 -0
- package/src/abstractions/Platform.js +1 -0
- package/src/abstractions/Platform.native.js +3 -0
- package/src/abstractions/Platform.web.js +3 -0
- package/src/abstractions/SafeAreaView.js +3 -0
- package/src/abstractions/SafeAreaView.native.js +3 -0
- package/src/abstractions/Switch.js +97 -0
- package/src/abstractions/Switch.native.js +12 -0
- package/src/abstractions/Table.js +29 -0
- package/src/abstractions/Table.native.js +19 -0
- package/src/abstractions/Text.js +13 -2
- package/src/abstractions/TextInput.js +3 -0
- package/src/abstractions/TextInput.native.js +5 -0
- package/src/abstractions/TextInput.web.js +5 -0
- package/src/abstractions/TouchableOpacity.js +3 -11
- package/src/abstractions/TouchableOpacity.native.js +3 -0
- package/src/abstractions/TouchableOpacity.web.js +3 -0
- package/src/abstractions/View.js +2 -2
- package/src/abstractions/helpers/componentSize.js +13 -0
- package/src/abstractions/helpers/componentSize.native.js +12 -0
- package/src/abstractions/helpers/transformStyle.js +8 -0
- package/src/abstractions/helpers/transformStyle.native.js +3 -0
- package/src/abstractions/helpers/windowWidth.js +13 -0
- package/src/abstractions/helpers/windowWidth.native.js +6 -0
- package/src/abstractions/helpers/windowWidth.web.js +6 -0
- package/src/components/actions/Breadcrumb.js +47 -0
- package/src/components/actions/Button.js +67 -0
- package/src/components/actions/Dropdown.js +68 -0
- package/src/components/actions/Link.js +52 -0
- package/src/components/actions/index.js +5 -0
- package/src/components/actions/menu/HorizontalMenu.js +96 -0
- package/src/components/actions/menu/Menu.js +7 -0
- package/src/components/actions/menu/SubmenuWrapper.js +16 -0
- package/src/components/actions/menu/VerticalMenu.js +107 -0
- package/src/components/animations/AnimatedView.js +45 -0
- package/src/components/animations/DraggableSlideView.js +42 -0
- package/src/components/animations/index.js +2 -0
- package/src/components/calendar/DayPicker.js +91 -0
- package/src/components/calendar/_helpers/calendarDays.js +16 -0
- package/src/components/calendar/index.js +1 -0
- package/src/components/feedback/index.js +1 -0
- package/src/components/feedback/notifications/Notification.js +37 -0
- package/src/components/feedback/notifications/NotificationsHandler.js +65 -0
- package/src/components/form/Form.js +25 -0
- package/src/{form → components/form}/FormGroup.js +4 -4
- package/src/components/form/FormItem.js +56 -0
- package/src/{form → components/form}/FormList.js +47 -11
- package/src/components/form/FormWrapperComponent.js +43 -0
- package/src/components/form/FormWrapperComponent.native.js +5 -0
- package/src/components/form/SubmitButton.js +20 -0
- package/src/{form → components/form}/index.js +3 -1
- package/src/components/form/useNewForm.js +67 -0
- package/src/components/form/useWatch.js +70 -0
- package/src/components/helpers/LazyRender.js +55 -0
- package/src/components/helpers/LazyRender.native.js +58 -0
- package/src/components/helpers/Portal.js +21 -0
- package/src/components/helpers/PortalHandler.js +32 -0
- package/src/components/helpers/Responsive.js +18 -0
- package/src/components/helpers/Separator.js +45 -0
- package/src/components/helpers/VerticalView.js +34 -0
- package/src/components/helpers/index.js +6 -0
- package/src/components/index.js +13 -0
- package/src/components/inputs/Checkbox.js +56 -0
- package/src/components/inputs/InputWrapper.js +79 -0
- package/src/components/inputs/Picker.js +116 -0
- package/src/components/inputs/Radio.js +55 -0
- package/src/components/inputs/Switch.js +60 -0
- package/src/components/inputs/TextInput.js +22 -0
- package/src/components/inputs/index.js +6 -0
- package/src/components/layout/Layout.js +40 -0
- package/src/components/layout/LayoutContent.js +42 -0
- package/src/components/layout/LayoutHeader.js +69 -0
- package/src/components/layout/LayoutSider.js +64 -0
- package/src/components/layout/index.js +4 -0
- package/src/components/presentation/Avatar.js +79 -0
- package/src/components/presentation/AvatarLabel.js +58 -0
- package/src/components/presentation/Badge.js +90 -0
- package/src/components/presentation/ContentLabel.js +43 -0
- package/src/components/presentation/Icon.js +20 -0
- package/src/components/presentation/IconLabel.js +39 -0
- package/src/components/presentation/Image.js +33 -0
- package/src/components/presentation/LabelValue.js +49 -0
- package/src/components/presentation/Result.js +60 -0
- package/src/components/presentation/ResultBar.js +56 -0
- package/src/components/presentation/Tag.js +69 -0
- package/src/components/presentation/Tooltip.js +43 -0
- package/src/components/presentation/index.js +11 -0
- package/src/components/state/Loading.js +20 -0
- package/src/components/state/LoadingView.js +28 -0
- package/src/components/state/index.js +2 -0
- package/src/components/structure/Accordion.js +69 -0
- package/src/components/structure/AccordionGroup.js +35 -0
- package/src/components/structure/Card.js +45 -0
- package/src/components/structure/Col.js +22 -0
- package/src/components/structure/Row.js +42 -0
- package/src/components/structure/SafeAreaView.js +42 -0
- package/src/components/structure/View.js +42 -0
- package/src/components/structure/index.js +8 -0
- package/src/components/structure/overlay/OverlayHandler.js +70 -0
- package/src/components/structure/overlay/OverlayHandler.native.js +6 -0
- package/src/components/structure/overlay/OverlayWrapper.js +52 -0
- package/src/components/structure/overlay/calculatePosition.js +29 -0
- package/src/components/structure/overlay/smartPlacement.js +32 -0
- package/src/components/structure/popover/Popover.js +69 -0
- package/src/components/structure/popover/Popover.native.js +75 -0
- package/src/components/structure/popover/PopoverContent.js +18 -0
- package/src/components/table/DataTable.js +57 -0
- package/src/components/table/Pagination.js +128 -0
- package/src/components/table/Table.js +65 -0
- package/src/components/table/TableCol.js +67 -0
- package/src/components/table/TableHeader.js +69 -0
- package/src/components/table/TableHeaderRow.js +31 -0
- package/src/components/table/TableRow.js +30 -0
- package/src/components/table/index.js +7 -0
- package/src/components/text/Text.js +32 -0
- package/src/components/text/VerticalText.js +29 -0
- package/src/components/text/index.js +2 -0
- package/src/helpers/debounce.js +9 -0
- package/src/helpers/index.js +3 -0
- package/src/helpers/options.js +65 -0
- package/src/helpers/random.js +5 -0
- package/src/index.css +15 -0
- package/src/index.js +3 -5
- package/src/modifiers/alignConverter.js +11 -0
- package/src/modifiers/animation.js +18 -0
- package/src/modifiers/animations/animatedEffects.js +63 -0
- package/src/modifiers/animations/animatedEffects.native.js +53 -0
- package/src/modifiers/animations/animatedEffects.web.js +3 -0
- package/src/modifiers/animations/fadeEffect.js +43 -0
- package/src/modifiers/animations/fadeEffect.native.js +33 -0
- package/src/modifiers/animations/slideEffect.js +61 -0
- package/src/modifiers/animations/slideEffect.native.js +53 -0
- package/src/modifiers/applyStyles.js +7 -0
- package/src/modifiers/background.js +10 -7
- package/src/modifiers/border.js +40 -13
- package/src/modifiers/colorConverter.js +13 -0
- package/src/modifiers/default.js +9 -0
- package/src/modifiers/display.js +22 -0
- package/src/modifiers/flex.js +11 -8
- package/src/modifiers/flexWrapper.js +58 -14
- package/src/modifiers/fullColor.js +29 -0
- package/src/modifiers/grid.js +27 -0
- package/src/modifiers/logger.js +6 -0
- package/src/modifiers/margin.js +10 -7
- package/src/modifiers/overflow.js +23 -0
- package/src/modifiers/padding.js +10 -7
- package/src/modifiers/position.js +20 -9
- package/src/modifiers/responsiveConverter.js +19 -0
- package/src/modifiers/shadow.js +10 -7
- package/src/modifiers/size.js +18 -9
- package/src/modifiers/sizeConverter.js +12 -0
- package/src/modifiers/state.js +33 -0
- package/src/modifiers/text.js +14 -13
- package/src/modifiers/textConverter.js +12 -0
- package/src/modifiers/themeComponent.js +11 -0
- package/src/responsive/ResponsiveHandler.js +28 -0
- package/src/responsive/index.js +2 -0
- package/src/responsive/responsiveHooks.js +54 -0
- package/src/theme/ThemeHandler.js +31 -33
- package/src/theme/default/base.js +29 -17
- package/src/theme/default/cyberpunkTheme.js +1 -0
- package/src/theme/default/darkTheme.js +2 -1
- package/src/theme/default/deepWoodsTheme.js +1 -0
- package/src/theme/default/forestTheme.js +1 -0
- package/src/theme/default/hackerTheme.js +40 -0
- package/src/theme/default/lightTheme.js +1 -0
- package/src/theme/default/midnightTheme.js +1 -0
- package/src/theme/default/msdosTheme.js +40 -0
- package/src/theme/default/oceanTheme.js +1 -0
- package/src/theme/default/pastelTheme.js +1 -0
- package/src/theme/default/sunsetTheme.js +1 -0
- package/src/theme/default/themes.js +4 -0
- package/src/theme/helpers/colorScale.js +11 -0
- package/src/theme/helpers/contrastColor.js +20 -0
- package/src/theme/helpers/dynamicColor.js +32 -0
- package/src/theme/helpers/mergePreset.js +7 -0
- package/src/theme/helpers/relatedScales.js +34 -0
- package/src/theme/helpers/sizeScale.js +17 -4
- package/src/theme/helpers/textScale.js +15 -0
- package/dist/actions/Button.js +0 -1
- package/dist/actions/index.js +0 -1
- package/dist/form/Form.js +0 -1
- package/dist/form/FormGroup.js +0 -1
- package/dist/form/FormItem.js +0 -1
- package/dist/form/FormList.js +0 -1
- package/dist/form/FormWrapperComponent.js +0 -1
- package/dist/form/FormWrapperComponent.native.js +0 -1
- package/dist/form/useForm.js +0 -1
- package/dist/modifiers/fullColor.js.js +0 -1
- package/dist/presentation/Icon.js +0 -1
- package/dist/presentation/Tag.js +0 -1
- package/dist/presentation/index.js +0 -1
- package/dist/structure/Card.js +0 -1
- package/dist/structure/View.js +0 -1
- package/dist/structure/index.js +0 -1
- package/dist/text/Text.js +0 -1
- package/dist/text/index.js +0 -1
- package/dist/theme/default/base.native.js +0 -1
- package/dist/theme/default/base.web.js +0 -1
- package/src/actions/Button.js +0 -48
- package/src/actions/index.js +0 -1
- package/src/form/Form.js +0 -14
- package/src/form/FormItem.js +0 -34
- package/src/form/FormWrapperComponent.js +0 -8
- package/src/form/FormWrapperComponent.native.js +0 -5
- package/src/form/useForm.js +0 -65
- package/src/modifiers/fullColor.js.js +0 -30
- package/src/presentation/Icon.js +0 -14
- package/src/presentation/Tag.js +0 -32
- package/src/presentation/index.js +0 -2
- package/src/structure/Card.js +0 -36
- package/src/structure/View.js +0 -34
- package/src/structure/index.js +0 -2
- package/src/text/Text.js +0 -20
- package/src/text/index.js +0 -1
- package/src/theme/default/base.native.js +0 -58
- package/src/theme/default/base.web.js +0 -3
package/dist/modifiers/size.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["width","height","minH","minHeight","maxH","maxHeight","minWidth","minW","maxWidth","maxW","fullWidth","fullW","fullHeight","fullH","ratio","square"];import{clearProps}from"./_helpers";import{useGetElementHeight}from"../theme/ThemeHandler";export function useSizeModifier(
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";var _excluded=["width","height","minH","minHeight","maxH","maxHeight","minWidth","minW","maxWidth","maxW","fullWidth","fullW","fullHeight","fullH","ratio","square","span","parentSpan"];import{clearProps}from"./_helpers";import{useGetElementHeight}from"../theme/ThemeHandler";export function useSizeModifier(_ref){var _span;var _ref2=_slicedToArray(_ref,2),values=_ref2[0],props=_ref2[1];var getHeight=useGetElementHeight();var _ref3=props||{},width=_ref3.width,height=_ref3.height,minH=_ref3.minH,minHeight=_ref3.minHeight,maxH=_ref3.maxH,maxHeight=_ref3.maxHeight,minWidth=_ref3.minWidth,minW=_ref3.minW,maxWidth=_ref3.maxWidth,maxW=_ref3.maxW,fullWidth=_ref3.fullWidth,fullW=_ref3.fullW,fullHeight=_ref3.fullHeight,fullH=_ref3.fullH,ratio=_ref3.ratio,square=_ref3.square,span=_ref3.span,parentSpan=_ref3.parentSpan,restProps=_objectWithoutProperties(_ref3,_excluded);minHeight=getHeight(minHeight||minH);minWidth=getHeight(minWidth||minW);maxHeight=getHeight(maxHeight||maxH);maxWidth=getHeight(maxWidth||maxW);height=getHeight(height);width=getHeight(width);span=(_span=span)!=null?_span:parentSpan;if(span)width=span/24*100+'%';if(fullWidth||fullW)width='100%';if(fullHeight||fullH)height='100%';var aspectRatio=ratio;if(!!square)aspectRatio=1;var style=clearProps({height:height,width:width,minHeight:minHeight,minHeight:minHeight,maxHeight:maxHeight,minWidth:minWidth,maxWidth:maxWidth,aspectRatio:aspectRatio});return[values,Object.assign({},restProps,{style:Object.assign({},props.style,style)})];}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import{getSizeFromProps}from"../theme/helpers/sizeScale";import{useGetThemeValue}from"../theme/ThemeHandler";export function useSizeConverter(groupKey,defaultValue){var getSizeValue=useGetThemeValue(groupKey);return function(_ref){var _ref2=_slicedToArray(_ref,2),values=_ref2[0],props=_ref2[1];var _getSizeFromProps=getSizeFromProps(props,defaultValue),_getSizeFromProps2=_slicedToArray(_getSizeFromProps,2),sizeCode=_getSizeFromProps2[0],formattedProps=_getSizeFromProps2[1];var size=getSizeValue(sizeCode);return[Object.assign({},values,{size:size,sizeCode:sizeCode}),formattedProps];};}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";var _excluded=["disabled","loading","onClick","onPress","onChange"];import{clearProps}from"./_helpers";export function useStateModifier(_ref){var _ref2=_slicedToArray(_ref,2),values=_ref2[0],props=_ref2[1];var disabled=props.disabled,loading=props.loading,onClick=props.onClick,onPress=props.onPress,onChange=props.onChange,restProps=_objectWithoutProperties(props,_excluded);var cursor=props.style;var opacity=props.opacity;if(!!disabled){opacity=0.3;onChange=undefined;cursor='not-allowed';}if(!!disabled||!!loading){onPress=undefined;onClick=undefined;}var style=clearProps({opacity:opacity,cursor:cursor});var newProps=clearProps({onPress:onPress,onClick:onClick,onChange:onChange});return[Object.assign({disabled:disabled,loading:loading},values),Object.assign({},newProps,restProps,{style:Object.assign({},props.style,style)})];}
|
package/dist/modifiers/text.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["
|
|
1
|
+
import _objectDestructuringEmpty from"@babel/runtime/helpers/objectDestructuringEmpty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";var _excluded=["color","textCode"],_excluded2=["opacity","bold","strong","fontWeight","weight","italic","underline","lineHeight","align","center","toRight","inherit","fontSize"];import{clearProps}from"./_helpers";import{mergePreset}from"../theme/helpers/mergePreset";import{useGetColor,useTexts}from"../theme/ThemeHandler";export function useTextModifier(_ref){var _ref2=_slicedToArray(_ref,2),_ref2$=_ref2[0],color=_ref2$.color,textCode=_ref2$.textCode,values=_objectWithoutProperties(_ref2$,_excluded),props=Object.assign({},(_objectDestructuringEmpty(_ref2[1]),_ref2[1]));var getColor=useGetColor();var texts=useTexts();if(!textCode&&!props.inherit)textCode='p';var _mergePreset=mergePreset(texts,textCode,props,'p'),opacity=_mergePreset.opacity,bold=_mergePreset.bold,strong=_mergePreset.strong,fontWeight=_mergePreset.fontWeight,weight=_mergePreset.weight,italic=_mergePreset.italic,underline=_mergePreset.underline,lineHeight=_mergePreset.lineHeight,align=_mergePreset.align,center=_mergePreset.center,toRight=_mergePreset.toRight,inherit=_mergePreset.inherit,fontSize=_mergePreset.fontSize,restProps=_objectWithoutProperties(_mergePreset,_excluded2);var fontStyle;if(italic)fontStyle='italic';var textDecorationLine;if(underline)textDecorationLine='underline';var textAlign=align;if(center)textAlign='center';if(toRight)textAlign='right';fontWeight=fontWeight||weight;if(bold||strong)fontWeight=600;var style=clearProps({fontWeight:fontWeight,fontStyle:fontStyle,textDecorationLine:textDecorationLine,lineHeight:lineHeight,textAlign:textAlign,opacity:opacity,color:color,fontSize:fontSize});return[values,Object.assign({},restProps,{style:Object.assign({},props.style,style)})];}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import{getTextFromProps}from"../theme/helpers/textScale";import{useGetThemeValue}from"../theme/ThemeHandler";export function useTextConverter(defaultValue){var getTextValue=useGetThemeValue('texts');return function(_ref){var _ref2=_slicedToArray(_ref,2),values=_ref2[0],props=_ref2[1];var _getTextFromProps=getTextFromProps(props,defaultValue),_getTextFromProps2=_slicedToArray(_getTextFromProps,2),textCode=_getTextFromProps2[0],formattedProps=_getTextFromProps2[1];var text=getTextValue(textCode);return[Object.assign({},values,{text:text,textCode:textCode}),formattedProps];};}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import{mergeDeepRight}from'ramda';import{useThemeComponent}from"../theme/ThemeHandler";export function useThemeComponentModifier(componentName){var themeProps=useThemeComponent(componentName);return function(_ref){var _ref2=_slicedToArray(_ref,2),values=_ref2[0],props=_ref2[1];props=mergeDeepRight(themeProps,props);return[values,props];};}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _jsxFileName="/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/responsive/ResponsiveHandler.js";import React from'react';import{useBreakpoints}from"../theme/ThemeHandler";import{useWindowWidth}from"../abstractions/helpers/windowWidth";import{jsx as _jsx}from"react/jsx-runtime";var ResponsiveContext=React.createContext(null);export var useResponsive=function useResponsive(){return React.useContext(ResponsiveContext);};export function ResponsiveHandler(_ref){var children=_ref.children;var width=useWindowWidth();var breakpoints=useBreakpoints();var screen=React.useMemo(function(){var _breakpoints;if(!(breakpoints!=null&&breakpoints.length))return false;for(var i=0;i<breakpoints.length;i++){if(width<breakpoints[i].value){return breakpoints[i].name;}}return(_breakpoints=breakpoints[breakpoints.length-1])==null?void 0:_breakpoints.name;},[width,breakpoints]);var value=React.useMemo(function(){return{width:width,screen:screen};},[width,screen]);return _jsx(ResponsiveContext.Provider,{value:value,children:children});}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./responsiveHooks";export*from"./ResponsiveHandler";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import{is}from'ramda';import React from'react';import{useBreakpoints}from"../theme/ThemeHandler";import{useResponsive}from"../responsive/ResponsiveHandler";export function useGetResponsiveValue(){var breakpoints=useBreakpoints();var _useResponsive=useResponsive(),width=_useResponsive.width,screen=_useResponsive.screen;return React.useCallback(function(value){var isObj=is(Object,value);if(!isObj)return value;if(value[screen])return value[screen];var keys=Object.keys(value);var _loop=function _loop(){var match=k.match(/^(\w+)([du])$/);if(!match)return 0;var bpName=match[1];var mode=match[2];var bpIndex=breakpoints.findIndex(function(b){return b.name===bpName;});if(bpIndex===-1)return 0;if(mode==='u'){var lowerBound=bpIndex>0?breakpoints[bpIndex-1].value:0;if(width>=lowerBound)return{v:value[k]};}if(mode==='d'){if(width<breakpoints[bpIndex].value)return{v:value[k]};}},_ret;for(var k of keys){_ret=_loop();if(_ret===0)continue;if(_ret)return _ret.v;}return value==null?void 0:value.df;},[screen]);}export function useResponsiveValue(value){var getValue=useGetResponsiveValue();var isObj=is(Object,value);var valueWatch=isObj?Object.keys(value).map(function(k){return`${k}:${value[k]}`;}):[value];return React.useMemo(function(){return getValue(value);},[getValue].concat(_toConsumableArray(valueWatch)));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";var _jsxFileName="/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/theme/ThemeHandler.js";import{mergeDeepRight}from'ramda';import React from'react';import{DEFAULT_LIGHT_THEME}from"./default/lightTheme";import{
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";var _jsxFileName="/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/theme/ThemeHandler.js";import{mergeDeepRight}from'ramda';import React from'react';import{DEFAULT_LIGHT_THEME}from"./default/lightTheme";import{getThemeValue}from"./helpers/relatedScales";import{useFormattedTheme}from"./format/formatTheme";import{jsx as _jsx}from"react/jsx-runtime";var DEFAULT_BREAKPOINTS=[{name:'sm',value:768},{name:'md',value:1024},{name:'lg',value:1440},{name:'xl',value:10000}];var ThemeContext=React.createContext(null);export var useThemeHandler=function useThemeHandler(){return React.useContext(ThemeContext)||{};};export var useBreakpoints=function useBreakpoints(){var _useThemeHandler;return((_useThemeHandler=useThemeHandler())==null?void 0:_useThemeHandler.breakpoints)||DEFAULT_BREAKPOINTS;};export var useTheme=function useTheme(groupKey){var theme=useThemeHandler().theme||DEFAULT_LIGHT_THEME;if(!groupKey)return theme;return(theme==null?void 0:theme[groupKey])||{};};export var useGetThemeValue=function useGetThemeValue(groupKey){var group=useTheme(groupKey);return function(key){return getThemeValue(group,key);};};export var useColors=function useColors(){return useTheme('colors');};export var useGetColor=function useGetColor(){return useGetThemeValue('colors');};export var useSpaces=function useSpaces(){return useTheme('spaces');};export var useGetSpace=function useGetSpace(){return useGetThemeValue('spaces');};export var useRadius=function useRadius(){return useTheme('radius');};export var useGetRadius=function useGetRadius(){return useGetThemeValue('radius');};export var useElementHeights=function useElementHeights(){return useTheme('elementHeights');};export var useGetElementHeight=function useGetElementHeight(){return useGetThemeValue('elementHeights');};export var useTexts=function useTexts(){return useTheme('texts');};export var useGetText=function useGetText(){return useGetThemeValue('text');};export var useThemeComponents=function useThemeComponents(){return useTheme('components');};export function useThemeComponent(name){var components=useThemeComponents();return components[name]||{};}export function useMergeThemeComponent(name,props){var themeProps=useThemeComponent(name);return mergeDeepRight(themeProps,props);}export function ThemeHandler(_ref){var breakpoints=_ref.breakpoints,themes=_ref.themes,initTheme=_ref.initTheme,children=_ref.children;var _React$useState=React.useState(initTheme||'light'),_React$useState2=_slicedToArray(_React$useState,2),activeThemeKey=_React$useState2[0],setActiveThemeKey=_React$useState2[1];var theme=useFormattedTheme(themes,activeThemeKey);var value={theme:theme,themes:themes,activeThemeKey:activeThemeKey,setActiveThemeKey:setActiveThemeKey,breakpoints:breakpoints||DEFAULT_BREAKPOINTS};return _jsx(ThemeContext.Provider,{value:value,children:children});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export var BASE_THEME={spaces:{
|
|
1
|
+
export var BASE_THEME={spaces:{xxxs:1,xxs:3,xs:5,sm:10,md:15,lg:20,xl:30,xxl:40,xxxl:50},radius:{xxxs:4,xxs:5,xs:5,sm:7,md:8,lg:10,xl:12,xxl:15,xxxl:18},icons:{xxxs:10,xxs:12,xs:14,sm:16,md:18,lg:22,xl:26,xxl:28,xxxl:32},elementHeights:{xs:20,sm:30,md:35,lg:50,xl:60},texts:{h1:{fontSize:32,strong:true},h2:{fontSize:26,strong:true},h3:{fontSize:22,strong:true},h4:{fontSize:18,strong:true},h5:{fontSize:16,strong:true},h6:{fontSize:14,strong:true},p:{fontSize:14},sm:{fontSize:12},xs:{fontSize:10},xxs:{fontSize:8}}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mergeDeepRight}from'ramda';import{BASE_THEME}from"./base";export var CYBERPUNK_DARK_THEME=mergeDeepRight(BASE_THEME,{colors:{primary:'#FCEE09',text:'#FFFFFF',text2:'#B3B3B3',text3:'#8C8C8C',text4:'#666666',bg:'#0A0A0F',overlayBG:'#14141F',shadow:'rgba(39, 45, 52, 0.6)',blue:'#00E5FF',yellow:'#FFD600',green:'#00FF9D',purple:'#D500F9',orange:'#FF9100',cyan:'#00B8D4',red:'#FF1744',navy:'#1E2A38',indigo:'#651FFF',gray:'#757575',brown:'#6D4C41',lylac:'#B388FF',pink:'#FF80AB'}});
|
|
1
|
+
import{mergeDeepRight}from'ramda';import{BASE_THEME}from"./base";export var CYBERPUNK_DARK_THEME=mergeDeepRight(BASE_THEME,{colors:{primary:'#FCEE09',text:'#FFFFFF',text2:'#B3B3B3',text3:'#8C8C8C',text4:'#666666',bg:'#0A0A0F',overlayBG:'#14141F',shadow:'rgba(39, 45, 52, 0.6)',divider:'rgba(255,255,255, 0.2)',blue:'#00E5FF',yellow:'#FFD600',green:'#00FF9D',purple:'#D500F9',orange:'#FF9100',cyan:'#00B8D4',red:'#FF1744',navy:'#1E2A38',indigo:'#651FFF',gray:'#757575',brown:'#6D4C41',lylac:'#B388FF',pink:'#FF80AB'}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mergeDeepRight}from'ramda';import{BASE_THEME}from"./base";export var DEFAULT_DARK_THEME=mergeDeepRight(BASE_THEME,{colors:{primary:'#818DF9',text:'#FFFFFF',text2:'#E0E0E0',text3:'#B0B0B0',text4:'#8A8A8A',bg:'#383E44',overlayBG:'#272D34',shadow:'rgba(
|
|
1
|
+
import{mergeDeepRight}from'ramda';import{BASE_THEME}from"./base";export var DEFAULT_DARK_THEME=mergeDeepRight(BASE_THEME,{colors:{primary:'#818DF9',text:'#FFFFFF',text2:'#E0E0E0',text3:'#B0B0B0',text4:'#8A8A8A',bg:'#383E44',overlayBG:'#272D34',shadow:'rgba(216, 210, 203, 0.1)',divider:'#383E44',blue:'#4DA3FF',yellow:'#FFD93B',green:'#4CAF50',purple:'#9B59B6',orange:'#FF7F50',cyan:'#00BCD4',red:'#E74C3C',navy:'#34495E',indigo:'#5C6BC0',gray:'#9E9E9E',brown:'#8D6E63',lylac:'#B39DDB',pink:'#F48FB1'}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mergeDeepRight}from'ramda';import{BASE_THEME}from"./base";export var DEEP_WOODS_DARK_THEME=mergeDeepRight(BASE_THEME,{colors:{primary:'#4CAF50',text:'#F0F8F2',text2:'#C8E6C9',text3:'#A5D6A7',text4:'#81C784',bg:'#0D1B14',overlayBG:'#16281F',shadow:'rgba(39, 45, 52, 0.6)',blue:'#64B5F6',yellow:'#FBC02D',green:'#81C784',purple:'#9575CD',orange:'#FFB74D',cyan:'#4DD0E1',red:'#E57373',navy:'#1B263B',indigo:'#5C6BC0',gray:'#9E9E9E',brown:'#8D6E63',lylac:'#B39DDB',pink:'#F48FB1'}});
|
|
1
|
+
import{mergeDeepRight}from'ramda';import{BASE_THEME}from"./base";export var DEEP_WOODS_DARK_THEME=mergeDeepRight(BASE_THEME,{colors:{primary:'#4CAF50',text:'#F0F8F2',text2:'#C8E6C9',text3:'#A5D6A7',text4:'#81C784',bg:'#0D1B14',overlayBG:'#16281F',shadow:'rgba(39, 45, 52, 0.6)',divider:'rgba(255,255,255, 0.2)',blue:'#64B5F6',yellow:'#FBC02D',green:'#81C784',purple:'#9575CD',orange:'#FFB74D',cyan:'#4DD0E1',red:'#E57373',navy:'#1B263B',indigo:'#5C6BC0',gray:'#9E9E9E',brown:'#8D6E63',lylac:'#B39DDB',pink:'#F48FB1'}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mergeDeepRight}from'ramda';import{BASE_THEME}from"./base";export var FOREST_MIST_THEME=mergeDeepRight(BASE_THEME,{colors:{primary:'#4CAF50',text:'#0B2414',text2:'#14532D',text3:'#1B5E20',text4:'#388E3C',bg:'#E9F5EC',overlayBG:'#FFFFFF',shadow:'rgba(39, 45, 52, 0.15)',blue:'#2563EB',yellow:'#F59E0B',green:'#15803D',purple:'#7C3AED',orange:'#EA580C',cyan:'#0891B2',red:'#B91C1C',navy:'#1E3A8A',indigo:'#4338CA',gray:'#94A3B8',brown:'#78350F',lylac:'#A78BFA',pink:'#F472B6'}});
|
|
1
|
+
import{mergeDeepRight}from'ramda';import{BASE_THEME}from"./base";export var FOREST_MIST_THEME=mergeDeepRight(BASE_THEME,{colors:{primary:'#4CAF50',text:'#0B2414',text2:'#14532D',text3:'#1B5E20',text4:'#388E3C',bg:'#E9F5EC',overlayBG:'#FFFFFF',shadow:'rgba(39, 45, 52, 0.15)',divider:'rgba(0,0,0, 0.1)',blue:'#2563EB',yellow:'#F59E0B',green:'#15803D',purple:'#7C3AED',orange:'#EA580C',cyan:'#0891B2',red:'#B91C1C',navy:'#1E3A8A',indigo:'#4338CA',gray:'#94A3B8',brown:'#78350F',lylac:'#A78BFA',pink:'#F472B6'}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{mergeDeepRight}from'ramda';import{BASE_THEME}from"./base";export var DEFAULT_MATRIX_THEME=mergeDeepRight(BASE_THEME,{colors:{primary:'#00FF41',text:'#00FF41',text2:'#00CC33',text3:'#009926',text4:'#00661A',bg:'#000000',overlayBG:'#0A0A0A',shadow:'rgba(0, 255, 65, 0.2)',divider:'rgba(0,255,65, 0.3)',blue:'#0087BD',yellow:'#AEBF00',green:'#00FF41',purple:'#7A1FA2',orange:'#FF6D00',cyan:'#00BFA5',red:'#D50000',navy:'#003366',indigo:'#303F9F',gray:'#4A4A4A',brown:'#5D4037',lylac:'#8E24AA',pink:'#C51162'},components:{Card:{border:1,br:5,borderColor:'divider'}}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mergeDeepRight}from'ramda';import{BASE_THEME}from"./base";export var DEFAULT_LIGHT_THEME=mergeDeepRight(BASE_THEME,{colors:{primary:'#818DF9',text:'#272D34',text2:'#4A5159',text3:'#6E7680',text4:'#9AA1AC',bg:'#F4F5FE',overlayBG:'#FFFFFF',shadow:'rgba(39, 45, 52, 0.15)',blue:'#4DA3FF',yellow:'#FFD93B',green:'#4CAF50',purple:'#9B59B6',orange:'#FF7F50',cyan:'#00BCD4',red:'#E74C3C',navy:'#34495E',indigo:'#5C6BC0',gray:'#B0BEC5',brown:'#8D6E63',lylac:'#B39DDB',pink:'#F48FB1'}});
|
|
1
|
+
import{mergeDeepRight}from'ramda';import{BASE_THEME}from"./base";export var DEFAULT_LIGHT_THEME=mergeDeepRight(BASE_THEME,{colors:{primary:'#818DF9',text:'#272D34',text2:'#4A5159',text3:'#6E7680',text4:'#9AA1AC',bg:'#F4F5FE',overlayBG:'#FFFFFF',shadow:'rgba(39, 45, 52, 0.15)',divider:'#e0e0e0',blue:'#4DA3FF',yellow:'#FFD93B',green:'#4CAF50',purple:'#9B59B6',orange:'#FF7F50',cyan:'#00BCD4',red:'#E74C3C',navy:'#34495E',indigo:'#5C6BC0',gray:'#B0BEC5',brown:'#8D6E63',lylac:'#B39DDB',pink:'#F48FB1'}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mergeDeepRight}from'ramda';import{BASE_THEME}from"./base";export var MIDNIGHT_NEON_THEME=mergeDeepRight(BASE_THEME,{colors:{primary:'#FF00FF',text:'#F0F0F0',text2:'#D4D4D4',text3:'#A3A3A3',text4:'#7A7A7A',bg:'#0D0D0D',overlayBG:'#1A1A1A',shadow:'rgba(39, 45, 52, 0.6)',blue:'#3B82F6',yellow:'#FACC15',green:'#22C55E',purple:'#A855F7',orange:'#FB923C',cyan:'#06B6D4',red:'#F87171',navy:'#1E3A8A',indigo:'#6366F1',gray:'#9CA3AF',brown:'#92400E',lylac:'#C084FC',pink:'#F472B6'}});
|
|
1
|
+
import{mergeDeepRight}from'ramda';import{BASE_THEME}from"./base";export var MIDNIGHT_NEON_THEME=mergeDeepRight(BASE_THEME,{colors:{primary:'#FF00FF',text:'#F0F0F0',text2:'#D4D4D4',text3:'#A3A3A3',text4:'#7A7A7A',bg:'#0D0D0D',overlayBG:'#1A1A1A',shadow:'rgba(39, 45, 52, 0.6)',divider:'rgba(255,255,255, 0.2)',blue:'#3B82F6',yellow:'#FACC15',green:'#22C55E',purple:'#A855F7',orange:'#FB923C',cyan:'#06B6D4',red:'#F87171',navy:'#1E3A8A',indigo:'#6366F1',gray:'#9CA3AF',brown:'#92400E',lylac:'#C084FC',pink:'#F472B6'}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{mergeDeepRight}from'ramda';import{BASE_THEME}from"./base";export var DEFAULT_MSDOS_THEME=mergeDeepRight(BASE_THEME,{colors:{primary:'#FFFF00',text:'#FFFFFF',text2:'#FFD700',text3:'#CCCCCC',text4:'#999999',bg:'#0000AA',overlayBG:'#000088',shadow:'rgba(0, 0, 0, 0.6)',divider:'rgba(255,255,255,0.3)',blue:'#0000FF',yellow:'#FFFF00',green:'#00FF00',purple:'#AA00FF',orange:'#FF7700',cyan:'#00FFFF',red:'#FF0000',navy:'#000080',indigo:'#4B0082',gray:'#B0B0B0',brown:'#8B4513',lylac:'#9370DB',pink:'#FF69B4'},components:{Card:{border:1,br:5,borderColor:'divider'}}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mergeDeepRight}from'ramda';import{BASE_THEME}from"./base";export var OCEAN_BREEZE_THEME=mergeDeepRight(BASE_THEME,{colors:{primary:'#2B90D9',text:'#04364A',text2:'#065A82',text3:'#0B84B4',text4:'#3ABEFF',bg:'#E6F7FF',overlayBG:'#FFFFFF',shadow:'rgba(39, 45, 52, 0.15)',blue:'#1D4ED8',yellow:'#FACC15',green:'#10B981',purple:'#8B5CF6',orange:'#FB923C',cyan:'#06B6D4',red:'#EF4444',navy:'#1E3A8A',indigo:'#6366F1',gray:'#9CA3AF',brown:'#A16207',lylac:'#C4B5FD',pink:'#F472B6'}});
|
|
1
|
+
import{mergeDeepRight}from'ramda';import{BASE_THEME}from"./base";export var OCEAN_BREEZE_THEME=mergeDeepRight(BASE_THEME,{colors:{primary:'#2B90D9',text:'#04364A',text2:'#065A82',text3:'#0B84B4',text4:'#3ABEFF',bg:'#E6F7FF',overlayBG:'#FFFFFF',shadow:'rgba(39, 45, 52, 0.15)',divider:'rgba(0,0,0, 0.1)',blue:'#1D4ED8',yellow:'#FACC15',green:'#10B981',purple:'#8B5CF6',orange:'#FB923C',cyan:'#06B6D4',red:'#EF4444',navy:'#1E3A8A',indigo:'#6366F1',gray:'#9CA3AF',brown:'#A16207',lylac:'#C4B5FD',pink:'#F472B6'}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mergeDeepRight}from'ramda';import{BASE_THEME}from"./base";export var PASTEL_DREAM_THEME=mergeDeepRight(BASE_THEME,{colors:{primary:'#FFB6C1',text:'#4B4453',text2:'#6D6875',text3:'#A093A6',text4:'#C9BBCF',bg:'#FFF7FA',overlayBG:'#FFFFFF',shadow:'rgba(39, 45, 52, 0.15)',blue:'#A5B4FC',yellow:'#FDE68A',green:'#BBF7D0',purple:'#E9D5FF',orange:'#FED7AA',cyan:'#BAE6FD',red:'#FCA5A5',navy:'#A5B4FC',indigo:'#C7D2FE',gray:'#E5E7EB',brown:'#E0B084',lylac:'#E9D5FF',pink:'#FBCFE8'}});
|
|
1
|
+
import{mergeDeepRight}from'ramda';import{BASE_THEME}from"./base";export var PASTEL_DREAM_THEME=mergeDeepRight(BASE_THEME,{colors:{primary:'#FFB6C1',text:'#4B4453',text2:'#6D6875',text3:'#A093A6',text4:'#C9BBCF',bg:'#FFF7FA',overlayBG:'#FFFFFF',shadow:'rgba(39, 45, 52, 0.15)',divider:'rgba(255,255,255, 0.2)',blue:'#A5B4FC',yellow:'#FDE68A',green:'#BBF7D0',purple:'#E9D5FF',orange:'#FED7AA',cyan:'#BAE6FD',red:'#FCA5A5',navy:'#A5B4FC',indigo:'#C7D2FE',gray:'#E5E7EB',brown:'#E0B084',lylac:'#E9D5FF',pink:'#FBCFE8'}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mergeDeepRight}from'ramda';import{BASE_THEME}from"./base";export var SUNSET_GLOW_THEME=mergeDeepRight(BASE_THEME,{colors:{primary:'#FF6B6B',text:'#331E0A',text2:'#5C4033',text3:'#8C5A43',text4:'#B97A57',bg:'#FFF5E6',overlayBG:'#FFFFFF',shadow:'rgba(39, 45, 52, 0.15)',blue:'#3B82F6',yellow:'#FBBF24',green:'#22C55E',purple:'#A855F7',orange:'#FB923C',cyan:'#06B6D4',red:'#DC2626',navy:'#1E3A8A',indigo:'#4F46E5',gray:'#9CA3AF',brown:'#92400E',lylac:'#C084FC',pink:'#F472B6'}});
|
|
1
|
+
import{mergeDeepRight}from'ramda';import{BASE_THEME}from"./base";export var SUNSET_GLOW_THEME=mergeDeepRight(BASE_THEME,{colors:{primary:'#FF6B6B',text:'#331E0A',text2:'#5C4033',text3:'#8C5A43',text4:'#B97A57',bg:'#FFF5E6',overlayBG:'#FFFFFF',shadow:'rgba(39, 45, 52, 0.15)',divider:'rgba(255,255,255, 0.2)',blue:'#3B82F6',yellow:'#FBBF24',green:'#22C55E',purple:'#A855F7',orange:'#FB923C',cyan:'#06B6D4',red:'#DC2626',navy:'#1E3A8A',indigo:'#4F46E5',gray:'#9CA3AF',brown:'#92400E',lylac:'#C084FC',pink:'#F472B6'}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CYBERPUNK_DARK_THEME}from"./cyberpunkTheme";import{DEEP_WOODS_DARK_THEME}from"./deepWoodsTheme";import{DEFAULT_DARK_THEME}from"./darkTheme";import{DEFAULT_LIGHT_THEME}from"./lightTheme";import{FOREST_MIST_THEME}from"./forestTheme";import{MIDNIGHT_NEON_THEME}from"./midnightTheme";import{OCEAN_BREEZE_THEME}from"./oceanTheme";import{PASTEL_DREAM_THEME}from"./pastelTheme";import{SUNSET_GLOW_THEME}from"./sunsetTheme";export var DEFAULT_THEMES={light:DEFAULT_LIGHT_THEME,dark:DEFAULT_DARK_THEME,pastel:PASTEL_DREAM_THEME,midnight:MIDNIGHT_NEON_THEME,sunset:SUNSET_GLOW_THEME,ocean:OCEAN_BREEZE_THEME,forest:FOREST_MIST_THEME,cyberpunk:CYBERPUNK_DARK_THEME,deepWoods:DEEP_WOODS_DARK_THEME};
|
|
1
|
+
import{CYBERPUNK_DARK_THEME}from"./cyberpunkTheme";import{DEEP_WOODS_DARK_THEME}from"./deepWoodsTheme";import{DEFAULT_DARK_THEME}from"./darkTheme";import{DEFAULT_LIGHT_THEME}from"./lightTheme";import{DEFAULT_MATRIX_THEME}from"./hackerTheme";import{DEFAULT_MSDOS_THEME}from"./msdosTheme";import{FOREST_MIST_THEME}from"./forestTheme";import{MIDNIGHT_NEON_THEME}from"./midnightTheme";import{OCEAN_BREEZE_THEME}from"./oceanTheme";import{PASTEL_DREAM_THEME}from"./pastelTheme";import{SUNSET_GLOW_THEME}from"./sunsetTheme";export var DEFAULT_THEMES={light:DEFAULT_LIGHT_THEME,dark:DEFAULT_DARK_THEME,pastel:PASTEL_DREAM_THEME,midnight:MIDNIGHT_NEON_THEME,sunset:SUNSET_GLOW_THEME,ocean:OCEAN_BREEZE_THEME,forest:FOREST_MIST_THEME,cyberpunk:CYBERPUNK_DARK_THEME,deepWoods:DEEP_WOODS_DARK_THEME,hacker:DEFAULT_MATRIX_THEME,msdos:DEFAULT_MSDOS_THEME};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["color"];import{omit,keys}from'ramda';import{DEFAULT_DARK_THEME}from"../default/darkTheme";var SCALE=keys(DEFAULT_DARK_THEME.colors);export function getColorFromProps(_ref,defaultValue){var color=_ref.color,props=_objectWithoutProperties(_ref,_excluded);if(!!color)return[color,props];color=SCALE.find(function(key){return!!props[key];})||defaultValue;return[color,omit(SCALE,props)];}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import tinycolor from'tinycolor2';export function getContrastColor(bg){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:['#FFFFFF','#666666'];var tolerance=arguments.length>2&&arguments[2]!==undefined?arguments[2]:2.5;if(!options.length)return'#666666';return tinycolor.mostReadable(bg,options).toHexString();}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";var BASE_COLORS=['text3','blue','yellow','green','purple','orange','cyan','red','navy','indigo','gray','brown','lylac','pink'];var COLORS=[].concat(BASE_COLORS,_toConsumableArray(BASE_COLORS.map(function(c){return`${c}+10`;})),_toConsumableArray(BASE_COLORS.map(function(c){return`${c}-10`;})));export function getDynamicColor(id){var num;if(typeof id==='number'){num=id;}else{num=String(id).split('').reduce(function(acc,char){return acc+char.charCodeAt(0);},0);}var index=num%COLORS.length;return COLORS[index];}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getThemeValue}from"./relatedScales";export function mergePreset(presets,key,props,defaultKey){if(!key)return props;var preset=getThemeValue(presets,key,false)||getThemeValue(presets,defaultKey,{});return Object.assign({},props,preset);}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{is}from'ramda';var SCALES=[['xxxs'],['xxs'],['xs'],['sm','small'],['md','p'],['lg','h6'],['xl','h5'],['xxl','h4'],['xxxl','h3']];export function getScaleSynonyms(key){return SCALES.find(function(list){return list.includes(key);})||[];}export function getThemeValue(group,key,defaultValue){defaultValue=defaultValue===undefined?key:defaultValue;if(!key)return defaultValue;var value=group[key];if(!!value||!is(String,key))return value||defaultValue;var synonyms=getScaleSynonyms(key);for(var synonym of synonyms){if(group!=null&&group[synonym]){value=group[synonym];break;}}return value||defaultValue;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["size"];import{omit}from'ramda';var SCALE=['xxxs','xxs','xs','sm','md','lg','xl','xxl','xxxl'];export function moveScale(value){var unit=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;var index=SCALE.indexOf(value);if(!index)return value;var movedIndex=index+unit;var movedValue=SCALE[index+unit];if(!movedValue){movedValue=unit>0?'xxxl':'xxxs';}return movedValue;}export function getSizeFromProps(_ref,defaultValue){var size=_ref.size,props=_objectWithoutProperties(_ref,_excluded);if(!!size)return[size,props];size=SCALE.find(function(key){return!!props[key];})||defaultValue;return[size,omit(SCALE,props)];}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["size"];import{omit}from'ramda';var SCALE=['xxxs','xxs','xs','sm','p','h6','h5','h4','h3','h2','h1'];export function moveTextScale(value){var unit=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;var index=SCALE.indexOf(value);if(!index)return value;return SCALE[index+unit]||value;}export function getTextFromProps(_ref,defaultValue){var size=_ref.size,props=_objectWithoutProperties(_ref,_excluded);if(!!size)return[size,props];size=SCALE.find(function(key){return!!props[key];})||defaultValue;return[size,omit(SCALE,props)];}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neko-os/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"author": "Christian Storch <ccstorch@gmail.com>",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -21,16 +21,20 @@
|
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
+
"@remixicon/react": "^4.6.0",
|
|
24
25
|
"dayjs": "^1.11.13",
|
|
25
26
|
"ramda": "^0.31.3",
|
|
26
27
|
"react": "*",
|
|
27
28
|
"react-native": "*",
|
|
28
|
-
"react-native-
|
|
29
|
-
"
|
|
30
|
-
"react-native-remix-icon": "^4.6.3"
|
|
29
|
+
"react-native-gesture-handler": "^2.28.0",
|
|
30
|
+
"react-native-reanimated": "^4.1.0",
|
|
31
|
+
"react-native-remix-icon": "^4.6.3",
|
|
32
|
+
"react-native-web": "*"
|
|
31
33
|
},
|
|
32
34
|
"dependencies": {
|
|
35
|
+
"dayjs": "^1.11.13",
|
|
33
36
|
"prop-types": "^15.8.1",
|
|
37
|
+
"react-native-safe-area-context": "^5.6.1",
|
|
34
38
|
"react-native-web": "^0.21.0",
|
|
35
39
|
"tinycolor2": "^1.6.0"
|
|
36
40
|
},
|
package/src/NekoUI.js
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
|
+
import { NotificationsHandler } from './components/feedback/notifications/NotificationsHandler'
|
|
2
|
+
import { OverlayHandler } from './components/structure/overlay/OverlayHandler'
|
|
3
|
+
import { PortalHandler } from './components/helpers/PortalHandler'
|
|
4
|
+
import { ResponsiveHandler } from './responsive/ResponsiveHandler'
|
|
1
5
|
import { ThemeHandler } from './theme/ThemeHandler'
|
|
2
6
|
|
|
3
7
|
export function NekoUI({ children, ...props }) {
|
|
4
|
-
return
|
|
8
|
+
return (
|
|
9
|
+
<ThemeHandler {...props}>
|
|
10
|
+
<ResponsiveHandler>
|
|
11
|
+
<PortalHandler>
|
|
12
|
+
<NotificationsHandler>
|
|
13
|
+
<OverlayHandler>{children}</OverlayHandler>
|
|
14
|
+
</NotificationsHandler>
|
|
15
|
+
</PortalHandler>
|
|
16
|
+
</ResponsiveHandler>
|
|
17
|
+
</ThemeHandler>
|
|
18
|
+
)
|
|
5
19
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import tinycolor from 'tinycolor2'
|
|
2
|
+
|
|
3
|
+
export function AbsActivityIndicator({ size = 20, color, style }) {
|
|
4
|
+
const bg = tinycolor(color).setAlpha(0.2).toString()
|
|
5
|
+
|
|
6
|
+
return (
|
|
7
|
+
<div
|
|
8
|
+
style={{
|
|
9
|
+
width: size,
|
|
10
|
+
height: size,
|
|
11
|
+
border: `${size / 8}px solid ${bg}`, // light transparent border
|
|
12
|
+
borderTop: `${size / 8}px solid ${color}`, // colored border for spinner effect
|
|
13
|
+
borderRadius: '50%',
|
|
14
|
+
animation: 'spin 1s linear infinite',
|
|
15
|
+
...style,
|
|
16
|
+
}}
|
|
17
|
+
></div>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Add global CSS for animation
|
|
22
|
+
// const styleSheet = document.styleSheets[0]
|
|
23
|
+
// styleSheet.insertRule(
|
|
24
|
+
// `
|
|
25
|
+
// @keyframes spin {
|
|
26
|
+
// 0% { transform: rotate(0deg); }
|
|
27
|
+
// 100% { transform: rotate(360deg); }
|
|
28
|
+
// }
|
|
29
|
+
// `,
|
|
30
|
+
// styleSheet.cssRules.length
|
|
31
|
+
// )
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import tinycolor from 'tinycolor2'
|
|
2
|
+
import { Animated, Easing } from 'react-native'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
|
|
5
|
+
export function AbsActivityIndicator({ size = 20, color, style }) {
|
|
6
|
+
const spinValue = React.useRef(new Animated.Value(0)).current
|
|
7
|
+
const bg = tinycolor(color).setAlpha(0.2).toString()
|
|
8
|
+
|
|
9
|
+
React.useEffect(() => {
|
|
10
|
+
const spinAnimation = Animated.loop(
|
|
11
|
+
Animated.timing(spinValue, {
|
|
12
|
+
toValue: 1,
|
|
13
|
+
duration: 1000,
|
|
14
|
+
easing: Easing.linear,
|
|
15
|
+
useNativeDriver: true,
|
|
16
|
+
})
|
|
17
|
+
)
|
|
18
|
+
spinAnimation.start()
|
|
19
|
+
return () => spinAnimation.stop()
|
|
20
|
+
}, [spinValue])
|
|
21
|
+
|
|
22
|
+
const spin = spinValue.interpolate({
|
|
23
|
+
inputRange: [0, 1],
|
|
24
|
+
outputRange: ['0deg', '360deg'],
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
const borderWidth = size / 8
|
|
28
|
+
|
|
29
|
+
console.log(color, bg)
|
|
30
|
+
return (
|
|
31
|
+
<Animated.View
|
|
32
|
+
style={{
|
|
33
|
+
width: size,
|
|
34
|
+
height: size,
|
|
35
|
+
borderRadius: size / 2,
|
|
36
|
+
borderWidth: borderWidth,
|
|
37
|
+
borderColor: `${bg}`,
|
|
38
|
+
borderTopColor: color,
|
|
39
|
+
transform: [{ rotate: spin }],
|
|
40
|
+
...style,
|
|
41
|
+
}}
|
|
42
|
+
/>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { map, prop } from 'ramda'
|
|
2
|
+
import Animated, { useAnimatedStyle } from 'react-native-reanimated'
|
|
3
|
+
|
|
4
|
+
export function AbsAnimatedView({ children, style, animatedStyles = [] }) {
|
|
5
|
+
return <Animated.View style={[style, ...animatedStyles]}>{children}</Animated.View>
|
|
6
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// import React from 'react'
|
|
2
|
+
|
|
3
|
+
// let AbsTouchableOpacity
|
|
4
|
+
|
|
5
|
+
// try {
|
|
6
|
+
// const { Platform, TouchableOpacity: RNTouchableOpacity } = require('react-native')
|
|
7
|
+
// AbsTouchableOpacity = (props) => <RNTouchableOpacity {...props} />
|
|
8
|
+
// } catch {
|
|
9
|
+
// AbsTouchableOpacity = (props) => <button {...props} />
|
|
10
|
+
// }
|
|
11
|
+
|
|
12
|
+
// export { AbsTouchableOpacity }
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export function AbsDraggableSlideView({ children }) {
|
|
2
|
+
return children
|
|
3
|
+
}
|
|
4
|
+
// export function AbsDraggableSlideView({
|
|
5
|
+
// from = 'left',
|
|
6
|
+
// distance,
|
|
7
|
+
// open,
|
|
8
|
+
// onClose,
|
|
9
|
+
// style,
|
|
10
|
+
// threshold = 0.3,
|
|
11
|
+
// children,
|
|
12
|
+
// resetOnOpen = true,
|
|
13
|
+
// }) {
|
|
14
|
+
// const [dragging, setDragging] = React.useState(false)
|
|
15
|
+
// const [startPos, setStartPos] = React.useState(0)
|
|
16
|
+
// const [translate, setTranslate] = React.useState(0)
|
|
17
|
+
|
|
18
|
+
// const ref = React.useRef()
|
|
19
|
+
|
|
20
|
+
// Reset on open
|
|
21
|
+
// React.useEffect(() => {
|
|
22
|
+
// if (resetOnOpen && open) setTranslate(0)
|
|
23
|
+
// }, [open, resetOnOpen])
|
|
24
|
+
|
|
25
|
+
// Handle pointer down
|
|
26
|
+
// const handlePointerDown = (e) => {
|
|
27
|
+
// setDragging(true)
|
|
28
|
+
// const pos = from === 'left' || from === 'right' ? e.clientX : e.clientY
|
|
29
|
+
// setStartPos(pos)
|
|
30
|
+
// e.target.setPointerCapture(e.pointerId)
|
|
31
|
+
// }
|
|
32
|
+
|
|
33
|
+
// const handlePointerMove = (e) => {
|
|
34
|
+
// if (!dragging) return
|
|
35
|
+
// const pos = from === 'left' || from === 'right' ? e.clientX : e.clientY
|
|
36
|
+
// let delta = pos - startPos
|
|
37
|
+
|
|
38
|
+
// if (from === 'left') delta = Math.min(delta, 0)
|
|
39
|
+
// else if (from === 'right') delta = Math.max(delta, 0)
|
|
40
|
+
// else if (from === 'top') delta = Math.min(delta, 0)
|
|
41
|
+
// else delta = Math.max(delta, 0)
|
|
42
|
+
|
|
43
|
+
// setTranslate(delta)
|
|
44
|
+
// }
|
|
45
|
+
|
|
46
|
+
// const handlePointerUp = (e) => {
|
|
47
|
+
// if (!dragging) return
|
|
48
|
+
// setDragging(false)
|
|
49
|
+
|
|
50
|
+
// Determine progress and if should close
|
|
51
|
+
// const size = from === 'left' || from === 'right' ? window.innerWidth : window.innerHeight
|
|
52
|
+
// const delta = translate
|
|
53
|
+
// let progress
|
|
54
|
+
// if (from === 'left') progress = -delta / (distance || size)
|
|
55
|
+
// else if (from === 'right') progress = delta / (distance || size)
|
|
56
|
+
// else if (from === 'top') progress = -delta / (distance || size)
|
|
57
|
+
// else progress = delta / (distance || size)
|
|
58
|
+
|
|
59
|
+
// const shouldClose = progress > threshold
|
|
60
|
+
|
|
61
|
+
// Animate to final position
|
|
62
|
+
// const finalValue = shouldClose ? (from === 'left' || from === 'top' ? -(distance || size) : distance || size) : 0
|
|
63
|
+
|
|
64
|
+
// setTranslate(finalValue)
|
|
65
|
+
|
|
66
|
+
// if (shouldClose && onClose) onClose()
|
|
67
|
+
// }
|
|
68
|
+
|
|
69
|
+
// const transformStyle =
|
|
70
|
+
// from === 'left' || from === 'right'
|
|
71
|
+
// ? { transform: `translateX(${translate}px)`, transition: dragging ? 'none' : 'transform 0.2s' }
|
|
72
|
+
// : { transform: `translateY(${translate}px)`, transition: dragging ? 'none' : 'transform 0.2s' }
|
|
73
|
+
|
|
74
|
+
// return (
|
|
75
|
+
// <div
|
|
76
|
+
// ref={ref}
|
|
77
|
+
// style={{ ...style, ...transformStyle, touchAction: 'none', cursor: 'grab' }}
|
|
78
|
+
// onPointerDown={handlePointerDown}
|
|
79
|
+
// onPointerMove={handlePointerMove}
|
|
80
|
+
// onPointerUp={handlePointerUp}
|
|
81
|
+
// >
|
|
82
|
+
// {children}
|
|
83
|
+
// </div>
|
|
84
|
+
// )
|
|
85
|
+
// }
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Dimensions } from 'react-native'
|
|
2
|
+
import { Gesture, GestureDetector } from 'react-native-gesture-handler'
|
|
3
|
+
import Animated, { useSharedValue, useAnimatedStyle, withSpring, withTiming, runOnJS } from 'react-native-reanimated'
|
|
4
|
+
import React from 'react'
|
|
5
|
+
|
|
6
|
+
export function AbsDraggableSlideView({
|
|
7
|
+
from = 'left',
|
|
8
|
+
distance,
|
|
9
|
+
open,
|
|
10
|
+
onClose,
|
|
11
|
+
style,
|
|
12
|
+
threshold = 0.3,
|
|
13
|
+
children,
|
|
14
|
+
resetOnOpen = true,
|
|
15
|
+
}) {
|
|
16
|
+
const { width, height } = Dimensions.get('window')
|
|
17
|
+
const maxDistance = from === 'left' || from === 'right' ? distance || width : distance || height
|
|
18
|
+
const gestureTranslation = useSharedValue(0)
|
|
19
|
+
|
|
20
|
+
React.useEffect(() => {
|
|
21
|
+
if (resetOnOpen && open) {
|
|
22
|
+
gestureTranslation.value = 0
|
|
23
|
+
}
|
|
24
|
+
}, [open, resetOnOpen, gestureTranslation])
|
|
25
|
+
|
|
26
|
+
const panGesture = Gesture.Pan()
|
|
27
|
+
.onUpdate((e) => {
|
|
28
|
+
if (from === 'left') gestureTranslation.value = Math.min(e.translationX, 0)
|
|
29
|
+
else if (from === 'right') gestureTranslation.value = Math.max(e.translationX, 0)
|
|
30
|
+
else if (from === 'top') gestureTranslation.value = Math.min(e.translationY, 0)
|
|
31
|
+
else gestureTranslation.value = Math.max(e.translationY, 0)
|
|
32
|
+
})
|
|
33
|
+
.onEnd((e) => {
|
|
34
|
+
let progress
|
|
35
|
+
if (from === 'left') progress = -e.translationX / maxDistance
|
|
36
|
+
else if (from === 'right') progress = e.translationX / maxDistance
|
|
37
|
+
else if (from === 'top') progress = -e.translationY / maxDistance
|
|
38
|
+
else progress = e.translationY / maxDistance
|
|
39
|
+
|
|
40
|
+
const shouldClose = progress > threshold
|
|
41
|
+
let finalValue = from === 'left' || from === 'top' ? -maxDistance : maxDistance
|
|
42
|
+
if (!shouldClose) finalValue = 0
|
|
43
|
+
|
|
44
|
+
gestureTranslation.value = withTiming(finalValue, { duration: 200 }, (finished) => {
|
|
45
|
+
if (finished && onClose && shouldClose) runOnJS(onClose)()
|
|
46
|
+
})
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
const animatedStyle = useAnimatedStyle(() => {
|
|
50
|
+
const transform =
|
|
51
|
+
from === 'left' || from === 'right'
|
|
52
|
+
? [{ translateX: gestureTranslation.value }]
|
|
53
|
+
: [{ translateY: gestureTranslation.value }]
|
|
54
|
+
return { transform }
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<GestureDetector gesture={panGesture}>
|
|
59
|
+
<Animated.View style={[style, animatedStyle]}>{children}</Animated.View>
|
|
60
|
+
</GestureDetector>
|
|
61
|
+
)
|
|
62
|
+
}
|
package/src/abstractions/Icon.js
CHANGED
|
@@ -1,26 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Icons from '@remixicon/react'
|
|
2
2
|
|
|
3
3
|
import { capitalizeFirstLetter, toCamelCase } from '../helpers/string'
|
|
4
4
|
|
|
5
5
|
export function AbsIcon({ name, ...props }) {
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const Component = ref?.current || (() => false)
|
|
6
|
+
if (!!name && !name.startsWith('Ri')) name = 'Ri' + capitalizeFirstLetter(toCamelCase(name))
|
|
7
|
+
const IconComponent = Icons[name] || Icons['RiCircleFill']
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
try {
|
|
12
|
-
import('@remixicon/react').then((module) => {
|
|
13
|
-
if (!!name && !name.startsWith('Ri')) name = 'Ri' + capitalizeFirstLetter(toCamelCase(name))
|
|
14
|
-
let IconComponent = module[name] || module['RiCircleFill']
|
|
15
|
-
ref.current = IconComponent
|
|
16
|
-
setLoading(false)
|
|
17
|
-
})
|
|
18
|
-
} catch {
|
|
19
|
-
console.error('Error loading AbsIcon component')
|
|
20
|
-
}
|
|
21
|
-
}, [])
|
|
22
|
-
|
|
23
|
-
if (loading) return false
|
|
24
|
-
|
|
25
|
-
return <Component {...props} />
|
|
9
|
+
return <IconComponent {...props} />
|
|
26
10
|
}
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
let AbsIcon
|
|
2
|
+
|
|
3
|
+
try {
|
|
4
|
+
const RmIcon = require('react-native-remix-icon')?.default
|
|
5
|
+
console.log(RmIcon)
|
|
6
|
+
AbsIcon = (props) => <RmIcon {...props} />
|
|
7
|
+
} catch {
|
|
8
|
+
AbsIcon = () => false
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { AbsIcon }
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
let AbsIcon
|
|
2
|
+
|
|
3
|
+
try {
|
|
4
|
+
const RmIcon = require('react-native-remix-icon')?.default
|
|
5
|
+
console.log(RmIcon)
|
|
6
|
+
AbsIcon = (props) => <RmIcon {...props} />
|
|
7
|
+
} catch {
|
|
8
|
+
AbsIcon = () => false
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { AbsIcon }
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function AbsImage({ src, resizeMode = 'cover', style, ...props }) {
|
|
2
|
+
const objectFitMap = {
|
|
3
|
+
cover: 'cover',
|
|
4
|
+
contain: 'contain',
|
|
5
|
+
stretch: 'fill',
|
|
6
|
+
center: 'none',
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const objectFit = objectFitMap[resizeMode] || 'cover'
|
|
10
|
+
|
|
11
|
+
return <img src={src} style={{ objectFit, objectPosition: 'center', ...style }} {...props} />
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const Platform = { OS: 'web' }
|