@nutui/nutui-react 3.0.0-beta.6 → 3.0.0-beta.8

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.
Files changed (88) hide show
  1. package/README.md +39 -9
  2. package/dist/cjs/packages/address/style/style.css +56 -89
  3. package/dist/cjs/packages/animate/style/animate.scss +0 -3
  4. package/dist/cjs/packages/animate/style/style.css +0 -3
  5. package/dist/cjs/packages/animatingnumbers/style/style.css +1 -1
  6. package/dist/cjs/packages/backtop/backtop.d.ts +2 -2
  7. package/dist/cjs/packages/backtop/backtop.js +14 -21
  8. package/dist/cjs/packages/backtop/style/backtop.scss +8 -17
  9. package/dist/cjs/packages/backtop/style/style.css +8 -14
  10. package/dist/cjs/packages/badge/badge.d.ts +2 -12
  11. package/dist/cjs/packages/badge/badge.js +12 -23
  12. package/dist/cjs/packages/badge/index.d.ts +1 -1
  13. package/dist/cjs/packages/badge/style/badge.scss +61 -34
  14. package/dist/cjs/packages/badge/style/style.css +63 -40
  15. package/dist/cjs/packages/badge/types.d.ts +12 -0
  16. package/dist/cjs/packages/badge/types.js +4 -0
  17. package/dist/cjs/packages/cascader/style/style.css +49 -85
  18. package/dist/cjs/packages/configprovider/types.d.ts +1 -1
  19. package/dist/cjs/packages/countdown/style/countdown.scss +21 -2
  20. package/dist/cjs/packages/countdown/style/style.css +20 -2
  21. package/dist/cjs/packages/countup/style/countup.scss +1 -1
  22. package/dist/cjs/packages/countup/style/style.css +1 -1
  23. package/dist/cjs/packages/elevator/style/elevator.scss +7 -4
  24. package/dist/cjs/packages/elevator/style/style.css +7 -4
  25. package/dist/cjs/packages/hoverbutton/style/style.css +3 -3
  26. package/dist/cjs/packages/hoverbuttonitem/style/hoverbuttonitem.scss +3 -3
  27. package/dist/cjs/packages/hoverbuttonitem/style/style.css +3 -3
  28. package/dist/cjs/packages/inputnumber/style/inputnumber.scss +19 -16
  29. package/dist/cjs/packages/inputnumber/style/style.css +21 -19
  30. package/dist/cjs/packages/numberkeyboard/style/numberkeyboard.scss +10 -1
  31. package/dist/cjs/packages/numberkeyboard/style/style.css +12 -0
  32. package/dist/cjs/packages/popover/style/popover.scss +16 -11
  33. package/dist/cjs/packages/popover/style/style.css +14 -2
  34. package/dist/cjs/packages/tabbar/style/style.css +63 -40
  35. package/dist/cjs/packages/tabbaritem/style/style.css +63 -40
  36. package/dist/cjs/packages/tabs/style/style.css +49 -85
  37. package/dist/cjs/packages/tabs/style/tabs.scss +68 -106
  38. package/dist/cjs/packages/tour/style/style.css +14 -2
  39. package/dist/cjs/packages/video/video.d.ts +6 -2
  40. package/dist/cjs/packages/video/video.js +16 -2
  41. package/dist/es/packages/address/style/style.css +56 -89
  42. package/dist/es/packages/animate/style/animate.scss +0 -3
  43. package/dist/es/packages/animate/style/style.css +0 -3
  44. package/dist/es/packages/animatingnumbers/style/style.css +1 -1
  45. package/dist/es/packages/backtop/backtop.d.ts +2 -2
  46. package/dist/es/packages/backtop/backtop.js +15 -22
  47. package/dist/es/packages/backtop/style/backtop.scss +8 -17
  48. package/dist/es/packages/backtop/style/style.css +8 -14
  49. package/dist/es/packages/badge/badge.d.ts +2 -12
  50. package/dist/es/packages/badge/badge.js +12 -23
  51. package/dist/es/packages/badge/index.d.ts +1 -1
  52. package/dist/es/packages/badge/style/badge.scss +61 -34
  53. package/dist/es/packages/badge/style/style.css +63 -40
  54. package/dist/es/packages/badge/types.d.ts +12 -0
  55. package/dist/es/packages/badge/types.js +1 -0
  56. package/dist/es/packages/cascader/style/style.css +49 -85
  57. package/dist/es/packages/configprovider/types.d.ts +1 -1
  58. package/dist/es/packages/countdown/style/countdown.scss +21 -2
  59. package/dist/es/packages/countdown/style/style.css +20 -2
  60. package/dist/es/packages/countup/style/countup.scss +1 -1
  61. package/dist/es/packages/countup/style/style.css +1 -1
  62. package/dist/es/packages/elevator/style/elevator.scss +7 -4
  63. package/dist/es/packages/elevator/style/style.css +7 -4
  64. package/dist/es/packages/hoverbutton/style/style.css +3 -3
  65. package/dist/es/packages/hoverbuttonitem/style/hoverbuttonitem.scss +3 -3
  66. package/dist/es/packages/hoverbuttonitem/style/style.css +3 -3
  67. package/dist/es/packages/inputnumber/style/inputnumber.scss +19 -16
  68. package/dist/es/packages/inputnumber/style/style.css +21 -19
  69. package/dist/es/packages/numberkeyboard/numberkeyboard.d.ts +10 -50
  70. package/dist/es/packages/numberkeyboard/style/numberkeyboard.scss +10 -1
  71. package/dist/es/packages/numberkeyboard/style/style.css +12 -0
  72. package/dist/es/packages/popover/style/popover.scss +16 -11
  73. package/dist/es/packages/popover/style/style.css +14 -2
  74. package/dist/es/packages/tabbar/style/style.css +63 -40
  75. package/dist/es/packages/tabbaritem/style/style.css +63 -40
  76. package/dist/es/packages/tabpane/tabpane.d.ts +3 -15
  77. package/dist/es/packages/tabs/style/style.css +49 -85
  78. package/dist/es/packages/tabs/style/tabs.scss +68 -106
  79. package/dist/es/packages/tabs/tabs.d.ts +12 -60
  80. package/dist/es/packages/tour/style/style.css +14 -2
  81. package/dist/es/packages/video/video.d.ts +6 -2
  82. package/dist/es/packages/video/video.js +16 -2
  83. package/dist/nutui.react.umd.js +167 -185
  84. package/dist/style.css +1 -1
  85. package/dist/styles/theme-dark.scss +2 -0
  86. package/dist/styles/theme-default.scss +2 -0
  87. package/dist/styles/variables.scss +36 -29
  88. package/package.json +2 -2
