@xfe-repo/mini-components 0.0.3 → 1.5.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.
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+
3
+ interface LoadingRectProps extends LoadingProps {
4
+ tips?: string;
5
+ rectCount?: number;
6
+ }
7
+
8
+ interface LoadingListProps extends LoadingProps {
9
+ hasMore?: boolean;
10
+ loading?: boolean;
11
+ noMoreText?: string;
12
+ loadingText?: string;
13
+ loadMoreText?: string;
14
+ hide?: boolean;
15
+ }
16
+
17
+ interface LoadingCircleProps extends LoadingProps {
18
+ }
19
+
20
+ interface LoadingProps {
21
+ className?: string;
22
+ onClick?: () => void;
23
+ tips?: string;
24
+ }
25
+ declare const _default: React.FunctionComponent<LoadingProps> & {
26
+ Circle: React.NamedExoticComponent<LoadingCircleProps>;
27
+ List: React.NamedExoticComponent<LoadingListProps>;
28
+ Rect: React.NamedExoticComponent<LoadingRectProps>;
29
+ };
30
+
31
+ export { _default as Loading };
package/dist/index.js CHANGED
@@ -27,26 +27,30 @@ function _object_spread(target) {
27
27
  }
28
28
  return target;
29
29
  }
30
+ function _type_of(obj) {
31
+ "@swc/helpers - typeof";
32
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
33
+ }
30
34
  var __create = Object.create;
31
35
  var __defProp = Object.defineProperty;
32
36
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
33
37
  var __getOwnPropNames = Object.getOwnPropertyNames;
34
38
  var __getProtoOf = Object.getPrototypeOf;
35
39
  var __hasOwnProp = Object.prototype.hasOwnProperty;
