@redneckz/wildless-cms-uni-blocks 0.14.594 → 0.14.596
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/bundle/EventBus/EventBus.d.ts +17 -4
- package/bundle/EventBus/defaultEventBus.d.ts +2 -13
- package/bundle/EventBus/useSubject.d.ts +2 -0
- package/bundle/EventBus/useSubjectState.d.ts +2 -0
- package/bundle/bundle.umd.js +148 -105
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/CarouselTariffsCard/CardCellsSection.d.ts +9 -0
- package/bundle/components/CarouselTariffsCard/carouselTariffsCardEventBus.d.ts +9 -0
- package/bundle/hooks/useLocation.d.ts +2 -1
- package/bundle/hooks/useReducer.d.ts +4 -0
- package/bundle/model/DefaultControlType.d.ts +7 -0
- package/bundle/ui-kit/DatePicker/DatePickerControl.d.ts +3 -7
- package/bundle/ui-kit/Foldable/Foldable.d.ts +11 -1
- package/bundle/ui-kit/Input/InputProps.d.ts +2 -6
- package/bundle/ui-kit/LocationDialog/SelectedLocation.d.ts +5 -0
- package/bundle/ui-kit/RadioButtonGroup/RadioButtonGroup.d.ts +3 -5
- package/bundle/ui-kit/RadioButtonGroup/RadioButtonGroupControl.d.ts +2 -0
- package/bundle/ui-kit/Select/Select.d.ts +4 -7
- package/bundle/ui-kit/Select/SelectControl.d.ts +1 -8
- package/bundle/utils/getRequiredLabel.d.ts +2 -0
- package/dist/EventBus/EventBus.d.ts +17 -4
- package/dist/EventBus/EventBus.js +29 -10
- package/dist/EventBus/EventBus.js.map +1 -1
- package/dist/EventBus/defaultEventBus.d.ts +2 -13
- package/dist/EventBus/defaultEventBus.js.map +1 -1
- package/dist/EventBus/useSubject.d.ts +2 -0
- package/dist/EventBus/useSubject.js +17 -0
- package/dist/EventBus/useSubject.js.map +1 -0
- package/dist/EventBus/useSubjectState.d.ts +2 -0
- package/dist/EventBus/useSubjectState.js +10 -0
- package/dist/EventBus/useSubjectState.js.map +1 -0
- package/dist/components/CarouselTariffsCard/CardCellsSection.d.ts +9 -0
- package/dist/components/CarouselTariffsCard/CardCellsSection.js +18 -0
- package/dist/components/CarouselTariffsCard/CardCellsSection.js.map +1 -0
- package/dist/components/CarouselTariffsCard/CarouselTariffsCard.js +11 -25
- package/dist/components/CarouselTariffsCard/CarouselTariffsCard.js.map +1 -1
- package/dist/components/CarouselTariffsCard/carouselTariffsCardEventBus.d.ts +9 -0
- package/dist/components/CarouselTariffsCard/carouselTariffsCardEventBus.js +5 -0
- package/dist/components/CarouselTariffsCard/carouselTariffsCardEventBus.js.map +1 -0
- package/dist/components/ExchangeRateTile/ExchangeRateTile.js +1 -1
- package/dist/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -1
- package/dist/components/Header/HeaderSecondaryMenu.js +1 -1
- package/dist/components/Header/HeaderSecondaryMenu.js.map +1 -1
- package/dist/components/OfficesAtmsMap/AtmsMap.js +1 -1
- package/dist/components/OfficesAtmsMap/AtmsMap.js.map +1 -1
- package/dist/components/OfficesAtmsMap/OfficesMap.js +1 -1
- package/dist/components/OfficesAtmsMap/OfficesMap.js.map +1 -1
- package/dist/components/StickyBottomMenu/BurgerMenuDialog.js +1 -1
- package/dist/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
- package/dist/hooks/useLocation.d.ts +2 -1
- package/dist/hooks/useLocation.js +27 -33
- package/dist/hooks/useLocation.js.map +1 -1
- package/dist/hooks/useReducer.d.ts +4 -0
- package/dist/hooks/useReducer.js +12 -0
- package/dist/hooks/useReducer.js.map +1 -0
- package/dist/hooks/useRegions.js +3 -1
- package/dist/hooks/useRegions.js.map +1 -1
- package/dist/model/DefaultControlType.d.ts +7 -0
- package/dist/{components/CarouselTariffsCard/CarouselTariffsCardAction.js → model/DefaultControlType.js} +1 -1
- package/dist/model/DefaultControlType.js.map +1 -0
- package/dist/ui-kit/Calculator/renderBinaryRadioButtonGroup.js +1 -1
- package/dist/ui-kit/Calculator/renderBinaryRadioButtonGroup.js.map +1 -1
- package/dist/ui-kit/DatePicker/DatePickerControl.d.ts +3 -7
- package/dist/ui-kit/DatePicker/DatePickerControl.js +2 -1
- package/dist/ui-kit/DatePicker/DatePickerControl.js.map +1 -1
- package/dist/ui-kit/DialogManager/useDialogManager.js +3 -3
- package/dist/ui-kit/DialogManager/useDialogManager.js.map +1 -1
- package/dist/ui-kit/DialogManager/useDialogsList.js +1 -1
- package/dist/ui-kit/DialogManager/useDialogsList.js.map +1 -1
- package/dist/ui-kit/Foldable/Foldable.d.ts +11 -1
- package/dist/ui-kit/Foldable/Foldable.js +10 -2
- package/dist/ui-kit/Foldable/Foldable.js.map +1 -1
- package/dist/ui-kit/FormField/Fields/SexField.js +5 -4
- package/dist/ui-kit/FormField/Fields/SexField.js.map +1 -1
- package/dist/ui-kit/FormField/Fields/VedField.js +1 -1
- package/dist/ui-kit/FormField/Fields/VedField.js.map +1 -1
- package/dist/ui-kit/FormField/constants.js +1 -0
- package/dist/ui-kit/FormField/constants.js.map +1 -1
- package/dist/ui-kit/FormField/getValidation.js +1 -0
- package/dist/ui-kit/FormField/getValidation.js.map +1 -1
- package/dist/ui-kit/Input/InputControl.js +2 -2
- package/dist/ui-kit/Input/InputControl.js.map +1 -1
- package/dist/ui-kit/Input/InputPhoneControl.js +2 -1
- package/dist/ui-kit/Input/InputPhoneControl.js.map +1 -1
- package/dist/ui-kit/Input/InputProps.d.ts +2 -6
- package/dist/ui-kit/Input/InputSnilsControl.js +2 -1
- package/dist/ui-kit/Input/InputSnilsControl.js.map +1 -1
- package/dist/ui-kit/LocationDialog/LocationDialog.js +9 -12
- package/dist/ui-kit/LocationDialog/LocationDialog.js.map +1 -1
- package/dist/ui-kit/LocationDialog/SelectedLocation.d.ts +5 -0
- package/dist/ui-kit/LocationDialog/SelectedLocation.js +15 -0
- package/dist/ui-kit/LocationDialog/SelectedLocation.js.map +1 -0
- package/dist/ui-kit/PopupManager/PopupManager.js +1 -1
- package/dist/ui-kit/PopupManager/PopupManager.js.map +1 -1
- package/dist/ui-kit/PopupManager/usePopupManager.js +3 -3
- package/dist/ui-kit/PopupManager/usePopupManager.js.map +1 -1
- package/dist/ui-kit/RadioButtonGroup/RadioButtonGroup.d.ts +3 -5
- package/dist/ui-kit/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/dist/ui-kit/RadioButtonGroup/RadioButtonGroup.js.map +1 -1
- package/dist/ui-kit/RadioButtonGroup/RadioButtonGroupControl.d.ts +2 -0
- package/dist/ui-kit/RadioButtonGroup/RadioButtonGroupControl.js +10 -0
- package/dist/ui-kit/RadioButtonGroup/RadioButtonGroupControl.js.map +1 -0
- package/dist/ui-kit/Select/Select.d.ts +4 -7
- package/dist/ui-kit/Select/Select.js +3 -4
- package/dist/ui-kit/Select/Select.js.map +1 -1
- package/dist/ui-kit/Select/SelectControl.d.ts +1 -8
- package/dist/ui-kit/Select/SelectControl.js +2 -1
- package/dist/ui-kit/Select/SelectControl.js.map +1 -1
- package/dist/utils/getRequiredLabel.d.ts +2 -0
- package/dist/utils/getRequiredLabel.js +5 -0
- package/dist/utils/getRequiredLabel.js.map +1 -0
- package/lib/EventBus/EventBus.d.ts +17 -4
- package/lib/EventBus/EventBus.js +29 -10
- package/lib/EventBus/EventBus.js.map +1 -1
- package/lib/EventBus/defaultEventBus.d.ts +2 -13
- package/lib/EventBus/defaultEventBus.js.map +1 -1
- package/lib/EventBus/useSubject.d.ts +2 -0
- package/lib/EventBus/useSubject.js +14 -0
- package/lib/EventBus/useSubject.js.map +1 -0
- package/lib/EventBus/useSubjectState.d.ts +2 -0
- package/lib/EventBus/useSubjectState.js +7 -0
- package/lib/EventBus/useSubjectState.js.map +1 -0
- package/lib/common.css +1 -1
- package/lib/components/CarouselTariffsCard/CardCellsSection.d.ts +9 -0
- package/lib/components/CarouselTariffsCard/CardCellsSection.js +16 -0
- package/lib/components/CarouselTariffsCard/CardCellsSection.js.map +1 -0
- package/lib/components/CarouselTariffsCard/CarouselTariffsCard.js +12 -26
- package/lib/components/CarouselTariffsCard/CarouselTariffsCard.js.map +1 -1
- package/lib/components/CarouselTariffsCard/carouselTariffsCardEventBus.d.ts +9 -0
- package/lib/components/CarouselTariffsCard/carouselTariffsCardEventBus.js +3 -0
- package/lib/components/CarouselTariffsCard/carouselTariffsCardEventBus.js.map +1 -0
- package/lib/components/ExchangeRateTile/ExchangeRateTile.js +2 -2
- package/lib/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -1
- package/lib/components/Header/HeaderSecondaryMenu.js +2 -2
- package/lib/components/Header/HeaderSecondaryMenu.js.map +1 -1
- package/lib/components/OfficesAtmsMap/AtmsMap.js +2 -2
- package/lib/components/OfficesAtmsMap/AtmsMap.js.map +1 -1
- package/lib/components/OfficesAtmsMap/OfficesMap.js +2 -2
- package/lib/components/OfficesAtmsMap/OfficesMap.js.map +1 -1
- package/lib/components/StickyBottomMenu/BurgerMenuDialog.js +2 -2
- package/lib/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
- package/lib/hooks/useLocation.d.ts +2 -1
- package/lib/hooks/useLocation.js +26 -33
- package/lib/hooks/useLocation.js.map +1 -1
- package/lib/hooks/useReducer.d.ts +4 -0
- package/lib/hooks/useReducer.js +9 -0
- package/lib/hooks/useReducer.js.map +1 -0
- package/lib/hooks/useRegions.js +3 -1
- package/lib/hooks/useRegions.js.map +1 -1
- package/lib/model/DefaultControlType.d.ts +7 -0
- package/lib/model/DefaultControlType.js +2 -0
- package/lib/model/DefaultControlType.js.map +1 -0
- package/lib/ui-kit/Calculator/renderBinaryRadioButtonGroup.js +1 -1
- package/lib/ui-kit/Calculator/renderBinaryRadioButtonGroup.js.map +1 -1
- package/lib/ui-kit/DatePicker/DatePickerControl.d.ts +3 -7
- package/lib/ui-kit/DatePicker/DatePickerControl.js +2 -1
- package/lib/ui-kit/DatePicker/DatePickerControl.js.map +1 -1
- package/lib/ui-kit/DialogManager/useDialogManager.js +3 -3
- package/lib/ui-kit/DialogManager/useDialogManager.js.map +1 -1
- package/lib/ui-kit/DialogManager/useDialogsList.js +1 -1
- package/lib/ui-kit/DialogManager/useDialogsList.js.map +1 -1
- package/lib/ui-kit/Foldable/Foldable.d.ts +11 -1
- package/lib/ui-kit/Foldable/Foldable.js +10 -2
- package/lib/ui-kit/Foldable/Foldable.js.map +1 -1
- package/lib/ui-kit/FormField/Fields/SexField.js +5 -4
- package/lib/ui-kit/FormField/Fields/SexField.js.map +1 -1
- package/lib/ui-kit/FormField/Fields/VedField.js +1 -1
- package/lib/ui-kit/FormField/Fields/VedField.js.map +1 -1
- package/lib/ui-kit/FormField/constants.js +1 -0
- package/lib/ui-kit/FormField/constants.js.map +1 -1
- package/lib/ui-kit/FormField/getValidation.js +1 -0
- package/lib/ui-kit/FormField/getValidation.js.map +1 -1
- package/lib/ui-kit/Input/InputControl.js +2 -2
- package/lib/ui-kit/Input/InputControl.js.map +1 -1
- package/lib/ui-kit/Input/InputPhoneControl.js +2 -1
- package/lib/ui-kit/Input/InputPhoneControl.js.map +1 -1
- package/lib/ui-kit/Input/InputProps.d.ts +2 -6
- package/lib/ui-kit/Input/InputSnilsControl.js +2 -1
- package/lib/ui-kit/Input/InputSnilsControl.js.map +1 -1
- package/lib/ui-kit/LocationDialog/LocationDialog.js +10 -13
- package/lib/ui-kit/LocationDialog/LocationDialog.js.map +1 -1
- package/lib/ui-kit/LocationDialog/SelectedLocation.d.ts +5 -0
- package/lib/ui-kit/LocationDialog/SelectedLocation.js +13 -0
- package/lib/ui-kit/LocationDialog/SelectedLocation.js.map +1 -0
- package/lib/ui-kit/PopupManager/PopupManager.js +1 -1
- package/lib/ui-kit/PopupManager/PopupManager.js.map +1 -1
- package/lib/ui-kit/PopupManager/usePopupManager.js +3 -3
- package/lib/ui-kit/PopupManager/usePopupManager.js.map +1 -1
- package/lib/ui-kit/RadioButtonGroup/RadioButtonGroup.d.ts +3 -5
- package/lib/ui-kit/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/lib/ui-kit/RadioButtonGroup/RadioButtonGroup.js.map +1 -1
- package/lib/ui-kit/RadioButtonGroup/RadioButtonGroupControl.d.ts +2 -0
- package/lib/ui-kit/RadioButtonGroup/RadioButtonGroupControl.js +8 -0
- package/lib/ui-kit/RadioButtonGroup/RadioButtonGroupControl.js.map +1 -0
- package/lib/ui-kit/Select/Select.d.ts +4 -7
- package/lib/ui-kit/Select/Select.js +3 -4
- package/lib/ui-kit/Select/Select.js.map +1 -1
- package/lib/ui-kit/Select/SelectControl.d.ts +1 -8
- package/lib/ui-kit/Select/SelectControl.js +2 -1
- package/lib/ui-kit/Select/SelectControl.js.map +1 -1
- package/lib/utils/getRequiredLabel.d.ts +2 -0
- package/lib/utils/getRequiredLabel.js +2 -0
- package/lib/utils/getRequiredLabel.js.map +1 -0
- package/mobile/bundle/EventBus/EventBus.d.ts +17 -4
- package/mobile/bundle/EventBus/defaultEventBus.d.ts +2 -13
- package/mobile/bundle/EventBus/useSubject.d.ts +2 -0
- package/mobile/bundle/EventBus/useSubjectState.d.ts +2 -0
- package/mobile/bundle/bundle.umd.js +148 -105
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/CarouselTariffsCard/CardCellsSection.d.ts +9 -0
- package/mobile/bundle/components/CarouselTariffsCard/carouselTariffsCardEventBus.d.ts +9 -0
- package/mobile/bundle/hooks/useLocation.d.ts +2 -1
- package/mobile/bundle/hooks/useReducer.d.ts +4 -0
- package/mobile/bundle/model/DefaultControlType.d.ts +7 -0
- package/mobile/bundle/ui-kit/DatePicker/DatePickerControl.d.ts +3 -7
- package/mobile/bundle/ui-kit/Foldable/Foldable.d.ts +11 -1
- package/mobile/bundle/ui-kit/Input/InputProps.d.ts +2 -6
- package/mobile/bundle/ui-kit/LocationDialog/SelectedLocation.d.ts +5 -0
- package/mobile/bundle/ui-kit/RadioButtonGroup/RadioButtonGroup.d.ts +3 -5
- package/mobile/bundle/ui-kit/RadioButtonGroup/RadioButtonGroupControl.d.ts +2 -0
- package/mobile/bundle/ui-kit/Select/Select.d.ts +4 -7
- package/mobile/bundle/ui-kit/Select/SelectControl.d.ts +1 -8
- package/mobile/bundle/utils/getRequiredLabel.d.ts +2 -0
- package/mobile/dist/EventBus/EventBus.d.ts +17 -4
- package/mobile/dist/EventBus/EventBus.js +29 -10
- package/mobile/dist/EventBus/EventBus.js.map +1 -1
- package/mobile/dist/EventBus/defaultEventBus.d.ts +2 -13
- package/mobile/dist/EventBus/defaultEventBus.js.map +1 -1
- package/mobile/dist/EventBus/useSubject.d.ts +2 -0
- package/mobile/dist/EventBus/useSubject.js +17 -0
- package/mobile/dist/EventBus/useSubject.js.map +1 -0
- package/mobile/dist/EventBus/useSubjectState.d.ts +2 -0
- package/mobile/dist/EventBus/useSubjectState.js +10 -0
- package/mobile/dist/EventBus/useSubjectState.js.map +1 -0
- package/mobile/dist/components/CarouselTariffsCard/CardCellsSection.d.ts +9 -0
- package/mobile/dist/components/CarouselTariffsCard/CardCellsSection.js +18 -0
- package/mobile/dist/components/CarouselTariffsCard/CardCellsSection.js.map +1 -0
- package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCard.js +11 -25
- package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCard.js.map +1 -1
- package/mobile/dist/components/CarouselTariffsCard/carouselTariffsCardEventBus.d.ts +9 -0
- package/mobile/dist/components/CarouselTariffsCard/carouselTariffsCardEventBus.js +5 -0
- package/mobile/dist/components/CarouselTariffsCard/carouselTariffsCardEventBus.js.map +1 -0
- package/mobile/dist/components/ExchangeRateTile/ExchangeRateTile.js +1 -1
- package/mobile/dist/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -1
- package/mobile/dist/components/Header/HeaderSecondaryMenu.js +1 -1
- package/mobile/dist/components/Header/HeaderSecondaryMenu.js.map +1 -1
- package/mobile/dist/components/OfficesAtmsMap/AtmsMap.js +1 -1
- package/mobile/dist/components/OfficesAtmsMap/AtmsMap.js.map +1 -1
- package/mobile/dist/components/OfficesAtmsMap/OfficesMap.js +1 -1
- package/mobile/dist/components/OfficesAtmsMap/OfficesMap.js.map +1 -1
- package/mobile/dist/components/StickyBottomMenu/BurgerMenuDialog.js +1 -1
- package/mobile/dist/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
- package/mobile/dist/hooks/useLocation.d.ts +2 -1
- package/mobile/dist/hooks/useLocation.js +27 -33
- package/mobile/dist/hooks/useLocation.js.map +1 -1
- package/mobile/dist/hooks/useReducer.d.ts +4 -0
- package/mobile/dist/hooks/useReducer.js +12 -0
- package/mobile/dist/hooks/useReducer.js.map +1 -0
- package/mobile/dist/hooks/useRegions.js +3 -1
- package/mobile/dist/hooks/useRegions.js.map +1 -1
- package/mobile/dist/model/DefaultControlType.d.ts +7 -0
- package/mobile/dist/{components/CarouselTariffsCard/CarouselTariffsCardAction.js → model/DefaultControlType.js} +1 -1
- package/mobile/dist/model/DefaultControlType.js.map +1 -0
- package/mobile/dist/ui-kit/Calculator/renderBinaryRadioButtonGroup.js +1 -1
- package/mobile/dist/ui-kit/Calculator/renderBinaryRadioButtonGroup.js.map +1 -1
- package/mobile/dist/ui-kit/DatePicker/DatePickerControl.d.ts +3 -7
- package/mobile/dist/ui-kit/DatePicker/DatePickerControl.js +2 -1
- package/mobile/dist/ui-kit/DatePicker/DatePickerControl.js.map +1 -1
- package/mobile/dist/ui-kit/DialogManager/useDialogManager.js +3 -3
- package/mobile/dist/ui-kit/DialogManager/useDialogManager.js.map +1 -1
- package/mobile/dist/ui-kit/DialogManager/useDialogsList.js +1 -1
- package/mobile/dist/ui-kit/DialogManager/useDialogsList.js.map +1 -1
- package/mobile/dist/ui-kit/Foldable/Foldable.d.ts +11 -1
- package/mobile/dist/ui-kit/Foldable/Foldable.js +10 -2
- package/mobile/dist/ui-kit/Foldable/Foldable.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/SexField.js +5 -4
- package/mobile/dist/ui-kit/FormField/Fields/SexField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/VedField.js +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/VedField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/constants.js +1 -0
- package/mobile/dist/ui-kit/FormField/constants.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/getValidation.js +1 -0
- package/mobile/dist/ui-kit/FormField/getValidation.js.map +1 -1
- package/mobile/dist/ui-kit/Input/InputControl.js +2 -2
- package/mobile/dist/ui-kit/Input/InputControl.js.map +1 -1
- package/mobile/dist/ui-kit/Input/InputPhoneControl.js +2 -1
- package/mobile/dist/ui-kit/Input/InputPhoneControl.js.map +1 -1
- package/mobile/dist/ui-kit/Input/InputProps.d.ts +2 -6
- package/mobile/dist/ui-kit/Input/InputSnilsControl.js +2 -1
- package/mobile/dist/ui-kit/Input/InputSnilsControl.js.map +1 -1
- package/mobile/dist/ui-kit/LocationDialog/LocationDialog.js +9 -12
- package/mobile/dist/ui-kit/LocationDialog/LocationDialog.js.map +1 -1
- package/mobile/dist/ui-kit/LocationDialog/SelectedLocation.d.ts +5 -0
- package/mobile/dist/ui-kit/LocationDialog/SelectedLocation.js +15 -0
- package/mobile/dist/ui-kit/LocationDialog/SelectedLocation.js.map +1 -0
- package/mobile/dist/ui-kit/PopupManager/PopupManager.js +1 -1
- package/mobile/dist/ui-kit/PopupManager/PopupManager.js.map +1 -1
- package/mobile/dist/ui-kit/PopupManager/usePopupManager.js +3 -3
- package/mobile/dist/ui-kit/PopupManager/usePopupManager.js.map +1 -1
- package/mobile/dist/ui-kit/RadioButtonGroup/RadioButtonGroup.d.ts +3 -5
- package/mobile/dist/ui-kit/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/mobile/dist/ui-kit/RadioButtonGroup/RadioButtonGroup.js.map +1 -1
- package/mobile/dist/ui-kit/RadioButtonGroup/RadioButtonGroupControl.d.ts +2 -0
- package/mobile/dist/ui-kit/RadioButtonGroup/RadioButtonGroupControl.js +10 -0
- package/mobile/dist/ui-kit/RadioButtonGroup/RadioButtonGroupControl.js.map +1 -0
- package/mobile/dist/ui-kit/Select/Select.d.ts +4 -7
- package/mobile/dist/ui-kit/Select/Select.js +3 -4
- package/mobile/dist/ui-kit/Select/Select.js.map +1 -1
- package/mobile/dist/ui-kit/Select/SelectControl.d.ts +1 -8
- package/mobile/dist/ui-kit/Select/SelectControl.js +2 -1
- package/mobile/dist/ui-kit/Select/SelectControl.js.map +1 -1
- package/mobile/dist/utils/getRequiredLabel.d.ts +2 -0
- package/mobile/dist/utils/getRequiredLabel.js +5 -0
- package/mobile/dist/utils/getRequiredLabel.js.map +1 -0
- package/mobile/lib/EventBus/EventBus.d.ts +17 -4
- package/mobile/lib/EventBus/EventBus.js +29 -10
- package/mobile/lib/EventBus/EventBus.js.map +1 -1
- package/mobile/lib/EventBus/defaultEventBus.d.ts +2 -13
- package/mobile/lib/EventBus/defaultEventBus.js.map +1 -1
- package/mobile/lib/EventBus/useSubject.d.ts +2 -0
- package/mobile/lib/EventBus/useSubject.js +14 -0
- package/mobile/lib/EventBus/useSubject.js.map +1 -0
- package/mobile/lib/EventBus/useSubjectState.d.ts +2 -0
- package/mobile/lib/EventBus/useSubjectState.js +7 -0
- package/mobile/lib/EventBus/useSubjectState.js.map +1 -0
- package/mobile/lib/common.css +1 -1
- package/mobile/lib/components/CarouselTariffsCard/CardCellsSection.d.ts +9 -0
- package/mobile/lib/components/CarouselTariffsCard/CardCellsSection.js +16 -0
- package/mobile/lib/components/CarouselTariffsCard/CardCellsSection.js.map +1 -0
- package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCard.js +12 -26
- package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCard.js.map +1 -1
- package/mobile/lib/components/CarouselTariffsCard/carouselTariffsCardEventBus.d.ts +9 -0
- package/mobile/lib/components/CarouselTariffsCard/carouselTariffsCardEventBus.js +3 -0
- package/mobile/lib/components/CarouselTariffsCard/carouselTariffsCardEventBus.js.map +1 -0
- package/mobile/lib/components/ExchangeRateTile/ExchangeRateTile.js +2 -2
- package/mobile/lib/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -1
- package/mobile/lib/components/Header/HeaderSecondaryMenu.js +2 -2
- package/mobile/lib/components/Header/HeaderSecondaryMenu.js.map +1 -1
- package/mobile/lib/components/OfficesAtmsMap/AtmsMap.js +2 -2
- package/mobile/lib/components/OfficesAtmsMap/AtmsMap.js.map +1 -1
- package/mobile/lib/components/OfficesAtmsMap/OfficesMap.js +2 -2
- package/mobile/lib/components/OfficesAtmsMap/OfficesMap.js.map +1 -1
- package/mobile/lib/components/StickyBottomMenu/BurgerMenuDialog.js +2 -2
- package/mobile/lib/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
- package/mobile/lib/hooks/useLocation.d.ts +2 -1
- package/mobile/lib/hooks/useLocation.js +26 -33
- package/mobile/lib/hooks/useLocation.js.map +1 -1
- package/mobile/lib/hooks/useReducer.d.ts +4 -0
- package/mobile/lib/hooks/useReducer.js +9 -0
- package/mobile/lib/hooks/useReducer.js.map +1 -0
- package/mobile/lib/hooks/useRegions.js +3 -1
- package/mobile/lib/hooks/useRegions.js.map +1 -1
- package/mobile/lib/model/DefaultControlType.d.ts +7 -0
- package/mobile/lib/model/DefaultControlType.js +2 -0
- package/mobile/lib/model/DefaultControlType.js.map +1 -0
- package/mobile/lib/ui-kit/Calculator/renderBinaryRadioButtonGroup.js +1 -1
- package/mobile/lib/ui-kit/Calculator/renderBinaryRadioButtonGroup.js.map +1 -1
- package/mobile/lib/ui-kit/DatePicker/DatePickerControl.d.ts +3 -7
- package/mobile/lib/ui-kit/DatePicker/DatePickerControl.js +2 -1
- package/mobile/lib/ui-kit/DatePicker/DatePickerControl.js.map +1 -1
- package/mobile/lib/ui-kit/DialogManager/useDialogManager.js +3 -3
- package/mobile/lib/ui-kit/DialogManager/useDialogManager.js.map +1 -1
- package/mobile/lib/ui-kit/DialogManager/useDialogsList.js +1 -1
- package/mobile/lib/ui-kit/DialogManager/useDialogsList.js.map +1 -1
- package/mobile/lib/ui-kit/Foldable/Foldable.d.ts +11 -1
- package/mobile/lib/ui-kit/Foldable/Foldable.js +10 -2
- package/mobile/lib/ui-kit/Foldable/Foldable.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/SexField.js +5 -4
- package/mobile/lib/ui-kit/FormField/Fields/SexField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/VedField.js +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/VedField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/constants.js +1 -0
- package/mobile/lib/ui-kit/FormField/constants.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/getValidation.js +1 -0
- package/mobile/lib/ui-kit/FormField/getValidation.js.map +1 -1
- package/mobile/lib/ui-kit/Input/InputControl.js +2 -2
- package/mobile/lib/ui-kit/Input/InputControl.js.map +1 -1
- package/mobile/lib/ui-kit/Input/InputPhoneControl.js +2 -1
- package/mobile/lib/ui-kit/Input/InputPhoneControl.js.map +1 -1
- package/mobile/lib/ui-kit/Input/InputProps.d.ts +2 -6
- package/mobile/lib/ui-kit/Input/InputSnilsControl.js +2 -1
- package/mobile/lib/ui-kit/Input/InputSnilsControl.js.map +1 -1
- package/mobile/lib/ui-kit/LocationDialog/LocationDialog.js +10 -13
- package/mobile/lib/ui-kit/LocationDialog/LocationDialog.js.map +1 -1
- package/mobile/lib/ui-kit/LocationDialog/SelectedLocation.d.ts +5 -0
- package/mobile/lib/ui-kit/LocationDialog/SelectedLocation.js +13 -0
- package/mobile/lib/ui-kit/LocationDialog/SelectedLocation.js.map +1 -0
- package/mobile/lib/ui-kit/PopupManager/PopupManager.js +1 -1
- package/mobile/lib/ui-kit/PopupManager/PopupManager.js.map +1 -1
- package/mobile/lib/ui-kit/PopupManager/usePopupManager.js +3 -3
- package/mobile/lib/ui-kit/PopupManager/usePopupManager.js.map +1 -1
- package/mobile/lib/ui-kit/RadioButtonGroup/RadioButtonGroup.d.ts +3 -5
- package/mobile/lib/ui-kit/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/mobile/lib/ui-kit/RadioButtonGroup/RadioButtonGroup.js.map +1 -1
- package/mobile/lib/ui-kit/RadioButtonGroup/RadioButtonGroupControl.d.ts +2 -0
- package/mobile/lib/ui-kit/RadioButtonGroup/RadioButtonGroupControl.js +8 -0
- package/mobile/lib/ui-kit/RadioButtonGroup/RadioButtonGroupControl.js.map +1 -0
- package/mobile/lib/ui-kit/Select/Select.d.ts +4 -7
- package/mobile/lib/ui-kit/Select/Select.js +3 -4
- package/mobile/lib/ui-kit/Select/Select.js.map +1 -1
- package/mobile/lib/ui-kit/Select/SelectControl.d.ts +1 -8
- package/mobile/lib/ui-kit/Select/SelectControl.js +2 -1
- package/mobile/lib/ui-kit/Select/SelectControl.js.map +1 -1
- package/mobile/lib/utils/getRequiredLabel.d.ts +2 -0
- package/mobile/lib/utils/getRequiredLabel.js +2 -0
- package/mobile/lib/utils/getRequiredLabel.js.map +1 -0
- package/mobile/src/EventBus/EventBus.ts +51 -15
- package/mobile/src/EventBus/defaultEventBus.ts +2 -14
- package/mobile/src/EventBus/useSubject.ts +19 -0
- package/mobile/src/EventBus/useSubjectState.ts +13 -0
- package/mobile/src/components/CarouselTariffsCard/CardCellsSection.tsx +54 -0
- package/mobile/src/components/CarouselTariffsCard/CarouselTariffsCard.tsx +23 -66
- package/mobile/src/components/CarouselTariffsCard/carouselTariffsCardEventBus.ts +11 -0
- package/mobile/src/components/ExchangeRateTile/ExchangeRateTile.tsx +2 -2
- package/mobile/src/components/Header/HeaderSecondaryMenu.tsx +2 -2
- package/mobile/src/components/OfficesAtmsMap/AtmsMap.tsx +2 -3
- package/mobile/src/components/OfficesAtmsMap/OfficesMap.tsx +2 -2
- package/mobile/src/components/StickyBottomMenu/BurgerMenuDialog.tsx +2 -2
- package/mobile/src/hooks/useLocation.ts +30 -44
- package/mobile/src/hooks/useReducer.ts +21 -0
- package/mobile/src/hooks/useRegions.ts +4 -1
- package/mobile/src/model/DefaultControlType.ts +7 -0
- package/mobile/src/ui-kit/Calculator/renderBinaryRadioButtonGroup.tsx +1 -1
- package/mobile/src/ui-kit/DatePicker/DatePickerControl.tsx +6 -14
- package/mobile/src/ui-kit/DialogManager/useDialogManager.ts +3 -3
- package/mobile/src/ui-kit/DialogManager/useDialogsList.ts +1 -1
- package/mobile/src/ui-kit/Foldable/Foldable.tsx +21 -5
- package/mobile/src/ui-kit/FormField/Fields/SexField.tsx +13 -11
- package/mobile/src/ui-kit/FormField/Fields/VedField.tsx +1 -1
- package/mobile/src/ui-kit/FormField/constants.tsx +1 -0
- package/mobile/src/ui-kit/FormField/getValidation.tsx +1 -0
- package/mobile/src/ui-kit/Input/InputControl.tsx +2 -3
- package/mobile/src/ui-kit/Input/InputPhoneControl.tsx +2 -1
- package/mobile/src/ui-kit/Input/InputProps.ts +2 -6
- package/mobile/src/ui-kit/Input/InputSnilsControl.tsx +2 -1
- package/mobile/src/ui-kit/LocationDialog/LocationDialog.tsx +13 -25
- package/mobile/src/ui-kit/LocationDialog/SelectedLocation.tsx +27 -0
- package/mobile/src/ui-kit/PopupManager/PopupManager.tsx +1 -1
- package/mobile/src/ui-kit/PopupManager/usePopupManager.tsx +3 -3
- package/mobile/src/ui-kit/RadioButtonGroup/RadioButtonGroup.tsx +9 -10
- package/mobile/src/ui-kit/RadioButtonGroup/RadioButtonGroupControl.tsx +18 -0
- package/mobile/src/ui-kit/Select/Select.tsx +8 -10
- package/mobile/src/ui-kit/Select/SelectControl.tsx +4 -10
- package/mobile/src/utils/getRequiredLabel.ts +4 -0
- package/package.json +1 -1
- package/src/EventBus/EventBus.ts +51 -15
- package/src/EventBus/defaultEventBus.ts +2 -14
- package/src/EventBus/useSubject.ts +19 -0
- package/src/EventBus/useSubjectState.ts +13 -0
- package/src/components/CarouselTariffsCard/CardCellsSection.tsx +54 -0
- package/src/components/CarouselTariffsCard/CarouselTariffsCard.tsx +23 -66
- package/src/components/CarouselTariffsCard/carouselTariffsCardEventBus.ts +11 -0
- package/src/components/ExchangeRateTile/ExchangeRateTile.tsx +2 -2
- package/src/components/Header/HeaderSecondaryMenu.tsx +2 -2
- package/src/components/OfficesAtmsMap/AtmsMap.tsx +2 -3
- package/src/components/OfficesAtmsMap/OfficesMap.tsx +2 -2
- package/src/components/StickyBottomMenu/BurgerMenuDialog.tsx +2 -2
- package/src/hooks/useLocation.ts +30 -44
- package/src/hooks/useReducer.ts +21 -0
- package/src/hooks/useRegions.ts +4 -1
- package/src/model/DefaultControlType.ts +7 -0
- package/src/ui-kit/Calculator/renderBinaryRadioButtonGroup.tsx +1 -1
- package/src/ui-kit/DatePicker/DatePickerControl.tsx +6 -14
- package/src/ui-kit/DialogManager/useDialogManager.ts +3 -3
- package/src/ui-kit/DialogManager/useDialogsList.ts +1 -1
- package/src/ui-kit/Foldable/Foldable.tsx +21 -5
- package/src/ui-kit/FormField/Fields/SexField.tsx +13 -11
- package/src/ui-kit/FormField/Fields/VedField.tsx +1 -1
- package/src/ui-kit/FormField/constants.tsx +1 -0
- package/src/ui-kit/FormField/getValidation.tsx +1 -0
- package/src/ui-kit/Input/InputControl.tsx +2 -3
- package/src/ui-kit/Input/InputPhoneControl.tsx +2 -1
- package/src/ui-kit/Input/InputProps.ts +2 -6
- package/src/ui-kit/Input/InputSnilsControl.tsx +2 -1
- package/src/ui-kit/LocationDialog/LocationDialog.tsx +13 -25
- package/src/ui-kit/LocationDialog/SelectedLocation.tsx +27 -0
- package/src/ui-kit/PopupManager/PopupManager.tsx +1 -1
- package/src/ui-kit/PopupManager/usePopupManager.tsx +3 -3
- package/src/ui-kit/RadioButtonGroup/RadioButtonGroup.fixture.tsx +2 -2
- package/src/ui-kit/RadioButtonGroup/RadioButtonGroup.tsx +9 -10
- package/src/ui-kit/RadioButtonGroup/RadioButtonGroupControl.tsx +18 -0
- package/src/ui-kit/Select/Select.tsx +8 -10
- package/src/ui-kit/Select/SelectControl.tsx +4 -10
- package/src/utils/getRequiredLabel.ts +4 -0
- package/bundle/EventBus/useLatestEvent.d.ts +0 -2
- package/bundle/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +0 -6
- package/dist/EventBus/useLatestEvent.d.ts +0 -2
- package/dist/EventBus/useLatestEvent.js +0 -11
- package/dist/EventBus/useLatestEvent.js.map +0 -1
- package/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +0 -6
- package/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.js.map +0 -1
- package/lib/EventBus/useLatestEvent.d.ts +0 -2
- package/lib/EventBus/useLatestEvent.js +0 -8
- package/lib/EventBus/useLatestEvent.js.map +0 -1
- package/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +0 -6
- package/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.js +0 -2
- package/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.js.map +0 -1
- package/mobile/bundle/EventBus/useLatestEvent.d.ts +0 -2
- package/mobile/bundle/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +0 -6
- package/mobile/dist/EventBus/useLatestEvent.d.ts +0 -2
- package/mobile/dist/EventBus/useLatestEvent.js +0 -11
- package/mobile/dist/EventBus/useLatestEvent.js.map +0 -1
- package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +0 -6
- package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.js.map +0 -1
- package/mobile/lib/EventBus/useLatestEvent.d.ts +0 -2
- package/mobile/lib/EventBus/useLatestEvent.js +0 -8
- package/mobile/lib/EventBus/useLatestEvent.js.map +0 -1
- package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +0 -6
- package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.js +0 -2
- package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.js.map +0 -1
- package/mobile/src/EventBus/useLatestEvent.ts +0 -16
- package/mobile/src/components/CarouselTariffsCard/CarouselTariffsCardAction.ts +0 -6
- package/src/EventBus/useLatestEvent.ts +0 -16
- package/src/components/CarouselTariffsCard/CarouselTariffsCardAction.ts +0 -6
package/src/EventBus/EventBus.ts
CHANGED
|
@@ -1,36 +1,72 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
1
|
+
export type Subscriber<Event> = (ev: Event) => void;
|
|
2
|
+
|
|
3
|
+
type Cleanup = () => void;
|
|
4
|
+
|
|
5
|
+
export interface EventBusObservable<EM extends Record<string, any>> {
|
|
6
|
+
subscribe<K extends keyof EM>(type: K, listener: Subscriber<EM[K]>): Cleanup;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface EventBusEmitter<EM extends Record<string, any>> {
|
|
10
|
+
fire<K extends keyof EM>(type: K, event: EM[K]): void;
|
|
11
|
+
subject<K extends keyof EM>(type: K, event: EM[K]): Cleanup;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export class EventBus<EM extends Record<string, any>>
|
|
15
|
+
implements EventBusObservable<EM>, EventBusEmitter<EM>
|
|
16
|
+
{
|
|
17
|
+
private subscribersMap: Partial<Record<keyof EM, Subscriber<EM[keyof EM]>[]>> = {};
|
|
3
18
|
private subjectsStateMap: Partial<EM> = {};
|
|
4
19
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
listener as (ev: EM[keyof EM]) => void,
|
|
8
|
-
);
|
|
20
|
+
readonly emitter: EventBusEmitter<EM> = this;
|
|
21
|
+
readonly observable: EventBusObservable<EM> = this;
|
|
9
22
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
23
|
+
subscribe<K extends keyof EM>(type: K, listener: Subscriber<EM[K]>): Cleanup {
|
|
24
|
+
this.subscribersMap[type] ||= [];
|
|
25
|
+
this.subscribersMap[type]?.push(listener as Subscriber<EM[keyof EM]>);
|
|
26
|
+
|
|
27
|
+
this.fireSubscribers([listener], this.subjectsStateMap[type]);
|
|
14
28
|
|
|
15
29
|
return () => {
|
|
16
30
|
this.unsubscribe(type, listener);
|
|
17
31
|
};
|
|
18
32
|
}
|
|
19
33
|
|
|
20
|
-
private unsubscribe<K extends keyof EM>(type: K, listener:
|
|
21
|
-
|
|
34
|
+
private unsubscribe<K extends keyof EM>(type: K, listener: Subscriber<EM[K]>) {
|
|
35
|
+
const index = this.subscribersMap[type]?.indexOf(listener as Subscriber<EM[keyof EM]>);
|
|
36
|
+
if (index && index !== -1) {
|
|
37
|
+
this.subscribersMap[type]?.splice(index, 1);
|
|
38
|
+
}
|
|
22
39
|
}
|
|
23
40
|
|
|
24
41
|
fire<K extends keyof EM>(type: K, event: EM[K]) {
|
|
25
42
|
const isSubjectDeclared = type in this.subjectsStateMap;
|
|
26
43
|
if (isSubjectDeclared) {
|
|
44
|
+
this.subject(type, event);
|
|
45
|
+
} else {
|
|
46
|
+
this.fireSubscribers(this.subscribersMap[type], event);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
subject<K extends keyof EM>(type: K, event: EM[K]): Cleanup {
|
|
51
|
+
if (this.subjectsStateMap[type] !== event) {
|
|
27
52
|
this.subjectsStateMap[type] = event;
|
|
53
|
+
this.fireSubscribers(this.subscribersMap[type], event);
|
|
28
54
|
}
|
|
29
55
|
|
|
30
|
-
|
|
56
|
+
return () => {
|
|
57
|
+
delete this.subjectsStateMap[type];
|
|
58
|
+
};
|
|
31
59
|
}
|
|
32
60
|
|
|
33
|
-
|
|
34
|
-
|
|
61
|
+
private fireSubscribers<K extends keyof EM>(
|
|
62
|
+
subscribers: Subscriber<EM[K]>[] | undefined,
|
|
63
|
+
event: EM[K] | undefined,
|
|
64
|
+
) {
|
|
65
|
+
if (!subscribers || !event) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
for (const _ of subscribers) {
|
|
69
|
+
_(event);
|
|
70
|
+
}
|
|
35
71
|
}
|
|
36
72
|
}
|
|
@@ -1,22 +1,10 @@
|
|
|
1
|
-
import { type CarouselTariffsCardAction } from '../components/CarouselTariffsCard/CarouselTariffsCardAction';
|
|
2
|
-
import { type Tab } from '../components/TabsLayout/TabsLayoutContent';
|
|
3
1
|
import { type Region } from '../hooks/useRegions';
|
|
4
2
|
import { type DialogAction } from '../ui-kit/DialogManager/DialogAction';
|
|
5
3
|
import { type PopupAction } from '../ui-kit/PopupManager/PopupAction';
|
|
6
4
|
import { EventBus } from './EventBus';
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
type?: Tab['type'];
|
|
10
|
-
groupName?: string;
|
|
11
|
-
label?: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
interface GlobalEventMap {
|
|
6
|
+
export const defaultEventBus = new EventBus<{
|
|
15
7
|
location: Region;
|
|
16
8
|
dialog: DialogAction;
|
|
17
9
|
popup: PopupAction;
|
|
18
|
-
|
|
19
|
-
fold: CarouselTariffsCardAction;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export const defaultEventBus = new EventBus<GlobalEventMap>();
|
|
10
|
+
}>();
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useCallback, useEffect } from '@redneckz/uni-jsx/lib/hooks';
|
|
2
|
+
import type { EventBusEmitter } from './EventBus';
|
|
3
|
+
|
|
4
|
+
export function useSubject<EM extends Record<string, any>, K extends keyof EM>(
|
|
5
|
+
eventBus: EventBusEmitter<EM>,
|
|
6
|
+
type: K,
|
|
7
|
+
initialState: EM[K] | (() => EM[K] | Promise<EM[K]>),
|
|
8
|
+
): (_: EM[K]) => void {
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const state = initialState instanceof Function ? initialState() : initialState;
|
|
11
|
+
if (state instanceof Promise) {
|
|
12
|
+
state.then((_) => eventBus.subject(type, _), console.warn);
|
|
13
|
+
} else {
|
|
14
|
+
eventBus.subject(type, state);
|
|
15
|
+
}
|
|
16
|
+
}, [eventBus, type]);
|
|
17
|
+
|
|
18
|
+
return useCallback((_: EM[K]) => eventBus.fire(type, _), [eventBus, type]);
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
2
|
+
import { type EventBusObservable } from './EventBus';
|
|
3
|
+
|
|
4
|
+
export const useSubjectState = <EM extends Record<string, any>, K extends keyof EM>(
|
|
5
|
+
eventBus: EventBusObservable<EM>,
|
|
6
|
+
type: K,
|
|
7
|
+
initialState: EM[K],
|
|
8
|
+
): EM[K] => {
|
|
9
|
+
const [state, setState] = useState(initialState);
|
|
10
|
+
useEffect(() => eventBus.subscribe(type, setState), [eventBus, type]);
|
|
11
|
+
|
|
12
|
+
return state;
|
|
13
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import type { AspectsProps } from '../../model/AspectsProps';
|
|
3
|
+
import { FoldableWrapper } from '../../ui-kit/Foldable/Foldable';
|
|
4
|
+
import { FoldableSection } from '../../ui-kit/Foldable/FoldableSection';
|
|
5
|
+
import { Icon } from '../../ui-kit/Icon/Icon';
|
|
6
|
+
import { getAspectsAttributes } from '../../utils/dataAttributes';
|
|
7
|
+
import type { TariffsCardCellProps } from './CarouselTariffsCardContent';
|
|
8
|
+
import { renderCardInfo } from './renderCardInfo';
|
|
9
|
+
|
|
10
|
+
export interface CardCellsSectionProps extends AspectsProps {
|
|
11
|
+
cardCells?: TariffsCardCellProps[];
|
|
12
|
+
visibleCellsCount?: number;
|
|
13
|
+
isUnfolded?: boolean;
|
|
14
|
+
onToggle?: () => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const CardCellsSection = JSX<CardCellsSectionProps>((props) => {
|
|
18
|
+
const { cardCells = [], visibleCellsCount = 1, isUnfolded } = props;
|
|
19
|
+
|
|
20
|
+
const [visibleCells, hiddenCells] =
|
|
21
|
+
visibleCellsCount > 0 && cardCells.length >= visibleCellsCount
|
|
22
|
+
? [cardCells.slice(0, visibleCellsCount), cardCells.slice(visibleCellsCount)]
|
|
23
|
+
: [cardCells, []];
|
|
24
|
+
|
|
25
|
+
return hiddenCells.length ? (
|
|
26
|
+
<FoldableWrapper>
|
|
27
|
+
<div>
|
|
28
|
+
{visibleCells.map(renderCardInfo)}
|
|
29
|
+
<FoldableSection isUnfolded={isUnfolded}>{hiddenCells.map(renderCardInfo)}</FoldableSection>
|
|
30
|
+
</div>
|
|
31
|
+
<FoldButton {...props} />
|
|
32
|
+
</FoldableWrapper>
|
|
33
|
+
) : (
|
|
34
|
+
<div>{visibleCells.map(renderCardInfo)}</div>
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const FoldButton = JSX<CardCellsSectionProps>(({ isUnfolded, data, onToggle }) => (
|
|
39
|
+
<button
|
|
40
|
+
type="button"
|
|
41
|
+
className="w-full cursor-pointer text-primary-main pt-lg flex justify-between items-center"
|
|
42
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
43
|
+
{...(isUnfolded ? getAspectsAttributes(data) : {})}
|
|
44
|
+
onClick={onToggle}
|
|
45
|
+
>
|
|
46
|
+
<div>{isUnfolded ? 'Скрыть' : 'Подробнее о тарифе'}</div>
|
|
47
|
+
<Icon
|
|
48
|
+
className="text-primary-text"
|
|
49
|
+
name={isUnfolded ? 'ArrowUpIcon' : 'ArrowDownIcon'}
|
|
50
|
+
width="16"
|
|
51
|
+
height="16"
|
|
52
|
+
/>
|
|
53
|
+
</button>
|
|
54
|
+
));
|
|
@@ -1,28 +1,22 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { type AspectsDef } from '../../model/AspectsProps';
|
|
5
|
-
import { type Slot } from '../../model/ContentPageDef';
|
|
6
|
-
import { type VNode } from '../../model/VNode';
|
|
2
|
+
import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
|
+
import { useSubjectState } from '../../EventBus/useSubjectState';
|
|
7
4
|
import { BlockWrapper } from '../../ui-kit/BlockWrapper';
|
|
8
|
-
import { Foldable } from '../../ui-kit/Foldable/Foldable';
|
|
9
|
-
import { FoldableSection } from '../../ui-kit/Foldable/FoldableSection';
|
|
10
5
|
import { Heading } from '../../ui-kit/Heading/Heading';
|
|
11
|
-
import { Icon } from '../../ui-kit/Icon/Icon';
|
|
12
6
|
import { Img } from '../../ui-kit/Img/Img';
|
|
13
7
|
import { LinkButton } from '../../ui-kit/LinkButton/LinkButton';
|
|
14
8
|
import { type UniBlockProps } from '../../UniBlock/UniBlockProps';
|
|
15
|
-
import { getAspectsAttributes } from '../../utils/dataAttributes';
|
|
16
9
|
import { isIcon } from '../../utils/isIcon';
|
|
17
10
|
import { style } from '../../utils/style';
|
|
11
|
+
import { CardCellsSection } from './CardCellsSection';
|
|
18
12
|
import { type CarouselTariffsCardContent } from './CarouselTariffsCardContent';
|
|
19
|
-
import {
|
|
13
|
+
import { carouselTariffsCardEventBus } from './carouselTariffsCardEventBus';
|
|
20
14
|
|
|
21
15
|
export interface CarouselTariffsCardProps extends CarouselTariffsCardContent, UniBlockProps {}
|
|
22
16
|
|
|
23
17
|
export const CarouselTariffsCard = JSX<CarouselTariffsCardProps>(
|
|
24
18
|
({
|
|
25
|
-
className
|
|
19
|
+
className,
|
|
26
20
|
title,
|
|
27
21
|
align = 'text-center',
|
|
28
22
|
icon,
|
|
@@ -33,22 +27,20 @@ export const CarouselTariffsCard = JSX<CarouselTariffsCardProps>(
|
|
|
33
27
|
data,
|
|
34
28
|
...rest
|
|
35
29
|
}) => {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const [isVisible, setIsVisible] = useState(false);
|
|
30
|
+
const { isUnfolded, parent: firedParent } = useSubjectState(
|
|
31
|
+
carouselTariffsCardEventBus.observable,
|
|
32
|
+
'fold',
|
|
33
|
+
{},
|
|
34
|
+
);
|
|
35
|
+
const isVisible = isUnfolded && firedParent === options?.parent;
|
|
43
36
|
|
|
44
|
-
|
|
37
|
+
const toggle = useCallback(
|
|
45
38
|
() =>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
39
|
+
carouselTariffsCardEventBus.emitter.fire('fold', {
|
|
40
|
+
isUnfolded: !isVisible,
|
|
41
|
+
parent: options?.parent,
|
|
50
42
|
}),
|
|
51
|
-
[options?.parent],
|
|
43
|
+
[isVisible, options?.parent],
|
|
52
44
|
);
|
|
53
45
|
|
|
54
46
|
return (
|
|
@@ -62,49 +54,14 @@ export const CarouselTariffsCard = JSX<CarouselTariffsCardProps>(
|
|
|
62
54
|
<Heading className={style('pt-xs', align)} headingType="h5" title={title} />
|
|
63
55
|
) : null}
|
|
64
56
|
{button?.text ? <LinkButton className="w-full mt-m mb-lg" {...button} /> : null}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
)}
|
|
73
|
-
renderFoldButton={
|
|
74
|
-
cardCells.length >= visibleCellsCount
|
|
75
|
-
? renderFoldButton(options?.parent, data, isVisible)
|
|
76
|
-
: null
|
|
77
|
-
}
|
|
78
|
-
/>
|
|
79
|
-
) : (
|
|
80
|
-
<div>{visibleCells}</div>
|
|
81
|
-
)}
|
|
57
|
+
<CardCellsSection
|
|
58
|
+
cardCells={cardCells}
|
|
59
|
+
visibleCellsCount={visibleCellsCount}
|
|
60
|
+
isUnfolded={isVisible}
|
|
61
|
+
data={data}
|
|
62
|
+
onToggle={toggle}
|
|
63
|
+
/>
|
|
82
64
|
</BlockWrapper>
|
|
83
65
|
);
|
|
84
66
|
},
|
|
85
67
|
);
|
|
86
|
-
|
|
87
|
-
const renderFoldButton =
|
|
88
|
-
(parent?: Slot, data?: AspectsDef[], isUnfolded = false) =>
|
|
89
|
-
(): VNode =>
|
|
90
|
-
(
|
|
91
|
-
<button
|
|
92
|
-
className="w-full cursor-pointer text-primary-main pt-lg flex justify-between items-center"
|
|
93
|
-
onClick={() => {
|
|
94
|
-
if (parent !== undefined) {
|
|
95
|
-
defaultEventBus.fire('fold', { type: 'fold', isUnfolded: !isUnfolded, parent });
|
|
96
|
-
}
|
|
97
|
-
}}
|
|
98
|
-
type="button"
|
|
99
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
100
|
-
{...(isUnfolded ? getAspectsAttributes(data) : {})}
|
|
101
|
-
>
|
|
102
|
-
<div>{isUnfolded ? 'Скрыть' : 'Подробнее о тарифе'}</div>
|
|
103
|
-
<Icon
|
|
104
|
-
className="text-primary-text"
|
|
105
|
-
name={isUnfolded ? 'ArrowUpIcon' : 'ArrowDownIcon'}
|
|
106
|
-
width="16"
|
|
107
|
-
height="16"
|
|
108
|
-
/>
|
|
109
|
-
</button>
|
|
110
|
-
);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EventBus } from '../../EventBus/EventBus';
|
|
2
|
+
import { type Slot } from '../../model/ContentPageDef';
|
|
3
|
+
|
|
4
|
+
export type CarouselTariffsCardFoldAction = {
|
|
5
|
+
isUnfolded?: boolean;
|
|
6
|
+
parent?: Slot;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const carouselTariffsCardEventBus = new EventBus<{
|
|
10
|
+
fold: CarouselTariffsCardFoldAction;
|
|
11
|
+
}>();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
-
import {
|
|
2
|
+
import { useLocationState } from '../../hooks/useLocation';
|
|
3
3
|
import { BaseTile } from '../../ui-kit/BaseTile/BaseTile';
|
|
4
4
|
import { BlockWrapper } from '../../ui-kit/BlockWrapper';
|
|
5
5
|
import { Heading } from '../../ui-kit/Heading/Heading';
|
|
@@ -19,7 +19,7 @@ export interface ExchangeRateTileProps extends ExchangeRateTileContent, UniBlock
|
|
|
19
19
|
|
|
20
20
|
export const ExchangeRateTile = JSX<ExchangeRateTileProps>(
|
|
21
21
|
({ className = '', title = 'Курсы обмена валют', button, ...rest }) => {
|
|
22
|
-
const
|
|
22
|
+
const currentLocation = useLocationState();
|
|
23
23
|
const exchangeRates = useFetchExchangeRateData(currentLocation);
|
|
24
24
|
|
|
25
25
|
const currencyRates = getCurrencyRates(exchangeRates?.exchangeRate?.currencies);
|
|
@@ -4,7 +4,7 @@ import { type SearchHeaderProps } from '../../data/CommonData';
|
|
|
4
4
|
import { type HeaderData } from '../../data/HeaderData';
|
|
5
5
|
import { type NavigationData } from '../../data/NavigationData';
|
|
6
6
|
import { getAspectsWithInclude } from '../../hooks/useAspects/aspects/getAspectsWithInclude';
|
|
7
|
-
import {
|
|
7
|
+
import { useLocationState } from '../../hooks/useLocation';
|
|
8
8
|
import { type BlockVersion } from '../../model/BlockVersion';
|
|
9
9
|
import { type IconVersion } from '../../model/IconVersion';
|
|
10
10
|
import { useLocationDialog } from '../../ui-kit/LocationDialog/useLocationDialog';
|
|
@@ -22,7 +22,7 @@ export const HeaderSecondaryMenu = JSX<HeaderSecondaryMenuProps>(
|
|
|
22
22
|
({ className, version, ...rest }) => {
|
|
23
23
|
const iconVersion: IconVersion = version === 'transparent' ? 'white' : 'black';
|
|
24
24
|
|
|
25
|
-
const
|
|
25
|
+
const currentLocation = useLocationState(rest?.branches?.default);
|
|
26
26
|
|
|
27
27
|
const searchDialog = useSearchDialog(rest);
|
|
28
28
|
const locationDialog = useLocationDialog(rest);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
-
import {
|
|
2
|
+
import { useLocationState } from '../../hooks/useLocation';
|
|
3
3
|
import { type AtmsDef } from './OfficesAtmsMapContent';
|
|
4
4
|
import { OfficesAtmsMapLayout } from './OfficesAtmsMapLayout';
|
|
5
5
|
import { type Atm } from './OfficesAtmsMapProps';
|
|
@@ -30,8 +30,7 @@ export interface AtmsMapProps {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export const AtmsMap = JSX<AtmsMapProps>(({ descriptionData, className }) => {
|
|
33
|
-
const
|
|
34
|
-
|
|
33
|
+
const currentLocation = useLocationState();
|
|
35
34
|
const regionCode = currentLocation?.code ?? '000';
|
|
36
35
|
|
|
37
36
|
const { data: officesData, isLoad } = useAtms(regionCode);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
-
import {
|
|
2
|
+
import { useLocationState } from '../../hooks/useLocation';
|
|
3
3
|
import { OfficesAtmsMapLayout } from './OfficesAtmsMapLayout';
|
|
4
4
|
import { getOfficePoint, renderOfficeCard } from './renderOfficeCard';
|
|
5
5
|
import { getRemoteWorkplacePoint, renderRemoteWorkplaceCard } from './renderRemoteWorkplaceCard';
|
|
@@ -10,7 +10,7 @@ export interface OfficesMapProps {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export const OfficesMap = JSX<OfficesMapProps>(({ className }) => {
|
|
13
|
-
const
|
|
13
|
+
const currentLocation = useLocationState();
|
|
14
14
|
const regionCode = currentLocation?.code ?? '000';
|
|
15
15
|
const { data, isLoad } = useOffices(regionCode);
|
|
16
16
|
|
|
@@ -4,7 +4,7 @@ import { type HeaderData } from '../../data/HeaderData';
|
|
|
4
4
|
import { type JSONRefObject } from '../../data/JSONRefObject';
|
|
5
5
|
import { type StickyMenuItem } from '../../data/StickyMobileData';
|
|
6
6
|
import { env } from '../../Env';
|
|
7
|
-
import {
|
|
7
|
+
import { useLocationState } from '../../hooks/useLocation';
|
|
8
8
|
import { Heading } from '../../ui-kit/Heading/Heading';
|
|
9
9
|
import { useLocationDialog } from '../../ui-kit/LocationDialog/useLocationDialog';
|
|
10
10
|
import { getBasePath } from '../../utils/getBasePath';
|
|
@@ -22,7 +22,7 @@ export interface BurgerMenuDialogProps {
|
|
|
22
22
|
export const BurgerMenuDialog = JSX<BurgerMenuDialogProps>(
|
|
23
23
|
({ menuRef, menuItem, locationDialogProps, closeAll }) => {
|
|
24
24
|
const locationDialog = useLocationDialog(locationDialogProps || {});
|
|
25
|
-
const
|
|
25
|
+
const { name: location } = useLocationState();
|
|
26
26
|
const menuDimensions = menuRef?.current?.getBoundingClientRect();
|
|
27
27
|
const basePath = getBasePath(env.SITE_URL);
|
|
28
28
|
|
package/src/hooks/useLocation.ts
CHANGED
|
@@ -1,54 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useAsyncData } from '@redneckz/uni-jsx/lib/hooks/useAsyncData';
|
|
1
|
+
import { useEffect } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
2
|
import { defaultEventBus } from '../EventBus/defaultEventBus';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { useSubject } from '../EventBus/useSubject';
|
|
4
|
+
import { useSubjectState } from '../EventBus/useSubjectState';
|
|
5
|
+
import { fetchJSON } from '../utils/fetchJSON';
|
|
6
6
|
import { type Region } from './useRegions';
|
|
7
7
|
|
|
8
8
|
const REGION_URL = '/api/v1/region';
|
|
9
9
|
const LOCATION_STORAGE_KEY = 'location';
|
|
10
10
|
|
|
11
|
-
export function useLocation(defaultLocation = 'Москва'):
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
11
|
+
export function useLocation(defaultLocation = 'Москва'): (_: Region) => void {
|
|
12
|
+
useEffect(() => defaultEventBus.subscribe('location', storeLocation), []);
|
|
13
|
+
|
|
14
|
+
return useSubject(defaultEventBus.emitter, 'location', restoreLocation(defaultLocation));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function useLocationState(defaultLocation = 'Москва'): Region {
|
|
18
|
+
return useSubjectState(defaultEventBus.observable, 'location', { name: defaultLocation });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function restoreLocation(defaultLocation: string) {
|
|
22
|
+
return async (): Promise<Region> => {
|
|
23
|
+
if (!globalThis.localStorage?.hasItem(LOCATION_STORAGE_KEY)) {
|
|
24
|
+
storeLocation(await fetchJSON<Region>(REGION_URL));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const storedLocation = globalThis.localStorage?.getItem(LOCATION_STORAGE_KEY);
|
|
28
|
+
try {
|
|
29
|
+
return storedLocation && JSON.parse(storedLocation);
|
|
30
|
+
} catch (ex) {
|
|
31
|
+
// Do nothing
|
|
30
32
|
}
|
|
31
|
-
}, [data]);
|
|
32
33
|
|
|
33
|
-
|
|
34
|
+
return { name: defaultLocation };
|
|
35
|
+
};
|
|
34
36
|
}
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
try {
|
|
40
|
-
const data = globalThis.localStorage?.getItem(LOCATION_STORAGE_KEY);
|
|
41
|
-
|
|
42
|
-
return data && JSON.parse(data);
|
|
43
|
-
} catch (ex) {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const storeLocation = (_: Region) => {
|
|
49
|
-
try {
|
|
50
|
-
globalThis.localStorage?.setItem(LOCATION_STORAGE_KEY, JSON.stringify(_));
|
|
51
|
-
} catch (ex) {
|
|
52
|
-
// Do nothing
|
|
53
|
-
}
|
|
54
|
-
};
|
|
38
|
+
function storeLocation(_: Region | null | undefined) {
|
|
39
|
+
_ && globalThis.localStorage?.setItem(LOCATION_STORAGE_KEY, JSON.stringify(_));
|
|
40
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useCallback, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
2
|
+
|
|
3
|
+
export type NotUndefined = object | null;
|
|
4
|
+
export type Reducer<S, A extends NotUndefined> = (state: S, action: A) => S;
|
|
5
|
+
export type Dispatch<A extends NotUndefined> = (action: A) => void;
|
|
6
|
+
|
|
7
|
+
export function useReducer<S, A extends NotUndefined>(
|
|
8
|
+
reducer: Reducer<S, A>,
|
|
9
|
+
initialArg: S,
|
|
10
|
+
): [state: S, dispatch: Dispatch<A>] {
|
|
11
|
+
const [state, setState] = useState(initialArg);
|
|
12
|
+
|
|
13
|
+
const dispatch = useCallback(
|
|
14
|
+
(action: A) => {
|
|
15
|
+
setState((_) => reducer(_, action));
|
|
16
|
+
},
|
|
17
|
+
[reducer],
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
return [state, dispatch];
|
|
21
|
+
}
|
package/src/hooks/useRegions.ts
CHANGED
|
@@ -11,8 +11,11 @@ export interface Region {
|
|
|
11
11
|
localities?: string[];
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
const EMPTY_REGIONS: Region[] = [];
|
|
15
|
+
|
|
16
|
+
// TODO Почему url можно менять? Разве смысл не в инкапсуляции api url. Тоже под рефакторинг попадает
|
|
14
17
|
export function useRegions(url: string = REGIONS_URL): Region[] {
|
|
15
18
|
const { data } = useAsyncData(url, fetchJSONUnsafe as FetchJSONUnsafeType<Region[]>);
|
|
16
19
|
|
|
17
|
-
return Array.isArray(data) ? data :
|
|
20
|
+
return Array.isArray(data) ? data : EMPTY_REGIONS;
|
|
18
21
|
}
|
|
@@ -44,7 +44,7 @@ export const renderBinaryRadioButtonGroup = ({
|
|
|
44
44
|
<RadioButtonGroup
|
|
45
45
|
orientation={orientation}
|
|
46
46
|
items={items}
|
|
47
|
-
|
|
47
|
+
value={items[value ? 0 : 1].id}
|
|
48
48
|
onChange={(_) => onChange && onChange(_ === items[0].id)}
|
|
49
49
|
{...rest}
|
|
50
50
|
/>
|
|
@@ -1,25 +1,17 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { type DefaultControlType } from '../../model/DefaultControlType';
|
|
3
|
+
import { getRequiredLabel } from '../../utils/getRequiredLabel';
|
|
2
4
|
import { style } from '../../utils/style';
|
|
5
|
+
import { type ControlProps } from '../ControlProps';
|
|
3
6
|
import { renderErrorText } from '../Input/renderErrorText';
|
|
4
7
|
import { DatePicker } from './DatePicker';
|
|
5
8
|
|
|
6
|
-
export interface DatePickerControlProps {
|
|
7
|
-
className?: string;
|
|
8
|
-
label: string;
|
|
9
|
-
value?: Date;
|
|
10
|
-
error?: string;
|
|
11
|
-
errors?: string[];
|
|
12
|
-
onChange?: (value: Date) => void;
|
|
13
|
-
}
|
|
9
|
+
export interface DatePickerControlProps extends DefaultControlType, ControlProps<Date> {}
|
|
14
10
|
|
|
15
11
|
export const DatePickerControl = JSX<DatePickerControlProps>(
|
|
16
|
-
({ className, label, error, ...rest }) => (
|
|
12
|
+
({ className, label, error, errors, ...rest }) => (
|
|
17
13
|
<div className={style('shrink-0 w-full', className)}>
|
|
18
|
-
<DatePicker
|
|
19
|
-
label={label && rest?.errors ? `${label}*` : label}
|
|
20
|
-
valid={Boolean(!error)}
|
|
21
|
-
{...rest}
|
|
22
|
-
/>
|
|
14
|
+
<DatePicker label={getRequiredLabel({ label, errors })} valid={Boolean(!error)} {...rest} />
|
|
23
15
|
{renderErrorText(error)}
|
|
24
16
|
</div>
|
|
25
17
|
),
|
|
@@ -8,7 +8,7 @@ export interface DialogOptions {
|
|
|
8
8
|
|
|
9
9
|
export const useDialogManager = () => ({
|
|
10
10
|
open: (dialog: VNode, options: DialogOptions = {}) =>
|
|
11
|
-
defaultEventBus.fire('dialog', { type: 'open', dialog, ...options }),
|
|
12
|
-
close: () => defaultEventBus.fire('dialog', { type: 'close' }),
|
|
13
|
-
closeAll: () => defaultEventBus.fire('dialog', { type: 'close', all: true }),
|
|
11
|
+
defaultEventBus.emitter.fire('dialog', { type: 'open', dialog, ...options }),
|
|
12
|
+
close: () => defaultEventBus.emitter.fire('dialog', { type: 'close' }),
|
|
13
|
+
closeAll: () => defaultEventBus.emitter.fire('dialog', { type: 'close', all: true }),
|
|
14
14
|
});
|