@arquimedes.co/eureka-forms 2.0.99-test → 3.0.0-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/App/App.js +21 -46
- package/dist/App/AppFunctions.js +177 -328
- package/dist/App/AppFunctions.test.js +638 -0
- package/dist/App/AppHooks.js +127 -223
- package/dist/App/AppHooks.test.js +154 -0
- package/dist/Contexts/CustomContext.js +1 -1
- package/dist/Contexts/FormContext.js +3 -2
- package/dist/Contexts/SectionContext.js +1 -1
- package/dist/Form/ConfirmationDialog/ConfirmationDialog.js +43 -62
- package/dist/Form/Form.js +75 -160
- package/dist/Form/FormFunctions.js +64 -114
- package/dist/Form/FormFunctions.test.js +454 -0
- package/dist/Form/FormHooks.js +14 -21
- package/dist/Form/FormTypes/ColumnForm/ColumnForm.js +34 -105
- package/dist/Form/FormTypes/StepperForm/StepperForm.js +48 -110
- package/dist/Form/Section/MaterialSection/MaterialSection.js +10 -23
- package/dist/Form/Section/MaterialSection/MaterialSection.module.css +0 -2
- package/dist/Form/Section/Section.js +4 -15
- package/dist/Form/Terms/Term/MaterialTerm/MaterialTerm.js +30 -65
- package/dist/Form/Terms/Term/Term.js +2 -13
- package/dist/Form/Terms/Terms.js +11 -27
- package/dist/FormSteps/@Construction/CBRElementStep/CBRElementStep.js +36 -106
- package/dist/FormSteps/@Construction/CBRIncidentsStep/CBRIncidentsStep.js +2 -13
- package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.js +12 -40
- package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.js +57 -77
- package/dist/FormSteps/@Construction/CBRPropertyStep/CBRPropertyStep.js +46 -111
- package/dist/FormSteps/AYFStepMapper.js +63 -127
- package/dist/FormSteps/ApiSelectorStep/ApiSelectorStep.js +2 -13
- package/dist/FormSteps/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.js +63 -165
- package/dist/FormSteps/CBRStepMapper.js +61 -152
- package/dist/FormSteps/CheckBoxStep/CheckBoxStep.js +2 -13
- package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +19 -37
- package/dist/FormSteps/ClassifierSelectorStep/ClassifierSelectorStep.js +2 -13
- package/dist/FormSteps/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +47 -80
- package/dist/FormSteps/CollapsibleStep/CollapsibleStep.js +3 -26
- package/dist/FormSteps/CollapsibleStep/MaterialTitleStep/MaterialCollapsibleStep.js +33 -61
- package/dist/FormSteps/CustomStep.js +17 -31
- package/dist/FormSteps/DatePickerStep/DatePickerStep.js +2 -13
- package/dist/FormSteps/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.js +7 -20
- package/dist/FormSteps/EntityValueStep/EntityValuePickerStep.js +2 -13
- package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValueDialog/MaterialEntityValueDialog.js +16 -32
- package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.js +94 -180
- package/dist/FormSteps/FileUploadStep/FileUploadStep.js +2 -13
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.js +33 -95
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/FileFunctions.js +3 -0
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +86 -180
- package/dist/FormSteps/MapperStep/MapperStep.js +2 -13
- 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.js +89 -175
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/PillMapperElement/PillMapperElement.js +20 -47
- package/dist/FormSteps/MapperStep/MaterialMapperStep/MaterialMapperStep.js +81 -117
- package/dist/FormSteps/PhoneInputStep/MaterialTextInputStep/MaterialPhoneInputStep.js +15 -33
- package/dist/FormSteps/PhoneInputStep/PhoneInputStep.js +2 -13
- package/dist/FormSteps/RatingStep/MaterialRatingStep/MaterialRatingStep.js +17 -31
- package/dist/FormSteps/RatingStep/RatingStep.js +2 -13
- package/dist/FormSteps/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.js +35 -61
- package/dist/FormSteps/SelectorStep/SelectorStep.js +2 -13
- package/dist/FormSteps/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.js +2 -3
- package/dist/FormSteps/SeparatorStep/SeparatorStep.js +2 -13
- package/dist/FormSteps/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +77 -142
- package/dist/FormSteps/SmartSelectStep/SmartSelectStep.js +2 -13
- package/dist/FormSteps/Step.js +29 -58
- package/dist/FormSteps/StepFunctions.js +149 -204
- package/dist/FormSteps/StepFunctions.test.js +695 -0
- package/dist/FormSteps/StepHooks.js +94 -146
- package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaEditorStep.js +38 -74
- package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.js +12 -28
- package/dist/FormSteps/TextAreaStep/TextAreaStep.js +3 -14
- package/dist/FormSteps/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js +12 -30
- package/dist/FormSteps/TextInputStep/TextInputStep.js +2 -13
- package/dist/FormSteps/TimePickerStep/MaterialTimePickerStep/MaterialTimePickerStep.js +9 -26
- package/dist/FormSteps/TimePickerStep/TimePickerStep.js +2 -13
- package/dist/FormSteps/TitleStep/MaterialTitleStep/MaterialTitleStep.js +13 -26
- package/dist/FormSteps/TitleStep/TitleStep.js +2 -13
- package/dist/FormSteps/Utils/@StepFiller/StepFiller.js +14 -26
- package/dist/FormSteps/Utils/MaterialInputContainer/MaterialInputContainer.js +6 -18
- package/dist/Icons/ArrowLeftIcon.js +6 -0
- package/dist/Icons/ArrowRightIcon.js +6 -0
- package/dist/Icons/CalendarIcon.js +3 -14
- package/dist/Icons/CheckCircleIcon.js +6 -0
- package/dist/Icons/CheckboxCheckedIcon.js +6 -0
- package/dist/Icons/CheckboxUncheckedIcon.js +6 -0
- package/dist/Icons/ClockIcon.js +6 -0
- package/dist/Icons/CloseIcon.js +6 -0
- package/dist/Icons/Construction/LeakIcon.js +3 -14
- package/dist/Icons/Construction/ProjectIcon.js +3 -14
- package/dist/Icons/Construction/PropertyIcon.js +3 -14
- package/dist/Icons/Construction/SpaceIcon.js +3 -14
- package/dist/Icons/DeleteIcon.js +6 -0
- package/dist/Icons/DocumentIcon.js +3 -14
- package/dist/Icons/Entities/CheckListIcon.js +3 -14
- package/dist/Icons/Entities/GenericEntityIcon.js +4 -15
- package/dist/Icons/Entities/HandshakeIcon.js +4 -15
- package/dist/Icons/Entities/SupplierIcon.js +4 -15
- package/dist/Icons/ErkIcon.module.css +9 -0
- package/dist/Icons/ErrorIcon.js +6 -0
- package/dist/Icons/ExpandLessIcon.js +6 -0
- package/dist/Icons/ExpandMoreIcon.js +6 -0
- package/dist/Icons/FileIcon.js +6 -0
- package/dist/Icons/InfoIcon.js +6 -0
- package/dist/Icons/LocationIcon.js +3 -14
- package/dist/Icons/PersonIcon.js +4 -15
- package/dist/Icons/Ratings/DislikeIcon.js +6 -0
- package/dist/Icons/Ratings/DissatisfiedIcon.js +6 -0
- package/dist/Icons/Ratings/LikeIcon.js +6 -0
- package/dist/Icons/Ratings/SatisfiedIcon.js +6 -0
- package/dist/Icons/Ratings/StarIcon.js +6 -0
- package/dist/Icons/Ratings/VeryDissatisfiedIcon.js +6 -0
- package/dist/Icons/Ratings/VerySatisfiedIcon.js +6 -0
- package/dist/Icons/WarningIcon.js +6 -0
- package/dist/Init.js +2 -0
- 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.js +25 -88
- package/dist/Shared/ErkButton/ErkButton.js +31 -0
- package/dist/Shared/{RoundedButton/RoundedButton.stories.js → ErkButton/ErkButton.stories.js} +6 -6
- package/dist/Shared/ErkCheckbox/ErkCheckBox.js +30 -0
- package/dist/Shared/ErkCheckbox/ErkCheckBox.stories.js +37 -0
- package/dist/Shared/ErkDatePicker/ErkDatePicker.js +210 -0
- package/dist/Shared/ErkDatePicker/ErkDatePicker.stories.js +103 -0
- package/dist/Shared/ErkPhoneInput/EkrPhoneInput.js +83 -0
- package/dist/Shared/ErkSelect/ErkSelect.js +90 -0
- package/dist/Shared/ErkSelect/ErkSelect.stories.js +64 -0
- package/dist/Shared/ErkSmartSelect/ErkSmartSelect.js +56 -0
- package/dist/Shared/ErkSmartSelect/ErkSmartSelect.stories.js +167 -0
- package/dist/Shared/ErkTextField/ErkTextField.js +111 -0
- package/dist/Shared/ErkTextField/ErkTextField.stories.js +105 -0
- package/dist/Shared/ErkTimePicker/ErkTimePicker.js +131 -0
- package/dist/Shared/InputIcon/InputIcon.js +25 -48
- package/dist/Shared/Loader/Loader.js +6 -18
- package/dist/Shared/Navbar/Navbar.js +2 -14
- package/dist/Shared/Navbar/Navbar.stories.js +2 -2
- package/dist/Shared/Rating/Rating.js +4 -27
- package/dist/Shared/Rating/Rating.stories.js +13 -19
- package/dist/Shared/Rating/Ratings/LikeRating.js +19 -33
- package/dist/Shared/Rating/Ratings/SatisfactionRating.js +27 -47
- package/dist/Shared/Rating/Ratings/ScaleRating.js +23 -54
- package/dist/Shared/Toggle/Toggle.js +11 -34
- package/dist/States/GlobalSlice.js +6 -17
- package/dist/States/SiteSlice.js +58 -76
- 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.js +102 -143
- package/dist/Utils/FormStepFunctions.js +27 -45
- package/dist/Utils/LocaleUtils.js +12 -0
- 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.js +22 -51
- package/dist/Utils/store.js +10 -65
- package/dist/Widget.js +15 -26
- 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.js +22 -0
- package/package.json +108 -124
- package/dist/@Types/@Types.d.ts +0 -2
- package/dist/@Types/AYFFormStep.d.ts +0 -19
- package/dist/@Types/Branding.d.ts +0 -13
- package/dist/@Types/CBRFormStep.d.ts +0 -74
- package/dist/@Types/Condition.d.ts +0 -143
- package/dist/@Types/Draft/Draft.d.ts +0 -12
- package/dist/@Types/Draft/DraftEntityData.d.ts +0 -54
- package/dist/@Types/Entity.d.ts +0 -36
- package/dist/@Types/Form.d.ts +0 -75
- package/dist/@Types/FormStep.d.ts +0 -219
- package/dist/@Types/GenericFormSteps.d.ts +0 -84
- package/dist/@Types/MapperElement.d.ts +0 -8
- package/dist/@Types/Organization.d.ts +0 -11
- package/dist/@Types/Time.d.ts +0 -6
- package/dist/@Types/index.d.ts +0 -1
- package/dist/App/App.d.ts +0 -59
- package/dist/App/AppFunctions.d.ts +0 -23
- package/dist/App/AppHooks.d.ts +0 -10
- package/dist/Contexts/CustomContext.d.ts +0 -12
- package/dist/Contexts/FormContext.d.ts +0 -6
- package/dist/Contexts/SectionContext.d.ts +0 -3
- package/dist/Form/ConfirmationDialog/ConfirmationDialog.d.ts +0 -12
- package/dist/Form/Form.d.ts +0 -40
- package/dist/Form/FormFunctions.d.ts +0 -12
- package/dist/Form/FormHooks.d.ts +0 -3
- package/dist/Form/FormTypes/ColumnForm/ColumnForm.d.ts +0 -4
- package/dist/Form/FormTypes/StepperForm/StepperForm.d.ts +0 -4
- package/dist/Form/Section/MaterialSection/MaterialSection.d.ts +0 -4
- package/dist/Form/Section/Section.d.ts +0 -6
- package/dist/Form/Terms/Term/MaterialTerm/MaterialTerm.d.ts +0 -4
- package/dist/Form/Terms/Term/Term.d.ts +0 -8
- package/dist/Form/Terms/Terms.d.ts +0 -3
- package/dist/FormSteps/@Construction/CBRElementStep/CBRElementStep.d.ts +0 -8
- package/dist/FormSteps/@Construction/CBRIncidentsStep/CBRIncidentsStep.d.ts +0 -9
- package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.d.ts +0 -8
- package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.d.ts +0 -11
- package/dist/FormSteps/@Construction/CBRPropertyStep/CBRPropertyStep.d.ts +0 -8
- package/dist/FormSteps/AYFStepMapper.d.ts +0 -12
- package/dist/FormSteps/ApiSelectorStep/ApiSelectorStep.d.ts +0 -15
- package/dist/FormSteps/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.d.ts +0 -4
- package/dist/FormSteps/CBRStepMapper.d.ts +0 -13
- package/dist/FormSteps/CheckBoxStep/CheckBoxStep.d.ts +0 -9
- package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.d.ts +0 -4
- package/dist/FormSteps/ClassifierSelectorStep/ClassifierSelectorStep.d.ts +0 -9
- package/dist/FormSteps/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.d.ts +0 -4
- package/dist/FormSteps/CollapsibleStep/CollapsibleStep.d.ts +0 -9
- package/dist/FormSteps/CollapsibleStep/MaterialTitleStep/MaterialCollapsibleStep.d.ts +0 -4
- package/dist/FormSteps/CustomStep.d.ts +0 -27
- package/dist/FormSteps/DatePickerStep/DatePickerStep.d.ts +0 -11
- package/dist/FormSteps/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.d.ts +0 -4
- package/dist/FormSteps/EntityValueStep/EntityValuePickerStep.d.ts +0 -15
- package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValueDialog/MaterialEntityValueDialog.d.ts +0 -12
- package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.d.ts +0 -4
- package/dist/FormSteps/FileUploadStep/FileUploadStep.d.ts +0 -9
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.d.ts +0 -14
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.d.ts +0 -18
- package/dist/FormSteps/MapperStep/MapperStep.d.ts +0 -18
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/ListMapperElement/ListMapperElement.d.ts +0 -5
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/MapperElementComponent.d.ts +0 -15
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/PagedMapperElement/PagedMapperElement.d.ts +0 -5
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/PillMapperElement/PillMapperElement.d.ts +0 -5
- package/dist/FormSteps/MapperStep/MaterialMapperStep/MaterialMapperStep.d.ts +0 -21
- package/dist/FormSteps/PhoneInputStep/MaterialTextInputStep/MaterialPhoneInputStep.d.ts +0 -4
- package/dist/FormSteps/PhoneInputStep/PhoneInputStep.d.ts +0 -11
- package/dist/FormSteps/RatingStep/MaterialRatingStep/MaterialRatingStep.d.ts +0 -4
- package/dist/FormSteps/RatingStep/RatingStep.d.ts +0 -9
- package/dist/FormSteps/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.d.ts +0 -4
- package/dist/FormSteps/SelectorStep/SelectorStep.d.ts +0 -9
- package/dist/FormSteps/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.d.ts +0 -4
- package/dist/FormSteps/SeparatorStep/SeparatorStep.d.ts +0 -9
- package/dist/FormSteps/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.d.ts +0 -5
- package/dist/FormSteps/SmartSelectStep/SmartSelectStep.d.ts +0 -35
- package/dist/FormSteps/Step.d.ts +0 -8
- package/dist/FormSteps/StepFunctions.d.ts +0 -29
- package/dist/FormSteps/StepHooks.d.ts +0 -55
- package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaEditorStep.d.ts +0 -10
- package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.d.ts +0 -8
- package/dist/FormSteps/TextAreaStep/TextAreaStep.d.ts +0 -10
- package/dist/FormSteps/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.d.ts +0 -4
- package/dist/FormSteps/TextInputStep/TextInputStep.d.ts +0 -17
- package/dist/FormSteps/TimePickerStep/MaterialTimePickerStep/MaterialTimePickerStep.d.ts +0 -4
- package/dist/FormSteps/TimePickerStep/TimePickerStep.d.ts +0 -12
- package/dist/FormSteps/TitleStep/MaterialTitleStep/MaterialTitleStep.d.ts +0 -4
- package/dist/FormSteps/TitleStep/TitleStep.d.ts +0 -9
- package/dist/FormSteps/Utils/@StepFiller/StepFiller.d.ts +0 -9
- package/dist/FormSteps/Utils/MaterialInputContainer/MaterialInputContainer.d.ts +0 -12
- package/dist/Icons/@IconTypes.d.ts +0 -7
- package/dist/Icons/CalendarIcon.d.ts +0 -4
- package/dist/Icons/Construction/LeakIcon.d.ts +0 -3
- package/dist/Icons/Construction/ProjectIcon.d.ts +0 -3
- package/dist/Icons/Construction/PropertyIcon.d.ts +0 -3
- package/dist/Icons/Construction/SpaceIcon.d.ts +0 -3
- package/dist/Icons/DocumentIcon.d.ts +0 -3
- package/dist/Icons/Entities/CheckListIcon.d.ts +0 -3
- package/dist/Icons/Entities/GenericEntityIcon.d.ts +0 -3
- package/dist/Icons/Entities/HandshakeIcon.d.ts +0 -3
- package/dist/Icons/Entities/SupplierIcon.d.ts +0 -3
- package/dist/Icons/LocationIcon.d.ts +0 -4
- package/dist/Icons/PersonIcon.d.ts +0 -4
- package/dist/Services/FileService.d.ts +0 -5
- package/dist/Services/FormService.d.ts +0 -5
- package/dist/Services/OrganizationService.d.ts +0 -2
- package/dist/Shared/CustomBtn/CustomBtn.d.ts +0 -18
- package/dist/Shared/InputIcon/InputIcon.d.ts +0 -7
- package/dist/Shared/Loader/Loader.d.ts +0 -18
- package/dist/Shared/Navbar/Navbar.d.ts +0 -9
- package/dist/Shared/Navbar/Navbar.stories.d.ts +0 -13
- package/dist/Shared/Rating/Rating.d.ts +0 -15
- package/dist/Shared/Rating/Rating.stories.d.ts +0 -15
- package/dist/Shared/Rating/Ratings/LikeRating.d.ts +0 -4
- package/dist/Shared/Rating/Ratings/SatisfactionRating.d.ts +0 -4
- package/dist/Shared/Rating/Ratings/ScaleRating.d.ts +0 -4
- package/dist/Shared/RoundedButton/RoundedButton.d.ts +0 -30
- package/dist/Shared/RoundedButton/RoundedButton.js +0 -45
- package/dist/Shared/RoundedButton/RoundedButton.stories.d.ts +0 -23
- package/dist/Shared/RoundedCheckBox/RoundedCheckBox.d.ts +0 -24
- package/dist/Shared/RoundedCheckBox/RoundedCheckBox.js +0 -101
- package/dist/Shared/RoundedCheckBox/RoundedCheckBox.stories.d.ts +0 -21
- 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.d.ts +0 -36
- 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.d.ts +0 -28
- 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.d.ts +0 -36
- 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.d.ts +0 -37
- package/dist/Shared/RoundedTextField/RoundedTextField.stories.js +0 -224
- package/dist/Shared/RoundedTimePicker/RoundedTimePicker.d.ts +0 -41
- package/dist/Shared/RoundedTimePicker/RoundedTimePicker.js +0 -314
- package/dist/Shared/Toggle/Toggle.d.ts +0 -18
- package/dist/States/GlobalSlice.d.ts +0 -46
- package/dist/States/SiteSlice.d.ts +0 -95
- package/dist/States/WidthStatsSlice.d.ts +0 -7
- package/dist/Utils/AxiosAPI.d.ts +0 -2
- package/dist/Utils/AxiosWidget.d.ts +0 -2
- package/dist/Utils/CBRFunctions.d.ts +0 -8
- package/dist/Utils/DraftFunctions.d.ts +0 -56
- package/dist/Utils/FormStepFunctions.d.ts +0 -15
- package/dist/Utils/MaterialProviders.d.ts +0 -6
- package/dist/Utils/PhoneFunctions.d.ts +0 -2
- package/dist/Utils/TestUtils.d.ts +0 -77
- package/dist/Utils/store.d.ts +0 -27
- package/dist/Widget.d.ts +0 -1
- package/dist/__mocks__/axios.d.ts +0 -2
- package/dist/__mocks__/axios.js +0 -2
- package/dist/constants/AYFFormStepTypes.d.ts +0 -9
- package/dist/constants/CBRFormStepTypes.d.ts +0 -21
- package/dist/constants/ConditionTypes.d.ts +0 -27
- package/dist/constants/Draft/DraftEntityDataTypes.d.ts +0 -11
- package/dist/constants/Draft/DraftEntityTypes.d.ts +0 -3
- package/dist/constants/Draft/DraftStyleTypes.d.ts +0 -7
- package/dist/constants/EntityPropertyTypes.d.ts +0 -10
- package/dist/constants/Files/FileExtensions.d.ts +0 -3
- package/dist/constants/Files/FileMaxSize.d.ts +0 -2
- package/dist/constants/FormStepTypes.d.ts +0 -64
- package/dist/constants/IconTypes.d.ts +0 -15
- package/dist/constants/InternalFormStyle.d.ts +0 -3
- package/dist/constants/MaterialClassNameSeed.d.ts +0 -1
- package/dist/constants/MaterialClassNameSeed.js +0 -1
- package/dist/constants/TicketPropertyTypes.d.ts +0 -3
- package/dist/hooks.d.ts +0 -7
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -31
- package/dist/index.lib.d.ts +0 -7
- package/dist/setupTests.d.ts +0 -1
- /package/dist/Shared/{RoundedTimePicker/RoundedTimePicker.module.css → ErkTimePicker/ErkTimePicker.module.css} +0 -0
- /package/dist/{setupTests.js → __tests__/setup.js} +0 -0
|
@@ -1,105 +1,42 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
-
function step(op) {
|
|
26
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
-
switch (op[0]) {
|
|
31
|
-
case 0: case 1: t = op; break;
|
|
32
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
-
default:
|
|
36
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
-
if (t[2]) _.ops.pop();
|
|
41
|
-
_.trys.pop(); continue;
|
|
42
|
-
}
|
|
43
|
-
op = body.call(thisArg, _);
|
|
44
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
49
|
-
var t = {};
|
|
50
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
51
|
-
t[p] = s[p];
|
|
52
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
53
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
54
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
55
|
-
t[p[i]] = s[p[i]];
|
|
56
|
-
}
|
|
57
|
-
return t;
|
|
58
|
-
};
|
|
59
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
60
2
|
import { useEffect, useState } from 'react';
|
|
61
3
|
import styles from './CustomBtn.module.css';
|
|
62
4
|
import Loader from '../Loader/Loader';
|
|
63
|
-
function CustomBtn(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
var _k = useState(true), mounted = _k[0], setMounted = _k[1];
|
|
68
|
-
useEffect(function () {
|
|
5
|
+
function CustomBtn({ label, onClick, backgroundColor, color, loading = false, disabled = false, height = 'fit-content', width = 'fit-content', padding = '15px 30px', borderRadius = '20px', contentMargin = '0px 10px', children, ...others }) {
|
|
6
|
+
const [coords, setCoords] = useState(undefined);
|
|
7
|
+
const [mounted, setMounted] = useState(true);
|
|
8
|
+
useEffect(() => {
|
|
69
9
|
if (coords)
|
|
70
10
|
setCoords(undefined);
|
|
71
|
-
return
|
|
11
|
+
return () => setMounted(false);
|
|
12
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
72
13
|
}, [label]);
|
|
73
|
-
return (_jsxs("button",
|
|
74
|
-
width
|
|
75
|
-
height
|
|
76
|
-
borderRadius
|
|
14
|
+
return (_jsxs("button", { className: styles.customBtn, style: {
|
|
15
|
+
width,
|
|
16
|
+
height,
|
|
17
|
+
borderRadius,
|
|
77
18
|
background: backgroundColor,
|
|
78
|
-
padding
|
|
79
|
-
color
|
|
80
|
-
}, "data-testid": others['data-testid'], disabled: disabled || loading, onClick:
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
x: e.clientX - rect.left,
|
|
86
|
-
y: e.clientY - rect.top,
|
|
87
|
-
});
|
|
88
|
-
setTimeout(function () {
|
|
89
|
-
if (mounted)
|
|
90
|
-
setCoords(undefined);
|
|
91
|
-
}, 600);
|
|
92
|
-
onClick && onClick(e);
|
|
93
|
-
return [2 /*return*/];
|
|
19
|
+
padding,
|
|
20
|
+
color,
|
|
21
|
+
}, "data-testid": others['data-testid'], disabled: disabled || loading, onClick: (e) => {
|
|
22
|
+
const rect = e.target.getBoundingClientRect();
|
|
23
|
+
setCoords({
|
|
24
|
+
x: e.clientX - rect.left,
|
|
25
|
+
y: e.clientY - rect.top,
|
|
94
26
|
});
|
|
95
|
-
|
|
27
|
+
setTimeout(() => {
|
|
28
|
+
if (mounted)
|
|
29
|
+
setCoords(undefined);
|
|
30
|
+
}, 600);
|
|
31
|
+
void onClick?.(e);
|
|
32
|
+
}, children: [coords ? (_jsx("span", { className: styles.ripple, style: {
|
|
96
33
|
backgroundColor: color,
|
|
97
34
|
left: coords.x,
|
|
98
35
|
top: coords.y,
|
|
99
|
-
} })) : (_jsx(_Fragment, {})), _jsx("div",
|
|
36
|
+
} })) : (_jsx(_Fragment, {})), _jsx("div", { style: {
|
|
100
37
|
visibility: loading ? 'hidden' : 'visible',
|
|
101
38
|
margin: contentMargin,
|
|
102
39
|
display: 'flex',
|
|
103
|
-
}
|
|
40
|
+
}, children: children ?? label }), loading && (_jsx("div", { className: styles.loaderContainer, children: _jsx(Loader, { color: color, position: "unset" }) }))] }));
|
|
104
41
|
}
|
|
105
42
|
export default CustomBtn;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button as MuiButton, styled } from '@mui/material';
|
|
3
|
+
const StyledButton = styled(MuiButton)(({ height = 28, bold = false, fontColor = '#ffffff', fontSize = '1rem', borderRadius = 10, width = 'fit-content', padding = '0 13px 0 13px', backgroundColor = '#3d5a7f', }) => ({
|
|
4
|
+
width,
|
|
5
|
+
textTransform: 'none',
|
|
6
|
+
fontFamily: 'inherit',
|
|
7
|
+
fontSize,
|
|
8
|
+
borderRadius,
|
|
9
|
+
padding,
|
|
10
|
+
height: height,
|
|
11
|
+
boxShadow: 'none',
|
|
12
|
+
backgroundColor,
|
|
13
|
+
color: fontColor,
|
|
14
|
+
'&:hover': {
|
|
15
|
+
boxShadow: 'none',
|
|
16
|
+
backgroundColor,
|
|
17
|
+
},
|
|
18
|
+
'&:disabled': {
|
|
19
|
+
backgroundColor,
|
|
20
|
+
color: fontColor,
|
|
21
|
+
opacity: 0.5,
|
|
22
|
+
},
|
|
23
|
+
fontWeight: bold ? 'bold' : 'normal',
|
|
24
|
+
}));
|
|
25
|
+
/**
|
|
26
|
+
* Generic capta button
|
|
27
|
+
*/
|
|
28
|
+
function ErkButton({ text, color, ...props }) {
|
|
29
|
+
return (_jsx(StyledButton, { text: '', fontColor: color, variant: "contained", ...props, children: text }));
|
|
30
|
+
}
|
|
31
|
+
export default ErkButton;
|
package/dist/Shared/{RoundedButton/RoundedButton.stories.js → ErkButton/ErkButton.stories.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
component:
|
|
1
|
+
import ErkButton from './ErkButton';
|
|
2
|
+
const meta = {
|
|
3
|
+
component: ErkButton,
|
|
4
4
|
tags: ['autodocs'],
|
|
5
5
|
args: {
|
|
6
6
|
text: 'Label',
|
|
@@ -16,18 +16,18 @@ var meta = {
|
|
|
16
16
|
},
|
|
17
17
|
};
|
|
18
18
|
export default meta;
|
|
19
|
-
export
|
|
19
|
+
export const Default = {
|
|
20
20
|
args: {
|
|
21
21
|
text: 'Label',
|
|
22
22
|
},
|
|
23
23
|
};
|
|
24
|
-
export
|
|
24
|
+
export const Disabled = {
|
|
25
25
|
args: {
|
|
26
26
|
text: 'Label',
|
|
27
27
|
disabled: true,
|
|
28
28
|
},
|
|
29
29
|
};
|
|
30
|
-
export
|
|
30
|
+
export const DifferentColors = {
|
|
31
31
|
args: {
|
|
32
32
|
text: 'Label',
|
|
33
33
|
backgroundColor: 'red',
|
|
@@ -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;
|
|
@@ -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,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;
|
|
@@ -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,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;
|