@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
@@ -0,0 +1,60 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { assert } from 'chai';
|
3
|
+
import { createShallow, createMount } from '../test-utils';
|
4
|
+
import HiPasswordField from './HiPasswordField';
|
5
|
+
import HiTextField from './HiTextField';
|
6
|
+
import HiInput from './HiInput';
|
7
|
+
describe('<HiPasswordField />', function () {
|
8
|
+
var shallow;
|
9
|
+
var mount;
|
10
|
+
before(function () {
|
11
|
+
shallow = createShallow({
|
12
|
+
dive: true
|
13
|
+
});
|
14
|
+
mount = createMount();
|
15
|
+
});
|
16
|
+
after(function () {
|
17
|
+
mount.cleanUp();
|
18
|
+
});
|
19
|
+
describe('shallow', function () {
|
20
|
+
var wrapper;
|
21
|
+
beforeEach(function () {
|
22
|
+
wrapper = shallow(React.createElement(HiPasswordField, {
|
23
|
+
id: "password"
|
24
|
+
}));
|
25
|
+
});
|
26
|
+
describe('structure', function () {
|
27
|
+
it('should pass className to the FormControl', function () {
|
28
|
+
wrapper.setProps({
|
29
|
+
className: 'foo'
|
30
|
+
});
|
31
|
+
assert.strictEqual(wrapper.dive().hasClass('foo'), true);
|
32
|
+
});
|
33
|
+
it('should forward the fullWidth prop to FormControl', function () {
|
34
|
+
wrapper = shallow(React.createElement(HiPasswordField, {
|
35
|
+
id: "password",
|
36
|
+
fullWidth: true
|
37
|
+
}));
|
38
|
+
assert.strictEqual(wrapper.props().fullWidth, true);
|
39
|
+
});
|
40
|
+
it('should forward the fullWidth prop to FormControl', function () {
|
41
|
+
// Handle suggestions
|
42
|
+
assert.strictEqual(wrapper.state().showText, false);
|
43
|
+
wrapper.find(HiTextField).props().onRightIconClick();
|
44
|
+
assert.strictEqual(wrapper.state().showText, true);
|
45
|
+
wrapper.find(HiTextField).props().onRightIconClick();
|
46
|
+
assert.strictEqual(wrapper.state().showText, false);
|
47
|
+
});
|
48
|
+
it('should have placeholder prop to HiInput', function () {
|
49
|
+
assert.strictEqual(wrapper.find(HiTextField).dive().find(HiInput).props().placeholder, '');
|
50
|
+
wrapper.setProps({
|
51
|
+
HiInputProps: {
|
52
|
+
placeholder: 'Password'
|
53
|
+
}
|
54
|
+
});
|
55
|
+
wrapper.update();
|
56
|
+
assert.strictEqual(wrapper.find(HiTextField).dive().find(HiInput).props().placeholder, 'Password');
|
57
|
+
});
|
58
|
+
});
|
59
|
+
});
|
60
|
+
});
|
@@ -1,60 +1,41 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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 _react = _interopRequireDefault(require("react"));
|
29
|
-
|
30
|
-
var _HiInput = _interopRequireDefault(require("./HiInput"));
|
31
|
-
|
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 HiInput from './HiInput';
|
32
11
|
/**
|
33
12
|
* Construit une barre de recherche avec icône Search (Magnify),
|
34
13
|
* permet de filtrer une liste d'éléments en spécifiant le nom de la/les propriétés sur lesquelles filtrer,
|
35
14
|
* retour la liste d'élément filtré.
|
36
15
|
* Un bouton reset s'affiche à la saisie permettant de réinitialiser l'input.
|
37
16
|
*/
|
17
|
+
|
38
18
|
var HiSearchField =
|
39
19
|
/*#__PURE__*/
|
40
20
|
function (_React$Component) {
|
41
|
-
(
|
21
|
+
_inherits(HiSearchField, _React$Component);
|
42
22
|
|
43
23
|
function HiSearchField(props) {
|
44
24
|
var _this;
|
45
25
|
|
46
|
-
(
|
47
|
-
|
26
|
+
_classCallCheck(this, HiSearchField);
|
27
|
+
|
28
|
+
_this = _possibleConstructorReturn(this, _getPrototypeOf(HiSearchField).call(this, props));
|
48
29
|
_this.state = {
|
49
30
|
inputValue: ''
|
50
31
|
};
|
51
|
-
_this.filterOnProperties = _this.filterOnProperties.bind((
|
52
|
-
_this.handleChange = _this.handleChange.bind((
|
53
|
-
_this.handleReset = _this.handleReset.bind((
|
32
|
+
_this.filterOnProperties = _this.filterOnProperties.bind(_assertThisInitialized(_this));
|
33
|
+
_this.handleChange = _this.handleChange.bind(_assertThisInitialized(_this));
|
34
|
+
_this.handleReset = _this.handleReset.bind(_assertThisInitialized(_this));
|
54
35
|
return _this;
|
55
36
|
}
|
56
37
|
|
57
|
-
(
|
38
|
+
_createClass(HiSearchField, [{
|
58
39
|
key: "filterOnProperties",
|
59
40
|
value: function filterOnProperties(item, search) {
|
60
41
|
if (!this.props.filterPropertyList || this.props.filterPropertyList.length < 1) {
|
@@ -137,8 +118,9 @@ function (_React$Component) {
|
|
137
118
|
value: function render() {
|
138
119
|
var _this$props = this.props,
|
139
120
|
placeholder = _this$props.placeholder,
|
140
|
-
others = (
|
141
|
-
|
121
|
+
others = _objectWithoutProperties(_this$props, ["placeholder"]);
|
122
|
+
|
123
|
+
return React.createElement(HiInput, Object.assign({
|
142
124
|
placeholder: placeholder,
|
143
125
|
onReset: this.handleReset,
|
144
126
|
onChange: this.handleChange,
|
@@ -147,11 +129,12 @@ function (_React$Component) {
|
|
147
129
|
}, others));
|
148
130
|
}
|
149
131
|
}]);
|
132
|
+
|
150
133
|
return HiSearchField;
|
151
|
-
}(
|
134
|
+
}(React.Component);
|
152
135
|
|
153
|
-
(
|
136
|
+
_defineProperty(HiSearchField, "defaultProps", {
|
154
137
|
placeholder: 'Search'
|
155
138
|
});
|
156
|
-
|
157
|
-
|
139
|
+
|
140
|
+
export default HiSearchField;
|
@@ -0,0 +1,193 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { assert } from 'chai';
|
3
|
+
import { spy } from 'sinon';
|
4
|
+
import { createShallow, createMount } from '../test-utils';
|
5
|
+
import HiSearchField from './HiSearchField';
|
6
|
+
describe('<HiSearchField />', function () {
|
7
|
+
var shallow;
|
8
|
+
var mount;
|
9
|
+
before(function () {
|
10
|
+
shallow = createShallow({
|
11
|
+
untilSelector: 'HiSearchField'
|
12
|
+
});
|
13
|
+
});
|
14
|
+
beforeEach(function () {
|
15
|
+
mount = createMount();
|
16
|
+
});
|
17
|
+
after(function () {
|
18
|
+
mount.cleanUp();
|
19
|
+
});
|
20
|
+
it('should render a <div />', function () {
|
21
|
+
var wrapper = shallow(React.createElement(HiSearchField, {
|
22
|
+
itemList: [],
|
23
|
+
onFilteredList: function onFilteredList() {
|
24
|
+
return null;
|
25
|
+
}
|
26
|
+
}));
|
27
|
+
assert.strictEqual(wrapper.name(), 'div');
|
28
|
+
});
|
29
|
+
it('should render an <input /> inside the div', function () {
|
30
|
+
var wrapper = mount(React.createElement(HiSearchField, {
|
31
|
+
itemList: [],
|
32
|
+
onFilteredList: function onFilteredList() {
|
33
|
+
return null;
|
34
|
+
}
|
35
|
+
}));
|
36
|
+
var input = wrapper.find('input');
|
37
|
+
assert.strictEqual(input.name(), 'input');
|
38
|
+
assert.strictEqual(input.props().type, 'text', 'should pass the text type prop');
|
39
|
+
});
|
40
|
+
it('should fire onChange event callbacks', function () {
|
41
|
+
var handleChange = spy();
|
42
|
+
var wrapper = mount(React.createElement(HiSearchField, {
|
43
|
+
itemList: [],
|
44
|
+
onFilteredList: handleChange
|
45
|
+
}));
|
46
|
+
wrapper.find('input').simulate('change');
|
47
|
+
assert.strictEqual(handleChange.calledOnce, true, 'should have called the callback');
|
48
|
+
});
|
49
|
+
it('should fire onChange event callbacks and call onSearch', function () {
|
50
|
+
var handleChange = spy();
|
51
|
+
var onSearch = spy();
|
52
|
+
var wrapper = mount(React.createElement(HiSearchField, {
|
53
|
+
itemList: [],
|
54
|
+
onFilteredList: handleChange,
|
55
|
+
onSearch: onSearch
|
56
|
+
}));
|
57
|
+
wrapper.find('input').simulate('change', 'value');
|
58
|
+
assert.strictEqual(onSearch.calledOnce, true, 'should have called the callback');
|
59
|
+
});
|
60
|
+
it('should handle flatten array', function () {
|
61
|
+
var handleChange = spy();
|
62
|
+
var itemList = ['zizou', 'zizou', 'manu'];
|
63
|
+
var wrapper = mount(React.createElement(HiSearchField, {
|
64
|
+
itemList: itemList,
|
65
|
+
onFilteredList: handleChange
|
66
|
+
}));
|
67
|
+
wrapper.find('input').simulate('change');
|
68
|
+
assert.strictEqual(handleChange.calledOnce, true, 'should have called the callback');
|
69
|
+
});
|
70
|
+
it('should handle nested array', function () {
|
71
|
+
var handleChange = spy();
|
72
|
+
var itemList = [{
|
73
|
+
id: 'zz',
|
74
|
+
label: 'Zizou'
|
75
|
+
}, {
|
76
|
+
id: 'zze',
|
77
|
+
label: 'Zizou encore'
|
78
|
+
}, {
|
79
|
+
id: 'ep',
|
80
|
+
label: 'Emmanuel Petit'
|
81
|
+
}];
|
82
|
+
var wrapper = mount(React.createElement(HiSearchField, {
|
83
|
+
itemList: itemList,
|
84
|
+
onFilteredList: handleChange,
|
85
|
+
filterPropertyList: ['label']
|
86
|
+
}));
|
87
|
+
wrapper.find('input').simulate('change');
|
88
|
+
assert.strictEqual(handleChange.calledOnce, true, 'should have called the callback');
|
89
|
+
});
|
90
|
+
it('should handle double nested array', function () {
|
91
|
+
var handleChange = spy();
|
92
|
+
var itemList = [{
|
93
|
+
id: 'zz',
|
94
|
+
record: {
|
95
|
+
label: 'Zizou'
|
96
|
+
}
|
97
|
+
}, {
|
98
|
+
id: 'zze',
|
99
|
+
record: {
|
100
|
+
label: 'Zizou encore'
|
101
|
+
}
|
102
|
+
}, {
|
103
|
+
id: 'ep',
|
104
|
+
record: {
|
105
|
+
label: 'Emmanuel Petit'
|
106
|
+
}
|
107
|
+
}];
|
108
|
+
var wrapper = mount(React.createElement(HiSearchField, {
|
109
|
+
itemList: itemList,
|
110
|
+
onFilteredList: handleChange,
|
111
|
+
filterPropertyList: ['record.label']
|
112
|
+
}));
|
113
|
+
wrapper.find('input').simulate('change');
|
114
|
+
assert.strictEqual(handleChange.calledOnce, true, 'should have called the callback');
|
115
|
+
});
|
116
|
+
it('should return filtered list on search value and add reset button', function () {
|
117
|
+
var itemList = [{
|
118
|
+
id: 'zz',
|
119
|
+
label: 'Zizou'
|
120
|
+
}, {
|
121
|
+
id: 'zze',
|
122
|
+
label: 'Zizou encore'
|
123
|
+
}, {
|
124
|
+
id: 'ep',
|
125
|
+
label: 'Emmanuel Petit'
|
126
|
+
}];
|
127
|
+
var searchValue = 'peTit';
|
128
|
+
var expectedFilteredItemList = [{
|
129
|
+
id: 'ep',
|
130
|
+
label: 'Emmanuel Petit'
|
131
|
+
}];
|
132
|
+
var handleChange = spy();
|
133
|
+
var wrapper = mount(React.createElement(HiSearchField, {
|
134
|
+
itemList: itemList,
|
135
|
+
onFilteredList: handleChange,
|
136
|
+
filterPropertyList: ['label']
|
137
|
+
})); // Fill input
|
138
|
+
|
139
|
+
var event = {
|
140
|
+
target: {
|
141
|
+
value: searchValue
|
142
|
+
}
|
143
|
+
};
|
144
|
+
wrapper.find('input').simulate('change', event);
|
145
|
+
assert.strictEqual(handleChange.calledWith(expectedFilteredItemList), true, 'should have called the callback with filtered item list');
|
146
|
+
assert.strictEqual(handleChange.calledWith(itemList), false, 'should not have called yet the callback with full item list');
|
147
|
+
assert.strictEqual(wrapper.find('button').length, 0, 'should not have clear icon');
|
148
|
+
wrapper.find('input').simulate('focus');
|
149
|
+
var resetButton = wrapper.find('button');
|
150
|
+
assert.strictEqual(resetButton.name(), 'button', 'should have reset button');
|
151
|
+
wrapper.find('button').simulate('click'); // Click on reset
|
152
|
+
|
153
|
+
resetButton.simulate('click');
|
154
|
+
assert.strictEqual(handleChange.calledWith(itemList), true, 'should not have called the callback with full item list');
|
155
|
+
assert.strictEqual(handleChange.callCount, 3, 'should have called the callback three times');
|
156
|
+
});
|
157
|
+
it('should return filtered list on search value and add reset button call onSearch', function () {
|
158
|
+
var itemList = [{
|
159
|
+
id: 'zz',
|
160
|
+
label: 'Zizou'
|
161
|
+
}, {
|
162
|
+
id: 'zze',
|
163
|
+
label: 'Zizou encore'
|
164
|
+
}, {
|
165
|
+
id: 'ep',
|
166
|
+
label: 'Emmanuel Petit'
|
167
|
+
}];
|
168
|
+
var searchValue = 'peTit';
|
169
|
+
var handleChange = spy();
|
170
|
+
var onSearch = spy();
|
171
|
+
var wrapper = mount(React.createElement(HiSearchField, {
|
172
|
+
itemList: itemList,
|
173
|
+
onFilteredList: handleChange,
|
174
|
+
filterPropertyList: ['label'],
|
175
|
+
onSearch: onSearch
|
176
|
+
})); // Fill input
|
177
|
+
|
178
|
+
var event = {
|
179
|
+
target: {
|
180
|
+
value: searchValue
|
181
|
+
}
|
182
|
+
};
|
183
|
+
wrapper.find('input').simulate('change', event);
|
184
|
+
assert.strictEqual(handleChange.calledWith(itemList), false, 'should not have called yet the callback with full item list');
|
185
|
+
assert.strictEqual(wrapper.find('button').length, 0, 'should not have clear icon');
|
186
|
+
wrapper.find('input').simulate('focus');
|
187
|
+
var resetButton = wrapper.find('button');
|
188
|
+
assert.strictEqual(resetButton.name(), 'button', 'should have reset button'); // Click on reset
|
189
|
+
|
190
|
+
resetButton.simulate('click', 'reset');
|
191
|
+
assert.strictEqual(onSearch.callCount, 2, 'should have called the callback two times');
|
192
|
+
});
|
193
|
+
});
|
package/es/HiForm/HiSlider.js
CHANGED
@@ -1,39 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
var
|
15
|
-
|
16
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));
|
17
|
-
|
18
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/assertThisInitialized"));
|
19
|
-
|
20
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));
|
21
|
-
|
22
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
23
|
-
|
24
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
25
|
-
|
26
|
-
var _react = _interopRequireDefault(require("react"));
|
27
|
-
|
28
|
-
var _styles = require("@material-ui/core/styles");
|
29
|
-
|
30
|
-
var _HiFormControl = _interopRequireDefault(require("./HiFormControl"));
|
31
|
-
|
32
|
-
var _HiIcon = _interopRequireDefault(require("../HiIcon/HiIcon"));
|
33
|
-
|
34
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
35
|
-
|
36
|
-
var styles = function styles(theme) {
|
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";
|
8
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
9
|
+
import React from 'react';
|
10
|
+
import { withStyles } from '@material-ui/core/styles';
|
11
|
+
import HiFormControl from './HiFormControl';
|
12
|
+
import HiIcon from '../HiIcon/HiIcon';
|
13
|
+
import classNames from 'classnames';
|
14
|
+
export var styles = function styles(theme) {
|
37
15
|
return {
|
38
16
|
barContainer: {
|
39
17
|
width: '100%',
|
@@ -48,7 +26,7 @@ var styles = function styles(theme) {
|
|
48
26
|
zIndex: '2',
|
49
27
|
cursor: 'pointer'
|
50
28
|
},
|
51
|
-
mainContainer: (
|
29
|
+
mainContainer: _objectSpread({}, theme.typography.body1, {
|
52
30
|
display: 'flex',
|
53
31
|
flexWrap: 'nowrap',
|
54
32
|
alignItems: 'center'
|
@@ -113,31 +91,32 @@ var styles = function styles(theme) {
|
|
113
91
|
* HiSlider component
|
114
92
|
*/
|
115
93
|
|
116
|
-
|
117
|
-
exports.styles = styles;
|
118
|
-
|
119
94
|
var HiSlider =
|
120
95
|
/*#__PURE__*/
|
121
96
|
function (_React$Component) {
|
122
|
-
(
|
97
|
+
_inherits(HiSlider, _React$Component);
|
123
98
|
|
124
99
|
function HiSlider(props) {
|
125
100
|
var _this;
|
126
101
|
|
127
|
-
(
|
128
|
-
|
129
|
-
(
|
102
|
+
_classCallCheck(this, HiSlider);
|
103
|
+
|
104
|
+
_this = _possibleConstructorReturn(this, _getPrototypeOf(HiSlider).call(this, props));
|
105
|
+
|
106
|
+
_defineProperty(_assertThisInitialized(_this), "handleChange", function (event) {
|
130
107
|
_this.props.onChange(parseFloat(event.target.value));
|
131
108
|
|
132
109
|
_this.textValueWidth = _this.textValue.offsetWidth;
|
133
110
|
});
|
134
|
-
|
111
|
+
|
112
|
+
_defineProperty(_assertThisInitialized(_this), "handleFocus", function (isFocused) {
|
135
113
|
return function () {
|
136
114
|
_this.setState({
|
137
115
|
focused: isFocused
|
138
116
|
});
|
139
117
|
};
|
140
118
|
});
|
119
|
+
|
141
120
|
_this.state = {
|
142
121
|
focused: false
|
143
122
|
};
|
@@ -150,7 +129,7 @@ function (_React$Component) {
|
|
150
129
|
*/
|
151
130
|
|
152
131
|
|
153
|
-
(
|
132
|
+
_createClass(HiSlider, [{
|
154
133
|
key: "componentDidMount",
|
155
134
|
value: function componentDidMount() {
|
156
135
|
this.leftLabelWidth = this.leftLabel.offsetWidth;
|
@@ -209,27 +188,27 @@ function (_React$Component) {
|
|
209
188
|
|
210
189
|
var barColor = focused ? theme.palette.primary.dark : theme.palette.primary.main;
|
211
190
|
return (// HiFormControl pour l'affichage du label
|
212
|
-
|
191
|
+
React.createElement(HiFormControl, {
|
213
192
|
id: id,
|
214
193
|
label: label,
|
215
194
|
className: className,
|
216
195
|
onFocus: this.handleFocus(true),
|
217
196
|
onBlur: this.handleFocus(false)
|
218
|
-
},
|
197
|
+
}, React.createElement("div", {
|
219
198
|
className: classes.mainContainer
|
220
|
-
},
|
199
|
+
}, React.createElement("div", null, min, suffix), React.createElement("div", {
|
221
200
|
className: classes.barContainer,
|
222
201
|
ref: function ref(div) {
|
223
202
|
_this2.barContainer = div;
|
224
203
|
}
|
225
|
-
},
|
204
|
+
}, React.createElement("div", {
|
226
205
|
className: classes.topContainer
|
227
|
-
}, !hoveringLeft &&
|
206
|
+
}, !hoveringLeft && React.createElement("div", {
|
228
207
|
className: classes.leftLabel,
|
229
208
|
ref: function ref(div) {
|
230
209
|
_this2.leftLabel = div;
|
231
210
|
}
|
232
|
-
}, leftLabel),
|
211
|
+
}, leftLabel), React.createElement("div", {
|
233
212
|
className: classes.textValue,
|
234
213
|
style: {
|
235
214
|
left: "".concat(percentage, "%"),
|
@@ -238,17 +217,17 @@ function (_React$Component) {
|
|
238
217
|
ref: function ref(div) {
|
239
218
|
_this2.textValue = div;
|
240
219
|
}
|
241
|
-
}, value, suffix), !hoveringRight &&
|
220
|
+
}, value, suffix), !hoveringRight && React.createElement("div", {
|
242
221
|
className: classes.rightLabel,
|
243
222
|
ref: function ref(div) {
|
244
223
|
_this2.rightLabel = div;
|
245
224
|
}
|
246
|
-
}, rightLabel)),
|
225
|
+
}, rightLabel)), React.createElement("div", {
|
247
226
|
className: classes.barValue,
|
248
227
|
style: {
|
249
228
|
background: "linear-gradient(to right, ".concat(barColor, ", ").concat(barColor, " ").concat(percentage, "%, #E0E0E0 ").concat(percentage, "%, #E0E0E0)")
|
250
229
|
}
|
251
|
-
}),
|
230
|
+
}), React.createElement("input", {
|
252
231
|
type: 'range',
|
253
232
|
min: min,
|
254
233
|
max: max,
|
@@ -256,26 +235,25 @@ function (_React$Component) {
|
|
256
235
|
onChange: this.handleChange,
|
257
236
|
className: classes.barHidden,
|
258
237
|
step: step
|
259
|
-
}),
|
238
|
+
}), React.createElement("div", {
|
260
239
|
className: classes.bottomContainer
|
261
|
-
},
|
262
|
-
className: (
|
240
|
+
}, React.createElement(HiIcon, {
|
241
|
+
className: classNames(classes.arrow, _defineProperty({}, classes.focused, focused)),
|
263
242
|
icon: 'play_arrow',
|
264
243
|
style: {
|
265
244
|
left: "".concat(percentage, "%"),
|
266
245
|
color: barColor
|
267
246
|
}
|
268
|
-
}))),
|
247
|
+
}))), React.createElement("div", null, max, suffix)))
|
269
248
|
);
|
270
249
|
}
|
271
250
|
}]);
|
251
|
+
|
272
252
|
return HiSlider;
|
273
|
-
}(
|
253
|
+
}(React.Component);
|
274
254
|
|
275
|
-
|
255
|
+
export default withStyles(styles, {
|
276
256
|
hiComponent: true,
|
277
257
|
name: 'HiSlider',
|
278
258
|
withTheme: true
|
279
|
-
})(HiSlider);
|
280
|
-
|
281
|
-
exports.default = _default;
|
259
|
+
})(HiSlider);
|
@@ -0,0 +1,99 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { assert, expect } from 'chai';
|
3
|
+
import { spy } from 'sinon';
|
4
|
+
import { createShallow, createMount } from '../test-utils';
|
5
|
+
import HiSlider from './HiSlider';
|
6
|
+
import HiFormControl from './HiFormControl';
|
7
|
+
describe('<HiSlider />', function () {
|
8
|
+
var shallow;
|
9
|
+
var mount;
|
10
|
+
before(function () {
|
11
|
+
shallow = createShallow();
|
12
|
+
});
|
13
|
+
beforeEach(function () {
|
14
|
+
mount = createMount();
|
15
|
+
});
|
16
|
+
afterEach(function () {
|
17
|
+
mount.cleanUp();
|
18
|
+
});
|
19
|
+
describe('shallow', function () {
|
20
|
+
var wrapper;
|
21
|
+
var props = {
|
22
|
+
min: 0,
|
23
|
+
max: 100,
|
24
|
+
id: 'slider',
|
25
|
+
label: 'label'
|
26
|
+
};
|
27
|
+
beforeEach(function () {
|
28
|
+
wrapper = shallow(React.createElement(HiSlider, props), {
|
29
|
+
disableLifecycleMethods: true
|
30
|
+
});
|
31
|
+
});
|
32
|
+
it('should be a HiSlider', function () {
|
33
|
+
assert.strictEqual(wrapper.name(), 'HiSlider');
|
34
|
+
});
|
35
|
+
it('should have an HiFormControl as the only child', function () {
|
36
|
+
assert.strictEqual(wrapper.dive().children().length, 1);
|
37
|
+
assert.strictEqual(wrapper.dive().type(), HiFormControl);
|
38
|
+
});
|
39
|
+
it('should pass label to the HiFormControl', function () {
|
40
|
+
assert.strictEqual(wrapper.dive().find(HiFormControl).dive().props().label, props.label, '');
|
41
|
+
});
|
42
|
+
it('should show labels (right and left) if passed', function () {
|
43
|
+
assert.strictEqual(wrapper.dive().children().childAt(1).childAt(0).childAt(0).text(), '', 'should be empty because no left label is given in props');
|
44
|
+
assert.strictEqual(wrapper.dive().children().childAt(1).childAt(0).childAt(2).text(), '', 'should be empty because no right label is given in props');
|
45
|
+
var rightLabel = 'label right';
|
46
|
+
var leftLabel = 'label left';
|
47
|
+
wrapper.setProps({
|
48
|
+
rightLabel: rightLabel
|
49
|
+
});
|
50
|
+
wrapper.setProps({
|
51
|
+
leftLabel: leftLabel
|
52
|
+
});
|
53
|
+
assert.strictEqual(wrapper.dive().children().childAt(1).childAt(0).childAt(0).text(), leftLabel, 'should display the left label given in props');
|
54
|
+
assert.strictEqual(wrapper.dive().children().childAt(1).childAt(0).childAt(2).text(), rightLabel, 'should display the right label given in props');
|
55
|
+
});
|
56
|
+
it('should have the values given in props for max and min', function () {
|
57
|
+
assert.strictEqual(wrapper.dive().children().childAt(0).text(), '0', 'should be equal to the min value given in props');
|
58
|
+
assert.strictEqual(wrapper.dive().children().childAt(2).text(), '100', 'should be equal to the max value given in props');
|
59
|
+
});
|
60
|
+
it('should be on the initial value, then change', function () {
|
61
|
+
wrapper = shallow(React.createElement(HiSlider, {
|
62
|
+
id: 'slider',
|
63
|
+
min: 0,
|
64
|
+
max: 100,
|
65
|
+
value: 50
|
66
|
+
}), {
|
67
|
+
disableLifecycleMethods: true
|
68
|
+
});
|
69
|
+
assert.strictEqual(wrapper.dive().find('input').props().value, 50, 'the input value should be equal to initial value');
|
70
|
+
assert.strictEqual(wrapper.dive().children().childAt(1).childAt(0).childAt(1).text(), '50', 'the value shown to the user is the same as the initial value');
|
71
|
+
expect(wrapper.dive().children().childAt(1).childAt(1).props().style.background).to.include('50%');
|
72
|
+
});
|
73
|
+
});
|
74
|
+
it('should fire onChange event callbacks', function () {
|
75
|
+
var handleChange = spy();
|
76
|
+
var wrapper = mount(React.createElement(HiSlider, {
|
77
|
+
id: 'slider',
|
78
|
+
min: 0,
|
79
|
+
max: 100,
|
80
|
+
onChange: handleChange
|
81
|
+
}));
|
82
|
+
wrapper.find('input').simulate('change');
|
83
|
+
assert.strictEqual(handleChange.calledOnce, true, 'should have called the callback');
|
84
|
+
});
|
85
|
+
it('should be focused after onFocus, then not focused after onBlur', function () {
|
86
|
+
var wrapper = mount(shallow(React.createElement(HiSlider, {
|
87
|
+
id: 'slider',
|
88
|
+
rightLabel: 'test right',
|
89
|
+
leftLabel: 'test left',
|
90
|
+
min: 0,
|
91
|
+
max: 100,
|
92
|
+
value: 50
|
93
|
+
})).get(0));
|
94
|
+
wrapper.find(HiFormControl).prop('onFocus')();
|
95
|
+
assert.strictEqual(wrapper.state().focused, true, 'should be focused');
|
96
|
+
wrapper.find(HiFormControl).prop('onBlur')();
|
97
|
+
assert.strictEqual(wrapper.state().focused, false, 'should not be focused');
|
98
|
+
});
|
99
|
+
});
|