@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/HiTextField.js
CHANGED
@@ -1,62 +1,44 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
exports.default = void 0;
|
9
|
-
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends"));
|
11
|
-
|
12
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));
|
13
|
-
|
14
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));
|
15
|
-
|
16
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));
|
17
|
-
|
18
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));
|
19
|
-
|
20
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/assertThisInitialized"));
|
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 _react = _interopRequireDefault(require("react"));
|
27
|
-
|
28
|
-
var _HiFormControl = _interopRequireDefault(require("./HiFormControl"));
|
29
|
-
|
30
|
-
var _HiInput = _interopRequireDefault(require("./HiInput"));
|
31
|
-
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
3
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
4
|
+
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
5
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
6
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
32
8
|
// @inheritedComponent TextField
|
33
|
-
|
9
|
+
import React from 'react';
|
10
|
+
import HiFormControl from './HiFormControl';
|
11
|
+
import HiInput from './HiInput';
|
34
12
|
/**
|
35
13
|
* Champs input pour formulaire
|
36
14
|
*/
|
15
|
+
|
37
16
|
var HiTextField =
|
38
17
|
/*#__PURE__*/
|
39
18
|
function (_React$PureComponent) {
|
40
|
-
(
|
19
|
+
_inherits(HiTextField, _React$PureComponent);
|
41
20
|
|
42
21
|
function HiTextField(props) {
|
43
22
|
var _this;
|
44
23
|
|
45
|
-
(
|
46
|
-
|
47
|
-
(
|
24
|
+
_classCallCheck(this, HiTextField);
|
25
|
+
|
26
|
+
_this = _possibleConstructorReturn(this, _getPrototypeOf(HiTextField).call(this, props));
|
27
|
+
|
28
|
+
_defineProperty(_assertThisInitialized(_this), "focus", function () {
|
48
29
|
_this.input.focus();
|
49
30
|
});
|
31
|
+
|
50
32
|
_this.state = {
|
51
33
|
nbChars: props.value ? props.value.length : 0
|
52
34
|
};
|
53
|
-
_this.handleBlur = _this.handleBlur.bind((
|
54
|
-
_this.handleChange = _this.handleChange.bind((
|
55
|
-
_this.handleFocus = _this.handleFocus.bind((
|
35
|
+
_this.handleBlur = _this.handleBlur.bind(_assertThisInitialized(_this));
|
36
|
+
_this.handleChange = _this.handleChange.bind(_assertThisInitialized(_this));
|
37
|
+
_this.handleFocus = _this.handleFocus.bind(_assertThisInitialized(_this));
|
56
38
|
return _this;
|
57
39
|
}
|
58
40
|
|
59
|
-
(
|
41
|
+
_createClass(HiTextField, [{
|
60
42
|
key: "handleBlur",
|
61
43
|
value: function handleBlur(event) {
|
62
44
|
if (this.props.onBlur) {
|
@@ -113,7 +95,7 @@ function (_React$PureComponent) {
|
|
113
95
|
rows = _this$props.rows,
|
114
96
|
maxLength = _this$props.maxLength;
|
115
97
|
var nbChars = this.state.nbChars;
|
116
|
-
return
|
98
|
+
return React.createElement(HiFormControl, {
|
117
99
|
label: label,
|
118
100
|
required: required,
|
119
101
|
disabled: disabled,
|
@@ -127,7 +109,7 @@ function (_React$PureComponent) {
|
|
127
109
|
maxLength: maxLength,
|
128
110
|
nbChars: nbChars,
|
129
111
|
InputLabelProps: HiInputLabelProps
|
130
|
-
},
|
112
|
+
}, React.createElement(HiInput, Object.assign({
|
131
113
|
inputId: id,
|
132
114
|
name: name,
|
133
115
|
type: type,
|
@@ -150,10 +132,11 @@ function (_React$PureComponent) {
|
|
150
132
|
}, HiInputProps)));
|
151
133
|
}
|
152
134
|
}]);
|
135
|
+
|
153
136
|
return HiTextField;
|
154
|
-
}(
|
137
|
+
}(React.PureComponent);
|
155
138
|
|
156
|
-
(
|
139
|
+
_defineProperty(HiTextField, "defaultProps", {
|
157
140
|
name: '',
|
158
141
|
type: 'text',
|
159
142
|
fullWidth: true,
|
@@ -166,5 +149,5 @@ function (_React$PureComponent) {
|
|
166
149
|
multiline: false,
|
167
150
|
maxLength: 280
|
168
151
|
});
|
169
|
-
|
170
|
-
|
152
|
+
|
153
|
+
export default HiTextField;
|
@@ -0,0 +1,254 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { assert } from 'chai';
|
3
|
+
import { spy } from 'sinon';
|
4
|
+
import { createShallow, createMount } from '../test-utils';
|
5
|
+
import Warning from '@material-ui/icons/Warning';
|
6
|
+
import Info from '@material-ui/icons/Info';
|
7
|
+
import HiTextField from './HiTextField';
|
8
|
+
import HiInput from './HiInput';
|
9
|
+
describe('<HiTextField />', function () {
|
10
|
+
var shallow;
|
11
|
+
var mount;
|
12
|
+
before(function () {
|
13
|
+
shallow = createShallow({
|
14
|
+
dive: true
|
15
|
+
});
|
16
|
+
});
|
17
|
+
beforeEach(function () {
|
18
|
+
mount = createMount();
|
19
|
+
});
|
20
|
+
afterEach(function () {
|
21
|
+
mount.cleanUp();
|
22
|
+
});
|
23
|
+
describe('shallow', function () {
|
24
|
+
var wrapper;
|
25
|
+
beforeEach(function () {
|
26
|
+
wrapper = shallow(React.createElement(HiTextField, {
|
27
|
+
id: "text",
|
28
|
+
HiInputProps: {
|
29
|
+
name: 'testName',
|
30
|
+
startAdornment: 'Archive',
|
31
|
+
className: 'fullWidth'
|
32
|
+
}
|
33
|
+
}));
|
34
|
+
});
|
35
|
+
describe('shallow', function () {
|
36
|
+
it('should be a FormControl', function () {
|
37
|
+
assert.strictEqual(wrapper.name(), 'HiFormControl');
|
38
|
+
assert.strictEqual(wrapper.dive().name(), 'WithStyles(FormControl)');
|
39
|
+
});
|
40
|
+
it('should have initial props', function () {
|
41
|
+
assert.strictEqual(wrapper.props().error, false);
|
42
|
+
assert.strictEqual(wrapper.childAt(0).props().error, false);
|
43
|
+
});
|
44
|
+
it('should pass className to the FormControl', function () {
|
45
|
+
wrapper.setProps({
|
46
|
+
className: 'foo'
|
47
|
+
});
|
48
|
+
assert.strictEqual(wrapper.dive().hasClass('foo'), true);
|
49
|
+
});
|
50
|
+
it('should have an HiInput as the only child', function () {
|
51
|
+
assert.strictEqual(wrapper.children().length, 1);
|
52
|
+
assert.strictEqual(wrapper.childAt(0).type(), HiInput);
|
53
|
+
});
|
54
|
+
it('should forward the error prop to Input', function () {
|
55
|
+
wrapper = shallow(React.createElement(HiTextField, {
|
56
|
+
id: "text",
|
57
|
+
error: true
|
58
|
+
}));
|
59
|
+
assert.strictEqual(wrapper.childAt(0).props().error, true);
|
60
|
+
});
|
61
|
+
it('should forward the fullWidth prop to FormControl', function () {
|
62
|
+
wrapper = shallow(React.createElement(HiTextField, {
|
63
|
+
id: "text",
|
64
|
+
fullWidth: true
|
65
|
+
}));
|
66
|
+
assert.strictEqual(wrapper.props().fullWidth, true);
|
67
|
+
});
|
68
|
+
it('should pass HiInputProps to the HiInput', function () {
|
69
|
+
assert.strictEqual(wrapper.find(HiInput).props().startAdornment, 'Archive');
|
70
|
+
});
|
71
|
+
it('should apply additional properties to the Input component', function () {
|
72
|
+
wrapper.setProps({
|
73
|
+
HiInputProps: {
|
74
|
+
className: 'fullWidth'
|
75
|
+
}
|
76
|
+
});
|
77
|
+
assert.strictEqual(wrapper.find(HiInput).props().className, 'fullWidth');
|
78
|
+
});
|
79
|
+
});
|
80
|
+
describe('with a label', function () {
|
81
|
+
beforeEach(function () {
|
82
|
+
wrapper.setProps({
|
83
|
+
label: 'Foo bar'
|
84
|
+
});
|
85
|
+
});
|
86
|
+
it('should have 1 child', function () {
|
87
|
+
assert.strictEqual(wrapper.children().length, 1);
|
88
|
+
});
|
89
|
+
it('should have an HiInput as the first child', function () {
|
90
|
+
assert.strictEqual(wrapper.childAt(0).type(), HiInput);
|
91
|
+
});
|
92
|
+
});
|
93
|
+
describe('with a helper text', function () {
|
94
|
+
beforeEach(function () {
|
95
|
+
wrapper.setProps({
|
96
|
+
helperText: 'Foo bar'
|
97
|
+
});
|
98
|
+
});
|
99
|
+
it('should have 1 child', function () {
|
100
|
+
assert.strictEqual(wrapper.children().length, 1);
|
101
|
+
});
|
102
|
+
/* it('should have a FormHelperText as the second child', () => {
|
103
|
+
assert.strictEqual(wrapper.childAt(1).type(), FormHelperText);
|
104
|
+
}); */
|
105
|
+
|
106
|
+
it('should have an HiInput as the first child', function () {
|
107
|
+
assert.strictEqual(wrapper.childAt(0).type(), HiInput);
|
108
|
+
});
|
109
|
+
});
|
110
|
+
});
|
111
|
+
describe('mount', function () {
|
112
|
+
var wrapper;
|
113
|
+
var handleChange = spy();
|
114
|
+
var handleReset = spy();
|
115
|
+
var handleBlur = spy();
|
116
|
+
var handleFocus = spy();
|
117
|
+
describe('callbacks', function () {
|
118
|
+
it('should be called', function () {
|
119
|
+
wrapper = mount(React.createElement(HiTextField, {
|
120
|
+
id: "text",
|
121
|
+
onChange: handleChange,
|
122
|
+
onReset: handleReset,
|
123
|
+
onBlur: handleBlur,
|
124
|
+
onFocus: handleFocus,
|
125
|
+
value: "defaultValue",
|
126
|
+
helperText: "helper",
|
127
|
+
maxLength: 20
|
128
|
+
}));
|
129
|
+
wrapper.find('input').simulate('change', {
|
130
|
+
target: {
|
131
|
+
value: 'newValue'
|
132
|
+
}
|
133
|
+
});
|
134
|
+
assert.strictEqual(handleChange.callCount, 1, 'should trigger change callback');
|
135
|
+
assert.strictEqual(handleChange.args[0][0].target.value, 'newValue');
|
136
|
+
assert.strictEqual(wrapper.state().nbChars, 12);
|
137
|
+
wrapper.find('input').simulate('change', {
|
138
|
+
target: {
|
139
|
+
value: '1234567890123456789012345'
|
140
|
+
}
|
141
|
+
});
|
142
|
+
assert.strictEqual(handleChange.callCount, 1, 'should not trigger change callback');
|
143
|
+
assert.strictEqual(wrapper.state().nbChars, 12);
|
144
|
+
wrapper.find('input').simulate('focus');
|
145
|
+
assert.strictEqual(handleFocus.callCount, 1, 'should trigger focus callback');
|
146
|
+
wrapper.find('button').simulate('click');
|
147
|
+
assert.strictEqual(handleReset.callCount, 1, 'should trigger reset callback');
|
148
|
+
wrapper.find('input').simulate('blur');
|
149
|
+
assert.strictEqual(handleBlur.callCount, 1, 'should trigger blur callback');
|
150
|
+
});
|
151
|
+
});
|
152
|
+
describe('without callbacks (for 100% Branch coverage', function () {
|
153
|
+
it('should not be called', function () {
|
154
|
+
wrapper = mount(React.createElement(HiTextField, {
|
155
|
+
id: "text",
|
156
|
+
value: "defaultValue",
|
157
|
+
label: "label",
|
158
|
+
helperText: "My helper",
|
159
|
+
helperIcon: true,
|
160
|
+
onReset: function onReset() {}
|
161
|
+
}));
|
162
|
+
wrapper.find('input').simulate('change', {
|
163
|
+
target: {
|
164
|
+
value: 'newValue'
|
165
|
+
}
|
166
|
+
});
|
167
|
+
assert.strictEqual(wrapper.find('button').length, 1, 'should not have clear icon');
|
168
|
+
wrapper.find('input').simulate('focus');
|
169
|
+
assert.strictEqual(wrapper.find('button').length, 2, 'should not have clear icon');
|
170
|
+
wrapper.find('button').at(1).simulate('click');
|
171
|
+
wrapper.find('input').simulate('blur');
|
172
|
+
});
|
173
|
+
});
|
174
|
+
describe('helpers', function () {
|
175
|
+
it('should be displayed', function () {
|
176
|
+
wrapper = mount(React.createElement(HiTextField, {
|
177
|
+
id: "text",
|
178
|
+
onChange: handleChange,
|
179
|
+
onReset: handleReset,
|
180
|
+
onBlur: handleBlur,
|
181
|
+
onFocus: handleFocus,
|
182
|
+
value: "defaultValue",
|
183
|
+
helperText: "helper",
|
184
|
+
maxLength: 20
|
185
|
+
}));
|
186
|
+
assert.strictEqual(wrapper.find('p').text(), 'helper', 'Should render helper');
|
187
|
+
});
|
188
|
+
});
|
189
|
+
describe('helpers', function () {
|
190
|
+
it('should be displayed', function () {
|
191
|
+
wrapper = mount(React.createElement(HiTextField, {
|
192
|
+
id: "text",
|
193
|
+
value: "defaultValue",
|
194
|
+
label: "label",
|
195
|
+
helperText: "My helper",
|
196
|
+
helperIcon: true
|
197
|
+
}));
|
198
|
+
assert.strictEqual(wrapper.find('p').length, 0, 'Should not have helper p');
|
199
|
+
assert.strictEqual(wrapper.find(Info).length, 1, 'Should have helper icon');
|
200
|
+
assert.strictEqual(wrapper.childAt(0).text(), 'label', 'First child should be the label');
|
201
|
+
var helperIcon = wrapper.find(Info);
|
202
|
+
helperIcon.simulate('click');
|
203
|
+
assert.strictEqual(wrapper.childAt(0).text(), 'My helperlabel', 'First child should be the helper div');
|
204
|
+
});
|
205
|
+
});
|
206
|
+
describe('errors', function () {
|
207
|
+
it('should be displayed', function () {
|
208
|
+
wrapper = mount(React.createElement(HiTextField, {
|
209
|
+
id: "text",
|
210
|
+
value: "defaultValue",
|
211
|
+
label: "label",
|
212
|
+
error: true,
|
213
|
+
errorText: "My error"
|
214
|
+
}));
|
215
|
+
assert.strictEqual(wrapper.find('p').length, 0, 'Should not have error p');
|
216
|
+
assert.strictEqual(wrapper.find(Warning).length, 1, 'Should have error icon');
|
217
|
+
assert.strictEqual(wrapper.childAt(0).text(), 'label', 'First child should be the label');
|
218
|
+
var errorIcon = wrapper.find(Warning);
|
219
|
+
errorIcon.simulate('click');
|
220
|
+
assert.strictEqual(wrapper.childAt(0).text(), 'My errorlabel', 'First child should be the error div');
|
221
|
+
});
|
222
|
+
});
|
223
|
+
describe('state with multiline', function () {
|
224
|
+
it('should be good', function () {
|
225
|
+
var handleChange1 = spy();
|
226
|
+
wrapper = mount(React.createElement(HiTextField, {
|
227
|
+
id: "text",
|
228
|
+
onChange: handleChange1,
|
229
|
+
value: "defaultValue",
|
230
|
+
multiline: true
|
231
|
+
}));
|
232
|
+
assert.strictEqual(wrapper.state().nbChars, 12);
|
233
|
+
wrapper.find('textarea').first().simulate('change', {
|
234
|
+
target: {
|
235
|
+
value: 'newValue'
|
236
|
+
}
|
237
|
+
});
|
238
|
+
wrapper.find('textarea').at(1).simulate('change', {
|
239
|
+
target: {
|
240
|
+
value: 'newValue'
|
241
|
+
}
|
242
|
+
});
|
243
|
+
wrapper.find('textarea').at(2).simulate('change', {
|
244
|
+
target: {
|
245
|
+
value: 'newValue'
|
246
|
+
}
|
247
|
+
});
|
248
|
+
assert.strictEqual(handleChange1.callCount, 1, 'should trigger change callback');
|
249
|
+
assert.strictEqual(handleChange1.args[0][0].target.value, 'newValue');
|
250
|
+
assert.strictEqual(wrapper.state().nbChars, 8);
|
251
|
+
});
|
252
|
+
});
|
253
|
+
});
|
254
|
+
});
|
package/HiForm/HiUpload.js
CHANGED
@@ -1,43 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
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 _react = _interopRequireDefault(require("react"));
|
29
|
-
|
30
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
31
|
-
|
32
|
-
var _index = _interopRequireDefault(require("keycode/index"));
|
33
|
-
|
34
|
-
var _styles = require("@material-ui/core/styles");
|
35
|
-
|
36
|
-
var _HiUploadInput = _interopRequireDefault(require("./HiUploadInput"));
|
37
|
-
|
38
|
-
var _HiIcon = _interopRequireDefault(require("../HiIcon"));
|
39
|
-
|
40
|
-
var styles = function styles(theme) {
|
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 React from 'react';
|
10
|
+
import classNames from 'classnames';
|
11
|
+
import keycode from 'keycode/index';
|
12
|
+
import { withStyles } from '@material-ui/core/styles';
|
13
|
+
import HiUploadInput from './HiUploadInput';
|
14
|
+
import HiIcon from '../HiIcon';
|
15
|
+
export var styles = function styles(theme) {
|
41
16
|
return {
|
42
17
|
flexContainer: {
|
43
18
|
display: 'flex',
|
@@ -86,19 +61,19 @@ var styles = function styles(theme) {
|
|
86
61
|
};
|
87
62
|
};
|
88
63
|
|
89
|
-
exports.styles = styles;
|
90
|
-
|
91
64
|
var HiUpload =
|
92
65
|
/*#__PURE__*/
|
93
66
|
function (_React$PureComponent) {
|
94
|
-
(
|
67
|
+
_inherits(HiUpload, _React$PureComponent);
|
95
68
|
|
96
69
|
function HiUpload() {
|
97
70
|
var _this;
|
98
71
|
|
99
|
-
(
|
100
|
-
|
101
|
-
|
72
|
+
_classCallCheck(this, HiUpload);
|
73
|
+
|
74
|
+
_this = _possibleConstructorReturn(this, _getPrototypeOf(HiUpload).call(this));
|
75
|
+
|
76
|
+
_defineProperty(_assertThisInitialized(_this), "handleDrop", function (event) {
|
102
77
|
if (event.path[0].id === _this.uploadIconRef.props.id) {
|
103
78
|
event.preventDefault();
|
104
79
|
event.stopPropagation();
|
@@ -120,7 +95,8 @@ function (_React$PureComponent) {
|
|
120
95
|
}
|
121
96
|
}
|
122
97
|
});
|
123
|
-
|
98
|
+
|
99
|
+
_defineProperty(_assertThisInitialized(_this), "handleDragEnter", function (event) {
|
124
100
|
event.preventDefault();
|
125
101
|
event.stopPropagation();
|
126
102
|
|
@@ -144,7 +120,8 @@ function (_React$PureComponent) {
|
|
144
120
|
}
|
145
121
|
}
|
146
122
|
});
|
147
|
-
|
123
|
+
|
124
|
+
_defineProperty(_assertThisInitialized(_this), "handleDragLeave", function (event) {
|
148
125
|
event.preventDefault();
|
149
126
|
event.stopPropagation();
|
150
127
|
|
@@ -160,18 +137,21 @@ function (_React$PureComponent) {
|
|
160
137
|
});
|
161
138
|
}
|
162
139
|
});
|
163
|
-
|
140
|
+
|
141
|
+
_defineProperty(_assertThisInitialized(_this), "handleChange", function (event) {
|
164
142
|
var index = _this.getNextInputIndex();
|
165
143
|
|
166
144
|
var param = _this.handleFile(event.target.files, index);
|
167
145
|
|
168
146
|
_this.props.onChange(param, index);
|
169
147
|
});
|
170
|
-
|
148
|
+
|
149
|
+
_defineProperty(_assertThisInitialized(_this), "handleEmptyField", function (event) {
|
171
150
|
event.target.value = '';
|
172
151
|
});
|
173
|
-
|
174
|
-
|
152
|
+
|
153
|
+
_defineProperty(_assertThisInitialized(_this), "handleKeyPress", function (event) {
|
154
|
+
var key = keycode(event);
|
175
155
|
|
176
156
|
if (key === 'enter' || key === 'space') {
|
177
157
|
event.preventDefault();
|
@@ -179,7 +159,8 @@ function (_React$PureComponent) {
|
|
179
159
|
_this.uploadInput.click();
|
180
160
|
}
|
181
161
|
});
|
182
|
-
|
162
|
+
|
163
|
+
_defineProperty(_assertThisInitialized(_this), "handleFile", function (files, index) {
|
183
164
|
var error = false;
|
184
165
|
var errorMessage = '';
|
185
166
|
var file = null;
|
@@ -206,7 +187,8 @@ function (_React$PureComponent) {
|
|
206
187
|
value: file
|
207
188
|
};
|
208
189
|
});
|
209
|
-
|
190
|
+
|
191
|
+
_defineProperty(_assertThisInitialized(_this), "createInputs", function (others) {
|
210
192
|
var _this$props = _this.props,
|
211
193
|
inputs = _this$props.inputs,
|
212
194
|
values = _this$props.values;
|
@@ -220,7 +202,7 @@ function (_React$PureComponent) {
|
|
220
202
|
|
221
203
|
for (var i = 0; i < files.length; i += 1) {
|
222
204
|
if (files.length > 1 || values[i] && values[i].value) {
|
223
|
-
inputComponents.push(
|
205
|
+
inputComponents.push(React.createElement(HiUploadInput, Object.assign({
|
224
206
|
maxSize: inputs[i] ? inputs[i].maxSize : undefined,
|
225
207
|
acceptedTypes: inputs[i] ? inputs[i].acceptedTypes : undefined,
|
226
208
|
placeholder: inputs[i] ? inputs[i].placeholder : undefined,
|
@@ -238,7 +220,9 @@ function (_React$PureComponent) {
|
|
238
220
|
|
239
221
|
return inputComponents;
|
240
222
|
});
|
241
|
-
|
223
|
+
|
224
|
+
_defineProperty(_assertThisInitialized(_this), "uploadFieldRef", void 0);
|
225
|
+
|
242
226
|
_this.state = {
|
243
227
|
dragOver: false,
|
244
228
|
droppable: false
|
@@ -247,7 +231,7 @@ function (_React$PureComponent) {
|
|
247
231
|
} // When component mounts, we add eventListeners to handle the file drag and drop
|
248
232
|
|
249
233
|
|
250
|
-
(
|
234
|
+
_createClass(HiUpload, [{
|
251
235
|
key: "componentDidMount",
|
252
236
|
value: function componentDidMount() {
|
253
237
|
this.uploadFieldRef.addEventListener('dragenter', this.handleDragEnter, false);
|
@@ -300,7 +284,8 @@ function (_React$PureComponent) {
|
|
300
284
|
classes = _this$props2.classes,
|
301
285
|
values = _this$props2.values,
|
302
286
|
focused = _this$props2.focused,
|
303
|
-
others = (
|
287
|
+
others = _objectWithoutProperties(_this$props2, ["id", "inputs", "classes", "values", "focused"]);
|
288
|
+
|
304
289
|
var _this$state = this.state,
|
305
290
|
dragOver = _this$state.dragOver,
|
306
291
|
droppable = _this$state.droppable;
|
@@ -326,7 +311,7 @@ function (_React$PureComponent) {
|
|
326
311
|
}
|
327
312
|
}
|
328
313
|
|
329
|
-
var statusClass = (
|
314
|
+
var statusClass = classNames(classes.statusIcon, (_classNames = {}, _defineProperty(_classNames, classes.empty, empty), _defineProperty(_classNames, classes.complete, complete), _classNames));
|
330
315
|
var icon;
|
331
316
|
|
332
317
|
if (error) {
|
@@ -343,15 +328,15 @@ function (_React$PureComponent) {
|
|
343
328
|
focusable = false;
|
344
329
|
}
|
345
330
|
|
346
|
-
var iconClass = (
|
347
|
-
return
|
331
|
+
var iconClass = classNames(statusClass, classes.fileButton, (_classNames2 = {}, _defineProperty(_classNames2, classes.dragOver, dragOver), _defineProperty(_classNames2, classes.droppable, droppable), _defineProperty(_classNames2, classes.focused, focused), _defineProperty(_classNames2, classes.error, error && !focused), _defineProperty(_classNames2, classes.focusable, focusable), _classNames2));
|
332
|
+
return React.createElement("div", {
|
348
333
|
className: classes.flexContainer
|
349
|
-
},
|
334
|
+
}, React.createElement("label", {
|
350
335
|
ref: function ref(label) {
|
351
336
|
_this2.uploadFieldRef = label;
|
352
337
|
},
|
353
338
|
tabIndex: "-1"
|
354
|
-
},
|
339
|
+
}, React.createElement("input", {
|
355
340
|
hidden: true,
|
356
341
|
type: !complete || values.length === 1 ? 'file' : 'hidden',
|
357
342
|
onChange: this.handleChange,
|
@@ -359,7 +344,7 @@ function (_React$PureComponent) {
|
|
359
344
|
ref: function ref(el) {
|
360
345
|
_this2.uploadInput = el;
|
361
346
|
}
|
362
|
-
}),
|
347
|
+
}), React.createElement(HiIcon, {
|
363
348
|
ref: function ref(uploadIcon) {
|
364
349
|
_this2.uploadIconRef = uploadIcon;
|
365
350
|
},
|
@@ -369,17 +354,16 @@ function (_React$PureComponent) {
|
|
369
354
|
size: 32,
|
370
355
|
tabIndex: focusable ? '0' : '-1',
|
371
356
|
onKeyPress: this.handleKeyPress
|
372
|
-
})),
|
357
|
+
})), React.createElement("div", {
|
373
358
|
className: classes.inputContainer
|
374
359
|
}, this.createInputs(others)));
|
375
360
|
}
|
376
361
|
}]);
|
362
|
+
|
377
363
|
return HiUpload;
|
378
|
-
}(
|
364
|
+
}(React.PureComponent);
|
379
365
|
|
380
|
-
|
366
|
+
export default withStyles(styles, {
|
381
367
|
hiComponent: true,
|
382
368
|
name: 'HmuiHiUpload'
|
383
|
-
})(HiUpload);
|
384
|
-
|
385
|
-
exports.default = _default;
|
369
|
+
})(HiUpload);
|