@nutui/nutui-react 0.1.0 → 1.0.0

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 (164) hide show
  1. package/dist/esm/ActionSheet/style/css.js +1 -0
  2. package/dist/esm/ActionSheet/style/index.js +1 -1
  3. package/dist/esm/Address/style/css.js +1 -0
  4. package/dist/esm/Address/style/index.js +1 -1
  5. package/dist/esm/AnimatingNumbers/style/css.js +1 -0
  6. package/dist/esm/AnimatingNumbers/style/index.js +1 -1
  7. package/dist/esm/Avatar/style/css.js +1 -0
  8. package/dist/esm/Avatar/style/index.js +1 -1
  9. package/dist/esm/BackTop/style/css.js +1 -0
  10. package/dist/esm/BackTop/style/index.js +1 -1
  11. package/dist/esm/Badge/style/css.js +1 -0
  12. package/dist/esm/Badge/style/index.js +1 -1
  13. package/dist/esm/Barrage/style/css.js +1 -0
  14. package/dist/esm/Barrage/style/index.js +1 -1
  15. package/dist/esm/Button/style/css.js +1 -0
  16. package/dist/esm/Button/style/index.js +1 -1
  17. package/dist/esm/Button.js +110 -4
  18. package/dist/esm/Calendar/style/css.js +1 -0
  19. package/dist/esm/Calendar/style/index.js +1 -1
  20. package/dist/esm/CalendarItem/style/css.js +1 -0
  21. package/dist/esm/CalendarItem/style/index.js +1 -1
  22. package/dist/esm/Cell/style/css.js +1 -0
  23. package/dist/esm/Cell/style/index.js +1 -1
  24. package/dist/esm/Cell.js +1 -1
  25. package/dist/esm/CellGroup/style/css.js +1 -0
  26. package/dist/esm/CellGroup/style/index.js +1 -1
  27. package/dist/esm/Checkbox/style/css.js +1 -0
  28. package/dist/esm/Checkbox/style/index.js +1 -1
  29. package/dist/esm/Checkbox.js +1 -1
  30. package/dist/esm/CheckboxGroup/style/css.js +1 -0
  31. package/dist/esm/CheckboxGroup/style/index.js +1 -1
  32. package/dist/esm/CircleProgress/style/css.js +1 -0
  33. package/dist/esm/CircleProgress/style/index.js +1 -1
  34. package/dist/esm/Col/style/css.js +1 -0
  35. package/dist/esm/Col/style/index.js +1 -1
  36. package/dist/esm/Collapse/style/css.js +1 -0
  37. package/dist/esm/Collapse/style/index.js +1 -1
  38. package/dist/esm/CollapseItem/style/css.js +1 -0
  39. package/dist/esm/CollapseItem/style/index.js +1 -1
  40. package/dist/esm/CollapseItem.js +1 -1
  41. package/dist/esm/Dialog/style/css.js +1 -0
  42. package/dist/esm/Dialog/style/index.js +1 -1
  43. package/dist/esm/Divider/style/css.js +1 -0
  44. package/dist/esm/Divider/style/index.js +1 -1
  45. package/dist/esm/Drag/style/css.js +1 -0
  46. package/dist/esm/Drag/style/index.js +1 -1
  47. package/dist/esm/Drag.js +11 -30
  48. package/dist/esm/Elevator/style/css.js +1 -0
  49. package/dist/esm/Elevator/style/index.js +1 -1
  50. package/dist/esm/FixedNav/style/css.js +1 -0
  51. package/dist/esm/FixedNav/style/index.js +1 -1
  52. package/dist/esm/FixedNav.js +2 -2
  53. package/dist/esm/Icon/style/css.js +1 -0
  54. package/dist/esm/Icon/style/index.js +1 -1
  55. package/dist/esm/Icon.js +70 -4
  56. package/dist/esm/Infiniteloading/style/css.js +1 -0
  57. package/dist/esm/Infiniteloading/style/index.js +1 -1
  58. package/dist/esm/Input/style/css.js +1 -0
  59. package/dist/esm/Input/style/index.js +1 -1
  60. package/dist/esm/InputNumber/style/css.js +1 -0
  61. package/dist/esm/InputNumber/style/index.js +1 -1
  62. package/dist/esm/Layout/style/css.js +1 -0
  63. package/dist/esm/Layout/style/index.js +1 -1
  64. package/dist/esm/NavBar/style/css.js +1 -0
  65. package/dist/esm/NavBar/style/index.js +1 -1
  66. package/dist/esm/NavBar.js +1 -1
  67. package/dist/esm/NoticeBar/style/css.js +1 -0
  68. package/dist/esm/NoticeBar/style/index.js +1 -1
  69. package/dist/esm/NoticeBar.js +1 -1
  70. package/dist/esm/Notify/style/css.js +1 -0
  71. package/dist/esm/Notify/style/index.js +1 -1
  72. package/dist/esm/Overlay/style/css.js +1 -0
  73. package/dist/esm/Overlay/style/index.js +1 -1
  74. package/dist/esm/Pagination/style/css.js +1 -0
  75. package/dist/esm/Pagination/style/index.js +1 -1
  76. package/dist/esm/Picker/style/css.js +1 -0
  77. package/dist/esm/Picker/style/index.js +1 -1
  78. package/dist/esm/Popover/style/css.js +1 -0
  79. package/dist/esm/Popover/style/index.js +1 -1
  80. package/dist/esm/Popup/style/css.js +1 -0
  81. package/dist/esm/Popup/style/index.js +1 -1
  82. package/dist/esm/Price/style/css.js +1 -0
  83. package/dist/esm/Price/style/index.js +1 -1
  84. package/dist/esm/Radio/style/css.js +1 -0
  85. package/dist/esm/Radio/style/index.js +1 -1
  86. package/dist/esm/Radio.js +2 -3
  87. package/dist/esm/RadioGroup/style/css.js +1 -0
  88. package/dist/esm/RadioGroup/style/index.js +1 -1
  89. package/dist/esm/Range/style/css.js +1 -0
  90. package/dist/esm/Range/style/index.js +1 -1
  91. package/dist/esm/Range.js +1 -4
  92. package/dist/esm/Rate/style/css.js +1 -0
  93. package/dist/esm/Rate/style/index.js +1 -1
  94. package/dist/esm/Rate.js +1 -1
  95. package/dist/esm/Row/style/css.js +1 -0
  96. package/dist/esm/Row/style/index.js +1 -1
  97. package/dist/esm/ShortPassword/style/css.js +1 -0
  98. package/dist/esm/ShortPassword/style/index.js +1 -1
  99. package/dist/esm/Signature/style/css.js +1 -0
  100. package/dist/esm/Signature/style/index.js +1 -1
  101. package/dist/esm/Signature.js +1 -2
  102. package/dist/esm/Step/style/css.js +1 -0
  103. package/dist/esm/Step/style/index.js +1 -1
  104. package/dist/esm/Steps/style/css.js +1 -0
  105. package/dist/esm/Steps/style/index.js +1 -1
  106. package/dist/esm/Swiper/style/css.js +1 -0
  107. package/dist/esm/Swiper/style/index.js +1 -1
  108. package/dist/esm/SwiperItem/style/css.js +1 -0
  109. package/dist/esm/SwiperItem/style/index.js +1 -1
  110. package/dist/esm/Switch/style/css.js +1 -0
  111. package/dist/esm/Switch/style/index.js +1 -1
  112. package/dist/esm/Tabbar/style/css.js +1 -0
  113. package/dist/esm/Tabbar/style/index.js +1 -1
  114. package/dist/esm/Tabbar.js +1 -4
  115. package/dist/esm/TabbarItem/style/css.js +1 -0
  116. package/dist/esm/TabbarItem/style/index.js +1 -1
  117. package/dist/esm/TabbarItem.js +1 -1
  118. package/dist/esm/Tag/style/css.js +1 -0
  119. package/dist/esm/Tag/style/index.js +1 -1
  120. package/dist/esm/TextArea/style/css.js +1 -0
  121. package/dist/esm/TextArea/style/index.js +1 -1
  122. package/dist/esm/Toast/style/css.js +1 -0
  123. package/dist/esm/Toast/style/index.js +1 -1
  124. package/dist/esm/Toast.js +294 -7
  125. package/dist/esm/Uploader/style/css.js +1 -0
  126. package/dist/esm/Uploader/style/index.js +1 -1
  127. package/dist/esm/nutui-react.es.js +22 -22
  128. package/dist/esm/types/src/packages/nutui.react.build.d.ts +23 -23
  129. package/dist/esm/types/src/packages/nutui.react.d.ts +23 -23
  130. package/dist/esm/types/src/packages/tabbaritem/index.d.ts +1 -1
  131. package/dist/esm/types/src/packages/tabbaritem/{tabbarItem.d.ts → tabbaritem.d.ts} +0 -0
  132. package/dist/nutui.react.es.js +10461 -10479
  133. package/dist/nutui.react.umd.js +21 -21
  134. package/dist/packages/animatingnumbers/animatingnumbers.scss +1 -1
  135. package/dist/packages/calendar/calendar.scss +2 -1
  136. package/dist/packages/cell/cell.scss +2 -0
  137. package/dist/packages/checkbox/checkbox.scss +1 -1
  138. package/dist/packages/collapse/collapse.scss +1 -1
  139. package/dist/packages/collapseitem/collapseitem.scss +2 -0
  140. package/dist/packages/dialog/dialog.scss +8 -0
  141. package/dist/packages/fixednav/fixednav.scss +2 -0
  142. package/dist/packages/infiniteloading/infiniteloading.scss +1 -0
  143. package/dist/packages/input/input.scss +1 -0
  144. package/dist/packages/inputnumber/inputnumber.scss +1 -0
  145. package/dist/packages/navbar/navbar.scss +2 -0
  146. package/dist/packages/noticebar/noticebar.scss +2 -0
  147. package/dist/packages/popover/popover.scss +1 -1
  148. package/dist/packages/radio/radio.scss +2 -0
  149. package/dist/packages/range/range.scss +1 -0
  150. package/dist/packages/rate/rate.scss +2 -0
  151. package/dist/packages/signature/signature.scss +1 -0
  152. package/dist/packages/step/step.scss +1 -0
  153. package/dist/packages/tabbaritem/{tabbarItem.scss → tabbaritem.scss} +2 -0
  154. package/dist/packages/tag/tag.scss +1 -0
  155. package/dist/packages/toast/toast.scss +2 -0
  156. package/dist/packages/uploader/uploader.scss +2 -0
  157. package/dist/style.css +1 -1
  158. package/dist/style.es.js +1 -1
  159. package/dist/styles/themes/default.scss +22 -22
  160. package/dist/styles/variables.scss +3 -3
  161. package/package.json +18 -13
  162. package/dist/esm/button-345fb015.js +0 -110
  163. package/dist/esm/icon-63c0d58f.js +0 -70
  164. package/dist/esm/toast-420b65b7.js +0 -294
