@blocklet/labels 2.1.184 → 2.1.186
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/index.es.js +203 -208
- package/dist/index.umd.js +203 -208
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -1035,8 +1035,8 @@ function GithubLabelPicker({
|
|
|
1035
1035
|
const { isAdmin, hasAnyPassport } = useSessionContext();
|
|
1036
1036
|
const { flattenedLabels: labels, getLabelsByIds, loading, createLabel } = LabelsContainer.useContainer();
|
|
1037
1037
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
1038
|
-
const
|
|
1039
|
-
const
|
|
1038
|
+
const selectedLabelIds = value;
|
|
1039
|
+
const selectedLabels = useMemo(() => getLabelsByIds(selectedLabelIds), [getLabelsByIds, selectedLabelIds]);
|
|
1040
1040
|
const [inputValue, setInputValue] = useState("");
|
|
1041
1041
|
const exists = useMemo(
|
|
1042
1042
|
() => labels.some((x) => x.data.getName(locale).toLowerCase() === inputValue.toLowerCase()),
|
|
@@ -1053,12 +1053,11 @@ function GithubLabelPicker({
|
|
|
1053
1053
|
return;
|
|
1054
1054
|
}
|
|
1055
1055
|
event.preventDefault();
|
|
1056
|
-
setPendingValue(value);
|
|
1057
1056
|
setAnchorEl(event.currentTarget);
|
|
1058
1057
|
};
|
|
1059
1058
|
const handleClose = () => {
|
|
1060
1059
|
if (!updateImmediately) {
|
|
1061
|
-
onChange == null ? void 0 : onChange(
|
|
1060
|
+
onChange == null ? void 0 : onChange(selectedLabelIds);
|
|
1062
1061
|
}
|
|
1063
1062
|
setInputValue("");
|
|
1064
1063
|
if (anchorEl) {
|
|
@@ -1068,10 +1067,13 @@ function GithubLabelPicker({
|
|
|
1068
1067
|
};
|
|
1069
1068
|
const handleCreate = async () => {
|
|
1070
1069
|
const { id: id2 } = await createLabel(inputValue);
|
|
1071
|
-
|
|
1070
|
+
if (!multiple) {
|
|
1071
|
+
onChange == null ? void 0 : onChange([id2]);
|
|
1072
|
+
} else if (updateImmediately) {
|
|
1073
|
+
onChange([...selectedLabelIds, id2]);
|
|
1074
|
+
}
|
|
1072
1075
|
};
|
|
1073
|
-
const
|
|
1074
|
-
setPendingValue(newValue);
|
|
1076
|
+
const handleLabelSelectionChange = (newValue) => {
|
|
1075
1077
|
if (!multiple) {
|
|
1076
1078
|
onChange == null ? void 0 : onChange(newValue.length ? [newValue[newValue.length - 1]] : []);
|
|
1077
1079
|
setAnchorEl(null);
|
|
@@ -1100,43 +1102,206 @@ function GithubLabelPicker({
|
|
|
1100
1102
|
if (loading) {
|
|
1101
1103
|
return null;
|
|
1102
1104
|
}
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1105
|
+
function renderRecentLabels() {
|
|
1106
|
+
const recentLabelNodes = getLabelsByIds(initialRecentLabels).filter(isLabelPermitted);
|
|
1107
|
+
if (!(recentLabelNodes == null ? void 0 : recentLabelNodes.length)) {
|
|
1108
|
+
return null;
|
|
1109
|
+
}
|
|
1110
|
+
return /* @__PURE__ */ jsxs("li", { children: [
|
|
1111
|
+
/* @__PURE__ */ jsx(Box$1, { sx: { mb: 0.5, fontSize: 12, fontWeight: "medium" }, children: t("label.recently") }),
|
|
1112
|
+
/* @__PURE__ */ jsx(Box$1, { sx: { display: "flex", flexWrap: "wrap", gap: 0.75, mb: 2 }, children: recentLabelNodes.map((x) => {
|
|
1113
|
+
const labelId = x.data.id;
|
|
1114
|
+
const selected = value == null ? void 0 : value.includes(labelId);
|
|
1115
|
+
return /* @__PURE__ */ jsx(
|
|
1116
|
+
LabelChip,
|
|
1117
|
+
{
|
|
1118
|
+
label: x,
|
|
1119
|
+
fullName: false,
|
|
1120
|
+
onClick: () => {
|
|
1121
|
+
handleLabelSelectionChange(
|
|
1122
|
+
selected ? selectedLabelIds.filter((y) => y !== labelId) : [...selectedLabelIds, labelId]
|
|
1123
|
+
);
|
|
1124
|
+
},
|
|
1125
|
+
sx: {
|
|
1126
|
+
height: 24,
|
|
1127
|
+
lineHeight: "24px",
|
|
1128
|
+
".MuiChip-label": { maxHeight: 24 },
|
|
1129
|
+
...getSelectedSx(selected)
|
|
1130
|
+
}
|
|
1131
|
+
},
|
|
1132
|
+
labelId
|
|
1133
|
+
);
|
|
1134
|
+
}) })
|
|
1135
|
+
] });
|
|
1136
|
+
}
|
|
1137
|
+
function renderGroup(params) {
|
|
1138
|
+
return /* @__PURE__ */ jsxs("li", { children: [
|
|
1139
|
+
/* @__PURE__ */ jsx(Box$1, { sx: { mb: 0.5, fontSize: 12, fontWeight: "medium" }, children: t("label.title") }),
|
|
1140
|
+
/* @__PURE__ */ jsx(
|
|
1141
|
+
Box$1,
|
|
1142
|
+
{
|
|
1143
|
+
component: "ul",
|
|
1144
|
+
sx: {
|
|
1145
|
+
display: "flex",
|
|
1146
|
+
justifyContent: "flex-start",
|
|
1147
|
+
flexWrap: "wrap",
|
|
1148
|
+
gap: 0.75,
|
|
1149
|
+
p: 0
|
|
1150
|
+
},
|
|
1151
|
+
children: params.children
|
|
1152
|
+
}
|
|
1153
|
+
)
|
|
1154
|
+
] });
|
|
1155
|
+
}
|
|
1156
|
+
function renderAutocomplete() {
|
|
1157
|
+
return /* @__PURE__ */ jsx(
|
|
1158
|
+
Autocomplete,
|
|
1106
1159
|
{
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1160
|
+
open: true,
|
|
1161
|
+
multiple: true,
|
|
1162
|
+
inputValue,
|
|
1163
|
+
onInputChange: (event, newInputValue, reason) => {
|
|
1164
|
+
if (reason === "reset") {
|
|
1165
|
+
return;
|
|
1166
|
+
}
|
|
1167
|
+
setInputValue(newInputValue);
|
|
1168
|
+
},
|
|
1169
|
+
onClose: (event, reason) => {
|
|
1170
|
+
if (reason === "escape") {
|
|
1171
|
+
handleClose();
|
|
1172
|
+
}
|
|
1173
|
+
},
|
|
1174
|
+
value: selectedLabels,
|
|
1175
|
+
onChange: (event, newValue, reason) => {
|
|
1176
|
+
event.preventDefault();
|
|
1177
|
+
if (event.type === "keydown" && event.key === "Backspace" && reason === "removeOption") {
|
|
1178
|
+
return;
|
|
1179
|
+
}
|
|
1180
|
+
if (reason === "selectOption") {
|
|
1181
|
+
addRecentLabel(newValue[newValue.length - 1].data.id);
|
|
1182
|
+
}
|
|
1183
|
+
handleLabelSelectionChange(newValue.map((x) => x.data.id));
|
|
1184
|
+
},
|
|
1185
|
+
disableCloseOnSelect: true,
|
|
1186
|
+
PopperComponent,
|
|
1187
|
+
renderTags: () => null,
|
|
1188
|
+
noOptionsText: noLabelsText || "No labels",
|
|
1189
|
+
renderOption: (props, option, { selected }) => {
|
|
1190
|
+
const isPermitted = isLabelPermitted(option);
|
|
1191
|
+
if (!isPermitted) {
|
|
1192
|
+
return null;
|
|
1193
|
+
}
|
|
1194
|
+
const label = option.data;
|
|
1195
|
+
return /* @__PURE__ */ createElement(Box$1, { component: "li", ...props, key: label.id, sx: { "&.MuiAutocomplete-option": { p: 0 } } }, /* @__PURE__ */ jsx(
|
|
1196
|
+
LabelChip,
|
|
1197
|
+
{
|
|
1198
|
+
label: option,
|
|
1199
|
+
sx: {
|
|
1200
|
+
height: 24,
|
|
1201
|
+
lineHeight: "24px",
|
|
1202
|
+
".MuiChip-label": { maxHeight: 24 },
|
|
1203
|
+
...getSelectedSx(selected)
|
|
1204
|
+
},
|
|
1205
|
+
fullName: false
|
|
1206
|
+
}
|
|
1207
|
+
));
|
|
1208
|
+
},
|
|
1209
|
+
groupBy: () => "x",
|
|
1210
|
+
renderGroup: (params) => {
|
|
1211
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1212
|
+
renderRecentLabels(),
|
|
1213
|
+
renderGroup(params)
|
|
1214
|
+
] }, params.key);
|
|
1111
1215
|
},
|
|
1112
|
-
|
|
1216
|
+
options: filteredLabels,
|
|
1217
|
+
getOptionLabel: (option) => option.data.getName(locale),
|
|
1218
|
+
renderInput: (params) => /* @__PURE__ */ jsx(
|
|
1113
1219
|
Box$1,
|
|
1114
1220
|
{
|
|
1115
|
-
component:
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
"
|
|
1129
|
-
|
|
1130
|
-
|
|
1221
|
+
component: InputBase,
|
|
1222
|
+
ref: params.InputProps.ref,
|
|
1223
|
+
inputProps: params.inputProps,
|
|
1224
|
+
autoFocus: true,
|
|
1225
|
+
placeholder: "Filter labels",
|
|
1226
|
+
sx: (theme) => ({
|
|
1227
|
+
padding: 1,
|
|
1228
|
+
width: "100%",
|
|
1229
|
+
bgcolor: "#fff",
|
|
1230
|
+
"& input": {
|
|
1231
|
+
borderRadius: 1,
|
|
1232
|
+
backgroundColor: theme.palette.mode === "light" ? "#fff" : "#0d1117",
|
|
1233
|
+
padding: 1,
|
|
1234
|
+
transition: theme.transitions.create(["border-color", "box-shadow"]),
|
|
1235
|
+
border: `1px solid ${theme.palette.mode === "light" ? "#eaecef" : "#30363d"}`,
|
|
1236
|
+
fontSize: 14,
|
|
1237
|
+
"&:focus": {
|
|
1238
|
+
boxShadow: `0px 0px 0px 3px ${theme.palette.mode === "light" ? alpha(theme.palette.primary.light, 0.4) : "rgb(12, 45, 107)"}`,
|
|
1239
|
+
borderColor: theme.palette.mode === "light" ? theme.palette.primary.light : "#388bfd"
|
|
1131
1240
|
}
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
],
|
|
1135
|
-
children: /* @__PURE__ */ jsx(mdiTagPlusOutline, {})
|
|
1241
|
+
}
|
|
1242
|
+
})
|
|
1136
1243
|
}
|
|
1137
1244
|
)
|
|
1138
1245
|
}
|
|
1139
|
-
)
|
|
1246
|
+
);
|
|
1247
|
+
}
|
|
1248
|
+
function renderActions() {
|
|
1249
|
+
return /* @__PURE__ */ jsxs(Box$1, { children: [
|
|
1250
|
+
isAdmin && inputValue && !exists && /* @__PURE__ */ jsx(
|
|
1251
|
+
Box$1,
|
|
1252
|
+
{
|
|
1253
|
+
sx: {
|
|
1254
|
+
display: "flex",
|
|
1255
|
+
alignItems: "center",
|
|
1256
|
+
gap: 1,
|
|
1257
|
+
width: "100%",
|
|
1258
|
+
height: 36,
|
|
1259
|
+
px: 2,
|
|
1260
|
+
borderTop: "1px solid #eee",
|
|
1261
|
+
fontSize: 14,
|
|
1262
|
+
color: "grey.600",
|
|
1263
|
+
cursor: "pointer",
|
|
1264
|
+
textDecoration: "none"
|
|
1265
|
+
},
|
|
1266
|
+
onClick: handleCreate,
|
|
1267
|
+
children: /* @__PURE__ */ jsxs("span", { children: [
|
|
1268
|
+
'Create new label "',
|
|
1269
|
+
inputValue,
|
|
1270
|
+
'"'
|
|
1271
|
+
] })
|
|
1272
|
+
}
|
|
1273
|
+
),
|
|
1274
|
+
actions
|
|
1275
|
+
] });
|
|
1276
|
+
}
|
|
1277
|
+
const labelInput2 = trigger;
|
|
1278
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1279
|
+
/* @__PURE__ */ jsx(Box$1, { onClick: handleClick, sx: { display: "flex", alignItems: "center" }, children: labelInput2 || /* @__PURE__ */ jsx(
|
|
1280
|
+
Box$1,
|
|
1281
|
+
{
|
|
1282
|
+
component: ButtonBase,
|
|
1283
|
+
disableRipple: true,
|
|
1284
|
+
"aria-describedby": id,
|
|
1285
|
+
className: "label-picker-trigger",
|
|
1286
|
+
sx: [
|
|
1287
|
+
(theme) => ({
|
|
1288
|
+
width: "100%",
|
|
1289
|
+
fontSize: 13,
|
|
1290
|
+
color: theme.palette.mode === "light" ? "#586069" : "#8b949e",
|
|
1291
|
+
fontWeight: 600,
|
|
1292
|
+
"&:hover": {
|
|
1293
|
+
color: theme.palette.mode === "light" ? "primary.main" : "#58a6ff"
|
|
1294
|
+
},
|
|
1295
|
+
"& svg": {
|
|
1296
|
+
width: 22,
|
|
1297
|
+
height: 22
|
|
1298
|
+
}
|
|
1299
|
+
}),
|
|
1300
|
+
...Array.isArray(buttonSx) ? buttonSx : [buttonSx]
|
|
1301
|
+
],
|
|
1302
|
+
children: /* @__PURE__ */ jsx(mdiTagPlusOutline, {})
|
|
1303
|
+
}
|
|
1304
|
+
) }),
|
|
1140
1305
|
/* @__PURE__ */ jsx(
|
|
1141
1306
|
Box$1,
|
|
1142
1307
|
{
|
|
@@ -1158,178 +1323,8 @@ function GithubLabelPicker({
|
|
|
1158
1323
|
backgroundColor: theme.palette.mode === "light" ? "#fff" : "#1c2128"
|
|
1159
1324
|
}),
|
|
1160
1325
|
children: /* @__PURE__ */ jsx(ClickAwayListener, { onClickAway: handleClose, children: /* @__PURE__ */ jsxs(Box$1, { onClick: (e) => e.preventDefault(), children: [
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
{
|
|
1164
|
-
open: true,
|
|
1165
|
-
multiple: true,
|
|
1166
|
-
inputValue,
|
|
1167
|
-
onInputChange: (event, newInputValue, reason) => {
|
|
1168
|
-
if (reason === "reset") {
|
|
1169
|
-
return;
|
|
1170
|
-
}
|
|
1171
|
-
setInputValue(newInputValue);
|
|
1172
|
-
},
|
|
1173
|
-
onClose: (event, reason) => {
|
|
1174
|
-
if (reason === "escape") {
|
|
1175
|
-
handleClose();
|
|
1176
|
-
}
|
|
1177
|
-
},
|
|
1178
|
-
value: pendingOptions,
|
|
1179
|
-
onChange: (event, newValue, reason) => {
|
|
1180
|
-
event.preventDefault();
|
|
1181
|
-
if (event.type === "keydown" && event.key === "Backspace" && reason === "removeOption") {
|
|
1182
|
-
return;
|
|
1183
|
-
}
|
|
1184
|
-
if (reason === "selectOption") {
|
|
1185
|
-
addRecentLabel(newValue[newValue.length - 1].data.id);
|
|
1186
|
-
}
|
|
1187
|
-
handleChange(newValue.map((x) => x.data.id));
|
|
1188
|
-
},
|
|
1189
|
-
disableCloseOnSelect: true,
|
|
1190
|
-
PopperComponent,
|
|
1191
|
-
renderTags: () => null,
|
|
1192
|
-
noOptionsText: noLabelsText || "No labels",
|
|
1193
|
-
renderOption: (props, option, { selected }) => {
|
|
1194
|
-
const isPermitted = isLabelPermitted(option);
|
|
1195
|
-
if (!isPermitted) {
|
|
1196
|
-
return null;
|
|
1197
|
-
}
|
|
1198
|
-
const label = option.data;
|
|
1199
|
-
return /* @__PURE__ */ createElement(
|
|
1200
|
-
Box$1,
|
|
1201
|
-
{
|
|
1202
|
-
component: "li",
|
|
1203
|
-
...props,
|
|
1204
|
-
key: label.id,
|
|
1205
|
-
sx: {
|
|
1206
|
-
"&.MuiAutocomplete-option": {
|
|
1207
|
-
p: 0
|
|
1208
|
-
}
|
|
1209
|
-
}
|
|
1210
|
-
},
|
|
1211
|
-
/* @__PURE__ */ jsx(
|
|
1212
|
-
LabelChip,
|
|
1213
|
-
{
|
|
1214
|
-
label: option,
|
|
1215
|
-
sx: {
|
|
1216
|
-
height: 24,
|
|
1217
|
-
lineHeight: "24px",
|
|
1218
|
-
".MuiChip-label": { maxHeight: 24 },
|
|
1219
|
-
...getSelectedSx(selected)
|
|
1220
|
-
},
|
|
1221
|
-
fullName: false
|
|
1222
|
-
}
|
|
1223
|
-
)
|
|
1224
|
-
);
|
|
1225
|
-
},
|
|
1226
|
-
groupBy: () => "x",
|
|
1227
|
-
renderGroup: (params) => {
|
|
1228
|
-
const recentLabelNodes = getLabelsByIds(initialRecentLabels).filter(isLabelPermitted);
|
|
1229
|
-
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1230
|
-
!!(recentLabelNodes == null ? void 0 : recentLabelNodes.length) && /* @__PURE__ */ jsxs("li", { children: [
|
|
1231
|
-
/* @__PURE__ */ jsx(Box$1, { sx: { mb: 0.5, fontSize: 12, fontWeight: "medium" }, children: t("label.recently") }),
|
|
1232
|
-
/* @__PURE__ */ jsx(Box$1, { sx: { display: "flex", flexWrap: "wrap", gap: 0.75, mb: 2 }, children: recentLabelNodes.map((x) => {
|
|
1233
|
-
const labelId = x.data.id;
|
|
1234
|
-
const selected = value == null ? void 0 : value.includes(labelId);
|
|
1235
|
-
return /* @__PURE__ */ jsx(
|
|
1236
|
-
LabelChip,
|
|
1237
|
-
{
|
|
1238
|
-
label: x,
|
|
1239
|
-
fullName: false,
|
|
1240
|
-
onClick: () => {
|
|
1241
|
-
handleChange(
|
|
1242
|
-
selected ? pendingValue.filter((y) => y !== labelId) : [...pendingValue, labelId]
|
|
1243
|
-
);
|
|
1244
|
-
},
|
|
1245
|
-
sx: {
|
|
1246
|
-
height: 24,
|
|
1247
|
-
lineHeight: "24px",
|
|
1248
|
-
".MuiChip-label": { maxHeight: 24 },
|
|
1249
|
-
...getSelectedSx(selected)
|
|
1250
|
-
}
|
|
1251
|
-
},
|
|
1252
|
-
labelId
|
|
1253
|
-
);
|
|
1254
|
-
}) })
|
|
1255
|
-
] }),
|
|
1256
|
-
/* @__PURE__ */ jsxs("li", { children: [
|
|
1257
|
-
/* @__PURE__ */ jsx(Box$1, { sx: { mb: 0.5, fontSize: 12, fontWeight: "medium" }, children: t("label.title") }),
|
|
1258
|
-
/* @__PURE__ */ jsx(
|
|
1259
|
-
Box$1,
|
|
1260
|
-
{
|
|
1261
|
-
component: "ul",
|
|
1262
|
-
sx: {
|
|
1263
|
-
display: "flex",
|
|
1264
|
-
justifyContent: "flex-start",
|
|
1265
|
-
flexWrap: "wrap",
|
|
1266
|
-
gap: 0.75,
|
|
1267
|
-
p: 0
|
|
1268
|
-
},
|
|
1269
|
-
children: params.children
|
|
1270
|
-
}
|
|
1271
|
-
)
|
|
1272
|
-
] })
|
|
1273
|
-
] }, params.key);
|
|
1274
|
-
},
|
|
1275
|
-
options: filteredLabels,
|
|
1276
|
-
getOptionLabel: (option) => option.data.getName(locale),
|
|
1277
|
-
renderInput: (params) => /* @__PURE__ */ jsx(
|
|
1278
|
-
Box$1,
|
|
1279
|
-
{
|
|
1280
|
-
component: InputBase,
|
|
1281
|
-
ref: params.InputProps.ref,
|
|
1282
|
-
inputProps: params.inputProps,
|
|
1283
|
-
autoFocus: true,
|
|
1284
|
-
placeholder: "Filter labels",
|
|
1285
|
-
sx: (theme) => ({
|
|
1286
|
-
padding: 1,
|
|
1287
|
-
width: "100%",
|
|
1288
|
-
bgcolor: "#fff",
|
|
1289
|
-
"& input": {
|
|
1290
|
-
borderRadius: 1,
|
|
1291
|
-
backgroundColor: theme.palette.mode === "light" ? "#fff" : "#0d1117",
|
|
1292
|
-
padding: 1,
|
|
1293
|
-
transition: theme.transitions.create(["border-color", "box-shadow"]),
|
|
1294
|
-
border: `1px solid ${theme.palette.mode === "light" ? "#eaecef" : "#30363d"}`,
|
|
1295
|
-
fontSize: 14,
|
|
1296
|
-
"&:focus": {
|
|
1297
|
-
boxShadow: `0px 0px 0px 3px ${theme.palette.mode === "light" ? alpha(theme.palette.primary.light, 0.4) : "rgb(12, 45, 107)"}`,
|
|
1298
|
-
borderColor: theme.palette.mode === "light" ? theme.palette.primary.light : "#388bfd"
|
|
1299
|
-
}
|
|
1300
|
-
}
|
|
1301
|
-
})
|
|
1302
|
-
}
|
|
1303
|
-
)
|
|
1304
|
-
}
|
|
1305
|
-
),
|
|
1306
|
-
/* @__PURE__ */ jsxs(Box$1, { children: [
|
|
1307
|
-
isAdmin && inputValue && !exists && /* @__PURE__ */ jsx(
|
|
1308
|
-
Box$1,
|
|
1309
|
-
{
|
|
1310
|
-
sx: {
|
|
1311
|
-
display: "flex",
|
|
1312
|
-
alignItems: "center",
|
|
1313
|
-
gap: 1,
|
|
1314
|
-
width: "100%",
|
|
1315
|
-
height: 36,
|
|
1316
|
-
px: 2,
|
|
1317
|
-
borderTop: "1px solid #eee",
|
|
1318
|
-
fontSize: 14,
|
|
1319
|
-
color: "grey.600",
|
|
1320
|
-
cursor: "pointer",
|
|
1321
|
-
textDecoration: "none"
|
|
1322
|
-
},
|
|
1323
|
-
onClick: handleCreate,
|
|
1324
|
-
children: /* @__PURE__ */ jsxs("span", { children: [
|
|
1325
|
-
'Create new label "',
|
|
1326
|
-
inputValue,
|
|
1327
|
-
'"'
|
|
1328
|
-
] })
|
|
1329
|
-
}
|
|
1330
|
-
),
|
|
1331
|
-
actions
|
|
1332
|
-
] })
|
|
1326
|
+
renderAutocomplete(),
|
|
1327
|
+
renderActions()
|
|
1333
1328
|
] }) })
|
|
1334
1329
|
}
|
|
1335
1330
|
)
|
package/dist/index.umd.js
CHANGED
|
@@ -1022,8 +1022,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1022
1022
|
const { isAdmin, hasAnyPassport } = useSessionContext();
|
|
1023
1023
|
const { flattenedLabels: labels, getLabelsByIds, loading, createLabel } = LabelsContainer.useContainer();
|
|
1024
1024
|
const [anchorEl, setAnchorEl] = react.useState(null);
|
|
1025
|
-
const
|
|
1026
|
-
const
|
|
1025
|
+
const selectedLabelIds = value;
|
|
1026
|
+
const selectedLabels = react.useMemo(() => getLabelsByIds(selectedLabelIds), [getLabelsByIds, selectedLabelIds]);
|
|
1027
1027
|
const [inputValue, setInputValue] = react.useState("");
|
|
1028
1028
|
const exists = react.useMemo(
|
|
1029
1029
|
() => labels.some((x) => x.data.getName(locale).toLowerCase() === inputValue.toLowerCase()),
|
|
@@ -1040,12 +1040,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1040
1040
|
return;
|
|
1041
1041
|
}
|
|
1042
1042
|
event.preventDefault();
|
|
1043
|
-
setPendingValue(value);
|
|
1044
1043
|
setAnchorEl(event.currentTarget);
|
|
1045
1044
|
};
|
|
1046
1045
|
const handleClose = () => {
|
|
1047
1046
|
if (!updateImmediately) {
|
|
1048
|
-
onChange == null ? void 0 : onChange(
|
|
1047
|
+
onChange == null ? void 0 : onChange(selectedLabelIds);
|
|
1049
1048
|
}
|
|
1050
1049
|
setInputValue("");
|
|
1051
1050
|
if (anchorEl) {
|
|
@@ -1055,10 +1054,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1055
1054
|
};
|
|
1056
1055
|
const handleCreate = async () => {
|
|
1057
1056
|
const { id: id2 } = await createLabel(inputValue);
|
|
1058
|
-
|
|
1057
|
+
if (!multiple) {
|
|
1058
|
+
onChange == null ? void 0 : onChange([id2]);
|
|
1059
|
+
} else if (updateImmediately) {
|
|
1060
|
+
onChange([...selectedLabelIds, id2]);
|
|
1061
|
+
}
|
|
1059
1062
|
};
|
|
1060
|
-
const
|
|
1061
|
-
setPendingValue(newValue);
|
|
1063
|
+
const handleLabelSelectionChange = (newValue) => {
|
|
1062
1064
|
if (!multiple) {
|
|
1063
1065
|
onChange == null ? void 0 : onChange(newValue.length ? [newValue[newValue.length - 1]] : []);
|
|
1064
1066
|
setAnchorEl(null);
|
|
@@ -1087,43 +1089,206 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1087
1089
|
if (loading) {
|
|
1088
1090
|
return null;
|
|
1089
1091
|
}
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1092
|
+
function renderRecentLabels() {
|
|
1093
|
+
const recentLabelNodes = getLabelsByIds(initialRecentLabels).filter(isLabelPermitted);
|
|
1094
|
+
if (!(recentLabelNodes == null ? void 0 : recentLabelNodes.length)) {
|
|
1095
|
+
return null;
|
|
1096
|
+
}
|
|
1097
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
|
|
1098
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { mb: 0.5, fontSize: 12, fontWeight: "medium" }, children: t("label.recently") }),
|
|
1099
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { display: "flex", flexWrap: "wrap", gap: 0.75, mb: 2 }, children: recentLabelNodes.map((x) => {
|
|
1100
|
+
const labelId = x.data.id;
|
|
1101
|
+
const selected = value == null ? void 0 : value.includes(labelId);
|
|
1102
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1103
|
+
LabelChip,
|
|
1104
|
+
{
|
|
1105
|
+
label: x,
|
|
1106
|
+
fullName: false,
|
|
1107
|
+
onClick: () => {
|
|
1108
|
+
handleLabelSelectionChange(
|
|
1109
|
+
selected ? selectedLabelIds.filter((y) => y !== labelId) : [...selectedLabelIds, labelId]
|
|
1110
|
+
);
|
|
1111
|
+
},
|
|
1112
|
+
sx: {
|
|
1113
|
+
height: 24,
|
|
1114
|
+
lineHeight: "24px",
|
|
1115
|
+
".MuiChip-label": { maxHeight: 24 },
|
|
1116
|
+
...getSelectedSx(selected)
|
|
1117
|
+
}
|
|
1118
|
+
},
|
|
1119
|
+
labelId
|
|
1120
|
+
);
|
|
1121
|
+
}) })
|
|
1122
|
+
] });
|
|
1123
|
+
}
|
|
1124
|
+
function renderGroup(params) {
|
|
1125
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
|
|
1126
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { mb: 0.5, fontSize: 12, fontWeight: "medium" }, children: t("label.title") }),
|
|
1127
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1128
|
+
material.Box,
|
|
1129
|
+
{
|
|
1130
|
+
component: "ul",
|
|
1131
|
+
sx: {
|
|
1132
|
+
display: "flex",
|
|
1133
|
+
justifyContent: "flex-start",
|
|
1134
|
+
flexWrap: "wrap",
|
|
1135
|
+
gap: 0.75,
|
|
1136
|
+
p: 0
|
|
1137
|
+
},
|
|
1138
|
+
children: params.children
|
|
1139
|
+
}
|
|
1140
|
+
)
|
|
1141
|
+
] });
|
|
1142
|
+
}
|
|
1143
|
+
function renderAutocomplete() {
|
|
1144
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1145
|
+
material.Autocomplete,
|
|
1093
1146
|
{
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1147
|
+
open: true,
|
|
1148
|
+
multiple: true,
|
|
1149
|
+
inputValue,
|
|
1150
|
+
onInputChange: (event, newInputValue, reason) => {
|
|
1151
|
+
if (reason === "reset") {
|
|
1152
|
+
return;
|
|
1153
|
+
}
|
|
1154
|
+
setInputValue(newInputValue);
|
|
1155
|
+
},
|
|
1156
|
+
onClose: (event, reason) => {
|
|
1157
|
+
if (reason === "escape") {
|
|
1158
|
+
handleClose();
|
|
1159
|
+
}
|
|
1160
|
+
},
|
|
1161
|
+
value: selectedLabels,
|
|
1162
|
+
onChange: (event, newValue, reason) => {
|
|
1163
|
+
event.preventDefault();
|
|
1164
|
+
if (event.type === "keydown" && event.key === "Backspace" && reason === "removeOption") {
|
|
1165
|
+
return;
|
|
1166
|
+
}
|
|
1167
|
+
if (reason === "selectOption") {
|
|
1168
|
+
addRecentLabel(newValue[newValue.length - 1].data.id);
|
|
1169
|
+
}
|
|
1170
|
+
handleLabelSelectionChange(newValue.map((x) => x.data.id));
|
|
1171
|
+
},
|
|
1172
|
+
disableCloseOnSelect: true,
|
|
1173
|
+
PopperComponent,
|
|
1174
|
+
renderTags: () => null,
|
|
1175
|
+
noOptionsText: noLabelsText || "No labels",
|
|
1176
|
+
renderOption: (props, option, { selected }) => {
|
|
1177
|
+
const isPermitted = isLabelPermitted(option);
|
|
1178
|
+
if (!isPermitted) {
|
|
1179
|
+
return null;
|
|
1180
|
+
}
|
|
1181
|
+
const label = option.data;
|
|
1182
|
+
return /* @__PURE__ */ react.createElement(material.Box, { component: "li", ...props, key: label.id, sx: { "&.MuiAutocomplete-option": { p: 0 } } }, /* @__PURE__ */ jsxRuntime.jsx(
|
|
1183
|
+
LabelChip,
|
|
1184
|
+
{
|
|
1185
|
+
label: option,
|
|
1186
|
+
sx: {
|
|
1187
|
+
height: 24,
|
|
1188
|
+
lineHeight: "24px",
|
|
1189
|
+
".MuiChip-label": { maxHeight: 24 },
|
|
1190
|
+
...getSelectedSx(selected)
|
|
1191
|
+
},
|
|
1192
|
+
fullName: false
|
|
1193
|
+
}
|
|
1194
|
+
));
|
|
1195
|
+
},
|
|
1196
|
+
groupBy: () => "x",
|
|
1197
|
+
renderGroup: (params) => {
|
|
1198
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
|
|
1199
|
+
renderRecentLabels(),
|
|
1200
|
+
renderGroup(params)
|
|
1201
|
+
] }, params.key);
|
|
1098
1202
|
},
|
|
1099
|
-
|
|
1203
|
+
options: filteredLabels,
|
|
1204
|
+
getOptionLabel: (option) => option.data.getName(locale),
|
|
1205
|
+
renderInput: (params) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1100
1206
|
material.Box,
|
|
1101
1207
|
{
|
|
1102
|
-
component: material.
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
"
|
|
1116
|
-
|
|
1117
|
-
|
|
1208
|
+
component: material.InputBase,
|
|
1209
|
+
ref: params.InputProps.ref,
|
|
1210
|
+
inputProps: params.inputProps,
|
|
1211
|
+
autoFocus: true,
|
|
1212
|
+
placeholder: "Filter labels",
|
|
1213
|
+
sx: (theme) => ({
|
|
1214
|
+
padding: 1,
|
|
1215
|
+
width: "100%",
|
|
1216
|
+
bgcolor: "#fff",
|
|
1217
|
+
"& input": {
|
|
1218
|
+
borderRadius: 1,
|
|
1219
|
+
backgroundColor: theme.palette.mode === "light" ? "#fff" : "#0d1117",
|
|
1220
|
+
padding: 1,
|
|
1221
|
+
transition: theme.transitions.create(["border-color", "box-shadow"]),
|
|
1222
|
+
border: `1px solid ${theme.palette.mode === "light" ? "#eaecef" : "#30363d"}`,
|
|
1223
|
+
fontSize: 14,
|
|
1224
|
+
"&:focus": {
|
|
1225
|
+
boxShadow: `0px 0px 0px 3px ${theme.palette.mode === "light" ? material.alpha(theme.palette.primary.light, 0.4) : "rgb(12, 45, 107)"}`,
|
|
1226
|
+
borderColor: theme.palette.mode === "light" ? theme.palette.primary.light : "#388bfd"
|
|
1118
1227
|
}
|
|
1119
|
-
}
|
|
1120
|
-
|
|
1121
|
-
],
|
|
1122
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(mdiTagPlusOutline, {})
|
|
1228
|
+
}
|
|
1229
|
+
})
|
|
1123
1230
|
}
|
|
1124
1231
|
)
|
|
1125
1232
|
}
|
|
1126
|
-
)
|
|
1233
|
+
);
|
|
1234
|
+
}
|
|
1235
|
+
function renderActions() {
|
|
1236
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { children: [
|
|
1237
|
+
isAdmin && inputValue && !exists && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1238
|
+
material.Box,
|
|
1239
|
+
{
|
|
1240
|
+
sx: {
|
|
1241
|
+
display: "flex",
|
|
1242
|
+
alignItems: "center",
|
|
1243
|
+
gap: 1,
|
|
1244
|
+
width: "100%",
|
|
1245
|
+
height: 36,
|
|
1246
|
+
px: 2,
|
|
1247
|
+
borderTop: "1px solid #eee",
|
|
1248
|
+
fontSize: 14,
|
|
1249
|
+
color: "grey.600",
|
|
1250
|
+
cursor: "pointer",
|
|
1251
|
+
textDecoration: "none"
|
|
1252
|
+
},
|
|
1253
|
+
onClick: handleCreate,
|
|
1254
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
1255
|
+
'Create new label "',
|
|
1256
|
+
inputValue,
|
|
1257
|
+
'"'
|
|
1258
|
+
] })
|
|
1259
|
+
}
|
|
1260
|
+
),
|
|
1261
|
+
actions
|
|
1262
|
+
] });
|
|
1263
|
+
}
|
|
1264
|
+
const labelInput2 = trigger;
|
|
1265
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1266
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { onClick: handleClick, sx: { display: "flex", alignItems: "center" }, children: labelInput2 || /* @__PURE__ */ jsxRuntime.jsx(
|
|
1267
|
+
material.Box,
|
|
1268
|
+
{
|
|
1269
|
+
component: material.ButtonBase,
|
|
1270
|
+
disableRipple: true,
|
|
1271
|
+
"aria-describedby": id,
|
|
1272
|
+
className: "label-picker-trigger",
|
|
1273
|
+
sx: [
|
|
1274
|
+
(theme) => ({
|
|
1275
|
+
width: "100%",
|
|
1276
|
+
fontSize: 13,
|
|
1277
|
+
color: theme.palette.mode === "light" ? "#586069" : "#8b949e",
|
|
1278
|
+
fontWeight: 600,
|
|
1279
|
+
"&:hover": {
|
|
1280
|
+
color: theme.palette.mode === "light" ? "primary.main" : "#58a6ff"
|
|
1281
|
+
},
|
|
1282
|
+
"& svg": {
|
|
1283
|
+
width: 22,
|
|
1284
|
+
height: 22
|
|
1285
|
+
}
|
|
1286
|
+
}),
|
|
1287
|
+
...Array.isArray(buttonSx) ? buttonSx : [buttonSx]
|
|
1288
|
+
],
|
|
1289
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(mdiTagPlusOutline, {})
|
|
1290
|
+
}
|
|
1291
|
+
) }),
|
|
1127
1292
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1128
1293
|
material.Box,
|
|
1129
1294
|
{
|
|
@@ -1145,178 +1310,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1145
1310
|
backgroundColor: theme.palette.mode === "light" ? "#fff" : "#1c2128"
|
|
1146
1311
|
}),
|
|
1147
1312
|
children: /* @__PURE__ */ jsxRuntime.jsx(material.ClickAwayListener, { onClickAway: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { onClick: (e) => e.preventDefault(), children: [
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
{
|
|
1151
|
-
open: true,
|
|
1152
|
-
multiple: true,
|
|
1153
|
-
inputValue,
|
|
1154
|
-
onInputChange: (event, newInputValue, reason) => {
|
|
1155
|
-
if (reason === "reset") {
|
|
1156
|
-
return;
|
|
1157
|
-
}
|
|
1158
|
-
setInputValue(newInputValue);
|
|
1159
|
-
},
|
|
1160
|
-
onClose: (event, reason) => {
|
|
1161
|
-
if (reason === "escape") {
|
|
1162
|
-
handleClose();
|
|
1163
|
-
}
|
|
1164
|
-
},
|
|
1165
|
-
value: pendingOptions,
|
|
1166
|
-
onChange: (event, newValue, reason) => {
|
|
1167
|
-
event.preventDefault();
|
|
1168
|
-
if (event.type === "keydown" && event.key === "Backspace" && reason === "removeOption") {
|
|
1169
|
-
return;
|
|
1170
|
-
}
|
|
1171
|
-
if (reason === "selectOption") {
|
|
1172
|
-
addRecentLabel(newValue[newValue.length - 1].data.id);
|
|
1173
|
-
}
|
|
1174
|
-
handleChange(newValue.map((x) => x.data.id));
|
|
1175
|
-
},
|
|
1176
|
-
disableCloseOnSelect: true,
|
|
1177
|
-
PopperComponent,
|
|
1178
|
-
renderTags: () => null,
|
|
1179
|
-
noOptionsText: noLabelsText || "No labels",
|
|
1180
|
-
renderOption: (props, option, { selected }) => {
|
|
1181
|
-
const isPermitted = isLabelPermitted(option);
|
|
1182
|
-
if (!isPermitted) {
|
|
1183
|
-
return null;
|
|
1184
|
-
}
|
|
1185
|
-
const label = option.data;
|
|
1186
|
-
return /* @__PURE__ */ react.createElement(
|
|
1187
|
-
material.Box,
|
|
1188
|
-
{
|
|
1189
|
-
component: "li",
|
|
1190
|
-
...props,
|
|
1191
|
-
key: label.id,
|
|
1192
|
-
sx: {
|
|
1193
|
-
"&.MuiAutocomplete-option": {
|
|
1194
|
-
p: 0
|
|
1195
|
-
}
|
|
1196
|
-
}
|
|
1197
|
-
},
|
|
1198
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1199
|
-
LabelChip,
|
|
1200
|
-
{
|
|
1201
|
-
label: option,
|
|
1202
|
-
sx: {
|
|
1203
|
-
height: 24,
|
|
1204
|
-
lineHeight: "24px",
|
|
1205
|
-
".MuiChip-label": { maxHeight: 24 },
|
|
1206
|
-
...getSelectedSx(selected)
|
|
1207
|
-
},
|
|
1208
|
-
fullName: false
|
|
1209
|
-
}
|
|
1210
|
-
)
|
|
1211
|
-
);
|
|
1212
|
-
},
|
|
1213
|
-
groupBy: () => "x",
|
|
1214
|
-
renderGroup: (params) => {
|
|
1215
|
-
const recentLabelNodes = getLabelsByIds(initialRecentLabels).filter(isLabelPermitted);
|
|
1216
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
|
|
1217
|
-
!!(recentLabelNodes == null ? void 0 : recentLabelNodes.length) && /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
|
|
1218
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { mb: 0.5, fontSize: 12, fontWeight: "medium" }, children: t("label.recently") }),
|
|
1219
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { display: "flex", flexWrap: "wrap", gap: 0.75, mb: 2 }, children: recentLabelNodes.map((x) => {
|
|
1220
|
-
const labelId = x.data.id;
|
|
1221
|
-
const selected = value == null ? void 0 : value.includes(labelId);
|
|
1222
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1223
|
-
LabelChip,
|
|
1224
|
-
{
|
|
1225
|
-
label: x,
|
|
1226
|
-
fullName: false,
|
|
1227
|
-
onClick: () => {
|
|
1228
|
-
handleChange(
|
|
1229
|
-
selected ? pendingValue.filter((y) => y !== labelId) : [...pendingValue, labelId]
|
|
1230
|
-
);
|
|
1231
|
-
},
|
|
1232
|
-
sx: {
|
|
1233
|
-
height: 24,
|
|
1234
|
-
lineHeight: "24px",
|
|
1235
|
-
".MuiChip-label": { maxHeight: 24 },
|
|
1236
|
-
...getSelectedSx(selected)
|
|
1237
|
-
}
|
|
1238
|
-
},
|
|
1239
|
-
labelId
|
|
1240
|
-
);
|
|
1241
|
-
}) })
|
|
1242
|
-
] }),
|
|
1243
|
-
/* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
|
|
1244
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { mb: 0.5, fontSize: 12, fontWeight: "medium" }, children: t("label.title") }),
|
|
1245
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1246
|
-
material.Box,
|
|
1247
|
-
{
|
|
1248
|
-
component: "ul",
|
|
1249
|
-
sx: {
|
|
1250
|
-
display: "flex",
|
|
1251
|
-
justifyContent: "flex-start",
|
|
1252
|
-
flexWrap: "wrap",
|
|
1253
|
-
gap: 0.75,
|
|
1254
|
-
p: 0
|
|
1255
|
-
},
|
|
1256
|
-
children: params.children
|
|
1257
|
-
}
|
|
1258
|
-
)
|
|
1259
|
-
] })
|
|
1260
|
-
] }, params.key);
|
|
1261
|
-
},
|
|
1262
|
-
options: filteredLabels,
|
|
1263
|
-
getOptionLabel: (option) => option.data.getName(locale),
|
|
1264
|
-
renderInput: (params) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1265
|
-
material.Box,
|
|
1266
|
-
{
|
|
1267
|
-
component: material.InputBase,
|
|
1268
|
-
ref: params.InputProps.ref,
|
|
1269
|
-
inputProps: params.inputProps,
|
|
1270
|
-
autoFocus: true,
|
|
1271
|
-
placeholder: "Filter labels",
|
|
1272
|
-
sx: (theme) => ({
|
|
1273
|
-
padding: 1,
|
|
1274
|
-
width: "100%",
|
|
1275
|
-
bgcolor: "#fff",
|
|
1276
|
-
"& input": {
|
|
1277
|
-
borderRadius: 1,
|
|
1278
|
-
backgroundColor: theme.palette.mode === "light" ? "#fff" : "#0d1117",
|
|
1279
|
-
padding: 1,
|
|
1280
|
-
transition: theme.transitions.create(["border-color", "box-shadow"]),
|
|
1281
|
-
border: `1px solid ${theme.palette.mode === "light" ? "#eaecef" : "#30363d"}`,
|
|
1282
|
-
fontSize: 14,
|
|
1283
|
-
"&:focus": {
|
|
1284
|
-
boxShadow: `0px 0px 0px 3px ${theme.palette.mode === "light" ? material.alpha(theme.palette.primary.light, 0.4) : "rgb(12, 45, 107)"}`,
|
|
1285
|
-
borderColor: theme.palette.mode === "light" ? theme.palette.primary.light : "#388bfd"
|
|
1286
|
-
}
|
|
1287
|
-
}
|
|
1288
|
-
})
|
|
1289
|
-
}
|
|
1290
|
-
)
|
|
1291
|
-
}
|
|
1292
|
-
),
|
|
1293
|
-
/* @__PURE__ */ jsxRuntime.jsxs(material.Box, { children: [
|
|
1294
|
-
isAdmin && inputValue && !exists && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1295
|
-
material.Box,
|
|
1296
|
-
{
|
|
1297
|
-
sx: {
|
|
1298
|
-
display: "flex",
|
|
1299
|
-
alignItems: "center",
|
|
1300
|
-
gap: 1,
|
|
1301
|
-
width: "100%",
|
|
1302
|
-
height: 36,
|
|
1303
|
-
px: 2,
|
|
1304
|
-
borderTop: "1px solid #eee",
|
|
1305
|
-
fontSize: 14,
|
|
1306
|
-
color: "grey.600",
|
|
1307
|
-
cursor: "pointer",
|
|
1308
|
-
textDecoration: "none"
|
|
1309
|
-
},
|
|
1310
|
-
onClick: handleCreate,
|
|
1311
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
1312
|
-
'Create new label "',
|
|
1313
|
-
inputValue,
|
|
1314
|
-
'"'
|
|
1315
|
-
] })
|
|
1316
|
-
}
|
|
1317
|
-
),
|
|
1318
|
-
actions
|
|
1319
|
-
] })
|
|
1313
|
+
renderAutocomplete(),
|
|
1314
|
+
renderActions()
|
|
1320
1315
|
] }) })
|
|
1321
1316
|
}
|
|
1322
1317
|
)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/labels",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.186",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"react-color": "^2.19.3",
|
|
30
30
|
"react-select": "^5.8.1",
|
|
31
31
|
"unstated-next": "^1.1.0",
|
|
32
|
-
"@blocklet/translation-input": "^2.1.
|
|
32
|
+
"@blocklet/translation-input": "^2.1.186"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@arcblock/did-connect": "^2.10.36",
|