36
- var __export = function(target, all) {
40
+ var __export = function __export(target, all) {
37
41
  for(var name in all)__defProp(target, name, {
38
42
  get: all[name],
39
43
  enumerable: true
40
44
  });
41
45
  };
42
- var __copyProps = function(to, from, except, desc) {
43
- if (from && typeof from === "object" || typeof from === "function") {
46
+ var __copyProps = function __copyProps(to, from, except, desc) {
47
+ if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
44
48
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
45
49
  try {
46
50
  var _loop = function() {
47
51
  var key = _step.value;
48
52
  if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
49
- get: function() {
53
+ get: function get() {
50
54
  return from[key];
51
55
  },
52
56
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
@@ -70,7 +74,7 @@ var __copyProps = function(to, from, except, desc) {
70
74
  }
71
75
  return to;
72
76
  };
73
- var __toESM = function(mod, isNodeMode, target) {
77
+ var __toESM = function __toESM(mod, isNodeMode, target) {
74
78
  return target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(// If the importer is in node compatibility mode or this is not an ESM
75
79
  // file that has been converted to a CommonJS file using a Babel-
76
80
  // compatible transform (i.e. "__esModule" has not been set), then set
@@ -80,19 +84,19 @@ var __toESM = function(mod, isNodeMode, target) {
80
84
  enumerable: true
81
85
  }) : target, mod);
82
86
  };
83
- var __toCommonJS = function(mod) {
87
+ var __toCommonJS = function __toCommonJS(mod) {
84
88
  return __copyProps(__defProp({}, "__esModule", {
85
89
  value: true
86
90
  }), mod);
87
91
  };
88
92
  // src/index.ts
89
- var src_exports = {};
90
- __export(src_exports, {
91
- Loading: function() {
93
+ var index_exports = {};
94
+ __export(index_exports, {
95
+ Loading: function Loading() {
92
96
  return Loading_default;
93
97
  }
94
98
  });
95
- module.exports = __toCommonJS(src_exports);
99
+ module.exports = __toCommonJS(index_exports);
96
100
  // src/Loading/index.tsx
97
101
  var import_react4 = require("react");
98
102
  // src/Loading/LoadingCircle.tsx
@@ -100,8 +104,8 @@ var import_react = require("react");
100
104
  var import_classnames = __toESM(require("classnames"));
101
105
  var import_components = require("@tarojs/components");
102
106
  var import_jsx_runtime = require("react/jsx-runtime");
103
- var LoadingCircle = function(props) {
104
- var className = props.className, _props_tips = props.tips, tips = _props_tips === void 0 ? "加载中" : _props_tips, onClick = props.onClick;
107
+ var LoadingCircle = function LoadingCircle(props) {
108
+ var className = props.className, _props_tips = props.tips, tips = _props_tips === void 0 ? "\u52A0\u8F7D\u4E2D" : _props_tips, onClick = props.onClick;
105
109
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.View, {
106
110
  className: (0, import_classnames.default)("circle_loading", !!className && className),
107
111
  onClick: onClick,
@@ -129,7 +133,7 @@ var import_react2 = require("react");
129
133
  var import_classnames2 = __toESM(require("classnames"));
130
134
  var import_components2 = require("@tarojs/components");
131
135
  var import_jsx_runtime2 = require("react/jsx-runtime");
132
- var LoadingRect = function(props) {
136
+ var LoadingRect = function LoadingRect(props) {
133
137
  var className = props.className, _props_rectCount = props.rectCount, rectCount = _props_rectCount === void 0 ? 5 : _props_rectCount, tips = props.tips, onClick = props.onClick;
134
138
  var max = rectCount <= 10 ? rectCount : 10;
135
139
  var rectNodes = [];
@@ -155,9 +159,9 @@ var LoadingRect = function(props) {
155
159
  var LoadingRect_default = (0, import_react2.memo)(LoadingRect);
156
160
  // src/Loading/LoadingList.tsx
157
161
  var import_jsx_runtime3 = require("react/jsx-runtime");
158
- var LoadingList = function(props) {
162
+ var LoadingList = function LoadingList(props) {
159
163
  var className = props.className, hasMore = props.hasMore, _props_loading = props.loading, loading = _props_loading === void 0 ? true : _props_loading, hide = props.hide, onClick = props.onClick;
160
- var _props_noMoreText = props.noMoreText, noMoreText = _props_noMoreText === void 0 ? "没有更多了" : _props_noMoreText, _props_loadingText = props.loadingText, loadingText = _props_loadingText === void 0 ? "加载中" : _props_loadingText, _props_loadMoreText = props.loadMoreText, loadMoreText = _props_loadMoreText === void 0 ? "加载更多" : _props_loadMoreText;
164
+ var _props_noMoreText = props.noMoreText, noMoreText = _props_noMoreText === void 0 ? "\u6CA1\u6709\u66F4\u591A\u4E86" : _props_noMoreText, _props_loadingText = props.loadingText, loadingText = _props_loadingText === void 0 ? "\u52A0\u8F7D\u4E2D" : _props_loadingText, _props_loadMoreText = props.loadMoreText, loadMoreText = _props_loadMoreText === void 0 ? "\u52A0\u8F7D\u66F4\u591A" : _props_loadMoreText;
161
165
  if (hide) return null;
162
166
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_components3.View, {
163
167
  className: (0, import_classnames3.default)("list_loading", !!className && className),
package/dist/index.mjs ADDED
@@ -0,0 +1,118 @@
1
+ function _define_property(obj, key, value) {
2
+ if (key in obj) {
3
+ Object.defineProperty(obj, key, {
4
+ value: value,
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true
8
+ });
9
+ } else {
10
+ obj[key] = value;
11
+ }
12
+ return obj;
13
+ }
14
+ function _object_spread(target) {
15
+ for(var i = 1; i < arguments.length; i++){
16
+ var source = arguments[i] != null ? arguments[i] : {};
17
+ var ownKeys = Object.keys(source);
18
+ if (typeof Object.getOwnPropertySymbols === "function") {
19
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
20
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
21
+ }));
22
+ }
23
+ ownKeys.forEach(function(key) {
24
+ _define_property(target, key, source[key]);
25
+ });
26
+ }
27
+ return target;
28
+ }
29
+ // src/Loading/index.tsx
30
+ import { memo as memo4 } from "react";
31
+ // src/Loading/LoadingCircle.tsx
32
+ import { memo } from "react";
33
+ import classnames from "classnames";
34
+ import { View, Text, Image } from "@tarojs/components";
35
+ import { jsx, jsxs } from "react/jsx-runtime";
36
+ var LoadingCircle = function LoadingCircle(props) {
37
+ var className = props.className, _props_tips = props.tips, tips = _props_tips === void 0 ? "\u52A0\u8F7D\u4E2D" : _props_tips, onClick = props.onClick;
38
+ return /* @__PURE__ */ jsxs(View, {
39
+ className: classnames("circle_loading", !!className && className),
40
+ onClick: onClick,
41
+ children: [
42
+ /* @__PURE__ */ jsx(View, {
43
+ className: "img_circle_wrapper",
44
+ children: /* @__PURE__ */ jsx(Image, {
45
+ className: "img_circle",
46
+ src: "https://imgs.eshetang.com/activity/a14fa2166ed698f3d04061f57e5ab9b9.png"
47
+ })
48
+ }),
49
+ /* @__PURE__ */ jsx(Text, {
50
+ children: tips
51
+ })
52
+ ]
53
+ });
54
+ };
55
+ var LoadingCircle_default = memo(LoadingCircle);
56
+ // src/Loading/LoadingList.tsx
57
+ import { memo as memo3 } from "react";
58
+ import classnames3 from "classnames";
59
+ import { View as View3 } from "@tarojs/components";
60
+ // src/Loading/LoadingRect.tsx
61
+ import { memo as memo2 } from "react";
62
+ import classnames2 from "classnames";
63
+ import { View as View2, Text as Text2 } from "@tarojs/components";
64
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
65
+ var LoadingRect = function LoadingRect(props) {
66
+ var className = props.className, _props_rectCount = props.rectCount, rectCount = _props_rectCount === void 0 ? 5 : _props_rectCount, tips = props.tips, onClick = props.onClick;
67
+ var max = rectCount <= 10 ? rectCount : 10;
68
+ var rectNodes = [];
69
+ for(var i = 1; i <= max; i++){
70
+ rectNodes.push(/* @__PURE__ */ jsx2(View2, {
71
+ className: classnames2("rect", "rect_".concat(i))
72
+ }, "rect_".concat(i)));
73
+ }
74
+ return /* @__PURE__ */ jsxs2(View2, {
75
+ onClick: onClick,
76
+ children: [
77
+ /* @__PURE__ */ jsx2(View2, {
78
+ className: classnames2("rect_loading", !!className && className),
79
+ children: rectNodes
80
+ }),
81
+ /* @__PURE__ */ jsx2(Text2, {
82
+ className: "rect_tips",
83
+ children: tips
84
+ })
85
+ ]
86
+ });
87
+ };
88
+ var LoadingRect_default = memo2(LoadingRect);
89
+ // src/Loading/LoadingList.tsx
90
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
91
+ var LoadingList = function LoadingList(props) {
92
+ var className = props.className, hasMore = props.hasMore, _props_loading = props.loading, loading = _props_loading === void 0 ? true : _props_loading, hide = props.hide, onClick = props.onClick;
93
+ var _props_noMoreText = props.noMoreText, noMoreText = _props_noMoreText === void 0 ? "\u6CA1\u6709\u66F4\u591A\u4E86" : _props_noMoreText, _props_loadingText = props.loadingText, loadingText = _props_loadingText === void 0 ? "\u52A0\u8F7D\u4E2D" : _props_loadingText, _props_loadMoreText = props.loadMoreText, loadMoreText = _props_loadMoreText === void 0 ? "\u52A0\u8F7D\u66F4\u591A" : _props_loadMoreText;
94
+ if (hide) return null;
95
+ return /* @__PURE__ */ jsxs3(View3, {
96
+ className: classnames3("list_loading", !!className && className),
97
+ onClick: onClick,
98
+ children: [
99
+ (loading || hasMore) && /* @__PURE__ */ jsx3(View3, {
100
+ className: "loading",
101
+ children: /* @__PURE__ */ jsx3(LoadingRect_default, {})
102
+ }),
103
+ hasMore ? loading ? loadingText : loadMoreText : noMoreText
104
+ ]
105
+ });
106
+ };
107
+ var LoadingList_default = memo3(LoadingList);
108
+ // src/Loading/index.tsx
109
+ import { jsx as jsx4 } from "react/jsx-runtime";
110
+ var Loading = memo4(function(props) {
111
+ return /* @__PURE__ */ jsx4(LoadingCircle_default, _object_spread({}, props));
112
+ });
113
+ var Loading_default = Object.assign(Loading, {
114
+ Circle: LoadingCircle_default,
115
+ List: LoadingList_default,
116
+ Rect: LoadingRect_default
117
+ });
118
+ export { Loading_default as Loading };
package/package.json CHANGED
@@ -1,28 +1,45 @@
1
1
  {
2
2
  "name": "@xfe-repo/mini-components",
3
- "version": "0.0.3",
3
+ "version": "1.5.0",
4
4
  "sideEffects": false,
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "import": {
10
+ "types": "./dist/index.d.mts",
11
+ "default": "./dist/index.mjs"
12
+ },
13
+ "require": {
14
+ "types": "./dist/index.d.ts",
15
+ "default": "./dist/index.js"
16
+ }
17
+ },
18
+ "./dist/index.css": "./dist/index.css"
19
+ },
7
20
  "files": [
8
21
  "dist"
9
22
  ],
10
23
  "dependencies": {
11
- "classnames": "^2.5.1",
12
- "@tarojs/components": "4.0.8"
24
+ "@tarojs/components": "4.0.8",
25
+ "classnames": "^2.5.1"
13
26
  },
14
27
  "devDependencies": {
15
28
  "@swc/core": "^1.3.100",
16
- "@types/node": "^20.16.5",
29
+ "@types/node": "^20.17.0",
17
30
  "@types/react": "^18",
18
31
  "esbuild-plugin-less": "^1.3.9",
19
- "@xfe-repo/eslint-config": "0.0.5",
20
- "@xfe-repo/typescript-config": "0.0.6"
32
+ "eslint": "8.57.1",
33
+ "@xfe-repo/eslint-config": "1.5.0",
34
+ "@xfe-repo/typescript-config": "1.5.0"
35
+ },
36
+ "publishConfig": {
37
+ "registry": "https://registry.npmjs.org/"
21
38
  },
22
39
  "scripts": {
23
40
  "build": "tsup",
24
41
  "dev": "tsup --watch",
25
- "lint": "eslint \"src/**/*.ts*\"",
42
+ "lint": "eslint \"src/**/*.ts*\" --fix",
26
43
  "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
27
44
  }
28
45
  }