package/dist/style.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v0.1.0 Fri Dec 31 2021 17:17:16 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v1.0.0 Mon Jan 10 2022 09:47:22 GMT+0800 (China Standard Time)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -10,47 +10,47 @@
10
10
  @import '../../packages/layout/layout.scss';
11
11
  @import '../../packages/row/row.scss';
12
12
  @import '../../packages/col/col.scss';
13
- @import '../../packages/drag/drag.scss';
14
- @import '../../packages/collapse/collapse.scss';
15
13
  @import '../../packages/toast/toast.scss';
16
- @import '../../packages/backtop/backtop.scss';
17
- @import '../../packages/range/range.scss';
18
- @import '../../packages/infiniteloading/infiniteloading.scss';
19
- @import '../../packages/steps/steps.scss';
20
- @import '../../packages/step/step.scss';
21
- @import '../../packages/circleprogress/circleprogress.scss';
14
+ @import '../../packages/dialog/dialog.scss';
22
15
  @import '../../packages/popup/popup.scss';
23
16
  @import '../../packages/actionsheet/actionsheet.scss';
17
+ @import '../../packages/picker/picker.scss';
18
+ @import '../../packages/infiniteloading/infiniteloading.scss';
19
+ @import '../../packages/popover/popover.scss';
20
+ @import '../../packages/collapse/collapse.scss';
21
+ @import '../../packages/collapseitem/collapseitem.scss';
22
+ @import '../../packages/range/range.scss';
23
+ @import '../../packages/circleprogress/circleprogress.scss';
24
24
  @import '../../packages/noticebar/noticebar.scss';
