@xfe-repo/mini-components 0.0.2 → 0.0.4

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.mjs ADDED
@@ -0,0 +1,118 @@
1
+ // src/Loading/index.tsx
2
+ function _define_property(obj, key, value) {
3
+ if (key in obj) {
4
+ Object.defineProperty(obj, key, {
5
+ value: value,
6
+ enumerable: true,
7
+ configurable: true,
8
+ writable: true
9
+ });
10
+ } else {
11
+ obj[key] = value;
12
+ }
13
+ return obj;
14
+ }
15
+ function _object_spread(target) {
16
+ for(var i = 1; i < arguments.length; i++){
17
+ var source = arguments[i] != null ? arguments[i] : {};
18
+ var ownKeys = Object.keys(source);
19
+ if (typeof Object.getOwnPropertySymbols === "function") {
20
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
21
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
22
+ }));
23
+ }
24
+ ownKeys.forEach(function(key) {
25
+ _define_property(target, key, source[key]);
26
+ });
27
+ }
28
+ return target;
29
+ }
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(props) {
37
+ var className = props.className, _props_tips = props.tips, tips = _props_tips === void 0 ? "加载中" : _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(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(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 ? "没有更多了" : _props_noMoreText, _props_loadingText = props.loadingText, loadingText = _props_loadingText === void 0 ? "加载中" : _props_loadingText, _props_loadMoreText = props.loadMoreText, loadMoreText = _props_loadMoreText === void 0 ? "加载更多" : _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,9 +1,21 @@
1
1
  {
2
2
  "name": "@xfe-repo/mini-components",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
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
+ },
7
19
  "files": [
8
20
  "dist"
9
21
  ],
@@ -16,8 +28,11 @@
16
28
  "@types/node": "^20.16.5",
17
29
  "@types/react": "^18",
18
30
  "esbuild-plugin-less": "^1.3.9",
19
- "@xfe-repo/typescript-config": "0.0.6",
20
- "@xfe-repo/eslint-config": "0.0.5"
31
+ "@xfe-repo/eslint-config": "0.0.5",
32
+ "@xfe-repo/typescript-config": "0.0.6"
33
+ },
34
+ "publishConfig": {
35
+ "registry": "https://registry.npmjs.org/"
21
36
  },
22
37
  "scripts": {
23
38
  "build": "tsup",