diginet-core-ui 1.3.87 → 1.3.88
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 -3
- package/assets/images/icons/wifi.svg +3 -3
- package/assets/images/menu/bem/WA3F0100.svg +6 -6
- package/assets/images/menu/bem/WA3F1025.svg +10 -10
- package/assets/images/menu/bem/WA3F2000.svg +10 -10
- package/assets/images/menu/bem/WA3F2020.svg +6 -6
- package/assets/images/menu/bem/WA3F2030.svg +14 -14
- package/assets/images/menu/bem/WA3F2040.svg +8 -8
- package/assets/images/menu/bem/WA3F2100.svg +6 -6
- package/assets/images/menu/dhr/ALL.svg +6 -6
- package/assets/images/menu/dhr/D00.svg +12 -12
- package/assets/images/menu/dhr/D09.svg +8 -8
- package/assets/images/menu/dhr/D13.svg +10 -10
- package/assets/images/menu/dhr/D15.svg +10 -10
- package/assets/images/menu/dhr/D21.svg +10 -10
- package/assets/images/menu/dhr/D25.svg +11 -11
- package/assets/images/menu/dhr/D29.svg +11 -11
- package/assets/images/menu/dhr/D38.svg +6 -6
- package/assets/images/menu/dhr/D39.svg +10 -10
- package/assets/images/menu/dhr/D51.svg +12 -12
- package/assets/images/menu/dhr/D52.svg +16 -16
- package/assets/images/menu/dhr/D77.svg +16 -16
- package/assets/images/menu/dhr/D84.svg +12 -12
- package/assets/images/menu/dhr/D89.svg +8 -8
- package/assets/images/menu/dhr/Default.svg +13 -13
- package/assets/images/menu/dhr/MHRM00N0001.svg +14 -14
- package/assets/images/menu/dhr/MHRM00N0002.svg +22 -22
- package/assets/images/menu/dhr/MHRM00N0003.svg +17 -17
- package/assets/images/menu/dhr/MHRM00N0004.svg +12 -12
- package/assets/images/menu/dhr/MHRM00N0005.svg +11 -11
- package/assets/images/menu/dhr/MHRM09N0002.svg +3 -3
- package/assets/images/menu/dhr/MHRM09N0003.svg +25 -25
- package/assets/images/menu/dhr/MHRM09N0004.svg +14 -14
- package/assets/images/menu/dhr/MHRM09N0005.svg +7 -7
- package/assets/images/menu/dhr/MHRM09N1010.svg +12 -12
- package/assets/images/menu/dhr/MHRM09N1015.svg +18 -18
- package/assets/images/menu/dhr/MHRM09N1020.svg +13 -13
- package/assets/images/menu/dhr/MHRM09N1025.svg +12 -12
- package/assets/images/menu/dhr/MHRM09N1030.svg +11 -11
- package/assets/images/menu/dhr/MHRM09N1035.svg +15 -15
- package/assets/images/menu/dhr/MHRM09N1040.svg +8 -8
- package/assets/images/menu/dhr/MHRM09N1400.svg +11 -11
- package/assets/images/menu/dhr/MHRM13N0001.svg +16 -16
- package/assets/images/menu/dhr/MHRM13N0002.svg +13 -13
- package/assets/images/menu/dhr/MHRM13N0003.svg +12 -12
- package/assets/images/menu/dhr/MHRM13N0004.svg +21 -21
- package/assets/images/menu/dhr/MHRM25N0001.svg +26 -26
- package/assets/images/menu/dhr/MHRM29N0001.svg +30 -30
- package/assets/images/menu/dhr/MHRM29N0002.svg +13 -13
- package/assets/images/menu/dhr/MHRM29N0003.svg +17 -17
- package/assets/images/menu/dhr/MHRM29N0004.svg +18 -18
- package/assets/images/menu/dhr/MHRM29N0005.svg +13 -13
- package/assets/images/menu/dhr/MHRM29N0015.svg +63 -63
- package/assets/images/menu/dhr/MHRM39N0012.svg +43 -43
- package/assets/images/menu/dhr/MHRM39N0013.svg +24 -24
- package/assets/images/menu/dhr/MHRM39N0014.svg +14 -14
- package/assets/images/menu/dhr/MHRM39N0015.svg +36 -36
- package/assets/images/menu/dhr/MHRM39N0016.svg +23 -23
- package/assets/images/menu/dhr/MHRM39N0017.svg +14 -14
- package/assets/images/menu/dhr/MHRM39N0018.svg +5 -5
- package/assets/images/menu/dhr/MHRM39N0019.svg +11 -11
- package/assets/images/menu/dhr/MHRM39N0020.svg +11 -11
- package/assets/images/menu/dhr/MHRM39N0021.svg +11 -11
- package/assets/images/menu/dhr/MHRM39N0022.svg +18 -18
- package/assets/images/menu/dhr/MHRM39N0023.svg +13 -13
- package/assets/images/menu/dhr/MHRM77N0001.svg +28 -28
- package/assets/images/menu/dhr/MHRM82N0001.svg +8 -8
- package/assets/images/menu/dhr/MHRM82N0002.svg +5 -5
- package/assets/images/menu/dhr/MHRM84N0001.svg +27 -27
- package/assets/images/menu/dhr/MHRM84N0002.svg +24 -24
- package/assets/images/menu/dhr/MHRM89N0001.svg +16 -16
- package/assets/images/menu/dhr/MHRP00N0001.svg +10 -10
- package/assets/images/menu/dhr/MHRP09N0001.svg +22 -22
- package/assets/images/menu/dhr/MHRP09N0002.svg +19 -19
- package/assets/images/menu/dhr/MHRP09N0003.svg +12 -12
- package/assets/images/menu/dhr/MHRP09N0004.svg +6 -6
- package/assets/images/menu/dhr/MHRP09N0005.svg +10 -10
- package/assets/images/menu/dhr/MHRP09N0006.svg +17 -17
- package/assets/images/menu/dhr/MHRP09N0007.svg +15 -15
- package/assets/images/menu/dhr/MHRP09N0008.svg +8 -8
- package/assets/images/menu/dhr/MHRP09N0009.svg +10 -10
- package/assets/images/menu/dhr/MHRP09N0010.svg +12 -12
- package/assets/images/menu/dhr/MHRP09N0011.svg +16 -16
- package/assets/images/menu/dhr/MHRP09N0012.svg +6 -6
- package/assets/images/menu/dhr/MHRP09N0013.svg +8 -8
- package/assets/images/menu/dhr/MHRP09N0014.svg +11 -11
- package/assets/images/menu/dhr/MHRP09N0015.svg +12 -12
- package/assets/images/menu/dhr/MHRP09N0016.svg +18 -18
- package/assets/images/menu/dhr/MHRP09N0017.svg +18 -18
- package/assets/images/menu/dhr/MHRP09N0018.svg +12 -12
- package/assets/images/menu/dhr/MHRP09N0019.svg +13 -13
- package/assets/images/menu/dhr/MHRP09N0020.svg +17 -17
- package/assets/images/menu/dhr/MHRP09N0021.svg +10 -10
- package/assets/images/menu/dhr/MHRP09N0022.svg +16 -16
- package/assets/images/menu/dhr/MHRP09N0023.svg +8 -8
- package/assets/images/menu/dhr/MHRP09N0024.svg +15 -15
- package/assets/images/menu/dhr/MHRP09N0025.svg +16 -16
- package/assets/images/menu/dhr/MHRP09N0026.svg +13 -13
- package/assets/images/menu/dhr/MHRP09N0027.svg +10 -10
- package/assets/images/menu/dhr/MHRP09N0028.svg +6 -6
- package/assets/images/menu/dhr/MHRP09N0029.svg +14 -14
- package/assets/images/menu/dhr/MHRP09N0030.svg +4 -4
- package/assets/images/menu/dhr/MHRP09N0031.svg +5 -5
- package/assets/images/menu/dhr/MHRP09N0032.svg +7 -7
- package/assets/images/menu/dhr/MHRP13N0001.svg +9 -9
- package/assets/images/menu/dhr/MHRP21N0001.svg +12 -12
- package/assets/images/menu/dhr/MHRP21N0002.svg +13 -13
- package/assets/images/menu/dhr/MHRP25L0101.svg +15 -15
- package/assets/images/menu/dhr/MHRP25L0501.svg +14 -14
- package/assets/images/menu/dhr/MHRP25N0001.svg +13 -13
- package/assets/images/menu/dhr/MHRP25N0002.svg +16 -16
- package/assets/images/menu/dhr/MHRP25N0003.svg +38 -38
- package/assets/images/menu/dhr/MHRP25N0004.svg +17 -17
- package/assets/images/menu/dhr/MHRP25N0005.svg +20 -20
- package/assets/images/menu/dhr/MHRP29N0001.svg +18 -18
- package/assets/images/menu/dhr/MHRP29N0002.svg +15 -15
- package/assets/images/menu/dhr/MHRP29N0003.svg +20 -20
- package/assets/images/menu/dhr/MHRP29N0004.svg +21 -21
- package/assets/images/menu/dhr/MHRP29N0005.svg +21 -21
- package/assets/images/menu/dhr/MHRP29N0006.svg +14 -14
- package/assets/images/menu/dhr/MHRP29N0007.svg +19 -19
- package/assets/images/menu/dhr/MHRP29N0008.svg +20 -20
- package/assets/images/menu/dhr/MHRP29N0009.svg +11 -11
- package/assets/images/menu/dhr/MHRP29N0010.svg +11 -11
- package/assets/images/menu/dhr/MHRP29N0011.svg +12 -12
- package/assets/images/menu/dhr/MHRP29N0012.svg +7 -7
- package/assets/images/menu/dhr/MHRP29N0013.svg +27 -27
- package/assets/images/menu/dhr/MHRP29N0014.svg +32 -32
- package/assets/images/menu/dhr/MHRP29N0016.svg +54 -54
- package/assets/images/menu/dhr/MHRP29N0017.svg +24 -24
- package/assets/images/menu/dhr/MHRP29N0018.svg +44 -44
- package/assets/images/menu/dhr/MHRP29N0019.svg +17 -17
- package/assets/images/menu/dhr/MHRP29N0020.svg +11 -11
- package/assets/images/menu/dhr/MHRP29N0021.svg +8 -8
- package/assets/images/menu/dhr/MHRP29N0022.svg +9 -9
- package/assets/images/menu/dhr/MHRP29N0023.svg +22 -22
- package/assets/images/menu/dhr/MHRP29N0026.svg +13 -13
- package/assets/images/menu/dhr/MHRP29N0027.svg +14 -14
- package/assets/images/menu/dhr/MHRP29N0028.svg +15 -15
- package/assets/images/menu/dhr/MHRP38N0001.svg +13 -13
- package/assets/images/menu/dhr/MHRP38N0002.svg +14 -14
- package/assets/images/menu/dhr/MHRP39N0001.svg +15 -15
- package/assets/images/menu/dhr/MHRP39N0002.svg +13 -13
- package/assets/images/menu/dhr/MHRP39N0003.svg +16 -16
- package/assets/images/menu/dhr/MHRP39N0004.svg +22 -22
- package/assets/images/menu/dhr/MHRP39N0005.svg +16 -16
- package/assets/images/menu/dhr/MHRP39N0006.svg +17 -17
- package/assets/images/menu/dhr/MHRP39N0007.svg +13 -13
- package/assets/images/menu/dhr/MHRP39N0008.svg +3 -3
- package/assets/images/menu/dhr/MHRP39N0009.svg +3 -3
- package/assets/images/menu/dhr/MHRP39N0010.svg +7 -7
- package/assets/images/menu/dhr/MHRP39N0011.svg +7 -7
- package/assets/images/menu/dhr/MHRP39N0013.svg +10 -10
- package/assets/images/menu/dhr/MHRP39N0014.svg +11 -11
- package/assets/images/menu/dhr/MHRP39N0015.svg +5 -5
- package/assets/images/menu/dhr/MHRP39N0017.svg +11 -11
- package/assets/images/menu/dhr/MHRP39N0018.svg +11 -11
- package/assets/images/menu/dhr/MHRP39N1222.svg +12 -12
- package/assets/images/menu/dhr/MHRP51N0001.svg +9 -9
- package/assets/images/menu/dhr/MHRP51N0002.svg +13 -13
- package/assets/images/menu/dhr/MHRP52N0001.svg +21 -21
- package/assets/images/menu/dhr/MHRP52N0002.svg +21 -21
- package/assets/images/menu/dhr/MHRP52N0003.svg +16 -16
- package/assets/images/menu/dhr/MHRP75N0001.svg +19 -19
- package/assets/images/menu/dhr/MHRP75N0002.svg +25 -25
- package/assets/images/menu/dhr/MHRP75N0003.svg +3 -3
- package/assets/images/menu/dhr/MHRP75N0006.svg +14 -14
- package/assets/images/menu/dhr/MHRP75N0007.svg +19 -19
- package/assets/images/menu/dhr/MHRP75N0008.svg +19 -19
- package/assets/images/menu/dhr/MHRP77N0007.svg +28 -28
- package/assets/images/menu/dhr/MHRP77N0008.svg +17 -17
- package/assets/images/menu/dhr/MHRP77N0009.svg +19 -19
- package/assets/images/menu/dhr/MHRP77N0010.svg +20 -20
- package/assets/images/menu/dhr/MHRP89N1000.svg +5 -5
- package/assets/images/menu/dhr/MHRP89N1001.svg +5 -5
- package/assets/images/menu/dhr/TASK.svg +9 -9
- package/assets/images/menu/dhr/W00F0001.svg +3 -3
- package/assets/images/menu/dhr/W00F0002.svg +3 -3
- package/assets/images/menu/dhr/W00F0003.svg +3 -3
- package/assets/images/menu/dhr/W00F0004.svg +3 -3
- package/assets/images/menu/dhr/W09F2000-WEB5.svg +17 -17
- package/assets/images/menu/dhr/W09F2000.svg +4 -4
- package/assets/images/menu/dhr/W09F2002-WEB5.svg +21 -21
- package/assets/images/menu/dhr/W09F2005-WEB5.svg +13 -13
- package/assets/images/menu/dhr/W09F2020-WEB5.svg +16 -16
- package/assets/images/menu/dhr/W09F2022-WEB5.svg +20 -20
- package/assets/images/menu/dhr/W09F2150-WEB5.svg +16 -16
- package/assets/images/menu/dhr/W09F2152-WEB5.svg +20 -20
- package/assets/images/menu/dhr/W09F2160-WEB5.svg +14 -14
- package/assets/images/menu/dhr/W09F2162-WEB5.svg +18 -18
- package/assets/images/menu/dhr/W29F4006-WEB5.svg +19 -19
- package/assets/images/menu/dhr/W75F2260-WEB5.svg +15 -15
- package/assets/images/menu/dhr/W75F2261-WEB5.svg +19 -19
- package/assets/images/menu/dhr/W75F3005-WEB5.svg +13 -13
- package/assets/images/menu/dhr/W75F4070-WEB5.svg +21 -21
- package/assets/images/menu/dhr/W75F4071-WEB5.svg +17 -17
- package/assets/images/menu/dhr/W75F4100-WEB5.svg +14 -14
- package/assets/images/menu/dhr/W77F1011.svg +19 -19
- package/assets/images/menu/dhr/W77F1013.svg +22 -22
- package/assets/images/menu/erp/D05.svg +8 -8
- package/assets/images/menu/erp/D06.svg +4 -4
- package/assets/images/menu/erp/D90R.svg +9 -9
- package/assets/images/menu/erp/DBC.svg +9 -9
- package/assets/images/menu/erp/W00F0001.svg +3 -3
- package/assets/images/menu/erp/W00F0002.svg +3 -3
- package/assets/images/menu/erp/W00F0003.svg +3 -3
- package/assets/images/menu/erp/W00F0004.svg +3 -3
- package/assets/images/menu/erp/W05F0001.svg +16 -16
- package/assets/images/menu/erp/W05F0001N0000.svg +16 -16
- package/assets/images/menu/erp/W05F0004N0000.svg +6 -6
- package/assets/images/menu/erp/W05F0006N0000.svg +30 -30
- package/assets/images/menu/erp/W05F0007N0000.svg +6 -6
- package/assets/images/menu/erp/W05F0008N0000.svg +14 -14
- package/assets/images/menu/erp/W05F0011N0000.svg +20 -20
- package/assets/images/menu/erp/W05F0013N0000.svg +9 -9
- package/assets/images/menu/erp/W05F4000N0000.svg +9 -9
- package/assets/images/menu/erp/W06F0001.svg +17 -17
- package/assets/images/menu/erp/W06F0001N0000.svg +17 -17
- package/assets/images/menu/erp/W06F0004N0000.svg +22 -22
- package/assets/images/menu/erp/W06F0005N0000.svg +22 -22
- package/assets/images/menu/erp/W06F0006N0000.svg +55 -55
- package/assets/images/menu/erp/W06F0008N0000.svg +17 -17
- package/assets/images/menu/erp/W94F1000N0000.svg +9 -9
- package/assets/images/menu/erp/W94F1000N0001.svg +9 -9
- package/assets/images/menu/erp/WA3F1025.svg +5 -5
- package/assets/images/menu/erp/WA3F2100.svg +10 -10
- package/assets/storybook/avatar01.svg +9 -9
- package/assets/storybook/cover01.svg +9 -9
- package/components/accordion/details.js +6 -2
- package/components/accordion/group.js +9 -2
- package/components/accordion/index.js +15 -2
- package/components/accordion/summary.js +27 -4
- package/components/alert/index.js +33 -2
- package/components/alert/notify.js +22 -12
- package/components/avatar/index.js +81 -22
- package/components/badge/index.js +45 -20
- package/components/button/icon.js +56 -25
- package/components/button/index.js +65 -16
- package/components/button/more.js +35 -15
- package/components/button/ripple-effect.js +10 -0
- package/components/card/body.js +7 -2
- package/components/card/extra.js +7 -2
- package/components/card/footer.js +7 -2
- package/components/card/header.js +7 -2
- package/components/card/index.js +22 -2
- package/components/chart/Pie/Circle.js +1 -0
- package/components/chart/Pie/Sector.js +19 -2
- package/components/chart/Pie/Sectors.js +10 -0
- package/components/chart/Pie/index.js +36 -4
- package/components/chart/Pie-v2/Circle.js +1 -0
- package/components/chart/Pie-v2/Sector.js +15 -2
- package/components/chart/Pie-v2/Sectors.js +20 -0
- package/components/chart/Pie-v2/index.js +38 -11
- package/components/chart/bar/Axis.js +12 -0
- package/components/chart/bar/Bar.js +35 -13
- package/components/chart/bar/Grid.js +18 -0
- package/components/chart/bar/Labels.js +18 -0
- package/components/chart/bar/Points.js +17 -0
- package/components/chart/bar/index.js +26 -6
- package/components/chart/bar-v2/Axis.js +12 -0
- package/components/chart/bar-v2/Bar.js +36 -15
- package/components/chart/bar-v2/Grid.js +18 -0
- package/components/chart/bar-v2/Labels.js +18 -0
- package/components/chart/bar-v2/Points.js +17 -0
- package/components/chart/bar-v2/index.js +26 -6
- package/components/chart/line/Axis.js +16 -4
- package/components/chart/line/Grid.js +19 -2
- package/components/chart/line/Labels.js +18 -0
- package/components/chart/line/Path.js +33 -23
- package/components/chart/line/Point.js +40 -6
- package/components/chart/line/Title.js +3 -0
- package/components/chart/line/index.js +35 -12
- package/components/chart/line-v2/Axis.js +13 -0
- package/components/chart/line-v2/Grid.js +18 -0
- package/components/chart/line-v2/Labels.js +18 -0
- package/components/chart/line-v2/Path.js +33 -23
- package/components/chart/line-v2/Point.js +35 -6
- package/components/chart/line-v2/Title.js +3 -0
- package/components/chart/line-v2/index.js +30 -12
- package/components/check-text/index.js +8 -0
- package/components/check-text/interview-confirmation.js +7 -0
- package/components/check-text/interview-status.js +7 -0
- package/components/chip/attach.js +22 -9
- package/components/chip/index.js +33 -6
- package/components/collapse/index.js +13 -0
- package/components/divider/index.js +13 -2
- package/components/form-control/attachment/index.js +202 -41
- package/components/form-control/calendar/function.js +207 -153
- package/components/form-control/calendar/index.js +46 -21
- package/components/form-control/calendar/range.js +28 -11
- package/components/form-control/checkbox/index.js +37 -4
- package/components/form-control/control/index.js +13 -3
- package/components/form-control/date-picker/index-old.js +0 -18
- package/components/form-control/date-picker/index.js +99 -23
- package/components/form-control/date-range-picker/index.js +180 -44
- package/components/form-control/dropdown/index.js +314 -101
- package/components/form-control/dropdown-box/index.js +35 -6
- package/components/form-control/form/index.js +2 -0
- package/components/form-control/form-group/index.js +6 -1
- package/components/form-control/helper-text/index.js +9 -2
- package/components/form-control/input-base/index.js +73 -9
- package/components/form-control/label/index.js +12 -2
- package/components/form-control/money-input/index.js +143 -54
- package/components/form-control/number-input/index.js +124 -26
- package/components/form-control/number-input/index2.js +119 -78
- package/components/form-control/phone-input/index.js +85 -23
- package/components/form-control/radio/index.js +28 -9
- package/components/form-control/text-input/index.js +46 -10
- package/components/form-control/time-picker/index.js +71 -14
- package/components/form-control/time-picker/swiper.js +73 -21
- package/components/form-control/toggle/index.js +23 -8
- package/components/form-view/helper-text.js +2 -2
- package/components/form-view/index.js +14 -0
- package/components/form-view/input.js +13 -2
- package/components/form-view/label.js +2 -0
- package/components/grid/Col.js +16 -2
- package/components/grid/Container.js +21 -2
- package/components/grid/Row.js +21 -2
- package/components/grid/index.js +44 -2
- package/components/image/index.js +22 -2
- package/components/index.js +31 -62
- package/components/list/list-item-action.js +9 -0
- package/components/list/list-item-icon.js +9 -0
- package/components/list/list-item-text.js +5 -0
- package/components/list/list-item.js +11 -0
- package/components/list/list.js +13 -0
- package/components/list/sub-header.js +4 -0
- package/components/modal/body.js +6 -2
- package/components/modal/footer.js +11 -2
- package/components/modal/header.js +12 -2
- package/components/modal/index.js +10 -2
- package/components/modal/modal.js +52 -11
- package/components/others/extra/index.js +10 -3
- package/components/others/import/index.js +7 -0
- package/components/others/option-wrapper/index.js +7 -4
- package/components/others/scrollbar/index.js +3 -0
- package/components/paging/page-info.js +99 -35
- package/components/paging/page-selector.js +35 -7
- package/components/paging/page-selector2.js +74 -35
- package/components/paper/index.js +11 -0
- package/components/popover/body.js +6 -2
- package/components/popover/footer.js +11 -2
- package/components/popover/header.js +7 -2
- package/components/popover/index.js +146 -54
- package/components/popup/danger_popup.js +19 -0
- package/components/popup/index.js +48 -2
- package/components/popup/proposals_popup.js +49 -10
- package/components/popup/v2/index.js +47 -13
- package/components/progress/circular.js +48 -10
- package/components/progress/linear.js +20 -4
- package/components/rating/index.js +32 -8
- package/components/slider/slider-container.js +40 -3
- package/components/slider/slider-item.js +25 -10
- package/components/status/index.js +14 -2
- package/components/tab/tab-container.js +18 -4
- package/components/tab/tab-header.js +24 -4
- package/components/tab/tab-panel.js +16 -4
- package/components/tab/tab.js +30 -6
- package/components/tooltip/index.js +97 -12
- package/components/tooltip/portal.js +2 -0
- package/components/transfer/index.js +70 -25
- package/components/tree-view/index.js +202 -62
- package/components/typography/index.js +70 -47
- package/global/index.js +8 -0
- package/icons/basic.js +232 -0
- package/icons/effect.js +32 -15
- package/icons/general/clock/clock.js +2 -0
- package/icons/general/color-handler/background.js +2 -0
- package/icons/general/color-handler/text.js +2 -0
- package/icons/general/emoji/emoji.js +2 -0
- package/icons/general/font-properties/bold.js +2 -0
- package/icons/general/font-properties/font-family.js +2 -0
- package/icons/general/font-properties/font-size.js +2 -0
- package/icons/general/font-properties/italic.js +2 -0
- package/icons/general/font-properties/underline.js +2 -0
- package/icons/general/hyperlink/hyperlink.js +2 -0
- package/icons/general/indent/decrease.js +2 -0
- package/icons/general/indent/increase.js +2 -0
- package/icons/general/list/bullets.js +2 -0
- package/icons/general/list/numbering.js +2 -0
- package/icons/general/picture/picture.js +2 -0
- package/icons/general/steps/redo.js +2 -0
- package/icons/general/steps/undo.js +2 -0
- package/icons/general/text-align/center.js +2 -0
- package/icons/general/text-align/justify.js +2 -0
- package/icons/general/text-align/left.js +2 -0
- package/icons/general/text-align/right.js +2 -0
- package/icons/menu/dhr.js +1 -2
- package/icons/menu/index.js +2 -2
- package/icons/menu/v2/index.js +15 -2
- package/package.json +42 -42
- package/readme.md +1027 -1022
- package/styles/animation.js +58 -15
- package/styles/color-helper.js +157 -127
- package/styles/colors.js +9 -17
- package/styles/general.js +80 -18
- package/styles/typography.js +4 -4
- package/styles/utils.js +20 -19
- package/theme/createBreakpoints.js +18 -7
- package/theme/make-styles.js +5 -2
- package/theme/set-theme.js +9 -6
- package/theme/settings.js +2 -3
- package/theme/theme-provider.js +1 -0
- package/utils/array/array.js +54 -45
- package/utils/{classNames.js → classNames/index.js} +5 -0
- package/utils/console.js +6 -0
- package/utils/date.js +138 -69
- package/utils/error/error.js +11 -3
- package/utils/error/errors.js +147 -100
- package/utils/getFileType.js +9 -0
- package/utils/handleBreakpoints.js +5 -0
- package/utils/intersectionObserver.js +5 -0
- package/utils/{isMobile.js → isMobile/index.js} +0 -0
- package/utils/iterator.js +9 -0
- package/utils/map-parent.js +10 -3
- package/utils/object/extend.js +10 -0
- package/utils/object/object.js +11 -12
- package/utils/parseHTML.js +1 -0
- package/utils/promisify.js +5 -0
- package/utils/randomString.js +7 -0
- package/utils/remove-unicode.js +1 -0
- package/utils/render-portal.js +9 -1
- package/utils/renderHTML.js +6 -4
- package/utils/renderIcon.js +19 -9
- package/utils/sb-template.js +5 -6
- package/utils/string/capitalize.js +1 -0
- package/utils/string/capitalizeSentenceCase.js +2 -0
- package/utils/string/string.js +13 -0
- package/utils/type.js +21 -0
- package/utils/updatePosition.js +5 -4
- package/utils/useDelayUnmount.js +4 -0
- package/utils/useElementSize.js +3 -9
- package/utils/useEventListener.js +6 -12
- package/utils/useInput.js +6 -0
- package/utils/{useMediaQuery.js → useMediaQuery/index.js} +10 -8
- package/utils/useOnClickOutside.js +4 -2
- package/utils/usePortal.js +19 -12
- package/utils/validate.js +53 -39
package/utils/promisify.js
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
/* eslint-disable no-undef */
|
|
2
2
|
const slice = Array.prototype.slice;
|
|
3
3
|
let Promise;
|
|
4
|
+
|
|
4
5
|
if (typeof window !== 'undefined') {
|
|
5
6
|
Promise = window.Promise;
|
|
6
7
|
}
|
|
8
|
+
|
|
7
9
|
if (typeof global !== 'undefined') {
|
|
8
10
|
Promise = global.Promise;
|
|
9
11
|
}
|
|
12
|
+
|
|
10
13
|
function promisify(func) {
|
|
11
14
|
if (Promise) {
|
|
12
15
|
return function () {
|
|
13
16
|
const args = slice.call(arguments);
|
|
14
17
|
const ctx = this;
|
|
18
|
+
|
|
15
19
|
if (typeof args.slice(-1) === 'function') {
|
|
16
20
|
return func.apply(ctx, args);
|
|
17
21
|
} else {
|
|
@@ -31,4 +35,5 @@ function promisify(func) {
|
|
|
31
35
|
return func;
|
|
32
36
|
}
|
|
33
37
|
}
|
|
38
|
+
|
|
34
39
|
export default promisify;
|
package/utils/randomString.js
CHANGED
|
@@ -6,21 +6,28 @@ export default function getRandomString(length = 10, options = {}) {
|
|
|
6
6
|
allowSymbol = true
|
|
7
7
|
} = options;
|
|
8
8
|
let string = '';
|
|
9
|
+
|
|
9
10
|
if (allowNumber) {
|
|
10
11
|
string += '0123456789';
|
|
11
12
|
}
|
|
13
|
+
|
|
12
14
|
if (allowLowercase) {
|
|
13
15
|
string += 'abcdefghijklmnopqrstuvwxyz';
|
|
14
16
|
}
|
|
17
|
+
|
|
15
18
|
if (allowUppercase) {
|
|
16
19
|
string += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
17
20
|
}
|
|
21
|
+
|
|
18
22
|
if (allowSymbol) {
|
|
19
23
|
string += '@$%^&*_+-';
|
|
20
24
|
}
|
|
25
|
+
|
|
21
26
|
let newString = '';
|
|
27
|
+
|
|
22
28
|
for (let i = 0; i < length; i++) {
|
|
23
29
|
newString += string[Math.floor(Math.random() * string.length)];
|
|
24
30
|
}
|
|
31
|
+
|
|
25
32
|
return newString;
|
|
26
33
|
}
|
package/utils/remove-unicode.js
CHANGED
|
@@ -2,4 +2,5 @@ const removeUnicode = (str, spaceTo = ' ') => {
|
|
|
2
2
|
if (!str || typeof str !== 'string') return str;
|
|
3
3
|
return str.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/gi, "a").replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/gi, "e").replace(/ì|í|ị|ỉ|ĩ/gi, "i").replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/gi, "o").replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/gi, "u").replace(/ỳ|ý|ỵ|ỷ|ỹ/gi, "y").replace(/đ/gi, "d").replaceAll(' ', spaceTo);
|
|
4
4
|
};
|
|
5
|
+
|
|
5
6
|
export default removeUnicode;
|
package/utils/render-portal.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Children } from 'react';
|
|
|
2
2
|
import { render, createPortal } from 'react-dom';
|
|
3
3
|
import { useTheme } from "../theme";
|
|
4
4
|
const idPortal = 'DGN-UI-Portal',
|
|
5
|
-
|
|
5
|
+
classNameCommon = 'DGN-UI-Portal';
|
|
6
6
|
const {
|
|
7
7
|
zIndex
|
|
8
8
|
} = useTheme();
|
|
@@ -16,11 +16,13 @@ export const getPortal = () => {
|
|
|
16
16
|
};
|
|
17
17
|
export const isLastChildNode = node => {
|
|
18
18
|
if (!node) return false;
|
|
19
|
+
|
|
19
20
|
if (typeof node === 'string') {
|
|
20
21
|
node = document.querySelector(node);
|
|
21
22
|
} else {
|
|
22
23
|
node = node.current || node.target || node;
|
|
23
24
|
}
|
|
25
|
+
|
|
24
26
|
const portal = getPortal();
|
|
25
27
|
const length = portal.childNodes.length;
|
|
26
28
|
return length && portal.lastChild.contains(node);
|
|
@@ -32,13 +34,16 @@ export const renderPortal = (node, containers, isCreate = false, options = {}) =
|
|
|
32
34
|
} = options;
|
|
33
35
|
let container = getPortal();
|
|
34
36
|
Object.assign(container, style);
|
|
37
|
+
|
|
35
38
|
if (className) {
|
|
36
39
|
container.classList.add(className);
|
|
37
40
|
}
|
|
41
|
+
|
|
38
42
|
if (containers) {
|
|
39
43
|
containers.classList.add(classNameCommon);
|
|
40
44
|
containers.style.pointerEvents = 'auto';
|
|
41
45
|
container = container.appendChild(containers);
|
|
46
|
+
|
|
42
47
|
if (isCreate) {
|
|
43
48
|
return /*#__PURE__*/createPortal(node, container);
|
|
44
49
|
} else {
|
|
@@ -62,6 +67,7 @@ export const renderPortal = (node, containers, isCreate = false, options = {}) =
|
|
|
62
67
|
parent.classList.add(classNameCommon);
|
|
63
68
|
parent.style.pointerEvents = 'auto';
|
|
64
69
|
container = container.appendChild(parent);
|
|
70
|
+
|
|
65
71
|
if (isCreate) {
|
|
66
72
|
return /*#__PURE__*/createPortal(children, container);
|
|
67
73
|
} else {
|
|
@@ -76,10 +82,12 @@ export const removePortal = node => {
|
|
|
76
82
|
removePortalCommon();
|
|
77
83
|
return true;
|
|
78
84
|
}
|
|
85
|
+
|
|
79
86
|
return false;
|
|
80
87
|
};
|
|
81
88
|
export const removePortalCommon = () => {
|
|
82
89
|
const portals = getPortal();
|
|
90
|
+
|
|
83
91
|
if (!portals.childNodes.length) {
|
|
84
92
|
portals.remove();
|
|
85
93
|
}
|
package/utils/renderHTML.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
|
+
|
|
2
3
|
/** @jsx jsx */
|
|
3
4
|
import { jsx } from '@emotion/core';
|
|
4
5
|
import parseTextToHTML from "./parseHTML";
|
|
6
|
+
|
|
5
7
|
const renderHTML = (text = null, TagName = 'div', options = {}) => {
|
|
6
8
|
if (text && (text.$$typeof && String(text.$$typeof) === 'Symbol(react.element)' || Array.isArray(text) && text.some(node => node && String(node.$$typeof) === 'Symbol(react.element)'))) {
|
|
7
|
-
return jsx(TagName, {
|
|
8
|
-
...options
|
|
9
|
+
return jsx(TagName, { ...options
|
|
9
10
|
}, text);
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
return jsx(TagName, { ...options,
|
|
13
14
|
dangerouslySetInnerHTML: {
|
|
14
15
|
__html: parseTextToHTML(String(text))
|
|
15
16
|
}
|
|
16
17
|
});
|
|
17
18
|
};
|
|
19
|
+
|
|
18
20
|
export default renderHTML;
|
package/utils/renderIcon.js
CHANGED
|
@@ -1,53 +1,63 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
|
+
|
|
2
3
|
/** @jsx jsx */
|
|
3
4
|
import { jsx } from '@emotion/core';
|
|
4
5
|
import { ButtonIcon } from "../components";
|
|
5
6
|
import * as Icons from "../icons";
|
|
6
7
|
import { parseTextToHTML, capitalize } from "./";
|
|
7
|
-
/**
|
|
8
|
-
* render icon form source (dynamic type)
|
|
9
|
-
* @param {String|jsx} source data of icon, maybe svg text | image link | name of icon in icons store or a jsx element
|
|
10
|
-
* @param {String} type text to parse text to HTML, img link to use img tag, name to use icon form icons store
|
|
11
|
-
* @param {Object} options properties of Icon component if us type is name {width, height, color, viewBox, ...}
|
|
8
|
+
/**
|
|
9
|
+
* render icon form source (dynamic type)
|
|
10
|
+
* @param {String|jsx} source data of icon, maybe svg text | image link | name of icon in icons store or a jsx element
|
|
11
|
+
* @param {String} type text to parse text to HTML, img link to use img tag, name to use icon form icons store
|
|
12
|
+
* @param {Object} options properties of Icon component if us type is name {width, height, color, viewBox, ...}
|
|
12
13
|
*/
|
|
14
|
+
|
|
13
15
|
const renderIcon = (source, type, options = {}) => {
|
|
14
16
|
if (typeof source === 'string') {
|
|
15
17
|
switch (type) {
|
|
16
18
|
case 'name':
|
|
17
19
|
{
|
|
18
20
|
let IconComp = Icons[capitalize(source)];
|
|
21
|
+
|
|
19
22
|
if (IconComp) {
|
|
20
|
-
return jsx(IconComp, {
|
|
21
|
-
...options
|
|
23
|
+
return jsx(IconComp, { ...options
|
|
22
24
|
});
|
|
23
25
|
}
|
|
26
|
+
|
|
24
27
|
return null;
|
|
25
28
|
}
|
|
29
|
+
|
|
26
30
|
case 'effect':
|
|
27
31
|
return jsx(ButtonIcon, {
|
|
28
32
|
viewType: 'ghost',
|
|
29
33
|
name: source,
|
|
30
34
|
...options
|
|
31
35
|
});
|
|
36
|
+
|
|
32
37
|
case 'link':
|
|
33
38
|
case 'imgLink':
|
|
34
39
|
return jsx("img", {
|
|
35
40
|
src: source,
|
|
36
41
|
...options
|
|
37
42
|
});
|
|
43
|
+
|
|
38
44
|
default:
|
|
39
45
|
if (source.length < 20) {
|
|
40
46
|
const IconComp = Icons[capitalize(source)];
|
|
47
|
+
|
|
41
48
|
if (IconComp) {
|
|
42
|
-
return jsx(IconComp, {
|
|
43
|
-
...options
|
|
49
|
+
return jsx(IconComp, { ...options
|
|
44
50
|
});
|
|
45
51
|
}
|
|
52
|
+
|
|
46
53
|
return null;
|
|
47
54
|
}
|
|
55
|
+
|
|
48
56
|
return parseTextToHTML(source, options.output || options);
|
|
49
57
|
}
|
|
50
58
|
}
|
|
59
|
+
|
|
51
60
|
return source;
|
|
52
61
|
};
|
|
62
|
+
|
|
53
63
|
export default renderIcon;
|
package/utils/sb-template.js
CHANGED
|
@@ -40,8 +40,7 @@ export const Template = ({
|
|
|
40
40
|
${alignMap.get(align)};
|
|
41
41
|
`
|
|
42
42
|
}, [{}, ...propsCustom].map((itemProps, indexProps) => {
|
|
43
|
-
const argsTemp = {
|
|
44
|
-
...args,
|
|
43
|
+
const argsTemp = { ...args,
|
|
45
44
|
...itemProps
|
|
46
45
|
};
|
|
47
46
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
@@ -49,11 +48,11 @@ export const Template = ({
|
|
|
49
48
|
disabled: disabledTooltip,
|
|
50
49
|
key: indexProps,
|
|
51
50
|
title: JSON.stringify(argsTemp)
|
|
52
|
-
}, /*#__PURE__*/React.createElement(Component, {
|
|
53
|
-
...argsTemp
|
|
51
|
+
}, /*#__PURE__*/React.createElement(Component, { ...argsTemp
|
|
54
52
|
}));
|
|
55
53
|
})))));
|
|
56
54
|
};
|
|
55
|
+
|
|
57
56
|
const StoryBookTemplate = ({
|
|
58
57
|
args,
|
|
59
58
|
component,
|
|
@@ -80,8 +79,7 @@ const StoryBookTemplate = ({
|
|
|
80
79
|
key: idx,
|
|
81
80
|
horizontal: horizontal,
|
|
82
81
|
title: title,
|
|
83
|
-
args: {
|
|
84
|
-
...args,
|
|
82
|
+
args: { ...args,
|
|
85
83
|
...argsExtra
|
|
86
84
|
},
|
|
87
85
|
component: component,
|
|
@@ -91,6 +89,7 @@ const StoryBookTemplate = ({
|
|
|
91
89
|
});
|
|
92
90
|
})));
|
|
93
91
|
};
|
|
92
|
+
|
|
94
93
|
Template.defaultProps = {
|
|
95
94
|
propsCustom: [],
|
|
96
95
|
disabledTooltip: false,
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import capitalize from "./capitalize";
|
|
2
2
|
export default function capitalizeSentenceCase(string, separator = ' ') {
|
|
3
3
|
const sentence = string.toLowerCase().split(`${separator}`);
|
|
4
|
+
|
|
4
5
|
for (let i in sentence) {
|
|
5
6
|
sentence[i] = capitalize(sentence[i]);
|
|
6
7
|
}
|
|
8
|
+
|
|
7
9
|
return sentence.join(`${separator}`);
|
|
8
10
|
}
|
package/utils/string/string.js
CHANGED
|
@@ -3,36 +3,46 @@ export const encodeHtml = str => {
|
|
|
3
3
|
const encodeRegExp = [new RegExp('&', 'g'), new RegExp('"', 'g'), new RegExp("'", 'g'), new RegExp('<', 'g'), new RegExp('>', 'g')];
|
|
4
4
|
return String(str).replace(encodeRegExp[0], '&').replace(encodeRegExp[1], '"').replace(encodeRegExp[2], ''').replace(encodeRegExp[3], '<').replace(encodeRegExp[4], '>');
|
|
5
5
|
};
|
|
6
|
+
|
|
6
7
|
const splitQuad = raw => {
|
|
7
8
|
switch (typeof raw) {
|
|
8
9
|
case 'string':
|
|
9
10
|
return raw.split(/\s+/, 4);
|
|
11
|
+
|
|
10
12
|
case 'object':
|
|
11
13
|
return [raw.x || raw.h || raw.left, raw.y || raw.v || raw.top, raw.x || raw.h || raw.right, raw.y || raw.v || raw.bottom];
|
|
14
|
+
|
|
12
15
|
case 'number':
|
|
13
16
|
return [raw];
|
|
17
|
+
|
|
14
18
|
default:
|
|
15
19
|
return raw;
|
|
16
20
|
}
|
|
17
21
|
};
|
|
22
|
+
|
|
18
23
|
export const quadToObject = raw => {
|
|
19
24
|
const quad = splitQuad(raw);
|
|
20
25
|
let left = parseInt(quad && quad[0], 10);
|
|
21
26
|
let top = parseInt(quad && quad[1], 10);
|
|
22
27
|
let right = parseInt(quad && quad[2], 10);
|
|
23
28
|
let bottom = parseInt(quad && quad[3], 10);
|
|
29
|
+
|
|
24
30
|
if (!isFinite(left)) {
|
|
25
31
|
left = 0;
|
|
26
32
|
}
|
|
33
|
+
|
|
27
34
|
if (!isFinite(top)) {
|
|
28
35
|
top = left;
|
|
29
36
|
}
|
|
37
|
+
|
|
30
38
|
if (!isFinite(right)) {
|
|
31
39
|
right = left;
|
|
32
40
|
}
|
|
41
|
+
|
|
33
42
|
if (!isFinite(bottom)) {
|
|
34
43
|
bottom = top;
|
|
35
44
|
}
|
|
45
|
+
|
|
36
46
|
return {
|
|
37
47
|
top: top,
|
|
38
48
|
right: right,
|
|
@@ -44,10 +54,12 @@ export const format = (template, ...values) => {
|
|
|
44
54
|
if (isFunction(template)) {
|
|
45
55
|
return template(...values);
|
|
46
56
|
}
|
|
57
|
+
|
|
47
58
|
values.forEach((value, index) => {
|
|
48
59
|
if (isString(value)) {
|
|
49
60
|
value = value.replace(/\$/g, '$$$$');
|
|
50
61
|
}
|
|
62
|
+
|
|
51
63
|
const placeholderReg = new RegExp('\\{' + index + '\\}', 'gm');
|
|
52
64
|
template = template.replace(placeholderReg, value);
|
|
53
65
|
});
|
|
@@ -56,5 +68,6 @@ export const format = (template, ...values) => {
|
|
|
56
68
|
export const replaceAll = (() => {
|
|
57
69
|
const quote = str => (str + '').replace(/([+*?.[^\]$(){}><|=!:])/g, '\\$1'); // lgtm[js/incomplete-sanitization]
|
|
58
70
|
|
|
71
|
+
|
|
59
72
|
return (text, searchToken, replacementToken) => text.replace(new RegExp('(' + quote(searchToken) + ')', 'gi'), replacementToken);
|
|
60
73
|
})();
|
package/utils/type.js
CHANGED
|
@@ -5,65 +5,86 @@ const types = {
|
|
|
5
5
|
'[object String]': 'string',
|
|
6
6
|
'[object Null]': 'null'
|
|
7
7
|
};
|
|
8
|
+
|
|
8
9
|
const type = object => {
|
|
9
10
|
const typeOfObject = Object.prototype.toString.call(object);
|
|
10
11
|
return typeof object === 'object' ? types[typeOfObject] || 'object' : typeof object;
|
|
11
12
|
};
|
|
13
|
+
|
|
12
14
|
const isBoolean = object => {
|
|
13
15
|
return typeof object === 'boolean';
|
|
14
16
|
};
|
|
17
|
+
|
|
15
18
|
const isExponential = value => {
|
|
16
19
|
return isNumeric(value) && value.toString().indexOf('e') !== -1;
|
|
17
20
|
};
|
|
21
|
+
|
|
18
22
|
const isDate = object => {
|
|
19
23
|
return type(object) === 'date';
|
|
20
24
|
};
|
|
25
|
+
|
|
21
26
|
const isDefined = object => {
|
|
22
27
|
return object !== null && object !== undefined;
|
|
23
28
|
};
|
|
29
|
+
|
|
24
30
|
const isFunction = object => {
|
|
25
31
|
return typeof object === 'function';
|
|
26
32
|
};
|
|
33
|
+
|
|
27
34
|
const isString = object => {
|
|
28
35
|
return typeof object === 'string';
|
|
29
36
|
};
|
|
37
|
+
|
|
30
38
|
const isNumeric = object => {
|
|
31
39
|
return typeof object === 'number' && isFinite(object) || !isNaN(object - parseFloat(object));
|
|
32
40
|
};
|
|
41
|
+
|
|
33
42
|
const isObject = object => {
|
|
34
43
|
return type(object) === 'object';
|
|
35
44
|
};
|
|
45
|
+
|
|
36
46
|
const isEmptyObject = object => {
|
|
37
47
|
let property;
|
|
48
|
+
|
|
38
49
|
for (property in object) {
|
|
39
50
|
return false;
|
|
40
51
|
}
|
|
52
|
+
|
|
41
53
|
return true;
|
|
42
54
|
};
|
|
55
|
+
|
|
43
56
|
const isPlainObject = object => {
|
|
44
57
|
if (!object || Object.prototype.toString.call(object) !== '[object Object]') {
|
|
45
58
|
return false;
|
|
46
59
|
}
|
|
60
|
+
|
|
47
61
|
const proto = Object.getPrototypeOf(object);
|
|
48
62
|
const ctor = Object.hasOwnProperty.call(proto, 'constructor') && proto.constructor;
|
|
49
63
|
return typeof ctor === 'function' && Object.toString.call(ctor) === Object.toString.call(Object);
|
|
50
64
|
};
|
|
65
|
+
|
|
51
66
|
const isPrimitive = value => {
|
|
52
67
|
return ['object', 'array', 'function'].indexOf(type(value)) === -1;
|
|
53
68
|
};
|
|
69
|
+
|
|
54
70
|
const isWindow = object => {
|
|
55
71
|
return object != null && object === object.window;
|
|
56
72
|
};
|
|
73
|
+
|
|
57
74
|
const isRenderer = object => {
|
|
58
75
|
return !!(object.jquery || object.dxRenderer);
|
|
59
76
|
};
|
|
77
|
+
|
|
60
78
|
const isPromise = object => {
|
|
61
79
|
return object && isFunction(object.then);
|
|
62
80
|
};
|
|
81
|
+
|
|
63
82
|
const isDeferred = object => {
|
|
64
83
|
return object && isFunction(object.done) && isFunction(object.fail);
|
|
65
84
|
};
|
|
85
|
+
|
|
66
86
|
const isEvent = object => {
|
|
67
87
|
return !!(object && object.preventDefault);
|
|
68
88
|
};
|
|
89
|
+
|
|
69
90
|
export { isBoolean, isExponential, isDate, isDefined, isFunction, isString, isNumeric, isObject, isEmptyObject, isPlainObject, isPrimitive, isWindow, isRenderer, isPromise, isDeferred, type, isEvent };
|
package/utils/updatePosition.js
CHANGED
|
@@ -11,8 +11,8 @@ const updatePosition = (anchorEl, transformEl, cb) => {
|
|
|
11
11
|
} = window;
|
|
12
12
|
const {
|
|
13
13
|
height: nodeHeight
|
|
14
|
-
} = transformEl.getBoundingClientRect();
|
|
15
|
-
|
|
14
|
+
} = transformEl.getBoundingClientRect(); // Vertical
|
|
15
|
+
|
|
16
16
|
if (bottom < 0 || top > innerHeight) {
|
|
17
17
|
cb === null || cb === void 0 ? void 0 : cb();
|
|
18
18
|
} else if (bottom + 4 + nodeHeight > innerHeight) {
|
|
@@ -23,13 +23,14 @@ const updatePosition = (anchorEl, transformEl, cb) => {
|
|
|
23
23
|
}
|
|
24
24
|
} else {
|
|
25
25
|
transformEl.style.top = bottom + 4 + 'px';
|
|
26
|
-
}
|
|
26
|
+
} // Horizontal
|
|
27
|
+
|
|
27
28
|
|
|
28
|
-
// Horizontal
|
|
29
29
|
if (left < 0 || right > innerWidth) {
|
|
30
30
|
cb === null || cb === void 0 ? void 0 : cb();
|
|
31
31
|
} else {
|
|
32
32
|
transformEl.style.left = left + 'px';
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
|
+
|
|
35
36
|
export default updatePosition;
|
package/utils/useDelayUnmount.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { useState, useEffect } from 'react';
|
|
2
|
+
|
|
2
3
|
const useDelayUnmount = (isMounted, delayTime) => {
|
|
3
4
|
const [show, setShow] = useState(false);
|
|
4
5
|
useEffect(() => {
|
|
5
6
|
let timeoutId;
|
|
7
|
+
|
|
6
8
|
if (isMounted && !show) {
|
|
7
9
|
setShow(true);
|
|
8
10
|
} else if (!isMounted && show) {
|
|
9
11
|
timeoutId = setTimeout(() => setShow(false), delayTime);
|
|
10
12
|
}
|
|
13
|
+
|
|
11
14
|
return () => clearTimeout(timeoutId);
|
|
12
15
|
}, [isMounted, delayTime, show]);
|
|
13
16
|
return show;
|
|
14
17
|
};
|
|
18
|
+
|
|
15
19
|
export default useDelayUnmount;
|
package/utils/useElementSize.js
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
import { useCallback, useLayoutEffect, useState } from 'react';
|
|
2
|
-
import { useEventListener } from "./useEventListener";
|
|
3
|
-
|
|
4
|
-
// Usage:
|
|
2
|
+
import { useEventListener } from "./useEventListener"; // Usage:
|
|
5
3
|
// export const Component = () => {
|
|
6
4
|
// const [isVisible, setVisible] = useState(true);
|
|
7
5
|
// const [squareRef, { width, height }] = useElementSize();
|
|
8
|
-
|
|
9
6
|
// const toggleVisibility = () => setVisible(x => !x);
|
|
10
|
-
|
|
11
7
|
// return (
|
|
12
8
|
// <>
|
|
13
9
|
// <p>{`The square width is ${width}px and height ${height}px`}</p>
|
|
14
10
|
// <p>Try, resize your window and-or click on the button.</p>
|
|
15
|
-
|
|
16
11
|
// <button onClick={toggleVisibility}>{isVisible ? 'Hide' : 'Show'} square</button>
|
|
17
|
-
|
|
18
12
|
// {isVisible && (
|
|
19
13
|
// <div
|
|
20
14
|
// ref={squareRef}
|
|
@@ -38,8 +32,8 @@ export const useElementSize = () => {
|
|
|
38
32
|
const [size, setSize] = useState({
|
|
39
33
|
width: 0,
|
|
40
34
|
height: 0
|
|
41
|
-
});
|
|
42
|
-
|
|
35
|
+
}); // Prevent too many rendering using useCallback
|
|
36
|
+
|
|
43
37
|
const handleSize = useCallback(() => {
|
|
44
38
|
setSize({
|
|
45
39
|
width: (ref === null || ref === void 0 ? void 0 : ref.offsetWidth) || 0,
|
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
import { useEffect, useLayoutEffect, useRef } from 'react';
|
|
2
|
-
|
|
3
|
-
// Usage:
|
|
1
|
+
import { useEffect, useLayoutEffect, useRef } from 'react'; // Usage:
|
|
4
2
|
// export const Component = () => {
|
|
5
3
|
// // Define button ref
|
|
6
4
|
// const buttonRef = useRef < HTMLButtonElement > null;
|
|
7
|
-
|
|
8
5
|
// const onScroll = (event: Event) => {
|
|
9
6
|
// console.log("window scrolled!", event);
|
|
10
7
|
// };
|
|
11
|
-
|
|
12
8
|
// const onClick = (event: Event) => {
|
|
13
9
|
// console.log("button clicked!", event);
|
|
14
10
|
// };
|
|
15
|
-
|
|
16
11
|
// // example with window based event
|
|
17
12
|
// useEventListener("scroll", onScroll);
|
|
18
|
-
|
|
19
13
|
// // example with element based event
|
|
20
14
|
// useEventListener("click", onClick, buttonRef);
|
|
21
|
-
|
|
22
15
|
// return (
|
|
23
16
|
// <div style={{ minHeight: "200vh" }}>
|
|
24
17
|
// <button ref={buttonRef}>Click me</button>
|
|
@@ -35,15 +28,16 @@ export const useEventListener = (eventName, handler, element) => {
|
|
|
35
28
|
useEffect(() => {
|
|
36
29
|
// Define the listening target
|
|
37
30
|
const targetElement = (element === null || element === void 0 ? void 0 : element.current) || window;
|
|
31
|
+
|
|
38
32
|
if (!(targetElement && targetElement.addEventListener)) {
|
|
39
33
|
return;
|
|
40
|
-
}
|
|
34
|
+
} // Create event listener that calls handler function stored in ref
|
|
35
|
+
|
|
41
36
|
|
|
42
|
-
// Create event listener that calls handler function stored in ref
|
|
43
37
|
const eventListener = event => savedHandler.current(event);
|
|
44
|
-
targetElement.addEventListener(eventName, eventListener);
|
|
45
38
|
|
|
46
|
-
// Remove event listener on cleanup
|
|
39
|
+
targetElement.addEventListener(eventName, eventListener); // Remove event listener on cleanup
|
|
40
|
+
|
|
47
41
|
return () => {
|
|
48
42
|
targetElement.removeEventListener(eventName, eventListener);
|
|
49
43
|
};
|
package/utils/useInput.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
|
|
2
3
|
const useInput = (defaultValue, valueProp, onChange, onInput, delayOnChange) => {
|
|
3
4
|
const [value, setValue] = useState(defaultValue || valueProp);
|
|
4
5
|
const timer = useRef(null);
|
|
@@ -6,20 +7,24 @@ const useInput = (defaultValue, valueProp, onChange, onInput, delayOnChange) =>
|
|
|
6
7
|
useEffect(() => {
|
|
7
8
|
setValue(valueProp);
|
|
8
9
|
}, [valueProp]);
|
|
10
|
+
|
|
9
11
|
const _onChange = e => {
|
|
10
12
|
e.persist();
|
|
11
13
|
if (timer.current) clearTimeout(timer.current);
|
|
12
14
|
timer.current = setTimeout(() => {
|
|
13
15
|
const valueInput = e.target.value || e.value;
|
|
14
16
|
setValue(valueInput);
|
|
17
|
+
|
|
15
18
|
e.reset = () => {
|
|
16
19
|
setValue(valueProp);
|
|
17
20
|
e.target.value = valueProp;
|
|
18
21
|
onInput === null || onInput === void 0 ? void 0 : onInput(e);
|
|
19
22
|
};
|
|
23
|
+
|
|
20
24
|
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
21
25
|
}, delayOnChange);
|
|
22
26
|
};
|
|
27
|
+
|
|
23
28
|
return {
|
|
24
29
|
value,
|
|
25
30
|
setValue,
|
|
@@ -30,4 +35,5 @@ const useInput = (defaultValue, valueProp, onChange, onInput, delayOnChange) =>
|
|
|
30
35
|
}
|
|
31
36
|
};
|
|
32
37
|
};
|
|
38
|
+
|
|
33
39
|
export default useInput;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
// Usage:
|
|
1
|
+
import { useEffect, useState } from 'react'; // Usage:
|
|
4
2
|
// export default function Component() {
|
|
5
3
|
// const matches = useMediaQuery('(min-width: 768px)');
|
|
6
4
|
// return <div>{`The view port is ${matches ? 'at least' : 'less than'} 768 pixels wide`}</div>;
|
|
@@ -12,25 +10,28 @@ const useMediaQuery = query => {
|
|
|
12
10
|
if (typeof window !== 'undefined') {
|
|
13
11
|
return window.matchMedia(query).matches;
|
|
14
12
|
}
|
|
13
|
+
|
|
15
14
|
return false;
|
|
16
15
|
};
|
|
16
|
+
|
|
17
17
|
const [matches, setMatches] = useState(getMatches(query));
|
|
18
|
+
|
|
18
19
|
const handleChange = () => {
|
|
19
20
|
setMatches(getMatches(query));
|
|
20
21
|
};
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
const matchMedia = window.matchMedia(query);
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const matchMedia = window.matchMedia(query); // Triggered at the first client-side load and if query changes
|
|
26
25
|
|
|
27
|
-
// Listen matchMedia
|
|
26
|
+
handleChange(); // Listen matchMedia
|
|
28
27
|
// TODO: Use `addEventListener` once support for Safari < 14 is dropped
|
|
28
|
+
|
|
29
29
|
if (matchMedia.addListener) {
|
|
30
30
|
matchMedia.addListener(handleChange);
|
|
31
31
|
} else {
|
|
32
32
|
matchMedia.addEventListener('change', handleChange);
|
|
33
33
|
}
|
|
34
|
+
|
|
34
35
|
return () => {
|
|
35
36
|
if (matchMedia.removeListener) {
|
|
36
37
|
matchMedia.removeListener(handleChange);
|
|
@@ -41,4 +42,5 @@ const useMediaQuery = query => {
|
|
|
41
42
|
}, [query]);
|
|
42
43
|
return matches;
|
|
43
44
|
};
|
|
45
|
+
|
|
44
46
|
export default useMediaQuery;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* https://usehooks.com/useOnClickOutside/
|
|
1
|
+
/**
|
|
2
|
+
* https://usehooks.com/useOnClickOutside/
|
|
3
3
|
*/
|
|
4
4
|
import { useEffect } from 'react';
|
|
5
5
|
export default function useOnClickOutside(ref, handler) {
|
|
@@ -9,8 +9,10 @@ export default function useOnClickOutside(ref, handler) {
|
|
|
9
9
|
if (!ref.current || ref.current.contains(event.target)) {
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
|
+
|
|
12
13
|
handler(event);
|
|
13
14
|
};
|
|
15
|
+
|
|
14
16
|
document.addEventListener('mousedown', listener);
|
|
15
17
|
document.addEventListener('touchstart', listener);
|
|
16
18
|
return () => {
|