package/README.md CHANGED
@@ -71,25 +71,55 @@ pnpm run dev
71
71
  # visit in browser: http:http://localhost:3000 (you don't have to open it manually if you've run it in the browser again)
72
72
  ```
73
73
 
74
- ### running with mini-program
74
+ ### running with Taro
75
75
 
76
76
  ```sh
77
- # Clone repository
77
+ # Clone the repository
78
78
  git clone https://github.com/jdf2e/nutui-react.git
79
79
 
80
- # Enter the project dictionary
80
+ # Navigate to the project root directory
81
81
  cd nutui-react
82
82
 
83
83
  # Install dependencies
84
84
  pnpm install
85
85
 
86
- # Start development
87
- # dir:packages/nutui-taro-demo/dist/weapp
88
- pnpm run dev:taro:weapp
86
+ # Enter mini-program development mode
87
+ # Taro H5
88
+ pnpm dev:taro h5
89
+ # WeChat Mini Program
90
+ pnpm dev:taro weapp
91
+ # JD Mini Program
92
+ pnpm dev:taro jd
93
+ # For other platforms, refer to the scripts in the package.json file in the demo directory
94
+ ```
95
+
96
+ ### running with JDTaro
97
+
98
+ 1. Add a .npmrc file in the root directory of the repository with the following configuration:
99
+
100
+ ```shell
101
+ git-branch-lockfile=true
102
+ ```
103
+
104
+ ```sh
105
+ # Clone the repository
106
+ git clone https://github.com/jdf2e/nutui-react.git
107
+
108
+ # Navigate to the project root directory
109
+ cd nutui-react
110
+
111
+ # Install dependencies
112
+ pnpm install
89
113
 