25
25
  @import '../../packages/notify/notify.scss';
26
- @import '../../packages/dialog/dialog.scss';
27
26
  @import '../../packages/switch/switch.scss';
28
- @import '../../packages/collapseitem/collapseitem.scss';
29
- @import '../../packages/swiper/swiper.scss';
30
- @import '../../packages/swiperitem/swiperitem.scss';
31
27
  @import '../../packages/navbar/navbar.scss';
32
28
  @import '../../packages/tabbar/tabbar.scss';
33
29
  @import '../../packages/tabbaritem/tabbaritem.scss';
34
- @import '../../packages/inputnumber/inputnumber.scss';
35
30
  @import '../../packages/elevator/elevator.scss';
36
31
  @import '../../packages/fixednav/fixednav.scss';
37
32
  @import '../../packages/pagination/pagination.scss';
33
+ @import '../../packages/steps/steps.scss';
34
+ @import '../../packages/step/step.scss';
35
+ @import '../../packages/swiper/swiper.scss';
36
+ @import '../../packages/swiperitem/swiperitem.scss';
37
+ @import '../../packages/backtop/backtop.scss';
38
38
  @import '../../packages/rate/rate.scss';
39
- @import '../../packages/uploader/uploader.scss';
40
39
  @import '../../packages/input/input.scss';
