@neko-os/ui 0.0.5 → 0.0.7
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/DraggableSlideView.js +1 -0
- package/dist/abstractions/DraggableSlideView.native.js +1 -0
- package/dist/abstractions/Icon.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/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/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/components/actions/Breadcrumb.js +1 -0
- package/dist/components/actions/Button.js +1 -1
- package/dist/components/actions/Dropdown.js +1 -0
- package/dist/components/actions/Link.js +1 -1
- package/dist/components/actions/index.js +1 -1
- 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 -1
- package/dist/components/form/FormGroup.js +1 -1
- package/dist/components/form/FormItem.js +1 -1
- package/dist/components/form/FormList.js +1 -1
- package/dist/components/form/FormWrapperComponent.js +1 -1
- package/dist/components/form/FormWrapperComponent.native.js +1 -1
- package/dist/components/form/SubmitButton.js +1 -0
- package/dist/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 -1
- package/dist/components/helpers/Separator.js +1 -1
- package/dist/components/helpers/VerticalView.js +1 -0
- package/dist/components/helpers/index.js +1 -1
- package/dist/components/index.js +1 -1
- 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 -1
- package/dist/components/presentation/IconLabel.js +1 -1
- 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 -1
- package/dist/components/presentation/Tooltip.js +1 -0
- package/dist/components/presentation/index.js +1 -1
- 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 -1
- 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 -1
- package/dist/components/structure/index.js +1 -1
- 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 -1
- package/dist/components/text/VerticalText.js +1 -0
- package/dist/components/text/index.js +1 -1
- package/dist/helpers/debounce.js +1 -0
- package/dist/helpers/index.js +1 -1
- package/dist/helpers/options.js +1 -0
- package/dist/helpers/random.js +1 -0
- package/dist/index.css +10 -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/border.js +1 -1
- package/dist/modifiers/display.js +1 -1
- package/dist/modifiers/flex.js +1 -1
- package/dist/modifiers/flexWrapper.js +1 -1
- package/dist/modifiers/fullColor.js +1 -1
- package/dist/modifiers/grid.js +1 -0
- package/dist/modifiers/overflow.js +1 -0
- package/dist/modifiers/position.js +1 -1
- package/dist/modifiers/responsiveConverter.js +1 -0
- package/dist/modifiers/size.js +1 -1
- package/dist/modifiers/state.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/darkTheme.js +1 -1
- package/dist/theme/default/hackerTheme.js +1 -1
- package/dist/theme/default/lightTheme.js +1 -1
- package/dist/theme/default/msdosTheme.js +1 -1
- package/dist/theme/helpers/contrastColor.js +1 -0
- package/dist/theme/helpers/dynamicColor.js +1 -0
- package/dist/theme/helpers/relatedScales.js +1 -1
- package/dist/theme/helpers/sizeScale.js +1 -1
- package/dist/theme/helpers/textScale.js +1 -1
- package/package.json +9 -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/DraggableSlideView.js +85 -0
- package/src/abstractions/DraggableSlideView.native.js +62 -0
- package/src/abstractions/Icon.js +4 -42
- 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/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/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/components/actions/Breadcrumb.js +47 -0
- package/src/components/actions/Button.js +8 -3
- package/src/components/actions/Dropdown.js +68 -0
- package/src/components/actions/Link.js +21 -8
- package/src/components/actions/index.js +3 -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 +94 -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 +15 -4
- package/src/components/form/FormGroup.js +4 -4
- package/src/components/form/FormItem.js +30 -8
- package/src/components/form/FormList.js +45 -9
- package/src/components/form/FormWrapperComponent.js +37 -2
- package/src/components/form/FormWrapperComponent.native.js +2 -2
- package/src/components/form/SubmitButton.js +20 -0
- package/src/components/form/index.js +3 -2
- 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 +1 -1
- package/src/components/helpers/Separator.js +10 -14
- package/src/components/helpers/VerticalView.js +34 -0
- package/src/components/helpers/index.js +4 -0
- package/src/components/index.js +7 -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 +24 -6
- package/src/components/presentation/IconLabel.js +12 -2
- 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 +8 -11
- package/src/components/presentation/Tooltip.js +43 -0
- package/src/components/presentation/index.js +8 -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 +4 -1
- 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 +9 -3
- package/src/components/structure/index.js +6 -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 +4 -0
- package/src/components/text/VerticalText.js +29 -0
- package/src/components/text/index.js +1 -0
- package/src/helpers/debounce.js +9 -0
- package/src/helpers/index.js +2 -1
- package/src/helpers/options.js +65 -0
- package/src/helpers/random.js +5 -0
- package/src/index.css +10 -0
- package/src/index.js +1 -0
- 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/border.js +30 -6
- package/src/modifiers/display.js +3 -5
- package/src/modifiers/flex.js +1 -1
- package/src/modifiers/flexWrapper.js +48 -7
- package/src/modifiers/fullColor.js +5 -5
- package/src/modifiers/grid.js +27 -0
- package/src/modifiers/overflow.js +23 -0
- package/src/modifiers/position.js +10 -2
- package/src/modifiers/responsiveConverter.js +19 -0
- package/src/modifiers/size.js +10 -4
- package/src/modifiers/state.js +33 -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 +1 -1
- package/src/theme/default/base.js +22 -22
- package/src/theme/default/darkTheme.js +2 -2
- package/src/theme/default/hackerTheme.js +8 -0
- package/src/theme/default/lightTheme.js +1 -1
- package/src/theme/default/msdosTheme.js +1 -1
- package/src/theme/helpers/contrastColor.js +20 -0
- package/src/theme/helpers/dynamicColor.js +32 -0
- package/src/theme/helpers/relatedScales.js +6 -6
- package/src/theme/helpers/sizeScale.js +7 -2
- package/src/theme/helpers/textScale.js +1 -1
- package/dist/components/form/inputs/Checkbox.js +0 -1
- package/dist/components/form/inputs/Radio.js +0 -1
- package/dist/components/form/inputs/Switch.js +0 -1
- package/dist/components/form/inputs/index.js +0 -1
- package/dist/components/form/useForm.js +0 -1
- package/dist/helpers/responsive.js +0 -1
- package/src/components/form/inputs/Checkbox.js +0 -42
- package/src/components/form/inputs/Radio.js +0 -42
- package/src/components/form/inputs/Switch.js +0 -44
- package/src/components/form/inputs/index.js +0 -3
- package/src/components/form/useForm.js +0 -65
- package/src/helpers/responsive.js +0 -54
- /package/dist/abstractions/{windowWidth.js → helpers/windowWidth.js} +0 -0
- /package/dist/abstractions/{windowWidth.native.js → helpers/windowWidth.native.js} +0 -0
- /package/dist/abstractions/{windowWidth.web.js → helpers/windowWidth.web.js} +0 -0
- /package/src/abstractions/{windowWidth.js → helpers/windowWidth.js} +0 -0
- /package/src/abstractions/{windowWidth.native.js → helpers/windowWidth.native.js} +0 -0
- /package/src/abstractions/{windowWidth.web.js → helpers/windowWidth.web.js} +0 -0
|
@@ -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{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:'
|
|
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 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 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'}});
|
|
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)',divider:'
|
|
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 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:{
|
|
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'}}});
|
|
@@ -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];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{is}from'ramda';var SCALES=[['
|
|
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
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["size"];import{omit}from'ramda';var SCALE=['
|
|
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)];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["size"];import{omit}from'ramda';var SCALE=['
|
|
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.7",
|
|
4
4
|
"author": "Christian Storch <ccstorch@gmail.com>",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -21,16 +21,21 @@
|
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"
|
|
24
|
+
"@remixicon/react": "^4.6.0",
|
|
25
|
+
"dayjs": "*",
|
|
25
26
|
"ramda": "^0.31.3",
|
|
26
27
|
"react": "*",
|
|
27
28
|
"react-native": "*",
|
|
29
|
+
"react-native-gesture-handler": "^2.28.0",
|
|
30
|
+
"react-native-reanimated": "^4.1.0",
|
|
31
|
+
"react-native-remix-icon": "^4.6.3",
|
|
28
32
|
"react-native-web": "*",
|
|
29
|
-
"
|
|
30
|
-
"react-native-remix-icon": "^4.6.3"
|
|
33
|
+
"react-native-safe-area-context": "*"
|
|
31
34
|
},
|
|
32
35
|
"dependencies": {
|
|
36
|
+
"dayjs": "^1.11.18",
|
|
33
37
|
"prop-types": "^15.8.1",
|
|
38
|
+
"react-native-safe-area-context": "^5.6.1",
|
|
34
39
|
"react-native-web": "^0.21.0",
|
|
35
40
|
"tinycolor2": "^1.6.0"
|
|
36
41
|
},
|
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,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,48 +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) {
|
|
24
|
-
return (
|
|
25
|
-
<div
|
|
26
|
-
style={{
|
|
27
|
-
height: props.size,
|
|
28
|
-
width: props.size,
|
|
29
|
-
borderRadius: props.size,
|
|
30
|
-
display: 'flex',
|
|
31
|
-
justifyContent: 'center',
|
|
32
|
-
alignItems: 'center',
|
|
33
|
-
}}
|
|
34
|
-
>
|
|
35
|
-
<div
|
|
36
|
-
style={{
|
|
37
|
-
height: props.size / 3,
|
|
38
|
-
width: props.size / 3,
|
|
39
|
-
borderRadius: props.size,
|
|
40
|
-
backgroundColor: props.color,
|
|
41
|
-
}}
|
|
42
|
-
/>
|
|
43
|
-
</div>
|
|
44
|
-
)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return <Component {...props} />
|
|
9
|
+
return <IconComponent {...props} />
|
|
48
10
|
}
|
|
@@ -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' }
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export function AbsTable({ children, style, ...props }) {
|
|
2
|
+
return (
|
|
3
|
+
<table
|
|
4
|
+
{...props}
|
|
5
|
+
style={{
|
|
6
|
+
...style,
|
|
7
|
+
borderCollapse: 'separate',
|
|
8
|
+
borderSpacing: 0,
|
|
9
|
+
// orderCollapse: 'collapse',
|
|
10
|
+
// whiteSpace: 'nowrap',
|
|
11
|
+
width: '100%',
|
|
12
|
+
}}
|
|
13
|
+
>
|
|
14
|
+
<tbody>{children}</tbody>
|
|
15
|
+
</table>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function AbsTableRow({ ...props }) {
|
|
20
|
+
return <tr {...props} />
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function AbsTableHeader({ ...props }) {
|
|
24
|
+
return <th {...props} />
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function AbsTableCol({ ...props }) {
|
|
28
|
+
return <td {...props} />
|
|
29
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { View } from 'react-native'
|
|
2
|
+
|
|
3
|
+
export function AbsTable({ children, ...props }) {
|
|
4
|
+
return <View {...props}>{children}</View>
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function AbsTableRow({ style, ...props }) {
|
|
8
|
+
return <View {...props} style={[style, { flexDirection: 'row', flex: 1 }]} />
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function AbsTableHeader({ style, ...props }) {
|
|
12
|
+
if (!style.width && !style.minWidth && !style.flex) style.flex = 1
|
|
13
|
+
return <View {...props} style={[style]} />
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function AbsTableCol({ style, ...props }) {
|
|
17
|
+
if (!style.width && !style.minWidth && !style.flex) style.flex = 1
|
|
18
|
+
return <View {...props} style={style} />
|
|
19
|
+
}
|
package/src/abstractions/Text.js
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
export function AbsText(props) {
|
|
2
|
-
|
|
1
|
+
export function AbsText({ numberOfLines, style, ...props }) {
|
|
2
|
+
style = style || {}
|
|
3
|
+
|
|
4
|
+
const limitLinesStyle = !!numberOfLines
|
|
5
|
+
? {
|
|
6
|
+
display: '-webkit-box',
|
|
7
|
+
WebkitLineClamp: numberOfLines,
|
|
8
|
+
WebkitBoxOrient: 'vertical',
|
|
9
|
+
overflow: 'hidden',
|
|
10
|
+
}
|
|
11
|
+
: {}
|
|
12
|
+
|
|
13
|
+
return <span {...props} style={{ ...limitLinesStyle, ...style }} />
|
|
3
14
|
}
|
package/src/abstractions/View.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export function AbsView(props) {
|
|
2
|
-
return <div {...props} />
|
|
1
|
+
export function AbsView({ onPress, onClick, ...props }) {
|
|
2
|
+
return <div onClick={onClick || onPress} {...props} />
|
|
3
3
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function getElementSize(ref, callback) {
|
|
2
|
+
if (!ref.current) return
|
|
3
|
+
|
|
4
|
+
const el = ref.current
|
|
5
|
+
const rect = el.getBoundingClientRect()
|
|
6
|
+
|
|
7
|
+
callback({
|
|
8
|
+
width: el.offsetWidth,
|
|
9
|
+
height: el.offsetHeight,
|
|
10
|
+
x: rect.x + window.scrollX,
|
|
11
|
+
y: rect.y + window.scrollY,
|
|
12
|
+
})
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UIManager, findNodeHandle } from 'react-native'
|
|
2
|
+
|
|
3
|
+
export function getElementSize(ref, callback) {
|
|
4
|
+
if (!ref.current) return
|
|
5
|
+
|
|
6
|
+
const handle = findNodeHandle(ref.current)
|
|
7
|
+
if (handle) {
|
|
8
|
+
UIManager.measure(handle, (x, y, width, height) => {
|
|
9
|
+
callback({ width, height, x, y })
|
|
10
|
+
})
|
|
11
|
+
}
|
|
12
|
+
}
|