@arquimedes.co/eureka-forms 2.0.99 → 3.0.1-refactor
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/@Types/FormStep.d.ts +1 -1
- package/dist/App/App.d.ts +1 -3
- package/dist/App/App.js +21 -46
- package/dist/App/AppFunctions.d.ts +1 -1
- package/dist/App/AppFunctions.js +177 -328
- package/dist/App/AppFunctions.test.js +638 -0
- package/dist/App/AppHooks.d.ts +2 -2
- package/dist/App/AppHooks.js +127 -223
- package/dist/App/AppHooks.test.d.ts +1 -0
- package/dist/App/AppHooks.test.js +154 -0
- package/dist/Contexts/CustomContext.d.ts +0 -1
- package/dist/Contexts/CustomContext.js +1 -1
- package/dist/Contexts/FormContext.d.ts +1 -1
- package/dist/Contexts/FormContext.js +3 -2
- package/dist/Contexts/SectionContext.d.ts +0 -1
- package/dist/Contexts/SectionContext.js +1 -1
- package/dist/Form/ConfirmationDialog/ConfirmationDialog.d.ts +0 -1
- package/dist/Form/ConfirmationDialog/ConfirmationDialog.js +43 -62
- package/dist/Form/Form.d.ts +1 -2
- package/dist/Form/Form.js +75 -160
- package/dist/Form/FormFunctions.js +64 -114
- package/dist/Form/FormFunctions.test.d.ts +1 -0
- package/dist/Form/FormFunctions.test.js +454 -0
- package/dist/Form/FormHooks.d.ts +0 -1
- package/dist/Form/FormHooks.js +14 -21
- package/dist/Form/FormTypes/ColumnForm/ColumnForm.d.ts +0 -1
- package/dist/Form/FormTypes/ColumnForm/ColumnForm.js +34 -105
- package/dist/Form/FormTypes/StepperForm/StepperForm.d.ts +1 -2
- package/dist/Form/FormTypes/StepperForm/StepperForm.js +48 -110
- package/dist/Form/Section/MaterialSection/MaterialSection.d.ts +0 -1
- package/dist/Form/Section/MaterialSection/MaterialSection.js +10 -23
- package/dist/Form/Section/MaterialSection/MaterialSection.module.css +0 -2
- package/dist/Form/Section/Section.d.ts +0 -1
- package/dist/Form/Section/Section.js +4 -15
- package/dist/Form/Terms/Term/MaterialTerm/MaterialTerm.d.ts +0 -1
- package/dist/Form/Terms/Term/MaterialTerm/MaterialTerm.js +30 -65
- package/dist/Form/Terms/Term/Term.d.ts +0 -1
- package/dist/Form/Terms/Term/Term.js +2 -13
- package/dist/Form/Terms/Terms.d.ts +0 -1
- package/dist/Form/Terms/Terms.js +11 -27
- package/dist/FormSteps/@Construction/CBRElementStep/CBRElementStep.d.ts +0 -1
- package/dist/FormSteps/@Construction/CBRElementStep/CBRElementStep.js +36 -106
- package/dist/FormSteps/@Construction/CBRIncidentsStep/CBRIncidentsStep.d.ts +0 -1
- package/dist/FormSteps/@Construction/CBRIncidentsStep/CBRIncidentsStep.js +2 -13
- package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.d.ts +0 -1
- package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.js +12 -40
- package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.d.ts +0 -1
- package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.js +57 -77
- package/dist/FormSteps/@Construction/CBRPropertyStep/CBRPropertyStep.d.ts +0 -1
- package/dist/FormSteps/@Construction/CBRPropertyStep/CBRPropertyStep.js +46 -111
- package/dist/FormSteps/AYFStepMapper.d.ts +0 -1
- package/dist/FormSteps/AYFStepMapper.js +63 -127
- package/dist/FormSteps/ApiSelectorStep/ApiSelectorStep.d.ts +0 -1
- package/dist/FormSteps/ApiSelectorStep/ApiSelectorStep.js +2 -13
- package/dist/FormSteps/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.d.ts +0 -1
- package/dist/FormSteps/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.js +63 -165
- package/dist/FormSteps/CBRStepMapper.d.ts +0 -1
- package/dist/FormSteps/CBRStepMapper.js +61 -152
- package/dist/FormSteps/CheckBoxStep/CheckBoxStep.d.ts +0 -1
- package/dist/FormSteps/CheckBoxStep/CheckBoxStep.js +2 -13
- package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.d.ts +0 -1
- package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +19 -37
- package/dist/FormSteps/ClassifierSelectorStep/ClassifierSelectorStep.d.ts +0 -1
- package/dist/FormSteps/ClassifierSelectorStep/ClassifierSelectorStep.js +2 -13
- package/dist/FormSteps/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.d.ts +1 -2
- package/dist/FormSteps/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +47 -80
- package/dist/FormSteps/CollapsibleStep/CollapsibleStep.d.ts +0 -1
- package/dist/FormSteps/CollapsibleStep/CollapsibleStep.js +3 -26
- package/dist/FormSteps/CollapsibleStep/MaterialTitleStep/MaterialCollapsibleStep.d.ts +0 -1
- package/dist/FormSteps/CollapsibleStep/MaterialTitleStep/MaterialCollapsibleStep.js +33 -61
- package/dist/FormSteps/CustomStep.d.ts +0 -1
- package/dist/FormSteps/CustomStep.js +17 -31
- package/dist/FormSteps/DatePickerStep/DatePickerStep.d.ts +0 -1
- package/dist/FormSteps/DatePickerStep/DatePickerStep.js +2 -13
- package/dist/FormSteps/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.d.ts +1 -2
- package/dist/FormSteps/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.js +7 -20
- package/dist/FormSteps/EntityValueStep/EntityValuePickerStep.d.ts +0 -1
- package/dist/FormSteps/EntityValueStep/EntityValuePickerStep.js +2 -13
- package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValueDialog/MaterialEntityValueDialog.d.ts +0 -1
- package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValueDialog/MaterialEntityValueDialog.js +16 -32
- package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.d.ts +1 -2
- package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.js +94 -180
- package/dist/FormSteps/FileUploadStep/FileUploadStep.d.ts +0 -1
- package/dist/FormSteps/FileUploadStep/FileUploadStep.js +2 -13
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.d.ts +0 -1
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.js +33 -95
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/FileFunctions.d.ts +2 -0
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/FileFunctions.js +3 -0
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.d.ts +0 -2
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +86 -180
- package/dist/FormSteps/MapperStep/MapperStep.d.ts +0 -1
- package/dist/FormSteps/MapperStep/MapperStep.js +2 -13
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/ListMapperElement/ListMapperElement.d.ts +0 -1
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/ListMapperElement/ListMapperElement.js +16 -38
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/MapperElementComponent.js +21 -31
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/PagedMapperElement/PagedMapperElement.d.ts +0 -1
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/PagedMapperElement/PagedMapperElement.js +89 -175
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/PillMapperElement/PillMapperElement.d.ts +0 -1
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/PillMapperElement/PillMapperElement.js +20 -47
- package/dist/FormSteps/MapperStep/MaterialMapperStep/MaterialMapperStep.d.ts +0 -1
- package/dist/FormSteps/MapperStep/MaterialMapperStep/MaterialMapperStep.js +81 -117
- package/dist/FormSteps/PhoneInputStep/MaterialTextInputStep/MaterialPhoneInputStep.d.ts +1 -2
- package/dist/FormSteps/PhoneInputStep/MaterialTextInputStep/MaterialPhoneInputStep.js +15 -33
- package/dist/FormSteps/PhoneInputStep/PhoneInputStep.d.ts +0 -1
- package/dist/FormSteps/PhoneInputStep/PhoneInputStep.js +2 -13
- package/dist/FormSteps/RatingStep/MaterialRatingStep/MaterialRatingStep.d.ts +0 -1
- package/dist/FormSteps/RatingStep/MaterialRatingStep/MaterialRatingStep.js +17 -31
- package/dist/FormSteps/RatingStep/RatingStep.d.ts +0 -1
- package/dist/FormSteps/RatingStep/RatingStep.js +2 -13
- package/dist/FormSteps/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.d.ts +0 -1
- package/dist/FormSteps/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.js +35 -61
- package/dist/FormSteps/SelectorStep/SelectorStep.d.ts +0 -1
- package/dist/FormSteps/SelectorStep/SelectorStep.js +2 -13
- package/dist/FormSteps/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.d.ts +0 -1
- package/dist/FormSteps/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.js +2 -3
- package/dist/FormSteps/SeparatorStep/SeparatorStep.d.ts +0 -1
- package/dist/FormSteps/SeparatorStep/SeparatorStep.js +2 -13
- package/dist/FormSteps/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.d.ts +1 -2
- package/dist/FormSteps/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +77 -142
- package/dist/FormSteps/SmartSelectStep/SmartSelectStep.d.ts +5 -5
- package/dist/FormSteps/SmartSelectStep/SmartSelectStep.js +2 -13
- package/dist/FormSteps/Step.d.ts +0 -1
- package/dist/FormSteps/Step.js +29 -58
- package/dist/FormSteps/StepFunctions.d.ts +4 -6
- package/dist/FormSteps/StepFunctions.js +149 -204
- package/dist/FormSteps/StepFunctions.test.d.ts +1 -0
- package/dist/FormSteps/StepFunctions.test.js +695 -0
- package/dist/FormSteps/StepHooks.d.ts +68 -14
- package/dist/FormSteps/StepHooks.js +94 -146
- package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaEditorStep.d.ts +0 -1
- package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaEditorStep.js +38 -74
- package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.d.ts +1 -2
- package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.js +12 -28
- package/dist/FormSteps/TextAreaStep/TextAreaStep.d.ts +0 -1
- package/dist/FormSteps/TextAreaStep/TextAreaStep.js +3 -14
- package/dist/FormSteps/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.d.ts +1 -2
- package/dist/FormSteps/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js +12 -30
- package/dist/FormSteps/TextInputStep/TextInputStep.d.ts +1 -2
- package/dist/FormSteps/TextInputStep/TextInputStep.js +2 -13
- package/dist/FormSteps/TimePickerStep/MaterialTimePickerStep/MaterialTimePickerStep.d.ts +1 -2
- package/dist/FormSteps/TimePickerStep/MaterialTimePickerStep/MaterialTimePickerStep.js +9 -26
- package/dist/FormSteps/TimePickerStep/TimePickerStep.d.ts +0 -1
- package/dist/FormSteps/TimePickerStep/TimePickerStep.js +2 -13
- package/dist/FormSteps/TitleStep/MaterialTitleStep/MaterialTitleStep.d.ts +0 -1
- package/dist/FormSteps/TitleStep/MaterialTitleStep/MaterialTitleStep.js +13 -26
- package/dist/FormSteps/TitleStep/TitleStep.d.ts +0 -1
- package/dist/FormSteps/TitleStep/TitleStep.js +2 -13
- package/dist/FormSteps/Utils/@StepFiller/StepFiller.d.ts +1 -1
- package/dist/FormSteps/Utils/@StepFiller/StepFiller.js +14 -26
- package/dist/FormSteps/Utils/MaterialInputContainer/MaterialInputContainer.d.ts +0 -1
- package/dist/FormSteps/Utils/MaterialInputContainer/MaterialInputContainer.js +6 -18
- package/dist/Icons/@IconTypes.d.ts +0 -1
- package/dist/Icons/ArrowLeftIcon.d.ts +3 -0
- package/dist/Icons/ArrowLeftIcon.js +6 -0
- package/dist/Icons/ArrowRightIcon.d.ts +3 -0
- package/dist/Icons/ArrowRightIcon.js +6 -0
- package/dist/Icons/CalendarIcon.d.ts +1 -2
- package/dist/Icons/CalendarIcon.js +3 -14
- package/dist/Icons/CheckCircleIcon.d.ts +3 -0
- package/dist/Icons/CheckCircleIcon.js +6 -0
- package/dist/Icons/CheckboxCheckedIcon.d.ts +3 -0
- package/dist/Icons/CheckboxCheckedIcon.js +6 -0
- package/dist/Icons/CheckboxUncheckedIcon.d.ts +3 -0
- package/dist/Icons/CheckboxUncheckedIcon.js +6 -0
- package/dist/Icons/ClockIcon.d.ts +3 -0
- package/dist/Icons/ClockIcon.js +6 -0
- package/dist/Icons/CloseIcon.d.ts +3 -0
- package/dist/Icons/CloseIcon.js +6 -0
- package/dist/Icons/Construction/LeakIcon.d.ts +2 -2
- package/dist/Icons/Construction/LeakIcon.js +3 -14
- package/dist/Icons/Construction/ProjectIcon.d.ts +2 -2
- package/dist/Icons/Construction/ProjectIcon.js +3 -14
- package/dist/Icons/Construction/PropertyIcon.d.ts +2 -2
- package/dist/Icons/Construction/PropertyIcon.js +3 -14
- package/dist/Icons/Construction/SpaceIcon.d.ts +2 -2
- package/dist/Icons/Construction/SpaceIcon.js +3 -14
- package/dist/Icons/DeleteIcon.d.ts +3 -0
- package/dist/Icons/DeleteIcon.js +6 -0
- package/dist/Icons/DocumentIcon.d.ts +2 -2
- package/dist/Icons/DocumentIcon.js +3 -14
- package/dist/Icons/Entities/CheckListIcon.d.ts +2 -2
- package/dist/Icons/Entities/CheckListIcon.js +3 -14
- package/dist/Icons/Entities/GenericEntityIcon.d.ts +2 -2
- package/dist/Icons/Entities/GenericEntityIcon.js +4 -15
- package/dist/Icons/Entities/HandshakeIcon.d.ts +2 -2
- package/dist/Icons/Entities/HandshakeIcon.js +4 -15
- package/dist/Icons/Entities/SupplierIcon.d.ts +2 -2
- package/dist/Icons/Entities/SupplierIcon.js +4 -15
- package/dist/Icons/ErkIcon.module.css +9 -0
- package/dist/Icons/ErrorIcon.d.ts +3 -0
- package/dist/Icons/ErrorIcon.js +6 -0
- package/dist/Icons/ExpandLessIcon.d.ts +3 -0
- package/dist/Icons/ExpandLessIcon.js +6 -0
- package/dist/Icons/ExpandMoreIcon.d.ts +3 -0
- package/dist/Icons/ExpandMoreIcon.js +6 -0
- package/dist/Icons/FileIcon.d.ts +3 -0
- package/dist/Icons/FileIcon.js +6 -0
- package/dist/Icons/InfoIcon.d.ts +3 -0
- package/dist/Icons/InfoIcon.js +6 -0
- package/dist/Icons/LocationIcon.d.ts +1 -2
- package/dist/Icons/LocationIcon.js +3 -14
- package/dist/Icons/PersonIcon.d.ts +1 -2
- package/dist/Icons/PersonIcon.js +4 -15
- package/dist/Icons/Ratings/DislikeIcon.d.ts +3 -0
- package/dist/Icons/Ratings/DislikeIcon.js +6 -0
- package/dist/Icons/Ratings/DissatisfiedIcon.d.ts +3 -0
- package/dist/Icons/Ratings/DissatisfiedIcon.js +6 -0
- package/dist/Icons/Ratings/LikeIcon.d.ts +3 -0
- package/dist/Icons/Ratings/LikeIcon.js +6 -0
- package/dist/Icons/Ratings/SatisfiedIcon.d.ts +3 -0
- package/dist/Icons/Ratings/SatisfiedIcon.js +6 -0
- package/dist/Icons/Ratings/StarIcon.d.ts +3 -0
- package/dist/Icons/Ratings/StarIcon.js +6 -0
- package/dist/Icons/Ratings/VeryDissatisfiedIcon.d.ts +3 -0
- package/dist/Icons/Ratings/VeryDissatisfiedIcon.js +6 -0
- package/dist/Icons/Ratings/VerySatisfiedIcon.d.ts +3 -0
- package/dist/Icons/Ratings/VerySatisfiedIcon.js +6 -0
- package/dist/Icons/WarningIcon.d.ts +3 -0
- package/dist/Icons/WarningIcon.js +6 -0
- package/dist/Init.d.ts +1 -0
- package/dist/Init.js +2 -0
- package/dist/Services/FileService.d.ts +1 -1
- package/dist/Services/FileService.js +29 -86
- package/dist/Services/FormService.js +11 -56
- package/dist/Services/OrganizationService.js +11 -62
- package/dist/Shared/CustomBtn/CustomBtn.d.ts +1 -2
- package/dist/Shared/CustomBtn/CustomBtn.js +25 -88
- package/dist/Shared/{RoundedButton/RoundedButton.d.ts → ErkButton/ErkButton.d.ts} +6 -5
- package/dist/Shared/ErkButton/ErkButton.js +31 -0
- package/dist/Shared/{RoundedButton/RoundedButton.stories.d.ts → ErkButton/ErkButton.stories.d.ts} +2 -2
- package/dist/Shared/{RoundedButton/RoundedButton.stories.js → ErkButton/ErkButton.stories.js} +6 -6
- package/dist/Shared/ErkCheckbox/ErkCheckBox.d.ts +19 -0
- package/dist/Shared/ErkCheckbox/ErkCheckBox.js +30 -0
- package/dist/Shared/{RoundedCheckBox/RoundedCheckBox.stories.d.ts → ErkCheckbox/ErkCheckBox.stories.d.ts} +2 -7
- package/dist/Shared/ErkCheckbox/ErkCheckBox.stories.js +37 -0
- package/dist/Shared/ErkDatePicker/ErkDatePicker.d.ts +16 -0
- package/dist/Shared/ErkDatePicker/ErkDatePicker.js +210 -0
- package/dist/Shared/{RoundedDatePicker/RoundedDatePicker.stories.d.ts → ErkDatePicker/ErkDatePicker.stories.d.ts} +3 -16
- package/dist/Shared/ErkDatePicker/ErkDatePicker.stories.js +103 -0
- package/dist/Shared/ErkPhoneInput/EkrPhoneInput.d.ts +16 -0
- package/dist/Shared/ErkPhoneInput/EkrPhoneInput.js +83 -0
- package/dist/Shared/ErkSelect/ErkSelect.d.ts +39 -0
- package/dist/Shared/ErkSelect/ErkSelect.js +90 -0
- package/dist/Shared/{RoundedSelect/RoundedSelect.stories.d.ts → ErkSelect/ErkSelect.stories.d.ts} +2 -12
- package/dist/Shared/ErkSelect/ErkSelect.stories.js +64 -0
- package/dist/Shared/ErkSmartSelect/ErkSmartSelect.d.ts +28 -0
- package/dist/Shared/ErkSmartSelect/ErkSmartSelect.js +56 -0
- package/dist/Shared/{RoundedSmartSelect/RoundedSmartSelect.stories.d.ts → ErkSmartSelect/ErkSmartSelect.stories.d.ts} +2 -12
- package/dist/Shared/ErkSmartSelect/ErkSmartSelect.stories.js +167 -0
- package/dist/Shared/ErkTextField/ErkTextField.d.ts +26 -0
- package/dist/Shared/ErkTextField/ErkTextField.js +111 -0
- package/dist/Shared/{RoundedTextField/RoundedTextField.stories.d.ts → ErkTextField/ErkTextField.stories.d.ts} +3 -16
- package/dist/Shared/ErkTextField/ErkTextField.stories.js +105 -0
- package/dist/Shared/{RoundedTimePicker/RoundedTimePicker.d.ts → ErkTimePicker/ErkTimePicker.d.ts} +6 -16
- package/dist/Shared/ErkTimePicker/ErkTimePicker.js +131 -0
- package/dist/Shared/InputIcon/InputIcon.d.ts +2 -2
- package/dist/Shared/InputIcon/InputIcon.js +25 -48
- package/dist/Shared/Loader/Loader.d.ts +0 -1
- package/dist/Shared/Loader/Loader.js +6 -18
- package/dist/Shared/Navbar/Navbar.d.ts +0 -1
- package/dist/Shared/Navbar/Navbar.js +2 -14
- package/dist/Shared/Navbar/Navbar.stories.js +2 -2
- package/dist/Shared/Rating/Rating.d.ts +3 -5
- package/dist/Shared/Rating/Rating.js +4 -27
- package/dist/Shared/Rating/Rating.stories.js +13 -19
- package/dist/Shared/Rating/Ratings/LikeRating.d.ts +1 -2
- package/dist/Shared/Rating/Ratings/LikeRating.js +19 -33
- package/dist/Shared/Rating/Ratings/SatisfactionRating.d.ts +1 -2
- package/dist/Shared/Rating/Ratings/SatisfactionRating.js +27 -47
- package/dist/Shared/Rating/Ratings/ScaleRating.d.ts +1 -2
- package/dist/Shared/Rating/Ratings/ScaleRating.js +23 -54
- package/dist/Shared/Toggle/Toggle.d.ts +4 -14
- package/dist/Shared/Toggle/Toggle.js +11 -34
- package/dist/States/GlobalSlice.d.ts +4 -4
- package/dist/States/GlobalSlice.js +6 -17
- package/dist/States/SiteSlice.d.ts +30 -48
- package/dist/States/SiteSlice.js +58 -76
- package/dist/States/WidthStatsSlice.d.ts +2 -2
- package/dist/States/WidthStatsSlice.js +8 -9
- package/dist/Utils/AxiosAPI.js +3 -3
- package/dist/Utils/AxiosWidget.js +4 -4
- package/dist/Utils/CBRFunctions.js +29 -30
- package/dist/Utils/DraftFunctions.d.ts +3 -3
- package/dist/Utils/DraftFunctions.js +102 -143
- package/dist/Utils/FormStepFunctions.d.ts +1 -1
- package/dist/Utils/FormStepFunctions.js +27 -45
- package/dist/Utils/LocaleUtils.d.ts +2 -0
- package/dist/Utils/LocaleUtils.js +12 -0
- package/dist/Utils/MaterialProviders.d.ts +20 -1
- package/dist/Utils/MaterialProviders.js +43 -28
- package/dist/Utils/MuiClassnameSetup.js +3 -0
- package/dist/Utils/PhoneFunctions.js +5 -5
- package/dist/Utils/TestUtils.d.ts +55 -62
- package/dist/Utils/TestUtils.js +22 -51
- package/dist/Utils/store.d.ts +4 -2
- package/dist/Utils/store.js +10 -65
- package/dist/Widget.js +15 -26
- package/dist/constants/Draft/DraftEntityDataTypes.d.ts +3 -3
- package/dist/constants/Files/FileExtensions.js +3 -3
- package/dist/constants/Files/FileMaxSize.js +1 -1
- package/dist/constants/InternalFormStyle.js +1 -1
- package/dist/hooks.js +14 -16
- package/dist/index.css +4 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +22 -0
- package/package.json +108 -124
- package/dist/Shared/RoundedButton/RoundedButton.js +0 -45
- package/dist/Shared/RoundedCheckBox/RoundedCheckBox.d.ts +0 -24
- package/dist/Shared/RoundedCheckBox/RoundedCheckBox.js +0 -101
- package/dist/Shared/RoundedCheckBox/RoundedCheckBox.stories.js +0 -50
- package/dist/Shared/RoundedDatePicker/RoundedDatePicker.d.ts +0 -49
- package/dist/Shared/RoundedDatePicker/RoundedDatePicker.js +0 -351
- package/dist/Shared/RoundedDatePicker/RoundedDatePicker.stories.js +0 -223
- package/dist/Shared/RoundedPhoneInput/RoundedPhoneInput.d.ts +0 -43
- package/dist/Shared/RoundedPhoneInput/RoundedPhoneInput.js +0 -226
- package/dist/Shared/RoundedSelect/RoundedSelect.d.ts +0 -68
- package/dist/Shared/RoundedSelect/RoundedSelect.js +0 -214
- package/dist/Shared/RoundedSelect/RoundedSelect.stories.js +0 -91
- package/dist/Shared/RoundedSmartSelect/RoundedSmartSelect.d.ts +0 -63
- package/dist/Shared/RoundedSmartSelect/RoundedSmartSelect.js +0 -236
- package/dist/Shared/RoundedSmartSelect/RoundedSmartSelect.stories.js +0 -318
- package/dist/Shared/RoundedTextField/RoundedTextField.d.ts +0 -45
- package/dist/Shared/RoundedTextField/RoundedTextField.js +0 -175
- package/dist/Shared/RoundedTextField/RoundedTextField.stories.js +0 -224
- package/dist/Shared/RoundedTimePicker/RoundedTimePicker.js +0 -314
- package/dist/__mocks__/axios.d.ts +0 -2
- package/dist/__mocks__/axios.js +0 -2
- package/dist/constants/MaterialClassNameSeed.js +0 -1
- package/dist/index.js +0 -31
- /package/dist/{index.d.ts → App/AppFunctions.test.d.ts} +0 -0
- /package/dist/Shared/{RoundedTimePicker/RoundedTimePicker.module.css → ErkTimePicker/ErkTimePicker.module.css} +0 -0
- /package/dist/{constants/MaterialClassNameSeed.d.ts → Utils/MuiClassnameSetup.d.ts} +0 -0
- /package/dist/{setupTests.d.ts → __tests__/setup.d.ts} +0 -0
- /package/dist/{setupTests.js → __tests__/setup.js} +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
|
2
|
+
import { CheckboxProps as MuiCheckboxProps } from '@mui/material';
|
|
3
|
+
interface StyleProps {
|
|
4
|
+
size?: CSSProperties['fontSize'];
|
|
5
|
+
padding?: string;
|
|
6
|
+
error?: number;
|
|
7
|
+
}
|
|
8
|
+
interface ErkCheckboxProps extends Omit<StyleProps, 'error'>, Omit<MuiCheckboxProps, 'size' | 'onChange'> {
|
|
9
|
+
onChange?: (checked: boolean) => void;
|
|
10
|
+
checked: boolean;
|
|
11
|
+
error?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Generic datepicker with apps designs. Is class due to the use in the react-hook-forms library
|
|
15
|
+
*/
|
|
16
|
+
declare class ErkCheckbox extends React.Component<ErkCheckboxProps> {
|
|
17
|
+
render(): JSX.Element;
|
|
18
|
+
}
|
|
19
|
+
export default ErkCheckbox;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import CheckboxUncheckedIcon from '../../Icons/CheckboxUncheckedIcon';
|
|
4
|
+
import CheckboxCheckedIcon from '../../Icons/CheckboxCheckedIcon';
|
|
5
|
+
import { FormControl, Checkbox as MuiCheckbox, styled } from '@mui/material';
|
|
6
|
+
const StyledCheckbox = styled(MuiCheckbox)(({ theme, size = '1.5rem', padding = '9px', disabled, readOnly, error }) => ({
|
|
7
|
+
padding: padding,
|
|
8
|
+
fontSize: size,
|
|
9
|
+
opacity: disabled ? 0.5 : 1,
|
|
10
|
+
pointerEvents: readOnly ? 'none' : undefined,
|
|
11
|
+
color: error ? theme.palette.error.main : '#787878',
|
|
12
|
+
'&.Mui-disabled': {
|
|
13
|
+
color: '#A0A0A0',
|
|
14
|
+
},
|
|
15
|
+
}));
|
|
16
|
+
/**
|
|
17
|
+
* Generic capta checkbox
|
|
18
|
+
*/
|
|
19
|
+
function CustomCheckBox({ onChange, error = false, readOnly = false, disabled = false, ...others }) {
|
|
20
|
+
return (_jsx(FormControl, { error: true, children: _jsx(StyledCheckbox, { ...others, error: +error, readOnly: readOnly, disabled: disabled, inputProps: { disabled: disabled || readOnly }, icon: _jsx(CheckboxUncheckedIcon, { style: { fontSize: 'inherit' } }), checkedIcon: _jsx(CheckboxCheckedIcon, { style: { fontSize: 'inherit' } }), onChange: (event) => onChange?.(typeof event === 'boolean' ? event : event.target.checked) }) }));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Generic datepicker with apps designs. Is class due to the use in the react-hook-forms library
|
|
24
|
+
*/
|
|
25
|
+
class ErkCheckbox extends React.Component {
|
|
26
|
+
render() {
|
|
27
|
+
return _jsx(CustomCheckBox, { ...this.props });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export default ErkCheckbox;
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import type { StoryObj } from '@storybook/react';
|
|
2
|
-
import
|
|
2
|
+
import ErkCheckBox from './ErkCheckBox';
|
|
3
3
|
declare const meta: {
|
|
4
|
-
component: typeof
|
|
4
|
+
component: typeof ErkCheckBox;
|
|
5
5
|
tags: string[];
|
|
6
6
|
args: {
|
|
7
|
-
checkedColor: string;
|
|
8
|
-
uncheckedColor: string;
|
|
9
|
-
disabledColor: string;
|
|
10
7
|
size: string;
|
|
11
|
-
errorColor: string;
|
|
12
8
|
};
|
|
13
9
|
};
|
|
14
10
|
export default meta;
|
|
@@ -18,4 +14,3 @@ export declare const Checked: Story;
|
|
|
18
14
|
export declare const Error: Story;
|
|
19
15
|
export declare const Disabled: Story;
|
|
20
16
|
export declare const ErrorColor: Story;
|
|
21
|
-
export declare const DifferentColors: Story;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import ErkCheckBox from './ErkCheckBox';
|
|
2
|
+
const meta = {
|
|
3
|
+
component: ErkCheckBox,
|
|
4
|
+
tags: ['autodocs'],
|
|
5
|
+
args: {
|
|
6
|
+
size: '1.5rem',
|
|
7
|
+
},
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
export const Uncheked = {
|
|
11
|
+
args: {
|
|
12
|
+
checked: false,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
export const Checked = {
|
|
16
|
+
args: {
|
|
17
|
+
checked: true,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
export const Error = {
|
|
21
|
+
args: {
|
|
22
|
+
checked: false,
|
|
23
|
+
error: true,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
export const Disabled = {
|
|
27
|
+
args: {
|
|
28
|
+
checked: false,
|
|
29
|
+
disabled: true,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
export const ErrorColor = {
|
|
33
|
+
args: {
|
|
34
|
+
checked: false,
|
|
35
|
+
error: true,
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MobileDatePickerProps as MuiDatePickerProps, PickerValidDate } from '@mui/x-date-pickers';
|
|
3
|
+
import { ErkTextFieldProps } from '../ErkTextField/ErkTextField';
|
|
4
|
+
interface ErkDatePickerProps extends Omit<MuiDatePickerProps<PickerValidDate>, 'ref' | 'onChange'>, Pick<ErkTextFieldProps, 'error' | 'required' | 'helperText'> {
|
|
5
|
+
onChange?: (date: Date | null) => void;
|
|
6
|
+
/** If it should display the timePicker */
|
|
7
|
+
pickTime?: boolean;
|
|
8
|
+
inputRef?: React.Ref<HTMLInputElement>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Generic datepicker with apps designs. Is class due to the use in the react-hook-forms library
|
|
12
|
+
*/
|
|
13
|
+
declare class ErkDatePicker extends React.Component<ErkDatePickerProps> {
|
|
14
|
+
render(): JSX.Element;
|
|
15
|
+
}
|
|
16
|
+
export default ErkDatePicker;
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import CalendarIcon from '../../Icons/CalendarIcon';
|
|
4
|
+
import { styled, Dialog as MuiDialog } from '@mui/material';
|
|
5
|
+
import { MobileDatePicker as MuiDatePicker, MobileDateTimePicker as MuiDateTimePicker, DatePickerToolbar as MuiDatePickerToolbar, DateTimePickerToolbar as MuiDateTimePickerToolbar, PickersDay as MuiPickerDay, } from '@mui/x-date-pickers';
|
|
6
|
+
import { StyledTextField } from '../ErkTextField/ErkTextField';
|
|
7
|
+
const StyledDateTimePicker = styled(MuiDateTimePicker)(({ ...props }) => ({
|
|
8
|
+
'& .EF-MuiInputBase-root': {
|
|
9
|
+
cursor: props.disabled ? 'default' : 'pointer',
|
|
10
|
+
'& input': {
|
|
11
|
+
cursor: props.disabled ? 'default' : 'pointer',
|
|
12
|
+
paddingRight: '0px',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
}));
|
|
16
|
+
const StyledDatePicker = styled(MuiDatePicker)(({ ...props }) => ({
|
|
17
|
+
'& .EF-MuiInputBase-root': {
|
|
18
|
+
cursor: props.disabled ? 'default' : 'pointer',
|
|
19
|
+
'& input': {
|
|
20
|
+
cursor: props.disabled ? 'default' : 'pointer',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
}));
|
|
24
|
+
const StyledDateTimeToolBar = styled(MuiDateTimePickerToolbar)(({ theme }) => ({
|
|
25
|
+
'&.MuiPickersToolbar-root': {
|
|
26
|
+
backgroundColor: theme.palette.primary.main,
|
|
27
|
+
color: theme.palette.primary.contrastText,
|
|
28
|
+
'& span': {
|
|
29
|
+
fontSize: '1rem',
|
|
30
|
+
textTransform: 'capitalize',
|
|
31
|
+
color: theme.palette.primary.contrastText,
|
|
32
|
+
},
|
|
33
|
+
'& .MuiDateTimePickerToolbar-dateContainer': {
|
|
34
|
+
'& span': {
|
|
35
|
+
fontSize: '1.1rem',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
'& .MuiDateTimePickerToolbar-timeDigitsContainer': {
|
|
39
|
+
'& span': {
|
|
40
|
+
fontSize: '2.3rem',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
'& .MuiDateTimePickerToolbar-ampmSelection': {
|
|
44
|
+
'& span': {
|
|
45
|
+
color: theme.palette.primary.contrastText + '8b',
|
|
46
|
+
'&.Mui-selected': {
|
|
47
|
+
color: theme.palette.primary.contrastText,
|
|
48
|
+
fontWeight: 600,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
cursor: 'default',
|
|
54
|
+
'& .MuiTypography-root': {
|
|
55
|
+
textTransform: 'capitalize',
|
|
56
|
+
color: theme.palette.primary.contrastText,
|
|
57
|
+
},
|
|
58
|
+
}));
|
|
59
|
+
const StyledDateToolBar = styled(MuiDatePickerToolbar)(({ theme }) => ({
|
|
60
|
+
'&.MuiPickersToolbar-root': {
|
|
61
|
+
backgroundColor: theme.palette.primary.main,
|
|
62
|
+
color: theme.palette.primary.contrastText,
|
|
63
|
+
'& span': {
|
|
64
|
+
fontSize: '1rem',
|
|
65
|
+
textTransform: 'capitalize',
|
|
66
|
+
color: theme.palette.primary.contrastText,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
cursor: 'default',
|
|
70
|
+
'& .MuiTypography-root': {
|
|
71
|
+
textTransform: 'capitalize',
|
|
72
|
+
color: theme.palette.primary.contrastText,
|
|
73
|
+
},
|
|
74
|
+
}));
|
|
75
|
+
const StyledDialog = styled(MuiDialog)(({ theme }) => ({
|
|
76
|
+
'& .MuiDialog-paper': {
|
|
77
|
+
borderRadius: '5px',
|
|
78
|
+
backgroundColor: 'transparent',
|
|
79
|
+
},
|
|
80
|
+
'& .EF-MuiDialogActions-root': {
|
|
81
|
+
'& .EF-MuiButtonBase-root': { fontWeight: 700 },
|
|
82
|
+
},
|
|
83
|
+
'& .MuiDialogContent-root': { scrollbarColor: theme.palette.primary.main + ' white' },
|
|
84
|
+
'& .MuiDayCalendar-weekDayLabel': {
|
|
85
|
+
cursor: 'default',
|
|
86
|
+
},
|
|
87
|
+
'& .MuiPickersCalendarHeader-root': {
|
|
88
|
+
marginTop: 5,
|
|
89
|
+
},
|
|
90
|
+
'& .MuiDateCalendar-root': {
|
|
91
|
+
height: 'fit-content',
|
|
92
|
+
},
|
|
93
|
+
'& .MuiPickersSlideTransition-root': {
|
|
94
|
+
minHeight: '195px',
|
|
95
|
+
},
|
|
96
|
+
'& .MuiClock-root': {
|
|
97
|
+
marginTop: '34px',
|
|
98
|
+
marginBottom: '30px',
|
|
99
|
+
},
|
|
100
|
+
'& .MuiTimeClock-arrowSwitcher': {
|
|
101
|
+
top: 5,
|
|
102
|
+
},
|
|
103
|
+
}));
|
|
104
|
+
const StyledDay = styled(MuiPickerDay)(({ theme }) => ({
|
|
105
|
+
fontWeight: 500,
|
|
106
|
+
fontSize: '0.9rem',
|
|
107
|
+
lineHeight: 'normal',
|
|
108
|
+
'&.MuiPickersDay-today': {
|
|
109
|
+
backgroundColor: theme.palette.primary.main + '33',
|
|
110
|
+
},
|
|
111
|
+
'&.MuiPickersDay-dayOutsideMonth': {
|
|
112
|
+
color: 'rgb(0,0,0,0.4)',
|
|
113
|
+
'&.Mui-selected': {
|
|
114
|
+
color: theme.palette.primary.contrastText,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
}));
|
|
118
|
+
function CustomDatePicker({ error, required, disabled, readOnly, helperText, pickTime = false, ...others }) {
|
|
119
|
+
if (pickTime) {
|
|
120
|
+
return (_jsx(StyledDateTimePicker, { ...others, disabled: disabled ?? readOnly, defaultValue: required ? new Date() : undefined, showDaysOutsideCurrentMonth: true, slotProps: {
|
|
121
|
+
actionBar: {
|
|
122
|
+
actions: ['clear', 'accept'],
|
|
123
|
+
},
|
|
124
|
+
layout: {
|
|
125
|
+
sx: {
|
|
126
|
+
backgroundColor: '#ffffff',
|
|
127
|
+
textTransform: 'capitalize',
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
monthButton: {
|
|
131
|
+
sx: {
|
|
132
|
+
textTransform: 'capitalize',
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
toolbar: {
|
|
136
|
+
toolbarFormat: 'eee, d MMM',
|
|
137
|
+
hidden: false,
|
|
138
|
+
toolbarPlaceholder: '– –',
|
|
139
|
+
},
|
|
140
|
+
textField: {
|
|
141
|
+
error,
|
|
142
|
+
disabled,
|
|
143
|
+
helperText,
|
|
144
|
+
placeholder: '',
|
|
145
|
+
InputProps: {
|
|
146
|
+
disabled: disabled ?? readOnly,
|
|
147
|
+
endAdornment: (_jsx(CalendarIcon, { style: {
|
|
148
|
+
width: 27,
|
|
149
|
+
height: 27,
|
|
150
|
+
} })),
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
}, slots: {
|
|
154
|
+
day: StyledDay,
|
|
155
|
+
dialog: StyledDialog,
|
|
156
|
+
toolbar: StyledDateTimeToolBar,
|
|
157
|
+
textField: StyledTextField,
|
|
158
|
+
} }));
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
return (_jsx(StyledDatePicker, { ...others, readOnly: readOnly, disabled: disabled ?? readOnly, defaultValue: required ? new Date() : undefined, showDaysOutsideCurrentMonth: true, views: ['year', 'month', 'day'], slotProps: {
|
|
162
|
+
actionBar: {
|
|
163
|
+
actions: ['clear', 'accept'],
|
|
164
|
+
},
|
|
165
|
+
layout: {
|
|
166
|
+
sx: {
|
|
167
|
+
backgroundColor: '#ffffff',
|
|
168
|
+
textTransform: 'capitalize',
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
monthButton: {
|
|
172
|
+
sx: {
|
|
173
|
+
textTransform: 'capitalize',
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
toolbar: {
|
|
177
|
+
toolbarFormat: 'eee, d MMM',
|
|
178
|
+
hidden: false,
|
|
179
|
+
toolbarPlaceholder: '– –',
|
|
180
|
+
},
|
|
181
|
+
textField: {
|
|
182
|
+
error,
|
|
183
|
+
disabled,
|
|
184
|
+
helperText,
|
|
185
|
+
placeholder: '',
|
|
186
|
+
InputProps: {
|
|
187
|
+
disabled: disabled ?? readOnly,
|
|
188
|
+
endAdornment: (_jsx(CalendarIcon, { style: {
|
|
189
|
+
width: 27,
|
|
190
|
+
height: 27,
|
|
191
|
+
} })),
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
}, localeText: {}, slots: {
|
|
195
|
+
day: StyledDay,
|
|
196
|
+
dialog: StyledDialog,
|
|
197
|
+
toolbar: StyledDateToolBar,
|
|
198
|
+
textField: StyledTextField,
|
|
199
|
+
} }));
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Generic datepicker with apps designs. Is class due to the use in the react-hook-forms library
|
|
204
|
+
*/
|
|
205
|
+
class ErkDatePicker extends React.Component {
|
|
206
|
+
render() {
|
|
207
|
+
return _jsx(CustomDatePicker, { ...this.props });
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
export default ErkDatePicker;
|
|
@@ -1,21 +1,10 @@
|
|
|
1
1
|
import type { StoryObj } from '@storybook/react';
|
|
2
|
-
import
|
|
2
|
+
import ErkDatePicker from './ErkDatePicker';
|
|
3
3
|
declare const meta: {
|
|
4
|
-
component: typeof
|
|
4
|
+
component: typeof ErkDatePicker;
|
|
5
5
|
tags: string[];
|
|
6
6
|
args: {
|
|
7
|
-
|
|
8
|
-
secondaryColor: string;
|
|
9
|
-
helperTextColor: string;
|
|
10
|
-
outlineColor: string;
|
|
11
|
-
backgroundColor: string;
|
|
12
|
-
textColor: string;
|
|
13
|
-
contrastColor: string;
|
|
14
|
-
accentColor: string;
|
|
15
|
-
errorColor: string;
|
|
16
|
-
fontSize: string;
|
|
17
|
-
fontWeight: string;
|
|
18
|
-
cantEdit: false;
|
|
7
|
+
readOnly: false;
|
|
19
8
|
};
|
|
20
9
|
parameters: {
|
|
21
10
|
date: Date;
|
|
@@ -32,5 +21,3 @@ export declare const Error: Story;
|
|
|
32
21
|
export declare const Menu: Story;
|
|
33
22
|
export declare const DateTimeDateMenu: Story;
|
|
34
23
|
export declare const DateTimeTimeMenu: Story;
|
|
35
|
-
export declare const ErrorColor: Story;
|
|
36
|
-
export declare const DifferentColors: Story;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useArgs } from '@storybook/preview-api';
|
|
3
|
+
import ErkDatePicker from './ErkDatePicker';
|
|
4
|
+
import { within, screen } from '@storybook/testing-library';
|
|
5
|
+
import { userEvent } from '@storybook/testing-library';
|
|
6
|
+
const meta = {
|
|
7
|
+
component: ErkDatePicker,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
args: {
|
|
10
|
+
readOnly: false,
|
|
11
|
+
},
|
|
12
|
+
parameters: {
|
|
13
|
+
date: new Date('07-21-2021'),
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
export default meta;
|
|
17
|
+
export const Empty = {
|
|
18
|
+
args: {
|
|
19
|
+
value: null,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
export const Default = {
|
|
23
|
+
args: {
|
|
24
|
+
label: 'Label',
|
|
25
|
+
value: new Date('07-21-2021'),
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export const ValueAndLabel = {
|
|
29
|
+
args: {
|
|
30
|
+
label: 'Label',
|
|
31
|
+
value: null,
|
|
32
|
+
},
|
|
33
|
+
render: function Component(args) {
|
|
34
|
+
const [, setArgs] = useArgs();
|
|
35
|
+
const onValueChange = (value) => {
|
|
36
|
+
args.onChange?.(value);
|
|
37
|
+
setArgs({ value });
|
|
38
|
+
};
|
|
39
|
+
return _jsx(ErkDatePicker, { ...args, ref: args, onChange: onValueChange });
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
export const Full = {
|
|
43
|
+
args: {
|
|
44
|
+
label: 'Label',
|
|
45
|
+
value: null,
|
|
46
|
+
helperText: 'Helper text',
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
export const FullDateTime = {
|
|
50
|
+
args: {
|
|
51
|
+
label: 'Label',
|
|
52
|
+
value: null,
|
|
53
|
+
helperText: 'Helper text',
|
|
54
|
+
pickTime: true,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
export const Error = {
|
|
58
|
+
args: {
|
|
59
|
+
label: 'Label',
|
|
60
|
+
value: null,
|
|
61
|
+
helperText: 'Helper text',
|
|
62
|
+
error: true,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
export const Menu = {
|
|
66
|
+
args: {
|
|
67
|
+
label: 'Label',
|
|
68
|
+
value: null,
|
|
69
|
+
},
|
|
70
|
+
play: async ({ canvasElement }) => {
|
|
71
|
+
const canvas = within(canvasElement);
|
|
72
|
+
const selector = canvas.getByTestId('date-picker');
|
|
73
|
+
await userEvent.click(selector);
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
export const DateTimeDateMenu = {
|
|
77
|
+
args: {
|
|
78
|
+
label: 'Label',
|
|
79
|
+
value: null,
|
|
80
|
+
pickTime: true,
|
|
81
|
+
},
|
|
82
|
+
play: async ({ canvasElement }) => {
|
|
83
|
+
const canvas = within(canvasElement);
|
|
84
|
+
const selector = canvas.getByTestId('date-picker');
|
|
85
|
+
await userEvent.click(selector);
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
export const DateTimeTimeMenu = {
|
|
89
|
+
args: {
|
|
90
|
+
label: 'Label',
|
|
91
|
+
value: null,
|
|
92
|
+
pickTime: true,
|
|
93
|
+
},
|
|
94
|
+
play: async ({ canvasElement }) => {
|
|
95
|
+
const canvas = within(canvasElement);
|
|
96
|
+
const selector = canvas.getByTestId('date-picker');
|
|
97
|
+
await userEvent.click(selector);
|
|
98
|
+
const time = screen.getByText('12', {
|
|
99
|
+
selector: 'h3',
|
|
100
|
+
});
|
|
101
|
+
await userEvent.click(time);
|
|
102
|
+
},
|
|
103
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextFieldProps as MuiTextFieldProps } from '@mui/material';
|
|
3
|
+
interface ErkPhoneInputProps {
|
|
4
|
+
/** The value of the phoneinput */
|
|
5
|
+
value?: string;
|
|
6
|
+
onChange: (value: string) => void;
|
|
7
|
+
inputRef?: any;
|
|
8
|
+
readOnly?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Generic phoneinput with apps designs. Is class due to the use in the react-hook-forms library
|
|
12
|
+
*/
|
|
13
|
+
declare class ErkPhoneInput extends React.Component<ErkPhoneInputProps & Omit<MuiTextFieldProps, 'onChange'>> {
|
|
14
|
+
render(): JSX.Element;
|
|
15
|
+
}
|
|
16
|
+
export default ErkPhoneInput;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
|
+
import parse from 'libphonenumber-js/max';
|
|
4
|
+
import { defaultCountries, FlagImage, parseCountry, usePhoneInput } from 'react-international-phone';
|
|
5
|
+
import { useAppSelector } from '../../hooks';
|
|
6
|
+
import isoCountries from 'i18n-iso-countries';
|
|
7
|
+
import es from 'i18n-iso-countries/langs/es.json';
|
|
8
|
+
import { InputAdornment, Select, styled } from '@mui/material';
|
|
9
|
+
import { MenuItem } from '@mui/material';
|
|
10
|
+
import { StyledTextField } from '../ErkTextField/ErkTextField';
|
|
11
|
+
isoCountries.registerLocale(es);
|
|
12
|
+
const StyledSelect = styled(Select)(({ theme }) => ({
|
|
13
|
+
padding: 0,
|
|
14
|
+
input: {
|
|
15
|
+
padding: 0,
|
|
16
|
+
},
|
|
17
|
+
'& .EF-MuiSelect-select.EF-MuiInputBase-inputSizeSmall': {
|
|
18
|
+
paddingBottom: 0,
|
|
19
|
+
borderBottom: 'none',
|
|
20
|
+
},
|
|
21
|
+
backgroundColor: theme.palette.stepBackgroundColor.default,
|
|
22
|
+
'& input': {
|
|
23
|
+
padding: 0,
|
|
24
|
+
margin: 0,
|
|
25
|
+
},
|
|
26
|
+
'&.EF-MuiInputBase-root::before': {
|
|
27
|
+
borderBottom: 'none !important',
|
|
28
|
+
},
|
|
29
|
+
'&.EF-MuiInput-underline::after': {
|
|
30
|
+
borderBottom: 'none',
|
|
31
|
+
},
|
|
32
|
+
}));
|
|
33
|
+
function CustomPhoneInput({ value, onChange, inputRef, readOnly = false, disabled = false, ...others }) {
|
|
34
|
+
const defaultCountry = useAppSelector((state) => state.global.countryCode);
|
|
35
|
+
const { inputValue, handlePhoneValueChange, inputRef: phoneRef, country, setCountry, } = usePhoneInput({
|
|
36
|
+
value: '+' + value,
|
|
37
|
+
inputRef,
|
|
38
|
+
defaultCountry: defaultCountry.toLowerCase(),
|
|
39
|
+
disableDialCodePrefill: true,
|
|
40
|
+
disableDialCodeAndPrefix: true,
|
|
41
|
+
onChange: (data) => onChange(data.phone.replace('+', '')),
|
|
42
|
+
});
|
|
43
|
+
const countries = useMemo(() => defaultCountries
|
|
44
|
+
.map((c) => {
|
|
45
|
+
const country = parseCountry(c);
|
|
46
|
+
return {
|
|
47
|
+
country,
|
|
48
|
+
name: isoCountries.getName(country.iso2.toUpperCase(), 'es') ?? country.name,
|
|
49
|
+
};
|
|
50
|
+
})
|
|
51
|
+
.sort((a, b) => a.name.localeCompare(b.name)), []);
|
|
52
|
+
return (_jsx("div", { style: { position: 'relative', width: '100%', maxWidth: '100%' }, children: _jsx(StyledTextField, { ...others, value: inputValue, readOnly: readOnly, disabled: disabled, fullWidth: true, size: "small", variant: "outlined", onChange: handlePhoneValueChange, type: "tel", padding: "6px 12px 6px 6px", autoComplete: "tel", inputRef: phoneRef, onPaste: (e) => {
|
|
53
|
+
const value = e.clipboardData.getData('Text');
|
|
54
|
+
if (!value.startsWith('+')) {
|
|
55
|
+
const phone = parse('+' + value);
|
|
56
|
+
if (phone?.isValid()) {
|
|
57
|
+
e.preventDefault();
|
|
58
|
+
if (phone.country)
|
|
59
|
+
setCountry(phone.country.toLowerCase());
|
|
60
|
+
onChange(phone.number);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}, slotProps: {
|
|
64
|
+
input: {
|
|
65
|
+
disabled: readOnly || disabled,
|
|
66
|
+
startAdornment: (_jsx(InputAdornment, { position: "start", children: _jsx(StyledSelect, { size: "small", variant: "standard", value: country.iso2, inputProps: { disabled: readOnly || disabled }, onChange: (e) => setCountry(e.target.value), renderValue: (value) => (_jsx(FlagImage, { iso2: value, style: { display: 'flex' }, width: 20 })), children: countries.map(({ country, name }) => {
|
|
67
|
+
return (_jsxs(MenuItem, { value: country.iso2, children: [_jsx(FlagImage, { iso2: country.iso2, size: 20 }), _jsx("span", { style: {
|
|
68
|
+
marginLeft: '8px',
|
|
69
|
+
marginRight: '8px',
|
|
70
|
+
}, children: name }), _jsxs("span", { style: { color: 'grey' }, children: ["+", country.dialCode] })] }, country.iso2));
|
|
71
|
+
}) }) })),
|
|
72
|
+
},
|
|
73
|
+
} }) }));
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Generic phoneinput with apps designs. Is class due to the use in the react-hook-forms library
|
|
77
|
+
*/
|
|
78
|
+
class ErkPhoneInput extends React.Component {
|
|
79
|
+
render() {
|
|
80
|
+
return _jsx(CustomPhoneInput, { ...this.props });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export default ErkPhoneInput;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SelectProps as MuiSelectProps } from '@mui/material';
|
|
3
|
+
export interface SelectorStyleProps {
|
|
4
|
+
/** If input is readOnly */
|
|
5
|
+
readOnly?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const StyledSelect: import("@emotion/styled").StyledComponent<MuiSelectProps<unknown> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
8
|
+
export declare const StyledInputLabel: import("@emotion/styled").StyledComponent<import("@mui/material").InputLabelOwnProps & Pick<import("@mui/material").FormLabelOwnProps, "color" | "filled"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref"> & {
|
|
9
|
+
ref?: ((instance: HTMLLabelElement | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | React.RefObject<HTMLLabelElement> | null | undefined;
|
|
10
|
+
}, "required" | "size" | "color" | "children" | "className" | "style" | "classes" | "disabled" | "error" | "margin" | "sx" | "filled" | "variant" | "focused" | "disableAnimation" | "shrink"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
11
|
+
component?: React.ElementType;
|
|
12
|
+
} & {
|
|
13
|
+
open: boolean;
|
|
14
|
+
}, {}, {}>;
|
|
15
|
+
export declare const StyledHelperText: import("@emotion/styled").StyledComponent<import("@mui/material").FormHelperTextOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & {
|
|
16
|
+
ref?: ((instance: HTMLParagraphElement | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | React.RefObject<HTMLParagraphElement> | null | undefined;
|
|
17
|
+
}, "required" | "children" | "className" | "style" | "classes" | "disabled" | "error" | "margin" | "sx" | "filled" | "variant" | "focused"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
18
|
+
component?: React.ElementType;
|
|
19
|
+
}, {}, {}>;
|
|
20
|
+
interface ErkSelectProps extends Omit<MuiSelectProps, 'color' | 'onChange'>, SelectorStyleProps {
|
|
21
|
+
/** children to display in the options */
|
|
22
|
+
children?: React.ReactNode;
|
|
23
|
+
/** Currently selected value */
|
|
24
|
+
value?: any;
|
|
25
|
+
onChange?: (value: any) => void;
|
|
26
|
+
/** String to place in the label */
|
|
27
|
+
label?: string;
|
|
28
|
+
/** The helper Text to display */
|
|
29
|
+
helperText?: string;
|
|
30
|
+
/** the components ref */
|
|
31
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Generic textfield with apps designs. Is class due to the use in the react-hook-forms library
|
|
35
|
+
*/
|
|
36
|
+
declare class ErkSelect extends React.Component<ErkSelectProps> {
|
|
37
|
+
render(): JSX.Element;
|
|
38
|
+
}
|
|
39
|
+
export default ErkSelect;
|