@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
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { path } from 'ramda'
|
|
3
|
+
|
|
4
|
+
import { Button } from '../actions/Button'
|
|
5
|
+
import { LinkInput } from '../inputs/LinkInput'
|
|
6
|
+
import { Popover } from '../structure/popover/Popover'
|
|
7
|
+
import { View } from '../structure/View'
|
|
8
|
+
import { useFilter } from './FilterHandler'
|
|
9
|
+
import { useFilterPath } from './FilterGroup'
|
|
10
|
+
|
|
11
|
+
function autoFormat(value) {
|
|
12
|
+
if (value == null) return undefined
|
|
13
|
+
|
|
14
|
+
if ('min' in value || 'max' in value) {
|
|
15
|
+
const { min, max } = value
|
|
16
|
+
if (min != null && max != null) return `${min} – ${max}`
|
|
17
|
+
if (min != null) return `≥ ${min}`
|
|
18
|
+
if (max != null) return `≤ ${max}`
|
|
19
|
+
return undefined
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if ('start' in value || 'end' in value) {
|
|
23
|
+
const fmt = 'YYYY-MM-DD'
|
|
24
|
+
const s = value.start?.format?.(fmt) || value.start
|
|
25
|
+
const e = value.end?.format?.(fmt) || value.end
|
|
26
|
+
if (s && e) return `${s} – ${e}`
|
|
27
|
+
if (s) return `${s} →`
|
|
28
|
+
if (e) return `→ ${e}`
|
|
29
|
+
return undefined
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return String(value)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function PopoverFilterContent({ value, onApply, submitOnClose, children, onClose }) {
|
|
36
|
+
const [local, setLocal] = React.useState(value)
|
|
37
|
+
const localRef = React.useRef(local)
|
|
38
|
+
localRef.current = local
|
|
39
|
+
|
|
40
|
+
React.useEffect(() => {
|
|
41
|
+
if (!submitOnClose) return
|
|
42
|
+
return () => onApply(localRef.current)
|
|
43
|
+
}, [])
|
|
44
|
+
|
|
45
|
+
const handleApply = () => {
|
|
46
|
+
onApply(local)
|
|
47
|
+
onClose()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<View gap="sm">
|
|
52
|
+
{typeof children === 'function'
|
|
53
|
+
? children({ value: local, onChange: setLocal })
|
|
54
|
+
: React.cloneElement(React.Children.only(children), { value: local, onChange: setLocal })}
|
|
55
|
+
<View row toRight>
|
|
56
|
+
<Button label="Apply" onPress={handleApply} xs />
|
|
57
|
+
</View>
|
|
58
|
+
</View>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function PopoverFilterItem({ name, label, placeholder, children, submitOnClose, popoverProps, formatValue, ...props }) {
|
|
63
|
+
const { filters, onChangeFilter } = useFilter()
|
|
64
|
+
const listPath = useFilterPath(name)
|
|
65
|
+
const value = path(listPath, filters)
|
|
66
|
+
|
|
67
|
+
const displayText = value != null ? (formatValue?.(value) ?? autoFormat(value)) : undefined
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<Popover
|
|
71
|
+
trigger="click"
|
|
72
|
+
placement="bottomLeft"
|
|
73
|
+
unmountOnClose
|
|
74
|
+
{...popoverProps}
|
|
75
|
+
renderContent={({ onClose }) => (
|
|
76
|
+
<PopoverFilterContent value={value} onApply={(val) => onChangeFilter(listPath, val)} submitOnClose={submitOnClose} onClose={onClose}>
|
|
77
|
+
{children}
|
|
78
|
+
</PopoverFilterContent>
|
|
79
|
+
)}
|
|
80
|
+
>
|
|
81
|
+
<LinkInput value={displayText} placeholder={placeholder || label} suffixIcon="arrow-down-s-fill" suffixIconColor="text4" {...props} />
|
|
82
|
+
</Popover>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { Icon } from '../presentation'
|
|
4
|
+
import { Link } from '../actions'
|
|
5
|
+
import { TextInput } from '../inputs'
|
|
6
|
+
import { useFilter } from './FilterHandler'
|
|
7
|
+
|
|
8
|
+
export function SearchInput({ value: valueProp, onChange: onChangeProp, placeholder = 'Search...', ...rest }) {
|
|
9
|
+
const filter = useFilter()
|
|
10
|
+
|
|
11
|
+
const value = valueProp ?? filter.search
|
|
12
|
+
const onChange = onChangeProp ?? filter.onChangeSearch
|
|
13
|
+
|
|
14
|
+
const [local, setLocal] = React.useState(value || '')
|
|
15
|
+
|
|
16
|
+
React.useEffect(() => {
|
|
17
|
+
setLocal(value || '')
|
|
18
|
+
}, [value])
|
|
19
|
+
|
|
20
|
+
const push = () => {
|
|
21
|
+
onChange?.(local)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const clear = () => {
|
|
25
|
+
setLocal('')
|
|
26
|
+
onChange?.('')
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const suffix = !!local && (
|
|
30
|
+
<Link onPress={clear}>
|
|
31
|
+
<Icon name="close-line" />
|
|
32
|
+
</Link>
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<TextInput
|
|
37
|
+
prefixIcon="search-line"
|
|
38
|
+
prefixIconColor="text4"
|
|
39
|
+
placeholder={placeholder}
|
|
40
|
+
value={local}
|
|
41
|
+
onChange={setLocal}
|
|
42
|
+
onBlur={push}
|
|
43
|
+
onKeyDown={(e) => e.key === 'Enter' && push()}
|
|
44
|
+
onSubmitEditing={push}
|
|
45
|
+
suffix={suffix}
|
|
46
|
+
{...rest}
|
|
47
|
+
/>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
@@ -9,14 +9,20 @@ export const useFormState = () => React.useContext(FormContext)
|
|
|
9
9
|
export const useFormInstance = () => useFormState()?.form
|
|
10
10
|
export const useForm = useFormInstance
|
|
11
11
|
|
|
12
|
-
export function Form({ form, onSubmit, initialValues, children, loading, disabled, ...props }) {
|
|
13
|
-
const defaultForm = useNewForm({ onSubmit, initialValues })
|
|
12
|
+
export function Form({ form, onSubmit, onValuesChange, initialValues, children, loading, disabled, ...props }) {
|
|
13
|
+
const defaultForm = useNewForm({ onSubmit, onValuesChange, initialValues })
|
|
14
14
|
form = form || defaultForm
|
|
15
15
|
|
|
16
|
+
// Keep external form's callbacks in sync with Form props
|
|
17
|
+
if (form._callbacksRef) {
|
|
18
|
+
if (onSubmit) form._callbacksRef.current.onSubmit = onSubmit
|
|
19
|
+
if (onValuesChange) form._callbacksRef.current.onValuesChange = onValuesChange
|
|
20
|
+
}
|
|
21
|
+
|
|
16
22
|
return (
|
|
17
23
|
<FormContext.Provider value={{ loading, disabled, form }}>
|
|
18
24
|
<LoadingView active={loading} noWrapper>
|
|
19
|
-
<FormWrapperComponent form={form} gap="md" {...props}>
|
|
25
|
+
<FormWrapperComponent form={form} onSubmit={onSubmit} gap="md" {...props}>
|
|
20
26
|
{children}
|
|
21
27
|
</FormWrapperComponent>
|
|
22
28
|
</LoadingView>
|
|
@@ -15,6 +15,11 @@ export function FormItem({
|
|
|
15
15
|
useDefaultValue,
|
|
16
16
|
rules,
|
|
17
17
|
validateTrigger = 'onSubmit',
|
|
18
|
+
hidden,
|
|
19
|
+
valuePropName,
|
|
20
|
+
initialValue,
|
|
21
|
+
extra,
|
|
22
|
+
noStyle,
|
|
18
23
|
...props
|
|
19
24
|
}) {
|
|
20
25
|
const form = useFormInstance()
|
|
@@ -24,6 +29,13 @@ export function FormItem({
|
|
|
24
29
|
const [value, setValue] = React.useState(form.getFieldValue(listPath))
|
|
25
30
|
const [error, setError] = React.useState(form.getError(listPath))
|
|
26
31
|
|
|
32
|
+
// Set initial value on mount if provided and field has no value
|
|
33
|
+
React.useEffect(() => {
|
|
34
|
+
if (initialValue !== undefined && form.getFieldValue(listPath) === undefined) {
|
|
35
|
+
form.setFieldValue(listPath, initialValue)
|
|
36
|
+
}
|
|
37
|
+
}, [listPathStr])
|
|
38
|
+
|
|
27
39
|
// Register rules with the form
|
|
28
40
|
React.useEffect(() => {
|
|
29
41
|
return form.registerRules(listPath, rules, validateTrigger)
|
|
@@ -56,7 +68,7 @@ export function FormItem({
|
|
|
56
68
|
}
|
|
57
69
|
}
|
|
58
70
|
|
|
59
|
-
let valueKey = 'value'
|
|
71
|
+
let valueKey = valuePropName || 'value'
|
|
60
72
|
if (!!useDefaultValue) valueKey = 'defaultValue'
|
|
61
73
|
|
|
62
74
|
const child = typeof children === 'function' ? null : React.Children.only(children)
|
|
@@ -77,6 +89,18 @@ export function FormItem({
|
|
|
77
89
|
content = React.cloneElement(child, { ...child.props, ...childProps })
|
|
78
90
|
}
|
|
79
91
|
|
|
92
|
+
if (hidden) {
|
|
93
|
+
return (
|
|
94
|
+
<FormGroup name={listPath}>
|
|
95
|
+
<View hidden>{content}</View>
|
|
96
|
+
</FormGroup>
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (noStyle) {
|
|
101
|
+
return <FormGroup name={listPath}>{content}</FormGroup>
|
|
102
|
+
}
|
|
103
|
+
|
|
80
104
|
return (
|
|
81
105
|
<FormGroup name={listPath}>
|
|
82
106
|
<View {...props}>
|
|
@@ -87,6 +111,7 @@ export function FormItem({
|
|
|
87
111
|
)}
|
|
88
112
|
{content}
|
|
89
113
|
{error && <Text color="red">{error}</Text>}
|
|
114
|
+
{extra && <View marginT="xxs">{extra}</View>}
|
|
90
115
|
</View>
|
|
91
116
|
</FormGroup>
|
|
92
117
|
)
|
|
@@ -12,7 +12,7 @@ import { usePositionModifier } from '../../modifiers/position'
|
|
|
12
12
|
import { useShadowModifier } from '../../modifiers/shadow'
|
|
13
13
|
import { useSizeModifier } from '../../modifiers/size'
|
|
14
14
|
|
|
15
|
-
export function FormWrapperComponent({ children, form, ...rootProps }) {
|
|
15
|
+
export function FormWrapperComponent({ children, form, onSubmit, ...rootProps }) {
|
|
16
16
|
const formState = useFormState()
|
|
17
17
|
const [_, props] = pipe(
|
|
18
18
|
useDisplayModifier, //
|
|
@@ -28,10 +28,19 @@ export function FormWrapperComponent({ children, form, ...rootProps }) {
|
|
|
28
28
|
useShadowModifier
|
|
29
29
|
)([{}, rootProps])
|
|
30
30
|
|
|
31
|
-
const handleSubmit = (e) => {
|
|
31
|
+
const handleSubmit = async (e) => {
|
|
32
32
|
e.preventDefault()
|
|
33
33
|
if (formState?.loading || formState?.disabled) return
|
|
34
|
-
|
|
34
|
+
if (onSubmit) {
|
|
35
|
+
try {
|
|
36
|
+
const values = await form.validateFields()
|
|
37
|
+
onSubmit(values)
|
|
38
|
+
} catch (e) {
|
|
39
|
+
// Validation failed, errors already set on fields
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
form.handleSubmit()
|
|
43
|
+
}
|
|
35
44
|
}
|
|
36
45
|
|
|
37
46
|
return (
|
|
@@ -2,12 +2,16 @@ import { assocPath, path } from 'ramda'
|
|
|
2
2
|
import React from 'react'
|
|
3
3
|
import { validateRules, validateAllFields, normalizeRules } from './validation'
|
|
4
4
|
|
|
5
|
-
export function useNewForm({ initialValues = {}, validate, onSubmit } = {}) {
|
|
5
|
+
export function useNewForm({ initialValues = {}, validate, onSubmit, onValuesChange } = {}) {
|
|
6
6
|
const valuesRef = React.useRef({ ...initialValues })
|
|
7
|
+
const initialValuesRef = React.useRef({ ...initialValues })
|
|
7
8
|
const errorsRef = React.useRef({}) // Flat structure: { 'users': 'error', 'users.0.name': 'error' }
|
|
8
9
|
const listenersRef = React.useRef({})
|
|
9
10
|
const errorListenersRef = React.useRef({})
|
|
10
11
|
const rulesRegistryRef = React.useRef(new Map())
|
|
12
|
+
const callbacksRef = React.useRef({ onSubmit, validate, onValuesChange })
|
|
13
|
+
|
|
14
|
+
callbacksRef.current = { onSubmit, validate, onValuesChange }
|
|
11
15
|
|
|
12
16
|
const formApi = React.useMemo(() => {
|
|
13
17
|
const toKey = (name) => (Array.isArray(name) ? name.join('.') : name)
|
|
@@ -20,6 +24,14 @@ export function useNewForm({ initialValues = {}, validate, onSubmit } = {}) {
|
|
|
20
24
|
}
|
|
21
25
|
}
|
|
22
26
|
|
|
27
|
+
const notifyAll = () => {
|
|
28
|
+
Object.keys(listenersRef.current).forEach((key) => {
|
|
29
|
+
const keyPath = key.split('.')
|
|
30
|
+
const value = path(keyPath, valuesRef.current)
|
|
31
|
+
listenersRef.current[key]?.forEach((cb) => cb(value))
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
|
|
23
35
|
const notifyError = (name) => {
|
|
24
36
|
const key = toKey(name)
|
|
25
37
|
if (errorListenersRef.current[key]) {
|
|
@@ -27,13 +39,40 @@ export function useNewForm({ initialValues = {}, validate, onSubmit } = {}) {
|
|
|
27
39
|
}
|
|
28
40
|
}
|
|
29
41
|
|
|
42
|
+
const notifyAllErrors = () => {
|
|
43
|
+
Object.keys(errorListenersRef.current).forEach((key) => {
|
|
44
|
+
errorListenersRef.current[key]?.forEach((cb) => cb(errorsRef.current[key]))
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
|
|
30
48
|
const setFieldValue = (name, value) => {
|
|
31
49
|
valuesRef.current = assocPath(toPath(name), value, valuesRef.current)
|
|
32
50
|
notify(name)
|
|
51
|
+
const fn = callbacksRef.current.onValuesChange
|
|
52
|
+
if (fn) fn(name, valuesRef.current)
|
|
33
53
|
}
|
|
34
54
|
|
|
35
55
|
const getFieldValue = (name) => path(toPath(name), valuesRef.current)
|
|
36
56
|
|
|
57
|
+
const getFieldsValue = () => ({ ...valuesRef.current })
|
|
58
|
+
|
|
59
|
+
const setFieldsValue = (obj) => {
|
|
60
|
+
if (!obj) return
|
|
61
|
+
Object.entries(obj).forEach(([key, value]) => {
|
|
62
|
+
valuesRef.current = assocPath(toPath(key), value, valuesRef.current)
|
|
63
|
+
})
|
|
64
|
+
notifyAll()
|
|
65
|
+
const fn = callbacksRef.current.onValuesChange
|
|
66
|
+
if (fn) fn(null, valuesRef.current)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const resetFields = () => {
|
|
70
|
+
valuesRef.current = { ...initialValuesRef.current }
|
|
71
|
+
errorsRef.current = {}
|
|
72
|
+
notifyAll()
|
|
73
|
+
notifyAllErrors()
|
|
74
|
+
}
|
|
75
|
+
|
|
37
76
|
// Flat error lookup by key
|
|
38
77
|
const getError = (name) => {
|
|
39
78
|
const key = toKey(name)
|
|
@@ -112,6 +151,7 @@ export function useNewForm({ initialValues = {}, validate, onSubmit } = {}) {
|
|
|
112
151
|
const rulesErrors = await validateAllFields(valuesRef.current, rulesRegistryRef.current)
|
|
113
152
|
|
|
114
153
|
// Run legacy validate function if provided
|
|
154
|
+
const { validate } = callbacksRef.current
|
|
115
155
|
const legacyErrors = validate ? validate(valuesRef.current) || {} : {}
|
|
116
156
|
|
|
117
157
|
// Store errors in flat structure
|
|
@@ -134,16 +174,25 @@ export function useNewForm({ initialValues = {}, validate, onSubmit } = {}) {
|
|
|
134
174
|
return Object.keys(errorsRef.current).length === 0
|
|
135
175
|
}
|
|
136
176
|
|
|
177
|
+
const validateFields = async () => {
|
|
178
|
+
const isValid = await validateForm()
|
|
179
|
+
if (!isValid) return Promise.reject(errorsRef.current)
|
|
180
|
+
return { ...valuesRef.current }
|
|
181
|
+
}
|
|
182
|
+
|
|
137
183
|
const handleSubmit = async () => {
|
|
138
184
|
const isValid = await validateForm()
|
|
139
185
|
if (!isValid) return
|
|
140
|
-
|
|
141
|
-
onSubmit(valuesRef.current)
|
|
186
|
+
const { onSubmit } = callbacksRef.current
|
|
187
|
+
if (onSubmit) onSubmit({ ...valuesRef.current })
|
|
142
188
|
}
|
|
143
189
|
|
|
144
190
|
return {
|
|
145
191
|
setFieldValue,
|
|
146
192
|
getFieldValue,
|
|
193
|
+
getFieldsValue,
|
|
194
|
+
setFieldsValue,
|
|
195
|
+
resetFields,
|
|
147
196
|
getError,
|
|
148
197
|
setError,
|
|
149
198
|
clearErrors,
|
|
@@ -151,10 +200,12 @@ export function useNewForm({ initialValues = {}, validate, onSubmit } = {}) {
|
|
|
151
200
|
registerErrorListener,
|
|
152
201
|
registerRules,
|
|
153
202
|
validateField,
|
|
203
|
+
validateFields,
|
|
154
204
|
handleSubmit,
|
|
155
205
|
valuesRef,
|
|
206
|
+
_callbacksRef: callbacksRef,
|
|
156
207
|
}
|
|
157
|
-
}, [
|
|
208
|
+
}, [])
|
|
158
209
|
|
|
159
210
|
return formApi
|
|
160
211
|
}
|
|
@@ -11,12 +11,19 @@ import { useSizeConverter } from '../../modifiers/sizeConverter'
|
|
|
11
11
|
import { useSizeModifier } from '../../modifiers/size'
|
|
12
12
|
import { useThemeComponentModifier } from '../../modifiers/themeComponent'
|
|
13
13
|
|
|
14
|
-
const DEFAULT_PROPS = ([{ size, sizeCode }, { line }]) =>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
})
|
|
14
|
+
const DEFAULT_PROPS = ([{ size, sizeCode }, { line, vertical }]) => {
|
|
15
|
+
const lineSize = is(Number, line) ? line : 1
|
|
16
|
+
return {
|
|
17
|
+
...(vertical
|
|
18
|
+
? { width: !!line ? 2 * size : size, fullH: true, row: true }
|
|
19
|
+
: { height: !!line ? 2 * size : size, fullW: true }),
|
|
20
|
+
br: sizeCode,
|
|
21
|
+
center: true,
|
|
22
|
+
lineProps: vertical
|
|
23
|
+
? { width: lineSize, fullH: true, br: lineSize }
|
|
24
|
+
: { height: lineSize, fullW: true, br: lineSize },
|
|
25
|
+
}
|
|
26
|
+
}
|
|
20
27
|
|
|
21
28
|
export function Separator(rootProps) {
|
|
22
29
|
const [{ color }, formattedProps] = pipe(
|
|
@@ -30,14 +37,11 @@ export function Separator(rootProps) {
|
|
|
30
37
|
useFlexWrapperModifier
|
|
31
38
|
)([{}, rootProps])
|
|
32
39
|
|
|
33
|
-
const { line, lineProps, ...props } = formattedProps
|
|
34
|
-
const lineHeight = is(Number, line) ? line : 1
|
|
40
|
+
const { line, vertical, lineProps, ...props } = formattedProps
|
|
35
41
|
|
|
36
42
|
return (
|
|
37
43
|
<AbsView className="neko-separator" {...props}>
|
|
38
|
-
{!!line &&
|
|
39
|
-
<View bg={color} br={lineHeight} height={lineHeight} fullW className="neko-separator-line" {...lineProps} />
|
|
40
|
-
)}
|
|
44
|
+
{!!line && <View bg={color} className="neko-separator-line" {...lineProps} />}
|
|
41
45
|
</AbsView>
|
|
42
46
|
)
|
|
43
47
|
}
|
package/src/components/index.js
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Select } from './Select'
|
|
2
|
+
|
|
3
|
+
export function BooleanSelect({ trueLabel = 'True', falseLabel = 'False', placeholder, ...props }) {
|
|
4
|
+
return (
|
|
5
|
+
<Select
|
|
6
|
+
placeholder={placeholder}
|
|
7
|
+
options={[
|
|
8
|
+
{ label: trueLabel, value: true },
|
|
9
|
+
{ label: falseLabel, value: false },
|
|
10
|
+
]}
|
|
11
|
+
{...props}
|
|
12
|
+
/>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
@@ -47,6 +47,7 @@ export function DateInput({
|
|
|
47
47
|
placement,
|
|
48
48
|
type = 'day',
|
|
49
49
|
format,
|
|
50
|
+
startsOpen,
|
|
50
51
|
useBottomDrawer = { native: true, sm: true, md: true },
|
|
51
52
|
...props
|
|
52
53
|
}) {
|
|
@@ -88,13 +89,14 @@ export function DateInput({
|
|
|
88
89
|
return (
|
|
89
90
|
<Popover
|
|
90
91
|
trigger="click"
|
|
92
|
+
startsOpen={startsOpen}
|
|
91
93
|
placement={placement || 'bottomLeft'}
|
|
92
94
|
snapPoints={[350]}
|
|
93
95
|
useBottomDrawer={useBottomDrawer}
|
|
94
96
|
bottomDrawerProps={{ contentProps: { padding: 'md' } }}
|
|
95
97
|
watch={[value?.format?.('YYYYMMDD')]}
|
|
96
98
|
renderContent={({ onClose }) => (
|
|
97
|
-
<View flex centerH>
|
|
99
|
+
<View flex centerH onMouseDown={(e) => e.preventDefault()}>
|
|
98
100
|
<DatePicker
|
|
99
101
|
value={value}
|
|
100
102
|
onChange={(v) => {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { DateInput } from './DateInput'
|
|
2
|
+
import { Text } from '../text/Text'
|
|
3
|
+
import { View } from '../structure/View'
|
|
4
|
+
|
|
5
|
+
export function DateRangeInput({
|
|
6
|
+
value,
|
|
7
|
+
onChange,
|
|
8
|
+
startProps,
|
|
9
|
+
endProps,
|
|
10
|
+
placeholderStart = 'Start',
|
|
11
|
+
placeholderEnd = 'End',
|
|
12
|
+
separator = '–',
|
|
13
|
+
...props
|
|
14
|
+
}) {
|
|
15
|
+
const handleChangeStart = (start) => onChange?.({ ...value, start })
|
|
16
|
+
const handleChangeEnd = (end) => onChange?.({ ...value, end })
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<View row centerV gap="sm">
|
|
20
|
+
<DateInput
|
|
21
|
+
placeholder={placeholderStart}
|
|
22
|
+
value={value?.start}
|
|
23
|
+
onChange={handleChangeStart}
|
|
24
|
+
max={value?.end}
|
|
25
|
+
flex
|
|
26
|
+
{...props}
|
|
27
|
+
{...startProps}
|
|
28
|
+
/>
|
|
29
|
+
<Text text4>{separator}</Text>
|
|
30
|
+
<DateInput
|
|
31
|
+
placeholder={placeholderEnd}
|
|
32
|
+
value={value?.end}
|
|
33
|
+
onChange={handleChangeEnd}
|
|
34
|
+
min={value?.start}
|
|
35
|
+
flex
|
|
36
|
+
{...props}
|
|
37
|
+
{...endProps}
|
|
38
|
+
/>
|
|
39
|
+
</View>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { isEmpty } from 'ramda'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import { Icon } from '../presentation/Icon'
|
|
5
|
+
import { IconLabel } from '../presentation/IconLabel'
|
|
6
|
+
import { Loading } from '../state/Loading'
|
|
7
|
+
import { Text } from '../text/Text'
|
|
8
|
+
import { TextInput } from './TextInput'
|
|
9
|
+
import { View } from '../structure/View'
|
|
10
|
+
|
|
11
|
+
function getInputValue(e) {
|
|
12
|
+
return e?.target?.value !== undefined ? e.target.value : e
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function hasValue(v) {
|
|
16
|
+
return v !== undefined && v !== null && !isEmpty(v)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function EditableInput({
|
|
20
|
+
Input,
|
|
21
|
+
renderInput,
|
|
22
|
+
onChange,
|
|
23
|
+
onClose,
|
|
24
|
+
onSubmit,
|
|
25
|
+
submitOnChange,
|
|
26
|
+
submitWhenHasNoValue,
|
|
27
|
+
disableCloseOnBlur,
|
|
28
|
+
alwaysEditing,
|
|
29
|
+
...props
|
|
30
|
+
}) {
|
|
31
|
+
const initialValue = props.value || props.defaultValue
|
|
32
|
+
const [value, setValue] = React.useState(initialValue)
|
|
33
|
+
Input = Input || TextInput
|
|
34
|
+
|
|
35
|
+
const submit = (val) => {
|
|
36
|
+
const inputHasValue = hasValue(val)
|
|
37
|
+
const shouldSubmit = submitWhenHasNoValue || inputHasValue
|
|
38
|
+
const hasChangedTheValue = val !== initialValue
|
|
39
|
+
if (shouldSubmit && hasChangedTheValue) {
|
|
40
|
+
onSubmit && onSubmit(val)
|
|
41
|
+
}
|
|
42
|
+
onClose()
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const handleSubmit = (e) => submit(getInputValue(e))
|
|
46
|
+
|
|
47
|
+
const handleChange = (e) => {
|
|
48
|
+
const inputValue = getInputValue(e)
|
|
49
|
+
setValue(inputValue)
|
|
50
|
+
onChange && onChange(inputValue)
|
|
51
|
+
if (submitOnChange) submit(inputValue)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const { value: _, defaultValue: __, ...inputProps } = props
|
|
55
|
+
|
|
56
|
+
if (!!renderInput) {
|
|
57
|
+
return renderInput({ handleSubmit, handleChange, value, ...inputProps })
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<Input
|
|
62
|
+
startsOpen
|
|
63
|
+
sm
|
|
64
|
+
value={value}
|
|
65
|
+
onChange={handleChange}
|
|
66
|
+
onKeyDown={(e) => {
|
|
67
|
+
if (e.key === 'Enter' && !e.shiftKey) {
|
|
68
|
+
e.preventDefault()
|
|
69
|
+
handleSubmit(e)
|
|
70
|
+
}
|
|
71
|
+
}}
|
|
72
|
+
onBlur={!disableCloseOnBlur && !alwaysEditing ? () => submit(value) : undefined}
|
|
73
|
+
onOpenChange={(open) => !open && !alwaysEditing && submit(value)}
|
|
74
|
+
onOk={() => submit(value)}
|
|
75
|
+
{...inputProps}
|
|
76
|
+
/>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function Editable({ children, hidden, disabled, visibleIcon, emptyLabel, emptyIcon, loading, ...props }) {
|
|
81
|
+
const [isEditing, setIsEditing] = React.useState(false)
|
|
82
|
+
const [hovered, setHovered] = React.useState(false)
|
|
83
|
+
|
|
84
|
+
if (!!props.alwaysEditing || isEditing) {
|
|
85
|
+
return (
|
|
86
|
+
<EditableInput
|
|
87
|
+
disabled={disabled}
|
|
88
|
+
autoFocus={!props.alwaysEditing}
|
|
89
|
+
onClose={() => setIsEditing(false)}
|
|
90
|
+
{...props}
|
|
91
|
+
/>
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (disabled) return children
|
|
96
|
+
if (loading) return <Loading />
|
|
97
|
+
|
|
98
|
+
const hasAnyValue = hasValue(props.value || props.defaultValue)
|
|
99
|
+
const showEmptyLabel = emptyLabel && !hasAnyValue
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<View
|
|
103
|
+
row
|
|
104
|
+
centerV
|
|
105
|
+
gap={!hidden ? 1 : 0}
|
|
106
|
+
pointer
|
|
107
|
+
border={!hidden ? 1 : 0}
|
|
108
|
+
borderStyle="dashed"
|
|
109
|
+
borderColor={hovered && !hidden ? 'divider' : 'transparent'}
|
|
110
|
+
br={!hidden ? 'xxs' : undefined}
|
|
111
|
+
onClick={() => {
|
|
112
|
+
setIsEditing(true)
|
|
113
|
+
setHovered(false)
|
|
114
|
+
}}
|
|
115
|
+
onMouseEnter={() => setHovered(true)}
|
|
116
|
+
onMouseLeave={() => setHovered(false)}
|
|
117
|
+
>
|
|
118
|
+
<View flex minHeight={17} maxWidth="100%">
|
|
119
|
+
{hovered && !hasAnyValue && props.placeholder && <Text color="text4">{props.placeholder}</Text>}
|
|
120
|
+
{showEmptyLabel ? <IconLabel icon={emptyIcon} label={emptyLabel} color="text4" /> : children}
|
|
121
|
+
</View>
|
|
122
|
+
{!hidden && (visibleIcon || hovered) && (
|
|
123
|
+
<View>
|
|
124
|
+
<Icon name="RiEditLine" text4 />
|
|
125
|
+
</View>
|
|
126
|
+
)}
|
|
127
|
+
</View>
|
|
128
|
+
)
|
|
129
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Select } from './Select'
|
|
2
|
+
|
|
3
|
+
export function EnabledSelect({ enabledLabel = 'Enabled', disabledLabel = 'Disabled', placeholder, ...props }) {
|
|
4
|
+
return (
|
|
5
|
+
<Select
|
|
6
|
+
placeholder={placeholder}
|
|
7
|
+
options={[
|
|
8
|
+
{ label: enabledLabel, value: false },
|
|
9
|
+
{ label: disabledLabel, value: true },
|
|
10
|
+
]}
|
|
11
|
+
{...props}
|
|
12
|
+
/>
|
|
13
|
+
)
|
|
14
|
+
}
|