@neko-os/ui 0.2.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DynamicStyleTag.js +18 -2
- package/dist/DynamicStyleTag.native.js +3 -1
- package/dist/NekoUI.js +39 -1
- package/dist/abstractions/ActivityIndicator.js +19 -1
- package/dist/abstractions/ActivityIndicator.native.js +43 -1
- package/dist/abstractions/ActivityIndicator.web.js +43 -1
- package/dist/abstractions/AnimatedView.js +3 -1
- package/dist/abstractions/AnimatedView.native.js +5 -1
- package/dist/abstractions/AnimatedView.web.js +3 -1
- package/dist/abstractions/BlurView.js +43 -1
- package/dist/abstractions/BlurView.native.js +39 -1
- package/dist/abstractions/BlurView.web.js +39 -1
- package/dist/abstractions/DraggableSlideView.js +3 -1
- package/dist/abstractions/DraggableSlideView.native.js +62 -1
- package/dist/abstractions/FlatList.js +3 -1
- package/dist/abstractions/FlatList.native.js +37 -1
- package/dist/abstractions/FlatList.web.js +3 -1
- package/dist/abstractions/GradientView.js +5 -1
- package/dist/abstractions/GradientView.native.js +32 -1
- package/dist/abstractions/HiddenInput.js +3 -1
- package/dist/abstractions/HiddenInput.native.js +3 -1
- package/dist/abstractions/Icon.js +10 -1
- package/dist/abstractions/Icon.native.js +13 -1
- package/dist/abstractions/Icon.web.js +11 -1
- package/dist/abstractions/Image.js +12 -1
- package/dist/abstractions/Image.native.js +7 -1
- package/dist/abstractions/Image.web.js +7 -1
- package/dist/abstractions/ImageBackground.js +17 -1
- package/dist/abstractions/ImageBackground.native.js +27 -1
- package/dist/abstractions/ImageBackground.web.js +7 -1
- package/dist/abstractions/KeyboardAvoidingView.js +3 -1
- package/dist/abstractions/KeyboardAvoidingView.native.js +3 -1
- package/dist/abstractions/Platform.js +1 -1
- package/dist/abstractions/Platform.native.js +3 -1
- package/dist/abstractions/Platform.web.js +3 -1
- package/dist/abstractions/Pressable.js +4 -1
- package/dist/abstractions/Pressable.native.js +3 -1
- package/dist/abstractions/Pressable.web.js +3 -1
- package/dist/abstractions/SafeAreaView.js +3 -1
- package/dist/abstractions/SafeAreaView.native.js +3 -1
- package/dist/abstractions/ScrollView.js +3 -1
- package/dist/abstractions/ScrollView.native.js +5 -1
- package/dist/abstractions/ScrollView.web.js +3 -1
- package/dist/abstractions/StaticList.js +51 -1
- package/dist/abstractions/Switch.js +97 -1
- package/dist/abstractions/Switch.native.js +12 -1
- package/dist/abstractions/Table.js +29 -1
- package/dist/abstractions/Table.native.js +19 -1
- package/dist/abstractions/Text.js +14 -1
- package/dist/abstractions/Text.native.js +3 -1
- package/dist/abstractions/Text.web.js +18 -1
- package/dist/abstractions/TextInput.js +12 -1
- package/dist/abstractions/TextInput.native.js +5 -1
- package/dist/abstractions/TextInput.web.js +5 -1
- package/dist/abstractions/TouchableOpacity.js +4 -1
- package/dist/abstractions/TouchableOpacity.native.js +9 -1
- package/dist/abstractions/View.js +3 -1
- package/dist/abstractions/View.native.js +3 -1
- package/dist/abstractions/View.web.js +3 -1
- package/dist/abstractions/helpers/componentSize.js +13 -1
- package/dist/abstractions/helpers/componentSize.native.js +12 -1
- package/dist/abstractions/helpers/storage.js +32 -1
- package/dist/abstractions/helpers/storage.native.js +34 -1
- package/dist/abstractions/helpers/transformStyle.js +8 -1
- package/dist/abstractions/helpers/transformStyle.native.js +3 -1
- package/dist/abstractions/helpers/useSafeAreaInsets.js +3 -1
- package/dist/abstractions/helpers/useSafeAreaInsets.native.js +3 -1
- package/dist/abstractions/helpers/windowWidth.js +13 -1
- package/dist/abstractions/helpers/windowWidth.native.js +6 -1
- package/dist/abstractions/helpers/windowWidth.web.js +6 -1
- package/dist/components/actions/ActionsDrawer.js +81 -1
- package/dist/components/actions/Breadcrumb.js +47 -1
- package/dist/components/actions/Button.js +82 -1
- package/dist/components/actions/Dropdown.js +91 -1
- package/dist/components/actions/FloatingButton.js +87 -1
- package/dist/components/actions/FloatingMenu.js +39 -1
- package/dist/components/actions/Link.js +66 -1
- package/dist/components/actions/Pressable.js +38 -1
- package/dist/components/actions/index.js +9 -1
- package/dist/components/actions/menu/HorizontalMenu.js +98 -1
- package/dist/components/actions/menu/Menu.js +7 -1
- package/dist/components/actions/menu/SubmenuWrapper.js +16 -1
- package/dist/components/actions/menu/VerticalMenu.js +133 -1
- package/dist/components/animations/AnimatedTopBar.js +10 -1
- package/dist/components/animations/AnimatedTopBar.native.js +34 -1
- package/dist/components/animations/AnimatedTopBar.web.js +1 -1
- package/dist/components/animations/AnimatedView.js +45 -1
- package/dist/components/animations/DraggableSlideView.js +42 -1
- package/dist/components/animations/ParallaxHeader.js +9 -1
- package/dist/components/animations/ParallaxHeader.native.js +32 -1
- package/dist/components/animations/ParallaxHeader.web.js +32 -1
- package/dist/components/animations/ReanimatedScrollHandler.js +8 -1
- package/dist/components/animations/ReanimatedScrollHandler.native.js +24 -1
- package/dist/components/animations/ReanimatedScrollHandler.web.js +1 -1
- package/dist/components/animations/ReanimatedView.js +40 -1
- package/dist/components/animations/index.js +5 -1
- package/dist/components/calendar/CalendarNav.js +67 -1
- package/dist/components/calendar/WeekDaysBar.js +18 -1
- package/dist/components/calendar/_helpers/calendarDays.js +16 -1
- package/dist/components/calendar/_helpers/dateDisabled.js +24 -1
- package/dist/components/feedback/alerter.js +31 -1
- package/dist/components/feedback/confirmer.js +70 -1
- package/dist/components/feedback/index.js +3 -1
- package/dist/components/feedback/notifications/Notification.js +37 -1
- package/dist/components/feedback/notifications/NotificationsHandler.js +65 -1
- package/dist/components/filter/DateFilter.js +72 -0
- package/dist/components/filter/FilterGroup.js +17 -0
- package/dist/components/filter/FilterHandler.js +54 -0
- package/dist/components/filter/FilterItem.js +30 -0
- package/dist/components/filter/PopoverFilterItem.js +84 -0
- package/dist/components/filter/SearchInput.js +49 -0
- package/dist/components/filter/index.js +6 -0
- package/dist/components/form/Form.js +31 -1
- package/dist/components/form/FormGroup.js +21 -1
- package/dist/components/form/FormItem.js +118 -1
- package/dist/components/form/FormList.js +143 -1
- package/dist/components/form/FormWrapperComponent.js +52 -1
- package/dist/components/form/FormWrapperComponent.native.js +5 -1
- package/dist/components/form/SubmitButton.js +22 -1
- package/dist/components/form/index.js +9 -1
- package/dist/components/form/useNewForm.js +211 -1
- package/dist/components/form/useWatch.js +70 -1
- package/dist/components/form/validation/defaultMessages.js +20 -1
- package/dist/components/form/validation/index.js +5 -1
- package/dist/components/form/validation/normalizeRules.js +22 -1
- package/dist/components/form/validation/shouldValidateOn.js +21 -1
- package/dist/components/form/validation/validateRules.js +83 -1
- package/dist/components/form/validation/validators.js +82 -1
- package/dist/components/helpers/ConditionalLazyRender.js +6 -1
- package/dist/components/helpers/LazyAction.js +22 -1
- package/dist/components/helpers/LazyRender.js +55 -1
- package/dist/components/helpers/LazyRender.native.js +58 -1
- package/dist/components/helpers/Portal.js +21 -1
- package/dist/components/helpers/PortalHandler.js +32 -1
- package/dist/components/helpers/Responsive.js +18 -1
- package/dist/components/helpers/Separator.js +49 -1
- package/dist/components/helpers/VerticalView.js +34 -1
- package/dist/components/helpers/index.js +8 -1
- package/dist/components/index.js +20 -1
- package/dist/components/inputs/BooleanSelect.js +14 -0
- package/dist/components/inputs/Checkbox.js +56 -1
- package/dist/components/inputs/DateInput.js +123 -1
- package/dist/components/inputs/DateRangeInput.js +41 -0
- package/dist/components/inputs/Editable.js +129 -0
- package/dist/components/inputs/EnabledSelect.js +14 -0
- package/dist/components/inputs/InputWrapper.js +93 -1
- package/dist/components/inputs/LinkInput.js +17 -1
- package/dist/components/inputs/MaskInput.js +67 -1
- package/dist/components/inputs/NumberInput.js +111 -1
- package/dist/components/inputs/NumberRangeInput.js +41 -0
- package/dist/components/inputs/PasswordInput.js +24 -0
- package/dist/components/inputs/Picker.js +169 -1
- package/dist/components/inputs/Radio.js +55 -1
- package/dist/components/inputs/RateInput.js +62 -1
- package/dist/components/inputs/SegmentedPicker.js +62 -1
- package/dist/components/inputs/Select.js +219 -1
- package/dist/components/inputs/Switch.js +60 -1
- package/dist/components/inputs/TextArea.js +5 -0
- package/dist/components/inputs/TextInput.js +32 -1
- package/dist/components/inputs/UploadInput.js +140 -0
- package/dist/components/inputs/_DateInput.native.js +89 -1
- package/dist/components/inputs/datePicker/DatePicker.js +24 -1
- package/dist/components/inputs/datePicker/DayPicker.js +64 -1
- package/dist/components/inputs/datePicker/MonthPicker.js +62 -1
- package/dist/components/inputs/datePicker/QuarterPicker.js +65 -1
- package/dist/components/inputs/datePicker/WeekPicker.js +74 -1
- package/dist/components/inputs/datePicker/YearPicker.js +70 -1
- package/dist/components/inputs/index.js +23 -1
- package/dist/components/inputs/upload/Upload.js +99 -0
- package/dist/components/inputs/upload/Upload.native.js +154 -0
- package/dist/components/inputs/upload/useUploadState.js +143 -0
- package/dist/components/layout/Layout.js +40 -1
- package/dist/components/layout/LayoutContent.js +42 -1
- package/dist/components/layout/LayoutHeader.js +70 -1
- package/dist/components/layout/LayoutSider.js +64 -1
- package/dist/components/layout/index.js +4 -1
- package/dist/components/list/FlatList.js +91 -1
- package/dist/components/list/ScrollView.js +58 -1
- package/dist/components/list/index.js +2 -1
- package/dist/components/modals/bottomDrawer/index.js +3 -1
- package/dist/components/modals/bottomDrawer/index.native.js +5 -1
- package/dist/components/modals/bottomDrawer/index.web.js +5 -1
- package/dist/components/modals/bottomDrawer/native/BottomDrawer.js +239 -1
- package/dist/components/modals/bottomDrawer/native/DrawerContext.js +17 -1
- package/dist/components/modals/bottomDrawer/native/DrawerHandle.js +12 -1
- package/dist/components/modals/bottomDrawer/native/DrawerScrollView.js +5 -1
- package/dist/components/modals/bottomDrawer/native/createDrawerScrollComponent.js +139 -1
- package/dist/components/modals/bottomDrawer/native/utils.js +65 -1
- package/dist/components/modals/bottomDrawer/web/BottomDrawer.js +5 -1
- package/dist/components/modals/drawer/Drawer.js +5 -1
- package/dist/components/modals/drawer/Drawer.native.js +3 -1
- package/dist/components/modals/drawer/Drawer.web.js +3 -1
- package/dist/components/modals/drawer/index.js +1 -1
- package/dist/components/modals/index.js +4 -1
- package/dist/components/modals/modal/Modal.js +84 -1
- package/dist/components/modals/modal/Modal.native.js +83 -1
- package/dist/components/modals/modal/ModalBackdrop.js +58 -1
- package/dist/components/modals/modal/ModalContent.js +28 -1
- package/dist/components/modals/modal/ModalFooter.js +31 -1
- package/dist/components/modals/modal/ModalHeader.js +50 -1
- package/dist/components/modals/modal/handler/ModalsHandler.js +61 -1
- package/dist/components/modals/modal/index.js +6 -1
- package/dist/components/modals/router/ModalRoute.js +15 -1
- package/dist/components/modals/router/ModalsRouter.js +120 -1
- package/dist/components/modals/router/ModalsRouterContext.js +16 -1
- package/dist/components/modals/router/index.js +6 -1
- package/dist/components/modals/router/useAllModalsParams.js +6 -1
- package/dist/components/modals/router/useModalParams.js +6 -1
- package/dist/components/modals/router/useModalsNavigation.js +6 -1
- package/dist/components/modals/router/useUpdateModalContainer.js +6 -1
- package/dist/components/presentation/Avatar.js +79 -1
- package/dist/components/presentation/AvatarLabel.js +60 -1
- package/dist/components/presentation/AvatarsGroup.js +30 -0
- package/dist/components/presentation/Badge.js +91 -1
- package/dist/components/presentation/ContentLabel.js +43 -1
- package/dist/components/presentation/Icon.js +20 -1
- package/dist/components/presentation/IconLabel.js +40 -1
- package/dist/components/presentation/Image.js +33 -1
- package/dist/components/presentation/ImageBackground.js +38 -1
- package/dist/components/presentation/LabelValue.js +51 -1
- package/dist/components/presentation/Progress.js +20 -0
- package/dist/components/presentation/Rate.js +58 -1
- package/dist/components/presentation/RateTag.js +35 -1
- package/dist/components/presentation/Result.js +60 -1
- package/dist/components/presentation/ResultBar.js +56 -1
- package/dist/components/presentation/Tag.js +69 -1
- package/dist/components/presentation/Tooltip.js +44 -1
- package/dist/components/presentation/index.js +16 -1
- package/dist/components/sections/Section.js +50 -1
- package/dist/components/sections/SectionItem.js +24 -1
- package/dist/components/sections/SectionItemDropdown.js +68 -1
- package/dist/components/sections/SectionItemLink.js +35 -1
- package/dist/components/sections/index.js +4 -1
- package/dist/components/state/Loading.js +20 -1
- package/dist/components/state/LoadingView.js +37 -1
- package/dist/components/state/StatePresenter.js +41 -1
- package/dist/components/state/index.js +3 -1
- package/dist/components/steps/ActiveStepContent.js +16 -0
- package/dist/components/steps/StepsHandler.js +53 -0
- package/dist/components/steps/StepsMenu.js +14 -0
- package/dist/components/steps/StepsNavigation.js +37 -0
- package/dist/components/steps/index.js +4 -0
- package/dist/components/structure/Accordion.js +69 -1
- package/dist/components/structure/AccordionGroup.js +35 -1
- package/dist/components/structure/Affix.js +34 -0
- package/dist/components/structure/Affix.native.js +3 -0
- package/dist/components/structure/BlurView.js +59 -1
- package/dist/components/structure/Card.js +46 -1
- package/dist/components/structure/Col.js +22 -1
- package/dist/components/structure/GradientView.js +42 -1
- package/dist/components/structure/KeyboardAvoidingView.js +52 -1
- package/dist/components/structure/Row.js +50 -1
- package/dist/components/structure/SafeAreaView.js +42 -1
- package/dist/components/structure/Segment.js +51 -1
- package/dist/components/structure/TopBar.js +57 -1
- package/dist/components/structure/View.js +44 -1
- package/dist/components/structure/index.js +14 -1
- package/dist/components/structure/overlay/OverlayHandler.js +83 -1
- package/dist/components/structure/overlay/OverlayHandler.native.js +6 -1
- package/dist/components/structure/overlay/OverlayWrapper.js +52 -1
- package/dist/components/structure/overlay/calculatePosition.js +29 -1
- package/dist/components/structure/overlay/smartPlacement.js +32 -1
- package/dist/components/structure/popover/Popover.js +135 -1
- package/dist/components/structure/popover/Popover.native.js +105 -1
- package/dist/components/structure/popover/PopoverContent.js +18 -1
- package/dist/components/structure/popover/Popover_BU.js +157 -1
- package/dist/components/table/DataTable.js +62 -1
- package/dist/components/table/Pagination.js +128 -1
- package/dist/components/table/Table.js +66 -1
- package/dist/components/table/TableCol.js +67 -1
- package/dist/components/table/TableHeader.js +69 -1
- package/dist/components/table/TableHeaderRow.js +31 -1
- package/dist/components/table/TableRow.js +30 -1
- package/dist/components/table/index.js +7 -1
- package/dist/components/tabs/ActiveTabContent.js +38 -1
- package/dist/components/tabs/TabsHandler.js +16 -1
- package/dist/components/tabs/TabsMenu.js +15 -1
- package/dist/components/tabs/index.js +3 -1
- package/dist/components/text/DateText.js +24 -1
- package/dist/components/text/Text.js +32 -1
- package/dist/components/text/VerticalText.js +29 -1
- package/dist/components/text/index.js +3 -1
- package/dist/components/theme/ThemePicker.js +48 -1
- package/dist/components/theme/ThemePickerDrawer.js +12 -1
- package/dist/components/theme/ThemeStatusBar.js +3 -1
- package/dist/components/theme/ThemeStatusBar.native.js +9 -1
- package/dist/components/theme/ThemeThumb.js +98 -1
- package/dist/components/theme/index.js +3 -1
- package/dist/helpers/debounce.js +9 -1
- package/dist/helpers/index.js +5 -1
- package/dist/helpers/options.js +65 -1
- package/dist/helpers/random.js +5 -1
- package/dist/helpers/storage.js +76 -1
- package/dist/helpers/string.js +74 -1
- package/dist/i18n/I18n.js +96 -1
- package/dist/i18n/I18nProvider.js +40 -1
- package/dist/i18n/index.js +2 -1
- package/dist/index.js +8 -1
- package/dist/modifiers/_helpers.js +6 -1
- package/dist/modifiers/alignConverter.js +11 -1
- package/dist/modifiers/animation.js +18 -1
- package/dist/modifiers/animations/animatedEffects.js +64 -1
- package/dist/modifiers/animations/animatedEffects.native.js +55 -1
- package/dist/modifiers/animations/animatedEffects.web.js +55 -1
- package/dist/modifiers/animations/fadeEffect.js +46 -1
- package/dist/modifiers/animations/fadeEffect.native.js +33 -1
- package/dist/modifiers/animations/fadeEffect.web.js +3 -1
- package/dist/modifiers/animations/scaleEffect.js +46 -1
- package/dist/modifiers/animations/scaleEffect.native.js +33 -1
- package/dist/modifiers/animations/scrollEffect.web.js +3 -1
- package/dist/modifiers/animations/slideEffect.js +64 -1
- package/dist/modifiers/animations/slideEffect.native.js +53 -1
- package/dist/modifiers/animations/slideEffect.web.js +3 -1
- package/dist/modifiers/applyStyles.js +7 -1
- package/dist/modifiers/background.js +34 -1
- package/dist/modifiers/border.js +86 -1
- package/dist/modifiers/colorConverter.js +13 -1
- package/dist/modifiers/cursor.js +21 -1
- package/dist/modifiers/default.js +9 -1
- package/dist/modifiers/display.js +22 -1
- package/dist/modifiers/flex.js +20 -1
- package/dist/modifiers/flexWrapper.js +87 -1
- package/dist/modifiers/fullColor.js +32 -1
- package/dist/modifiers/grid.js +27 -1
- package/dist/modifiers/hover.js +28 -1
- package/dist/modifiers/logger.js +6 -1
- package/dist/modifiers/margin.js +25 -1
- package/dist/modifiers/overflow.js +28 -1
- package/dist/modifiers/padding.js +25 -1
- package/dist/modifiers/position.js +57 -1
- package/dist/modifiers/responsiveConverter.js +19 -1
- package/dist/modifiers/shadow.js +35 -1
- package/dist/modifiers/size.js +59 -1
- package/dist/modifiers/sizeConverter.js +12 -1
- package/dist/modifiers/state.js +33 -1
- package/dist/modifiers/text.js +62 -1
- package/dist/modifiers/textConverter.js +12 -1
- package/dist/modifiers/themeComponent.js +11 -1
- package/dist/responsive/ResponsiveHandler.js +28 -1
- package/dist/responsive/index.js +2 -1
- package/dist/responsive/responsiveHooks.js +67 -1
- package/dist/theme/ThemeHandler.js +81 -1
- package/dist/theme/default/base.js +95 -1
- package/dist/theme/default/blackTheme.js +47 -1
- package/dist/theme/default/cyberpunkTheme.js +36 -1
- package/dist/theme/default/darkTheme.js +35 -1
- package/dist/theme/default/hackerTheme.js +55 -1
- package/dist/theme/default/lightTheme.js +35 -1
- package/dist/theme/default/paperTheme.js +36 -1
- package/dist/theme/default/themes.js +15 -1
- package/dist/theme/format/colorsVariations.js +31 -1
- package/dist/theme/format/formatTheme.js +28 -1
- package/dist/theme/helpers/colorScale.js +12 -1
- package/dist/theme/helpers/contrastColor.js +18 -1
- package/dist/theme/helpers/dynamicColor.js +32 -1
- package/dist/theme/helpers/mergePreset.js +7 -1
- package/dist/theme/helpers/relatedScales.js +34 -1
- package/dist/theme/helpers/sizeScale.js +20 -1
- package/dist/theme/helpers/textScale.js +15 -1
- package/dist/theme/index.js +2 -1
- package/package.json +1 -3
- package/src/abstractions/Icon.js +1 -1
- package/src/abstractions/TextInput.js +10 -1
- package/src/abstractions/TouchableOpacity.native.js +8 -2
- package/src/components/actions/ActionsDrawer.js +1 -1
- package/src/components/actions/Button.js +3 -1
- package/src/components/actions/FloatingMenu.js +1 -1
- package/src/components/actions/menu/HorizontalMenu.js +2 -1
- package/src/components/actions/menu/VerticalMenu.js +2 -1
- package/src/components/filter/DateFilter.js +72 -0
- package/src/components/filter/FilterGroup.js +17 -0
- package/src/components/filter/FilterHandler.js +54 -0
- package/src/components/filter/FilterItem.js +30 -0
- package/src/components/filter/PopoverFilterItem.js +84 -0
- package/src/components/filter/SearchInput.js +49 -0
- package/src/components/filter/index.js +6 -0
- package/src/components/form/Form.js +9 -3
- package/src/components/form/FormItem.js +26 -1
- package/src/components/form/FormWrapperComponent.js +12 -3
- package/src/components/form/useNewForm.js +55 -4
- package/src/components/helpers/Separator.js +15 -11
- package/src/components/helpers/index.js +1 -0
- package/src/components/index.js +2 -0
- package/src/components/inputs/BooleanSelect.js +14 -0
- package/src/components/inputs/DateInput.js +3 -1
- package/src/components/inputs/DateRangeInput.js +41 -0
- package/src/components/inputs/Editable.js +129 -0
- package/src/components/inputs/EnabledSelect.js +14 -0
- package/src/components/inputs/InputWrapper.js +7 -4
- package/src/components/inputs/LinkInput.js +1 -1
- package/src/components/inputs/NumberInput.js +10 -5
- package/src/components/inputs/NumberRangeInput.js +41 -0
- package/src/components/inputs/PasswordInput.js +24 -0
- package/src/components/inputs/Picker.js +3 -3
- package/src/components/inputs/Select.js +61 -47
- package/src/components/inputs/TextArea.js +5 -0
- package/src/components/inputs/TextInput.js +14 -4
- package/src/components/inputs/UploadInput.js +140 -0
- package/src/components/inputs/index.js +9 -0
- package/src/components/inputs/upload/Upload.js +99 -0
- package/src/components/inputs/upload/Upload.native.js +154 -0
- package/src/components/inputs/upload/useUploadState.js +143 -0
- package/src/components/layout/LayoutHeader.js +1 -0
- package/src/components/presentation/AvatarLabel.js +1 -1
- package/src/components/presentation/AvatarsGroup.js +30 -0
- package/src/components/presentation/Badge.js +3 -2
- package/src/components/presentation/ContentLabel.js +1 -1
- package/src/components/presentation/IconLabel.js +1 -0
- package/src/components/presentation/Progress.js +20 -0
- package/src/components/presentation/index.js +2 -0
- package/src/components/sections/Section.js +1 -1
- package/src/components/sections/SectionItemLink.js +4 -2
- package/src/components/steps/ActiveStepContent.js +16 -0
- package/src/components/steps/StepsHandler.js +53 -0
- package/src/components/steps/StepsMenu.js +14 -0
- package/src/components/steps/StepsNavigation.js +37 -0
- package/src/components/steps/index.js +4 -0
- package/src/components/structure/Affix.js +34 -0
- package/src/components/structure/Affix.native.js +3 -0
- package/src/components/structure/Card.js +1 -0
- package/src/components/structure/TopBar.js +13 -1
- package/src/components/structure/index.js +1 -0
- package/src/components/structure/overlay/OverlayHandler.js +9 -1
- package/src/components/structure/popover/Popover.js +22 -5
- package/src/components/table/DataTable.js +7 -2
- package/src/components/table/Table.js +2 -1
- package/src/components/tabs/ActiveTabContent.js +4 -1
- package/src/components/text/DateText.js +15 -2
- package/src/modifiers/border.js +15 -9
- package/src/modifiers/size.js +8 -5
- package/src/theme/default/base.js +2 -0
- package/src/theme/default/hackerTheme.js +1 -10
- package/src/theme/default/paperTheme.js +1 -14
|
@@ -1 +1,211 @@
|
|
|
1
|
-
|
|
1
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {try {var i = n[a](c),u = i.value;} catch (n) {return void e(n);}i.done ? t(u) : Promise.resolve(u).then(r, o);}function _asyncToGenerator(n) {return function () {var t = this,e = arguments;return new Promise(function (r, o) {var a = n.apply(t, e);function _next(n) {asyncGeneratorStep(a, r, o, _next, _throw, "next", n);}function _throw(n) {asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);}_next(void 0);});};}function _slicedToArray(r, e) {return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r, a) {if (r) {if ("string" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}function _iterableToArrayLimit(r, l) {var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];if (null != t) {var e,n,i,u,a = [],f = !0,o = !1;try {if (i = (t = t.call(r)).next, 0 === l) {if (Object(t) !== t) return;f = !1;} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);} catch (r) {o = !0, n = r;} finally {try {if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;} finally {if (o) throw n;}}return a;}}function _arrayWithHoles(r) {if (Array.isArray(r)) return r;}import { assocPath, path } from 'ramda';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { validateRules, validateAllFields, normalizeRules } from "./validation";
|
|
4
|
+
|
|
5
|
+
export function useNewForm() {var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},_ref$initialValues = _ref.initialValues,initialValues = _ref$initialValues === void 0 ? {} : _ref$initialValues,validate = _ref.validate,onSubmit = _ref.onSubmit,onValuesChange = _ref.onValuesChange;
|
|
6
|
+
var valuesRef = React.useRef(Object.assign({}, initialValues));
|
|
7
|
+
var initialValuesRef = React.useRef(Object.assign({}, initialValues));
|
|
8
|
+
var errorsRef = React.useRef({});
|
|
9
|
+
var listenersRef = React.useRef({});
|
|
10
|
+
var errorListenersRef = React.useRef({});
|
|
11
|
+
var rulesRegistryRef = React.useRef(new Map());
|
|
12
|
+
var callbacksRef = React.useRef({ onSubmit: onSubmit, validate: validate, onValuesChange: onValuesChange });
|
|
13
|
+
|
|
14
|
+
callbacksRef.current = { onSubmit: onSubmit, validate: validate, onValuesChange: onValuesChange };
|
|
15
|
+
|
|
16
|
+
var formApi = React.useMemo(function () {
|
|
17
|
+
var toKey = function toKey(name) {return Array.isArray(name) ? name.join('.') : name;};
|
|
18
|
+
var toPath = function toPath(name) {return Array.isArray(name) ? name : [name];};
|
|
19
|
+
|
|
20
|
+
var notify = function notify(name) {
|
|
21
|
+
var key = toKey(name);
|
|
22
|
+
if (listenersRef.current[key]) {
|
|
23
|
+
listenersRef.current[key].forEach(function (cb) {return cb(path(toPath(name), valuesRef.current));});
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
var notifyAll = function notifyAll() {
|
|
28
|
+
Object.keys(listenersRef.current).forEach(function (key) {var _listenersRef$current;
|
|
29
|
+
var keyPath = key.split('.');
|
|
30
|
+
var value = path(keyPath, valuesRef.current);
|
|
31
|
+
(_listenersRef$current = listenersRef.current[key]) == null ? void 0 : _listenersRef$current.forEach(function (cb) {return cb(value);});
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var notifyError = function notifyError(name) {
|
|
36
|
+
var key = toKey(name);
|
|
37
|
+
if (errorListenersRef.current[key]) {
|
|
38
|
+
errorListenersRef.current[key].forEach(function (cb) {return cb(errorsRef.current[key]);});
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
var notifyAllErrors = function notifyAllErrors() {
|
|
43
|
+
Object.keys(errorListenersRef.current).forEach(function (key) {var _errorListenersRef$cu;
|
|
44
|
+
(_errorListenersRef$cu = errorListenersRef.current[key]) == null ? void 0 : _errorListenersRef$cu.forEach(function (cb) {return cb(errorsRef.current[key]);});
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
var setFieldValue = function setFieldValue(name, value) {
|
|
49
|
+
valuesRef.current = assocPath(toPath(name), value, valuesRef.current);
|
|
50
|
+
notify(name);
|
|
51
|
+
var fn = callbacksRef.current.onValuesChange;
|
|
52
|
+
if (fn) fn(name, valuesRef.current);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
var getFieldValue = function getFieldValue(name) {return path(toPath(name), valuesRef.current);};
|
|
56
|
+
|
|
57
|
+
var getFieldsValue = function getFieldsValue() {return Object.assign({}, valuesRef.current);};
|
|
58
|
+
|
|
59
|
+
var setFieldsValue = function setFieldsValue(obj) {
|
|
60
|
+
if (!obj) return;
|
|
61
|
+
Object.entries(obj).forEach(function (_ref2) {var _ref3 = _slicedToArray(_ref2, 2),key = _ref3[0],value = _ref3[1];
|
|
62
|
+
valuesRef.current = assocPath(toPath(key), value, valuesRef.current);
|
|
63
|
+
});
|
|
64
|
+
notifyAll();
|
|
65
|
+
var fn = callbacksRef.current.onValuesChange;
|
|
66
|
+
if (fn) fn(null, valuesRef.current);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
var resetFields = function resetFields() {
|
|
70
|
+
valuesRef.current = Object.assign({}, initialValuesRef.current);
|
|
71
|
+
errorsRef.current = {};
|
|
72
|
+
notifyAll();
|
|
73
|
+
notifyAllErrors();
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
var getError = function getError(name) {
|
|
78
|
+
var key = toKey(name);
|
|
79
|
+
return errorsRef.current[key];
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
var setError = function setError(name, error) {
|
|
83
|
+
var key = toKey(name);
|
|
84
|
+
if (error) {
|
|
85
|
+
errorsRef.current[key] = error;
|
|
86
|
+
} else {
|
|
87
|
+
delete errorsRef.current[key];
|
|
88
|
+
}
|
|
89
|
+
notifyError(name);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
var clearErrors = function clearErrors() {
|
|
93
|
+
errorsRef.current = {};
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
var registerListener = function registerListener(name, cb) {
|
|
97
|
+
var key = toKey(name);
|
|
98
|
+
if (!listenersRef.current[key]) {
|
|
99
|
+
listenersRef.current[key] = [];
|
|
100
|
+
}
|
|
101
|
+
listenersRef.current[key].push(cb);
|
|
102
|
+
return function () {
|
|
103
|
+
listenersRef.current[key] = listenersRef.current[key].filter(function (fn) {return fn !== cb;});
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
var registerErrorListener = function registerErrorListener(name, cb) {
|
|
108
|
+
var key = toKey(name);
|
|
109
|
+
if (!errorListenersRef.current[key]) {
|
|
110
|
+
errorListenersRef.current[key] = [];
|
|
111
|
+
}
|
|
112
|
+
errorListenersRef.current[key].push(cb);
|
|
113
|
+
return function () {
|
|
114
|
+
errorListenersRef.current[key] = errorListenersRef.current[key].filter(function (fn) {return fn !== cb;});
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
var registerRules = function registerRules(name, rules) {var defaultTrigger = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'onSubmit';
|
|
119
|
+
if (!rules) return;
|
|
120
|
+
var key = toKey(name);
|
|
121
|
+
var rulesArray = normalizeRules(rules).map(function (rule) {return Object.assign({},
|
|
122
|
+
rule, {
|
|
123
|
+
trigger: rule.trigger || defaultTrigger });}
|
|
124
|
+
);
|
|
125
|
+
rulesRegistryRef.current.set(key, { path: name, rules: rulesArray });
|
|
126
|
+
return function () {return rulesRegistryRef.current.delete(key);};
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
var validateField = function () {var _ref4 = _asyncToGenerator(function* (name) {var trigger = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'onSubmit';
|
|
130
|
+
var key = toKey(name);
|
|
131
|
+
var entry = rulesRegistryRef.current.get(key);
|
|
132
|
+
if (!entry) return null;
|
|
133
|
+
|
|
134
|
+
var value = path(name, valuesRef.current);
|
|
135
|
+
var error = yield validateRules(value, entry.rules, trigger);
|
|
136
|
+
|
|
137
|
+
if (error) {
|
|
138
|
+
errorsRef.current[key] = error;
|
|
139
|
+
} else {
|
|
140
|
+
delete errorsRef.current[key];
|
|
141
|
+
}
|
|
142
|
+
notifyError(name);
|
|
143
|
+
return error;
|
|
144
|
+
});return function validateField(_x) {return _ref4.apply(this, arguments);};}();
|
|
145
|
+
|
|
146
|
+
var validateForm = function () {var _ref5 = _asyncToGenerator(function* () {
|
|
147
|
+
|
|
148
|
+
errorsRef.current = {};
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
var rulesErrors = yield validateAllFields(valuesRef.current, rulesRegistryRef.current);
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
var validate = callbacksRef.current.validate;
|
|
155
|
+
var legacyErrors = validate ? validate(valuesRef.current) || {} : {};
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
Object.entries(rulesErrors).forEach(function (_ref6) {var _ref7 = _slicedToArray(_ref6, 2),key = _ref7[0],error = _ref7[1];
|
|
159
|
+
errorsRef.current[key] = error;
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
Object.entries(legacyErrors).forEach(function (_ref8) {var _ref9 = _slicedToArray(_ref8, 2),key = _ref9[0],error = _ref9[1];
|
|
164
|
+
if (!errorsRef.current[key]) {
|
|
165
|
+
errorsRef.current[key] = error;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
rulesRegistryRef.current.forEach(function (_, key) {
|
|
171
|
+
notifyError(key);
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
return Object.keys(errorsRef.current).length === 0;
|
|
175
|
+
});return function validateForm() {return _ref5.apply(this, arguments);};}();
|
|
176
|
+
|
|
177
|
+
var validateFields = function () {var _ref0 = _asyncToGenerator(function* () {
|
|
178
|
+
var isValid = yield validateForm();
|
|
179
|
+
if (!isValid) return Promise.reject(errorsRef.current);
|
|
180
|
+
return Object.assign({}, valuesRef.current);
|
|
181
|
+
});return function validateFields() {return _ref0.apply(this, arguments);};}();
|
|
182
|
+
|
|
183
|
+
var handleSubmit = function () {var _ref1 = _asyncToGenerator(function* () {
|
|
184
|
+
var isValid = yield validateForm();
|
|
185
|
+
if (!isValid) return;
|
|
186
|
+
var onSubmit = callbacksRef.current.onSubmit;
|
|
187
|
+
if (onSubmit) onSubmit(Object.assign({}, valuesRef.current));
|
|
188
|
+
});return function handleSubmit() {return _ref1.apply(this, arguments);};}();
|
|
189
|
+
|
|
190
|
+
return {
|
|
191
|
+
setFieldValue: setFieldValue,
|
|
192
|
+
getFieldValue: getFieldValue,
|
|
193
|
+
getFieldsValue: getFieldsValue,
|
|
194
|
+
setFieldsValue: setFieldsValue,
|
|
195
|
+
resetFields: resetFields,
|
|
196
|
+
getError: getError,
|
|
197
|
+
setError: setError,
|
|
198
|
+
clearErrors: clearErrors,
|
|
199
|
+
registerListener: registerListener,
|
|
200
|
+
registerErrorListener: registerErrorListener,
|
|
201
|
+
registerRules: registerRules,
|
|
202
|
+
validateField: validateField,
|
|
203
|
+
validateFields: validateFields,
|
|
204
|
+
handleSubmit: handleSubmit,
|
|
205
|
+
valuesRef: valuesRef,
|
|
206
|
+
_callbacksRef: callbacksRef
|
|
207
|
+
};
|
|
208
|
+
}, []);
|
|
209
|
+
|
|
210
|
+
return formApi;
|
|
211
|
+
}
|
|
@@ -1 +1,70 @@
|
|
|
1
|
-
|
|
1
|
+
function _toConsumableArray(r) {return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();}function _nonIterableSpread() {throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArray(r) {if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);}function _arrayWithoutHoles(r) {if (Array.isArray(r)) return _arrayLikeToArray(r);}function _slicedToArray(r, e) {return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r, a) {if (r) {if ("string" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}function _iterableToArrayLimit(r, l) {var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];if (null != t) {var e,n,i,u,a = [],f = !0,o = !1;try {if (i = (t = t.call(r)).next, 0 === l) {if (Object(t) !== t) return;f = !1;} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);} catch (r) {o = !0, n = r;} finally {try {if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;} finally {if (o) throw n;}}return a;}}function _arrayWithHoles(r) {if (Array.isArray(r)) return r;}import React from 'react';
|
|
2
|
+
import { useFormInstance } from "./Form";
|
|
3
|
+
|
|
4
|
+
export function useWatch(name) {var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},form = _ref.form;
|
|
5
|
+
var contextForm = useFormInstance();
|
|
6
|
+
form = form || contextForm;
|
|
7
|
+
var _React$useState = React.useState(function () {var _form;return (_form = form) == null ? void 0 : _form.getFieldValue(name);}),_React$useState2 = _slicedToArray(_React$useState, 2),value = _React$useState2[0],setValue = _React$useState2[1];
|
|
8
|
+
|
|
9
|
+
React.useEffect(function () {
|
|
10
|
+
if (!form) {
|
|
11
|
+
console.error('No form provided to useWatch. Pass it as params or wrap it inside a <Form> component.');
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
setValue(form.getFieldValue(name));
|
|
16
|
+
|
|
17
|
+
var unsubscribe = form.registerListener(name, function (newValue) {
|
|
18
|
+
setValue(newValue);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
return unsubscribe;
|
|
22
|
+
}, [form, name]);
|
|
23
|
+
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function useWatchAll(form) {
|
|
28
|
+
var contextForm = useFormInstance();
|
|
29
|
+
form = form || contextForm;
|
|
30
|
+
var _React$useState3 = React.useState(function () {var _form2;return ((_form2 = form) == null ? void 0 : _form2.valuesRef.current) || {};}),_React$useState4 = _slicedToArray(_React$useState3, 2),values = _React$useState4[0],setValues = _React$useState4[1];
|
|
31
|
+
var watchedFieldsRef = React.useRef(new Set());
|
|
32
|
+
|
|
33
|
+
React.useEffect(function () {
|
|
34
|
+
if (!form) return;
|
|
35
|
+
|
|
36
|
+
setValues(Object.assign({}, form.valuesRef.current));
|
|
37
|
+
|
|
38
|
+
var checkForNewFields = function checkForNewFields() {
|
|
39
|
+
var currentFields = Object.keys(form.valuesRef.current);
|
|
40
|
+
var unsubscribers = [];
|
|
41
|
+
|
|
42
|
+
currentFields.forEach(function (field) {
|
|
43
|
+
if (!watchedFieldsRef.current.has(field)) {
|
|
44
|
+
watchedFieldsRef.current.add(field);
|
|
45
|
+
var unsub = form.registerListener(field, function () {
|
|
46
|
+
setValues(Object.assign({}, form.valuesRef.current));
|
|
47
|
+
});
|
|
48
|
+
unsubscribers.push(unsub);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
return unsubscribers;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
var unsubscribers = checkForNewFields();
|
|
56
|
+
|
|
57
|
+
var interval = setInterval(function () {
|
|
58
|
+
var newUnsubs = checkForNewFields();
|
|
59
|
+
unsubscribers.push.apply(unsubscribers, _toConsumableArray(newUnsubs));
|
|
60
|
+
}, 100);
|
|
61
|
+
|
|
62
|
+
return function () {
|
|
63
|
+
clearInterval(interval);
|
|
64
|
+
unsubscribers.forEach(function (unsub) {return unsub();});
|
|
65
|
+
watchedFieldsRef.current.clear();
|
|
66
|
+
};
|
|
67
|
+
}, [form]);
|
|
68
|
+
|
|
69
|
+
return values;
|
|
70
|
+
}
|
|
@@ -1 +1,20 @@
|
|
|
1
|
-
export var defaultMessages=
|
|
1
|
+
export var defaultMessages = {
|
|
2
|
+
required: 'This field is required',
|
|
3
|
+
type: {
|
|
4
|
+
email: 'Please enter a valid email address',
|
|
5
|
+
url: 'Please enter a valid URL',
|
|
6
|
+
number: 'Please enter a valid number',
|
|
7
|
+
integer: 'Please enter a valid integer'
|
|
8
|
+
},
|
|
9
|
+
min: {
|
|
10
|
+
string: function string(min) {return `Must be at least ${min} characters`;},
|
|
11
|
+
number: function number(min) {return `Must be at least ${min}`;},
|
|
12
|
+
array: function array(min) {return `Must have at least ${min} items`;}
|
|
13
|
+
},
|
|
14
|
+
max: {
|
|
15
|
+
string: function string(max) {return `Must be at most ${max} characters`;},
|
|
16
|
+
number: function number(max) {return `Must be at most ${max}`;},
|
|
17
|
+
array: function array(max) {return `Must have at most ${max} items`;}
|
|
18
|
+
},
|
|
19
|
+
pattern: 'Invalid format'
|
|
20
|
+
};
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
export{defaultMessages}from"./defaultMessages";
|
|
1
|
+
export { defaultMessages } from "./defaultMessages";
|
|
2
|
+
export { validators } from "./validators";
|
|
3
|
+
export { validateRules, validateAllFields } from "./validateRules";
|
|
4
|
+
export { normalizeRules } from "./normalizeRules";
|
|
5
|
+
export { shouldValidateOn } from "./shouldValidateOn";
|
|
@@ -1 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
function _defineProperty(e, r, t) {return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e;}function _toPropertyKey(t) {var i = _toPrimitive(t, "string");return "symbol" == typeof i ? i : i + "";}function _toPrimitive(t, r) {if ("object" != typeof t || !t) return t;var e = t[Symbol.toPrimitive];if (void 0 !== e) {var i = e.call(t, r || "default");if ("object" != typeof i) return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return ("string" === r ? String : Number)(t);}function _slicedToArray(r, e) {return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r, a) {if (r) {if ("string" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}function _iterableToArrayLimit(r, l) {var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];if (null != t) {var e,n,i,u,a = [],f = !0,o = !1;try {if (i = (t = t.call(r)).next, 0 === l) {if (Object(t) !== t) return;f = !1;} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);} catch (r) {o = !0, n = r;} finally {try {if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;} finally {if (o) throw n;}}return a;}}function _arrayWithHoles(r) {if (Array.isArray(r)) return r;}
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export function normalizeRules(rules) {
|
|
16
|
+
if (!rules) return [];
|
|
17
|
+
if (Array.isArray(rules)) return rules;
|
|
18
|
+
if (typeof rules === 'object') {
|
|
19
|
+
return Object.entries(rules).map(function (_ref) {var _ref2 = _slicedToArray(_ref, 2),key = _ref2[0],value = _ref2[1];return _defineProperty({}, key, value);});
|
|
20
|
+
}
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
@@ -1 +1,21 @@
|
|
|
1
|
-
import{normalizeRules}from"./normalizeRules";
|
|
1
|
+
import { normalizeRules } from "./normalizeRules";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export function shouldValidateOn(trigger, rules) {var validateTrigger = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'onSubmit';
|
|
11
|
+
if (!rules) return false;
|
|
12
|
+
|
|
13
|
+
var triggers = Array.isArray(validateTrigger) ? validateTrigger : [validateTrigger];
|
|
14
|
+
if (triggers.includes(trigger)) return true;
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var rulesArray = normalizeRules(rules);
|
|
18
|
+
return rulesArray.some(
|
|
19
|
+
function (rule) {return rule.trigger === trigger || Array.isArray(rule.trigger) && rule.trigger.includes(trigger);}
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -1 +1,83 @@
|
|
|
1
|
-
|
|
1
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {try {var i = n[a](c),u = i.value;} catch (n) {return void e(n);}i.done ? t(u) : Promise.resolve(u).then(r, o);}function _asyncToGenerator(n) {return function () {var t = this,e = arguments;return new Promise(function (r, o) {var a = n.apply(t, e);function _next(n) {asyncGeneratorStep(a, r, o, _next, _throw, "next", n);}function _throw(n) {asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);}_next(void 0);});};}import { path as getPath } from 'ramda';
|
|
2
|
+
import { validators } from "./validators";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
export function validateRules(_x, _x2) {return _validateRules.apply(this, arguments);}function _validateRules() {_validateRules = _asyncToGenerator(function* (value, rules) {var trigger = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'onSubmit';
|
|
12
|
+
if (!rules || rules.length === 0) return null;
|
|
13
|
+
|
|
14
|
+
for (var rule of rules) {
|
|
15
|
+
var ruleTrigger = rule.trigger || 'onSubmit';
|
|
16
|
+
var triggers = Array.isArray(ruleTrigger) ? ruleTrigger : [ruleTrigger];
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
if (trigger !== 'onSubmit' && !triggers.includes(trigger)) {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
var error = null;
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
if (rule.validator) {
|
|
27
|
+
try {
|
|
28
|
+
yield rule.validator(rule, value);
|
|
29
|
+
} catch (e) {
|
|
30
|
+
error = e.message || rule.message || 'Validation failed';
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
|
|
34
|
+
if (rule.required) {
|
|
35
|
+
error = validators.required(value, rule);
|
|
36
|
+
}
|
|
37
|
+
if (!error && rule.type) {
|
|
38
|
+
error = validators.type(value, rule);
|
|
39
|
+
}
|
|
40
|
+
if (!error && rule.min !== undefined) {
|
|
41
|
+
error = validators.min(value, rule);
|
|
42
|
+
}
|
|
43
|
+
if (!error && rule.max !== undefined) {
|
|
44
|
+
error = validators.max(value, rule);
|
|
45
|
+
}
|
|
46
|
+
if (!error && rule.pattern) {
|
|
47
|
+
error = validators.pattern(value, rule);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (error) {
|
|
52
|
+
return error;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return null;
|
|
57
|
+
});return _validateRules.apply(this, arguments);}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
export function validateAllFields(_x3, _x4) {return _validateAllFields.apply(this, arguments);}function _validateAllFields() {_validateAllFields = _asyncToGenerator(function* (values, rulesRegistry) {
|
|
66
|
+
var errors = {};
|
|
67
|
+
var validationPromises = [];
|
|
68
|
+
|
|
69
|
+
rulesRegistry.forEach(function (_ref, pathKey) {var path = _ref.path,rules = _ref.rules;
|
|
70
|
+
var value = getPath(path, values);
|
|
71
|
+
|
|
72
|
+
validationPromises.push(
|
|
73
|
+
validateRules(value, rules, 'onSubmit').then(function (error) {
|
|
74
|
+
if (error) {
|
|
75
|
+
errors[pathKey] = error;
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
yield Promise.all(validationPromises);
|
|
82
|
+
return errors;
|
|
83
|
+
});return _validateAllFields.apply(this, arguments);}
|
|
@@ -1 +1,82 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defaultMessages } from "./defaultMessages";
|
|
2
|
+
|
|
3
|
+
var isEmpty = function isEmpty(value) {
|
|
4
|
+
if (value === undefined || value === null) return true;
|
|
5
|
+
if (typeof value === 'string' && value.trim() === '') return true;
|
|
6
|
+
if (Array.isArray(value) && value.length === 0) return true;
|
|
7
|
+
return false;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export var validators = {
|
|
11
|
+
required: function required(value, rule) {
|
|
12
|
+
if (isEmpty(value)) {
|
|
13
|
+
return rule.message || defaultMessages.required;
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
type: function type(value, rule) {
|
|
19
|
+
if (isEmpty(value)) return null;
|
|
20
|
+
|
|
21
|
+
var typeValidators = {
|
|
22
|
+
email: function email(v) {return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(v);},
|
|
23
|
+
url: function url(v) {
|
|
24
|
+
try {
|
|
25
|
+
new URL(v);
|
|
26
|
+
return true;
|
|
27
|
+
} catch (_unused) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
number: function number(v) {return !isNaN(Number(v));},
|
|
32
|
+
integer: function integer(v) {return Number.isInteger(Number(v)) && !isNaN(Number(v));}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var validator = typeValidators[rule.type];
|
|
36
|
+
if (validator && !validator(value)) {
|
|
37
|
+
return rule.message || defaultMessages.type[rule.type] || `Invalid ${rule.type}`;
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
min: function min(value, rule) {
|
|
43
|
+
if (isEmpty(value)) return null;
|
|
44
|
+
|
|
45
|
+
if (typeof value === 'string' && value.length < rule.min) {
|
|
46
|
+
return rule.message || defaultMessages.min.string(rule.min);
|
|
47
|
+
}
|
|
48
|
+
if (typeof value === 'number' && value < rule.min) {
|
|
49
|
+
return rule.message || defaultMessages.min.number(rule.min);
|
|
50
|
+
}
|
|
51
|
+
if (Array.isArray(value) && value.length < rule.min) {
|
|
52
|
+
return rule.message || defaultMessages.min.array(rule.min);
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
max: function max(value, rule) {
|
|
58
|
+
if (isEmpty(value)) return null;
|
|
59
|
+
|
|
60
|
+
if (typeof value === 'string' && value.length > rule.max) {
|
|
61
|
+
return rule.message || defaultMessages.max.string(rule.max);
|
|
62
|
+
}
|
|
63
|
+
if (typeof value === 'number' && value > rule.max) {
|
|
64
|
+
return rule.message || defaultMessages.max.number(rule.max);
|
|
65
|
+
}
|
|
66
|
+
if (Array.isArray(value) && value.length > rule.max) {
|
|
67
|
+
return rule.message || defaultMessages.max.array(rule.max);
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
pattern: function pattern(value, rule) {
|
|
73
|
+
if (isEmpty(value)) return null;
|
|
74
|
+
|
|
75
|
+
var regex = rule.pattern instanceof RegExp ? rule.pattern : new RegExp(rule.pattern);
|
|
76
|
+
|
|
77
|
+
if (!regex.test(String(value))) {
|
|
78
|
+
return rule.message || defaultMessages.pattern;
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/helpers/ConditionalLazyRender.js";var _excluded = ["children"];function _objectWithoutProperties(e, t) {if (null == e) return {};var o,r,i = _objectWithoutPropertiesLoose(e, t);if (Object.getOwnPropertySymbols) {var n = Object.getOwnPropertySymbols(e);for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);}return i;}function _objectWithoutPropertiesLoose(r, e) {if (null == r) return {};var t = {};for (var n in r) if ({}.hasOwnProperty.call(r, n)) {if (-1 !== e.indexOf(n)) continue;t[n] = r[n];}return t;}import { LazyRender } from "./LazyRender";import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
export function ConditionalLazyRender(_ref) {var children = _ref.children,props = _objectWithoutProperties(_ref, _excluded);
|
|
4
|
+
if (!props.delay && !props.whenVisible && !props.destroyOffScreen) return children;
|
|
5
|
+
return _jsx(LazyRender, Object.assign({}, props, { children: children }));
|
|
6
|
+
}
|
|
@@ -1 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
var _jsxFileName = "/Users/christianstorch/Apps/nekoapps/libs/neko-ui/src/components/helpers/LazyAction.js";var _excluded = ["children", "disabled", "action", "minHeight"];function _objectWithoutProperties(e, t) {if (null == e) return {};var o,r,i = _objectWithoutPropertiesLoose(e, t);if (Object.getOwnPropertySymbols) {var n = Object.getOwnPropertySymbols(e);for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);}return i;}function _objectWithoutPropertiesLoose(r, e) {if (null == r) return {};var t = {};for (var n in r) if ({}.hasOwnProperty.call(r, n)) {if (-1 !== e.indexOf(n)) continue;t[n] = r[n];}return t;}import { is } from 'ramda';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import { LazyRender } from "./LazyRender";import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
function InnerContent(_ref) {var action = _ref.action;
|
|
7
|
+
React.useEffect(function () {
|
|
8
|
+
action == null ? void 0 : action();
|
|
9
|
+
}, []);
|
|
10
|
+
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function LazyAction(_ref2) {var children = _ref2.children,disabled = _ref2.disabled,action = _ref2.action,initMinHeight = _ref2.minHeight,props = _objectWithoutProperties(_ref2, _excluded);
|
|
15
|
+
if (!action || !is(Function, action) || !!disabled) return false;
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
_jsx(LazyRender, Object.assign({ whenVisible: true, minHeight: 2 }, props, { children:
|
|
19
|
+
_jsx(InnerContent, { action: action }) })
|
|
20
|
+
));
|
|
21
|
+
|
|
22
|
+
}
|