@blocklet/labels 2.4.36 → 2.4.38
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/dist/components/label/context.d.ts +3 -2
- package/dist/components/label/context.mjs +87 -0
- package/dist/components/label/index.mjs +5 -0
- package/dist/components/label/label-picker.d.ts +2 -1
- package/dist/components/label/label-picker.mjs +175 -0
- package/dist/components/label/label-tree.d.ts +2 -1
- package/dist/components/label/label-tree.mjs +124 -0
- package/dist/components/label/labels.d.ts +3 -3
- package/dist/components/label/labels.mjs +82 -0
- package/dist/components/label/types.mjs +0 -0
- package/dist/components/label/utils.mjs +52 -0
- package/dist/global.d.ts +1 -0
- package/dist/index.mjs +7 -0
- package/dist/label2/github-label-picker.d.ts +3 -2
- package/dist/label2/github-label-picker.mjs +372 -0
- package/dist/label2/labels-context.d.ts +8 -8
- package/dist/label2/labels-context.mjs +137 -0
- package/dist/label2/labels-input.d.ts +3 -2
- package/dist/label2/labels-input.mjs +54 -0
- package/dist/label2/labels2.d.ts +5 -5
- package/dist/label2/labels2.mjs +222 -0
- package/dist/label2/session.d.ts +1 -3
- package/dist/label2/session.mjs +17 -0
- package/dist/label2/tree.d.ts +1 -1
- package/dist/label2/tree.mjs +130 -0
- package/dist/request-cache.mjs +82 -0
- package/dist/test/fixtures/index.d.ts +1 -1
- package/dist/test/fixtures/index.mjs +73 -0
- package/dist/type-override.d.ts +7 -0
- package/dist/types.mjs +0 -0
- package/dist/vite-env.d.ts +1 -0
- package/package.json +9 -16
- package/dist/index.es.js +0 -1463
- package/dist/index.umd.js +0 -1450
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Chip, useTheme } from "@mui/material";
|
|
3
|
+
import chroma from "chroma-js";
|
|
4
|
+
import CloseOutlineIcon from "@mui/icons-material/Close";
|
|
5
|
+
import { useSize, useDeepCompareLayoutEffect } from "ahooks";
|
|
6
|
+
import { useRef, useState } from "react";
|
|
7
|
+
import { LabelsContainer } from "./labels-context.mjs";
|
|
8
|
+
const getTextColor = (color, mode) => {
|
|
9
|
+
const baseColor = chroma(color);
|
|
10
|
+
if (mode === "dark") {
|
|
11
|
+
return baseColor.brighten(4).hex();
|
|
12
|
+
}
|
|
13
|
+
return baseColor.hex();
|
|
14
|
+
};
|
|
15
|
+
const getBorderColor = (color, mode) => {
|
|
16
|
+
const baseColor = chroma(color);
|
|
17
|
+
if (mode === "dark") {
|
|
18
|
+
return baseColor.brighten(2).alpha(0.4).hex();
|
|
19
|
+
}
|
|
20
|
+
if (baseColor.luminance() > 0.5) {
|
|
21
|
+
return baseColor.darken(3).hex();
|
|
22
|
+
}
|
|
23
|
+
return baseColor.brighten(0.5).alpha(0.25).hex();
|
|
24
|
+
};
|
|
25
|
+
const getBackgroundColor = (color, mode) => {
|
|
26
|
+
const baseColor = chroma(color);
|
|
27
|
+
if (mode === "dark") {
|
|
28
|
+
if (baseColor.luminance() > 0.5) {
|
|
29
|
+
return baseColor.darken(2).alpha(0.5).hex();
|
|
30
|
+
}
|
|
31
|
+
return baseColor.brighten(1.5).alpha(0.35).hex();
|
|
32
|
+
}
|
|
33
|
+
if (baseColor.luminance() > 0.5) {
|
|
34
|
+
return baseColor.darken(2.5).hex();
|
|
35
|
+
}
|
|
36
|
+
return baseColor.brighten(2.5).alpha(0.25).hex();
|
|
37
|
+
};
|
|
38
|
+
const getFilterStyle = (color, mode) => {
|
|
39
|
+
const baseColor = chroma(color);
|
|
40
|
+
if (mode === "dark") {
|
|
41
|
+
return "brightness(1.3) contrast(1.2)";
|
|
42
|
+
}
|
|
43
|
+
if (baseColor.luminance() > 0.5) {
|
|
44
|
+
return "brightness(0.85) contrast(1.2)";
|
|
45
|
+
}
|
|
46
|
+
return "brightness(0.85) contrast(1.2)";
|
|
47
|
+
};
|
|
48
|
+
export function LabelChip({
|
|
49
|
+
label,
|
|
50
|
+
onDelete,
|
|
51
|
+
sx,
|
|
52
|
+
fullName = true,
|
|
53
|
+
onClick,
|
|
54
|
+
disabled = false,
|
|
55
|
+
renderName = (name) => name
|
|
56
|
+
}) {
|
|
57
|
+
const { getFullLabelName, getLabelName } = LabelsContainer.useContainer();
|
|
58
|
+
const theme = useTheme();
|
|
59
|
+
const { mode } = theme.palette;
|
|
60
|
+
const color = getTextColor(label.data.color, mode);
|
|
61
|
+
const mergedSx = [
|
|
62
|
+
{
|
|
63
|
+
height: 20,
|
|
64
|
+
borderRadius: 0.5,
|
|
65
|
+
fontSize: 12,
|
|
66
|
+
fontWeight: 500,
|
|
67
|
+
color: `${color} !important`,
|
|
68
|
+
bgcolor: `${getBackgroundColor(label.data.color, mode)} !important`,
|
|
69
|
+
transition: "filter 0.2s",
|
|
70
|
+
borderColor: `${getBorderColor(label.data.color, mode)} !important`,
|
|
71
|
+
WebkitTextFillColor: `${color} !important`,
|
|
72
|
+
".MuiChip-deleteIcon": {
|
|
73
|
+
color: `${color} !important`,
|
|
74
|
+
cursor: "pointer",
|
|
75
|
+
transition: "transform 0.3s",
|
|
76
|
+
"&:hover": {
|
|
77
|
+
transform: "rotate(90deg)"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
".MuiChip-label": {
|
|
81
|
+
px: 0.5,
|
|
82
|
+
maxHeight: 20
|
|
83
|
+
},
|
|
84
|
+
...onClick && {
|
|
85
|
+
cursor: "pointer",
|
|
86
|
+
"&:hover": {
|
|
87
|
+
filter: getFilterStyle(label.data.color, mode)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
...Array.isArray(sx) ? sx : [sx]
|
|
92
|
+
];
|
|
93
|
+
const hasDelete = !disabled && !!onDelete;
|
|
94
|
+
const hasOnClick = !disabled && !!onClick;
|
|
95
|
+
return (
|
|
96
|
+
// @ts-ignore
|
|
97
|
+
/* @__PURE__ */ jsx(
|
|
98
|
+
Chip,
|
|
99
|
+
{
|
|
100
|
+
label: renderName(fullName ? getFullLabelName(label.data.id) : getLabelName(label.data.id)),
|
|
101
|
+
variant: "outlined",
|
|
102
|
+
size: "small",
|
|
103
|
+
...hasDelete && {
|
|
104
|
+
onDelete: (e) => {
|
|
105
|
+
e.stopPropagation();
|
|
106
|
+
e.preventDefault();
|
|
107
|
+
onDelete(label);
|
|
108
|
+
},
|
|
109
|
+
deleteIcon: /* @__PURE__ */ jsx(CloseOutlineIcon, {})
|
|
110
|
+
},
|
|
111
|
+
...hasOnClick && {
|
|
112
|
+
onClick: (e) => {
|
|
113
|
+
e.stopPropagation();
|
|
114
|
+
e.preventDefault();
|
|
115
|
+
onClick(label);
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
sx: mergedSx
|
|
119
|
+
},
|
|
120
|
+
label.data.id
|
|
121
|
+
)
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
export function Labels2({
|
|
125
|
+
compact = true,
|
|
126
|
+
labels,
|
|
127
|
+
sx,
|
|
128
|
+
renderLabel,
|
|
129
|
+
renderWhenEmpty,
|
|
130
|
+
prepend,
|
|
131
|
+
displaySystemLabels = true,
|
|
132
|
+
onItemClick
|
|
133
|
+
}) {
|
|
134
|
+
const { getLabelsByIds, loading } = LabelsContainer.useContainer();
|
|
135
|
+
const labelsWrapperRef = useRef(null);
|
|
136
|
+
const [overflowIndex, setOverflowIndex] = useState(99999);
|
|
137
|
+
let labelNodes = getLabelsByIds(labels || []);
|
|
138
|
+
const size = useSize(labelsWrapperRef);
|
|
139
|
+
useDeepCompareLayoutEffect(() => {
|
|
140
|
+
if (compact) {
|
|
141
|
+
if (labelsWrapperRef.current) {
|
|
142
|
+
const { right } = labelsWrapperRef.current.getBoundingClientRect();
|
|
143
|
+
const labelElements = labelsWrapperRef.current.querySelectorAll(".MuiChip-root");
|
|
144
|
+
if (labelElements?.length > 0) {
|
|
145
|
+
Array.from(labelElements).some((x, i) => {
|
|
146
|
+
const rect = x.getBoundingClientRect();
|
|
147
|
+
if (rect.right > right - 36) {
|
|
148
|
+
setOverflowIndex(i);
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
return false;
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
} else {
|
|
156
|
+
setOverflowIndex(99999);
|
|
157
|
+
}
|
|
158
|
+
}, [size, compact]);
|
|
159
|
+
if (loading) {
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
if (!displaySystemLabels) {
|
|
163
|
+
labelNodes = labelNodes.filter((x) => x.data.type !== "system");
|
|
164
|
+
}
|
|
165
|
+
const mergedSx = [
|
|
166
|
+
{
|
|
167
|
+
display: "flex",
|
|
168
|
+
gap: 1,
|
|
169
|
+
width: "100%",
|
|
170
|
+
alignItems: "center",
|
|
171
|
+
overflow: "hidden",
|
|
172
|
+
flexWrap: compact ? "no-wrap" : "wrap"
|
|
173
|
+
},
|
|
174
|
+
...Array.isArray(sx) ? sx : [sx]
|
|
175
|
+
];
|
|
176
|
+
return /* @__PURE__ */ jsxs(Box, { sx: mergedSx, ref: labelsWrapperRef, children: [
|
|
177
|
+
prepend,
|
|
178
|
+
labelNodes.map((item, index) => {
|
|
179
|
+
if (!item) {
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
const visible = index < overflowIndex;
|
|
183
|
+
let extra = null;
|
|
184
|
+
if (index === overflowIndex) {
|
|
185
|
+
extra = /* @__PURE__ */ jsx(
|
|
186
|
+
Box,
|
|
187
|
+
{
|
|
188
|
+
sx: {
|
|
189
|
+
display: "inline-flex",
|
|
190
|
+
...compact && { height: 20, lineHeight: "20px" },
|
|
191
|
+
color: "text.secondary",
|
|
192
|
+
fontWeight: "bold",
|
|
193
|
+
fontSize: 14
|
|
194
|
+
},
|
|
195
|
+
children: `+${labelNodes.length - overflowIndex}`
|
|
196
|
+
},
|
|
197
|
+
"overflow-label"
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
let labelChip = /* @__PURE__ */ jsx(
|
|
201
|
+
LabelChip,
|
|
202
|
+
{
|
|
203
|
+
label: item,
|
|
204
|
+
onClick: onItemClick,
|
|
205
|
+
sx: {
|
|
206
|
+
visibility: visible ? "visible" : "hidden",
|
|
207
|
+
pointerEvents: visible ? "auto" : "none"
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
item.data.id
|
|
211
|
+
);
|
|
212
|
+
if (renderLabel) {
|
|
213
|
+
labelChip = renderLabel(item, labelChip);
|
|
214
|
+
}
|
|
215
|
+
if (extra) {
|
|
216
|
+
return [extra, labelChip];
|
|
217
|
+
}
|
|
218
|
+
return labelChip;
|
|
219
|
+
}),
|
|
220
|
+
labelNodes.length === 0 && renderWhenEmpty
|
|
221
|
+
] });
|
|
222
|
+
}
|
package/dist/label2/session.d.ts
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { SessionContext } from "@arcblock/did-connect-react/lib/Session";
|
|
3
|
+
export const useSessionContext = () => {
|
|
4
|
+
const ctx = useContext(SessionContext) || {};
|
|
5
|
+
const loginRole = ctx?.session?.user?.role;
|
|
6
|
+
return {
|
|
7
|
+
...ctx,
|
|
8
|
+
isAdmin: ["admin", "owner"].includes(loginRole),
|
|
9
|
+
hasAnyPassport: (passports) => {
|
|
10
|
+
if (!passports || passports.length === 0) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
const passportsArr = Array.isArray(passports) ? passports : [passports];
|
|
14
|
+
return passportsArr.includes(loginRole);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
};
|
package/dist/label2/tree.d.ts
CHANGED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { arrayToTree } from "performant-array-to-tree";
|
|
2
|
+
export class TreeNode {
|
|
3
|
+
data;
|
|
4
|
+
parent;
|
|
5
|
+
children;
|
|
6
|
+
constructor({ data, parent, children }) {
|
|
7
|
+
this.data = data;
|
|
8
|
+
this.parent = parent;
|
|
9
|
+
this.children = children || [];
|
|
10
|
+
}
|
|
11
|
+
setParent(node) {
|
|
12
|
+
this.parent = node;
|
|
13
|
+
}
|
|
14
|
+
add(...nodes) {
|
|
15
|
+
this.children.push(...nodes);
|
|
16
|
+
nodes.forEach((node) => node.setParent(this));
|
|
17
|
+
}
|
|
18
|
+
removeChild(node) {
|
|
19
|
+
this.children = this.children.filter((x) => x !== node);
|
|
20
|
+
node.setParent(void 0);
|
|
21
|
+
}
|
|
22
|
+
isLeaf(node) {
|
|
23
|
+
return !node.children?.length;
|
|
24
|
+
}
|
|
25
|
+
getAllParents(includeSelf = true) {
|
|
26
|
+
const parents = [];
|
|
27
|
+
if (includeSelf) {
|
|
28
|
+
parents.unshift(this);
|
|
29
|
+
}
|
|
30
|
+
let { parent } = this;
|
|
31
|
+
while (parent) {
|
|
32
|
+
parents.unshift(parent);
|
|
33
|
+
parent = parent.parent;
|
|
34
|
+
}
|
|
35
|
+
return parents;
|
|
36
|
+
}
|
|
37
|
+
getAllSiblings() {
|
|
38
|
+
const siblings = this.parent?.children.filter((node) => node !== this) || [];
|
|
39
|
+
return siblings;
|
|
40
|
+
}
|
|
41
|
+
flatten(includeRoot) {
|
|
42
|
+
const nodes = [];
|
|
43
|
+
const traverse = (node) => {
|
|
44
|
+
nodes.push(node);
|
|
45
|
+
node.children.forEach(traverse);
|
|
46
|
+
};
|
|
47
|
+
traverse(this);
|
|
48
|
+
if (!includeRoot) {
|
|
49
|
+
nodes.shift();
|
|
50
|
+
}
|
|
51
|
+
return nodes;
|
|
52
|
+
}
|
|
53
|
+
clone() {
|
|
54
|
+
const cloned = new TreeNode({ data: this.data });
|
|
55
|
+
cloned.add(...this.children);
|
|
56
|
+
return cloned;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
class Label {
|
|
60
|
+
id;
|
|
61
|
+
name;
|
|
62
|
+
desc;
|
|
63
|
+
image;
|
|
64
|
+
icon;
|
|
65
|
+
type;
|
|
66
|
+
color;
|
|
67
|
+
passports;
|
|
68
|
+
translation;
|
|
69
|
+
constructor(data) {
|
|
70
|
+
this.id = data.id;
|
|
71
|
+
this.name = data.name;
|
|
72
|
+
this.desc = data.desc;
|
|
73
|
+
this.image = data.image;
|
|
74
|
+
this.icon = data.icon;
|
|
75
|
+
this.type = data.type;
|
|
76
|
+
this.color = data.color || "#ddd";
|
|
77
|
+
this.passports = data.passports || [];
|
|
78
|
+
this.translation = this._normalizeTranslation(data.translation);
|
|
79
|
+
}
|
|
80
|
+
_normalizeTranslation(translation) {
|
|
81
|
+
if (typeof translation === "object") {
|
|
82
|
+
return translation;
|
|
83
|
+
}
|
|
84
|
+
try {
|
|
85
|
+
return JSON.parse(translation);
|
|
86
|
+
} catch {
|
|
87
|
+
return {};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
getName(locale) {
|
|
91
|
+
if (!locale) {
|
|
92
|
+
return this.name;
|
|
93
|
+
}
|
|
94
|
+
return this?.translation?.[locale] || this?.name;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
export class LabelTreeNode extends TreeNode {
|
|
98
|
+
static Label = Label;
|
|
99
|
+
getName(locale) {
|
|
100
|
+
return this.data.getName(locale);
|
|
101
|
+
}
|
|
102
|
+
isSystemLabel() {
|
|
103
|
+
return this.data.type === "system";
|
|
104
|
+
}
|
|
105
|
+
getFullName(locale) {
|
|
106
|
+
const parents = this.getAllParents();
|
|
107
|
+
parents.shift();
|
|
108
|
+
if (locale) {
|
|
109
|
+
return parents.map((item) => item.getName(locale)).join(" / ");
|
|
110
|
+
}
|
|
111
|
+
return parents.map((item) => item.data.name).join(" / ");
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const mapToTree = (items, parent) => {
|
|
115
|
+
return items.map((item) => {
|
|
116
|
+
const node = new LabelTreeNode({ data: new Label(item.data), parent });
|
|
117
|
+
const children = mapToTree(item.children || [], node);
|
|
118
|
+
node.add(...children);
|
|
119
|
+
return node;
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
export const initLabelTree = (data) => {
|
|
123
|
+
const treeData = arrayToTree(data);
|
|
124
|
+
const root = new LabelTreeNode({ data: {} });
|
|
125
|
+
root.add(...mapToTree(treeData));
|
|
126
|
+
return root;
|
|
127
|
+
};
|
|
128
|
+
export const createEmptyLabelTree = () => {
|
|
129
|
+
return new LabelTreeNode({ data: {}, children: [] });
|
|
130
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export const createCacheKey = (args) => {
|
|
2
|
+
return args.map((x) => typeof x === "string" ? x : JSON.stringify(x)).join("-");
|
|
3
|
+
};
|
|
4
|
+
const CACHE_PREFIX = "request-cache-";
|
|
5
|
+
const getStorageKey = (key) => `${CACHE_PREFIX}${key}`;
|
|
6
|
+
const serialize = (data) => {
|
|
7
|
+
try {
|
|
8
|
+
return JSON.stringify(data);
|
|
9
|
+
} catch (error) {
|
|
10
|
+
console.warn("Failed to serialize cache data:", error);
|
|
11
|
+
return "";
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
const deserialize = (data) => {
|
|
15
|
+
try {
|
|
16
|
+
return JSON.parse(data);
|
|
17
|
+
} catch (error) {
|
|
18
|
+
console.warn("Failed to deserialize cache data:", error);
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const setCache = (key, cachedData, options = {}) => {
|
|
23
|
+
const storageKey = getStorageKey(key);
|
|
24
|
+
const expiresAt = options.cacheTime ? Date.now() + options.cacheTime : Number.MAX_SAFE_INTEGER;
|
|
25
|
+
const recordData = {
|
|
26
|
+
...cachedData,
|
|
27
|
+
expiresAt
|
|
28
|
+
};
|
|
29
|
+
localStorage.setItem(storageKey, serialize(recordData));
|
|
30
|
+
};
|
|
31
|
+
const getCache = (key) => {
|
|
32
|
+
const storageKey = getStorageKey(key);
|
|
33
|
+
const cachedData = localStorage.getItem(storageKey);
|
|
34
|
+
if (!cachedData) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
const recordData = deserialize(cachedData);
|
|
38
|
+
if (!recordData) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
if (Date.now() > recordData.expiresAt) {
|
|
42
|
+
localStorage.removeItem(storageKey);
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
return recordData;
|
|
46
|
+
};
|
|
47
|
+
const clearCache = (key) => {
|
|
48
|
+
if (key) {
|
|
49
|
+
const cacheKeys = Array.isArray(key) ? key : [key];
|
|
50
|
+
cacheKeys.forEach((cacheKey) => {
|
|
51
|
+
const storageKey = getStorageKey(cacheKey);
|
|
52
|
+
localStorage.removeItem(storageKey);
|
|
53
|
+
});
|
|
54
|
+
} else {
|
|
55
|
+
const keysToRemove = [];
|
|
56
|
+
for (let i = 0; i < localStorage.length; i++) {
|
|
57
|
+
const storageKey = localStorage.key(i);
|
|
58
|
+
if (storageKey && storageKey.startsWith(CACHE_PREFIX)) {
|
|
59
|
+
keysToRemove.push(storageKey);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
keysToRemove.forEach((x) => localStorage.removeItem(x));
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const cleanupExpiredCache = () => {
|
|
66
|
+
const keysToRemove = [];
|
|
67
|
+
for (let i = 0; i < localStorage.length; i++) {
|
|
68
|
+
const key = localStorage.key(i);
|
|
69
|
+
if (key && key.startsWith(CACHE_PREFIX)) {
|
|
70
|
+
const cachedData = localStorage.getItem(key);
|
|
71
|
+
if (cachedData) {
|
|
72
|
+
const recordData = deserialize(cachedData);
|
|
73
|
+
if (recordData?.expiresAt && Date.now() > recordData.expiresAt) {
|
|
74
|
+
keysToRemove.push(key);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
keysToRemove.forEach((key) => localStorage.removeItem(key));
|
|
80
|
+
};
|
|
81
|
+
cleanupExpiredCache();
|
|
82
|
+
export { getCache, setCache, clearCache };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Label } from '../../components/label/types';
|
|
1
|
+
import type { Label } from '../../components/label/types';
|
|
2
2
|
export declare const labels: Label[];
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export const labels = [
|
|
2
|
+
{
|
|
3
|
+
id: "priority",
|
|
4
|
+
name: "Priority",
|
|
5
|
+
color: "#ddd",
|
|
6
|
+
children: [
|
|
7
|
+
{
|
|
8
|
+
id: "priority-high",
|
|
9
|
+
name: "High",
|
|
10
|
+
color: "#f44336",
|
|
11
|
+
icon: "flat-color-icons:high-priority"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
id: "priority-medium",
|
|
15
|
+
name: "Medium",
|
|
16
|
+
color: "#ffc109",
|
|
17
|
+
icon: "flat-color-icons:medium-priority"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: "priority-low",
|
|
21
|
+
name: "Low",
|
|
22
|
+
color: "#4caf50",
|
|
23
|
+
icon: "flat-color-icons:low-priority"
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: "1",
|
|
29
|
+
name: "label-1",
|
|
30
|
+
color: "#ddd",
|
|
31
|
+
children: [
|
|
32
|
+
{
|
|
33
|
+
id: "1-1",
|
|
34
|
+
name: "label-1-1",
|
|
35
|
+
color: "#ddd",
|
|
36
|
+
children: [
|
|
37
|
+
{
|
|
38
|
+
id: "1-1-1",
|
|
39
|
+
name: "label-1-1-1",
|
|
40
|
+
color: "#ddd"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: "1-1-2",
|
|
44
|
+
name: "label-1-1-2",
|
|
45
|
+
color: "#ddd"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: "1-2",
|
|
51
|
+
name: "label-1-2",
|
|
52
|
+
color: "#ddd"
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: "2",
|
|
58
|
+
name: "label-2",
|
|
59
|
+
color: "#12ecf0"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: "3",
|
|
63
|
+
name: "label-3",
|
|
64
|
+
color: "#f3aa0e",
|
|
65
|
+
children: [
|
|
66
|
+
{
|
|
67
|
+
id: "3-1",
|
|
68
|
+
name: "label-3-1",
|
|
69
|
+
color: "#ddd"
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
];
|
package/dist/types.mjs
ADDED
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
package/package.json
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/labels",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.38",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
7
|
-
"main": "./dist/index.umd.js",
|
|
8
|
-
"module": "./dist/index.es.js",
|
|
9
|
-
"types": "./dist/index.d.ts",
|
|
10
7
|
"exports": {
|
|
11
|
-
".":
|
|
12
|
-
"import": "./dist/index.es.js",
|
|
13
|
-
"require": "./dist/index.umd.js"
|
|
14
|
-
},
|
|
15
|
-
"./src/*": "./src/*"
|
|
8
|
+
".": "./dist/index.mjs"
|
|
16
9
|
},
|
|
10
|
+
"main": "./dist/index.mjs",
|
|
11
|
+
"module": "./dist/index.mjs",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"sideEffects": false,
|
|
17
14
|
"publishConfig": {
|
|
18
15
|
"access": "public"
|
|
19
16
|
},
|
|
@@ -29,7 +26,7 @@
|
|
|
29
26
|
"react-color": "^2.19.3",
|
|
30
27
|
"react-select": "^5.8.1",
|
|
31
28
|
"unstated-next": "^1.1.0",
|
|
32
|
-
"@blocklet/translation-input": "2.4.
|
|
29
|
+
"@blocklet/translation-input": "2.4.38"
|
|
33
30
|
},
|
|
34
31
|
"peerDependencies": {
|
|
35
32
|
"@arcblock/did-connect-react": "^3.1.4",
|
|
@@ -62,18 +59,14 @@
|
|
|
62
59
|
"react-dom": "^19.1.0",
|
|
63
60
|
"rollup-plugin-node-externals": "^7.1.3",
|
|
64
61
|
"typescript": "^4.9.5",
|
|
62
|
+
"unbuild": "^3.6.0",
|
|
65
63
|
"unplugin-icons": "^0.14.15",
|
|
66
64
|
"vite": "^7.0.0",
|
|
67
65
|
"vite-plugin-dts": "^4.5.4",
|
|
68
66
|
"vite-plugin-libcss": "^1.1.2"
|
|
69
67
|
},
|
|
70
68
|
"scripts": {
|
|
71
|
-
"
|
|
72
|
-
"build": "tsc && vite build",
|
|
73
|
-
"build:watch": "vite build --watch",
|
|
74
|
-
"preview": "vite preview",
|
|
75
|
-
"storybook": "start-storybook -p 6007",
|
|
76
|
-
"build-storybook": "build-storybook",
|
|
69
|
+
"build": "unbuild",
|
|
77
70
|
"lint": "eslint src --ext .mjs,.js,.jsx,.ts,.tsx",
|
|
78
71
|
"lint:fix": "eslint src --ext .mjs,.js,.jsx,.ts,.tsx --fix"
|
|
79
72
|
}
|