@hipay/hipay-material-ui 2.3.1-rc2 → 2.3.1-rc4
Sign up to get free protection for your applications and to get access to all the features.
- package/App.test.js +8 -0
- package/HiAlertModal/HiAlertModal.js +48 -77
- package/HiAlertModal/HiAlertModal.test.js +189 -0
- package/HiAlertModal/index.js +1 -15
- package/HiAppBar/HiAppBar.js +34 -63
- package/HiAppBar/index.js +1 -15
- package/HiBadge/HiBadge.js +10 -29
- package/HiBadge/HiBadge.test.js +49 -0
- package/HiBadge/index.js +1 -15
- package/HiBreadcrumb/HiBreadcrumb.js +27 -43
- package/HiBreadcrumb/HiBreadcrumb.test.js +44 -0
- package/HiBreadcrumb/HiStep.js +35 -57
- package/HiBreadcrumb/HiStep.test.js +47 -0
- package/HiBreadcrumb/HiStepConnector.js +32 -57
- package/HiBreadcrumb/HiStepConnector.test.js +113 -0
- package/HiBreadcrumb/HiStepContent.js +25 -46
- package/HiBreadcrumb/HiStepContent.test.js +32 -0
- package/HiBreadcrumb/HiStepIcon.js +26 -46
- package/HiBreadcrumb/HiStepIcon.test.js +65 -0
- package/HiBreadcrumb/HiStepLabel.js +36 -61
- package/HiBreadcrumb/HiStepLabel.test.js +30 -0
- package/HiBreadcrumb/HiStepper.js +23 -45
- package/HiBreadcrumb/HiStepper.test.js +33 -0
- package/HiBreadcrumb/index.js +1 -15
- package/HiButton/HiButton.js +9 -27
- package/HiButton/index.js +2 -13
- package/HiCell/CellAddress.js +20 -40
- package/HiCell/CellAddress.test.js +75 -0
- package/HiCell/CellDate.js +26 -47
- package/HiCell/CellDate.test.js +173 -0
- package/HiCell/CellIcon.js +28 -49
- package/HiCell/CellIcon.test.js +57 -0
- package/HiCell/CellImage.js +23 -42
- package/HiCell/CellImage.test.js +49 -0
- package/HiCell/CellNumeric.js +25 -46
- package/HiCell/CellNumeric.test.js +46 -0
- package/HiCell/CellPinToAction.js +20 -41
- package/HiCell/CellRate.js +32 -55
- package/HiCell/CellRate.test.js +73 -0
- package/HiCell/CellSentinel.js +22 -42
- package/HiCell/CellSentinel.test.js +48 -0
- package/HiCell/CellSentinelScore.js +23 -44
- package/HiCell/CellText.js +37 -56
- package/HiCell/CellText.test.js +76 -0
- package/HiCell/CellTextStyled.js +8 -21
- package/HiCell/index.js +9 -79
- package/HiCheckbox/HiCheckbox.js +35 -60
- package/HiCheckbox/HiCheckbox.test.js +55 -0
- package/HiCheckbox/index.js +1 -15
- package/HiChip/HiChip.js +24 -44
- package/HiChip/HiChip.test.js +136 -0
- package/HiChip/HiChipSwitch.js +47 -70
- package/HiChip/HiChipSwitch.test.js +99 -0
- package/HiChip/index.js +2 -23
- package/HiColoredLabel/HiColoredLabel.js +28 -52
- package/HiColoredLabel/HiColoredLabel.test.js +96 -0
- package/HiColoredLabel/index.js +1 -15
- package/HiDatePicker/Caption.js +11 -28
- package/HiDatePicker/Caption.test.js +65 -0
- package/HiDatePicker/HiDatePicker.js +100 -115
- package/HiDatePicker/HiDatePicker.test.js +370 -0
- package/HiDatePicker/HiDatePickerMobile.js +32 -54
- package/HiDatePicker/HiDateRangePicker.js +138 -149
- package/HiDatePicker/HiDateRangePicker.test.js +703 -0
- package/HiDatePicker/HiDateRangeSelector.js +71 -103
- package/HiDatePicker/HiDateRangeSelector.test.js +193 -0
- package/HiDatePicker/ListPicker.js +33 -55
- package/HiDatePicker/ListPicker.test.js +53 -0
- package/HiDatePicker/NavBar.js +18 -45
- package/HiDatePicker/NavBar.test.js +39 -0
- package/HiDatePicker/Overlays/CustomOverlayLayout.js +23 -40
- package/HiDatePicker/Overlays/CustomOverlayLayoutWithoutFooter.js +22 -39
- package/HiDatePicker/Overlays/MonthPickerOverlay.js +29 -45
- package/HiDatePicker/Overlays/MonthPickerOverlay.test.js +50 -0
- package/HiDatePicker/Overlays/Overlay.js +18 -35
- package/HiDatePicker/Overlays/Overlay.test.js +20 -0
- package/HiDatePicker/Overlays/TimePickerOverlay.js +47 -73
- package/HiDatePicker/Overlays/TimePickerOverlay.test.js +48 -0
- package/HiDatePicker/Overlays/YearPickerOverlay.js +29 -45
- package/HiDatePicker/Overlays/YearPickerOverlay.test.js +79 -0
- package/HiDatePicker/Overlays/index.js +5 -47
- package/HiDatePicker/Weekday.js +3 -13
- package/HiDatePicker/hiLocaleUtils.js +1 -8
- package/HiDatePicker/hiLocaleUtils.test.js +51 -0
- package/HiDatePicker/index.js +1 -15
- package/HiDatePicker/stylesheet.js +9 -22
- package/HiDotsStepper/HiDot.js +30 -57
- package/HiDotsStepper/HiDot.test.js +55 -0
- package/HiDotsStepper/HiDotsStepper.js +29 -47
- package/HiDotsStepper/HiDotsStepper.test.js +90 -0
- package/HiDotsStepper/index.js +2 -23
- package/HiExpansionPanel/HiExpansionPanel.js +42 -72
- package/HiExpansionPanel/index.js +2 -13
- package/HiForm/HiAddressField.js +30 -47
- package/HiForm/HiAddressField.test.js +79 -0
- package/HiForm/HiEmailField.js +28 -46
- package/HiForm/HiEmailField.test.js +19 -0
- package/HiForm/HiFormControl.js +72 -100
- package/HiForm/HiFormControl.test.js +195 -0
- package/HiForm/HiFormLabel.js +29 -54
- package/HiForm/HiFormLabel.test.js +66 -0
- package/HiForm/HiInput.js +62 -86
- package/HiForm/HiInput.test.js +202 -0
- package/HiForm/HiPasswordField.js +29 -55
- package/HiForm/HiPasswordField.test.js +60 -0
- package/HiForm/HiSearchField.js +27 -44
- package/HiForm/HiSearchField.test.js +193 -0
- package/HiForm/HiSlider.js +42 -64
- package/HiForm/HiSlider.test.js +99 -0
- package/HiForm/HiTextField.js +29 -46
- package/HiForm/HiTextField.test.js +254 -0
- package/HiForm/HiUpload.js +54 -70
- package/HiForm/HiUpload.test.js +241 -0
- package/HiForm/HiUploadField.js +24 -41
- package/HiForm/HiUploadField.test.js +55 -0
- package/HiForm/HiUploadInput.js +56 -77
- package/HiForm/HiUploadInput.test.js +148 -0
- package/HiForm/index.js +11 -95
- package/HiIcon/HiIcon.js +22 -44
- package/HiIcon/index.js +1 -15
- package/HiIconButton/HiIconButton.js +18 -40
- package/HiIconButton/HiIconButton.test.js +69 -0
- package/HiIconButton/index.js +1 -15
- package/HiLoader/HiLoader.js +9 -24
- package/HiLoader/HiLoader.test.js +18 -0
- package/HiLoader/index.js +1 -15
- package/HiMap/HiMap.js +50 -77
- package/HiMap/HiMap.test.js +29 -0
- package/HiMap/HiMapExpand.js +39 -64
- package/HiMap/HiMapExpand.test.js +48 -0
- package/HiMap/index.js +2 -23
- package/HiNotice/HiKPI.js +33 -54
- package/HiNotice/HiKPI.test.js +171 -0
- package/HiNotice/HiKPINotice.js +7 -21
- package/HiNotice/HiKPINotice.test.js +88 -0
- package/HiNotice/index.js +2 -23
- package/HiPaymentMeans/HiPaymentMeans.js +112 -131
- package/HiPaymentMeans/HiPaymentMeans.test.js +162 -0
- package/HiPaymentMeans/index.js +1 -15
- package/HiPdfReader/HiPdfReader.js +51 -76
- package/HiPdfReader/index.js +1 -15
- package/HiPin/HiPin.js +9 -30
- package/HiPin/HiPin.test.js +61 -0
- package/HiPin/index.js +1 -15
- package/HiRadio/HiRadio.js +7 -24
- package/HiRadio/HiRadio.test.js +57 -0
- package/HiRadio/index.js +1 -15
- package/HiSelect/HiDynamicSelect.js +40 -56
- package/HiSelect/HiDynamicSelectField.js +22 -40
- package/HiSelect/HiNestedSelect.js +55 -84
- package/HiSelect/HiNestedSelectContent.js +46 -73
- package/HiSelect/HiNestedSelectField.js +22 -40
- package/HiSelect/HiSelect.js +123 -139
- package/HiSelect/HiSelect.test.js +1092 -0
- package/HiSelect/HiSelectContent.js +73 -95
- package/HiSelect/HiSelectField.js +22 -40
- package/HiSelect/HiSelectInput.js +63 -87
- package/HiSelect/HiSelectInput.test.js +21 -0
- package/HiSelect/HiSelectMobile.js +35 -54
- package/HiSelect/HiSuggestSelect.js +56 -78
- package/HiSelect/HiSuggestSelectField.js +22 -40
- package/HiSelect/index.js +8 -85
- package/HiSelectableList/HiSelectableList.js +49 -77
- package/HiSelectableList/HiSelectableList.test.js +173 -0
- package/HiSelectableList/HiSelectableListHierarchic.js +35 -56
- package/HiSelectableList/HiSelectableListItem.js +66 -98
- package/HiSelectableList/HiSelectableListItem.test.js +97 -0
- package/HiSelectableList/index.js +3 -31
- package/HiSwitch/HiSwitch.js +20 -45
- package/HiSwitch/HiSwitch.test.js +41 -0
- package/HiSwitch/HiSwitchState.js +15 -36
- package/HiSwitch/HiSwitchState.test.js +76 -0
- package/HiSwitch/index.js +2 -23
- package/HiTable/HiCellBuilder.js +44 -72
- package/HiTable/HiTable.js +29 -47
- package/HiTable/HiTable.test.js +29 -0
- package/HiTable/HiTableBody.js +19 -34
- package/HiTable/HiTableHeader.js +30 -53
- package/HiTable/HiTableRow.js +29 -56
- package/HiTable/constants.js +43 -94
- package/HiTable/index.js +1 -15
- package/es/App.test.js +8 -0
- package/es/HiAlertModal/HiAlertModal.js +48 -77
- package/es/HiAlertModal/HiAlertModal.test.js +189 -0
- package/es/HiAlertModal/index.js +1 -15
- package/es/HiAppBar/HiAppBar.js +34 -63
- package/es/HiAppBar/index.js +1 -15
- package/es/HiBadge/HiBadge.js +10 -29
- package/es/HiBadge/HiBadge.test.js +49 -0
- package/es/HiBadge/index.js +1 -15
- package/es/HiBreadcrumb/HiBreadcrumb.js +27 -43
- package/es/HiBreadcrumb/HiBreadcrumb.test.js +44 -0
- package/es/HiBreadcrumb/HiStep.js +35 -57
- package/es/HiBreadcrumb/HiStep.test.js +47 -0
- package/es/HiBreadcrumb/HiStepConnector.js +32 -57
- package/es/HiBreadcrumb/HiStepConnector.test.js +113 -0
- package/es/HiBreadcrumb/HiStepContent.js +25 -46
- package/es/HiBreadcrumb/HiStepContent.test.js +32 -0
- package/es/HiBreadcrumb/HiStepIcon.js +26 -46
- package/es/HiBreadcrumb/HiStepIcon.test.js +65 -0
- package/es/HiBreadcrumb/HiStepLabel.js +36 -61
- package/es/HiBreadcrumb/HiStepLabel.test.js +30 -0
- package/es/HiBreadcrumb/HiStepper.js +23 -45
- package/es/HiBreadcrumb/HiStepper.test.js +33 -0
- package/es/HiBreadcrumb/index.js +1 -15
- package/es/HiButton/HiButton.js +9 -27
- package/es/HiButton/index.js +2 -13
- package/es/HiCell/CellAddress.js +20 -40
- package/es/HiCell/CellAddress.test.js +75 -0
- package/es/HiCell/CellDate.js +26 -47
- package/es/HiCell/CellDate.test.js +173 -0
- package/es/HiCell/CellIcon.js +28 -49
- package/es/HiCell/CellIcon.test.js +57 -0
- package/es/HiCell/CellImage.js +23 -42
- package/es/HiCell/CellImage.test.js +49 -0
- package/es/HiCell/CellNumeric.js +25 -46
- package/es/HiCell/CellNumeric.test.js +46 -0
- package/es/HiCell/CellPinToAction.js +20 -41
- package/es/HiCell/CellRate.js +32 -55
- package/es/HiCell/CellRate.test.js +73 -0
- package/es/HiCell/CellSentinel.js +22 -42
- package/es/HiCell/CellSentinel.test.js +48 -0
- package/es/HiCell/CellSentinelScore.js +23 -44
- package/es/HiCell/CellText.js +37 -56
- package/es/HiCell/CellText.test.js +76 -0
- package/es/HiCell/CellTextStyled.js +8 -21
- package/es/HiCell/index.js +9 -79
- package/es/HiCheckbox/HiCheckbox.js +35 -60
- package/es/HiCheckbox/HiCheckbox.test.js +55 -0
- package/es/HiCheckbox/index.js +1 -15
- package/es/HiChip/HiChip.js +24 -44
- package/es/HiChip/HiChip.test.js +136 -0
- package/es/HiChip/HiChipSwitch.js +47 -70
- package/es/HiChip/HiChipSwitch.test.js +99 -0
- package/es/HiChip/index.js +2 -23
- package/es/HiColoredLabel/HiColoredLabel.js +28 -52
- package/es/HiColoredLabel/HiColoredLabel.test.js +96 -0
- package/es/HiColoredLabel/index.js +1 -15
- package/es/HiDatePicker/Caption.js +11 -28
- package/es/HiDatePicker/Caption.test.js +65 -0
- package/es/HiDatePicker/HiDatePicker.js +100 -115
- package/es/HiDatePicker/HiDatePicker.test.js +370 -0
- package/es/HiDatePicker/HiDatePickerMobile.js +32 -54
- package/es/HiDatePicker/HiDateRangePicker.js +138 -149
- package/es/HiDatePicker/HiDateRangePicker.test.js +703 -0
- package/es/HiDatePicker/HiDateRangeSelector.js +71 -103
- package/es/HiDatePicker/HiDateRangeSelector.test.js +193 -0
- package/es/HiDatePicker/ListPicker.js +33 -55
- package/es/HiDatePicker/ListPicker.test.js +53 -0
- package/es/HiDatePicker/NavBar.js +18 -45
- package/es/HiDatePicker/NavBar.test.js +39 -0
- package/es/HiDatePicker/Overlays/CustomOverlayLayout.js +23 -40
- package/es/HiDatePicker/Overlays/CustomOverlayLayoutWithoutFooter.js +22 -39
- package/es/HiDatePicker/Overlays/MonthPickerOverlay.js +29 -45
- package/es/HiDatePicker/Overlays/MonthPickerOverlay.test.js +50 -0
- package/es/HiDatePicker/Overlays/Overlay.js +18 -35
- package/es/HiDatePicker/Overlays/Overlay.test.js +20 -0
- package/es/HiDatePicker/Overlays/TimePickerOverlay.js +47 -73
- package/es/HiDatePicker/Overlays/TimePickerOverlay.test.js +48 -0
- package/es/HiDatePicker/Overlays/YearPickerOverlay.js +29 -45
- package/es/HiDatePicker/Overlays/YearPickerOverlay.test.js +79 -0
- package/es/HiDatePicker/Overlays/index.js +5 -47
- package/es/HiDatePicker/Weekday.js +3 -13
- package/es/HiDatePicker/hiLocaleUtils.js +1 -8
- package/es/HiDatePicker/hiLocaleUtils.test.js +51 -0
- package/es/HiDatePicker/index.js +1 -15
- package/es/HiDatePicker/stylesheet.js +9 -22
- package/es/HiDotsStepper/HiDot.js +30 -57
- package/es/HiDotsStepper/HiDot.test.js +55 -0
- package/es/HiDotsStepper/HiDotsStepper.js +29 -47
- package/es/HiDotsStepper/HiDotsStepper.test.js +90 -0
- package/es/HiDotsStepper/index.js +2 -23
- package/es/HiExpansionPanel/HiExpansionPanel.js +42 -72
- package/es/HiExpansionPanel/index.js +2 -13
- package/es/HiForm/HiAddressField.js +30 -47
- package/es/HiForm/HiAddressField.test.js +79 -0
- package/es/HiForm/HiEmailField.js +28 -46
- package/es/HiForm/HiEmailField.test.js +19 -0
- package/es/HiForm/HiFormControl.js +72 -100
- package/es/HiForm/HiFormControl.test.js +195 -0
- package/es/HiForm/HiFormLabel.js +29 -54
- package/es/HiForm/HiFormLabel.test.js +66 -0
- package/es/HiForm/HiInput.js +62 -86
- package/es/HiForm/HiInput.test.js +202 -0
- package/es/HiForm/HiPasswordField.js +29 -55
- package/es/HiForm/HiPasswordField.test.js +60 -0
- package/es/HiForm/HiSearchField.js +27 -44
- package/es/HiForm/HiSearchField.test.js +193 -0
- package/es/HiForm/HiSlider.js +42 -64
- package/es/HiForm/HiSlider.test.js +99 -0
- package/es/HiForm/HiTextField.js +29 -46
- package/es/HiForm/HiTextField.test.js +254 -0
- package/es/HiForm/HiUpload.js +54 -70
- package/es/HiForm/HiUpload.test.js +241 -0
- package/es/HiForm/HiUploadField.js +24 -41
- package/es/HiForm/HiUploadField.test.js +55 -0
- package/es/HiForm/HiUploadInput.js +56 -77
- package/es/HiForm/HiUploadInput.test.js +148 -0
- package/es/HiForm/index.js +11 -95
- package/es/HiIcon/HiIcon.js +22 -44
- package/es/HiIcon/index.js +1 -15
- package/es/HiIconButton/HiIconButton.js +18 -40
- package/es/HiIconButton/HiIconButton.test.js +69 -0
- package/es/HiIconButton/index.js +1 -15
- package/es/HiLoader/HiLoader.js +9 -24
- package/es/HiLoader/HiLoader.test.js +18 -0
- package/es/HiLoader/index.js +1 -15
- package/es/HiMap/HiMap.js +50 -77
- package/es/HiMap/HiMap.test.js +29 -0
- package/es/HiMap/HiMapExpand.js +39 -64
- package/es/HiMap/HiMapExpand.test.js +48 -0
- package/es/HiMap/index.js +2 -23
- package/es/HiNotice/HiKPI.js +33 -54
- package/es/HiNotice/HiKPI.test.js +171 -0
- package/es/HiNotice/HiKPINotice.js +7 -21
- package/es/HiNotice/HiKPINotice.test.js +88 -0
- package/es/HiNotice/index.js +2 -23
- package/es/HiPaymentMeans/HiPaymentMeans.js +112 -131
- package/es/HiPaymentMeans/HiPaymentMeans.test.js +162 -0
- package/es/HiPaymentMeans/index.js +1 -15
- package/es/HiPdfReader/HiPdfReader.js +51 -76
- package/es/HiPdfReader/index.js +1 -15
- package/es/HiPin/HiPin.js +9 -30
- package/es/HiPin/HiPin.test.js +61 -0
- package/es/HiPin/index.js +1 -15
- package/es/HiRadio/HiRadio.js +7 -24
- package/es/HiRadio/HiRadio.test.js +57 -0
- package/es/HiRadio/index.js +1 -15
- package/es/HiSelect/HiDynamicSelect.js +40 -56
- package/es/HiSelect/HiDynamicSelectField.js +22 -40
- package/es/HiSelect/HiNestedSelect.js +55 -84
- package/es/HiSelect/HiNestedSelectContent.js +46 -73
- package/es/HiSelect/HiNestedSelectField.js +22 -40
- package/es/HiSelect/HiSelect.js +123 -139
- package/es/HiSelect/HiSelect.test.js +1092 -0
- package/es/HiSelect/HiSelectContent.js +73 -95
- package/es/HiSelect/HiSelectField.js +22 -40
- package/es/HiSelect/HiSelectInput.js +63 -87
- package/es/HiSelect/HiSelectInput.test.js +21 -0
- package/es/HiSelect/HiSelectMobile.js +35 -54
- package/es/HiSelect/HiSuggestSelect.js +56 -78
- package/es/HiSelect/HiSuggestSelectField.js +22 -40
- package/es/HiSelect/index.js +8 -85
- package/es/HiSelectableList/HiSelectableList.js +49 -77
- package/es/HiSelectableList/HiSelectableList.test.js +173 -0
- package/es/HiSelectableList/HiSelectableListHierarchic.js +35 -56
- package/es/HiSelectableList/HiSelectableListItem.js +66 -98
- package/es/HiSelectableList/HiSelectableListItem.test.js +97 -0
- package/es/HiSelectableList/index.js +3 -31
- package/es/HiSwitch/HiSwitch.js +20 -45
- package/es/HiSwitch/HiSwitch.test.js +41 -0
- package/es/HiSwitch/HiSwitchState.js +15 -36
- package/es/HiSwitch/HiSwitchState.test.js +76 -0
- package/es/HiSwitch/index.js +2 -23
- package/es/HiTable/HiCellBuilder.js +44 -72
- package/es/HiTable/HiTable.js +29 -47
- package/es/HiTable/HiTable.test.js +29 -0
- package/es/HiTable/HiTableBody.js +19 -34
- package/es/HiTable/HiTableHeader.js +30 -53
- package/es/HiTable/HiTableRow.js +29 -56
- package/es/HiTable/constants.js +43 -94
- package/es/HiTable/index.js +1 -15
- package/es/hi-svg-icons/HiAccount.js +18 -36
- package/es/hi-svg-icons/HiActivity.js +17 -35
- package/es/hi-svg-icons/HiAll.js +22 -42
- package/es/hi-svg-icons/HiBilling.js +18 -36
- package/es/hi-svg-icons/HiBriefcaseRescue.js +10 -26
- package/es/hi-svg-icons/HiCatalog.js +18 -36
- package/es/hi-svg-icons/HiCustomer.js +18 -36
- package/es/hi-svg-icons/HiDownload.js +11 -25
- package/es/hi-svg-icons/HiFinance.js +18 -36
- package/es/hi-svg-icons/HiPermission.js +17 -35
- package/es/hi-svg-icons/HiRoute.js +18 -36
- package/es/hi-svg-icons/HiSettlement.js +18 -36
- package/es/hi-svg-icons/HiSizeLarge.js +12 -27
- package/es/hi-svg-icons/HiSizeMedium.js +11 -25
- package/es/hi-svg-icons/HiSizeSmall.js +11 -25
- package/es/hi-svg-icons/HiTransaction.js +18 -36
- package/es/hi-svg-icons/HiUser.js +18 -36
- package/es/hi-svg-icons/HiWidget.js +22 -42
- package/es/hi-svg-icons/index.js +18 -151
- package/es/hi-svg-icons/index.text.js +11 -21
- package/es/styleguide/Wrapper.js +19 -36
- package/es/styles/MuiThemeProvider.js +39 -59
- package/es/styles/colorManipulator.js +16 -44
- package/es/styles/colorManipulator.test.js +242 -0
- package/es/styles/createBreakpoints.js +6 -20
- package/es/styles/createBreakpoints.test.js +48 -0
- package/es/styles/createGenerateClassName.js +5 -15
- package/es/styles/createGenerateClassName.test.js +141 -0
- package/es/styles/createMixins.js +8 -19
- package/es/styles/createMixins.test.js +24 -0
- package/es/styles/createMuiTheme.js +34 -53
- package/es/styles/createMuiTheme.test.js +67 -0
- package/es/styles/createPalette.js +30 -50
- package/es/styles/createPalette.test.js +159 -0
- package/es/styles/createStyles.js +1 -8
- package/es/styles/createStyles.test.js +8 -0
- package/es/styles/createTypography.js +18 -30
- package/es/styles/createTypography.test.js +60 -0
- package/es/styles/getStylesCreator.js +11 -24
- package/es/styles/getStylesCreator.test.js +92 -0
- package/es/styles/getThemeProps.js +1 -9
- package/es/styles/getThemeProps.test.js +39 -0
- package/es/styles/index.js +5 -47
- package/es/styles/jssPreset.js +9 -25
- package/es/styles/mergeClasses.js +7 -19
- package/es/styles/shadows.js +1 -8
- package/es/styles/shape.js +1 -8
- package/es/styles/spacing.js +1 -9
- package/es/styles/themeListener.js +5 -18
- package/es/styles/themeListener.test.js +26 -0
- package/es/styles/transitions.js +18 -38
- package/es/styles/transitions.test.js +208 -0
- package/es/styles/zIndex.js +1 -8
- package/es/test-utils/createMount.js +11 -22
- package/es/test-utils/createRender.js +8 -19
- package/es/test-utils/createShallow.js +13 -23
- package/es/test-utils/getClasses.js +2 -11
- package/es/test-utils/index.js +5 -47
- package/es/test-utils/until.js +6 -16
- package/es/test-utils/until.test.js +157 -0
- package/es/test-utils/unwrap.js +1 -8
- package/es/theme/palette.js +2 -10
- package/es/theme/typography.js +2 -10
- package/es/theme.js +2 -11
- package/es/transitions/utils.js +2 -13
- package/es/utils/exactProp.js +5 -18
- package/es/utils/helpers.js +18 -55
- package/es/withMobileDialog/index.js +1 -15
- package/es/withMobileDialog/withMobileDialog.js +7 -22
- package/es/withMobileDialog/withMobileDialog.test.js +67 -0
- package/hi-svg-icons/HiAccount.js +18 -36
- package/hi-svg-icons/HiActivity.js +17 -35
- package/hi-svg-icons/HiAll.js +22 -42
- package/hi-svg-icons/HiBilling.js +18 -36
- package/hi-svg-icons/HiBriefcaseRescue.js +10 -26
- package/hi-svg-icons/HiCatalog.js +18 -36
- package/hi-svg-icons/HiCustomer.js +18 -36
- package/hi-svg-icons/HiDownload.js +11 -25
- package/hi-svg-icons/HiFinance.js +18 -36
- package/hi-svg-icons/HiPermission.js +17 -35
- package/hi-svg-icons/HiRoute.js +18 -36
- package/hi-svg-icons/HiSettlement.js +18 -36
- package/hi-svg-icons/HiSizeLarge.js +12 -27
- package/hi-svg-icons/HiSizeMedium.js +11 -25
- package/hi-svg-icons/HiSizeSmall.js +11 -25
- package/hi-svg-icons/HiTransaction.js +18 -36
- package/hi-svg-icons/HiUser.js +18 -36
- package/hi-svg-icons/HiWidget.js +22 -42
- package/hi-svg-icons/index.js +18 -151
- package/hi-svg-icons/index.text.js +11 -21
- package/package.json +1 -1
- package/styleguide/Wrapper.js +19 -36
- package/styles/MuiThemeProvider.js +39 -59
- package/styles/colorManipulator.js +16 -44
- package/styles/colorManipulator.test.js +242 -0
- package/styles/createBreakpoints.js +6 -20
- package/styles/createBreakpoints.test.js +48 -0
- package/styles/createGenerateClassName.js +5 -15
- package/styles/createGenerateClassName.test.js +141 -0
- package/styles/createMixins.js +8 -19
- package/styles/createMixins.test.js +24 -0
- package/styles/createMuiTheme.js +34 -53
- package/styles/createMuiTheme.test.js +67 -0
- package/styles/createPalette.js +30 -50
- package/styles/createPalette.test.js +159 -0
- package/styles/createStyles.js +1 -8
- package/styles/createStyles.test.js +8 -0
- package/styles/createTypography.js +18 -30
- package/styles/createTypography.test.js +60 -0
- package/styles/getStylesCreator.js +11 -24
- package/styles/getStylesCreator.test.js +92 -0
- package/styles/getThemeProps.js +1 -9
- package/styles/getThemeProps.test.js +39 -0
- package/styles/index.js +5 -47
- package/styles/jssPreset.js +9 -25
- package/styles/mergeClasses.js +7 -19
- package/styles/shadows.js +1 -8
- package/styles/shape.js +1 -8
- package/styles/spacing.js +1 -9
- package/styles/themeListener.js +5 -18
- package/styles/themeListener.test.js +26 -0
- package/styles/transitions.js +18 -38
- package/styles/transitions.test.js +208 -0
- package/styles/zIndex.js +1 -8
- package/test-utils/createMount.js +11 -22
- package/test-utils/createRender.js +8 -19
- package/test-utils/createShallow.js +13 -23
- package/test-utils/getClasses.js +2 -11
- package/test-utils/index.js +5 -47
- package/test-utils/until.js +6 -16
- package/test-utils/until.test.js +157 -0
- package/test-utils/unwrap.js +1 -8
- package/theme/palette.js +2 -10
- package/theme/typography.js +2 -10
- package/theme.js +2 -11
- package/transitions/utils.js +2 -13
- package/utils/exactProp.js +5 -18
- package/utils/helpers.js +18 -55
- package/withMobileDialog/index.js +1 -15
- package/withMobileDialog/withMobileDialog.js +7 -22
- package/withMobileDialog/withMobileDialog.test.js +67 -0
package/HiForm/HiFormControl.js
CHANGED
@@ -1,56 +1,25 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends"));
|
11
|
-
|
12
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
13
|
-
|
14
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));
|
15
|
-
|
16
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));
|
17
|
-
|
18
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));
|
19
|
-
|
20
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));
|
21
|
-
|
22
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/assertThisInitialized"));
|
23
|
-
|
24
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));
|
25
|
-
|
26
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
27
|
-
|
28
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
29
|
-
|
30
|
-
var _react = _interopRequireDefault(require("react"));
|
31
|
-
|
32
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
33
|
-
|
34
|
-
var _Warning = _interopRequireDefault(require("@material-ui/icons/Warning"));
|
35
|
-
|
36
|
-
var _Info = _interopRequireDefault(require("@material-ui/icons/Info"));
|
37
|
-
|
38
|
-
var _FormControl = _interopRequireDefault(require("@material-ui/core/FormControl"));
|
39
|
-
|
40
|
-
var _FormHelperText = _interopRequireDefault(require("@material-ui/core/FormHelperText"));
|
41
|
-
|
42
|
-
var _styles = require("@material-ui/core/styles");
|
43
|
-
|
44
|
-
var _HiFormLabel = _interopRequireDefault(require("./HiFormLabel"));
|
45
|
-
|
46
|
-
var _HiIconButton = _interopRequireDefault(require("../HiIconButton"));
|
47
|
-
|
48
|
-
var _helpers = require("../utils/helpers");
|
49
|
-
|
50
|
-
var _index = _interopRequireDefault(require("keycode/index"));
|
51
|
-
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
3
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
4
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
5
|
+
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
6
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
7
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
8
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
9
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
52
10
|
// @inheritedComponent FormControl
|
53
|
-
|
11
|
+
import React from 'react';
|
12
|
+
import classNames from 'classnames';
|
13
|
+
import Warning from '@material-ui/icons/Warning';
|
14
|
+
import Info from '@material-ui/icons/Info';
|
15
|
+
import FormControl from '@material-ui/core/FormControl';
|
16
|
+
import FormHelperText from '@material-ui/core/FormHelperText';
|
17
|
+
import { withStyles } from '@material-ui/core/styles';
|
18
|
+
import HiFormLabel from './HiFormLabel';
|
19
|
+
import HiIconButton from '../HiIconButton';
|
20
|
+
import { escapeHTML } from '../utils/helpers';
|
21
|
+
import keycode from 'keycode/index';
|
22
|
+
export var styles = function styles(theme) {
|
54
23
|
return {
|
55
24
|
helperTextClassName: {
|
56
25
|
color: theme.palette.neutral.main,
|
@@ -84,7 +53,7 @@ var styles = function styles(theme) {
|
|
84
53
|
iconButtonInfo: {},
|
85
54
|
iconButtonInfoActive: {},
|
86
55
|
iconFullWidth: {},
|
87
|
-
errorDiv: (
|
56
|
+
errorDiv: _objectSpread({}, theme.typography.b3, {
|
88
57
|
backgroundColor: theme.palette.negative.main,
|
89
58
|
color: '#FFFFFF',
|
90
59
|
padding: '16px 8px',
|
@@ -114,7 +83,7 @@ var styles = function styles(theme) {
|
|
114
83
|
errorDivArrowDown: {
|
115
84
|
borderTopColor: theme.palette.negative.main
|
116
85
|
},
|
117
|
-
helperDiv: (
|
86
|
+
helperDiv: _objectSpread({}, theme.typography.b2, {
|
118
87
|
width: '100%',
|
119
88
|
backgroundColor: '#ffffff',
|
120
89
|
color: theme.palette.neutral.normal,
|
@@ -139,20 +108,19 @@ var styles = function styles(theme) {
|
|
139
108
|
* Champs input pour formulaire
|
140
109
|
*/
|
141
110
|
|
142
|
-
|
143
|
-
exports.styles = styles;
|
144
|
-
|
145
111
|
var HiFormControl =
|
146
112
|
/*#__PURE__*/
|
147
113
|
function (_React$PureComponent) {
|
148
|
-
(
|
114
|
+
_inherits(HiFormControl, _React$PureComponent);
|
149
115
|
|
150
116
|
function HiFormControl(props) {
|
151
117
|
var _this;
|
152
118
|
|
153
|
-
(
|
154
|
-
|
155
|
-
(
|
119
|
+
_classCallCheck(this, HiFormControl);
|
120
|
+
|
121
|
+
_this = _possibleConstructorReturn(this, _getPrototypeOf(HiFormControl).call(this, props));
|
122
|
+
|
123
|
+
_defineProperty(_assertThisInitialized(_this), "handleHelperClick", function (event) {
|
156
124
|
_this.setState(function (prevState) {
|
157
125
|
return {
|
158
126
|
helperOpen: !prevState.helperOpen
|
@@ -163,21 +131,24 @@ function (_React$PureComponent) {
|
|
163
131
|
event.preventDefault();
|
164
132
|
}
|
165
133
|
});
|
166
|
-
|
167
|
-
|
134
|
+
|
135
|
+
_defineProperty(_assertThisInitialized(_this), "handleKeyDown", function (event) {
|
136
|
+
var key = keycode(event);
|
168
137
|
|
169
138
|
if (['space', 'enter'].includes(key)) {
|
170
139
|
_this.handleHelperClick(event);
|
171
140
|
}
|
172
141
|
});
|
173
|
-
|
142
|
+
|
143
|
+
_defineProperty(_assertThisInitialized(_this), "handleHover", function (value) {
|
174
144
|
return function () {
|
175
145
|
_this.setState({
|
176
146
|
hovered: value
|
177
147
|
});
|
178
148
|
};
|
179
149
|
});
|
180
|
-
|
150
|
+
|
151
|
+
_defineProperty(_assertThisInitialized(_this), "handleFocus", function (value) {
|
181
152
|
return function () {
|
182
153
|
_this.setState({
|
183
154
|
focused: value
|
@@ -190,19 +161,20 @@ function (_React$PureComponent) {
|
|
190
161
|
}
|
191
162
|
};
|
192
163
|
});
|
164
|
+
|
193
165
|
_this.state = {
|
194
166
|
helperOpen: false,
|
195
167
|
focused: false,
|
196
168
|
hovered: false
|
197
169
|
};
|
198
|
-
_this.handleHelperClick = _this.handleHelperClick.bind((
|
199
|
-
_this.handleKeyDown = _this.handleKeyDown.bind((
|
200
|
-
_this.handleFocus = _this.handleFocus.bind((
|
201
|
-
_this.handleHover = _this.handleHover.bind((
|
170
|
+
_this.handleHelperClick = _this.handleHelperClick.bind(_assertThisInitialized(_this));
|
171
|
+
_this.handleKeyDown = _this.handleKeyDown.bind(_assertThisInitialized(_this));
|
172
|
+
_this.handleFocus = _this.handleFocus.bind(_assertThisInitialized(_this));
|
173
|
+
_this.handleHover = _this.handleHover.bind(_assertThisInitialized(_this));
|
202
174
|
return _this;
|
203
175
|
}
|
204
176
|
|
205
|
-
(
|
177
|
+
_createClass(HiFormControl, [{
|
206
178
|
key: "render",
|
207
179
|
value: function render() {
|
208
180
|
var _classNames2;
|
@@ -226,66 +198,68 @@ function (_React$PureComponent) {
|
|
226
198
|
rootRef = _this$props.rootRef,
|
227
199
|
maxLength = _this$props.maxLength,
|
228
200
|
nbChars = _this$props.nbChars,
|
229
|
-
others = (
|
201
|
+
others = _objectWithoutProperties(_this$props, ["children", "classes", "className", "disabled", "error", "errorText", "id", "label", "InputLabelProps", "helperText", "helperIcon", "FormHelperTextProps", "fullWidth", "required", "multiline", "rootRef", "maxLength", "nbChars"]);
|
202
|
+
|
230
203
|
var _this$state = this.state,
|
231
204
|
helperOpen = _this$state.helperOpen,
|
232
205
|
focused = _this$state.focused,
|
233
206
|
hovered = _this$state.hovered;
|
234
|
-
return
|
207
|
+
return React.createElement(FormControl, Object.assign({
|
235
208
|
fullWidth: fullWidth,
|
236
209
|
className: className,
|
237
210
|
error: error,
|
238
211
|
ref: rootRef
|
239
|
-
}, others), error && errorText && helperOpen &&
|
212
|
+
}, others), error && errorText && helperOpen && React.createElement("div", {
|
240
213
|
className: classes.errorDiv
|
241
|
-
},
|
242
|
-
className: (
|
243
|
-
}),
|
214
|
+
}, React.createElement("div", {
|
215
|
+
className: classNames(classes.arrowDown, classes.errorDivArrowDown, fullWidth ? [classes.arrowFullWidth] : [classes.arrowNotFullWidth])
|
216
|
+
}), React.createElement("span", {
|
244
217
|
// eslint-disable-next-line react/no-danger
|
245
218
|
dangerouslySetInnerHTML: {
|
246
|
-
__html:
|
219
|
+
__html: escapeHTML(errorText)
|
247
220
|
}
|
248
|
-
})), helperIcon && helperText && !error && helperOpen &&
|
221
|
+
})), helperIcon && helperText && !error && helperOpen && React.createElement("div", {
|
249
222
|
className: classes.helperDiv
|
250
|
-
},
|
251
|
-
className: (
|
252
|
-
}),
|
223
|
+
}, React.createElement("div", {
|
224
|
+
className: classNames(classes.arrowDown, classes.helperDivArrowDown, fullWidth ? [classes.arrowFullWidth] : [classes.arrowNotFullWidth])
|
225
|
+
}), React.createElement("span", {
|
253
226
|
// eslint-disable-next-line react/no-danger
|
254
227
|
dangerouslySetInnerHTML: {
|
255
|
-
__html:
|
228
|
+
__html: escapeHTML(helperText)
|
256
229
|
}
|
257
|
-
})), label &&
|
230
|
+
})), label && React.createElement(HiFormLabel, Object.assign({
|
258
231
|
htmlFor: id,
|
259
232
|
label: label,
|
260
233
|
required: required,
|
261
234
|
disabled: disabled,
|
262
235
|
focused: !disabled && (focused || hovered)
|
263
|
-
}, InputLabelProps), error && errorText &&
|
264
|
-
className: (
|
236
|
+
}, InputLabelProps), error && errorText && React.createElement(HiIconButton, {
|
237
|
+
className: classNames(classes.iconButton, classes.iconButtonError, _defineProperty({}, classes.iconFullWidth, fullWidth)),
|
265
238
|
onClick: this.handleHelperClick
|
266
|
-
},
|
267
|
-
className: (
|
268
|
-
})), helperIcon && helperText && !error &&
|
269
|
-
className: (
|
239
|
+
}, React.createElement(Warning, {
|
240
|
+
className: classNames(classes.icon)
|
241
|
+
})), helperIcon && helperText && !error && React.createElement(HiIconButton, {
|
242
|
+
className: classNames(classes.iconButton, classes.iconButtonInfo, (_classNames2 = {}, _defineProperty(_classNames2, classes.iconButtonInfoActive, helperOpen), _defineProperty(_classNames2, classes.iconFullWidth, fullWidth), _classNames2)),
|
270
243
|
onClick: this.handleHelperClick
|
271
|
-
},
|
272
|
-
className: (
|
273
|
-
}))),
|
244
|
+
}, React.createElement(Info, {
|
245
|
+
className: classNames(classes.icon)
|
246
|
+
}))), React.createElement("div", {
|
274
247
|
onMouseEnter: this.handleHover(true),
|
275
248
|
onMouseLeave: this.handleHover(false),
|
276
249
|
onFocus: this.handleFocus(true),
|
277
250
|
onBlur: this.handleFocus(false)
|
278
|
-
}, children), !multiline && helperText && !helperIcon &&
|
251
|
+
}, children), !multiline && helperText && !helperIcon && React.createElement(FormHelperText, Object.assign({
|
279
252
|
className: classes.helperTextClassName
|
280
|
-
}, FormHelperTextProps), helperText), multiline &&
|
253
|
+
}, FormHelperTextProps), helperText), multiline && React.createElement(FormHelperText, Object.assign({
|
281
254
|
className: classes.helperTextClassName
|
282
255
|
}, FormHelperTextProps), nbChars, "/", maxLength));
|
283
256
|
}
|
284
257
|
}]);
|
258
|
+
|
285
259
|
return HiFormControl;
|
286
|
-
}(
|
260
|
+
}(React.PureComponent);
|
287
261
|
|
288
|
-
(
|
262
|
+
_defineProperty(HiFormControl, "defaultProps", {
|
289
263
|
fullWidth: true,
|
290
264
|
required: true,
|
291
265
|
disabled: false,
|
@@ -298,9 +272,7 @@ function (_React$PureComponent) {
|
|
298
272
|
maxLength: 280
|
299
273
|
});
|
300
274
|
|
301
|
-
|
275
|
+
export default withStyles(styles, {
|
302
276
|
hiComponent: true,
|
303
277
|
name: 'HmuiHiFormControl'
|
304
|
-
})(HiFormControl);
|
305
|
-
|
306
|
-
exports.default = _default;
|
278
|
+
})(HiFormControl);
|
@@ -0,0 +1,195 @@
|
|
1
|
+
/* eslint-disable */
|
2
|
+
import React from 'react';
|
3
|
+
import { assert } from 'chai';
|
4
|
+
import { spy } from 'sinon';
|
5
|
+
import { createShallow, createMount } from '../test-utils';
|
6
|
+
import Info from '@material-ui/icons/Info';
|
7
|
+
import HiFormControl from './HiFormControl';
|
8
|
+
import HiIconButton from '../HiIconButton';
|
9
|
+
import HiFormLabel from './HiFormLabel';
|
10
|
+
import HiInput from './HiInput';
|
11
|
+
import FormControl from '@material-ui/core/FormControl';
|
12
|
+
import FormHelperText from '@material-ui/core/FormHelperText';
|
13
|
+
describe('<HiFormControl />', function () {
|
14
|
+
var shallow;
|
15
|
+
var mount;
|
16
|
+
before(function () {
|
17
|
+
shallow = createShallow({
|
18
|
+
dive: true
|
19
|
+
});
|
20
|
+
});
|
21
|
+
beforeEach(function () {
|
22
|
+
mount = createMount();
|
23
|
+
});
|
24
|
+
afterEach(function () {
|
25
|
+
mount.cleanUp();
|
26
|
+
});
|
27
|
+
describe('shallow', function () {
|
28
|
+
var wrapper;
|
29
|
+
beforeEach(function () {
|
30
|
+
wrapper = shallow(React.createElement(HiFormControl, null, React.createElement(HiInput, null)));
|
31
|
+
});
|
32
|
+
describe('structure', function () {
|
33
|
+
it('should be a FormControl', function () {
|
34
|
+
assert.strictEqual(wrapper.name(), 'WithStyles(FormControl)');
|
35
|
+
assert.strictEqual(wrapper.dive().name(), 'FormControl');
|
36
|
+
});
|
37
|
+
it('should have initial props', function () {
|
38
|
+
assert.strictEqual(wrapper.props().error, false);
|
39
|
+
});
|
40
|
+
it('should pass className to the FormControl', function () {
|
41
|
+
wrapper.setProps({
|
42
|
+
className: 'foo'
|
43
|
+
});
|
44
|
+
assert.strictEqual(wrapper.dive().hasClass('foo'), true);
|
45
|
+
});
|
46
|
+
it('should have one child', function () {
|
47
|
+
assert.strictEqual(wrapper.children().length, 1);
|
48
|
+
});
|
49
|
+
it('should forward the fullWidth prop to FormControl', function () {
|
50
|
+
wrapper = shallow(React.createElement(HiFormControl, {
|
51
|
+
fullWidth: true
|
52
|
+
}));
|
53
|
+
assert.strictEqual(wrapper.props().fullWidth, true);
|
54
|
+
});
|
55
|
+
it('should display help', function () {
|
56
|
+
assert.strictEqual(wrapper.state().helperOpen, false);
|
57
|
+
wrapper.setProps({
|
58
|
+
label: 'Label',
|
59
|
+
helperText: 'helper',
|
60
|
+
helperIcon: true
|
61
|
+
});
|
62
|
+
var helperIcon = wrapper.find(HiIconButton);
|
63
|
+
assert.strictEqual(wrapper.childAt(0).type(), HiFormLabel, 'helper div should not be here');
|
64
|
+
helperIcon.simulate('click');
|
65
|
+
assert.strictEqual(wrapper.state().helperOpen, true, 'helper should be open');
|
66
|
+
assert.strictEqual(wrapper.childAt(0).type(), 'div', 'helper div should be here');
|
67
|
+
});
|
68
|
+
});
|
69
|
+
describe('with a label', function () {
|
70
|
+
beforeEach(function () {
|
71
|
+
wrapper.setProps({
|
72
|
+
label: 'Foo bar'
|
73
|
+
});
|
74
|
+
});
|
75
|
+
it('should have 2 children', function () {
|
76
|
+
assert.strictEqual(wrapper.children().length, 2);
|
77
|
+
});
|
78
|
+
it('should have an HiFormLabel as the first child', function () {
|
79
|
+
assert.strictEqual(wrapper.childAt(0).type(), HiFormLabel);
|
80
|
+
});
|
81
|
+
it('should have a div as the second child', function () {
|
82
|
+
assert.strictEqual(wrapper.childAt(1).type(), 'div');
|
83
|
+
});
|
84
|
+
});
|
85
|
+
describe('with a helper text', function () {
|
86
|
+
beforeEach(function () {
|
87
|
+
wrapper.setProps({
|
88
|
+
helperText: 'Foo bar'
|
89
|
+
});
|
90
|
+
});
|
91
|
+
it('should have 2 children', function () {
|
92
|
+
assert.strictEqual(wrapper.children().length, 2);
|
93
|
+
});
|
94
|
+
it('should have a FormHelperText as the second child', function () {
|
95
|
+
assert.strictEqual(wrapper.childAt(1).type(), FormHelperText);
|
96
|
+
});
|
97
|
+
it('should have a div as the first child', function () {
|
98
|
+
assert.strictEqual(wrapper.childAt(0).type(), 'div');
|
99
|
+
});
|
100
|
+
});
|
101
|
+
describe('with a helper text', function () {
|
102
|
+
beforeEach(function () {
|
103
|
+
wrapper.setProps({
|
104
|
+
multiline: true
|
105
|
+
});
|
106
|
+
});
|
107
|
+
it('should have 2 children', function () {
|
108
|
+
assert.strictEqual(wrapper.children().length, 2);
|
109
|
+
});
|
110
|
+
});
|
111
|
+
});
|
112
|
+
describe('mount', function () {
|
113
|
+
var wrapper;
|
114
|
+
var handleBlur = spy();
|
115
|
+
var handleFocus = spy();
|
116
|
+
beforeEach(function () {
|
117
|
+
wrapper = mount(React.createElement(HiFormControl, {
|
118
|
+
onBlur: handleBlur,
|
119
|
+
onFocus: handleFocus,
|
120
|
+
helperText: "helper"
|
121
|
+
}));
|
122
|
+
});
|
123
|
+
describe('callbacks', function () {
|
124
|
+
it('should be called', function () {
|
125
|
+
wrapper.find(FormControl).simulate('focus');
|
126
|
+
assert.strictEqual(handleFocus.callCount, 1, 'should trigger focus callback');
|
127
|
+
wrapper.find(FormControl).simulate('blur');
|
128
|
+
assert.strictEqual(handleBlur.callCount, 1, 'should trigger blur callback');
|
129
|
+
});
|
130
|
+
});
|
131
|
+
describe('without callbacks (for 100% Branch coverage', function () {
|
132
|
+
it('should not be called', function () {
|
133
|
+
// wrapper = mount(
|
134
|
+
// <HiFormControl
|
135
|
+
// value="defaultValue"
|
136
|
+
// label="label"
|
137
|
+
// helperText="My helper"
|
138
|
+
// helperIcon
|
139
|
+
// />,
|
140
|
+
// );
|
141
|
+
wrapper.find(FormControl).simulate('blur');
|
142
|
+
});
|
143
|
+
});
|
144
|
+
describe('helpers', function () {
|
145
|
+
it('should be displayed', function () {
|
146
|
+
assert.strictEqual(wrapper.find('p').text(), 'helper', 'Should render helper');
|
147
|
+
});
|
148
|
+
});
|
149
|
+
describe('helpers on multiline', function () {
|
150
|
+
it('should be displayed', function () {
|
151
|
+
assert.strictEqual(wrapper.find('p').text(), 'helper', 'Should render helper');
|
152
|
+
});
|
153
|
+
it('should display nbChars/maxLength', function () {
|
154
|
+
wrapper.setProps({
|
155
|
+
multiline: true,
|
156
|
+
nbChars: 5,
|
157
|
+
maxLength: 200
|
158
|
+
});
|
159
|
+
assert.strictEqual(wrapper.find('p').text(), '5/200', 'Should render helper');
|
160
|
+
});
|
161
|
+
});
|
162
|
+
describe('helpers', function () {
|
163
|
+
it('should be displayed', function () {
|
164
|
+
wrapper.setProps({
|
165
|
+
helperIcon: true,
|
166
|
+
value: 'Default value',
|
167
|
+
label: 'label'
|
168
|
+
});
|
169
|
+
assert.strictEqual(wrapper.find('p').length, 0, 'Should not have helper p');
|
170
|
+
assert.strictEqual(wrapper.find(Info).length, 1, 'Should have helper icon');
|
171
|
+
assert.strictEqual(wrapper.childAt(0).text(), 'label', 'First child should be the label');
|
172
|
+
var helperIcon = wrapper.find(Info);
|
173
|
+
helperIcon.simulate('click');
|
174
|
+
assert.strictEqual(wrapper.childAt(0).text(), 'helperlabel', 'First child should be the helper div');
|
175
|
+
});
|
176
|
+
});
|
177
|
+
describe('errors', function () {
|
178
|
+
it('should be displayed', function () {
|
179
|
+
wrapper.unmount();
|
180
|
+
wrapper = mount(React.createElement(HiFormControl, {
|
181
|
+
value: "defaultValue",
|
182
|
+
label: "label",
|
183
|
+
error: true,
|
184
|
+
errorText: "My error"
|
185
|
+
}));
|
186
|
+
assert.strictEqual(wrapper.find('p').length, 0, 'Should not have error p');
|
187
|
+
assert.strictEqual(wrapper.find(HiIconButton).length, 1, 'Should have error icon');
|
188
|
+
assert.strictEqual(wrapper.childAt(0).text(), 'label', 'First child should be the label');
|
189
|
+
var errorIcon = wrapper.find(HiIconButton);
|
190
|
+
errorIcon.simulate('click');
|
191
|
+
assert.strictEqual(wrapper.childAt(0).text(), 'My errorlabel', 'First child should be the error div');
|
192
|
+
});
|
193
|
+
});
|
194
|
+
});
|
195
|
+
});
|
package/HiForm/HiFormLabel.js
CHANGED
@@ -1,42 +1,19 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends"));
|
11
|
-
|
12
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
13
|
-
|
14
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));
|
15
|
-
|
16
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));
|
17
|
-
|
18
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));
|
19
|
-
|
20
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));
|
21
|
-
|
22
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));
|
23
|
-
|
24
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
25
|
-
|
26
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
27
|
-
|
28
|
-
var _react = _interopRequireDefault(require("react"));
|
29
|
-
|
30
|
-
var _InputLabel = _interopRequireDefault(require("@material-ui/core/InputLabel"));
|
31
|
-
|
32
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
33
|
-
|
34
|
-
var _styles = require("@material-ui/core/styles");
|
35
|
-
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
3
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
4
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
5
|
+
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
6
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
8
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
36
9
|
// @inheritedComponent InputLabel
|
37
|
-
|
10
|
+
import React from 'react';
|
11
|
+
import InputLabel from '@material-ui/core/InputLabel';
|
12
|
+
import classNames from 'classnames';
|
13
|
+
import { withStyles } from '@material-ui/core/styles';
|
14
|
+
export var styles = function styles(theme) {
|
38
15
|
return {
|
39
|
-
root: (
|
16
|
+
root: _objectSpread({}, theme.typography.h4, {
|
40
17
|
fontWeight: theme.typography.fontWeightRegular,
|
41
18
|
color: theme.palette.neutral.main,
|
42
19
|
position: 'inherit',
|
@@ -64,20 +41,18 @@ var styles = function styles(theme) {
|
|
64
41
|
* Label pour champs de formulaire
|
65
42
|
*/
|
66
43
|
|
67
|
-
|
68
|
-
exports.styles = styles;
|
69
|
-
|
70
44
|
var HiFormLabel =
|
71
45
|
/*#__PURE__*/
|
72
46
|
function (_React$PureComponent) {
|
73
|
-
(
|
47
|
+
_inherits(HiFormLabel, _React$PureComponent);
|
74
48
|
|
75
49
|
function HiFormLabel() {
|
76
|
-
(
|
77
|
-
|
50
|
+
_classCallCheck(this, HiFormLabel);
|
51
|
+
|
52
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(HiFormLabel).apply(this, arguments));
|
78
53
|
}
|
79
54
|
|
80
|
-
(
|
55
|
+
_createClass(HiFormLabel, [{
|
81
56
|
key: "render",
|
82
57
|
value: function render() {
|
83
58
|
var _this$props = this.props,
|
@@ -90,9 +65,10 @@ function (_React$PureComponent) {
|
|
90
65
|
required = _this$props.required,
|
91
66
|
translations = _this$props.translations,
|
92
67
|
focused = _this$props.focused,
|
93
|
-
other = (
|
94
|
-
|
95
|
-
|
68
|
+
other = _objectWithoutProperties(_this$props, ["classes", "className", "children", "htmlFor", "label", "InputLabelProps", "required", "translations", "focused"]);
|
69
|
+
|
70
|
+
var className = classNames(classes.root, classNameProp);
|
71
|
+
return React.createElement(InputLabel, Object.assign({
|
96
72
|
htmlFor: htmlFor,
|
97
73
|
className: className,
|
98
74
|
focused: focused,
|
@@ -102,24 +78,23 @@ function (_React$PureComponent) {
|
|
102
78
|
error: classes.error,
|
103
79
|
focused: classes.focused
|
104
80
|
}
|
105
|
-
}, InputLabelProps, other), label, !required &&
|
81
|
+
}, InputLabelProps, other), label, !required && React.createElement("span", {
|
106
82
|
className: classes.optional
|
107
83
|
}, " ", translations.optional), children);
|
108
84
|
}
|
109
85
|
}]);
|
86
|
+
|
110
87
|
return HiFormLabel;
|
111
|
-
}(
|
88
|
+
}(React.PureComponent);
|
112
89
|
|
113
|
-
(
|
90
|
+
_defineProperty(HiFormLabel, "defaultProps", {
|
114
91
|
required: true,
|
115
92
|
translations: {
|
116
93
|
optional: 'optional'
|
117
94
|
}
|
118
95
|
});
|
119
96
|
|
120
|
-
|
97
|
+
export default withStyles(styles, {
|
121
98
|
hiComponent: true,
|
122
99
|
name: 'HmuiHiFormLabel'
|
123
|
-
})(HiFormLabel);
|
124
|
-
|
125
|
-
exports.default = _default;
|
100
|
+
})(HiFormLabel);
|