@hipay/hipay-material-ui 4.0.1-beta3 → 4.0.1-beta5
Sign up to get free protection for your applications and to get access to all the features.
- package/HiAccordion/HiAccordion.js +26 -8
- package/HiAccordion/index.js +5 -1
- package/HiAccordionActions/HiAccordionActions.js +14 -1
- package/HiAccordionActions/index.js +5 -1
- package/HiAccordionSummary/HiAccordionSummary.js +15 -1
- package/HiAccordionSummary/index.js +5 -1
- package/HiAlertModal/HiAlertModal.js +22 -7
- package/HiAlertModal/index.js +5 -1
- package/HiAppBar/HiAppBar.js +47 -15
- package/HiAppBar/index.js +2 -0
- package/HiAvatar/HiAvatar.js +12 -3
- package/HiAvatar/index.js +2 -0
- package/HiBadge/HiBadge.js +24 -8
- package/HiBadge/index.js +2 -0
- package/HiBreadcrumb/HiBreadcrumb.js +35 -10
- package/HiBreadcrumb/HiStep.js +50 -17
- package/HiBreadcrumb/HiStepConnector.js +55 -18
- package/HiBreadcrumb/HiStepContent.js +35 -10
- package/HiBreadcrumb/HiStepIcon.js +40 -14
- package/HiBreadcrumb/HiStepLabel.js +49 -18
- package/HiBreadcrumb/HiStepper.js +35 -10
- package/HiBreadcrumb/index.js +2 -0
- package/HiButton/HiButton.js +33 -8
- package/HiButton/index.js +5 -1
- package/HiCell/CellAddress.js +38 -16
- package/HiCell/CellDate.js +41 -14
- package/HiCell/CellHiddenContent.js +30 -8
- package/HiCell/CellIcon.js +41 -16
- package/HiCell/CellImage.js +39 -16
- package/HiCell/CellNumeric.js +45 -17
- package/HiCell/CellPinToAction.js +38 -13
- package/HiCell/CellRate.js +52 -17
- package/HiCell/CellSentinel.js +38 -16
- package/HiCell/CellSentinelScore.js +36 -13
- package/HiCell/CellText.js +58 -21
- package/HiCell/CellTextStyled.js +24 -13
- package/HiCell/index.js +10 -0
- package/HiCheckbox/HiCheckbox.js +57 -19
- package/HiCheckbox/index.js +2 -0
- package/HiChip/HiChip.js +47 -24
- package/HiChip/HiChipSwitch.js +65 -21
- package/HiChip/index.js +3 -0
- package/HiColoredLabel/HiColoredLabel.js +49 -15
- package/HiColoredLabel/index.js +2 -0
- package/HiDatePicker/Caption.js +21 -9
- package/HiDatePicker/HiDatePicker.js +93 -20
- package/HiDatePicker/HiDatePickerMobile.js +48 -22
- package/HiDatePicker/HiDateRangePicker.js +139 -42
- package/HiDatePicker/HiDateRangeSelector.js +135 -53
- package/HiDatePicker/ListPicker.js +43 -12
- package/HiDatePicker/NavBar.js +31 -12
- package/HiDatePicker/Overlays/CustomOverlayLayout.js +28 -11
- package/HiDatePicker/Overlays/CustomOverlayLayoutWithoutFooter.js +28 -11
- package/HiDatePicker/Overlays/MonthPickerOverlay.js +32 -9
- package/HiDatePicker/Overlays/Overlay.js +25 -8
- package/HiDatePicker/Overlays/TimePickerOverlay.js +45 -13
- package/HiDatePicker/Overlays/YearPickerOverlay.js +38 -13
- package/HiDatePicker/Overlays/index.js +6 -0
- package/HiDatePicker/Weekday.js +9 -4
- package/HiDatePicker/hiLocaleUtils.js +20 -8
- package/HiDatePicker/index.js +2 -0
- package/HiDatePicker/stylesheet.js +13 -6
- package/HiDialog/HiDialog.js +19 -7
- package/HiDialog/index.js +2 -0
- package/HiDotsStepper/HiDot.js +42 -12
- package/HiDotsStepper/HiDotsStepper.js +43 -15
- package/HiDotsStepper/index.js +3 -0
- package/HiExpansionPanel/HiExpansionPanel.js +38 -16
- package/HiExpansionPanel/index.js +5 -1
- package/HiForm/HiAddressField.js +41 -14
- package/HiForm/HiEmailField.js +34 -9
- package/HiForm/HiFormControl.js +79 -32
- package/HiForm/HiFormLabel.js +45 -18
- package/HiForm/HiInput.js +97 -37
- package/HiForm/HiPasswordField.js +43 -13
- package/HiForm/HiSearchField.js +40 -8
- package/HiForm/HiSlider.js +62 -26
- package/HiForm/HiTextField.js +52 -26
- package/HiForm/HiUpload.js +94 -33
- package/HiForm/HiUploadField.js +37 -14
- package/HiForm/HiUploadInput.js +81 -25
- package/HiForm/index.js +12 -0
- package/HiIcon/HiIcon.js +34 -9
- package/HiIcon/index.js +2 -0
- package/HiIconButton/HiIconButton.js +21 -6
- package/HiIconButton/index.js +2 -0
- package/HiListItemLink/HiListItemLink.js +19 -6
- package/HiListItemLink/index.js +2 -0
- package/HiLoader/HiLoader.js +16 -6
- package/HiLoader/index.js +2 -0
- package/HiNotice/HiKPI.js +53 -21
- package/HiNotice/HiKPINotice.js +16 -6
- package/HiNotice/index.js +3 -0
- package/HiPagination/HiPagination.js +11 -1
- package/HiPagination/index.js +2 -0
- package/HiPaymentMeans/HiPaymentMeans.js +72 -31
- package/HiPaymentMeans/index.js +2 -0
- package/HiPdfReader/HiPdfReader.js +61 -27
- package/HiPdfReader/index.js +2 -0
- package/HiPin/HiPin.js +19 -7
- package/HiPin/index.js +2 -0
- package/HiRadio/HiRadio.js +22 -11
- package/HiRadio/index.js +2 -0
- package/HiScrollStepper/HiScrollStepper.js +67 -29
- package/HiScrollStepper/index.js +2 -0
- package/HiSelect/HiDynamicSelect.js +47 -36
- package/HiSelect/HiDynamicSelectField.js +52 -27
- package/HiSelect/HiNestedSelect.js +116 -69
- package/HiSelect/HiNestedSelectContent.js +90 -63
- package/HiSelect/HiNestedSelectField.js +52 -27
- package/HiSelect/HiSelect.js +192 -93
- package/HiSelect/HiSelectContent.js +103 -67
- package/HiSelect/HiSelectField.js +53 -28
- package/HiSelect/HiSelectInput.js +81 -25
- package/HiSelect/HiSelectMobile.js +49 -11
- package/HiSelect/HiSuggestSelect.js +85 -28
- package/HiSelect/HiSuggestSelectField.js +43 -18
- package/HiSelect/index.js +14 -2
- package/HiSelectableList/HiSelectableList.js +95 -38
- package/HiSelectableList/HiSelectableListHierarchic.js +65 -38
- package/HiSelectableList/HiSelectableListItem.js +88 -45
- package/HiSelectableList/index.js +4 -0
- package/HiStepper/DefaultIndicator.js +10 -1
- package/HiStepper/HiStep.js +48 -18
- package/HiStepper/HiStepper.js +15 -2
- package/HiStepper/index.js +3 -0
- package/HiSwitch/HiSwitch.js +33 -9
- package/HiSwitch/HiSwitchState.js +32 -15
- package/HiSwitch/index.js +3 -0
- package/HiTable/HiCellBuilder.js +69 -13
- package/HiTable/HiTable.js +48 -20
- package/HiTable/HiTableBody.js +28 -10
- package/HiTable/HiTableHeader.js +55 -21
- package/HiTable/HiTableRow.js +51 -16
- package/HiTable/constants.js +98 -48
- package/HiTable/index.js +2 -0
- package/es/HiAccordion/HiAccordion.js +26 -8
- package/es/HiAccordion/index.js +5 -1
- package/es/HiAccordionActions/HiAccordionActions.js +14 -1
- package/es/HiAccordionActions/index.js +5 -1
- package/es/HiAccordionSummary/HiAccordionSummary.js +15 -1
- package/es/HiAccordionSummary/index.js +5 -1
- package/es/HiAlertModal/HiAlertModal.js +22 -7
- package/es/HiAlertModal/index.js +5 -1
- package/es/HiAppBar/HiAppBar.js +47 -15
- package/es/HiAppBar/index.js +2 -0
- package/es/HiAvatar/HiAvatar.js +12 -3
- package/es/HiAvatar/index.js +2 -0
- package/es/HiBadge/HiBadge.js +24 -8
- package/es/HiBadge/index.js +2 -0
- package/es/HiBreadcrumb/HiBreadcrumb.js +35 -10
- package/es/HiBreadcrumb/HiStep.js +50 -17
- package/es/HiBreadcrumb/HiStepConnector.js +55 -18
- package/es/HiBreadcrumb/HiStepContent.js +35 -10
- package/es/HiBreadcrumb/HiStepIcon.js +40 -14
- package/es/HiBreadcrumb/HiStepLabel.js +49 -18
- package/es/HiBreadcrumb/HiStepper.js +35 -10
- package/es/HiBreadcrumb/index.js +2 -0
- package/es/HiButton/HiButton.js +33 -8
- package/es/HiButton/index.js +5 -1
- package/es/HiCell/CellAddress.js +38 -16
- package/es/HiCell/CellDate.js +41 -14
- package/es/HiCell/CellHiddenContent.js +30 -8
- package/es/HiCell/CellIcon.js +41 -16
- package/es/HiCell/CellImage.js +39 -16
- package/es/HiCell/CellNumeric.js +45 -17
- package/es/HiCell/CellPinToAction.js +38 -13
- package/es/HiCell/CellRate.js +52 -17
- package/es/HiCell/CellSentinel.js +38 -16
- package/es/HiCell/CellSentinelScore.js +36 -13
- package/es/HiCell/CellText.js +58 -21
- package/es/HiCell/CellTextStyled.js +24 -13
- package/es/HiCell/index.js +10 -0
- package/es/HiCheckbox/HiCheckbox.js +57 -19
- package/es/HiCheckbox/index.js +2 -0
- package/es/HiChip/HiChip.js +47 -24
- package/es/HiChip/HiChipSwitch.js +65 -21
- package/es/HiChip/index.js +3 -0
- package/es/HiColoredLabel/HiColoredLabel.js +49 -15
- package/es/HiColoredLabel/index.js +2 -0
- package/es/HiDatePicker/Caption.js +21 -9
- package/es/HiDatePicker/HiDatePicker.js +93 -20
- package/es/HiDatePicker/HiDatePickerMobile.js +48 -22
- package/es/HiDatePicker/HiDateRangePicker.js +139 -42
- package/es/HiDatePicker/HiDateRangeSelector.js +135 -53
- package/es/HiDatePicker/ListPicker.js +43 -12
- package/es/HiDatePicker/NavBar.js +31 -12
- package/es/HiDatePicker/Overlays/CustomOverlayLayout.js +28 -11
- package/es/HiDatePicker/Overlays/CustomOverlayLayoutWithoutFooter.js +28 -11
- package/es/HiDatePicker/Overlays/MonthPickerOverlay.js +32 -9
- package/es/HiDatePicker/Overlays/Overlay.js +25 -8
- package/es/HiDatePicker/Overlays/TimePickerOverlay.js +45 -13
- package/es/HiDatePicker/Overlays/YearPickerOverlay.js +38 -13
- package/es/HiDatePicker/Overlays/index.js +6 -0
- package/es/HiDatePicker/Weekday.js +9 -4
- package/es/HiDatePicker/hiLocaleUtils.js +20 -8
- package/es/HiDatePicker/index.js +2 -0
- package/es/HiDatePicker/stylesheet.js +13 -6
- package/es/HiDialog/HiDialog.js +19 -7
- package/es/HiDialog/index.js +2 -0
- package/es/HiDotsStepper/HiDot.js +42 -12
- package/es/HiDotsStepper/HiDotsStepper.js +43 -15
- package/es/HiDotsStepper/index.js +3 -0
- package/es/HiExpansionPanel/HiExpansionPanel.js +38 -16
- package/es/HiExpansionPanel/index.js +5 -1
- package/es/HiForm/HiAddressField.js +41 -14
- package/es/HiForm/HiEmailField.js +34 -9
- package/es/HiForm/HiFormControl.js +79 -32
- package/es/HiForm/HiFormLabel.js +45 -18
- package/es/HiForm/HiInput.js +97 -37
- package/es/HiForm/HiPasswordField.js +43 -13
- package/es/HiForm/HiSearchField.js +40 -8
- package/es/HiForm/HiSlider.js +62 -26
- package/es/HiForm/HiTextField.js +52 -26
- package/es/HiForm/HiUpload.js +94 -33
- package/es/HiForm/HiUploadField.js +37 -14
- package/es/HiForm/HiUploadInput.js +81 -25
- package/es/HiForm/index.js +12 -0
- package/es/HiIcon/HiIcon.js +34 -9
- package/es/HiIcon/index.js +2 -0
- package/es/HiIconButton/HiIconButton.js +21 -6
- package/es/HiIconButton/index.js +2 -0
- package/es/HiListItemLink/HiListItemLink.js +19 -6
- package/es/HiListItemLink/index.js +2 -0
- package/es/HiLoader/HiLoader.js +16 -6
- package/es/HiLoader/index.js +2 -0
- package/es/HiNotice/HiKPI.js +53 -21
- package/es/HiNotice/HiKPINotice.js +16 -6
- package/es/HiNotice/index.js +3 -0
- package/es/HiPagination/HiPagination.js +11 -1
- package/es/HiPagination/index.js +2 -0
- package/es/HiPaymentMeans/HiPaymentMeans.js +72 -31
- package/es/HiPaymentMeans/index.js +2 -0
- package/es/HiPdfReader/HiPdfReader.js +61 -27
- package/es/HiPdfReader/index.js +2 -0
- package/es/HiPin/HiPin.js +19 -7
- package/es/HiPin/index.js +2 -0
- package/es/HiRadio/HiRadio.js +22 -11
- package/es/HiRadio/index.js +2 -0
- package/es/HiScrollStepper/HiScrollStepper.js +67 -29
- package/es/HiScrollStepper/index.js +2 -0
- package/es/HiSelect/HiDynamicSelect.js +47 -36
- package/es/HiSelect/HiDynamicSelectField.js +52 -27
- package/es/HiSelect/HiNestedSelect.js +116 -69
- package/es/HiSelect/HiNestedSelectContent.js +90 -63
- package/es/HiSelect/HiNestedSelectField.js +52 -27
- package/es/HiSelect/HiSelect.js +192 -93
- package/es/HiSelect/HiSelectContent.js +103 -67
- package/es/HiSelect/HiSelectField.js +53 -28
- package/es/HiSelect/HiSelectInput.js +81 -25
- package/es/HiSelect/HiSelectMobile.js +49 -11
- package/es/HiSelect/HiSuggestSelect.js +85 -28
- package/es/HiSelect/HiSuggestSelectField.js +43 -18
- package/es/HiSelect/index.js +14 -2
- package/es/HiSelectableList/HiSelectableList.js +95 -38
- package/es/HiSelectableList/HiSelectableListHierarchic.js +65 -38
- package/es/HiSelectableList/HiSelectableListItem.js +88 -45
- package/es/HiSelectableList/index.js +4 -0
- package/es/HiStepper/DefaultIndicator.js +10 -1
- package/es/HiStepper/HiStep.js +48 -18
- package/es/HiStepper/HiStepper.js +15 -2
- package/es/HiStepper/index.js +3 -0
- package/es/HiSwitch/HiSwitch.js +33 -9
- package/es/HiSwitch/HiSwitchState.js +32 -15
- package/es/HiSwitch/index.js +3 -0
- package/es/HiTable/HiCellBuilder.js +69 -13
- package/es/HiTable/HiTable.js +48 -20
- package/es/HiTable/HiTableBody.js +28 -10
- package/es/HiTable/HiTableHeader.js +55 -21
- package/es/HiTable/HiTableRow.js +51 -16
- package/es/HiTable/constants.js +98 -48
- package/es/HiTable/index.js +2 -0
- package/es/hi-svg-icons/HiAccount.js +14 -4
- package/es/hi-svg-icons/HiActivity.js +14 -4
- package/es/hi-svg-icons/HiAll.js +18 -7
- package/es/hi-svg-icons/HiBilling.js +14 -4
- package/es/hi-svg-icons/HiBriefcaseRescue.js +14 -4
- package/es/hi-svg-icons/HiBusiness.js +14 -4
- package/es/hi-svg-icons/HiCatalog.js +14 -4
- package/es/hi-svg-icons/HiCustomer.js +14 -4
- package/es/hi-svg-icons/HiDownload.js +14 -4
- package/es/hi-svg-icons/HiFinance.js +14 -4
- package/es/hi-svg-icons/HiFinanceMenu.js +14 -4
- package/es/hi-svg-icons/HiHostedPaymentPage.js +14 -4
- package/es/hi-svg-icons/HiHostedPaymentPageMenu.js +14 -4
- package/es/hi-svg-icons/HiIntegration.js +14 -4
- package/es/hi-svg-icons/HiIntegrationMenu.js +14 -4
- package/es/hi-svg-icons/HiIntelligence.js +14 -4
- package/es/hi-svg-icons/HiIntelligenceMenu.js +14 -4
- package/es/hi-svg-icons/HiInvoice.js +14 -4
- package/es/hi-svg-icons/HiInvoiceMenu.js +14 -4
- package/es/hi-svg-icons/HiLogoRounded.js +17 -6
- package/es/hi-svg-icons/HiOrder.js +14 -4
- package/es/hi-svg-icons/HiPaymentOrder.js +14 -4
- package/es/hi-svg-icons/HiPermission.js +14 -4
- package/es/hi-svg-icons/HiPriceGrid.js +14 -4
- package/es/hi-svg-icons/HiPrivate.js +14 -4
- package/es/hi-svg-icons/HiRoute.js +14 -4
- package/es/hi-svg-icons/HiRouteMenu.js +14 -4
- package/es/hi-svg-icons/HiRouteSwitch.js +19 -7
- package/es/hi-svg-icons/HiRouteSwitchMenu.js +19 -7
- package/es/hi-svg-icons/HiSettlement.js +14 -4
- package/es/hi-svg-icons/HiSizeLarge.js +14 -4
- package/es/hi-svg-icons/HiSizeMedium.js +14 -4
- package/es/hi-svg-icons/HiSizeSmall.js +14 -4
- package/es/hi-svg-icons/HiStore.js +14 -4
- package/es/hi-svg-icons/HiStoreMenu.js +14 -4
- package/es/hi-svg-icons/HiTransaction.js +14 -4
- package/es/hi-svg-icons/HiTransactionMenu.js +14 -4
- package/es/hi-svg-icons/HiUser.js +14 -4
- package/es/hi-svg-icons/HiVendor.js +14 -4
- package/es/hi-svg-icons/HiWidget.js +14 -4
- package/es/hi-svg-icons/index.js +41 -0
- package/es/hi-svg-images/HiLogo.js +12 -4
- package/es/hi-svg-images/HiLogoWhite.js +12 -4
- package/es/hi-svg-images/index.js +3 -0
- package/es/setupTest.js +13 -2
- package/es/styleguide/Wrapper.js +6 -0
- package/es/styles/MuiThemeProvider.js +53 -18
- package/es/styles/colorManipulator.js +50 -15
- package/es/styles/createBreakpoints.js +29 -14
- package/es/styles/createGenerateClassName.js +24 -14
- package/es/styles/createMixins.js +10 -4
- package/es/styles/createMuiTheme.js +28 -11
- package/es/styles/createPalette.js +89 -66
- package/es/styles/createStyles.js +1 -0
- package/es/styles/createTypography.js +24 -15
- package/es/styles/getStylesCreator.js +14 -2
- package/es/styles/getThemeProps.js +7 -2
- package/es/styles/index.js +6 -0
- package/es/styles/jssPreset.js +11 -1
- package/es/styles/makeStyles.js +9 -2
- package/es/styles/mergeClasses.js +16 -5
- package/es/styles/shadows.js +4 -1
- package/es/styles/shape.js +2 -1
- package/es/styles/spacing.js +4 -1
- package/es/styles/themeListener.js +10 -2
- package/es/styles/transitions.js +35 -20
- package/es/styles/withStyles.js +9 -2
- package/es/styles/zIndex.js +2 -1
- package/es/test-utils/createMount.js +12 -2
- package/es/test-utils/createRender.js +9 -2
- package/es/test-utils/createShallow.js +17 -6
- package/es/test-utils/getClasses.js +4 -1
- package/es/test-utils/index.js +6 -0
- package/es/test-utils/until.js +14 -3
- package/es/test-utils/unwrap.js +1 -0
- package/es/theme/palette.js +7 -2
- package/es/theme/typography.js +15 -7
- package/es/theme.js +8 -2
- package/es/transitions/utils.js +7 -3
- package/es/utils/exactProp.js +13 -3
- package/es/utils/helpers.js +58 -19
- package/es/withMobileDialog/index.js +2 -0
- package/es/withMobileDialog/withMobileDialog.js +12 -3
- package/hi-svg-icons/HiAccount.js +14 -4
- package/hi-svg-icons/HiActivity.js +14 -4
- package/hi-svg-icons/HiAll.js +18 -7
- package/hi-svg-icons/HiBilling.js +14 -4
- package/hi-svg-icons/HiBriefcaseRescue.js +14 -4
- package/hi-svg-icons/HiBusiness.js +14 -4
- package/hi-svg-icons/HiCatalog.js +14 -4
- package/hi-svg-icons/HiCustomer.js +14 -4
- package/hi-svg-icons/HiDownload.js +14 -4
- package/hi-svg-icons/HiFinance.js +14 -4
- package/hi-svg-icons/HiFinanceMenu.js +14 -4
- package/hi-svg-icons/HiHostedPaymentPage.js +14 -4
- package/hi-svg-icons/HiHostedPaymentPageMenu.js +14 -4
- package/hi-svg-icons/HiIntegration.js +14 -4
- package/hi-svg-icons/HiIntegrationMenu.js +14 -4
- package/hi-svg-icons/HiIntelligence.js +14 -4
- package/hi-svg-icons/HiIntelligenceMenu.js +14 -4
- package/hi-svg-icons/HiInvoice.js +14 -4
- package/hi-svg-icons/HiInvoiceMenu.js +14 -4
- package/hi-svg-icons/HiLogoRounded.js +17 -6
- package/hi-svg-icons/HiOrder.js +14 -4
- package/hi-svg-icons/HiPaymentOrder.js +14 -4
- package/hi-svg-icons/HiPermission.js +14 -4
- package/hi-svg-icons/HiPriceGrid.js +14 -4
- package/hi-svg-icons/HiPrivate.js +14 -4
- package/hi-svg-icons/HiRoute.js +14 -4
- package/hi-svg-icons/HiRouteMenu.js +14 -4
- package/hi-svg-icons/HiRouteSwitch.js +19 -7
- package/hi-svg-icons/HiRouteSwitchMenu.js +19 -7
- package/hi-svg-icons/HiSettlement.js +14 -4
- package/hi-svg-icons/HiSizeLarge.js +14 -4
- package/hi-svg-icons/HiSizeMedium.js +14 -4
- package/hi-svg-icons/HiSizeSmall.js +14 -4
- package/hi-svg-icons/HiStore.js +14 -4
- package/hi-svg-icons/HiStoreMenu.js +14 -4
- package/hi-svg-icons/HiTransaction.js +14 -4
- package/hi-svg-icons/HiTransactionMenu.js +14 -4
- package/hi-svg-icons/HiUser.js +14 -4
- package/hi-svg-icons/HiVendor.js +14 -4
- package/hi-svg-icons/HiWidget.js +14 -4
- package/hi-svg-icons/index.js +41 -0
- package/hi-svg-images/HiLogo.js +12 -4
- package/hi-svg-images/HiLogoWhite.js +12 -4
- package/hi-svg-images/index.js +3 -0
- package/package.json +1 -1
- package/setupTest.js +13 -2
- package/styleguide/Wrapper.js +6 -0
- package/styles/MuiThemeProvider.js +53 -18
- package/styles/colorManipulator.js +50 -15
- package/styles/createBreakpoints.js +29 -14
- package/styles/createGenerateClassName.js +24 -14
- package/styles/createMixins.js +10 -4
- package/styles/createMuiTheme.js +28 -11
- package/styles/createPalette.js +89 -66
- package/styles/createStyles.js +1 -0
- package/styles/createTypography.js +24 -15
- package/styles/getStylesCreator.js +14 -2
- package/styles/getThemeProps.js +7 -2
- package/styles/index.js +6 -0
- package/styles/jssPreset.js +11 -1
- package/styles/makeStyles.js +9 -2
- package/styles/mergeClasses.js +16 -5
- package/styles/shadows.js +4 -1
- package/styles/shape.js +2 -1
- package/styles/spacing.js +4 -1
- package/styles/themeListener.js +10 -2
- package/styles/transitions.js +35 -20
- package/styles/withStyles.js +9 -2
- package/styles/zIndex.js +2 -1
- package/test-utils/createMount.js +12 -2
- package/test-utils/createRender.js +9 -2
- package/test-utils/createShallow.js +17 -6
- package/test-utils/getClasses.js +4 -1
- package/test-utils/index.js +6 -0
- package/test-utils/until.js +14 -3
- package/test-utils/unwrap.js +1 -0
- package/theme/palette.js +7 -2
- package/theme/typography.js +15 -7
- package/theme.js +8 -2
- package/transitions/utils.js +7 -3
- package/utils/exactProp.js +13 -3
- package/utils/helpers.js +58 -19
- package/withMobileDialog/index.js +2 -0
- package/withMobileDialog/withMobileDialog.js +12 -3
package/HiForm/HiSlider.js
CHANGED
@@ -1,25 +1,41 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
5
6
|
value: true
|
6
7
|
});
|
7
8
|
exports.styles = exports.default = void 0;
|
9
|
+
|
8
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
11
|
+
|
9
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));
|
13
|
+
|
10
14
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));
|
15
|
+
|
16
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));
|
17
|
+
|
11
18
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));
|
19
|
+
|
12
20
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));
|
13
|
-
|
21
|
+
|
14
22
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
23
|
+
|
15
24
|
var _react = _interopRequireDefault(require("react"));
|
25
|
+
|
16
26
|
var _withStyles = _interopRequireDefault(require("@mui/styles/withStyles"));
|
27
|
+
|
17
28
|
var _HiFormControl = _interopRequireDefault(require("./HiFormControl"));
|
29
|
+
|
18
30
|
var _HiIcon = _interopRequireDefault(require("../HiIcon/HiIcon"));
|
31
|
+
|
19
32
|
var _classnames = _interopRequireDefault(require("classnames"));
|
20
|
-
|
21
|
-
function
|
22
|
-
|
33
|
+
|
34
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
35
|
+
|
36
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
37
|
+
|
38
|
+
var styles = function styles(theme) {
|
23
39
|
return {
|
24
40
|
barContainer: {
|
25
41
|
width: '100%',
|
@@ -95,20 +111,30 @@ var styles = exports.styles = function styles(theme) {
|
|
95
111
|
}
|
96
112
|
};
|
97
113
|
};
|
98
|
-
|
99
114
|
/**
|
100
115
|
* HiSlider component
|
101
116
|
*/
|
117
|
+
|
118
|
+
|
119
|
+
exports.styles = styles;
|
120
|
+
|
102
121
|
var HiSlider = /*#__PURE__*/function (_React$Component) {
|
103
122
|
(0, _inherits2.default)(HiSlider, _React$Component);
|
123
|
+
|
124
|
+
var _super = _createSuper(HiSlider);
|
125
|
+
|
104
126
|
function HiSlider(props) {
|
105
127
|
var _this;
|
128
|
+
|
106
129
|
(0, _classCallCheck2.default)(this, HiSlider);
|
107
|
-
_this =
|
130
|
+
_this = _super.call(this, props);
|
131
|
+
|
108
132
|
_this.handleChange = function (event) {
|
109
133
|
_this.props.onChange(parseFloat(event.target.value));
|
134
|
+
|
110
135
|
_this.textValueWidth = _this.textValue.offsetWidth;
|
111
136
|
};
|
137
|
+
|
112
138
|
_this.handleFocus = function (isFocused) {
|
113
139
|
return function () {
|
114
140
|
_this.setState({
|
@@ -116,17 +142,19 @@ var HiSlider = /*#__PURE__*/function (_React$Component) {
|
|
116
142
|
});
|
117
143
|
};
|
118
144
|
};
|
145
|
+
|
119
146
|
_this.state = {
|
120
147
|
focused: false
|
121
148
|
};
|
122
149
|
return _this;
|
123
150
|
}
|
124
|
-
|
125
151
|
/**
|
126
152
|
* Measures several components once they are mounted.
|
127
153
|
* If the value and a label (left or right) are hovered,
|
128
154
|
* we hide this label.
|
129
155
|
*/
|
156
|
+
|
157
|
+
|
130
158
|
(0, _createClass2.default)(HiSlider, [{
|
131
159
|
key: "componentDidMount",
|
132
160
|
value: function componentDidMount() {
|
@@ -134,17 +162,19 @@ var HiSlider = /*#__PURE__*/function (_React$Component) {
|
|
134
162
|
this.rightLabelWidth = this.rightLabel.offsetWidth;
|
135
163
|
this.textValueWidth = this.textValue.offsetWidth;
|
136
164
|
this.barContainerWidth = this.barContainer.offsetWidth;
|
165
|
+
|
137
166
|
var _this$getHovering = this.getHovering(),
|
138
|
-
|
139
|
-
|
167
|
+
hoveringLeft = _this$getHovering.hoveringLeft,
|
168
|
+
hoveringRight = _this$getHovering.hoveringRight;
|
169
|
+
|
140
170
|
if (hoveringLeft || hoveringRight) {
|
141
171
|
this.forceUpdate();
|
142
172
|
}
|
143
173
|
}
|
144
|
-
|
145
174
|
/**
|
146
175
|
* Calculates if the labels are hovered.
|
147
176
|
*/
|
177
|
+
|
148
178
|
}, {
|
149
179
|
key: "getHovering",
|
150
180
|
value: function getHovering() {
|
@@ -160,25 +190,28 @@ var HiSlider = /*#__PURE__*/function (_React$Component) {
|
|
160
190
|
key: "render",
|
161
191
|
value: function render() {
|
162
192
|
var _this2 = this;
|
193
|
+
|
163
194
|
var _this$props = this.props,
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
195
|
+
classes = _this$props.classes,
|
196
|
+
className = _this$props.className,
|
197
|
+
min = _this$props.min,
|
198
|
+
max = _this$props.max,
|
199
|
+
leftLabel = _this$props.leftLabel,
|
200
|
+
rightLabel = _this$props.rightLabel,
|
201
|
+
step = _this$props.step,
|
202
|
+
suffix = _this$props.suffix,
|
203
|
+
id = _this$props.id,
|
204
|
+
label = _this$props.label,
|
205
|
+
value = _this$props.value,
|
206
|
+
theme = _this$props.theme;
|
176
207
|
var focused = this.state.focused;
|
177
208
|
var ratio = (value - min) / (max - min);
|
178
209
|
var percentage = ratio * 100;
|
210
|
+
|
179
211
|
var _this$getHovering2 = this.getHovering(),
|
180
|
-
|
181
|
-
|
212
|
+
hoveringLeft = _this$getHovering2.hoveringLeft,
|
213
|
+
hoveringRight = _this$getHovering2.hoveringRight;
|
214
|
+
|
182
215
|
var barColor = focused ? theme.palette.primary.dark : theme.palette.primary.main;
|
183
216
|
return (
|
184
217
|
/*#__PURE__*/
|
@@ -245,8 +278,11 @@ var HiSlider = /*#__PURE__*/function (_React$Component) {
|
|
245
278
|
}]);
|
246
279
|
return HiSlider;
|
247
280
|
}(_react.default.Component);
|
248
|
-
|
281
|
+
|
282
|
+
var _default = (0, _withStyles.default)(styles, {
|
249
283
|
hiComponent: true,
|
250
284
|
name: 'HiSlider',
|
251
285
|
withTheme: true
|
252
|
-
})(HiSlider);
|
286
|
+
})(HiSlider);
|
287
|
+
|
288
|
+
exports.default = _default;
|
package/HiForm/HiTextField.js
CHANGED
@@ -1,34 +1,54 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
5
6
|
value: true
|
6
7
|
});
|
7
8
|
exports.default = void 0;
|
9
|
+
|
8
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends"));
|
11
|
+
|
9
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));
|
13
|
+
|
10
14
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));
|
11
|
-
|
12
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));
|
15
|
+
|
13
16
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/assertThisInitialized"));
|
17
|
+
|
14
18
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));
|
19
|
+
|
20
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));
|
21
|
+
|
22
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));
|
23
|
+
|
15
24
|
var _react = _interopRequireDefault(require("react"));
|
25
|
+
|
16
26
|
var _HiFormControl = _interopRequireDefault(require("./HiFormControl"));
|
27
|
+
|
17
28
|
var _HiInput = _interopRequireDefault(require("./HiInput"));
|
18
|
-
|
19
|
-
function
|
29
|
+
|
30
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
31
|
+
|
32
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
33
|
+
|
20
34
|
/**
|
21
35
|
* Champs input pour formulaire
|
22
36
|
*/
|
23
37
|
var HiTextField = /*#__PURE__*/function (_React$PureComponent) {
|
24
38
|
(0, _inherits2.default)(HiTextField, _React$PureComponent);
|
39
|
+
|
40
|
+
var _super = _createSuper(HiTextField);
|
41
|
+
|
25
42
|
function HiTextField(props) {
|
26
43
|
var _this;
|
44
|
+
|
27
45
|
(0, _classCallCheck2.default)(this, HiTextField);
|
28
|
-
_this =
|
46
|
+
_this = _super.call(this, props);
|
47
|
+
|
29
48
|
_this.focus = function () {
|
30
49
|
_this.input.focus();
|
31
50
|
};
|
51
|
+
|
32
52
|
_this.state = {
|
33
53
|
nbChars: props.value ? props.value.length : 0
|
34
54
|
};
|
@@ -37,6 +57,7 @@ var HiTextField = /*#__PURE__*/function (_React$PureComponent) {
|
|
37
57
|
_this.handleFocus = _this.handleFocus.bind((0, _assertThisInitialized2.default)(_this));
|
38
58
|
return _this;
|
39
59
|
}
|
60
|
+
|
40
61
|
(0, _createClass2.default)(HiTextField, [{
|
41
62
|
key: "handleBlur",
|
42
63
|
value: function handleBlur(event) {
|
@@ -48,10 +69,12 @@ var HiTextField = /*#__PURE__*/function (_React$PureComponent) {
|
|
48
69
|
key: "handleChange",
|
49
70
|
value: function handleChange(event) {
|
50
71
|
var value = event.target.value;
|
72
|
+
|
51
73
|
if (value.length <= this.props.maxLength) {
|
52
74
|
if (this.props.onChange) {
|
53
75
|
this.props.onChange(event);
|
54
76
|
}
|
77
|
+
|
55
78
|
if (this.props.multiline === true) {
|
56
79
|
this.setState({
|
57
80
|
nbChars: value.length
|
@@ -70,27 +93,28 @@ var HiTextField = /*#__PURE__*/function (_React$PureComponent) {
|
|
70
93
|
key: "render",
|
71
94
|
value: function render() {
|
72
95
|
var _this2 = this;
|
96
|
+
|
73
97
|
var _this$props = this.props,
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
98
|
+
className = _this$props.className,
|
99
|
+
disabled = _this$props.disabled,
|
100
|
+
error = _this$props.error,
|
101
|
+
errorText = _this$props.errorText,
|
102
|
+
id = _this$props.id,
|
103
|
+
label = _this$props.label,
|
104
|
+
helperText = _this$props.helperText,
|
105
|
+
helperIcon = _this$props.helperIcon,
|
106
|
+
fullWidth = _this$props.fullWidth,
|
107
|
+
required = _this$props.required,
|
108
|
+
type = _this$props.type,
|
109
|
+
multiline = _this$props.multiline,
|
110
|
+
placeholder = _this$props.placeholder,
|
111
|
+
value = _this$props.value,
|
112
|
+
HiInputProps = _this$props.HiInputProps,
|
113
|
+
HiInputLabelProps = _this$props.HiInputLabelProps,
|
114
|
+
name = _this$props.name,
|
115
|
+
rows = _this$props.rows,
|
116
|
+
maxLength = _this$props.maxLength,
|
117
|
+
customRef = _this$props.customRef;
|
94
118
|
var nbChars = this.state.nbChars;
|
95
119
|
return /*#__PURE__*/_react.default.createElement(_HiFormControl.default, {
|
96
120
|
label: label,
|
@@ -132,6 +156,7 @@ var HiTextField = /*#__PURE__*/function (_React$PureComponent) {
|
|
132
156
|
}]);
|
133
157
|
return HiTextField;
|
134
158
|
}(_react.default.PureComponent);
|
159
|
+
|
135
160
|
HiTextField.defaultProps = {
|
136
161
|
name: '',
|
137
162
|
type: 'text',
|
@@ -145,4 +170,5 @@ HiTextField.defaultProps = {
|
|
145
170
|
multiline: false,
|
146
171
|
maxLength: 280
|
147
172
|
};
|
148
|
-
var _default =
|
173
|
+
var _default = HiTextField;
|
174
|
+
exports.default = _default;
|
package/HiForm/HiUpload.js
CHANGED
@@ -1,27 +1,45 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
5
6
|
value: true
|
6
7
|
});
|
7
8
|
exports.styles = exports.default = void 0;
|
9
|
+
|
8
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
11
|
+
|
9
12
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
13
|
+
|
10
14
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends"));
|
15
|
+
|
11
16
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));
|
17
|
+
|
12
18
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));
|
19
|
+
|
20
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));
|
21
|
+
|
13
22
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));
|
23
|
+
|
14
24
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));
|
15
|
-
|
25
|
+
|
16
26
|
var _react = _interopRequireDefault(require("react"));
|
27
|
+
|
17
28
|
var _classnames = _interopRequireDefault(require("classnames"));
|
29
|
+
|
18
30
|
var _index = _interopRequireDefault(require("keycode/index"));
|
31
|
+
|
19
32
|
var _withStyles = _interopRequireDefault(require("@mui/styles/withStyles"));
|
33
|
+
|
20
34
|
var _HiUploadInput = _interopRequireDefault(require("./HiUploadInput"));
|
35
|
+
|
21
36
|
var _HiIcon = _interopRequireDefault(require("../HiIcon"));
|
22
|
-
|
23
|
-
function
|
24
|
-
|
37
|
+
|
38
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
39
|
+
|
40
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
41
|
+
|
42
|
+
var styles = function styles(theme) {
|
25
43
|
return {
|
26
44
|
flexContainer: {
|
27
45
|
display: 'flex',
|
@@ -69,23 +87,34 @@ var styles = exports.styles = function styles(theme) {
|
|
69
87
|
focusable: {}
|
70
88
|
};
|
71
89
|
};
|
90
|
+
|
91
|
+
exports.styles = styles;
|
92
|
+
|
72
93
|
var HiUpload = /*#__PURE__*/function (_React$PureComponent) {
|
73
94
|
(0, _inherits2.default)(HiUpload, _React$PureComponent);
|
95
|
+
|
96
|
+
var _super = _createSuper(HiUpload);
|
97
|
+
|
74
98
|
function HiUpload() {
|
75
99
|
var _this;
|
100
|
+
|
76
101
|
(0, _classCallCheck2.default)(this, HiUpload);
|
77
|
-
_this =
|
78
|
-
|
102
|
+
_this = _super.call(this);
|
103
|
+
|
79
104
|
_this.handleDrop = function (event) {
|
80
105
|
if (event.path[0].id === _this.uploadIconRef.props.id) {
|
81
106
|
event.preventDefault();
|
82
107
|
event.stopPropagation();
|
108
|
+
|
83
109
|
if (_this.state.droppable) {
|
84
110
|
var index = _this.getNextInputIndex();
|
111
|
+
|
85
112
|
var param = _this.handleFile(event.dataTransfer.files, index);
|
113
|
+
|
86
114
|
_this.setState({
|
87
115
|
dragOver: false
|
88
116
|
});
|
117
|
+
|
89
118
|
_this.props.onChange(param, 0);
|
90
119
|
} else {
|
91
120
|
_this.setState({
|
@@ -94,17 +123,20 @@ var HiUpload = /*#__PURE__*/function (_React$PureComponent) {
|
|
94
123
|
}
|
95
124
|
}
|
96
125
|
};
|
97
|
-
|
126
|
+
|
98
127
|
_this.handleDragEnter = function (event) {
|
99
128
|
event.preventDefault();
|
100
129
|
event.stopPropagation();
|
130
|
+
|
101
131
|
if (event.path[0].id === _this.uploadIconRef.props.id) {
|
102
132
|
if (event.dataTransfer.items.length !== 1) {
|
103
133
|
event.dataTransfer.dropEffect = 'none';
|
134
|
+
|
104
135
|
_this.props.onChange({
|
105
136
|
errorMessage: _this.props.translations.errorDragEnter,
|
106
137
|
value: null
|
107
138
|
}, 0);
|
139
|
+
|
108
140
|
_this.setState({
|
109
141
|
dragOver: true
|
110
142
|
});
|
@@ -116,47 +148,59 @@ var HiUpload = /*#__PURE__*/function (_React$PureComponent) {
|
|
116
148
|
}
|
117
149
|
}
|
118
150
|
};
|
119
|
-
|
151
|
+
|
120
152
|
_this.handleDragLeave = function (event) {
|
121
153
|
event.preventDefault();
|
122
154
|
event.stopPropagation();
|
155
|
+
|
123
156
|
if (event.path[0].id === _this.uploadIconRef.props.id && event.relatedTarget.parentElement !== _this.uploadFieldRef) {
|
124
157
|
_this.props.onChange({
|
125
158
|
errorMessage: '',
|
126
159
|
value: null
|
127
160
|
}, 0);
|
161
|
+
|
128
162
|
_this.setState({
|
129
163
|
droppable: false,
|
130
164
|
dragOver: false
|
131
165
|
});
|
132
166
|
}
|
133
167
|
};
|
168
|
+
|
134
169
|
_this.handleChange = function (event) {
|
135
170
|
var index = _this.getNextInputIndex();
|
171
|
+
|
136
172
|
var param = _this.handleFile(event.target.files, index);
|
173
|
+
|
137
174
|
_this.props.onChange(param, index);
|
138
175
|
};
|
176
|
+
|
139
177
|
_this.handleEmptyField = function (event) {
|
140
178
|
event.target.value = '';
|
141
179
|
};
|
180
|
+
|
142
181
|
_this.handleKeyPress = function (event) {
|
143
182
|
var key = (0, _index.default)(event);
|
183
|
+
|
144
184
|
if (key === 'enter' || key === 'space') {
|
145
185
|
event.preventDefault();
|
186
|
+
|
146
187
|
_this.uploadInput.click();
|
147
188
|
}
|
148
189
|
};
|
149
|
-
|
190
|
+
|
150
191
|
_this.handleFile = function (files, index) {
|
151
192
|
var error = false;
|
152
193
|
var errorMessage = '';
|
153
194
|
var file = null;
|
195
|
+
|
154
196
|
if (files.length === 1) {
|
155
197
|
file = files[0];
|
198
|
+
|
156
199
|
if (_this.props.inputs[index] && file.size > _this.props.inputs[index].maxSize) {
|
157
200
|
errorMessage += _this.props.translations.errorSize.replace('maxSize', _this.props.inputs[index].maxSize / 1000000);
|
158
201
|
error = true;
|
159
202
|
}
|
203
|
+
|
160
204
|
if (_this.props.inputs[index] && _this.props.inputs[index].acceptedTypes && _this.props.inputs[index].acceptedTypes.length !== 0 && _this.props.inputs[index].acceptedTypes.indexOf(file.type) === -1) {
|
161
205
|
errorMessage += _this.props.translations.errorType;
|
162
206
|
error = true;
|
@@ -164,23 +208,26 @@ var HiUpload = /*#__PURE__*/function (_React$PureComponent) {
|
|
164
208
|
} else {
|
165
209
|
errorMessage = _this.props.translations.errorDropMultiple;
|
166
210
|
}
|
211
|
+
|
167
212
|
return {
|
168
213
|
errorMessage: errorMessage,
|
169
214
|
error: error,
|
170
215
|
value: file
|
171
216
|
};
|
172
217
|
};
|
218
|
+
|
173
219
|
_this.createInputs = function (others) {
|
174
220
|
var _this$props = _this.props,
|
175
|
-
|
176
|
-
|
177
|
-
var files = inputs;
|
221
|
+
inputs = _this$props.inputs,
|
222
|
+
values = _this$props.values;
|
223
|
+
var files = inputs; // unlimited number of files
|
178
224
|
|
179
|
-
// unlimited number of files
|
180
225
|
if (inputs.length === 0) {
|
181
226
|
files = values;
|
182
227
|
}
|
228
|
+
|
183
229
|
var inputComponents = [];
|
230
|
+
|
184
231
|
for (var i = 0; i < files.length; i += 1) {
|
185
232
|
if (files.length > 1 || values[i] && values[i].value) {
|
186
233
|
inputComponents.push( /*#__PURE__*/_react.default.createElement(_HiUploadInput.default, (0, _extends2.default)({
|
@@ -198,17 +245,19 @@ var HiUpload = /*#__PURE__*/function (_React$PureComponent) {
|
|
198
245
|
}, others)));
|
199
246
|
}
|
200
247
|
}
|
248
|
+
|
201
249
|
return inputComponents;
|
202
250
|
};
|
251
|
+
|
203
252
|
_this.uploadFieldRef = void 0;
|
204
253
|
_this.state = {
|
205
254
|
dragOver: false,
|
206
255
|
droppable: false
|
207
256
|
};
|
208
257
|
return _this;
|
209
|
-
}
|
258
|
+
} // When component mounts, we add eventListeners to handle the file drag and drop
|
259
|
+
|
210
260
|
|
211
|
-
// When component mounts, we add eventListeners to handle the file drag and drop
|
212
261
|
(0, _createClass2.default)(HiUpload, [{
|
213
262
|
key: "componentDidMount",
|
214
263
|
value: function componentDidMount() {
|
@@ -232,9 +281,8 @@ var HiUpload = /*#__PURE__*/function (_React$PureComponent) {
|
|
232
281
|
}, {
|
233
282
|
key: "getNextInputIndex",
|
234
283
|
value: function getNextInputIndex() {
|
235
|
-
var index = 0;
|
284
|
+
var index = 0; // Add an input at the end
|
236
285
|
|
237
|
-
// Add an input at the end
|
238
286
|
if (!this.props.inputs.length) {
|
239
287
|
index = this.props.values.length + 1;
|
240
288
|
} else {
|
@@ -246,27 +294,31 @@ var HiUpload = /*#__PURE__*/function (_React$PureComponent) {
|
|
246
294
|
}
|
247
295
|
}
|
248
296
|
}
|
297
|
+
|
249
298
|
return index;
|
250
|
-
}
|
299
|
+
} // Action when files are dropped on the field
|
300
|
+
|
251
301
|
}, {
|
252
302
|
key: "render",
|
253
303
|
value: function render() {
|
254
|
-
var
|
304
|
+
var _classNames,
|
305
|
+
_classNames2,
|
306
|
+
_this2 = this;
|
307
|
+
|
255
308
|
var _this$props2 = this.props,
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
309
|
+
id = _this$props2.id,
|
310
|
+
inputs = _this$props2.inputs,
|
311
|
+
classes = _this$props2.classes,
|
312
|
+
values = _this$props2.values,
|
313
|
+
focused = _this$props2.focused,
|
314
|
+
others = (0, _objectWithoutProperties2.default)(_this$props2, ["id", "inputs", "classes", "values", "focused"]);
|
262
315
|
var _this$state = this.state,
|
263
|
-
|
264
|
-
|
316
|
+
dragOver = _this$state.dragOver,
|
317
|
+
droppable = _this$state.droppable;
|
265
318
|
var complete = true;
|
266
319
|
var empty = true;
|
267
|
-
var error = false;
|
320
|
+
var error = false; // For unlimited inputs: always grey
|
268
321
|
|
269
|
-
// For unlimited inputs: always grey
|
270
322
|
if (!inputs.length) {
|
271
323
|
complete = false;
|
272
324
|
} else if (values.length === 0 || inputs.length > 0 && inputs.length !== values.length) {
|
@@ -274,6 +326,7 @@ var HiUpload = /*#__PURE__*/function (_React$PureComponent) {
|
|
274
326
|
} else {
|
275
327
|
for (var i = 0, len = values.length; i < len; i += 1) {
|
276
328
|
var value = values[i];
|
329
|
+
|
277
330
|
if (value !== undefined) {
|
278
331
|
complete = value.value === null || value.error ? false : complete;
|
279
332
|
empty = value.value !== null && !value.error ? false : empty;
|
@@ -283,8 +336,10 @@ var HiUpload = /*#__PURE__*/function (_React$PureComponent) {
|
|
283
336
|
}
|
284
337
|
}
|
285
338
|
}
|
286
|
-
|
339
|
+
|
340
|
+
var statusClass = (0, _classnames.default)(classes.statusIcon, (_classNames = {}, (0, _defineProperty2.default)(_classNames, classes.empty, empty), (0, _defineProperty2.default)(_classNames, classes.complete, complete), _classNames));
|
287
341
|
var icon;
|
342
|
+
|
288
343
|
if (error) {
|
289
344
|
icon = 'warning';
|
290
345
|
} else if (complete) {
|
@@ -292,11 +347,14 @@ var HiUpload = /*#__PURE__*/function (_React$PureComponent) {
|
|
292
347
|
} else {
|
293
348
|
icon = 'file_upload';
|
294
349
|
}
|
350
|
+
|
295
351
|
var focusable = true;
|
352
|
+
|
296
353
|
if (complete && values.length > 1) {
|
297
354
|
focusable = false;
|
298
355
|
}
|
299
|
-
|
356
|
+
|
357
|
+
var iconClass = (0, _classnames.default)(statusClass, classes.fileButton, (_classNames2 = {}, (0, _defineProperty2.default)(_classNames2, classes.dragOver, dragOver), (0, _defineProperty2.default)(_classNames2, classes.droppable, droppable), (0, _defineProperty2.default)(_classNames2, classes.focused, focused), (0, _defineProperty2.default)(_classNames2, classes.error, error && !focused), (0, _defineProperty2.default)(_classNames2, classes.focusable, focusable), _classNames2));
|
300
358
|
return /*#__PURE__*/_react.default.createElement("div", {
|
301
359
|
className: classes.flexContainer
|
302
360
|
}, /*#__PURE__*/_react.default.createElement("label", {
|
@@ -329,7 +387,10 @@ var HiUpload = /*#__PURE__*/function (_React$PureComponent) {
|
|
329
387
|
}]);
|
330
388
|
return HiUpload;
|
331
389
|
}(_react.default.PureComponent);
|
332
|
-
|
390
|
+
|
391
|
+
var _default = (0, _withStyles.default)(styles, {
|
333
392
|
hiComponent: true,
|
334
393
|
name: 'HmuiHiUpload'
|
335
|
-
})(HiUpload);
|
394
|
+
})(HiUpload);
|
395
|
+
|
396
|
+
exports.default = _default;
|