diginet-core-ui 1.3.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/avatar/default.svg +3 -0
- package/assets/images/menu/dhr/Default.svg +13 -0
- package/assets/images/menu/dhr/MHRM00N0001.svg +14 -0
- package/assets/images/menu/dhr/MHRM09N0001.svg +1 -0
- package/assets/images/menu/dhr/MHRM09N0002.svg +3 -0
- package/assets/images/menu/dhr/MHRM09N0003.svg +25 -0
- package/assets/images/menu/dhr/MHRM25N0001.svg +26 -0
- package/assets/images/menu/dhr/MHRM29N0001.svg +30 -0
- package/assets/images/menu/dhr/MHRM29N0015.svg +63 -0
- package/assets/images/menu/dhr/MHRM39N0012.svg +43 -0
- package/assets/images/menu/dhr/MHRM39N0013.svg +24 -0
- package/assets/images/menu/dhr/MHRM39N0014.svg +14 -0
- package/assets/images/menu/dhr/MHRM39N0015.svg +36 -0
- package/assets/images/menu/dhr/MHRM39N0016.svg +23 -0
- package/assets/images/menu/dhr/MHRM77N0001.svg +28 -0
- package/assets/images/menu/dhr/MHRM84N0001.svg +27 -0
- package/assets/images/menu/dhr/MHRM84N0002.svg +24 -0
- package/assets/images/menu/dhr/MHRM89N0001.svg +16 -0
- package/assets/images/menu/dhr/MHRP00N0001.svg +10 -0
- package/assets/images/menu/dhr/MHRP09N0001.svg +22 -0
- package/assets/images/menu/dhr/MHRP09N0002.svg +19 -0
- package/assets/images/menu/dhr/MHRP09N0003.svg +12 -0
- package/assets/images/menu/dhr/MHRP09N0004.svg +6 -0
- package/assets/images/menu/dhr/MHRP09N0005.svg +10 -0
- package/assets/images/menu/dhr/MHRP09N0006.svg +17 -0
- package/assets/images/menu/dhr/MHRP09N0007.svg +15 -0
- package/assets/images/menu/dhr/MHRP09N0008.svg +8 -0
- package/assets/images/menu/dhr/MHRP09N0009.svg +10 -0
- package/assets/images/menu/dhr/MHRP09N0010.svg +12 -0
- package/assets/images/menu/dhr/MHRP09N0011.svg +16 -0
- package/assets/images/menu/dhr/MHRP09N0012.svg +6 -0
- package/assets/images/menu/dhr/MHRP09N0013.svg +8 -0
- package/assets/images/menu/dhr/MHRP09N0014.svg +11 -0
- package/assets/images/menu/dhr/MHRP09N0015.svg +12 -0
- package/assets/images/menu/dhr/MHRP09N0016.svg +18 -0
- package/assets/images/menu/dhr/MHRP09N0017.svg +18 -0
- package/assets/images/menu/dhr/MHRP09N0018.svg +12 -0
- package/assets/images/menu/dhr/MHRP09N0019.svg +13 -0
- package/assets/images/menu/dhr/MHRP09N0020.svg +17 -0
- package/assets/images/menu/dhr/MHRP09N0021.svg +10 -0
- package/assets/images/menu/dhr/MHRP09N0022.svg +16 -0
- package/assets/images/menu/dhr/MHRP09N0023.svg +8 -0
- package/assets/images/menu/dhr/MHRP09N0024.svg +15 -0
- package/assets/images/menu/dhr/MHRP09N0025.svg +16 -0
- package/assets/images/menu/dhr/MHRP09N0026.svg +13 -0
- package/assets/images/menu/dhr/MHRP09N0027.svg +10 -0
- package/assets/images/menu/dhr/MHRP13N0001.svg +9 -0
- package/assets/images/menu/dhr/MHRP21N0001.svg +12 -0
- package/assets/images/menu/dhr/MHRP21N0002.svg +13 -0
- package/assets/images/menu/dhr/MHRP25N0001.svg +13 -0
- package/assets/images/menu/dhr/MHRP25N0002.svg +16 -0
- package/assets/images/menu/dhr/MHRP25N0003.svg +38 -0
- package/assets/images/menu/dhr/MHRP25N0004.svg +17 -0
- package/assets/images/menu/dhr/MHRP25N0005.svg +20 -0
- package/assets/images/menu/dhr/MHRP29N0001.svg +18 -0
- package/assets/images/menu/dhr/MHRP29N0002.svg +15 -0
- package/assets/images/menu/dhr/MHRP29N0003.svg +20 -0
- package/assets/images/menu/dhr/MHRP29N0004.svg +21 -0
- package/assets/images/menu/dhr/MHRP29N0005.svg +21 -0
- package/assets/images/menu/dhr/MHRP29N0006.svg +14 -0
- package/assets/images/menu/dhr/MHRP29N0007.svg +19 -0
- package/assets/images/menu/dhr/MHRP29N0008.svg +20 -0
- package/assets/images/menu/dhr/MHRP29N0009.svg +11 -0
- package/assets/images/menu/dhr/MHRP29N0010.svg +11 -0
- package/assets/images/menu/dhr/MHRP29N0011.svg +12 -0
- package/assets/images/menu/dhr/MHRP29N0013.svg +27 -0
- package/assets/images/menu/dhr/MHRP29N0014.svg +32 -0
- package/assets/images/menu/dhr/MHRP29N0016.svg +54 -0
- package/assets/images/menu/dhr/MHRP29N0017.svg +24 -0
- package/assets/images/menu/dhr/MHRP29N0018.svg +44 -0
- package/assets/images/menu/dhr/MHRP29N0019.svg +17 -0
- package/assets/images/menu/dhr/MHRP29N0020.svg +11 -0
- package/assets/images/menu/dhr/MHRP38N0001.svg +13 -0
- package/assets/images/menu/dhr/MHRP38N0002.svg +14 -0
- package/assets/images/menu/dhr/MHRP39N0001.svg +15 -0
- package/assets/images/menu/dhr/MHRP39N0002.svg +13 -0
- package/assets/images/menu/dhr/MHRP39N0003.svg +16 -0
- package/assets/images/menu/dhr/MHRP39N0004.svg +22 -0
- package/assets/images/menu/dhr/MHRP39N0005.svg +16 -0
- package/assets/images/menu/dhr/MHRP39N0006.svg +17 -0
- package/assets/images/menu/dhr/MHRP39N0007.svg +13 -0
- package/assets/images/menu/dhr/MHRP39N0008.svg +3 -0
- package/assets/images/menu/dhr/MHRP39N0009.svg +3 -0
- package/assets/images/menu/dhr/MHRP39N0010.svg +7 -0
- package/assets/images/menu/dhr/MHRP39N0011.svg +14 -0
- package/assets/images/menu/dhr/MHRP39N0013.svg +10 -0
- package/assets/images/menu/dhr/MHRP39N0014.svg +11 -0
- package/assets/images/menu/dhr/MHRP39N1222.svg +12 -0
- package/assets/images/menu/dhr/MHRP51N0001.svg +9 -0
- package/assets/images/menu/dhr/MHRP51N0002.svg +13 -0
- package/assets/images/menu/dhr/MHRP52N0001.svg +21 -0
- package/assets/images/menu/dhr/MHRP52N0002.svg +21 -0
- package/assets/images/menu/dhr/MHRP52N0003.svg +16 -0
- package/assets/images/menu/dhr/MHRP75N0001.svg +19 -0
- package/assets/images/menu/dhr/MHRP75N0002.svg +25 -0
- package/assets/images/menu/dhr/MHRP75N0003.svg +3 -0
- package/assets/images/menu/dhr/MHRP75N0006.svg +14 -0
- package/assets/images/menu/dhr/MHRP75N0007.svg +19 -0
- package/assets/images/menu/dhr/MHRP75N0008.svg +19 -0
- package/assets/images/menu/dhr/MHRP77N0007.svg +28 -0
- package/assets/images/menu/dhr/MHRP77N0008.svg +17 -0
- package/assets/images/menu/dhr/MHRP77N0009.svg +19 -0
- package/assets/images/menu/dhr/MHRP77N0010.svg +20 -0
- package/assets/images/menu/dhr/MHRP89N1000.svg +6 -0
- package/assets/images/menu/dhr/MHRP89N1001.svg +6 -0
- package/assets/images/menu/dhr/W00F0001.svg +3 -0
- package/assets/images/menu/dhr/W00F0002.svg +3 -0
- package/assets/images/menu/dhr/W00F0003.svg +3 -0
- package/assets/images/menu/dhr/W00F0004.svg +3 -0
- package/assets/images/menu/dhr/W00F0005.svg +1 -0
- package/assets/images/menu/dhr/W09F2000-WEB5.svg +17 -0
- package/assets/images/menu/dhr/W09F2000.svg +6 -0
- package/assets/images/menu/dhr/W09F2002-WEB5.svg +21 -0
- package/assets/images/menu/dhr/W09F2005-WEB5.svg +13 -0
- package/assets/images/menu/dhr/W09F2020-WEB5.svg +16 -0
- package/assets/images/menu/dhr/W09F2022-WEB5.svg +20 -0
- package/assets/images/menu/dhr/W09F2150-WEB5.svg +16 -0
- package/assets/images/menu/dhr/W09F2152-WEB5.svg +20 -0
- package/assets/images/menu/dhr/W09F2160-WEB5.svg +14 -0
- package/assets/images/menu/dhr/W09F2162-WEB5.svg +18 -0
- package/assets/images/menu/dhr/W29F4006-WEB5.svg +19 -0
- package/assets/images/menu/dhr/W75F2260-WEB5.svg +15 -0
- package/assets/images/menu/dhr/W75F2261-WEB5.svg +19 -0
- package/assets/images/menu/dhr/W75F3005-WEB5.svg +13 -0
- package/assets/images/menu/dhr/W75F4070-WEB5.svg +21 -0
- package/assets/images/menu/dhr/W75F4071-WEB5.svg +17 -0
- package/assets/images/menu/dhr/W75F4100-WEB5.svg +14 -0
- package/assets/images/menu/dhr/W77F1011.svg +19 -0
- package/assets/images/menu/dhr/W77F1013.svg +22 -0
- package/assets/images/menu/erp/W00F0001.svg +3 -0
- package/assets/images/menu/erp/W00F0002.svg +3 -0
- package/assets/images/menu/erp/W00F0003.svg +3 -0
- package/assets/images/menu/erp/W00F0004.svg +3 -0
- package/assets/images/menu/erp/W05F0001.svg +16 -0
- package/assets/images/menu/erp/W05F0001N0000.svg +16 -0
- package/assets/images/menu/erp/W05F0004N0000.svg +6 -0
- package/assets/images/menu/erp/W05F0006.svg +30 -0
- package/assets/images/menu/erp/W05F0007N0000.svg +6 -0
- package/assets/images/menu/erp/W05F0008.svg +14 -0
- package/assets/images/menu/erp/W05F4000.svg +9 -0
- package/assets/images/menu/erp/W06F0001.svg +17 -0
- package/assets/images/menu/erp/W06F0001N0000.svg +17 -0
- package/assets/images/menu/erp/W06F0004N0000.svg +22 -0
- package/assets/images/menu/erp/W06F0005.svg +22 -0
- package/assets/images/menu/erp/W06F0006.svg +55 -0
- package/assets/images/menu/erp/W06F0008.svg +17 -0
- package/assets/images/menu/erp/WA3F1025.svg +5 -0
- package/assets/images/menu/erp/WA3F2100.svg +10 -0
- package/components/accordion/context.js +6 -0
- package/components/accordion/css.js +159 -0
- package/components/accordion/details.js +60 -0
- package/components/accordion/group.js +122 -0
- package/components/accordion/index.js +117 -0
- package/components/accordion/summary.js +175 -0
- package/components/alert/index.js +264 -0
- package/components/alert/notify.js +192 -0
- package/components/avatar/index.js +556 -0
- package/components/badge/index.js +223 -0
- package/components/button/icon.js +493 -0
- package/components/button/index.js +653 -0
- package/components/button/more.js +135 -0
- package/components/button/ripple-effect.js +85 -0
- package/components/card/body-card.js +67 -0
- package/components/card/card.js +127 -0
- package/components/card/context.js +6 -0
- package/components/card/index.js +50 -0
- package/components/chart/Pie/Circle.js +50 -0
- package/components/chart/Pie/Sector.js +142 -0
- package/components/chart/Pie/Sectors.js +91 -0
- package/components/chart/Pie/index.js +311 -0
- package/components/chart/Pie-v2/Circle.js +50 -0
- package/components/chart/Pie-v2/Sector.js +128 -0
- package/components/chart/Pie-v2/Sectors.js +224 -0
- package/components/chart/Pie-v2/index.js +397 -0
- package/components/chart/bar/Axis.js +79 -0
- package/components/chart/bar/Bar.js +365 -0
- package/components/chart/bar/Grid.js +115 -0
- package/components/chart/bar/Labels.js +175 -0
- package/components/chart/bar/Points.js +111 -0
- package/components/chart/bar/index.js +172 -0
- package/components/chart/bar-v2/Axis.js +79 -0
- package/components/chart/bar-v2/Bar.js +374 -0
- package/components/chart/bar-v2/Grid.js +115 -0
- package/components/chart/bar-v2/Labels.js +175 -0
- package/components/chart/bar-v2/Points.js +111 -0
- package/components/chart/bar-v2/index.js +172 -0
- package/components/chart/line/Axis.js +79 -0
- package/components/chart/line/Grid.js +115 -0
- package/components/chart/line/Labels.js +172 -0
- package/components/chart/line/Path.js +163 -0
- package/components/chart/line/Point.js +348 -0
- package/components/chart/line/Title.js +56 -0
- package/components/chart/line/index.js +174 -0
- package/components/chart/line-v2/Axis.js +79 -0
- package/components/chart/line-v2/Grid.js +115 -0
- package/components/chart/line-v2/Labels.js +172 -0
- package/components/chart/line-v2/Path.js +163 -0
- package/components/chart/line-v2/Point.js +354 -0
- package/components/chart/line-v2/Title.js +56 -0
- package/components/chart/line-v2/index.js +174 -0
- package/components/check-text/index.js +157 -0
- package/components/check-text/interview-confirmation.js +172 -0
- package/components/check-text/interview-status.js +138 -0
- package/components/chip/attach.js +180 -0
- package/components/chip/index.js +340 -0
- package/components/collapse/index.js +67 -0
- package/components/dialogs/colors.js +11 -0
- package/components/divider/index.js +71 -0
- package/components/divider/style.js +12 -0
- package/components/form-control/attachment/index.js +1890 -0
- package/components/form-control/calendar/function.js +673 -0
- package/components/form-control/calendar/index.js +248 -0
- package/components/form-control/calendar/range.js +293 -0
- package/components/form-control/checkbox/index.js +306 -0
- package/components/form-control/control/index.js +92 -0
- package/components/form-control/date-picker/index-old.js +953 -0
- package/components/form-control/date-picker/index.js +676 -0
- package/components/form-control/date-range-picker/index.js +1305 -0
- package/components/form-control/dropdown/index.js +1865 -0
- package/components/form-control/dropdown-box/index.js +292 -0
- package/components/form-control/form/context.js +5 -0
- package/components/form-control/form/index.js +41 -0
- package/components/form-control/form-group/index.js +118 -0
- package/components/form-control/helper-text/index.js +71 -0
- package/components/form-control/input-base/index.js +733 -0
- package/components/form-control/label/index.js +73 -0
- package/components/form-control/money-input/index.js +491 -0
- package/components/form-control/number-input/index.js +633 -0
- package/components/form-control/phone-input/index.js +433 -0
- package/components/form-control/radio/index.js +263 -0
- package/components/form-control/text-input/index.js +523 -0
- package/components/form-control/time-picker/index.js +829 -0
- package/components/form-control/time-picker/swiper.js +590 -0
- package/components/form-control/toggle/index.js +250 -0
- package/components/form-view/helper-text.js +33 -0
- package/components/form-view/index.js +107 -0
- package/components/form-view/input.js +129 -0
- package/components/form-view/label.js +38 -0
- package/components/index.js +100 -0
- package/components/list/list-item-action.js +82 -0
- package/components/list/list-item-icon.js +76 -0
- package/components/list/list-item-text.js +57 -0
- package/components/list/list-item.js +114 -0
- package/components/list/list.js +155 -0
- package/components/list/sub-header.js +61 -0
- package/components/modal/body.js +71 -0
- package/components/modal/context.js +6 -0
- package/components/modal/footer.js +63 -0
- package/components/modal/header.js +108 -0
- package/components/modal/index.js +69 -0
- package/components/modal/modal.js +339 -0
- package/components/others/extra/index.js +124 -0
- package/components/others/scrollbar/index.js +95 -0
- package/components/paging/page-info.js +298 -0
- package/components/paging/page-selector.js +281 -0
- package/components/paper/index.js +119 -0
- package/components/popover/index.js +417 -0
- package/components/popup/danger_popup.js +215 -0
- package/components/popup/index.js +469 -0
- package/components/popup/proposals_popup.js +364 -0
- package/components/popup/v2/danger-popup.js +17 -0
- package/components/popup/v2/index.js +460 -0
- package/components/popup/v2/info-popup.js +17 -0
- package/components/popup/v2/success-popup.js +17 -0
- package/components/popup/v2/warning-popup.js +17 -0
- package/components/popup/v2/yes-no-popup.js +20 -0
- package/components/progress/circular.js +414 -0
- package/components/progress/linear.js +327 -0
- package/components/rating/index.js +392 -0
- package/components/slider/slider-container.js +356 -0
- package/components/slider/slider-item.js +183 -0
- package/components/status/index.js +123 -0
- package/components/tab/context.js +3 -0
- package/components/tab/tab-container.js +83 -0
- package/components/tab/tab-header.js +133 -0
- package/components/tab/tab-panel.js +51 -0
- package/components/tab/tab.js +206 -0
- package/components/tooltip/index.js +602 -0
- package/components/tooltip/portal.js +13 -0
- package/components/transfer/index.js +489 -0
- package/components/tree-view/css.js +94 -0
- package/components/tree-view/index.js +1009 -0
- package/components/typography/index.js +218 -0
- package/css/styles.css +1 -0
- package/css/styles.css.map +1 -0
- package/global/index.js +175 -0
- package/icons/basic.js +6326 -0
- package/icons/effect.js +171 -0
- package/icons/general/clock/clock.js +21 -0
- package/icons/general/color-handler/background.js +41 -0
- package/icons/general/color-handler/text.js +41 -0
- package/icons/general/emoji/emoji.js +35 -0
- package/icons/general/font-properties/bold.js +21 -0
- package/icons/general/font-properties/font-family.js +35 -0
- package/icons/general/font-properties/font-size.js +27 -0
- package/icons/general/font-properties/italic.js +21 -0
- package/icons/general/font-properties/underline.js +31 -0
- package/icons/general/hyperlink/hyperlink.js +38 -0
- package/icons/general/indent/decrease.js +55 -0
- package/icons/general/indent/increase.js +55 -0
- package/icons/general/index.js +21 -0
- package/icons/general/list/bullets.js +77 -0
- package/icons/general/list/numbering.js +71 -0
- package/icons/general/picture/picture.js +21 -0
- package/icons/general/steps/redo.js +21 -0
- package/icons/general/steps/undo.js +21 -0
- package/icons/general/text-align/center.js +21 -0
- package/icons/general/text-align/justify.js +21 -0
- package/icons/general/text-align/left.js +21 -0
- package/icons/general/text-align/right.js +21 -0
- package/icons/index.js +3 -0
- package/icons/menu/dhr.js +2440 -0
- package/icons/menu/erp.js +490 -0
- package/icons/menu/index.js +5 -0
- package/icons/menu/v2/index.js +52 -0
- package/locale/index.js +11 -0
- package/package.json +45 -0
- package/readme.md +517 -0
- package/styles/animation.js +890 -0
- package/styles/color-helper.js +504 -0
- package/styles/colors.js +306 -0
- package/styles/general.js +48 -0
- package/styles/media-queries.js +10 -0
- package/styles/typography.js +122 -0
- package/styles/utils.js +10 -0
- package/theme/index.js +5 -0
- package/theme/make-styles.js +95 -0
- package/theme/set-theme.js +39 -0
- package/theme/settings.js +230 -0
- package/theme/theme-provider.js +68 -0
- package/theme/theme.js +56 -0
- package/theme/with-styles.js +17 -0
- package/theme/with-theme.js +11 -0
- package/utils/array/array.js +186 -0
- package/utils/console.js +34 -0
- package/utils/date.js +471 -0
- package/utils/error/error.js +62 -0
- package/utils/error/errors.js +247 -0
- package/utils/getFileType.js +32 -0
- package/utils/index.js +23 -0
- package/utils/iterator.js +45 -0
- package/utils/map-parent.js +53 -0
- package/utils/number.js +64 -0
- package/utils/object/extend.js +57 -0
- package/utils/object/object.js +68 -0
- package/utils/parseHTML.js +8 -0
- package/utils/promisify.js +38 -0
- package/utils/randomString.js +33 -0
- package/utils/remove-unicode.js +6 -0
- package/utils/render-portal.js +90 -0
- package/utils/renderHTML.js +21 -0
- package/utils/renderIcon.js +57 -0
- package/utils/string/capitalize.js +3 -0
- package/utils/string/capitalizeSentenceCase.js +10 -0
- package/utils/string/string.js +81 -0
- package/utils/type.js +90 -0
- package/utils/updatePosition.js +36 -0
- package/utils/useOnClickOutside.js +23 -0
- package/utils/usePortal.js +56 -0
- package/utils/validate.js +149 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
/** @jsxRuntime classic */
|
|
4
|
+
|
|
5
|
+
/** @jsx jsx */
|
|
6
|
+
import { memo, forwardRef } from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { jsx, css } from '@emotion/core';
|
|
9
|
+
import { Typography } from '../../';
|
|
10
|
+
import theme from '../../../theme/settings';
|
|
11
|
+
import { getGlobal } from '../../../global';
|
|
12
|
+
const HelperText = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
13
|
+
disabled,
|
|
14
|
+
status,
|
|
15
|
+
className,
|
|
16
|
+
children,
|
|
17
|
+
...props
|
|
18
|
+
}, ref) => {
|
|
19
|
+
/* Start styled */
|
|
20
|
+
const HelperTextRoot = css`
|
|
21
|
+
margin-top: 4px;
|
|
22
|
+
&.info {
|
|
23
|
+
color: ${theme.colors.info};
|
|
24
|
+
}
|
|
25
|
+
&.success {
|
|
26
|
+
color: ${theme.colors.success};
|
|
27
|
+
}
|
|
28
|
+
&.warning {
|
|
29
|
+
color: ${theme.colors.warning};
|
|
30
|
+
}
|
|
31
|
+
&.danger {
|
|
32
|
+
color: ${theme.colors.danger};
|
|
33
|
+
}
|
|
34
|
+
&.disabled {
|
|
35
|
+
color: ${theme.colors.disabled};
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
/* End styled */
|
|
39
|
+
|
|
40
|
+
return jsx(Typography, _extends({
|
|
41
|
+
ref: ref,
|
|
42
|
+
type: 'p3',
|
|
43
|
+
color: theme.colors.danger,
|
|
44
|
+
fullWidth: false,
|
|
45
|
+
css: HelperTextRoot,
|
|
46
|
+
className: ['DGN-UI-HelperText', className, status, disabled ? 'disabled' : ''].join(' ').trim()
|
|
47
|
+
}, props), typeof children === 'boolean' ? getGlobal('thisFieldIsRequired') : children);
|
|
48
|
+
}));
|
|
49
|
+
HelperText.defaultProps = {
|
|
50
|
+
disabled: false,
|
|
51
|
+
status: 'default',
|
|
52
|
+
className: '',
|
|
53
|
+
children: ''
|
|
54
|
+
};
|
|
55
|
+
HelperText.propTypes = {
|
|
56
|
+
/** prevent all event if true */
|
|
57
|
+
disabled: PropTypes.bool,
|
|
58
|
+
|
|
59
|
+
/** status type to display color for input (only available for type is inform) */
|
|
60
|
+
status: PropTypes.oneOf(['default', 'warning', 'success', 'danger', 'info']),
|
|
61
|
+
|
|
62
|
+
/** class use in for helper text */
|
|
63
|
+
className: PropTypes.string,
|
|
64
|
+
|
|
65
|
+
/** the content to display in HelperText */
|
|
66
|
+
children: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
67
|
+
|
|
68
|
+
/** any props else */
|
|
69
|
+
props: PropTypes.any
|
|
70
|
+
};
|
|
71
|
+
export default HelperText;
|
|
@@ -0,0 +1,733 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
/** @jsxRuntime classic */
|
|
4
|
+
|
|
5
|
+
/** @jsx jsx */
|
|
6
|
+
import { memo, useEffect, useRef, forwardRef, useImperativeHandle } from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { jsx, css } from '@emotion/core';
|
|
9
|
+
import { renderIcon } from '../../../utils';
|
|
10
|
+
import theme from '../../../theme/settings';
|
|
11
|
+
const {
|
|
12
|
+
colors,
|
|
13
|
+
typography: {
|
|
14
|
+
fontSize,
|
|
15
|
+
fontFamily
|
|
16
|
+
}
|
|
17
|
+
} = theme;
|
|
18
|
+
const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
19
|
+
type,
|
|
20
|
+
viewType,
|
|
21
|
+
defaultValue,
|
|
22
|
+
value,
|
|
23
|
+
placeholder,
|
|
24
|
+
resize,
|
|
25
|
+
status,
|
|
26
|
+
className,
|
|
27
|
+
autoComplete,
|
|
28
|
+
autoFocus,
|
|
29
|
+
disabled,
|
|
30
|
+
readOnly,
|
|
31
|
+
multiline,
|
|
32
|
+
nonStyle,
|
|
33
|
+
refs,
|
|
34
|
+
startIcon,
|
|
35
|
+
endIcon,
|
|
36
|
+
startIconProps,
|
|
37
|
+
endIconProps,
|
|
38
|
+
inputRef,
|
|
39
|
+
inputProps,
|
|
40
|
+
iconStyle,
|
|
41
|
+
inputStyle,
|
|
42
|
+
rows,
|
|
43
|
+
maxRows,
|
|
44
|
+
onChange,
|
|
45
|
+
onBlur,
|
|
46
|
+
onFocus,
|
|
47
|
+
onInput,
|
|
48
|
+
onKeyDown,
|
|
49
|
+
onKeyUp,
|
|
50
|
+
...props
|
|
51
|
+
}, reference) => {
|
|
52
|
+
const ref = useRef(null);
|
|
53
|
+
const inputBaseRef = useRef(null);
|
|
54
|
+
const valueArray = useRef([]);
|
|
55
|
+
/* Start styled */
|
|
56
|
+
|
|
57
|
+
const inputBaseRoot = css`
|
|
58
|
+
display: flex;
|
|
59
|
+
flex: 1 1 auto;
|
|
60
|
+
align-items: center;
|
|
61
|
+
position: relative;
|
|
62
|
+
height: max-content;
|
|
63
|
+
&:hover,
|
|
64
|
+
&:focus-within {
|
|
65
|
+
.start-icon:not(.non-effect) {
|
|
66
|
+
path {
|
|
67
|
+
fill: ${colors.primary};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
&:focus-within {
|
|
72
|
+
border-bottom-color: ${colors.borderFocus};
|
|
73
|
+
&::after {
|
|
74
|
+
border-bottom-color: inherit;
|
|
75
|
+
transform: scaleX(1);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
&.underlined {
|
|
79
|
+
padding-bottom: 4px;
|
|
80
|
+
padding-top: 4px;
|
|
81
|
+
&:not(:focus-within):hover {
|
|
82
|
+
&::before {
|
|
83
|
+
border-bottom-color: ${colors.borderHover};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
&:focus-within {
|
|
87
|
+
${!readOnly && `
|
|
88
|
+
border-bottom-color: ${colors.borderFocus};
|
|
89
|
+
&::after {
|
|
90
|
+
border-bottom-color: inherit;
|
|
91
|
+
transform: scaleX(1);
|
|
92
|
+
}
|
|
93
|
+
`}
|
|
94
|
+
}
|
|
95
|
+
&::before {
|
|
96
|
+
content: '';
|
|
97
|
+
position: absolute;
|
|
98
|
+
left: 0;
|
|
99
|
+
right: 0;
|
|
100
|
+
bottom: 0;
|
|
101
|
+
border-bottom: 1px solid ${colors.border};
|
|
102
|
+
}
|
|
103
|
+
&::after {
|
|
104
|
+
content: '';
|
|
105
|
+
position: absolute;
|
|
106
|
+
left: 0px;
|
|
107
|
+
right: 0px;
|
|
108
|
+
bottom: -1px;
|
|
109
|
+
border-bottom: 2px solid transparent;
|
|
110
|
+
transform: scaleX(0);
|
|
111
|
+
transform-origin: center;
|
|
112
|
+
transition: all 0.2s ease;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
&.outlined {
|
|
116
|
+
border: 1px solid ${colors.border};
|
|
117
|
+
border-radius: 4px;
|
|
118
|
+
height: 40px;
|
|
119
|
+
box-sizing: border-box;
|
|
120
|
+
background-color: ${colors.white};
|
|
121
|
+
&:not(:focus-within):hover {
|
|
122
|
+
background-color: ${colors.hover};
|
|
123
|
+
border-color: ${colors.borderHover};
|
|
124
|
+
input {
|
|
125
|
+
background-color: ${colors.hover};
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
&:focus-within {
|
|
129
|
+
${!readOnly && `
|
|
130
|
+
border-color: ${colors.borderFocus};
|
|
131
|
+
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
|
|
132
|
+
&::after {
|
|
133
|
+
border-color: inherit;
|
|
134
|
+
}
|
|
135
|
+
`}
|
|
136
|
+
}
|
|
137
|
+
&::after {
|
|
138
|
+
content: '';
|
|
139
|
+
position: absolute;
|
|
140
|
+
left: -2px;
|
|
141
|
+
right: -2px;
|
|
142
|
+
top: -2px;
|
|
143
|
+
bottom: -2px;
|
|
144
|
+
border: 2px solid transparent;
|
|
145
|
+
border-radius: 4px;
|
|
146
|
+
pointer-events: none;
|
|
147
|
+
}
|
|
148
|
+
.start-icon {
|
|
149
|
+
margin-left: 16px;
|
|
150
|
+
}
|
|
151
|
+
.end-icon {
|
|
152
|
+
margin-right: 16px;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
&.non-style {
|
|
156
|
+
border-color: transparent !important;
|
|
157
|
+
box-shadow: none !important;
|
|
158
|
+
background-color: transparent !important;
|
|
159
|
+
input {
|
|
160
|
+
background-color: transparent !important;
|
|
161
|
+
}
|
|
162
|
+
&:before,
|
|
163
|
+
&:after {
|
|
164
|
+
border-color: transparent !important;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
&.info {
|
|
168
|
+
border-color: ${colors.info} !important;
|
|
169
|
+
&::before {
|
|
170
|
+
border-color: ${colors.info} !important;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
&.success {
|
|
174
|
+
border-color: ${colors.success} !important;
|
|
175
|
+
&::before {
|
|
176
|
+
border-color: ${colors.success} !important;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
&.warning {
|
|
180
|
+
border-color: ${colors.warning} !important;
|
|
181
|
+
&::before {
|
|
182
|
+
border-color: ${colors.warning} !important;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
&.danger {
|
|
186
|
+
border-color: ${colors.danger} !important;
|
|
187
|
+
&::before {
|
|
188
|
+
border-color: ${colors.danger} !important;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
&.disabled {
|
|
192
|
+
border-color: ${colors.disabled} !important;
|
|
193
|
+
pointer-events: none;
|
|
194
|
+
&::before {
|
|
195
|
+
border-bottom-color: ${colors.disabled} !important;
|
|
196
|
+
}
|
|
197
|
+
&.outlined {
|
|
198
|
+
background-color: ${colors.bgDisabled};
|
|
199
|
+
}
|
|
200
|
+
input {
|
|
201
|
+
// color: ${colors.disabled};
|
|
202
|
+
}
|
|
203
|
+
.start-icon,
|
|
204
|
+
.end-icon {
|
|
205
|
+
&:not(.non-effect), &.allow-disabled {
|
|
206
|
+
path {
|
|
207
|
+
fill: ${colors.disabled};
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
& + .DGN-UI-HelperText {
|
|
213
|
+
min-height: 16px;
|
|
214
|
+
position: absolute;
|
|
215
|
+
top: 100%;
|
|
216
|
+
}
|
|
217
|
+
`;
|
|
218
|
+
const inputBaseCSS = css`
|
|
219
|
+
display: flex;
|
|
220
|
+
flex: 1 1 auto;
|
|
221
|
+
`;
|
|
222
|
+
const inputCSS = css`
|
|
223
|
+
width: 100%;
|
|
224
|
+
border: none;
|
|
225
|
+
outline: none;
|
|
226
|
+
color: ${colors.input};
|
|
227
|
+
background-color: transparent;
|
|
228
|
+
padding-top: 0;
|
|
229
|
+
font-family: ${fontFamily};
|
|
230
|
+
font-style: normal;
|
|
231
|
+
font-weight: 500;
|
|
232
|
+
font-size: ${fontSize};
|
|
233
|
+
line-height: 20px;
|
|
234
|
+
height: 24px;
|
|
235
|
+
&::placeholder {
|
|
236
|
+
color: ${colors.placeholder};
|
|
237
|
+
font-family: ${fontFamily};
|
|
238
|
+
font-size: ${fontSize};
|
|
239
|
+
}
|
|
240
|
+
&:focus {
|
|
241
|
+
background-color: transparent;
|
|
242
|
+
color: ${colors.primary};
|
|
243
|
+
}
|
|
244
|
+
&:hover {
|
|
245
|
+
color: ${colors.primary};
|
|
246
|
+
}
|
|
247
|
+
&.outlined {
|
|
248
|
+
padding-bottom: inherit;
|
|
249
|
+
padding-left: 16px;
|
|
250
|
+
padding-right: 16px;
|
|
251
|
+
}
|
|
252
|
+
&.underlined {
|
|
253
|
+
padding-bottom: 0;
|
|
254
|
+
padding-left: 0;
|
|
255
|
+
padding-right: 0;
|
|
256
|
+
}
|
|
257
|
+
&:disabled {
|
|
258
|
+
background-color: transparent;
|
|
259
|
+
}
|
|
260
|
+
`;
|
|
261
|
+
const textAreaCSS = css`
|
|
262
|
+
display: block;
|
|
263
|
+
color: ${colors.input};
|
|
264
|
+
font-family: ${fontFamily};
|
|
265
|
+
font-size: ${fontSize};
|
|
266
|
+
line-height: 20px;
|
|
267
|
+
min-height: max-content;
|
|
268
|
+
min-width: max-content;
|
|
269
|
+
outline: none;
|
|
270
|
+
border: none;
|
|
271
|
+
background-color: transparent;
|
|
272
|
+
padding: 2px 0;
|
|
273
|
+
width: 100%;
|
|
274
|
+
overflow-y: auto;
|
|
275
|
+
position: relative;
|
|
276
|
+
resize: ${resize};
|
|
277
|
+
box-sizing: border-box;
|
|
278
|
+
&:disabled {
|
|
279
|
+
color: ${colors.disabled};
|
|
280
|
+
}
|
|
281
|
+
&:hover:not(:focus-within) {
|
|
282
|
+
border-color: ${colors.borderHover};
|
|
283
|
+
color: ${colors.primary};
|
|
284
|
+
::placeholder {
|
|
285
|
+
color: ${colors.primary};
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
&:focus-within {
|
|
289
|
+
color: ${colors.primary};
|
|
290
|
+
}
|
|
291
|
+
&::-webkit-scrollbar {
|
|
292
|
+
width: 4px;
|
|
293
|
+
background-color: white;
|
|
294
|
+
border-radius: 4px;
|
|
295
|
+
}
|
|
296
|
+
&::-webkit-scrollbar-thumb{
|
|
297
|
+
border-radius: 10px;
|
|
298
|
+
mix-blend-mode: normal;
|
|
299
|
+
background-color: ${colors.bgDisabled};
|
|
300
|
+
background-clip: content-box;
|
|
301
|
+
}
|
|
302
|
+
`;
|
|
303
|
+
const multilineCSS = css`
|
|
304
|
+
display: block;
|
|
305
|
+
position: relative;
|
|
306
|
+
height: max-content;
|
|
307
|
+
width: 100%;
|
|
308
|
+
box-sizing: border-box;
|
|
309
|
+
&.outlined {
|
|
310
|
+
border: 1px solid ${colors.border};
|
|
311
|
+
border-radius: 4px;
|
|
312
|
+
/* height: 30px; */
|
|
313
|
+
padding: 7px 16px;
|
|
314
|
+
.css-${textAreaCSS.name} {
|
|
315
|
+
height: 24px;
|
|
316
|
+
}
|
|
317
|
+
&:not(:focus-within):hover {
|
|
318
|
+
background-color: ${colors.hover};
|
|
319
|
+
border-color: ${colors.borderHover};
|
|
320
|
+
input {
|
|
321
|
+
background-color: ${colors.hover};
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
&:focus-within {
|
|
325
|
+
${!readOnly && `
|
|
326
|
+
border-color: ${colors.borderFocus};
|
|
327
|
+
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
|
|
328
|
+
&::after {
|
|
329
|
+
border-color: inherit;
|
|
330
|
+
}
|
|
331
|
+
`}
|
|
332
|
+
}
|
|
333
|
+
&::after {
|
|
334
|
+
content: '';
|
|
335
|
+
position: absolute;
|
|
336
|
+
left: -2px;
|
|
337
|
+
right: -2px;
|
|
338
|
+
top: -2px;
|
|
339
|
+
bottom: -2px;
|
|
340
|
+
border: 2px solid transparent;
|
|
341
|
+
border-radius: 4px;
|
|
342
|
+
pointer-events: none;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
&.underlined {
|
|
346
|
+
border: 0;
|
|
347
|
+
/* height: 26px; */
|
|
348
|
+
padding: 4px 0;
|
|
349
|
+
.css-${textAreaCSS.name} {
|
|
350
|
+
height: 24px;
|
|
351
|
+
}
|
|
352
|
+
&:not(:focus-within):hover {
|
|
353
|
+
&::before {
|
|
354
|
+
border-bottom-color: ${colors.borderHover};
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
&:focus-within {
|
|
358
|
+
${!readOnly && `
|
|
359
|
+
&::after {
|
|
360
|
+
border-bottom-color: ${colors.borderFocus};
|
|
361
|
+
transform: scaleX(1);
|
|
362
|
+
}
|
|
363
|
+
`}
|
|
364
|
+
}
|
|
365
|
+
&::before {
|
|
366
|
+
content: '';
|
|
367
|
+
position: absolute;
|
|
368
|
+
left: 0;
|
|
369
|
+
right: 0;
|
|
370
|
+
bottom: 0;
|
|
371
|
+
border-bottom: 1px solid ${colors.border};
|
|
372
|
+
}
|
|
373
|
+
&::after {
|
|
374
|
+
content: '';
|
|
375
|
+
position: absolute;
|
|
376
|
+
left: 0px;
|
|
377
|
+
right: 0px;
|
|
378
|
+
bottom: -1px;
|
|
379
|
+
border-bottom: 2px solid transparent;
|
|
380
|
+
transform: scaleX(0);
|
|
381
|
+
transform-origin: center;
|
|
382
|
+
transition: all 0.2s ease;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
&.disabled {
|
|
386
|
+
pointer-events: none;
|
|
387
|
+
resize: none;
|
|
388
|
+
color: ${colors.disabled};
|
|
389
|
+
&.outlined {
|
|
390
|
+
background-color: ${colors.bgDisabled};
|
|
391
|
+
}
|
|
392
|
+
&.underlined::before {
|
|
393
|
+
border-bottom-color: ${colors.disabled} !important;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
& + .DGN-UI-HelperText {
|
|
397
|
+
min-height: 16px;
|
|
398
|
+
position: absolute;
|
|
399
|
+
top: 100%;
|
|
400
|
+
}
|
|
401
|
+
`;
|
|
402
|
+
const inputBaseIconCSS = css`
|
|
403
|
+
display: flex;
|
|
404
|
+
color: inherit;
|
|
405
|
+
&.start-icon {
|
|
406
|
+
margin-right: 4px;
|
|
407
|
+
& + input {
|
|
408
|
+
padding-left: 0;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
&.end-icon {
|
|
412
|
+
margin-left: 4px;
|
|
413
|
+
}
|
|
414
|
+
`;
|
|
415
|
+
/* End styled */
|
|
416
|
+
|
|
417
|
+
/* Start handler */
|
|
418
|
+
|
|
419
|
+
const onInputTextArea = e => {
|
|
420
|
+
if (!/\d+/.test(rows)) {
|
|
421
|
+
const el = e.target;
|
|
422
|
+
const defaultHeight = 24;
|
|
423
|
+
|
|
424
|
+
if (el.value) {
|
|
425
|
+
el.style.height = 0;
|
|
426
|
+
el.style.height = Math.max(defaultHeight, el.scrollHeight) + 'px';
|
|
427
|
+
} else {
|
|
428
|
+
el.style.height = defaultHeight + 'px';
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
!!onInput && onInput(e);
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
useEffect(() => {
|
|
436
|
+
!!refs && refs(ref);
|
|
437
|
+
|
|
438
|
+
if (defaultValue !== undefined && defaultValue !== '') {
|
|
439
|
+
if (multiline && !/\d+/.test(rows)) {
|
|
440
|
+
inputBaseRef.current.style.height = 0;
|
|
441
|
+
inputBaseRef.current.style.height = Math.max(24, inputBaseRef.current.scrollHeight) + 'px';
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}, []);
|
|
445
|
+
useEffect(() => {
|
|
446
|
+
if (/\d+/.test(rows)) {
|
|
447
|
+
inputBaseRef.current.style.height = 20 * rows + 4 + 'px';
|
|
448
|
+
return () => {
|
|
449
|
+
if (inputBaseRef.current) {
|
|
450
|
+
inputBaseRef.current.style.height = null;
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
}, [rows]);
|
|
455
|
+
useEffect(() => {
|
|
456
|
+
if (/\d+/.test(maxRows)) {
|
|
457
|
+
inputBaseRef.current.style.maxHeight = 20 * maxRows + 4 + 'px';
|
|
458
|
+
return () => {
|
|
459
|
+
if (inputBaseRef.current) {
|
|
460
|
+
inputBaseRef.current.style.maxHeight = null;
|
|
461
|
+
}
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
}, [maxRows]);
|
|
465
|
+
useEffect(() => {
|
|
466
|
+
if (viewType === 'outlined' && endIcon) {
|
|
467
|
+
inputBaseRef.current.style.paddingRight = '0';
|
|
468
|
+
return () => {
|
|
469
|
+
if (inputBaseRef.current) {
|
|
470
|
+
inputBaseRef.current.style.paddingRight = null;
|
|
471
|
+
}
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
}, [viewType]);
|
|
475
|
+
useEffect(() => {
|
|
476
|
+
if (multiline && !/\d+/.test(rows) && !(inputBaseRef.current.value || inputBaseRef.current.value === 0)) {
|
|
477
|
+
inputBaseRef.current.style.height = '24px';
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
if (autoFocus) {
|
|
481
|
+
inputBaseRef.current.focus();
|
|
482
|
+
}
|
|
483
|
+
}, [multiline]);
|
|
484
|
+
useEffect(() => {
|
|
485
|
+
if (placeholder !== undefined) {
|
|
486
|
+
inputBaseRef.current.placeholder = placeholder;
|
|
487
|
+
}
|
|
488
|
+
}, [placeholder]);
|
|
489
|
+
useEffect(() => {
|
|
490
|
+
const defaultHeight = 24;
|
|
491
|
+
|
|
492
|
+
if (value !== undefined) {
|
|
493
|
+
valueArray.current.push(value);
|
|
494
|
+
inputBaseRef.current.value = value;
|
|
495
|
+
|
|
496
|
+
if (multiline && !/\d+/.test(rows)) {
|
|
497
|
+
inputBaseRef.current.style.height = 0;
|
|
498
|
+
inputBaseRef.current.style.height = Math.max(defaultHeight, inputBaseRef.current.scrollHeight) + 'px';
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
return () => {
|
|
503
|
+
if (value !== undefined && multiline && !/\d+/.test(rows) && inputBaseRef.current) {
|
|
504
|
+
inputBaseRef.current.style.height = defaultHeight + 'px';
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
}, [value]);
|
|
508
|
+
useEffect(() => {
|
|
509
|
+
if (disabled) {
|
|
510
|
+
if (ref.current) {
|
|
511
|
+
ref.current.classList.add('disabled');
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
inputBaseRef.current.disabled = disabled;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
return () => {
|
|
518
|
+
ref.current && ref.current.classList.remove('disabled');
|
|
519
|
+
inputBaseRef.current && inputBaseRef.current.removeAttribute('disabled');
|
|
520
|
+
};
|
|
521
|
+
}, [disabled]);
|
|
522
|
+
/* End handler */
|
|
523
|
+
|
|
524
|
+
/* Start component */
|
|
525
|
+
|
|
526
|
+
const newClass = (viewType === 'outlined' ? 'outlined' : 'underlined') + (nonStyle ? ' non-style' : '');
|
|
527
|
+
const MultipleInputComp = jsx("div", _extends({
|
|
528
|
+
css: multilineCSS,
|
|
529
|
+
className: ['DGN-UI-InputBase', newClass, className].join(' ').trim(),
|
|
530
|
+
ref: ref
|
|
531
|
+
}, props), jsx("textarea", _extends({
|
|
532
|
+
type: "text",
|
|
533
|
+
placeholder: placeholder,
|
|
534
|
+
defaultValue: defaultValue
|
|
535
|
+
}, inputProps, {
|
|
536
|
+
css: textAreaCSS,
|
|
537
|
+
readOnly: readOnly,
|
|
538
|
+
style: inputStyle || (inputProps === null || inputProps === void 0 ? void 0 : inputProps.style),
|
|
539
|
+
className: inputProps.className ? inputProps.className : '',
|
|
540
|
+
ref: inputBaseRef,
|
|
541
|
+
onKeyDown: onKeyDown,
|
|
542
|
+
onKeyUp: onKeyUp,
|
|
543
|
+
onInput: onInputTextArea,
|
|
544
|
+
onChange: onChange,
|
|
545
|
+
onBlur: onBlur,
|
|
546
|
+
onFocus: onFocus
|
|
547
|
+
})));
|
|
548
|
+
const InputComp = jsx("div", _extends({
|
|
549
|
+
css: inputBaseRoot,
|
|
550
|
+
ref: ref
|
|
551
|
+
}, props, {
|
|
552
|
+
className: ['DGN-UI-InputBase', newClass, className, status].join(' ').trim()
|
|
553
|
+
}), jsx("div", {
|
|
554
|
+
css: inputBaseCSS
|
|
555
|
+
}, !!startIcon && jsx("div", _extends({
|
|
556
|
+
css: inputBaseIconCSS
|
|
557
|
+
}, startIconProps, {
|
|
558
|
+
className: 'start-icon ' + (startIconProps.className ? startIconProps.className : '')
|
|
559
|
+
}), renderIcon(startIcon, typeof startIcon === 'string' && startIcon.length < 20 ? 'effect' : null, {
|
|
560
|
+
onClick: startIconProps.onClick ? null : () => inputBaseRef.current.focus(),
|
|
561
|
+
style: {
|
|
562
|
+
padding: 0,
|
|
563
|
+
minHeight: '24px',
|
|
564
|
+
...iconStyle
|
|
565
|
+
},
|
|
566
|
+
viewBox: true
|
|
567
|
+
})), jsx("input", _extends({
|
|
568
|
+
type: type,
|
|
569
|
+
autoComplete: autoComplete,
|
|
570
|
+
placeholder: placeholder,
|
|
571
|
+
defaultValue: defaultValue
|
|
572
|
+
}, inputProps, {
|
|
573
|
+
readOnly: readOnly,
|
|
574
|
+
style: inputStyle || (inputProps === null || inputProps === void 0 ? void 0 : inputProps.style),
|
|
575
|
+
className: [newClass, inputProps === null || inputProps === void 0 ? void 0 : inputProps.className].join(' '),
|
|
576
|
+
ref: inputBaseRef,
|
|
577
|
+
css: inputCSS,
|
|
578
|
+
onKeyDown: onKeyDown,
|
|
579
|
+
onKeyUp: onKeyUp,
|
|
580
|
+
onInput: onInput,
|
|
581
|
+
onChange: onChange,
|
|
582
|
+
onBlur: onBlur,
|
|
583
|
+
onFocus: onFocus
|
|
584
|
+
}))), !!endIcon && jsx("div", _extends({
|
|
585
|
+
css: inputBaseIconCSS
|
|
586
|
+
}, endIconProps, {
|
|
587
|
+
className: 'end-icon ' + (endIconProps.className ? endIconProps.className : '')
|
|
588
|
+
}), renderIcon(endIcon, null, {
|
|
589
|
+
style: {
|
|
590
|
+
padding: 0,
|
|
591
|
+
minHeight: '24px',
|
|
592
|
+
...iconStyle
|
|
593
|
+
},
|
|
594
|
+
viewBox: true
|
|
595
|
+
})));
|
|
596
|
+
const InputBaseComp = multiline ? MultipleInputComp : InputComp;
|
|
597
|
+
/* End component */
|
|
598
|
+
|
|
599
|
+
useImperativeHandle(reference, () => ref.current);
|
|
600
|
+
useImperativeHandle(inputRef, () => {
|
|
601
|
+
inputBaseRef.current.resetValue = () => {
|
|
602
|
+
inputBaseRef.current.value = value;
|
|
603
|
+
return value;
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
inputBaseRef.current.setPreviousValue = () => {
|
|
607
|
+
valueArray.current.pop();
|
|
608
|
+
const preValue = valueArray.current[valueArray.current.length - 1];
|
|
609
|
+
const previousValue = preValue || preValue === 0 ? preValue : defaultValue || '';
|
|
610
|
+
inputBaseRef.current.value = previousValue;
|
|
611
|
+
return previousValue;
|
|
612
|
+
};
|
|
613
|
+
|
|
614
|
+
return inputBaseRef.current;
|
|
615
|
+
});
|
|
616
|
+
return InputBaseComp;
|
|
617
|
+
}));
|
|
618
|
+
InputBase.defaultProps = {
|
|
619
|
+
autoComplete: 'off',
|
|
620
|
+
className: '',
|
|
621
|
+
defaultValue: '',
|
|
622
|
+
placeholder: '',
|
|
623
|
+
resize: 'none',
|
|
624
|
+
status: 'default',
|
|
625
|
+
type: 'text',
|
|
626
|
+
viewType: 'underlined',
|
|
627
|
+
autoFocus: false,
|
|
628
|
+
nonStyle: false,
|
|
629
|
+
disabled: false,
|
|
630
|
+
multiline: false,
|
|
631
|
+
readOnly: false,
|
|
632
|
+
required: false,
|
|
633
|
+
endIconProps: {},
|
|
634
|
+
iconStyle: {},
|
|
635
|
+
inputProps: {},
|
|
636
|
+
inputStyle: {},
|
|
637
|
+
startIconProps: {}
|
|
638
|
+
};
|
|
639
|
+
InputBase.propTypes = {
|
|
640
|
+
/** the type of border you want to display */
|
|
641
|
+
viewType: PropTypes.oneOf(['underlined', 'outlined']),
|
|
642
|
+
|
|
643
|
+
/** default value is displayed for first render */
|
|
644
|
+
defaultValue: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
645
|
+
|
|
646
|
+
/** the displayed value for each change */
|
|
647
|
+
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
648
|
+
|
|
649
|
+
/** hints for input */
|
|
650
|
+
placeholder: PropTypes.string,
|
|
651
|
+
|
|
652
|
+
/** type auto complete of input (like new-password) */
|
|
653
|
+
autoComplete: PropTypes.string,
|
|
654
|
+
|
|
655
|
+
/** allow resize multiline input (resize css style) */
|
|
656
|
+
resize: PropTypes.string,
|
|
657
|
+
|
|
658
|
+
/** class for InputBase component */
|
|
659
|
+
className: PropTypes.string,
|
|
660
|
+
|
|
661
|
+
/** the number of rows of textarea */
|
|
662
|
+
rows: PropTypes.number,
|
|
663
|
+
|
|
664
|
+
/** the maximum of rows of textarea */
|
|
665
|
+
maxRows: PropTypes.number,
|
|
666
|
+
|
|
667
|
+
/** status type to display color for input (only available for type is inform) */
|
|
668
|
+
status: PropTypes.oneOf(['default', 'warning', 'success', 'danger', 'info']),
|
|
669
|
+
|
|
670
|
+
/** use multiline input if true */
|
|
671
|
+
multiline: PropTypes.bool,
|
|
672
|
+
|
|
673
|
+
/** transparent border color if true */
|
|
674
|
+
nonStyle: PropTypes.bool,
|
|
675
|
+
|
|
676
|
+
/** prevent all event if true, hide all icon */
|
|
677
|
+
disabled: PropTypes.bool,
|
|
678
|
+
|
|
679
|
+
/** prevent all event if true */
|
|
680
|
+
readOnly: PropTypes.bool,
|
|
681
|
+
|
|
682
|
+
/** auto focus after first render */
|
|
683
|
+
autoFocus: PropTypes.bool,
|
|
684
|
+
|
|
685
|
+
/** At least one character is required */
|
|
686
|
+
required: PropTypes.bool,
|
|
687
|
+
|
|
688
|
+
/** icon element display in the left of input */
|
|
689
|
+
startIcon: PropTypes.any,
|
|
690
|
+
|
|
691
|
+
/** icon element display in the right of input */
|
|
692
|
+
endIcon: PropTypes.any,
|
|
693
|
+
|
|
694
|
+
/** props of input in InputBase component */
|
|
695
|
+
inputProps: PropTypes.object,
|
|
696
|
+
|
|
697
|
+
/** props of start icon in InputBase component */
|
|
698
|
+
startIconProps: PropTypes.object,
|
|
699
|
+
|
|
700
|
+
/** props of end icon in InputBase component */
|
|
701
|
+
endIconProps: PropTypes.object,
|
|
702
|
+
|
|
703
|
+
/** style inline of icon in InputBase component */
|
|
704
|
+
iconStyle: PropTypes.object,
|
|
705
|
+
|
|
706
|
+
/** style inline of input in InputBase component */
|
|
707
|
+
inputStyle: PropTypes.object,
|
|
708
|
+
|
|
709
|
+
/** The function to get ref of Dropdown component */
|
|
710
|
+
refs: PropTypes.func,
|
|
711
|
+
|
|
712
|
+
/** on key down function */
|
|
713
|
+
onKeyDown: PropTypes.func,
|
|
714
|
+
|
|
715
|
+
/** on key up function */
|
|
716
|
+
onKeyUp: PropTypes.func,
|
|
717
|
+
|
|
718
|
+
/** on input function */
|
|
719
|
+
onInput: PropTypes.func,
|
|
720
|
+
|
|
721
|
+
/** on change function */
|
|
722
|
+
onChange: PropTypes.func,
|
|
723
|
+
|
|
724
|
+
/** on blur function */
|
|
725
|
+
onBlur: PropTypes.func,
|
|
726
|
+
|
|
727
|
+
/** on focus function */
|
|
728
|
+
onFocus: PropTypes.func,
|
|
729
|
+
|
|
730
|
+
/** inputRef of InputBase component */
|
|
731
|
+
inputRef: PropTypes.any
|
|
732
|
+
};
|
|
733
|
+
export default InputBase;
|