@hipay/hipay-material-ui 2.3.1-rc2 → 2.3.1-rc4
Sign up to get free protection for your applications and to get access to all the features.
- package/App.test.js +8 -0
- package/HiAlertModal/HiAlertModal.js +48 -77
- package/HiAlertModal/HiAlertModal.test.js +189 -0
- package/HiAlertModal/index.js +1 -15
- package/HiAppBar/HiAppBar.js +34 -63
- package/HiAppBar/index.js +1 -15
- package/HiBadge/HiBadge.js +10 -29
- package/HiBadge/HiBadge.test.js +49 -0
- package/HiBadge/index.js +1 -15
- package/HiBreadcrumb/HiBreadcrumb.js +27 -43
- package/HiBreadcrumb/HiBreadcrumb.test.js +44 -0
- package/HiBreadcrumb/HiStep.js +35 -57
- package/HiBreadcrumb/HiStep.test.js +47 -0
- package/HiBreadcrumb/HiStepConnector.js +32 -57
- package/HiBreadcrumb/HiStepConnector.test.js +113 -0
- package/HiBreadcrumb/HiStepContent.js +25 -46
- package/HiBreadcrumb/HiStepContent.test.js +32 -0
- package/HiBreadcrumb/HiStepIcon.js +26 -46
- package/HiBreadcrumb/HiStepIcon.test.js +65 -0
- package/HiBreadcrumb/HiStepLabel.js +36 -61
- package/HiBreadcrumb/HiStepLabel.test.js +30 -0
- package/HiBreadcrumb/HiStepper.js +23 -45
- package/HiBreadcrumb/HiStepper.test.js +33 -0
- package/HiBreadcrumb/index.js +1 -15
- package/HiButton/HiButton.js +9 -27
- package/HiButton/index.js +2 -13
- package/HiCell/CellAddress.js +20 -40
- package/HiCell/CellAddress.test.js +75 -0
- package/HiCell/CellDate.js +26 -47
- package/HiCell/CellDate.test.js +173 -0
- package/HiCell/CellIcon.js +28 -49
- package/HiCell/CellIcon.test.js +57 -0
- package/HiCell/CellImage.js +23 -42
- package/HiCell/CellImage.test.js +49 -0
- package/HiCell/CellNumeric.js +25 -46
- package/HiCell/CellNumeric.test.js +46 -0
- package/HiCell/CellPinToAction.js +20 -41
- package/HiCell/CellRate.js +32 -55
- package/HiCell/CellRate.test.js +73 -0
- package/HiCell/CellSentinel.js +22 -42
- package/HiCell/CellSentinel.test.js +48 -0
- package/HiCell/CellSentinelScore.js +23 -44
- package/HiCell/CellText.js +37 -56
- package/HiCell/CellText.test.js +76 -0
- package/HiCell/CellTextStyled.js +8 -21
- package/HiCell/index.js +9 -79
- package/HiCheckbox/HiCheckbox.js +35 -60
- package/HiCheckbox/HiCheckbox.test.js +55 -0
- package/HiCheckbox/index.js +1 -15
- package/HiChip/HiChip.js +24 -44
- package/HiChip/HiChip.test.js +136 -0
- package/HiChip/HiChipSwitch.js +47 -70
- package/HiChip/HiChipSwitch.test.js +99 -0
- package/HiChip/index.js +2 -23
- package/HiColoredLabel/HiColoredLabel.js +28 -52
- package/HiColoredLabel/HiColoredLabel.test.js +96 -0
- package/HiColoredLabel/index.js +1 -15
- package/HiDatePicker/Caption.js +11 -28
- package/HiDatePicker/Caption.test.js +65 -0
- package/HiDatePicker/HiDatePicker.js +100 -115
- package/HiDatePicker/HiDatePicker.test.js +370 -0
- package/HiDatePicker/HiDatePickerMobile.js +32 -54
- package/HiDatePicker/HiDateRangePicker.js +138 -149
- package/HiDatePicker/HiDateRangePicker.test.js +703 -0
- package/HiDatePicker/HiDateRangeSelector.js +71 -103
- package/HiDatePicker/HiDateRangeSelector.test.js +193 -0
- package/HiDatePicker/ListPicker.js +33 -55
- package/HiDatePicker/ListPicker.test.js +53 -0
- package/HiDatePicker/NavBar.js +18 -45
- package/HiDatePicker/NavBar.test.js +39 -0
- package/HiDatePicker/Overlays/CustomOverlayLayout.js +23 -40
- package/HiDatePicker/Overlays/CustomOverlayLayoutWithoutFooter.js +22 -39
- package/HiDatePicker/Overlays/MonthPickerOverlay.js +29 -45
- package/HiDatePicker/Overlays/MonthPickerOverlay.test.js +50 -0
- package/HiDatePicker/Overlays/Overlay.js +18 -35
- package/HiDatePicker/Overlays/Overlay.test.js +20 -0
- package/HiDatePicker/Overlays/TimePickerOverlay.js +47 -73
- package/HiDatePicker/Overlays/TimePickerOverlay.test.js +48 -0
- package/HiDatePicker/Overlays/YearPickerOverlay.js +29 -45
- package/HiDatePicker/Overlays/YearPickerOverlay.test.js +79 -0
- package/HiDatePicker/Overlays/index.js +5 -47
- package/HiDatePicker/Weekday.js +3 -13
- package/HiDatePicker/hiLocaleUtils.js +1 -8
- package/HiDatePicker/hiLocaleUtils.test.js +51 -0
- package/HiDatePicker/index.js +1 -15
- package/HiDatePicker/stylesheet.js +9 -22
- package/HiDotsStepper/HiDot.js +30 -57
- package/HiDotsStepper/HiDot.test.js +55 -0
- package/HiDotsStepper/HiDotsStepper.js +29 -47
- package/HiDotsStepper/HiDotsStepper.test.js +90 -0
- package/HiDotsStepper/index.js +2 -23
- package/HiExpansionPanel/HiExpansionPanel.js +42 -72
- package/HiExpansionPanel/index.js +2 -13
- package/HiForm/HiAddressField.js +30 -47
- package/HiForm/HiAddressField.test.js +79 -0
- package/HiForm/HiEmailField.js +28 -46
- package/HiForm/HiEmailField.test.js +19 -0
- package/HiForm/HiFormControl.js +72 -100
- package/HiForm/HiFormControl.test.js +195 -0
- package/HiForm/HiFormLabel.js +29 -54
- package/HiForm/HiFormLabel.test.js +66 -0
- package/HiForm/HiInput.js +62 -86
- package/HiForm/HiInput.test.js +202 -0
- package/HiForm/HiPasswordField.js +29 -55
- package/HiForm/HiPasswordField.test.js +60 -0
- package/HiForm/HiSearchField.js +27 -44
- package/HiForm/HiSearchField.test.js +193 -0
- package/HiForm/HiSlider.js +42 -64
- package/HiForm/HiSlider.test.js +99 -0
- package/HiForm/HiTextField.js +29 -46
- package/HiForm/HiTextField.test.js +254 -0
- package/HiForm/HiUpload.js +54 -70
- package/HiForm/HiUpload.test.js +241 -0
- package/HiForm/HiUploadField.js +24 -41
- package/HiForm/HiUploadField.test.js +55 -0
- package/HiForm/HiUploadInput.js +56 -77
- package/HiForm/HiUploadInput.test.js +148 -0
- package/HiForm/index.js +11 -95
- package/HiIcon/HiIcon.js +22 -44
- package/HiIcon/index.js +1 -15
- package/HiIconButton/HiIconButton.js +18 -40
- package/HiIconButton/HiIconButton.test.js +69 -0
- package/HiIconButton/index.js +1 -15
- package/HiLoader/HiLoader.js +9 -24
- package/HiLoader/HiLoader.test.js +18 -0
- package/HiLoader/index.js +1 -15
- package/HiMap/HiMap.js +50 -77
- package/HiMap/HiMap.test.js +29 -0
- package/HiMap/HiMapExpand.js +39 -64
- package/HiMap/HiMapExpand.test.js +48 -0
- package/HiMap/index.js +2 -23
- package/HiNotice/HiKPI.js +33 -54
- package/HiNotice/HiKPI.test.js +171 -0
- package/HiNotice/HiKPINotice.js +7 -21
- package/HiNotice/HiKPINotice.test.js +88 -0
- package/HiNotice/index.js +2 -23
- package/HiPaymentMeans/HiPaymentMeans.js +112 -131
- package/HiPaymentMeans/HiPaymentMeans.test.js +162 -0
- package/HiPaymentMeans/index.js +1 -15
- package/HiPdfReader/HiPdfReader.js +51 -76
- package/HiPdfReader/index.js +1 -15
- package/HiPin/HiPin.js +9 -30
- package/HiPin/HiPin.test.js +61 -0
- package/HiPin/index.js +1 -15
- package/HiRadio/HiRadio.js +7 -24
- package/HiRadio/HiRadio.test.js +57 -0
- package/HiRadio/index.js +1 -15
- package/HiSelect/HiDynamicSelect.js +40 -56
- package/HiSelect/HiDynamicSelectField.js +22 -40
- package/HiSelect/HiNestedSelect.js +55 -84
- package/HiSelect/HiNestedSelectContent.js +46 -73
- package/HiSelect/HiNestedSelectField.js +22 -40
- package/HiSelect/HiSelect.js +123 -139
- package/HiSelect/HiSelect.test.js +1092 -0
- package/HiSelect/HiSelectContent.js +73 -95
- package/HiSelect/HiSelectField.js +22 -40
- package/HiSelect/HiSelectInput.js +63 -87
- package/HiSelect/HiSelectInput.test.js +21 -0
- package/HiSelect/HiSelectMobile.js +35 -54
- package/HiSelect/HiSuggestSelect.js +56 -78
- package/HiSelect/HiSuggestSelectField.js +22 -40
- package/HiSelect/index.js +8 -85
- package/HiSelectableList/HiSelectableList.js +49 -77
- package/HiSelectableList/HiSelectableList.test.js +173 -0
- package/HiSelectableList/HiSelectableListHierarchic.js +35 -56
- package/HiSelectableList/HiSelectableListItem.js +66 -98
- package/HiSelectableList/HiSelectableListItem.test.js +97 -0
- package/HiSelectableList/index.js +3 -31
- package/HiSwitch/HiSwitch.js +20 -45
- package/HiSwitch/HiSwitch.test.js +41 -0
- package/HiSwitch/HiSwitchState.js +15 -36
- package/HiSwitch/HiSwitchState.test.js +76 -0
- package/HiSwitch/index.js +2 -23
- package/HiTable/HiCellBuilder.js +44 -72
- package/HiTable/HiTable.js +29 -47
- package/HiTable/HiTable.test.js +29 -0
- package/HiTable/HiTableBody.js +19 -34
- package/HiTable/HiTableHeader.js +30 -53
- package/HiTable/HiTableRow.js +29 -56
- package/HiTable/constants.js +43 -94
- package/HiTable/index.js +1 -15
- package/es/App.test.js +8 -0
- package/es/HiAlertModal/HiAlertModal.js +48 -77
- package/es/HiAlertModal/HiAlertModal.test.js +189 -0
- package/es/HiAlertModal/index.js +1 -15
- package/es/HiAppBar/HiAppBar.js +34 -63
- package/es/HiAppBar/index.js +1 -15
- package/es/HiBadge/HiBadge.js +10 -29
- package/es/HiBadge/HiBadge.test.js +49 -0
- package/es/HiBadge/index.js +1 -15
- package/es/HiBreadcrumb/HiBreadcrumb.js +27 -43
- package/es/HiBreadcrumb/HiBreadcrumb.test.js +44 -0
- package/es/HiBreadcrumb/HiStep.js +35 -57
- package/es/HiBreadcrumb/HiStep.test.js +47 -0
- package/es/HiBreadcrumb/HiStepConnector.js +32 -57
- package/es/HiBreadcrumb/HiStepConnector.test.js +113 -0
- package/es/HiBreadcrumb/HiStepContent.js +25 -46
- package/es/HiBreadcrumb/HiStepContent.test.js +32 -0
- package/es/HiBreadcrumb/HiStepIcon.js +26 -46
- package/es/HiBreadcrumb/HiStepIcon.test.js +65 -0
- package/es/HiBreadcrumb/HiStepLabel.js +36 -61
- package/es/HiBreadcrumb/HiStepLabel.test.js +30 -0
- package/es/HiBreadcrumb/HiStepper.js +23 -45
- package/es/HiBreadcrumb/HiStepper.test.js +33 -0
- package/es/HiBreadcrumb/index.js +1 -15
- package/es/HiButton/HiButton.js +9 -27
- package/es/HiButton/index.js +2 -13
- package/es/HiCell/CellAddress.js +20 -40
- package/es/HiCell/CellAddress.test.js +75 -0
- package/es/HiCell/CellDate.js +26 -47
- package/es/HiCell/CellDate.test.js +173 -0
- package/es/HiCell/CellIcon.js +28 -49
- package/es/HiCell/CellIcon.test.js +57 -0
- package/es/HiCell/CellImage.js +23 -42
- package/es/HiCell/CellImage.test.js +49 -0
- package/es/HiCell/CellNumeric.js +25 -46
- package/es/HiCell/CellNumeric.test.js +46 -0
- package/es/HiCell/CellPinToAction.js +20 -41
- package/es/HiCell/CellRate.js +32 -55
- package/es/HiCell/CellRate.test.js +73 -0
- package/es/HiCell/CellSentinel.js +22 -42
- package/es/HiCell/CellSentinel.test.js +48 -0
- package/es/HiCell/CellSentinelScore.js +23 -44
- package/es/HiCell/CellText.js +37 -56
- package/es/HiCell/CellText.test.js +76 -0
- package/es/HiCell/CellTextStyled.js +8 -21
- package/es/HiCell/index.js +9 -79
- package/es/HiCheckbox/HiCheckbox.js +35 -60
- package/es/HiCheckbox/HiCheckbox.test.js +55 -0
- package/es/HiCheckbox/index.js +1 -15
- package/es/HiChip/HiChip.js +24 -44
- package/es/HiChip/HiChip.test.js +136 -0
- package/es/HiChip/HiChipSwitch.js +47 -70
- package/es/HiChip/HiChipSwitch.test.js +99 -0
- package/es/HiChip/index.js +2 -23
- package/es/HiColoredLabel/HiColoredLabel.js +28 -52
- package/es/HiColoredLabel/HiColoredLabel.test.js +96 -0
- package/es/HiColoredLabel/index.js +1 -15
- package/es/HiDatePicker/Caption.js +11 -28
- package/es/HiDatePicker/Caption.test.js +65 -0
- package/es/HiDatePicker/HiDatePicker.js +100 -115
- package/es/HiDatePicker/HiDatePicker.test.js +370 -0
- package/es/HiDatePicker/HiDatePickerMobile.js +32 -54
- package/es/HiDatePicker/HiDateRangePicker.js +138 -149
- package/es/HiDatePicker/HiDateRangePicker.test.js +703 -0
- package/es/HiDatePicker/HiDateRangeSelector.js +71 -103
- package/es/HiDatePicker/HiDateRangeSelector.test.js +193 -0
- package/es/HiDatePicker/ListPicker.js +33 -55
- package/es/HiDatePicker/ListPicker.test.js +53 -0
- package/es/HiDatePicker/NavBar.js +18 -45
- package/es/HiDatePicker/NavBar.test.js +39 -0
- package/es/HiDatePicker/Overlays/CustomOverlayLayout.js +23 -40
- package/es/HiDatePicker/Overlays/CustomOverlayLayoutWithoutFooter.js +22 -39
- package/es/HiDatePicker/Overlays/MonthPickerOverlay.js +29 -45
- package/es/HiDatePicker/Overlays/MonthPickerOverlay.test.js +50 -0
- package/es/HiDatePicker/Overlays/Overlay.js +18 -35
- package/es/HiDatePicker/Overlays/Overlay.test.js +20 -0
- package/es/HiDatePicker/Overlays/TimePickerOverlay.js +47 -73
- package/es/HiDatePicker/Overlays/TimePickerOverlay.test.js +48 -0
- package/es/HiDatePicker/Overlays/YearPickerOverlay.js +29 -45
- package/es/HiDatePicker/Overlays/YearPickerOverlay.test.js +79 -0
- package/es/HiDatePicker/Overlays/index.js +5 -47
- package/es/HiDatePicker/Weekday.js +3 -13
- package/es/HiDatePicker/hiLocaleUtils.js +1 -8
- package/es/HiDatePicker/hiLocaleUtils.test.js +51 -0
- package/es/HiDatePicker/index.js +1 -15
- package/es/HiDatePicker/stylesheet.js +9 -22
- package/es/HiDotsStepper/HiDot.js +30 -57
- package/es/HiDotsStepper/HiDot.test.js +55 -0
- package/es/HiDotsStepper/HiDotsStepper.js +29 -47
- package/es/HiDotsStepper/HiDotsStepper.test.js +90 -0
- package/es/HiDotsStepper/index.js +2 -23
- package/es/HiExpansionPanel/HiExpansionPanel.js +42 -72
- package/es/HiExpansionPanel/index.js +2 -13
- package/es/HiForm/HiAddressField.js +30 -47
- package/es/HiForm/HiAddressField.test.js +79 -0
- package/es/HiForm/HiEmailField.js +28 -46
- package/es/HiForm/HiEmailField.test.js +19 -0
- package/es/HiForm/HiFormControl.js +72 -100
- package/es/HiForm/HiFormControl.test.js +195 -0
- package/es/HiForm/HiFormLabel.js +29 -54
- package/es/HiForm/HiFormLabel.test.js +66 -0
- package/es/HiForm/HiInput.js +62 -86
- package/es/HiForm/HiInput.test.js +202 -0
- package/es/HiForm/HiPasswordField.js +29 -55
- package/es/HiForm/HiPasswordField.test.js +60 -0
- package/es/HiForm/HiSearchField.js +27 -44
- package/es/HiForm/HiSearchField.test.js +193 -0
- package/es/HiForm/HiSlider.js +42 -64
- package/es/HiForm/HiSlider.test.js +99 -0
- package/es/HiForm/HiTextField.js +29 -46
- package/es/HiForm/HiTextField.test.js +254 -0
- package/es/HiForm/HiUpload.js +54 -70
- package/es/HiForm/HiUpload.test.js +241 -0
- package/es/HiForm/HiUploadField.js +24 -41
- package/es/HiForm/HiUploadField.test.js +55 -0
- package/es/HiForm/HiUploadInput.js +56 -77
- package/es/HiForm/HiUploadInput.test.js +148 -0
- package/es/HiForm/index.js +11 -95
- package/es/HiIcon/HiIcon.js +22 -44
- package/es/HiIcon/index.js +1 -15
- package/es/HiIconButton/HiIconButton.js +18 -40
- package/es/HiIconButton/HiIconButton.test.js +69 -0
- package/es/HiIconButton/index.js +1 -15
- package/es/HiLoader/HiLoader.js +9 -24
- package/es/HiLoader/HiLoader.test.js +18 -0
- package/es/HiLoader/index.js +1 -15
- package/es/HiMap/HiMap.js +50 -77
- package/es/HiMap/HiMap.test.js +29 -0
- package/es/HiMap/HiMapExpand.js +39 -64
- package/es/HiMap/HiMapExpand.test.js +48 -0
- package/es/HiMap/index.js +2 -23
- package/es/HiNotice/HiKPI.js +33 -54
- package/es/HiNotice/HiKPI.test.js +171 -0
- package/es/HiNotice/HiKPINotice.js +7 -21
- package/es/HiNotice/HiKPINotice.test.js +88 -0
- package/es/HiNotice/index.js +2 -23
- package/es/HiPaymentMeans/HiPaymentMeans.js +112 -131
- package/es/HiPaymentMeans/HiPaymentMeans.test.js +162 -0
- package/es/HiPaymentMeans/index.js +1 -15
- package/es/HiPdfReader/HiPdfReader.js +51 -76
- package/es/HiPdfReader/index.js +1 -15
- package/es/HiPin/HiPin.js +9 -30
- package/es/HiPin/HiPin.test.js +61 -0
- package/es/HiPin/index.js +1 -15
- package/es/HiRadio/HiRadio.js +7 -24
- package/es/HiRadio/HiRadio.test.js +57 -0
- package/es/HiRadio/index.js +1 -15
- package/es/HiSelect/HiDynamicSelect.js +40 -56
- package/es/HiSelect/HiDynamicSelectField.js +22 -40
- package/es/HiSelect/HiNestedSelect.js +55 -84
- package/es/HiSelect/HiNestedSelectContent.js +46 -73
- package/es/HiSelect/HiNestedSelectField.js +22 -40
- package/es/HiSelect/HiSelect.js +123 -139
- package/es/HiSelect/HiSelect.test.js +1092 -0
- package/es/HiSelect/HiSelectContent.js +73 -95
- package/es/HiSelect/HiSelectField.js +22 -40
- package/es/HiSelect/HiSelectInput.js +63 -87
- package/es/HiSelect/HiSelectInput.test.js +21 -0
- package/es/HiSelect/HiSelectMobile.js +35 -54
- package/es/HiSelect/HiSuggestSelect.js +56 -78
- package/es/HiSelect/HiSuggestSelectField.js +22 -40
- package/es/HiSelect/index.js +8 -85
- package/es/HiSelectableList/HiSelectableList.js +49 -77
- package/es/HiSelectableList/HiSelectableList.test.js +173 -0
- package/es/HiSelectableList/HiSelectableListHierarchic.js +35 -56
- package/es/HiSelectableList/HiSelectableListItem.js +66 -98
- package/es/HiSelectableList/HiSelectableListItem.test.js +97 -0
- package/es/HiSelectableList/index.js +3 -31
- package/es/HiSwitch/HiSwitch.js +20 -45
- package/es/HiSwitch/HiSwitch.test.js +41 -0
- package/es/HiSwitch/HiSwitchState.js +15 -36
- package/es/HiSwitch/HiSwitchState.test.js +76 -0
- package/es/HiSwitch/index.js +2 -23
- package/es/HiTable/HiCellBuilder.js +44 -72
- package/es/HiTable/HiTable.js +29 -47
- package/es/HiTable/HiTable.test.js +29 -0
- package/es/HiTable/HiTableBody.js +19 -34
- package/es/HiTable/HiTableHeader.js +30 -53
- package/es/HiTable/HiTableRow.js +29 -56
- package/es/HiTable/constants.js +43 -94
- package/es/HiTable/index.js +1 -15
- package/es/hi-svg-icons/HiAccount.js +18 -36
- package/es/hi-svg-icons/HiActivity.js +17 -35
- package/es/hi-svg-icons/HiAll.js +22 -42
- package/es/hi-svg-icons/HiBilling.js +18 -36
- package/es/hi-svg-icons/HiBriefcaseRescue.js +10 -26
- package/es/hi-svg-icons/HiCatalog.js +18 -36
- package/es/hi-svg-icons/HiCustomer.js +18 -36
- package/es/hi-svg-icons/HiDownload.js +11 -25
- package/es/hi-svg-icons/HiFinance.js +18 -36
- package/es/hi-svg-icons/HiPermission.js +17 -35
- package/es/hi-svg-icons/HiRoute.js +18 -36
- package/es/hi-svg-icons/HiSettlement.js +18 -36
- package/es/hi-svg-icons/HiSizeLarge.js +12 -27
- package/es/hi-svg-icons/HiSizeMedium.js +11 -25
- package/es/hi-svg-icons/HiSizeSmall.js +11 -25
- package/es/hi-svg-icons/HiTransaction.js +18 -36
- package/es/hi-svg-icons/HiUser.js +18 -36
- package/es/hi-svg-icons/HiWidget.js +22 -42
- package/es/hi-svg-icons/index.js +18 -151
- package/es/hi-svg-icons/index.text.js +11 -21
- package/es/styleguide/Wrapper.js +19 -36
- package/es/styles/MuiThemeProvider.js +39 -59
- package/es/styles/colorManipulator.js +16 -44
- package/es/styles/colorManipulator.test.js +242 -0
- package/es/styles/createBreakpoints.js +6 -20
- package/es/styles/createBreakpoints.test.js +48 -0
- package/es/styles/createGenerateClassName.js +5 -15
- package/es/styles/createGenerateClassName.test.js +141 -0
- package/es/styles/createMixins.js +8 -19
- package/es/styles/createMixins.test.js +24 -0
- package/es/styles/createMuiTheme.js +34 -53
- package/es/styles/createMuiTheme.test.js +67 -0
- package/es/styles/createPalette.js +30 -50
- package/es/styles/createPalette.test.js +159 -0
- package/es/styles/createStyles.js +1 -8
- package/es/styles/createStyles.test.js +8 -0
- package/es/styles/createTypography.js +18 -30
- package/es/styles/createTypography.test.js +60 -0
- package/es/styles/getStylesCreator.js +11 -24
- package/es/styles/getStylesCreator.test.js +92 -0
- package/es/styles/getThemeProps.js +1 -9
- package/es/styles/getThemeProps.test.js +39 -0
- package/es/styles/index.js +5 -47
- package/es/styles/jssPreset.js +9 -25
- package/es/styles/mergeClasses.js +7 -19
- package/es/styles/shadows.js +1 -8
- package/es/styles/shape.js +1 -8
- package/es/styles/spacing.js +1 -9
- package/es/styles/themeListener.js +5 -18
- package/es/styles/themeListener.test.js +26 -0
- package/es/styles/transitions.js +18 -38
- package/es/styles/transitions.test.js +208 -0
- package/es/styles/zIndex.js +1 -8
- package/es/test-utils/createMount.js +11 -22
- package/es/test-utils/createRender.js +8 -19
- package/es/test-utils/createShallow.js +13 -23
- package/es/test-utils/getClasses.js +2 -11
- package/es/test-utils/index.js +5 -47
- package/es/test-utils/until.js +6 -16
- package/es/test-utils/until.test.js +157 -0
- package/es/test-utils/unwrap.js +1 -8
- package/es/theme/palette.js +2 -10
- package/es/theme/typography.js +2 -10
- package/es/theme.js +2 -11
- package/es/transitions/utils.js +2 -13
- package/es/utils/exactProp.js +5 -18
- package/es/utils/helpers.js +18 -55
- package/es/withMobileDialog/index.js +1 -15
- package/es/withMobileDialog/withMobileDialog.js +7 -22
- package/es/withMobileDialog/withMobileDialog.test.js +67 -0
- package/hi-svg-icons/HiAccount.js +18 -36
- package/hi-svg-icons/HiActivity.js +17 -35
- package/hi-svg-icons/HiAll.js +22 -42
- package/hi-svg-icons/HiBilling.js +18 -36
- package/hi-svg-icons/HiBriefcaseRescue.js +10 -26
- package/hi-svg-icons/HiCatalog.js +18 -36
- package/hi-svg-icons/HiCustomer.js +18 -36
- package/hi-svg-icons/HiDownload.js +11 -25
- package/hi-svg-icons/HiFinance.js +18 -36
- package/hi-svg-icons/HiPermission.js +17 -35
- package/hi-svg-icons/HiRoute.js +18 -36
- package/hi-svg-icons/HiSettlement.js +18 -36
- package/hi-svg-icons/HiSizeLarge.js +12 -27
- package/hi-svg-icons/HiSizeMedium.js +11 -25
- package/hi-svg-icons/HiSizeSmall.js +11 -25
- package/hi-svg-icons/HiTransaction.js +18 -36
- package/hi-svg-icons/HiUser.js +18 -36
- package/hi-svg-icons/HiWidget.js +22 -42
- package/hi-svg-icons/index.js +18 -151
- package/hi-svg-icons/index.text.js +11 -21
- package/package.json +1 -1
- package/styleguide/Wrapper.js +19 -36
- package/styles/MuiThemeProvider.js +39 -59
- package/styles/colorManipulator.js +16 -44
- package/styles/colorManipulator.test.js +242 -0
- package/styles/createBreakpoints.js +6 -20
- package/styles/createBreakpoints.test.js +48 -0
- package/styles/createGenerateClassName.js +5 -15
- package/styles/createGenerateClassName.test.js +141 -0
- package/styles/createMixins.js +8 -19
- package/styles/createMixins.test.js +24 -0
- package/styles/createMuiTheme.js +34 -53
- package/styles/createMuiTheme.test.js +67 -0
- package/styles/createPalette.js +30 -50
- package/styles/createPalette.test.js +159 -0
- package/styles/createStyles.js +1 -8
- package/styles/createStyles.test.js +8 -0
- package/styles/createTypography.js +18 -30
- package/styles/createTypography.test.js +60 -0
- package/styles/getStylesCreator.js +11 -24
- package/styles/getStylesCreator.test.js +92 -0
- package/styles/getThemeProps.js +1 -9
- package/styles/getThemeProps.test.js +39 -0
- package/styles/index.js +5 -47
- package/styles/jssPreset.js +9 -25
- package/styles/mergeClasses.js +7 -19
- package/styles/shadows.js +1 -8
- package/styles/shape.js +1 -8
- package/styles/spacing.js +1 -9
- package/styles/themeListener.js +5 -18
- package/styles/themeListener.test.js +26 -0
- package/styles/transitions.js +18 -38
- package/styles/transitions.test.js +208 -0
- package/styles/zIndex.js +1 -8
- package/test-utils/createMount.js +11 -22
- package/test-utils/createRender.js +8 -19
- package/test-utils/createShallow.js +13 -23
- package/test-utils/getClasses.js +2 -11
- package/test-utils/index.js +5 -47
- package/test-utils/until.js +6 -16
- package/test-utils/until.test.js +157 -0
- package/test-utils/unwrap.js +1 -8
- package/theme/palette.js +2 -10
- package/theme/typography.js +2 -10
- package/theme.js +2 -11
- package/transitions/utils.js +2 -13
- package/utils/exactProp.js +5 -18
- package/utils/helpers.js +18 -55
- package/withMobileDialog/index.js +1 -15
- package/withMobileDialog/withMobileDialog.js +7 -22
- package/withMobileDialog/withMobileDialog.test.js +67 -0
package/styles/createMuiTheme.js
CHANGED
@@ -1,43 +1,22 @@
|
|
1
|
-
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3
|
+
import deepmerge from 'deepmerge'; // < 1kb payload overhead when lodash/merge is > 3kb.
|
4
|
+
|
5
|
+
import isPlainObject from 'is-plain-object';
|
6
|
+
import warning from 'warning';
|
7
|
+
import createBreakpoints from './createBreakpoints';
|
8
|
+
import createMixins from './createMixins';
|
9
|
+
import createPalette from './createPalette';
|
10
|
+
import createTypography from './createTypography';
|
11
|
+
import shadows from './shadows';
|
12
|
+
import shape from './shape';
|
13
|
+
import spacing from './spacing';
|
14
|
+
import transitions from './transitions';
|
15
|
+
import zIndex from './zIndex';
|
2
16
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
6
|
-
value: true
|
7
|
-
});
|
8
|
-
exports.default = void 0;
|
9
|
-
|
10
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
11
|
-
|
12
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
13
|
-
|
14
|
-
var _deepmerge = _interopRequireDefault(require("deepmerge"));
|
15
|
-
|
16
|
-
var _isPlainObject = _interopRequireDefault(require("is-plain-object"));
|
17
|
-
|
18
|
-
var _warning = _interopRequireDefault(require("warning"));
|
19
|
-
|
20
|
-
var _createBreakpoints = _interopRequireDefault(require("./createBreakpoints"));
|
21
|
-
|
22
|
-
var _createMixins = _interopRequireDefault(require("./createMixins"));
|
23
|
-
|
24
|
-
var _createPalette = _interopRequireDefault(require("./createPalette"));
|
25
|
-
|
26
|
-
var _createTypography = _interopRequireDefault(require("./createTypography"));
|
27
|
-
|
28
|
-
var _shadows = _interopRequireDefault(require("./shadows"));
|
29
|
-
|
30
|
-
var _shape = _interopRequireDefault(require("./shape"));
|
31
|
-
|
32
|
-
var _spacing = _interopRequireDefault(require("./spacing"));
|
33
|
-
|
34
|
-
var _transitions = _interopRequireDefault(require("./transitions"));
|
35
|
-
|
36
|
-
var _zIndex = _interopRequireDefault(require("./zIndex"));
|
37
|
-
|
38
|
-
// < 1kb payload overhead when lodash/merge is > 3kb.
|
39
17
|
function createMuiTheme() {
|
40
18
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
19
|
+
|
41
20
|
var _options$breakpoints = options.breakpoints,
|
42
21
|
breakpointsInput = _options$breakpoints === void 0 ? {} : _options$breakpoints,
|
43
22
|
_options$mixins = options.mixins,
|
@@ -47,31 +26,33 @@ function createMuiTheme() {
|
|
47
26
|
shadowsInput = options.shadows,
|
48
27
|
_options$typography = options.typography,
|
49
28
|
typographyInput = _options$typography === void 0 ? {} : _options$typography,
|
50
|
-
other = (
|
51
|
-
|
52
|
-
var
|
53
|
-
var
|
29
|
+
other = _objectWithoutProperties(options, ["breakpoints", "mixins", "palette", "shadows", "typography"]);
|
30
|
+
|
31
|
+
var palette = createPalette(paletteInput);
|
32
|
+
var breakpoints = createBreakpoints(breakpointsInput);
|
33
|
+
|
34
|
+
var muiTheme = _objectSpread({
|
54
35
|
breakpoints: breakpoints,
|
55
36
|
direction: 'ltr',
|
56
|
-
mixins: (
|
37
|
+
mixins: createMixins(breakpoints, spacing, mixinsInput),
|
57
38
|
overrides: {},
|
58
39
|
// Inject custom styles
|
59
40
|
palette: palette,
|
60
41
|
props: {},
|
61
42
|
// Inject custom properties
|
62
|
-
shadows: shadowsInput ||
|
63
|
-
typography: (
|
64
|
-
}, (
|
65
|
-
shape:
|
66
|
-
spacing:
|
67
|
-
transitions:
|
68
|
-
zIndex:
|
43
|
+
shadows: shadowsInput || shadows,
|
44
|
+
typography: createTypography(palette, typographyInput)
|
45
|
+
}, deepmerge({
|
46
|
+
shape: shape,
|
47
|
+
spacing: spacing,
|
48
|
+
transitions: transitions,
|
49
|
+
zIndex: zIndex
|
69
50
|
}, other, {
|
70
|
-
isMergeableObject:
|
51
|
+
isMergeableObject: isPlainObject
|
71
52
|
}));
|
72
|
-
|
53
|
+
|
54
|
+
warning(muiTheme.shadows.length === 25, 'Material-UI: the shadows array provided to createMuiTheme should support 25 elevations.');
|
73
55
|
return muiTheme;
|
74
56
|
}
|
75
57
|
|
76
|
-
|
77
|
-
exports.default = _default;
|
58
|
+
export default createMuiTheme;
|
@@ -0,0 +1,67 @@
|
|
1
|
+
import { assert } from 'chai';
|
2
|
+
import createMuiTheme from './createMuiTheme';
|
3
|
+
import { deepOrange, green } from '@material-ui/core/colors';
|
4
|
+
describe('createMuiTheme', function () {
|
5
|
+
it('should have a palette', function () {
|
6
|
+
var muiTheme = createMuiTheme();
|
7
|
+
assert.strictEqual(typeof createMuiTheme, 'function', 'should be a function');
|
8
|
+
assert.ok(muiTheme.palette, 'should have a palette');
|
9
|
+
});
|
10
|
+
it('should have the custom palette', function () {
|
11
|
+
var muiTheme = createMuiTheme({
|
12
|
+
palette: {
|
13
|
+
primary: {
|
14
|
+
main: deepOrange[500]
|
15
|
+
},
|
16
|
+
secondary: {
|
17
|
+
main: green.A400
|
18
|
+
}
|
19
|
+
}
|
20
|
+
});
|
21
|
+
assert.strictEqual(muiTheme.palette.primary.main, deepOrange[500], 'should have a palette');
|
22
|
+
assert.strictEqual(muiTheme.palette.secondary.main, green.A400, 'should have a palette');
|
23
|
+
});
|
24
|
+
it('should allow providing a partial structure', function () {
|
25
|
+
var muiTheme = createMuiTheme({
|
26
|
+
transitions: {
|
27
|
+
duration: {
|
28
|
+
shortest: 150
|
29
|
+
}
|
30
|
+
}
|
31
|
+
});
|
32
|
+
assert.notStrictEqual(muiTheme.transitions.duration.shorter, undefined);
|
33
|
+
});
|
34
|
+
describe('shadows', function () {
|
35
|
+
it('should provide the default array', function () {
|
36
|
+
var muiTheme = createMuiTheme();
|
37
|
+
assert.strictEqual(muiTheme.shadows[2], '0px 1px 5px 0px rgba(0, 0, 0, 0.2),' + '0px 2px 2px 0px rgba(0, 0, 0, 0.14),0px 3px 1px -2px rgba(0, 0, 0, 0.12)');
|
38
|
+
});
|
39
|
+
it('should override the array as expected', function () {
|
40
|
+
var shadows = ['none', 1, 1, 1, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11];
|
41
|
+
var muiTheme = createMuiTheme({
|
42
|
+
shadows: shadows
|
43
|
+
});
|
44
|
+
assert.strictEqual(muiTheme.shadows, shadows);
|
45
|
+
});
|
46
|
+
});
|
47
|
+
describe('props', function () {
|
48
|
+
it('should have the props as expected', function () {
|
49
|
+
var props = {
|
50
|
+
MuiDialog: {
|
51
|
+
fullScreen: true,
|
52
|
+
fullWidth: false
|
53
|
+
},
|
54
|
+
MuiButtonBase: {
|
55
|
+
disableRipple: true
|
56
|
+
},
|
57
|
+
MuiPopover: {
|
58
|
+
container: document.createElement('div')
|
59
|
+
}
|
60
|
+
};
|
61
|
+
var muiTheme = createMuiTheme({
|
62
|
+
props: props
|
63
|
+
});
|
64
|
+
assert.deepEqual(muiTheme.props, props);
|
65
|
+
});
|
66
|
+
});
|
67
|
+
});
|
package/styles/createPalette.js
CHANGED
@@ -1,31 +1,13 @@
|
|
1
|
-
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3
|
+
import warning from 'warning';
|
4
|
+
import deepmerge from 'deepmerge'; // < 1kb payload overhead when lodash/merge is > 3kb.
|
2
5
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
exports.default = createPalette;
|
9
|
-
exports.dark = exports.light = void 0;
|
10
|
-
|
11
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
12
|
-
|
13
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
14
|
-
|
15
|
-
var _warning = _interopRequireDefault(require("warning"));
|
16
|
-
|
17
|
-
var _deepmerge = _interopRequireDefault(require("deepmerge"));
|
18
|
-
|
19
|
-
var _grey = _interopRequireDefault(require("@material-ui/core/colors/grey"));
|
20
|
-
|
21
|
-
var _red = _interopRequireDefault(require("@material-ui/core/colors/red"));
|
22
|
-
|
23
|
-
var _common = _interopRequireDefault(require("@material-ui/core/colors/common"));
|
24
|
-
|
25
|
-
var _colorManipulator = require("./colorManipulator");
|
26
|
-
|
27
|
-
// < 1kb payload overhead when lodash/merge is > 3kb.
|
28
|
-
var light = {
|
6
|
+
import grey from '@material-ui/core/colors/grey';
|
7
|
+
import red from '@material-ui/core/colors/red';
|
8
|
+
import common from '@material-ui/core/colors/common';
|
9
|
+
import { getContrastRatio, darken, lighten } from './colorManipulator';
|
10
|
+
export var light = {
|
29
11
|
global: {
|
30
12
|
background1: '#FFFFFF',
|
31
13
|
background2: '#F8F9FB',
|
@@ -52,8 +34,8 @@ var light = {
|
|
52
34
|
// The background colors used to style the surfaces.
|
53
35
|
// Consistency between these values is important.
|
54
36
|
background: {
|
55
|
-
paper:
|
56
|
-
default:
|
37
|
+
paper: common.white,
|
38
|
+
default: grey[50]
|
57
39
|
},
|
58
40
|
// The colors used to style the action elements.
|
59
41
|
action: {
|
@@ -77,8 +59,7 @@ var light = {
|
|
77
59
|
disabled: '#FAFAFA'
|
78
60
|
}
|
79
61
|
};
|
80
|
-
|
81
|
-
var dark = {
|
62
|
+
export var dark = {
|
82
63
|
global: {
|
83
64
|
background1: '#303030',
|
84
65
|
background2: '#212121',
|
@@ -90,7 +71,7 @@ var dark = {
|
|
90
71
|
background3: '#303030'
|
91
72
|
},
|
92
73
|
text: {
|
93
|
-
primary:
|
74
|
+
primary: common.white,
|
94
75
|
secondary: 'rgba(255, 255, 255, 0.7)',
|
95
76
|
disabled: 'rgba(255, 255, 255, 0.5)',
|
96
77
|
hint: 'rgba(255, 255, 255, 0.5)',
|
@@ -98,11 +79,11 @@ var dark = {
|
|
98
79
|
},
|
99
80
|
divider: 'rgba(255, 255, 255, 0.12)',
|
100
81
|
background: {
|
101
|
-
paper:
|
82
|
+
paper: grey[800],
|
102
83
|
default: '#303030'
|
103
84
|
},
|
104
85
|
action: {
|
105
|
-
active:
|
86
|
+
active: common.white,
|
106
87
|
hover: 'rgba(255, 255, 255, 0.1)',
|
107
88
|
hoverOpacity: 0.1,
|
108
89
|
selected: 'rgba(255, 255, 255, 0.2)',
|
@@ -117,21 +98,20 @@ var dark = {
|
|
117
98
|
disabled: 'rgba(255, 255, 255, 0.5)'
|
118
99
|
}
|
119
100
|
};
|
120
|
-
exports.dark = dark;
|
121
101
|
|
122
102
|
function addLightOrDark(intent, direction, shade, tonalOffset) {
|
123
103
|
if (!intent[direction]) {
|
124
104
|
if (intent.hasOwnProperty(shade)) {
|
125
105
|
intent[direction] = intent[shade];
|
126
106
|
} else if (direction === 'light') {
|
127
|
-
intent.light =
|
107
|
+
intent.light = lighten(intent.main, tonalOffset);
|
128
108
|
} else if (direction === 'dark') {
|
129
|
-
intent.dark =
|
109
|
+
intent.dark = darken(intent.main, tonalOffset * 1.5);
|
130
110
|
}
|
131
111
|
}
|
132
112
|
}
|
133
113
|
|
134
|
-
function createPalette(palette) {
|
114
|
+
export default function createPalette(palette) {
|
135
115
|
var _palette$primary = palette.primary,
|
136
116
|
primary = _palette$primary === void 0 ? {
|
137
117
|
light: '#5bc8ef',
|
@@ -178,9 +158,9 @@ function createPalette(palette) {
|
|
178
158
|
} : _palette$neutral,
|
179
159
|
_palette$error = palette.error,
|
180
160
|
error = _palette$error === void 0 ? {
|
181
|
-
light:
|
182
|
-
main:
|
183
|
-
dark:
|
161
|
+
light: red[300],
|
162
|
+
main: red[500],
|
163
|
+
dark: red[700]
|
184
164
|
} : _palette$error,
|
185
165
|
_palette$lookup = palette.lookup,
|
186
166
|
lookup = _palette$lookup === void 0 ? {
|
@@ -195,17 +175,17 @@ function createPalette(palette) {
|
|
195
175
|
tonalOffset = _palette$tonalOffset === void 0 ? 0.2 : _palette$tonalOffset,
|
196
176
|
_palette$context = palette.context,
|
197
177
|
context = _palette$context === void 0 ? 'local' : _palette$context,
|
198
|
-
other = (
|
178
|
+
other = _objectWithoutProperties(palette, ["primary", "secondary", "positive", "negative", "middle", "neutral", "error", "lookup", "type", "contrastThreshold", "tonalOffset", "context"]);
|
199
179
|
|
200
180
|
function getContrastText(background) {
|
201
181
|
// Use the same logic as
|
202
182
|
// Bootstrap: https://github.com/twbs/bootstrap/blob/1d6e3710dd447de1a200f29e8fa521f8a0908f70/scss/_functions.scss#L59
|
203
183
|
// and material-components-web https://github.com/material-components/material-components-web/blob/ac46b8863c4dab9fc22c4c662dc6bd1b65dd652f/packages/mdc-theme/_functions.scss#L54
|
204
|
-
var contrastText =
|
184
|
+
var contrastText = getContrastRatio(background, dark.text.primary) >= contrastThreshold ? dark.text.primary : light.text.primary;
|
205
185
|
|
206
186
|
if (process.env.NODE_ENV !== 'production') {
|
207
|
-
var contrast =
|
208
|
-
|
187
|
+
var contrast = getContrastRatio(background, contrastText);
|
188
|
+
warning(contrast >= 2.2, ["Material-UI: the contrast ratio of ".concat(contrast, ":1 for ").concat(contrastText, " on ").concat(background), 'falls below the WACG recommended absolute minimum contrast ratio of 3:1.', 'https://www.w3.org/TR/2008/REC-WCAG20-20081211/#visual-audio-contrast-contrast'].join('\n'));
|
209
189
|
}
|
210
190
|
|
211
191
|
return contrastText;
|
@@ -239,15 +219,15 @@ function createPalette(palette) {
|
|
239
219
|
dark: dark,
|
240
220
|
light: light
|
241
221
|
};
|
242
|
-
|
222
|
+
warning(types[type], "Material-UI: the palette type `".concat(type, "` is not supported."));
|
243
223
|
var contexts = {
|
244
224
|
local: types[type] ? types[type].local : {},
|
245
225
|
global: types[type] ? types[type].global : {}
|
246
226
|
};
|
247
|
-
|
248
|
-
var paletteOutput = (
|
227
|
+
warning(contexts[context], "Material-UI: the context `".concat(context, "` is not supported."));
|
228
|
+
var paletteOutput = deepmerge(_objectSpread({
|
249
229
|
// A collection of common colors.
|
250
|
-
common:
|
230
|
+
common: common,
|
251
231
|
// The palette type, can be light or dark.
|
252
232
|
type: type,
|
253
233
|
// The colors used to represent primary interface elements for a user.
|
@@ -267,7 +247,7 @@ function createPalette(palette) {
|
|
267
247
|
// The colors used to represent form elements that have lookup state.
|
268
248
|
lookup: lookup,
|
269
249
|
// The grey colors.
|
270
|
-
grey:
|
250
|
+
grey: grey,
|
271
251
|
// Used by `getContrastText()` to maximize the contrast between the background and
|
272
252
|
// the text.
|
273
253
|
contrastThreshold: contrastThreshold,
|
@@ -0,0 +1,159 @@
|
|
1
|
+
import { assert } from 'chai';
|
2
|
+
import consoleErrorMock from 'test/utils/consoleErrorMock';
|
3
|
+
import { pink, deepOrange, green, red } from '@material-ui/core/colors';
|
4
|
+
import { lighten, darken } from './colorManipulator';
|
5
|
+
import createPalette, { dark, light } from './createPalette';
|
6
|
+
describe('createPalette()', function () {
|
7
|
+
before(function () {
|
8
|
+
consoleErrorMock.spy();
|
9
|
+
});
|
10
|
+
after(function () {
|
11
|
+
consoleErrorMock.reset();
|
12
|
+
});
|
13
|
+
it('should create a material design palette according to spec', function () {
|
14
|
+
var palette = createPalette({});
|
15
|
+
assert.strictEqual(palette.primary.main, '#00ade9', 'should use blue hipay as the default primary main color');
|
16
|
+
assert.strictEqual(palette.primary.light, '#5bc8ef', 'should use light blue hipay as the default primary light color');
|
17
|
+
assert.strictEqual(palette.primary.dark, '#007ca9', 'should use dark blue hipay as the default primary dark color');
|
18
|
+
assert.strictEqual(palette.primary.contrastText, '#FFFFFF', 'should use white as the default primary contrastText color');
|
19
|
+
assert.strictEqual(palette.secondary.main, '#ffcf21', 'should use yellow hipay as the default secondary main color');
|
20
|
+
assert.strictEqual(palette.secondary.light, '#ffd94f', 'should use light yellow hipay as the default secondary light color');
|
21
|
+
assert.strictEqual(palette.secondary.dark, '#E9BE30', 'should use dark yellow hipay as the default secondary dark color');
|
22
|
+
assert.strictEqual(palette.secondary.contrastText, '#FFFFFF', 'should use white as the default secondary contrastText color');
|
23
|
+
assert.strictEqual(palette.error.main, red[500], 'should use red[500] as the default error main color');
|
24
|
+
assert.strictEqual(palette.error.light, red[300], 'should use red[300] as the default error light color');
|
25
|
+
assert.strictEqual(palette.error.dark, red[700], 'should use red[700] as the default error dark color');
|
26
|
+
assert.strictEqual(palette.text, light.text, 'should use light theme text for a light theme by default');
|
27
|
+
});
|
28
|
+
it('should create a palette with Material colors', function () {
|
29
|
+
var palette = createPalette({
|
30
|
+
primary: deepOrange,
|
31
|
+
secondary: green,
|
32
|
+
error: pink
|
33
|
+
});
|
34
|
+
assert.strictEqual(palette.primary.main, deepOrange[500], 'should use deepOrange[500] as the primary main color');
|
35
|
+
assert.strictEqual(palette.primary.light, deepOrange[300], 'should use deepOrange[300] as the primary light color');
|
36
|
+
assert.strictEqual(palette.primary.dark, deepOrange[700], 'should use deepOrange[700] as the primary dark color');
|
37
|
+
assert.strictEqual(palette.secondary.main, green.A400, 'should use green.A400 as the secondary main color');
|
38
|
+
assert.strictEqual(palette.secondary.light, green.A200, 'should use green.A200 as the secondary light color');
|
39
|
+
assert.strictEqual(palette.secondary.dark, green.A700, 'should use green.A700 as the secondary dark color');
|
40
|
+
assert.strictEqual(palette.error.main, pink[500], 'should use pink[500] as the error main color');
|
41
|
+
assert.strictEqual(palette.error.light, pink[300], 'should use pink[300] as the error light color');
|
42
|
+
assert.strictEqual(palette.error.dark, pink[700], 'should use pink[700] as the error dark color');
|
43
|
+
assert.strictEqual(palette.text, light.text, 'should use light theme text');
|
44
|
+
});
|
45
|
+
it('should create a palette with custom colors', function () {
|
46
|
+
var palette = createPalette({
|
47
|
+
primary: {
|
48
|
+
main: deepOrange[500],
|
49
|
+
light: deepOrange[300],
|
50
|
+
dark: deepOrange[700],
|
51
|
+
contrastText: '#ffffff'
|
52
|
+
},
|
53
|
+
secondary: {
|
54
|
+
main: green.A400,
|
55
|
+
light: green.A200,
|
56
|
+
dark: green.A700,
|
57
|
+
contrastText: '#000000'
|
58
|
+
},
|
59
|
+
error: {
|
60
|
+
main: pink[500],
|
61
|
+
light: pink[300],
|
62
|
+
dark: pink[700],
|
63
|
+
contrastText: '#00ff00'
|
64
|
+
}
|
65
|
+
});
|
66
|
+
assert.strictEqual(palette.primary.main, deepOrange[500], 'should use deepOrange[500] as the primary main color');
|
67
|
+
assert.strictEqual(palette.primary.light, deepOrange[300], 'should use deepOrange[300] as the primary light color');
|
68
|
+
assert.strictEqual(palette.primary.dark, deepOrange[700], 'should use deepOrange[700] as the primary dark color');
|
69
|
+
assert.strictEqual(palette.primary.contrastText, '#ffffff', 'should use #ffffff as the secondary contrastText color');
|
70
|
+
assert.strictEqual(palette.secondary.main, green.A400, 'should use green.A400 as the secondary main color');
|
71
|
+
assert.strictEqual(palette.secondary.light, green.A200, 'should use green.A200 as the secondary light color');
|
72
|
+
assert.strictEqual(palette.secondary.dark, green.A700, 'should use green.A700 as the secondary dark color');
|
73
|
+
assert.strictEqual(palette.secondary.contrastText, '#000000', 'should use #000000 as the secondary contrastText color');
|
74
|
+
assert.strictEqual(palette.error.main, pink[500], 'should use pink[500] as the error main color');
|
75
|
+
assert.strictEqual(palette.error.light, pink[300], 'should use pink[300] as the error light color');
|
76
|
+
assert.strictEqual(palette.error.dark, pink[700], 'should use pink[700] as the error dark color');
|
77
|
+
assert.strictEqual(palette.error.contrastText, '#00ff00', 'should use #00ff00 as the error contrastText color');
|
78
|
+
assert.strictEqual(palette.text, light.text, 'should use light theme text');
|
79
|
+
});
|
80
|
+
it('should calculate light and dark colors if not provided', function () {
|
81
|
+
var palette = createPalette({
|
82
|
+
primary: {
|
83
|
+
main: deepOrange[500]
|
84
|
+
},
|
85
|
+
secondary: {
|
86
|
+
main: green.A400
|
87
|
+
},
|
88
|
+
error: {
|
89
|
+
main: pink[500]
|
90
|
+
}
|
91
|
+
});
|
92
|
+
assert.strictEqual(palette.primary.main, deepOrange[500], 'should use deepOrange[500] as the primary main color');
|
93
|
+
assert.strictEqual(palette.primary.light, lighten(deepOrange[500], 0.2), 'should use lighten(deepOrange[500], 0.2) as the primary light color');
|
94
|
+
assert.strictEqual(palette.primary.dark, darken(deepOrange[500], 0.3), 'should use darken(deepOrange[500], 0.3) as the primary dark color');
|
95
|
+
assert.strictEqual(palette.secondary.main, green.A400, 'should use green.A400 as the secondary main color');
|
96
|
+
assert.strictEqual(palette.secondary.light, lighten(green.A400, 0.2), 'should use lighten(green.A400, 0.2) as the secondary light color');
|
97
|
+
assert.strictEqual(palette.secondary.dark, darken(green.A400, 0.3), 'should use darken(green.A400, 0.3) as the secondary dark color');
|
98
|
+
assert.strictEqual(palette.error.main, pink[500], 'should use pink[500] as the error main color');
|
99
|
+
assert.strictEqual(palette.error.light, lighten(pink[500], 0.2), 'should use lighten(pink[500], 0.2) as the error light color');
|
100
|
+
assert.strictEqual(palette.error.dark, darken(pink[500], 0.3), 'should use darken(pink[500], 0.3) as the error dark color');
|
101
|
+
});
|
102
|
+
it('should calculate light and dark colors using the provided tonalOffset', function () {
|
103
|
+
var palette = createPalette({
|
104
|
+
primary: {
|
105
|
+
main: deepOrange[500]
|
106
|
+
},
|
107
|
+
secondary: {
|
108
|
+
main: green.A400
|
109
|
+
},
|
110
|
+
error: {
|
111
|
+
main: red[500]
|
112
|
+
},
|
113
|
+
tonalOffset: 0.1
|
114
|
+
}); // primary
|
115
|
+
|
116
|
+
assert.strictEqual(palette.primary.main, deepOrange[500], 'should use deepOrange[500] as the primary main color');
|
117
|
+
assert.strictEqual(palette.primary.light, lighten(deepOrange[500], 0.1), 'should use lighten(deepOrange[500], 0.1) as the primary light color');
|
118
|
+
assert.strictEqual(palette.primary.dark, darken(deepOrange[500], 0.15), 'should use darken(deepOrange[500], 0.1) as the primary dark color'); // secondary
|
119
|
+
|
120
|
+
assert.strictEqual(palette.secondary.main, green.A400, 'should use green.A400 as the secondary main color');
|
121
|
+
assert.strictEqual(palette.secondary.light, lighten(green.A400, 0.1), 'should use lighten(green.A400, 0.1) as the secondary light color');
|
122
|
+
assert.strictEqual(palette.secondary.dark, darken(green.A400, 0.15), 'should use darken(green.A400, 0.1) as the secondary dark color'); // error
|
123
|
+
|
124
|
+
assert.strictEqual(palette.error.main, red[500], 'should use red[500] as the error main color');
|
125
|
+
assert.strictEqual(palette.error.light, lighten(red[500], 0.1), 'should use lighten(red[500], 0.1) as the error light color');
|
126
|
+
assert.strictEqual(palette.error.dark, darken(red[500], 0.15), 'should use darken(red[500], 0.1) as the error dark color');
|
127
|
+
});
|
128
|
+
it('should calculate contrastText using the provided contrastThreshold', function () {
|
129
|
+
var palette = createPalette({
|
130
|
+
contrastThreshold: 7
|
131
|
+
});
|
132
|
+
assert.strictEqual(palette.primary.contrastText, '#FFFFFF', 'should use white as the default primary contrastText color');
|
133
|
+
assert.strictEqual(palette.secondary.contrastText, '#FFFFFF', 'should use white as the default secondary contrastText color');
|
134
|
+
});
|
135
|
+
it('should create a dark palette', function () {
|
136
|
+
var palette = createPalette({
|
137
|
+
type: 'dark'
|
138
|
+
});
|
139
|
+
assert.strictEqual(palette.primary.main, '#00ade9', 'should use indigo as the default primary color');
|
140
|
+
assert.strictEqual(palette.secondary.main, '#ffcf21', 'should use pink as the default secondary color');
|
141
|
+
assert.strictEqual(palette.text, dark.text, 'should use dark theme text');
|
142
|
+
assert.strictEqual(consoleErrorMock.callCount(), 0);
|
143
|
+
});
|
144
|
+
it('should throw an exception when an invalid type is specified', function () {
|
145
|
+
createPalette({
|
146
|
+
type: 'foo'
|
147
|
+
});
|
148
|
+
assert.strictEqual(consoleErrorMock.callCount(), 1);
|
149
|
+
assert.match(consoleErrorMock.args()[0][0], /Material-UI: the palette type `foo` is not supported/);
|
150
|
+
});
|
151
|
+
describe('augmentColor', function () {
|
152
|
+
it('should throw when the input is invalid', function () {
|
153
|
+
var palette = createPalette({});
|
154
|
+
assert.throws(function () {
|
155
|
+
palette.augmentColor({});
|
156
|
+
}, /The color object needs to have a/);
|
157
|
+
});
|
158
|
+
});
|
159
|
+
});
|
package/styles/createStyles.js
CHANGED