41
40
  @import '../../packages/textarea/textarea.scss';
41
+ @import '../../packages/inputnumber/inputnumber.scss';
42
+ @import '../../packages/shortpassword/shortpassword.scss';
43
+ @import '../../packages/radio/radio.scss';
44
+ @import '../../packages/radiogroup/radiogroup.scss';
42
45
  @import '../../packages/checkbox/checkbox.scss';
43
46
  @import '../../packages/checkboxgroup/checkboxgroup.scss';
44
47
  @import '../../packages/tag/tag.scss';
45
- @import '../../packages/popover/popover.scss';
46
48
  @import '../../packages/badge/badge.scss';
47
- @import '../../packages/animatingnumbers/animatingnumbers.scss';
48
- @import '../../packages/radio/radio.scss';
49
- @import '../../packages/radiogroup/radiogroup.scss';
50
- @import '../../packages/shortpassword/shortpassword.scss';
49
+ @import '../../packages/uploader/uploader.scss';
51
50
  @import '../../packages/calendar/calendar.scss';
52
51
  @import '../../packages/calendaritem/calendaritem.scss';
53
- @import '../../packages/picker/picker.scss';
54
- @import '../../packages/signature/signature.scss';
55
- @import '../../packages/barrage/barrage.scss';
56
52
  @import '../../packages/address/address.scss';
53
+ @import '../../packages/barrage/barrage.scss';
54
+ @import '../../packages/signature/signature.scss';
55
+ @import '../../packages/drag/drag.scss';
56
+ @import '../../packages/animatingnumbers/animatingnumbers.scss';
@@ -346,6 +346,6 @@ $dialog-vertical-footer-ok-margin-top: 10px !default;
346
346
  $dialog-footer-button-min-width: 100px !default;
347
347
  $dialog-footer-cancel-margin-right: 20px !default;
348
348
  $dialog-footer-ok-max-width: 128px !default;
349
-
350
- @import './mixins/index';
351
- @import './animation/index';
349
+ // 在组件中import
350
+ //@import './mixins/index';
351
+ //@import './animation/index';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nutui/nutui-react",
3
- "version": "0.1.0",
3
+ "version": "1.0.0",
4
4
  "style": "dist/style.css",
5
5
  "main": "dist/nutui.react.umd.js",
6
6
  "module": "dist/esm/nutui-react.es.js",
@@ -37,27 +37,26 @@
37
37
  ],
38
38
  "scripts": {
39
39
  "add": "node scripts/createComponentMode.js",
40
- "generate:types": "tsc && npm run replace:types",
41
40
  "generate:file": "node scripts/generate-nutui.js",
42
- "generate:loader-style": "node scripts/generate-loader-style.js",
43
- "replace:scss": "node scripts/replace-scss.js",
44
- "replace:types": "node scripts/replace-types.js",
45
41
  "generate:themes": "node scripts/generate-themes.js",
46
42
  "checked": "npm run generate:file && tsc",
47
43
  "dev": "npm run checked && vite --open --force",
48
- "build:css": "npm run generate:themes && vite build --config vite.config.build.css.ts && npm run build:replace",
44
+ "replace:scss": "node scripts/replace-scss-alias.js",
45
+ "replace:types": "node scripts/replace-types-alias.js",
46
+ "build:types": "tsc && npm run replace:types",
47
+ "build:loader-style": "node scripts/generate-loader-style.js",
48
+ "build:component:css": "node scripts/build-component-css.js",
49
+ "build:css": "npm run generate:themes && vite build --config vite.config.build.css.ts && npm run build:replace ",
49
50
  "build:replace": "npm run replace:scss",
50
- "build:esm": "npx rollup -c rollup.config.es.js",
51
- "build": "npm run checked && vite build --config vite.config.build.ts && npm run build:esm && npm run build:css && npm run generate:types && npm run generate:loader-style",
51
+ "build:es": "npx rollup -c rollup.config.es.js",
52
+ "build": "npm run checked && vite build --config vite.config.build.ts && npm run build:es && npm run build:css && npm run build:loader-style && npm run build:types ",
52
53
  "build:site": "npm run checked && vite build --config vite.config.build.site.ts",
53
54
  "publish:beta": "npm publish --tag beta",
54
55
  "prepare": "husky install"
55
56
  },