90
- # OR run as jd mini-program
91
- # dir:packages/nutui-taro-demo/dist/jd
92
- pnpm run dev:taro:jd
114
+ # Enter mini-program development mode
115
+ # Taro H5
116
+ pnpm dev:jdtaro h5
117
+ # WeChat Mini Program
118
+ pnpm dev:jdtaro weapp
119
+ # JD Mini Program
120
+ pnpm dev:jdtaro jd
121
+ # harmony cpp
122
+ pnpm dev:jdtaro:jdharmonycpp
93
123
  ```
94
124
 
95
125
  ## Build Versions
@@ -51,6 +51,8 @@
51
51
  color: var(--nutui-color-primary, #ff0f23);
52
52
  }
53
53
  .nut-elevator-list-fixed {
54
+ display: flex;
55
+ align-items: center;
54
56
  width: 100%;
55
57
  position: absolute;
56
58
  top: 0;
@@ -58,14 +60,15 @@
58
60
  z-index: 1;
59
61
  padding: var(--nutui-elevator-list-item-padding, 0 20px);
60
62
  height: var(--nutui-elevator-list-item-code-height, 35px);
61
- line-height: var(--nutui-elevator-list-item-code-line-height, 35px);
62
- font-size: var(--nutui-elevator-list-item-code-font-size, var(--nutui-font-size-base, 14px));
63
- color: var(--nutui-elevator-list-fixed-color, var(--nutui-color-primary, #ff0f23));
64
- font-weight: var(--nutui-elevator-list-item-code-font-weight, var(--nutui-font-weight-bold, 600));
65
63
  background-color: var(--nutui-elevator-list-fixed-bg-color, #ffffff);
66
64
  box-sizing: border-box;
67
65
  box-shadow: var(--nutui-elevator-list-fixed-box-shadow, 0 0 10px #eee);
68
66
  }
67
+ .nut-elevator-list-fixed-title {
68
+ font-size: var(--nutui-elevator-list-item-code-font-size, var(--nutui-font-size-base, 14px));
69
+ color: var(--nutui-elevator-list-fixed-color, var(--nutui-color-primary, #ff0f23));
70
+ font-weight: var(--nutui-elevator-list-item-code-font-weight, var(--nutui-font-weight-bold, 600));
71
+ }
69
72
  .nut-elevator-code-current {
70
73
  position: absolute;
71
74
  right: var(--nutui-elevator-list-item-code-current-right, 60px);
@@ -544,12 +547,17 @@
544
547
  display: flex;
545
548
  }
546
549
 
550
+ .nut-tabs-horizontal {
551
+ flex-direction: column;
552
+ }
553
+
547
554
  .nut-tabs-titles {
548
555
  display: flex;
549
556
  box-sizing: border-box;
550
557
  height: var(--nutui-tabs-titles-height, 44px);
551
558
  user-select: none;
552
- overflow: hidden;
559
+ overflow-x: auto;
560
+ overflow-y: hidden;
553
561
  background: var(--nutui-tabs-titles-background-color, var(--nutui-color-background, #f5f6fa));
554
562
  scrollbar-width: none;
555
563
  }
@@ -560,7 +568,6 @@
560
568
  }
561
569
  .nut-tabs-titles .nut-tabs-list {
562
570
  width: 100%;
563
- height: auto;
564
571
  display: flex;
565
572
  flex-shrink: 0;
566
573
  }
@@ -576,10 +583,6 @@
576
583
  .nut-tabs-titles-right .nut-tabs-titles-item {
577
584
  padding: 0 22px;
578
585
  }
579
- .nut-tabs-titles-scrollable {
580
- overflow-x: auto;
581
- overflow-y: hidden;
582
- }
583
586
  .nut-tabs-titles-item {
584
587
  position: relative;
585
588
  display: flex;
@@ -595,11 +598,14 @@
595
598
  text-overflow: ellipsis;
596
599
  white-space: nowrap;
597
600
  }
601
+ .nut-tabs-titles-item .nut-icon {
602
+ color: var(--nutui-tabs-titles-item-color, var(--nutui-color-title, #1a1a1a));
603
+ }
598
604
  .nut-tabs-titles-item-left, .nut-tabs-titles-item-right {
599
605
  flex: none;
600
606
  }
601
607
  .nut-tabs-titles-item-text {
602
- text-align: center;
608
+ color: var(--nutui-tabs-titles-item-color, var(--nutui-color-title, #1a1a1a));
603
609
  }
604
610
  .nut-tabs-titles-item-smile, .nut-tabs-titles-item-line {
605
611
  position: absolute;
@@ -607,9 +613,9 @@
607
613
  width: 0;
608
614
  height: 0;
609
615
  content: " ";
610
- bottom: var(--nutui-tabs-line-bottom, 15%);
611
616
  left: 50%;
612
617
  transform: translate(-50%, 0);
618
+ bottom: var(--nutui-tabs-line-bottom, 15%);
613
619
  border-radius: var(--nutui-tabs-line-border-radius, 2px);
614
620
  opacity: var(--nutui-tabs-tab-line-opacity, 1);
615
621
  overflow: hidden;
@@ -622,9 +628,11 @@
622
628
  font-size: 20px;
623
629
  width: 100%;
624
630
  height: 100%;
625
- color: var(--nutui-color-primary, #ff0f23);
626
631
  }
627
- .nut-tabs-titles-item-active {
632
+ .nut-tabs-titles-item-active .nut-icon {
633
+ color: var(--nutui-tabs-titles-item-active-color, var(--nutui-color-primary, #ff0f23));
634
+ }
635
+ .nut-tabs-titles-item-active .nut-tabs-titles-item-text {
628
636
  color: var(--nutui-tabs-titles-item-active-color, var(--nutui-color-primary, #ff0f23));
629
637
  font-weight: var(--nutui-tabs-titles-item-active-font-weight, var(--nutui-font-weight-bold, 600));
630
638
  }
@@ -640,10 +648,20 @@
640
648
  width: 40px;
641
649
  height: 20px;
642
650
  }
651
+ .nut-tabs-titles-item-active .nut-tabs-titles-item-smile .nut-icon {
652
+ color: var(--nutui-tabs-titles-item-active-color, var(--nutui-color-primary, #ff0f23));
653
+ }
643
654
  .nut-tabs-titles-item-disabled {
644
655
  color: var(--nutui-color-text-disabled, #c2c4cc);
645
656
  }
646
- .nut-tabs-titles-simple .nut-tabs-titles-item-active {
657
+ .nut-tabs-titles-item-disabled .nut-icon {
658
+ color: var(--nutui-color-text-disabled, #c2c4cc);
659
+ }
660
+ .nut-tabs-titles-item-disabled .nut-tabs-titles-item-text {
661
+ color: var(--nutui-color-text-disabled, #c2c4cc);
662
+ }
663
+ .nut-tabs-titles-simple .nut-tabs-titles-item-active .nut-tabs-titles-item-text,
664
+ .nut-tabs-titles-simple .nut-tabs-titles-item-active .nut-icon {
647
665
  color: var(--nutui-color-title, #1a1a1a);
648
666
  font-size: var(--nutui-tabs-titles-item-active-font-size, var(--nutui-font-size-l, 16px));
649
667
  }
@@ -672,11 +690,10 @@
672
690
  }
673
691
  .nut-tabs-titles-button .nut-tabs-titles-item-active .nut-tabs-titles-item-text {
674
692
  background: var(--nutui-color-default-light);
675
- color: var(--nutui-color-text, #505259);
693
+ color: var(--nutui-tabs-titles-item-active-color, var(--nutui-color-primary, #ff0f23));
676
694
  border-radius: var(--nutui-tabs-button-border-radius, 50px);
677
695
  font-weight: var(--nutui-font-weight-bold, 600);
678
696
  background-color: var(--nutui-tabs-button-active-background-color, var(--nutui-color-primary-light-pressed, #ffebf1));
679
- color: var(--nutui-color-primary, #ff0f23);
680
697
  border: var(--nutui-tabs-button-active-border, 1px solid var(--nutui-color-primary, #ff0f23));
681
698
  }
682
699
  .nut-tabs-titles-divider {
@@ -701,68 +718,29 @@
701
718
  display: none;
702
719
  }
703
720
 
704
- [dir=rtl] .nut-tabs-titles-item-smile, [dir=rtl] .nut-tabs-titles-item-line,
705
- .nut-rtl .nut-tabs-titles-item-smile,
706
- .nut-rtl .nut-tabs-titles-item-line {
707
- left: auto;
708
- right: 50%;
709
- transform: translate(50%, 0);
710
- }
711
- [dir=rtl] .nut-tabs-titles-divider .nut-tabs-titles-item::after,
712
- .nut-rtl .nut-tabs-titles-divider .nut-tabs-titles-item::after {
713
- right: auto;
714
- left: 0;
715
- }
716
-
717
- .nut-tabs-horizontal {
718
- flex-direction: column;
719
- position: relative;
720
- }
721
-
722
- .nut-tabs-vertical {
723
- flex-direction: row;
724
- width: 100%;
725
- }
726
721
  .nut-tabs-vertical .nut-tabs-ellipsis {
727
722
  text-overflow: ellipsis;
728
723
  white-space: nowrap;
729
724
  overflow: hidden;
730
725
  }
731
726
  .nut-tabs-vertical .nut-tabs-titles {
732
- box-sizing: border-box;
733
727
  flex-direction: column;
734
728
  height: 100%;
735
- padding: 0;
736
729
  width: var(--nutui-tabs-vertical-titles-width, 100px);
737
730
  flex-shrink: 0;
738
731
  }
739
732
  .nut-tabs-vertical .nut-tabs-titles .nut-tabs-list {
740
- width: 100%;
741
- display: flex;
742
733
  flex-direction: column;
743
- flex-shrink: 0;
744
- }
745
- .nut-tabs-vertical .nut-tabs-titles-line .nut-tabs-titles-item {
746
- padding-left: 14px;
747
- }
748
- .nut-tabs-vertical .nut-tabs-titles-scrollable {
749
- overflow-x: hidden;
750
- overflow-y: auto;
751
734
  }
752
735
  .nut-tabs-vertical .nut-tabs-titles-item {
753
736
  height: var(--nutui-tabs-vertical-titles-item-height, 40px);
754
- margin: 0;
755
737
  flex: none;
756
738
  }
757
739
  .nut-tabs-vertical .nut-tabs-titles-item-smile {
758
- width: 0;
759
- height: 0;
760
740
  overflow: hidden;
761
741
  transition: width 0.3s ease;
762
742
  }
763
743
  .nut-tabs-vertical .nut-tabs-titles-item-line {
764
- width: 0;
765
- height: 0;
766
744
  transform: translate(0, -50%);
767
745
  transition: height 0.3s ease;
768
746
  }
@@ -782,21 +760,17 @@
782
760
  right: -12px;
783
761
  bottom: -2%;
784
762
  left: auto;
785
- width: 40px;
786
- height: 20px;
787
763
  transform: rotate(320deg);
788
764
  }
789
765
  .nut-tabs-vertical .nut-tabs-horizontal .nut-tabs-titles {
790
766
  flex-direction: row;
791
- overflow-x: auto;
792
- overflow-y: hidden;
793
767
  height: var(--nutui-tabs-titles-height, 44px);
768
+ width: 100%;
769
+ padding: 0 !important;
794
770
  }
795
771
  .nut-tabs-vertical .nut-tabs-horizontal .nut-tabs-titles .nut-tabs-list {
796
- width: 100%;
797
- display: flex;
798
772
  flex-direction: row;
799
- flex-shrink: 0;
773
+ height: auto;
800
774
  }
801
775
  .nut-tabs-vertical .nut-tabs-horizontal .nut-tabs-content {
802
776
  flex-direction: row;
@@ -807,6 +781,9 @@
807
781
  .nut-tabs-vertical .nut-tabs-horizontal .nut-tabs-titles-item-active .nut-tabs-titles-item-line {
808
782
  left: 50%;
809
783
  transform: translate(-50%, 0);
784
+ width: var(--nutui-tabs-tab-line-width, 12px);
785
+ height: var(--nutui-tabs-tab-line-height, 2px);
786
+ background: var(--nutui-tabs-tab-line-color, var(--nutui-color-primary, #ff0f23));
810
787
  }
811
788
  .nut-tabs-vertical .nut-tabs-horizontal .nut-tabs-titles-item-active .nut-tabs-titles-item-smile {
812
789
  left: 50%;
@@ -824,28 +801,26 @@
824
801
  .nut-tabs-vertical .nut-tabs-content .nut-tabpane {
825
802
  height: 100%;
826
803
  }
827
- .nut-tabs-vertical .nut-tabs-horizontal .nut-tabs-titles {
804
+
805
+ .nut-tabs-content {
828
806
  display: flex;
829
- flex-direction: row;
830
- padding: 0 !important;
831
- width: 100%;
807
+ box-sizing: border-box;
832
808
  }
833
- .nut-tabs-vertical .nut-tabs-horizontal .nut-tabs-titles .nut-tabs-titles-item {
834
- display: flex;
835
- align-items: center;
836
- justify-content: center;
837
- flex: 1 0 auto;
809
+ .nut-tabs-content-wrap {
810
+ overflow: hidden;
838
811
  }
839
- .nut-tabs-vertical .nut-tabs-horizontal .nut-tabs-titles .nut-tabs-titles-item-active {
840
- color: var(--nutui-color-primary, #ff0f23);
841
- font-weight: var(--nutui-tabs-titles-item-active-font-weight, var(--nutui-font-weight-bold, 600));
842
- font-size: var(--nutui-tabs-titles-item-active-font-size, var(--nutui-font-size-l, 16px));
812
+
813
+ [dir=rtl] .nut-tabs-titles-item-smile, [dir=rtl] .nut-tabs-titles-item-line,
814
+ .nut-rtl .nut-tabs-titles-item-smile,
815
+ .nut-rtl .nut-tabs-titles-item-line {
816
+ left: auto;
817
+ right: 50%;
818
+ transform: translate(50%, 0);
843
819
  }
844
- .nut-tabs-vertical .nut-tabs-horizontal .nut-tabs-titles .nut-tabs-titles-item-active .nut-tabs-titles-item-line {
845
- content: " ";
846
- width: var(--nutui-tabs-tab-line-width, 12px);
847
- height: var(--nutui-tabs-tab-line-height, 2px);
848
- background: var(--nutui-tabs-tab-line-color, var(--nutui-color-primary, #ff0f23));
820
+ [dir=rtl] .nut-tabs-titles-divider .nut-tabs-titles-item::after,
821
+ .nut-rtl .nut-tabs-titles-divider .nut-tabs-titles-item::after {
822
+ right: auto;
823
+ left: 0;
849
824
  }
850
825
 
851
826
  [dir=rtl] .nut-tabs-vertical .nut-tabs-titles-line .nut-tabs-titles-item,
@@ -877,14 +852,6 @@
877
852
  transform: translate(50%, 0) rotate(0deg);
878
853
  }
879
854
 
880
- .nut-tabs-content {
881
- display: flex;
882
- box-sizing: border-box;
883
- }
884
- .nut-tabs-content-wrap {
885
- overflow: hidden;
886
- }
887
-
888
855
  .nut-cascader {
889
856
  width: 100%;
890
857
  font-size: var(--nutui-cascader-font-size, var(--nutui-font-size-base, 14px));
@@ -1,7 +1,4 @@
1
1
  .nut-animate {
2
- .nut-ani-container {
3
- display: inline-block;
4
- }
5
2
  /* Animation css */
6
3
  [class*='nut-animate-'] {
7
4
  animation-duration: 0.5s;
@@ -5,9 +5,6 @@
5
5
  .nut-animate {
6
6
  /* Animation css */
7
7
  }
8
- .nut-animate .nut-ani-container {
9
- display: inline-block;
10
- }
11
8
  .nut-animate [class*=nut-animate-] {
12
9
  animation-duration: 0.5s;
13
10
  animation-timing-function: ease-out;
@@ -24,7 +24,7 @@
24
24
  display: flex;
25
25
  height: 80%;
26
26
  align-items: flex-end;
27
- color: var(--nutui-countup-bg-color, inherit);
27
+ color: var(--nutui-countup-separator-color, var(--nutui-color-title, #1a1a1a));
28
28
  font-size: var(--nutui-countup-base-size, 18px);
29
29
  font-weight: var(--nutui-font-weight-bold, 600);
30
30
  }
@@ -1,7 +1,7 @@
1
1
  import React, { FunctionComponent } from 'react';
2
2
  import type { MouseEvent } from 'react';
3
- import { BasicComponent } from "../../utils/typings";
4
- export interface BackTopProps extends BasicComponent {
3
+ import { HoverButtonProps } from "../hoverbutton/index";
4
+ export interface BackTopProps extends HoverButtonProps {
5
5
  target: string;
6
6
  threshold: number;
7
7
  zIndex: number;
@@ -16,11 +16,11 @@ var _object_spread = require("@swc/helpers/_/_object_spread");
16
16
  var _object_spread_props = require("@swc/helpers/_/_object_spread_props");
17
17
  var _sliced_to_array = require("@swc/helpers/_/_sliced_to_array");
18
18
  var _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
19
- var _iconsreact = require("@nutui/icons-react");
20
19
  var _classnames = /*#__PURE__*/ _interop_require_default._(require("classnames"));
20
+ var _iconsreact = require("@nutui/icons-react");
21
21
  var _typings = require("../../utils/typings");
22
22
  var _raf = /*#__PURE__*/ _interop_require_wildcard._(require("../../utils/raf"));
23
- var _configprovider = require("../configprovider");
23
+ var _index = /*#__PURE__*/ _interop_require_default._(require("../hoverbutton/index"));
24
24
  var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typings.ComponentDefaults), {
25
25
  target: '',
26
26
  threshold: 200,
@@ -28,8 +28,7 @@ var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typing
28
28
  duration: 1000
29
29
  });
30
30
  var BackTop = function BackTop(props) {
31
- var rtl = (0, _configprovider.useRtl)();
32
- var _$_object_spread = (0, _object_spread._)({}, defaultProps, props), children = _$_object_spread.children, target = _$_object_spread.target, threshold = _$_object_spread.threshold, zIndex = _$_object_spread.zIndex, className = _$_object_spread.className, duration = _$_object_spread.duration, style = _$_object_spread.style, onClick = _$_object_spread.onClick;
31
+ var _$_object_spread = (0, _object_spread._)({}, defaultProps, props), children = _$_object_spread.children, target = _$_object_spread.target, threshold = _$_object_spread.threshold, zIndex = _$_object_spread.zIndex, className = _$_object_spread.className, duration = _$_object_spread.duration, icon = _$_object_spread.icon, style = _$_object_spread.style, onClick = _$_object_spread.onClick;
33
32
  var classPrefix = 'nut-backtop';
34
33
  var _useState = (0, _sliced_to_array._)((0, _react.useState)(false), 2), backTop = _useState[0], setBackTop = _useState[1];
35
34
  var _useState1 = (0, _sliced_to_array._)((0, _react.useState)(0), 2), scrollTop = _useState1[0], setScrollTop = _useState1[1];
@@ -108,26 +107,20 @@ var BackTop = function BackTop(props) {
108
107
  scroll,
109
108
  scrollAnimation
110
109
  ]);
111
- var styles = (0, _react.useMemo)(function() {
112
- var _obj;
113
- return Object.keys(style || {}).length !== 0 ? (0, _object_spread._)({
114
- zIndex: zIndex
115
- }, style) : (_obj = {}, (0, _define_property._)(_obj, rtl ? 'left' : 'right', '10px'), (0, _define_property._)(_obj, "bottom", '20px'), (0, _define_property._)(_obj, "zIndex", zIndex), _obj);
116
- }, [
117
- rtl,
118
- style,
119
- zIndex
120
- ]);
121
- return /*#__PURE__*/ _react.default.createElement("div", {
110
+ return /*#__PURE__*/ _react.default.createElement(_index.default, {
122
111
  className: cls,
123
- style: styles,
112
+ style: (0, _object_spread._)({
113
+ zIndex: zIndex
114
+ }, style),
115
+ icon: !children && (icon || /*#__PURE__*/ _react.default.createElement(_iconsreact.Top, null)),
116
+ onClick: function onClick(e) {
117
+ goTop(e);
118
+ }
119
+ }, children && /*#__PURE__*/ _react.default.createElement("div", {
120
+ className: "nut-hoverbutton-item-container",
124
121
  onClick: function onClick(e) {
125
122
  goTop(e);
126
123
  }
127
- }, children || /*#__PURE__*/ _react.default.createElement(_iconsreact.Top, {
128
- width: 19,
129
- height: 19,
130
- className: "nut-backtop-main"
131
- }));
124
+ }, children));
132
125
  };
133
126
  BackTop.displayName = 'NutBackTop';
@@ -1,31 +1,22 @@
1
1
  .nut-backtop {
2
2
  display: none;
3
- position: fixed;
4
3
 
5
4
  &-rn {
6
5
  position: absolute;
7
6
  }
8
7
 
9
8
  &-show {
10
- width: 40px;
11
- height: 40px;
12
9
  display: flex;
13
10
  align-items: center;
14
11
  justify-content: center;
15
- background: $color-background-overlay;
16
- color: $color-title;
17
- border: 1px solid $backtop-border-color;
18
- border-radius: 21px;
19
- z-index: 100;
20
-
21
- &:active,
22
- &-active {
23
- background: $color-background;
24
- }
25
- }
26
-
27
- &-main {
12
+ width: $hoverbutton-item-size;
13
+ height: $hoverbutton-item-size;
28
14
  transition: all 0.2s ease-in-out;
29
- color: $color-title;
15
+ .nut-hoverbutton-item-container {
16
+ display: flex;
17
+ flex-direction: column;
18
+ justify-content: center;
19
+ align-items: center;
20
+ }
30
21
  }
31
22
  }
@@ -4,27 +4,21 @@
4
4
  /* #endif */
5
5
  .nut-backtop {
6
6
  display: none;
7
- position: fixed;
8
7
  }
9
8
  .nut-backtop-rn {
10
9
  position: absolute;
11
10
  }
12
11
  .nut-backtop-show {
13
- width: 40px;
14
- height: 40px;
15
12
  display: flex;
16
13
  align-items: center;
17
14
  justify-content: center;
18
- background: var(--nutui-color-background-overlay, #ffffff);
19
- color: var(--nutui-color-title, #1a1a1a);
20
- border: 1px solid var(--nutui-backtop-border-color, var(--nutui-color-border, rgba(0, 0, 0, 0.06)));
21
- border-radius: 21px;
22
- z-index: 100;
23
- }
24
- .nut-backtop-show:active, .nut-backtop-show-active {
25
- background: var(--nutui-color-background, #f5f6fa);
26
- }
27
- .nut-backtop-main {
15
+ width: var(--nutui-hoverbutton-item-size, 40px);
16
+ height: var(--nutui-hoverbutton-item-size, 40px);
28
17
  transition: all 0.2s ease-in-out;
29
- color: var(--nutui-color-title, #1a1a1a);
18
+ }
19
+ .nut-backtop-show .nut-hoverbutton-item-container {
20
+ display: flex;
21
+ flex-direction: column;
22
+ justify-content: center;
23
+ align-items: center;
30
24
  }
@@ -1,13 +1,3 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- import { BasicComponent } from "../../utils/typings";
3
- export type BadgeFill = 'solid' | 'outline';
4
- export interface BadgeProps extends BasicComponent {
5
- value: ReactNode;
6
- dot: boolean;
7
- max: number;
8
- top: string | number;
9
- right: string | number;
10
- color: string;
11
- fill: BadgeFill;
12
- }
1
+ import { FunctionComponent } from 'react';
2
+ import { BadgeProps } from './types';
13
3
  export declare const Badge: FunctionComponent<Partial<BadgeProps>>;
@@ -21,10 +21,10 @@ var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typing
21
21
  value: '',
22
22
  dot: false,
23
23
  max: 99,
24
- top: '4',
25
- right: '8',
26
- color: '',
27
- fill: 'solid'
24
+ top: 0,
25
+ right: 0,
26
+ fill: 'solid',
27
+ size: 'large'
28
28
  });
29
29
  var Badge = function Badge(props) {
30
30
  var content = function content() {
@@ -45,28 +45,16 @@ var Badge = function Badge(props) {
45
45
  };
46
46
  var _this;
47
47
  var rtl = (0, _configprovider.useRtl)();
48
- var _$_object_spread = (0, _object_spread._)({}, defaultProps, props), className = _$_object_spread.className, style = _$_object_spread.style, value = _$_object_spread.value, max = _$_object_spread.max, children = _$_object_spread.children, dot = _$_object_spread.dot, top = _$_object_spread.top, right = _$_object_spread.right, color = _$_object_spread.color, fill = _$_object_spread.fill;
48
+ var _$_object_spread = (0, _object_spread._)({}, defaultProps, props), className = _$_object_spread.className, style = _$_object_spread.style, value = _$_object_spread.value, max = _$_object_spread.max, children = _$_object_spread.children, dot = _$_object_spread.dot, top = _$_object_spread.top, right = _$_object_spread.right, fill = _$_object_spread.fill, size = _$_object_spread.size;
49
49
  var classPrefix = 'nut-badge';
50
- var classes = (0, _classnames.default)(classPrefix, className, (0, _define_property._)({}, "".concat(classPrefix, "-").concat(fill), fill === 'outline'));
50
+ var classes = (0, _classnames.default)(classPrefix, className);
51
51
  var _obj;
52
- var contentClasses = (0, _classnames.default)("".concat(classPrefix, "-content"), (_obj = {}, (0, _define_property._)(_obj, "".concat(classPrefix, "-sup"), isNumber() || isString() || dot), (0, _define_property._)(_obj, "".concat(classPrefix, "-one"), typeof content() === 'string' && ((_this = "".concat(content())) === null || _this === void 0 ? void 0 : _this.length) === 1), (0, _define_property._)(_obj, "".concat(classPrefix, "-dot"), dot), (0, _define_property._)(_obj, "".concat(classPrefix, "-").concat(fill), fill === 'outline'), _obj));
53
- var getStyle = function getStyle() {
52
+ var contentClasses = (0, _classnames.default)((_obj = {}, (0, _define_property._)(_obj, "".concat(classPrefix, "-sup"), isNumber() || isString() || dot), (0, _define_property._)(_obj, "".concat(classPrefix, "-number"), isNumber()), (0, _define_property._)(_obj, "".concat(classPrefix, "-one"), typeof content() === 'string' && ((_this = "".concat(content())) === null || _this === void 0 ? void 0 : _this.length) === 1), (0, _define_property._)(_obj, "".concat(classPrefix, "-dot"), dot), (0, _define_property._)(_obj, "".concat(classPrefix, "-dot-").concat(size), dot), (0, _define_property._)(_obj, "".concat(classPrefix, "-").concat(fill), fill === 'outline'), (0, _define_property._)(_obj, "".concat(classPrefix, "-content"), children), _obj));
53
+ var getPositionStyle = function getPositionStyle() {
54
54
  var style = {};
55
- style.top = "".concat(Number(-top) || parseFloat(String(-top)) || 0, "px");
55
+ style.top = "".concat(Number(top) || 0, "px");
56
56
  var dir = rtl ? 'left' : 'right';
57
57
  style[dir] = "".concat(Number(right) || parseFloat(String(right)) || 0, "px");
58
- if (color) {
59
- if (fill === 'outline') {
60
- style.color = color;
61
- style.background = '#fff';
62
- if (!(color === null || color === void 0 ? void 0 : color.includes('gradient'))) {
63
- style.border = "1px solid ".concat(color);
64
- }
65
- } else {
66
- style.color = '#fff';
67
- style.background = color;
68
- }
69
- }
70
58
  return style;
71
59
  };
72
60
  var _obj1;
@@ -74,10 +62,11 @@ var Badge = function Badge(props) {
74
62
  className: classes,
75
63
  style: style
76
64
  }, isIcon() && /*#__PURE__*/ _react.default.createElement("div", {
77
- className: (0, _classnames.default)("".concat(classPrefix, "-content"), (_obj1 = {}, (0, _define_property._)(_obj1, "".concat(classPrefix, "-icon"), true), (0, _define_property._)(_obj1, "".concat(classPrefix, "-icon-rtl"), rtl), _obj1))
65
+ className: (0, _classnames.default)("".concat(classPrefix, "-content"), (_obj1 = {}, (0, _define_property._)(_obj1, "".concat(classPrefix, "-icon"), true), (0, _define_property._)(_obj1, "".concat(classPrefix, "-icon-rtl"), rtl), _obj1)),
66
+ style: getPositionStyle()
78
67
  }, value), children, !isIcon() && /*#__PURE__*/ _react.default.createElement("div", {
79
68
  className: contentClasses,
80
- style: getStyle()
69
+ style: getPositionStyle()
81
70
  }, content()));
82
71
  };
83
72
  Badge.displayName = 'NutBadge';
@@ -1,3 +1,3 @@
1
1
  import { Badge } from './badge';
2
- export type { BadgeFill, BadgeProps } from './badge';
2
+ export type { BadgeFill, BadgeDotSize, BadgeProps } from './types';
3
3
  export default Badge;