@hipay/hipay-material-ui 2.3.1-rc3 → 2.3.1-rc4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/HiChip/HiChip.js
CHANGED
|
@@ -1,29 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
11
|
-
|
|
12
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
13
|
-
|
|
14
|
-
var _react = _interopRequireDefault(require("react"));
|
|
15
|
-
|
|
16
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
|
-
|
|
18
|
-
var _keycode = _interopRequireDefault(require("keycode"));
|
|
19
|
-
|
|
20
|
-
var _HiIcon = _interopRequireDefault(require("../HiIcon"));
|
|
21
|
-
|
|
22
|
-
var _styles = require("@material-ui/core/styles");
|
|
23
|
-
|
|
24
|
-
var styles = function styles(theme) {
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import keycode from 'keycode';
|
|
6
|
+
import HiIcon from '../HiIcon';
|
|
7
|
+
import { withStyles } from '@material-ui/core/styles';
|
|
8
|
+
export var styles = function styles(theme) {
|
|
25
9
|
return {
|
|
26
|
-
root: (
|
|
10
|
+
root: _objectSpread({}, theme.typography.b3, {
|
|
27
11
|
display: 'inline-flex',
|
|
28
12
|
marginRight: 4,
|
|
29
13
|
width: 'fit-content',
|
|
@@ -106,10 +90,8 @@ var styles = function styles(theme) {
|
|
|
106
90
|
};
|
|
107
91
|
};
|
|
108
92
|
|
|
109
|
-
exports.styles = styles;
|
|
110
|
-
|
|
111
93
|
var handleKeyDown = function handleKeyDown(e, fn) {
|
|
112
|
-
if ((
|
|
94
|
+
if (keycode(e) === 'space' || keycode(e) === 'enter') {
|
|
113
95
|
e.preventDefault();
|
|
114
96
|
fn();
|
|
115
97
|
}
|
|
@@ -141,17 +123,17 @@ function HiChip(props) {
|
|
|
141
123
|
titleNext = props.titleNext,
|
|
142
124
|
titlePrevious = props.titlePrevious,
|
|
143
125
|
style = props.style;
|
|
144
|
-
return
|
|
126
|
+
return React.createElement("div", {
|
|
145
127
|
id: id,
|
|
146
128
|
role: 'button',
|
|
147
|
-
className: (
|
|
129
|
+
className: classNames(classes.root, className, (_classNames = {}, _defineProperty(_classNames, classes.leftNavigation, onPrevious), _defineProperty(_classNames, classes.rightNavigation, onNext), _defineProperty(_classNames, classes.deletable, onDelete), _defineProperty(_classNames, classes.leftIcon, icon), _classNames)),
|
|
148
130
|
title: title,
|
|
149
131
|
onClick: onClick,
|
|
150
132
|
onKeyDown: onKeyDown,
|
|
151
133
|
tabIndex: onKeyDown ? '0' : '-1',
|
|
152
134
|
style: style
|
|
153
|
-
}, icon &&
|
|
154
|
-
className: (
|
|
135
|
+
}, icon && React.createElement(HiIcon, {
|
|
136
|
+
className: classNames(classes.icon, _defineProperty({}, classes.iconClickable, onIconClick)),
|
|
155
137
|
id: "".concat(id, "-icon"),
|
|
156
138
|
icon: icon,
|
|
157
139
|
size: iconSize,
|
|
@@ -161,10 +143,10 @@ function HiChip(props) {
|
|
|
161
143
|
},
|
|
162
144
|
title: titleIcon,
|
|
163
145
|
tabIndex: onIconClick ? 0 : -1
|
|
164
|
-
}), prefix &&
|
|
146
|
+
}), prefix && React.createElement("span", {
|
|
165
147
|
id: "".concat(id, "-prefix"),
|
|
166
148
|
className: classes.prefix
|
|
167
|
-
}, prefix), img &&
|
|
149
|
+
}, prefix), img && React.createElement("img", {
|
|
168
150
|
className: classes.badge,
|
|
169
151
|
id: "".concat(id, "-badge"),
|
|
170
152
|
src: img,
|
|
@@ -177,8 +159,8 @@ function HiChip(props) {
|
|
|
177
159
|
}
|
|
178
160
|
},
|
|
179
161
|
title: titleImg
|
|
180
|
-
}), onPrevious &&
|
|
181
|
-
className: (
|
|
162
|
+
}), onPrevious && React.createElement(HiIcon, {
|
|
163
|
+
className: classNames(classes.navigate),
|
|
182
164
|
id: "".concat(id, "-previous"),
|
|
183
165
|
icon: "arrow_left",
|
|
184
166
|
onClick: onPrevious,
|
|
@@ -188,11 +170,11 @@ function HiChip(props) {
|
|
|
188
170
|
size: iconSize,
|
|
189
171
|
title: titlePrevious,
|
|
190
172
|
tabIndex: 0
|
|
191
|
-
}),
|
|
173
|
+
}), React.createElement("span", {
|
|
192
174
|
id: "".concat(id, "-label"),
|
|
193
175
|
className: classes.label
|
|
194
|
-
}, label), onNext &&
|
|
195
|
-
className: (
|
|
176
|
+
}, label), onNext && React.createElement(HiIcon, {
|
|
177
|
+
className: classNames(classes.navigate),
|
|
196
178
|
id: "".concat(id, "-next"),
|
|
197
179
|
icon: "arrow_right",
|
|
198
180
|
onClick: onNext,
|
|
@@ -202,7 +184,7 @@ function HiChip(props) {
|
|
|
202
184
|
size: iconSize,
|
|
203
185
|
title: titleNext,
|
|
204
186
|
tabIndex: 0
|
|
205
|
-
}), onDelete &&
|
|
187
|
+
}), onDelete && React.createElement(HiIcon, {
|
|
206
188
|
classes: {
|
|
207
189
|
root: classes.eraseIcon
|
|
208
190
|
},
|
|
@@ -218,9 +200,7 @@ function HiChip(props) {
|
|
|
218
200
|
}));
|
|
219
201
|
}
|
|
220
202
|
|
|
221
|
-
|
|
203
|
+
export default withStyles(styles, {
|
|
222
204
|
hiComponent: true,
|
|
223
205
|
name: 'HmuiHiChip'
|
|
224
|
-
})(HiChip);
|
|
225
|
-
|
|
226
|
-
exports.default = _default;
|
|
206
|
+
})(HiChip);
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { assert } from 'chai';
|
|
3
|
+
import { spy } from 'sinon';
|
|
4
|
+
import { createShallow, createMount, getClasses } from '../test-utils';
|
|
5
|
+
import HiChip from './HiChip';
|
|
6
|
+
import HiIcon from '../HiIcon';
|
|
7
|
+
describe('<HiChip />', function () {
|
|
8
|
+
var shallow;
|
|
9
|
+
var mount;
|
|
10
|
+
var classes;
|
|
11
|
+
var wrapper;
|
|
12
|
+
|
|
13
|
+
var noop = function noop() {};
|
|
14
|
+
|
|
15
|
+
before(function () {
|
|
16
|
+
shallow = createShallow({
|
|
17
|
+
untilSelector: 'Badge'
|
|
18
|
+
});
|
|
19
|
+
mount = createMount();
|
|
20
|
+
classes = getClasses(React.createElement(HiChip, {
|
|
21
|
+
label: "test"
|
|
22
|
+
}));
|
|
23
|
+
});
|
|
24
|
+
after(function () {
|
|
25
|
+
mount.cleanUp();
|
|
26
|
+
});
|
|
27
|
+
describe('Basic chip', function () {
|
|
28
|
+
before(function () {
|
|
29
|
+
wrapper = shallow(React.createElement(HiChip, {
|
|
30
|
+
label: "test"
|
|
31
|
+
}));
|
|
32
|
+
});
|
|
33
|
+
it('should render a div containing a span and an icon', function () {
|
|
34
|
+
assert.strictEqual(wrapper.name(), 'div');
|
|
35
|
+
assert.strictEqual(wrapper.childAt(0).is('span'), true, 'should be a span');
|
|
36
|
+
assert.strictEqual(wrapper.find(HiIcon).length, 0, 'should not have deletable icon');
|
|
37
|
+
});
|
|
38
|
+
it('should merge user classes & spread custom props to the root node', function () {
|
|
39
|
+
assert.strictEqual(wrapper.hasClass(classes.root), true);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
describe('Chip with icon', function () {
|
|
43
|
+
before(function () {
|
|
44
|
+
wrapper = shallow(React.createElement(HiChip, {
|
|
45
|
+
label: "test",
|
|
46
|
+
icon: "magnify"
|
|
47
|
+
}));
|
|
48
|
+
});
|
|
49
|
+
it('should render a div containing a span', function () {
|
|
50
|
+
assert.strictEqual(wrapper.name(), 'div');
|
|
51
|
+
assert.strictEqual(wrapper.childAt(0).is(HiIcon), true, 'should be a HiIcon');
|
|
52
|
+
assert.strictEqual(wrapper.childAt(1).is('span'), true, 'should be a span');
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
describe('Chip with img', function () {
|
|
56
|
+
before(function () {
|
|
57
|
+
wrapper = shallow(React.createElement(HiChip, {
|
|
58
|
+
label: "test",
|
|
59
|
+
img: "/static/hmus/images/countries/ag.svg"
|
|
60
|
+
}));
|
|
61
|
+
});
|
|
62
|
+
it('should render a div containing an img and a span', function () {
|
|
63
|
+
assert.strictEqual(wrapper.name(), 'div');
|
|
64
|
+
assert.strictEqual(wrapper.childAt(0).is('img'), true, 'should be a img');
|
|
65
|
+
assert.strictEqual(wrapper.childAt(1).is('span'), true, 'should be a span');
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
describe('Chip with icon and navigable', function () {
|
|
69
|
+
before(function () {
|
|
70
|
+
wrapper = shallow(React.createElement(HiChip, {
|
|
71
|
+
label: "test",
|
|
72
|
+
icon: "magnify",
|
|
73
|
+
onNext: noop,
|
|
74
|
+
onPrevious: noop
|
|
75
|
+
}));
|
|
76
|
+
});
|
|
77
|
+
it('should render a div containing a span', function () {
|
|
78
|
+
assert.strictEqual(wrapper.name(), 'div');
|
|
79
|
+
assert.strictEqual(wrapper.childAt(0).is(HiIcon), true, 'should be a HiIcon (icon)');
|
|
80
|
+
assert.strictEqual(wrapper.childAt(1).is(HiIcon), true, 'should be a HiIcon (previous)');
|
|
81
|
+
assert.strictEqual(wrapper.childAt(2).is('span'), true, 'should be a span');
|
|
82
|
+
assert.strictEqual(wrapper.childAt(3).is(HiIcon), true, 'should be a HiIcon (next)');
|
|
83
|
+
});
|
|
84
|
+
it('should merge user classes & spread custom props to the root node', function () {
|
|
85
|
+
assert.strictEqual(wrapper.hasClass(classes.root), true);
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
describe('Chip with icon and navigable and delete', function () {
|
|
89
|
+
before(function () {
|
|
90
|
+
wrapper = shallow(React.createElement(HiChip, {
|
|
91
|
+
label: "test",
|
|
92
|
+
icon: "magnify",
|
|
93
|
+
onNext: noop,
|
|
94
|
+
onPrevious: noop,
|
|
95
|
+
onDelete: noop
|
|
96
|
+
}));
|
|
97
|
+
});
|
|
98
|
+
it('should render all components', function () {
|
|
99
|
+
assert.strictEqual(wrapper.name(), 'div');
|
|
100
|
+
assert.strictEqual(wrapper.childAt(0).is(HiIcon), true, 'should be a HiIcon (icon)');
|
|
101
|
+
assert.strictEqual(wrapper.childAt(1).is(HiIcon), true, 'should be a HiIcon (previous)');
|
|
102
|
+
assert.strictEqual(wrapper.childAt(2).is('span'), true, 'should be a span');
|
|
103
|
+
assert.strictEqual(wrapper.childAt(3).is(HiIcon), true, 'should be a HiIcon (next)');
|
|
104
|
+
assert.strictEqual(wrapper.childAt(4).is(HiIcon), true, 'should be a HiIcon (delete)');
|
|
105
|
+
});
|
|
106
|
+
it('should merge user classes & spread custom props to the root node', function () {
|
|
107
|
+
assert.strictEqual(wrapper.hasClass(classes.root), true);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
describe('delete icon', function () {
|
|
111
|
+
it('should call onDelete when clicking', function () {
|
|
112
|
+
var handleDelete = spy();
|
|
113
|
+
var handleNext = spy();
|
|
114
|
+
var handlePrevious = spy();
|
|
115
|
+
wrapper = shallow(React.createElement(HiChip, {
|
|
116
|
+
label: "test",
|
|
117
|
+
onDelete: handleDelete,
|
|
118
|
+
onPrevious: handlePrevious,
|
|
119
|
+
onNext: handleNext
|
|
120
|
+
}));
|
|
121
|
+
wrapper.find(HiIcon).at(0).simulate('click');
|
|
122
|
+
assert.strictEqual(handlePrevious.callCount, 1, 'should have been called once handlePrevious');
|
|
123
|
+
assert.strictEqual(handleNext.callCount, 0, 'should not have been called handleNext');
|
|
124
|
+
assert.strictEqual(handleDelete.callCount, 0, 'should not have been called handleDelete');
|
|
125
|
+
wrapper.find(HiIcon).at(1).simulate('click');
|
|
126
|
+
assert.strictEqual(handlePrevious.callCount, 1, 'should have been called once handlePrevious');
|
|
127
|
+
assert.strictEqual(handleNext.callCount, 1, 'should have been called once handleNext');
|
|
128
|
+
assert.strictEqual(handleDelete.callCount, 0, 'should not have been called handleDelete');
|
|
129
|
+
wrapper.find(HiIcon).at(2).simulate('click');
|
|
130
|
+
assert.strictEqual(handlePrevious.callCount, 1, 'should have been called once handlePrevious');
|
|
131
|
+
assert.strictEqual(handleNext.callCount, 1, 'should have been called once handleNext');
|
|
132
|
+
assert.strictEqual(handleDelete.callCount, 1, 'should have been called once handleDelete');
|
|
133
|
+
wrapper.unmount();
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
});
|
package/HiChip/HiChipSwitch.js
CHANGED
|
@@ -1,45 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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 _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
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 _HiIcon = _interopRequireDefault(require("../HiIcon"));
|
|
35
|
-
|
|
36
|
-
var _styles = require("@material-ui/core/styles");
|
|
37
|
-
|
|
38
|
-
var _colorManipulator = require("@material-ui/core/styles/colorManipulator");
|
|
39
|
-
|
|
40
|
-
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 classNames from 'classnames';
|
|
11
|
+
import keycode from 'keycode/index';
|
|
12
|
+
import HiIcon from '../HiIcon';
|
|
13
|
+
import { withStyles } from '@material-ui/core/styles';
|
|
14
|
+
import { emphasize } from '@material-ui/core/styles/colorManipulator';
|
|
15
|
+
export var styles = function styles(theme) {
|
|
41
16
|
return {
|
|
42
|
-
root: (
|
|
17
|
+
root: _objectSpread({}, theme.typography.b3, {
|
|
43
18
|
display: 'inline-flex',
|
|
44
19
|
alignItems: 'center',
|
|
45
20
|
marginRight: 4,
|
|
@@ -54,7 +29,7 @@ var styles = function styles(theme) {
|
|
|
54
29
|
// Remove grey highlight
|
|
55
30
|
WebkitTapHighlightColor: 'transparent',
|
|
56
31
|
'&:hover, &:focus': {
|
|
57
|
-
backgroundColor:
|
|
32
|
+
backgroundColor: emphasize(theme.palette.grey[300], 0.08)
|
|
58
33
|
}
|
|
59
34
|
}),
|
|
60
35
|
active: {
|
|
@@ -115,20 +90,21 @@ var styles = function styles(theme) {
|
|
|
115
90
|
};
|
|
116
91
|
};
|
|
117
92
|
|
|
118
|
-
exports.styles = styles;
|
|
119
|
-
|
|
120
93
|
var HiChipSwitch =
|
|
121
94
|
/*#__PURE__*/
|
|
122
95
|
function (_React$PureComponent) {
|
|
123
|
-
(
|
|
96
|
+
_inherits(HiChipSwitch, _React$PureComponent);
|
|
124
97
|
|
|
125
98
|
function HiChipSwitch(props) {
|
|
126
99
|
var _this;
|
|
127
100
|
|
|
128
|
-
(
|
|
129
|
-
|
|
130
|
-
(
|
|
131
|
-
|
|
101
|
+
_classCallCheck(this, HiChipSwitch);
|
|
102
|
+
|
|
103
|
+
_this = _possibleConstructorReturn(this, _getPrototypeOf(HiChipSwitch).call(this, props));
|
|
104
|
+
|
|
105
|
+
_defineProperty(_assertThisInitialized(_this), "chipSwitchRef", null);
|
|
106
|
+
|
|
107
|
+
_defineProperty(_assertThisInitialized(_this), "handleKeyDown", function (event) {
|
|
132
108
|
// Ignore events from children of `Chip`.
|
|
133
109
|
if (event.currentTarget !== event.target) {
|
|
134
110
|
return;
|
|
@@ -137,7 +113,7 @@ function (_React$PureComponent) {
|
|
|
137
113
|
var _this$props = _this.props,
|
|
138
114
|
onClick = _this$props.onClick,
|
|
139
115
|
onKeyDown = _this$props.onKeyDown;
|
|
140
|
-
var key = (
|
|
116
|
+
var key = keycode(event);
|
|
141
117
|
|
|
142
118
|
if (onClick && (key === 'space' || key === 'enter')) {
|
|
143
119
|
event.preventDefault();
|
|
@@ -154,22 +130,24 @@ function (_React$PureComponent) {
|
|
|
154
130
|
onKeyDown(event);
|
|
155
131
|
}
|
|
156
132
|
});
|
|
157
|
-
|
|
133
|
+
|
|
134
|
+
_defineProperty(_assertThisInitialized(_this), "handleKeyDownSelection", function (event) {
|
|
158
135
|
var onSelectionClick = _this.props.onSelectionClick;
|
|
159
|
-
var key = (
|
|
136
|
+
var key = keycode(event);
|
|
160
137
|
|
|
161
138
|
if (onSelectionClick && (key === 'space' || key === 'enter')) {
|
|
162
139
|
event.preventDefault();
|
|
163
140
|
onSelectionClick(event);
|
|
164
141
|
}
|
|
165
142
|
});
|
|
166
|
-
|
|
167
|
-
_this.
|
|
168
|
-
_this.
|
|
143
|
+
|
|
144
|
+
_this.handleClickSelection = _this.handleClickSelection.bind(_assertThisInitialized(_this));
|
|
145
|
+
_this.handleKeyDown = _this.handleKeyDown.bind(_assertThisInitialized(_this));
|
|
146
|
+
_this.handleKeyDownSelection = _this.handleKeyDownSelection.bind(_assertThisInitialized(_this));
|
|
169
147
|
return _this;
|
|
170
148
|
}
|
|
171
149
|
|
|
172
|
-
(
|
|
150
|
+
_createClass(HiChipSwitch, [{
|
|
173
151
|
key: "handleClickSelection",
|
|
174
152
|
value: function handleClickSelection(event) {
|
|
175
153
|
if (this.props.onSelectionClick) {
|
|
@@ -210,9 +188,9 @@ function (_React$PureComponent) {
|
|
|
210
188
|
};
|
|
211
189
|
}
|
|
212
190
|
|
|
213
|
-
return
|
|
191
|
+
return React.createElement("div", {
|
|
214
192
|
id: id,
|
|
215
|
-
className: (
|
|
193
|
+
className: classNames(classes.root, (_classNames = {}, _defineProperty(_classNames, classes.active, !!active), _defineProperty(_classNames, classes.inactive, !active), _classNames)),
|
|
216
194
|
onClick: onClick,
|
|
217
195
|
role: "button",
|
|
218
196
|
tabIndex: "0",
|
|
@@ -220,30 +198,29 @@ function (_React$PureComponent) {
|
|
|
220
198
|
ref: function ref(node) {
|
|
221
199
|
_this2.chipRef = node;
|
|
222
200
|
}
|
|
223
|
-
},
|
|
201
|
+
}, React.createElement(HiIcon, {
|
|
224
202
|
icon: active ? activeIcon : 'add',
|
|
225
203
|
size: 20,
|
|
226
|
-
className: (
|
|
227
|
-
}),
|
|
228
|
-
className: (
|
|
229
|
-
}, label), selection !== null &&
|
|
230
|
-
className: (
|
|
204
|
+
className: classNames(classes.icon, _defineProperty({}, classes.iconActive, !!active))
|
|
205
|
+
}), React.createElement("span", {
|
|
206
|
+
className: classNames(classes.label, _defineProperty({}, classes.noSelection, selection === null))
|
|
207
|
+
}, label), selection !== null && React.createElement("div", Object.assign({
|
|
208
|
+
className: classNames(classes.selection, _defineProperty({}, classes.selectionClickable, onSelectionClick && selection !== 0))
|
|
231
209
|
}, selectionProps), selection));
|
|
232
210
|
}
|
|
233
211
|
}]);
|
|
212
|
+
|
|
234
213
|
return HiChipSwitch;
|
|
235
|
-
}(
|
|
214
|
+
}(React.PureComponent);
|
|
236
215
|
|
|
237
|
-
(
|
|
216
|
+
_defineProperty(HiChipSwitch, "defaultProps", {
|
|
238
217
|
active: false,
|
|
239
218
|
activeIcon: 'check',
|
|
240
219
|
selection: null,
|
|
241
220
|
selectionTitle: ''
|
|
242
221
|
});
|
|
243
222
|
|
|
244
|
-
|
|
223
|
+
export default withStyles(styles, {
|
|
245
224
|
hiComponent: true,
|
|
246
225
|
name: 'HmuiHiChipSwitch'
|
|
247
|
-
})(HiChipSwitch);
|
|
248
|
-
|
|
249
|
-
exports.default = _default;
|
|
226
|
+
})(HiChipSwitch);
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { assert } from 'chai';
|
|
3
|
+
import { spy } from 'sinon';
|
|
4
|
+
import { createShallow, createMount, getClasses } from '../test-utils';
|
|
5
|
+
import HiChipSwitch from './HiChipSwitch';
|
|
6
|
+
import HiIcon from '../HiIcon';
|
|
7
|
+
describe('<HiChipSwitch />', function () {
|
|
8
|
+
var shallow;
|
|
9
|
+
var mount;
|
|
10
|
+
var classes;
|
|
11
|
+
var wrapper;
|
|
12
|
+
|
|
13
|
+
var noop = function noop() {};
|
|
14
|
+
|
|
15
|
+
before(function () {
|
|
16
|
+
shallow = createShallow({
|
|
17
|
+
untilSelector: 'Badge'
|
|
18
|
+
});
|
|
19
|
+
mount = createMount();
|
|
20
|
+
classes = getClasses(React.createElement(HiChipSwitch, {
|
|
21
|
+
label: "test",
|
|
22
|
+
onClick: noop
|
|
23
|
+
}));
|
|
24
|
+
});
|
|
25
|
+
after(function () {
|
|
26
|
+
mount.cleanUp();
|
|
27
|
+
});
|
|
28
|
+
describe('text with leftIcon', function () {
|
|
29
|
+
before(function () {
|
|
30
|
+
wrapper = shallow(React.createElement(HiChipSwitch, {
|
|
31
|
+
label: "test",
|
|
32
|
+
onClick: noop
|
|
33
|
+
}));
|
|
34
|
+
});
|
|
35
|
+
it('should render a div containing a span and an icon', function () {
|
|
36
|
+
assert.strictEqual(wrapper.name(), 'div');
|
|
37
|
+
assert.strictEqual(wrapper.childAt(0).is(HiIcon), true, 'should be a HiIcon');
|
|
38
|
+
assert.strictEqual(wrapper.childAt(1).is('span'), true, 'should be a span');
|
|
39
|
+
});
|
|
40
|
+
it('should merge user classes & spread custom props to the root node', function () {
|
|
41
|
+
assert.strictEqual(wrapper.hasClass(classes.root), true);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
describe('text with leftIcon and selection', function () {
|
|
45
|
+
before(function () {
|
|
46
|
+
wrapper = shallow(React.createElement(HiChipSwitch, {
|
|
47
|
+
label: "test",
|
|
48
|
+
selection: 5,
|
|
49
|
+
onClick: noop
|
|
50
|
+
}));
|
|
51
|
+
});
|
|
52
|
+
it('should render a div containing a span', function () {
|
|
53
|
+
assert.strictEqual(wrapper.name(), 'div');
|
|
54
|
+
assert.strictEqual(wrapper.childAt(0).is(HiIcon), true, 'should be a HiIcon (leftIcon)');
|
|
55
|
+
assert.strictEqual(wrapper.childAt(1).is('span'), true, 'should be a span');
|
|
56
|
+
assert.strictEqual(wrapper.childAt(2).is('div'), true, 'should be a div');
|
|
57
|
+
});
|
|
58
|
+
it('should merge user classes & spread custom props to the root node', function () {
|
|
59
|
+
assert.strictEqual(wrapper.hasClass(classes.root), true);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
describe('callbacks', function () {
|
|
63
|
+
it('should call onDelete when clicking', function () {
|
|
64
|
+
var handleClick = spy();
|
|
65
|
+
var handleSelectionClick = spy();
|
|
66
|
+
wrapper = shallow(React.createElement(HiChipSwitch, {
|
|
67
|
+
label: "test",
|
|
68
|
+
onClick: handleClick,
|
|
69
|
+
onSelectionClick: handleSelectionClick,
|
|
70
|
+
selection: 5
|
|
71
|
+
}));
|
|
72
|
+
wrapper.simulate('click');
|
|
73
|
+
assert.strictEqual(handleClick.callCount, 1, 'should have been called once handleClick');
|
|
74
|
+
assert.strictEqual(handleSelectionClick.callCount, 0, 'should not have been called handleSelectionClick');
|
|
75
|
+
assert.strictEqual(wrapper.find(HiIcon).length, 1, 'should have default icon');
|
|
76
|
+
wrapper.setProps({
|
|
77
|
+
active: true
|
|
78
|
+
});
|
|
79
|
+
wrapper.update();
|
|
80
|
+
assert.strictEqual(wrapper.find(HiIcon).length, 1, 'should have default active icon');
|
|
81
|
+
wrapper.setProps({
|
|
82
|
+
activeIcon: 'search'
|
|
83
|
+
});
|
|
84
|
+
wrapper.update();
|
|
85
|
+
assert.strictEqual(wrapper.find(HiIcon).length, 1, 'should have specific active icon');
|
|
86
|
+
wrapper.find('div').at(1).simulate('click');
|
|
87
|
+
assert.strictEqual(handleSelectionClick.callCount, 1, 'should have been called once handleSelectionClick');
|
|
88
|
+
wrapper.unmount();
|
|
89
|
+
wrapper = mount(React.createElement(HiChipSwitch, {
|
|
90
|
+
label: "test",
|
|
91
|
+
onClick: handleClick,
|
|
92
|
+
selection: 5
|
|
93
|
+
}));
|
|
94
|
+
wrapper.find('div').at(1).simulate('click');
|
|
95
|
+
assert.strictEqual(handleSelectionClick.callCount, 1, 'should not have been called handleSelectionClick');
|
|
96
|
+
wrapper.unmount();
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
});
|
package/HiChip/index.js
CHANGED
|
@@ -1,23 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
Object.defineProperty(exports, "default", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function get() {
|
|
11
|
-
return _HiChip.default;
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
Object.defineProperty(exports, "HiChipSwitch", {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function get() {
|
|
17
|
-
return _HiChipSwitch.default;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
var _HiChip = _interopRequireDefault(require("./HiChip"));
|
|
22
|
-
|
|
23
|
-
var _HiChipSwitch = _interopRequireDefault(require("./HiChipSwitch"));
|
|
1
|
+
export { default } from './HiChip';
|
|
2
|
+
export { default as HiChipSwitch } from './HiChipSwitch';
|