56
57
  "lint-staged": {
57
58
  "*.md": "prettier --write",
58
- "*.{ts,tsx,js,scss}": "prettier --write",
59
- "*.js": "eslint --cache --fix",
60
- "*.{js,css,md}": "prettier --write"
59
+ "*.{ts,tsx,js,vue,scss}": "prettier --write"
61
60
  },
62
61
  "dependencies": {
63
62
  "@babel/runtime": "^7.16.5",
@@ -88,6 +87,7 @@
88
87
  "@types/react": "^17.0.0",
89
88
  "@types/react-dom": "^17.0.0",
90
89
  "@types/react-router-dom": "^5.1.7",
90
+ "@types/react-syntax-highlighter": "^13.5.2",
91
91
  "@types/react-transition-group": "^4.4.4",
92
92
  "@typescript-eslint/eslint-plugin": "^4.24.0",
93
93
  "@typescript-eslint/parser": "^4.24.0",
@@ -108,6 +108,7 @@
108
108
  "husky": "^6.0.0",
109
109
  "inquirer": "^8.0.0",
110
110
  "lint-staged": "^11.0.0",
111
+ "lzutf8": "^0.6.0",
111
112
  "map-stream": "0.0.7",
112
113
  "marked": "^2.0.3",
113
114
  "postcss-import": "^14.0.2",
@@ -115,11 +116,15 @@
115
116
  "prettier": "2.3.0",
116
117
  "react": "^17.0.0",
117
118
  "react-dom": "^17.0.0",
119
+ "react-markdown": "^7.1.2",
120
+ "react-syntax-highlighter": "^15.4.5",
121
+ "remark-directive": "^2.0.1",
122
+ "remark-gfm": "^3.0.1",
118
123
  "sass": "^1.45.0",
119
124
  "shelljs": "^0.8.4",
120
125
  "typescript": "^4.1.2",
126
+ "unist-util-visit": "^4.1.0",
121
127
  "vinyl-fs": "^3.0.3",
122
- "vite": "^2.1.5",
123
- "vite-plugin-markdown": "^2.0.2"
128
+ "vite": "^2.1.5"
124
129
  }
125
130
  }
