@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/src/modifiers/margin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { clearProps } from './_helpers'
|
|
2
2
|
import { useGetSpace } from '../theme/ThemeHandler'
|
|
3
3
|
|
|
4
|
-
export function useMarginModifier(props) {
|
|
4
|
+
export function useMarginModifier([values, props]) {
|
|
5
5
|
const getSpace = useGetSpace()
|
|
6
6
|
const { marginT, marginB, marginL, marginR, marginV, marginH, margin, ...restProps } = props
|
|
7
7
|
|
|
@@ -12,11 +12,14 @@ export function useMarginModifier(props) {
|
|
|
12
12
|
|
|
13
13
|
const style = clearProps({ marginTop, marginBottom, marginRight, marginLeft })
|
|
14
14
|
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
...
|
|
19
|
-
|
|
15
|
+
return [
|
|
16
|
+
values,
|
|
17
|
+
{
|
|
18
|
+
...restProps,
|
|
19
|
+
style: {
|
|
20
|
+
...props.style,
|
|
21
|
+
...style,
|
|
22
|
+
},
|
|
20
23
|
},
|
|
21
|
-
|
|
24
|
+
]
|
|
22
25
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { clearProps } from './_helpers'
|
|
2
|
+
|
|
3
|
+
export function useOverflowModifier([values, props]) {
|
|
4
|
+
let { hiddenOverflow, scroll, scrollY, scrollX, overflow, overflowY, overflowX, ...restProps } = props
|
|
5
|
+
|
|
6
|
+
if (hiddenOverflow) overflow = 'hidden'
|
|
7
|
+
if (scroll) overflow = 'scroll'
|
|
8
|
+
if (scrollY) overflowY = 'scroll'
|
|
9
|
+
if (scrollX) overflowX = 'scroll'
|
|
10
|
+
|
|
11
|
+
const style = clearProps({ overflow, overflowY, overflowX })
|
|
12
|
+
|
|
13
|
+
return [
|
|
14
|
+
values,
|
|
15
|
+
{
|
|
16
|
+
...restProps,
|
|
17
|
+
style: {
|
|
18
|
+
...props.style,
|
|
19
|
+
...style,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
]
|
|
23
|
+
}
|
package/src/modifiers/padding.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { clearProps } from './_helpers'
|
|
2
2
|
import { useGetSpace } from '../theme/ThemeHandler'
|
|
3
3
|
|
|
4
|
-
export function usePaddingModifier(props) {
|
|
4
|
+
export function usePaddingModifier([values, props]) {
|
|
5
5
|
const getSpace = useGetSpace()
|
|
6
6
|
const { paddingT, paddingB, paddingL, paddingR, paddingV, paddingH, padding, ...restProps } = props
|
|
7
7
|
|
|
@@ -12,11 +12,14 @@ export function usePaddingModifier(props) {
|
|
|
12
12
|
|
|
13
13
|
const style = clearProps({ paddingTop, paddingBottom, paddingRight, paddingLeft })
|
|
14
14
|
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
...
|
|
19
|
-
|
|
15
|
+
return [
|
|
16
|
+
values,
|
|
17
|
+
{
|
|
18
|
+
...restProps,
|
|
19
|
+
style: {
|
|
20
|
+
...props.style,
|
|
21
|
+
...style,
|
|
22
|
+
},
|
|
20
23
|
},
|
|
21
|
-
|
|
24
|
+
]
|
|
22
25
|
}
|
|
@@ -1,18 +1,29 @@
|
|
|
1
|
+
import { Platform } from '../abstractions/Platform'
|
|
1
2
|
import { clearProps } from './_helpers'
|
|
2
3
|
|
|
3
|
-
export function usePositionModifier(props) {
|
|
4
|
-
let { position, absolute, relative, top, bottom, left, right, ...restProps } = props
|
|
4
|
+
export function usePositionModifier([values, props]) {
|
|
5
|
+
let { position, absolute, relative, fixed, sticky, top, bottom, left, right, zIndex, ...restProps } = props
|
|
5
6
|
|
|
7
|
+
if (!zIndex && !!absolute) zIndex = 10
|
|
6
8
|
if (absolute) position = 'absolute'
|
|
7
9
|
if (relative) position = 'relative'
|
|
10
|
+
if (fixed) position = 'fixed'
|
|
11
|
+
if (sticky) position = 'sticky'
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
if (Platform.OS !== 'web' && ['fixed', 'sticky'].includes(position)) {
|
|
14
|
+
position = 'absolute'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const style = clearProps({ position, top, bottom, left, right, zIndex })
|
|
10
18
|
|
|
11
|
-
return
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
...
|
|
15
|
-
|
|
19
|
+
return [
|
|
20
|
+
values,
|
|
21
|
+
{
|
|
22
|
+
...restProps,
|
|
23
|
+
style: {
|
|
24
|
+
...props.style,
|
|
25
|
+
...style,
|
|
26
|
+
},
|
|
16
27
|
},
|
|
17
|
-
|
|
28
|
+
]
|
|
18
29
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { curry } from 'ramda'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import { useGetResponsiveValue } from '../responsive/responsiveHooks'
|
|
5
|
+
|
|
6
|
+
export const useResponsiveConverter = curry(function (keys, [values, props]) {
|
|
7
|
+
const getValue = useGetResponsiveValue()
|
|
8
|
+
|
|
9
|
+
return React.useMemo(() => {
|
|
10
|
+
const formattedProps = Object.keys(props).reduce((acc, k) => {
|
|
11
|
+
let v = props[k]
|
|
12
|
+
if (!keys?.length || keys.includes(k)) v = getValue(v)
|
|
13
|
+
acc[k] = v
|
|
14
|
+
return acc
|
|
15
|
+
}, {})
|
|
16
|
+
|
|
17
|
+
return [values, formattedProps]
|
|
18
|
+
}, [getValue])
|
|
19
|
+
})
|
package/src/modifiers/shadow.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { clearProps } from './_helpers'
|
|
2
2
|
import { useGetColor } from '../theme/ThemeHandler'
|
|
3
3
|
|
|
4
|
-
export function useShadowModifier(props) {
|
|
4
|
+
export function useShadowModifier([values, props]) {
|
|
5
5
|
const getColor = useGetColor()
|
|
6
6
|
let { shadow, ...restProps } = props
|
|
7
7
|
|
|
@@ -22,11 +22,14 @@ export function useShadowModifier(props) {
|
|
|
22
22
|
|
|
23
23
|
const style = clearProps({ boxShadow, shadowRadius, shadowOffset, shadowOpacity, shadowColor, elevation })
|
|
24
24
|
|
|
25
|
-
return
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
...
|
|
29
|
-
|
|
25
|
+
return [
|
|
26
|
+
values,
|
|
27
|
+
{
|
|
28
|
+
...restProps,
|
|
29
|
+
style: {
|
|
30
|
+
...props.style,
|
|
31
|
+
...style,
|
|
32
|
+
},
|
|
30
33
|
},
|
|
31
|
-
|
|
34
|
+
]
|
|
32
35
|
}
|
package/src/modifiers/size.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { clearProps } from './_helpers'
|
|
2
2
|
import { useGetElementHeight } from '../theme/ThemeHandler'
|
|
3
3
|
|
|
4
|
-
export function useSizeModifier(props) {
|
|
4
|
+
export function useSizeModifier([values, props]) {
|
|
5
5
|
const getHeight = useGetElementHeight()
|
|
6
6
|
let {
|
|
7
7
|
width,
|
|
@@ -20,16 +20,22 @@ export function useSizeModifier(props) {
|
|
|
20
20
|
fullH,
|
|
21
21
|
ratio,
|
|
22
22
|
square,
|
|
23
|
+
span,
|
|
24
|
+
parentSpan,
|
|
23
25
|
...restProps
|
|
24
26
|
} = props || {}
|
|
25
27
|
|
|
26
28
|
minHeight = getHeight(minHeight || minH)
|
|
27
|
-
minWidth = minWidth || minW
|
|
29
|
+
minWidth = getHeight(minWidth || minW)
|
|
28
30
|
|
|
29
|
-
maxHeight = maxHeight || maxH
|
|
30
|
-
maxWidth = maxWidth || maxW
|
|
31
|
+
maxHeight = getHeight(maxHeight || maxH)
|
|
32
|
+
maxWidth = getHeight(maxWidth || maxW)
|
|
31
33
|
|
|
32
34
|
height = getHeight(height)
|
|
35
|
+
width = getHeight(width)
|
|
36
|
+
|
|
37
|
+
span = span ?? parentSpan
|
|
38
|
+
if (span) width = (span / 24) * 100 + '%'
|
|
33
39
|
|
|
34
40
|
if (fullWidth || fullW) width = '100%'
|
|
35
41
|
if (fullHeight || fullH) height = '100%'
|
|
@@ -37,10 +43,13 @@ export function useSizeModifier(props) {
|
|
|
37
43
|
let aspectRatio = ratio
|
|
38
44
|
if (!!square) aspectRatio = 1
|
|
39
45
|
|
|
40
|
-
const style = clearProps({ height, width, minHeight, minHeight, maxHeight, maxWidth, aspectRatio })
|
|
46
|
+
const style = clearProps({ height, width, minHeight, minHeight, maxHeight, minWidth, maxWidth, aspectRatio })
|
|
41
47
|
|
|
42
|
-
return
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
return [
|
|
49
|
+
values,
|
|
50
|
+
{
|
|
51
|
+
...restProps,
|
|
52
|
+
style: { ...props.style, ...style },
|
|
53
|
+
},
|
|
54
|
+
]
|
|
46
55
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getSizeFromProps } from '../theme/helpers/sizeScale'
|
|
2
|
+
import { useGetThemeValue } from '../theme/ThemeHandler'
|
|
3
|
+
|
|
4
|
+
export function useSizeConverter(groupKey, defaultValue) {
|
|
5
|
+
const getSizeValue = useGetThemeValue(groupKey)
|
|
6
|
+
|
|
7
|
+
return ([values, props]) => {
|
|
8
|
+
const [sizeCode, formattedProps] = getSizeFromProps(props, defaultValue)
|
|
9
|
+
const size = getSizeValue(sizeCode)
|
|
10
|
+
return [{ ...values, size, sizeCode }, formattedProps]
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { clearProps } from './_helpers'
|
|
2
|
+
|
|
3
|
+
export function useStateModifier([values, props]) {
|
|
4
|
+
let { disabled, loading, onClick, onPress, onChange, ...restProps } = props
|
|
5
|
+
|
|
6
|
+
let cursor = props.style
|
|
7
|
+
let opacity = props.opacity
|
|
8
|
+
|
|
9
|
+
if (!!disabled) {
|
|
10
|
+
opacity = 0.3
|
|
11
|
+
onChange = undefined
|
|
12
|
+
cursor = 'not-allowed'
|
|
13
|
+
}
|
|
14
|
+
if (!!disabled || !!loading) {
|
|
15
|
+
onPress = undefined
|
|
16
|
+
onClick = undefined
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const style = clearProps({ opacity, cursor })
|
|
20
|
+
const newProps = clearProps({ onPress, onClick, onChange })
|
|
21
|
+
|
|
22
|
+
return [
|
|
23
|
+
{ disabled, loading, ...values },
|
|
24
|
+
{
|
|
25
|
+
...newProps,
|
|
26
|
+
...restProps,
|
|
27
|
+
style: {
|
|
28
|
+
...props.style,
|
|
29
|
+
...style,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
]
|
|
33
|
+
}
|
package/src/modifiers/text.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { clearProps } from './_helpers'
|
|
2
|
-
import { mergePreset
|
|
2
|
+
import { mergePreset } from '../theme/helpers/mergePreset'
|
|
3
|
+
import { useGetColor, useTexts } from '../theme/ThemeHandler'
|
|
3
4
|
|
|
4
|
-
export function useTextModifier({
|
|
5
|
+
export function useTextModifier([{ color, textCode, ...values }, { ...props }]) {
|
|
5
6
|
const getColor = useGetColor()
|
|
6
7
|
const texts = useTexts()
|
|
7
8
|
|
|
8
|
-
if (!
|
|
9
|
+
if (!textCode && !props.inherit) textCode = 'p'
|
|
9
10
|
|
|
10
11
|
let {
|
|
11
|
-
color,
|
|
12
12
|
opacity,
|
|
13
13
|
bold,
|
|
14
14
|
strong,
|
|
@@ -23,7 +23,7 @@ export function useTextModifier({ size, ...props }) {
|
|
|
23
23
|
inherit,
|
|
24
24
|
fontSize,
|
|
25
25
|
...restProps
|
|
26
|
-
} = mergePreset(texts,
|
|
26
|
+
} = mergePreset(texts, textCode, props, 'p')
|
|
27
27
|
|
|
28
28
|
let fontStyle
|
|
29
29
|
if (italic) fontStyle = 'italic'
|
|
@@ -38,8 +38,6 @@ export function useTextModifier({ size, ...props }) {
|
|
|
38
38
|
fontWeight = fontWeight || weight
|
|
39
39
|
if (bold || strong) fontWeight = 600
|
|
40
40
|
|
|
41
|
-
if (!inherit) color = getColor(color || 'text')
|
|
42
|
-
|
|
43
41
|
const style = clearProps({
|
|
44
42
|
fontWeight,
|
|
45
43
|
fontStyle,
|
|
@@ -51,11 +49,14 @@ export function useTextModifier({ size, ...props }) {
|
|
|
51
49
|
fontSize,
|
|
52
50
|
})
|
|
53
51
|
|
|
54
|
-
return
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
...
|
|
58
|
-
|
|
52
|
+
return [
|
|
53
|
+
values,
|
|
54
|
+
{
|
|
55
|
+
...restProps,
|
|
56
|
+
style: {
|
|
57
|
+
...props.style,
|
|
58
|
+
...style,
|
|
59
|
+
},
|
|
59
60
|
},
|
|
60
|
-
|
|
61
|
+
]
|
|
61
62
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getTextFromProps } from '../theme/helpers/textScale'
|
|
2
|
+
import { useGetThemeValue } from '../theme/ThemeHandler'
|
|
3
|
+
|
|
4
|
+
export function useTextConverter(defaultValue) {
|
|
5
|
+
const getTextValue = useGetThemeValue('texts')
|
|
6
|
+
|
|
7
|
+
return ([values, props]) => {
|
|
8
|
+
const [textCode, formattedProps] = getTextFromProps(props, defaultValue)
|
|
9
|
+
const text = getTextValue(textCode)
|
|
10
|
+
return [{ ...values, text, textCode }, formattedProps]
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { mergeDeepRight } from 'ramda'
|
|
2
|
+
import { useThemeComponent } from '../theme/ThemeHandler'
|
|
3
|
+
|
|
4
|
+
export function useThemeComponentModifier(componentName) {
|
|
5
|
+
const themeProps = useThemeComponent(componentName)
|
|
6
|
+
|
|
7
|
+
return ([values, props]) => {
|
|
8
|
+
props = mergeDeepRight(themeProps, props)
|
|
9
|
+
return [values, props]
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { useBreakpoints } from '../theme/ThemeHandler'
|
|
4
|
+
import { useWindowWidth } from '../abstractions/helpers/windowWidth'
|
|
5
|
+
|
|
6
|
+
const ResponsiveContext = React.createContext(null)
|
|
7
|
+
|
|
8
|
+
export const useResponsive = () => React.useContext(ResponsiveContext)
|
|
9
|
+
|
|
10
|
+
export function ResponsiveHandler({ children }) {
|
|
11
|
+
const width = useWindowWidth()
|
|
12
|
+
|
|
13
|
+
const breakpoints = useBreakpoints()
|
|
14
|
+
|
|
15
|
+
const screen = React.useMemo(() => {
|
|
16
|
+
if (!breakpoints?.length) return false
|
|
17
|
+
for (let i = 0; i < breakpoints.length; i++) {
|
|
18
|
+
if (width < breakpoints[i].value) {
|
|
19
|
+
return breakpoints[i].name
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return breakpoints[breakpoints.length - 1]?.name
|
|
23
|
+
}, [width, breakpoints])
|
|
24
|
+
|
|
25
|
+
const value = React.useMemo(() => ({ width, screen }), [width, screen])
|
|
26
|
+
|
|
27
|
+
return <ResponsiveContext.Provider value={value}>{children}</ResponsiveContext.Provider>
|
|
28
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { is } from 'ramda'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import { useBreakpoints } from '../theme/ThemeHandler'
|
|
5
|
+
import { useResponsive } from '../responsive/ResponsiveHandler'
|
|
6
|
+
|
|
7
|
+
export function useGetResponsiveValue() {
|
|
8
|
+
const breakpoints = useBreakpoints()
|
|
9
|
+
const { width, screen } = useResponsive()
|
|
10
|
+
|
|
11
|
+
return React.useCallback(
|
|
12
|
+
(value) => {
|
|
13
|
+
const isObj = is(Object, value)
|
|
14
|
+
|
|
15
|
+
if (!isObj) return value
|
|
16
|
+
|
|
17
|
+
if (value[screen]) return value[screen]
|
|
18
|
+
|
|
19
|
+
const keys = Object.keys(value)
|
|
20
|
+
for (let k of keys) {
|
|
21
|
+
const match = k.match(/^(\w+)([du])$/)
|
|
22
|
+
if (!match) continue
|
|
23
|
+
|
|
24
|
+
const bpName = match[1]
|
|
25
|
+
const mode = match[2]
|
|
26
|
+
|
|
27
|
+
const bpIndex = breakpoints.findIndex((b) => b.name === bpName)
|
|
28
|
+
if (bpIndex === -1) continue
|
|
29
|
+
|
|
30
|
+
// For "up", use the lower boundary of the range (previous breakpoint value)
|
|
31
|
+
// For "down", use the upper boundary of the range (current breakpoint value)
|
|
32
|
+
if (mode === 'u') {
|
|
33
|
+
const lowerBound = bpIndex > 0 ? breakpoints[bpIndex - 1].value : 0
|
|
34
|
+
if (width >= lowerBound) return value[k]
|
|
35
|
+
}
|
|
36
|
+
if (mode === 'd') {
|
|
37
|
+
if (width < breakpoints[bpIndex].value) return value[k]
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return value?.df
|
|
42
|
+
},
|
|
43
|
+
[screen]
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function useResponsiveValue(value) {
|
|
48
|
+
const getValue = useGetResponsiveValue()
|
|
49
|
+
|
|
50
|
+
const isObj = is(Object, value)
|
|
51
|
+
const valueWatch = isObj ? Object.keys(value).map((k) => `${k}:${value[k]}`) : [value]
|
|
52
|
+
|
|
53
|
+
return React.useMemo(() => getValue(value), [getValue, ...valueWatch])
|
|
54
|
+
}
|
|
@@ -2,50 +2,48 @@ import { mergeDeepRight } from 'ramda'
|
|
|
2
2
|
import React from 'react'
|
|
3
3
|
|
|
4
4
|
import { DEFAULT_LIGHT_THEME } from './default/lightTheme'
|
|
5
|
-
import {
|
|
5
|
+
import { getThemeValue } from './helpers/relatedScales'
|
|
6
6
|
import { useFormattedTheme } from './format/formatTheme'
|
|
7
7
|
|
|
8
|
+
const DEFAULT_BREAKPOINTS = [
|
|
9
|
+
{ name: 'sm', value: 768 },
|
|
10
|
+
{ name: 'md', value: 1024 },
|
|
11
|
+
{ name: 'lg', value: 1440 },
|
|
12
|
+
{ name: 'xl', value: 10000 },
|
|
13
|
+
]
|
|
14
|
+
|
|
8
15
|
const ThemeContext = React.createContext(null)
|
|
9
16
|
export const useThemeHandler = () => React.useContext(ThemeContext) || {}
|
|
10
|
-
export const useTheme = () => useThemeHandler().theme || DEFAULT_LIGHT_THEME
|
|
11
17
|
|
|
12
|
-
export const
|
|
13
|
-
const getColor = (colors, key) => colors[key] || key
|
|
14
|
-
export const useGetColor = () => {
|
|
15
|
-
const colors = useColors()
|
|
16
|
-
return (key) => getColor(colors, key)
|
|
17
|
-
}
|
|
18
|
+
export const useBreakpoints = () => useThemeHandler()?.breakpoints || DEFAULT_BREAKPOINTS
|
|
18
19
|
|
|
19
|
-
export const
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return (key) => getSpace(spaces, key)
|
|
20
|
+
export const useTheme = (groupKey) => {
|
|
21
|
+
const theme = useThemeHandler().theme || DEFAULT_LIGHT_THEME
|
|
22
|
+
if (!groupKey) return theme
|
|
23
|
+
return theme?.[groupKey] || {}
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export const
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
const radius = useRadius()
|
|
30
|
-
return (key) => getRadius(radius, key)
|
|
26
|
+
export const useGetThemeValue = (groupKey) => {
|
|
27
|
+
const group = useTheme(groupKey)
|
|
28
|
+
return (key) => getThemeValue(group, key)
|
|
31
29
|
}
|
|
32
30
|
|
|
33
|
-
export const
|
|
31
|
+
export const useColors = () => useTheme('colors')
|
|
32
|
+
export const useGetColor = () => useGetThemeValue('colors')
|
|
34
33
|
|
|
35
|
-
export
|
|
36
|
-
|
|
37
|
-
const preset = presets[key] || presets[defaultKey]
|
|
38
|
-
return { ...props, ...preset }
|
|
39
|
-
}
|
|
34
|
+
export const useSpaces = () => useTheme('spaces')
|
|
35
|
+
export const useGetSpace = () => useGetThemeValue('spaces')
|
|
40
36
|
|
|
41
|
-
export const
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
export const useRadius = () => useTheme('radius')
|
|
38
|
+
export const useGetRadius = () => useGetThemeValue('radius')
|
|
39
|
+
|
|
40
|
+
export const useElementHeights = () => useTheme('elementHeights')
|
|
41
|
+
export const useGetElementHeight = () => useGetThemeValue('elementHeights')
|
|
42
|
+
|
|
43
|
+
export const useTexts = () => useTheme('texts')
|
|
44
|
+
export const useGetText = () => useGetThemeValue('text')
|
|
47
45
|
|
|
48
|
-
export const useThemeComponents = () => useTheme()
|
|
46
|
+
export const useThemeComponents = () => useTheme('components')
|
|
49
47
|
export function useThemeComponent(name) {
|
|
50
48
|
const components = useThemeComponents()
|
|
51
49
|
return components[name] || {}
|
|
@@ -55,10 +53,10 @@ export function useMergeThemeComponent(name, props) {
|
|
|
55
53
|
return mergeDeepRight(themeProps, props)
|
|
56
54
|
}
|
|
57
55
|
|
|
58
|
-
export function ThemeHandler({ themes, initTheme, children }) {
|
|
56
|
+
export function ThemeHandler({ breakpoints, themes, initTheme, children }) {
|
|
59
57
|
const [activeThemeKey, setActiveThemeKey] = React.useState(initTheme || 'light')
|
|
60
58
|
const theme = useFormattedTheme(themes, activeThemeKey)
|
|
61
|
-
const value = { theme, themes, activeThemeKey, setActiveThemeKey }
|
|
59
|
+
const value = { theme, themes, activeThemeKey, setActiveThemeKey, breakpoints: breakpoints || DEFAULT_BREAKPOINTS }
|
|
62
60
|
|
|
63
61
|
return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>
|
|
64
62
|
}
|
|
@@ -1,35 +1,47 @@
|
|
|
1
1
|
export const BASE_THEME = {
|
|
2
2
|
spaces: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
xxxs: 1,
|
|
4
|
+
xxs: 3,
|
|
5
|
+
xs: 5,
|
|
6
6
|
sm: 10,
|
|
7
7
|
md: 15,
|
|
8
8
|
lg: 20,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
xl: 30,
|
|
10
|
+
xxl: 40,
|
|
11
|
+
xxxl: 50,
|
|
12
12
|
},
|
|
13
13
|
|
|
14
14
|
radius: {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
xxxs: 4,
|
|
16
|
+
xxs: 5,
|
|
17
|
+
xs: 5,
|
|
18
18
|
sm: 7,
|
|
19
19
|
md: 8,
|
|
20
20
|
lg: 10,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
xl: 12,
|
|
22
|
+
xxl: 15,
|
|
23
|
+
xxxl: 18,
|
|
24
24
|
},
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
icons: {
|
|
27
|
+
xxxs: 10,
|
|
28
|
+
xxs: 12,
|
|
29
|
+
xs: 14,
|
|
30
|
+
sm: 16,
|
|
31
|
+
md: 18,
|
|
32
|
+
lg: 22,
|
|
33
|
+
xl: 26,
|
|
34
|
+
xxl: 28,
|
|
35
|
+
xxxl: 32,
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
// Buttons, inputs, etc.
|
|
27
39
|
elementHeights: {
|
|
28
|
-
|
|
40
|
+
xs: 20,
|
|
29
41
|
sm: 30,
|
|
30
42
|
md: 35,
|
|
31
43
|
lg: 50,
|
|
32
|
-
|
|
44
|
+
xl: 60,
|
|
33
45
|
},
|
|
34
46
|
|
|
35
47
|
texts: {
|
|
@@ -59,7 +71,7 @@ export const BASE_THEME = {
|
|
|
59
71
|
},
|
|
60
72
|
p: { fontSize: 14 },
|
|
61
73
|
sm: { fontSize: 12 },
|
|
62
|
-
|
|
63
|
-
|
|
74
|
+
xs: { fontSize: 10 },
|
|
75
|
+
xxs: { fontSize: 8 },
|
|
64
76
|
},
|
|
65
77
|
}
|