@@ -1,110 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["color", "shape", "plain", "loading", "disabled", "type", "size", "block", "icon", "children", "onClick", "className", "style"];
5
-
6
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7
-
8
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
9
-
10
- import React__default, { useState, useEffect } from 'react';
11
- import Icon from './Icon.js';
12
- var defaultProps = {
13
- className: '',
14
- color: '',
15
- shape: 'round',
16
- plain: false,
17
- loading: false,
18
- disabled: false,
19
- type: 'default',
20
- size: 'normal',
21
- block: false,
22
- icon: '',
23
- style: {},
24
- children: undefined,
25
- onClick: function onClick(e) {}
26
- };
27
-
28
- var Button = function Button(props) {
29
- var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
30
- color = _defaultProps$props.color,
31
- shape = _defaultProps$props.shape,
32
- plain = _defaultProps$props.plain,
33
- loading = _defaultProps$props.loading,
34
- disabled = _defaultProps$props.disabled,
35
- type = _defaultProps$props.type,
36
- size = _defaultProps$props.size,
37
- block = _defaultProps$props.block,
38
- icon = _defaultProps$props.icon,
39
- children = _defaultProps$props.children,
40
- onClick = _defaultProps$props.onClick,
41
- className = _defaultProps$props.className,
42
- style = _defaultProps$props.style,
43
- rest = _objectWithoutProperties(_defaultProps$props, _excluded);
44
-
45
- var _useState = useState(''),
46
- _useState2 = _slicedToArray(_useState, 2),
47
- btnName = _useState2[0],
48
- setBtnName = _useState2[1];
49
-
50
- var _useState3 = useState({}),
51
- _useState4 = _slicedToArray(_useState3, 2),
52
- btnStyle = _useState4[0],
53
- setBtnStyle = _useState4[1];
54
-
55
- useEffect(function () {
56
- setBtnName(classes());
57
- setBtnStyle(getStyle());
58
- }, [className, color, shape, plain, loading, disabled, style, type, size, block, icon, children, onClick]);
59
-
60
- var classes = function classes() {
61
- var prefixCls = 'nut-button';
62
- return "".concat(prefixCls, " ").concat(type ? "".concat(prefixCls, "--").concat(type) : '', "\n ").concat(size ? "".concat(prefixCls, "--").concat(size) : '', "\n ").concat(shape ? "".concat(prefixCls, "--").concat(shape) : '', "\n ").concat(plain ? "".concat(prefixCls, "--plain") : '', "\n ").concat(block ? "".concat(prefixCls, "--block") : '', "\n ").concat(disabled ? "".concat(prefixCls, "--disabled") : '', "\n ").concat(loading ? "".concat(prefixCls, "--loading") : '');
63
- };
64
-
65
- var handleClick = function handleClick(e) {
66
- if (!loading && !disabled && onClick) {
67
- onClick(e);
68
- }
69
- };
70
-
71
- var getStyle = function getStyle() {
72
- var style = {};
73
-
74
- if (color) {
75
- if (plain) {
76
- style.color = color;
77
- style.background = '#fff';
78
-
79
- if (!(color !== null && color !== void 0 && color.includes('gradient'))) {
80
- style.borderColor = color;
81
- }
82
- } else {
83
- style.color = '#fff';
84
- style.background = color;
85
- }
86
- }
87
-
88
- return style;
89
- };
90
-
91
- return React__default.createElement("div", _objectSpread(_objectSpread({
92
- className: "".concat(btnName, " ").concat(className),
93
- style: _objectSpread(_objectSpread({}, btnStyle), style)
94
- }, rest), {}, {
95
- onClick: function onClick(e) {
96
- return handleClick(e);
97
- }
98
- }), React__default.createElement("div", {
99
- className: "nut-button__warp",
100
- style: getStyle()
101
- }, loading && React__default.createElement(Icon, {
102
- name: "loading"
103
- }), !loading && icon ? React__default.createElement(Icon, {
104
- name: icon
105
- }) : '', children));
106
- };
107
-
108
- Button.defaultProps = defaultProps;
109
- Button.displayName = 'NutButton';
110
- export { Button as B };
@@ -1,70 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["name", "size", "classPrefix", "color", "tag", "children", "className", "style", "click"];
4
-
5
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
-
7
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
-
9
- import React__default from 'react';
10
- import { c as cn } from './bem-893ad28d.js';
11
- var defaultProps = {
12
- name: '',
13
- size: '',
14
- classPrefix: 'nutui-iconfont',
15
- color: '',
16
- tag: 'i',
17
- click: function click(e) {},
18
- className: ''
19
- };
20
-
21
- function pxCheck(value) {
22
- return Number.isNaN(Number(value)) ? String(value) : "".concat(value, "px");
23
- }
24
-
25
- var Icon = function Icon(props) {
26
- var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
27
- name = _defaultProps$props.name,
28
- size = _defaultProps$props.size,
29
- classPrefix = _defaultProps$props.classPrefix,
30
- color = _defaultProps$props.color,
31
- tag = _defaultProps$props.tag,
32
- children = _defaultProps$props.children,
33
- className = _defaultProps$props.className,
34
- style = _defaultProps$props.style,
35
- click = _defaultProps$props.click,
36
- rest = _objectWithoutProperties(_defaultProps$props, _excluded);
37
-
38
- var isImage = name ? name.indexOf('/') !== -1 : false;
39
- var type = isImage ? 'img' : tag;
40
- var b = cn('icon');
41
-
42
- var handleClick = function handleClick(e) {
43
- if (props.click) {
44
- props.click(e);
45
- }
46
- };
47
-
48
- var hasSrc = function hasSrc() {
49
- if (isImage) return {
50
- src: name
51
- };
52
- return {};
53
- };
54
-
55
- return React__default.createElement(type, _objectSpread(_objectSpread({
56
- className: isImage ? "".concat(className || '', " ").concat(b('img')) : "".concat(className || '', " ").concat(b(null, [classPrefix]), " nut-icon-").concat(name, " "),
57
- style: _objectSpread({
58
- color: color,
59
- fontSize: pxCheck(size),
60
- width: pxCheck(size),
61
- height: pxCheck(size)
62
- }, style)
63
- }, rest), {}, {
64
- onClick: handleClick
65
- }, hasSrc()), children);
66
- };
67
-
68
- Icon.defaultProps = defaultProps;
69
- Icon.displayName = 'NutIcon';
70
- export { Icon as I };
@@ -1,294 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/inherits";
5
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
-
9
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
-
11
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
12
-
13
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
14
-
15
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
16
-
17
- import * as React from 'react';
18
- import * as ReactDOM from 'react-dom';
19
- import { c as cn } from './bem-893ad28d.js';
20
- import { I as Icon } from './icon-63c0d58f.js';
21
- import classNames from 'classnames';
22
-
23
- var Notification = /*#__PURE__*/function (_React$PureComponent) {
24
- _inherits(Notification, _React$PureComponent);
25
-
26
- var _super = _createSuper(Notification);
27
-
28
- function Notification(props) {
29
- var _this;
30
-
31
- _classCallCheck(this, Notification);
32
-
33
- _this = _super.call(this, props);
34
-
35
- _defineProperty(_assertThisInitialized(_this), "closeTimer", void 0);
36
-
37
- _this.close = _this.close.bind(_assertThisInitialized(_this));
38
- _this.startCloseTimer = _this.startCloseTimer.bind(_assertThisInitialized(_this));
39
- _this.clearCloseTimer = _this.clearCloseTimer.bind(_assertThisInitialized(_this));
40
- _this.close = _this.close.bind(_assertThisInitialized(_this));
41
- _this.clickCover = _this.clickCover.bind(_assertThisInitialized(_this));
42
- _this.state = {
43
- show: true
44
- };
45
- return _this;
46
- }
47
-
48
- _createClass(Notification, [{
49
- key: "close",
50
- value: function close() {
51
- this.setState({
52
- show: false
53
- });
54
- this.clearCloseTimer();
55
- this.props.onClose();
56
- }
57
- }, {
58
- key: "startCloseTimer",
59
- value: function startCloseTimer() {
60
- var _this2 = this;
61
-
62
- var duration = this.props.duration;
63
-
64
- if (duration) {
65
- this.closeTimer = window.setTimeout(function () {
66
- _this2.close();
67
- }, duration * 1000);
68
- }
69
- }
70
- }, {
71
- key: "clearCloseTimer",
72
- value: function clearCloseTimer() {
73
- if (this.closeTimer) {
74
- clearTimeout(this.closeTimer);
75
- this.closeTimer = -1;
76
- }
77
- }
78
- }, {
79
- key: "clickCover",
80
- value: function clickCover() {
81
- var closeOnClickOverlay = this.props.closeOnClickOverlay;
82
-
83
- if (closeOnClickOverlay) {
84
- this.close();
85
- }
86
- }
87
- }, {
88
- key: "componentDidMount",
89
- value: function componentDidMount() {
90
- this.startCloseTimer();
91
- }
92
- }, {
93
- key: "componentWillUnmount",
94
- value: function componentWillUnmount() {
95
- this.clearCloseTimer();
96
- }
97
- }, {
98
- key: "render",
99
- value: function render() {
100
- var _classNames,
101
- _this3 = this;
102
-
103
- var _this$props = this.props,
104
- style = _this$props.style,
105
- icon = _this$props.icon,
106
- msg = _this$props.msg,
107
- bottom = _this$props.bottom,
108
- center = _this$props.center,
109
- bgColor = _this$props.bgColor,
110
- coverColor = _this$props.coverColor,
111
- textAlignCenter = _this$props.textAlignCenter,
112
- size = _this$props.size,
113
- customClass = _this$props.customClass,
114
- cover = _this$props.cover,
115
- type = _this$props.type;
116
- this.state;
117
- var toastBem = cn('toast');
118
- var classes = classNames((_classNames = {}, _defineProperty(_classNames, 'nut-toast-center', center), _defineProperty(_classNames, 'nut-toast-has-icon', icon), _defineProperty(_classNames, 'nut-toast-cover', cover), _defineProperty(_classNames, 'nut-toast-loading', type === 'loading'), _defineProperty(_classNames, "customClass", customClass), _defineProperty(_classNames, 'nut-toast-' + size, true), _classNames));
119
- return React.createElement(React.Fragment, null, React.createElement("div", {
120
- className: "".concat(toastBem(), " ").concat(classes),
121
- style: {
122
- bottom: center ? 'auto' : bottom + 'px',
123
- backgroundColor: cover ? coverColor : ''
124
- },
125
- onClick: function onClick() {
126
- _this3.clickCover();
127
- }
128
- }, React.createElement("div", {
129
- className: toastBem('inner'),
130
- style: {
131
- textAlign: textAlignCenter ? 'center' : 'left',
132
- backgroundColor: bgColor
133
- }
134
- }, icon ? React.createElement("p", {
135
- className: toastBem('icon-wrapper')
136
- }, React.createElement(Icon, {
137
- name: icon ? icon : '',
138
- size: "20"
139
- })) : null, React.createElement("span", {
140
- className: toastBem('text')
141
- }, msg))));
142
- }
143
- }]);
144
-
145
- return Notification;
146
- }(React.PureComponent);
147
-
148
- _defineProperty(Notification, "newInstance", void 0);
149
-
150
- Notification.newInstance = function (properties, callback) {
151
- var element = document.createElement('div');
152
-
153
- if (properties.id) {
154
- element.setAttribute('id', "".concat(properties.id));
155
- }
156
-
157
- document.body.appendChild(element);
158
- var called = false;
159
-
160
- function ref(instance) {
161
- if (called) {
162
- return;
163
- }
164
-
165
- called = true;
166
- callback({
167
- component: instance,
168
- destroy: function destroy() {
169
- ReactDOM.unmountComponentAtNode(element);
170
- element && element.parentNode && element.parentNode.removeChild(element);
171
- }
172
- });
173
- }
174
-
175
- ReactDOM.render(React.createElement(Notification, _objectSpread(_objectSpread({}, properties), {}, {
176
- ref: ref
177
- })), element);
178
- };
179
-
180
- var messageInstance = null;
181
- var options = {
182
- msg: '',
183
- id: '',
184
- duration: 1.5,
185
- center: true,
186
- type: 'text',
187
- customClass: '',
188
- bottom: 30,
189
- size: 'base',
190
- icon: '',
191
- textAlignCenter: true,
192
- loadingRotate: true,
193
- bgColor: 'rgba(0, 0, 0, .8)',
194
- onClose: function onClose() {},
195
- cover: false,
196
- coverColor: 'rgba(0, 0, 0, 0)',
197
- closeOnClickOverlay: false // 是否点击遮罩可关闭
198
-
199
- };
200
-
201
- function getInstance(props, callback) {
202
- if (messageInstance) {
203
- messageInstance.destroy();
204
- messageInstance = null;
205
- }
206
-
207
- Notification.newInstance(props, function (notification) {
208
- return callback && callback(notification);
209
- });
210
- }
211
-
212
- function notice(opts) {
213
- function close() {
214
- if (messageInstance) {
215
- messageInstance.destroy();
216
- messageInstance = null;
217
- }
218
- }
219
-
220
- opts = _objectSpread(_objectSpread(_objectSpread({}, options), opts), {}, {
221
- onClose: close
222
- });
223
- getInstance(opts, function (notification) {
224
- messageInstance = notification;
225
- });
226
- }
227
-
228
- var errorMsg = function errorMsg(msg) {
229
- if (!msg) {
230
- console.warn('[NutUI Toast]: msg不能为空');
231
- return;
232
- }
233
- };
234
-
235
- var Toast = {
236
- text: function text(msg) {
237
- var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
238
- errorMsg(msg);
239
- return notice(_objectSpread({
240
- msg: msg,
241
- type: 'text'
242
- }, option));
243
- },
244
- success: function success(msg) {
245
- var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
246
- errorMsg(msg);
247
- return notice(_objectSpread({
248
- msg: msg,
249
- icon: 'success',
250
- type: 'success'
251
- }, option));
252
- },
253
- fail: function fail(msg) {
254
- var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
255
- errorMsg(msg);
256
- return notice(_objectSpread({
257
- msg: msg,
258
- icon: 'failure',
259
- type: 'fail'
260
- }, option));
261
- },
262
- loading: function loading(msg) {
263
- var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
264
- errorMsg(msg);
265
- return notice(_objectSpread({
266
- msg: msg,
267
- icon: 'loading',
268
- type: 'loading'
269
- }, option));
270
- },
271
- warn: function warn(msg) {
272
- var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
273
- errorMsg(msg);
274
- return notice(_objectSpread({
275
- msg: msg,
276
- icon: 'tips',
277
- type: 'warn'
278
- }, option));
279
- },
280
- customIcon: function customIcon(msg) {
281
- var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
282
- errorMsg(msg);
283
- return notice(_objectSpread({
284
- msg: msg
285
- }, option));
286
- },
287
- hide: function hide() {
288
- if (messageInstance) {
289
- messageInstance.destroy();
290
- messageInstance = null;
291
- }
292
- }
293
- };
294
- export { Toast as T };