@bigbinary/neeto-tags-frontend 1.3.1 → 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.
- package/dist/index.cjs.js +100 -22
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +105 -27
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/types.d.ts +7 -1
package/dist/index.cjs.js
CHANGED
|
@@ -124,14 +124,76 @@ function _slicedToArray(arr, i) {
|
|
|
124
124
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
+
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|
|
128
|
+
|
|
129
|
+
var css$1 = ".neeto-chat__metadata-card__spinner{scale:.6}";
|
|
130
|
+
n(css$1,{});
|
|
131
|
+
|
|
132
|
+
var Title = function Title(_ref) {
|
|
133
|
+
var _ref$titleProps = _ref.titleProps,
|
|
134
|
+
titleProps = _ref$titleProps === void 0 ? {} : _ref$titleProps,
|
|
135
|
+
title = _ref.title,
|
|
136
|
+
isUpdating = _ref.isUpdating,
|
|
137
|
+
setIsTagsDropdownVisible = _ref.setIsTagsDropdownVisible,
|
|
138
|
+
showAddTagsOnTitle = _ref.showAddTagsOnTitle;
|
|
139
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
140
|
+
t = _useTranslation.t;
|
|
141
|
+
var tagsTitle = title || t("neetoTags.common.tag", constants.PLURAL);
|
|
142
|
+
var _useState = React.useState(false),
|
|
143
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
144
|
+
didStartUpdate = _useState2[0],
|
|
145
|
+
setDidStartUpdate = _useState2[1];
|
|
146
|
+
var _useState3 = React.useState(false),
|
|
147
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
148
|
+
isCheckIconVisible = _useState4[0],
|
|
149
|
+
setIsCheckIconVisible = _useState4[1];
|
|
150
|
+
React.useEffect(function () {
|
|
151
|
+
if (!isUpdating) return;
|
|
152
|
+
setDidStartUpdate(true);
|
|
153
|
+
}, [isUpdating]);
|
|
154
|
+
React.useEffect(function () {
|
|
155
|
+
if (isUpdating || !didStartUpdate) return;
|
|
156
|
+
setIsCheckIconVisible(true);
|
|
157
|
+
setDidStartUpdate(false);
|
|
158
|
+
setTimeout(function () {
|
|
159
|
+
setIsCheckIconVisible(false);
|
|
160
|
+
}, 5000);
|
|
161
|
+
}, [didStartUpdate, isUpdating]);
|
|
162
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
163
|
+
className: "mb-2 flex w-full items-center justify-between gap-2"
|
|
164
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
165
|
+
className: "flex items-center gap-2"
|
|
166
|
+
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, _extends({
|
|
167
|
+
className: "neeto-ui-text-gray-700",
|
|
168
|
+
style: "h5",
|
|
169
|
+
weight: "bold"
|
|
170
|
+
}, titleProps), tagsTitle), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
171
|
+
className: "inline-flex h-6 items-center"
|
|
172
|
+
}, isUpdating && /*#__PURE__*/React__default["default"].createElement(neetoui.Spinner, {
|
|
173
|
+
className: "neeto-chat__metadata-card__spinner"
|
|
174
|
+
}), !isUpdating && isCheckIconVisible && /*#__PURE__*/React__default["default"].createElement(neetoIcons.Check, {
|
|
175
|
+
className: "neeto-ui-text-success-500",
|
|
176
|
+
size: 20
|
|
177
|
+
}))), showAddTagsOnTitle && /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
178
|
+
icon: neetoIcons.Settings,
|
|
179
|
+
size: "15",
|
|
180
|
+
style: "icon",
|
|
181
|
+
onClick: function onClick() {
|
|
182
|
+
return setIsTagsDropdownVisible(function (addTag) {
|
|
183
|
+
return ramda.not(addTag);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}));
|
|
187
|
+
};
|
|
188
|
+
|
|
127
189
|
/**
|
|
128
190
|
* A component that helps to manage tags.
|
|
129
191
|
* Renders selected tags, has dropdown to list down available tags
|
|
130
192
|
* and allows user to remove tags from the list.
|
|
131
193
|
*/
|
|
132
194
|
var Tags$2 = function Tags(_ref) {
|
|
133
|
-
var _ref$
|
|
134
|
-
|
|
195
|
+
var _ref$title = _ref.title,
|
|
196
|
+
title = _ref$title === void 0 ? "" : _ref$title,
|
|
135
197
|
allTags = _ref.allTags,
|
|
136
198
|
selectedTags = _ref.selectedTags,
|
|
137
199
|
onTagSelect = _ref.onTagSelect,
|
|
@@ -141,13 +203,24 @@ var Tags$2 = function Tags(_ref) {
|
|
|
141
203
|
selectProps = _ref.selectProps,
|
|
142
204
|
buttonProps = _ref.buttonProps,
|
|
143
205
|
_ref$showSuccessToast = _ref.showSuccessToastr,
|
|
144
|
-
showSuccessToastr = _ref$showSuccessToast === void 0 ? false : _ref$showSuccessToast
|
|
206
|
+
showSuccessToastr = _ref$showSuccessToast === void 0 ? false : _ref$showSuccessToast,
|
|
207
|
+
titleProps = _ref.titleProps,
|
|
208
|
+
_ref$containerProps = _ref.containerProps,
|
|
209
|
+
containerProps = _ref$containerProps === void 0 ? {} : _ref$containerProps,
|
|
210
|
+
_ref$isUpdating = _ref.isUpdating,
|
|
211
|
+
isUpdating = _ref$isUpdating === void 0 ? false : _ref$isUpdating,
|
|
212
|
+
_ref$showAddTagsOnTit = _ref.showAddTagsOnTitle,
|
|
213
|
+
showAddTagsOnTitle = _ref$showAddTagsOnTit === void 0 ? true : _ref$showAddTagsOnTit,
|
|
214
|
+
_ref$showTitleBar = _ref.showTitleBar,
|
|
215
|
+
showTitleBar = _ref$showTitleBar === void 0 ? true : _ref$showTitleBar,
|
|
216
|
+
_ref$bodyProps = _ref.bodyProps,
|
|
217
|
+
bodyProps = _ref$bodyProps === void 0 ? {} : _ref$bodyProps;
|
|
145
218
|
var _useTranslation = reactI18next.useTranslation(),
|
|
146
219
|
t = _useTranslation.t;
|
|
147
220
|
var _useState = React.useState(false),
|
|
148
221
|
_useState2 = _slicedToArray(_useState, 2),
|
|
149
|
-
|
|
150
|
-
|
|
222
|
+
isTagsDropdownVisible = _useState2[0],
|
|
223
|
+
setIsTagsDropdownVisible = _useState2[1];
|
|
151
224
|
var tags = React.useMemo(function () {
|
|
152
225
|
if (!allTags) return [];
|
|
153
226
|
if (!selectedTags) return allTags;
|
|
@@ -158,7 +231,7 @@ var Tags$2 = function Tags(_ref) {
|
|
|
158
231
|
});
|
|
159
232
|
}, [allTags, selectedTags]);
|
|
160
233
|
var handleAddExistingTag = function handleAddExistingTag(event) {
|
|
161
|
-
|
|
234
|
+
setIsTagsDropdownVisible(false);
|
|
162
235
|
onTagSelect(event);
|
|
163
236
|
// @ts-ignore
|
|
164
237
|
showSuccessToastr && neetoui.Toastr.success("", {
|
|
@@ -174,17 +247,22 @@ var Tags$2 = function Tags(_ref) {
|
|
|
174
247
|
className: "w-20"
|
|
175
248
|
});
|
|
176
249
|
};
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
className: "neeto-ui-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
250
|
+
var isAddTagsButtonVisible = !showAddTagsOnTitle && !isTagsDropdownVisible;
|
|
251
|
+
var isTagsBodyVisible = pure.isNotEmpty(selectedTags) || isTagsDropdownVisible || isAddTagsButtonVisible;
|
|
252
|
+
return /*#__PURE__*/React__default["default"].createElement("div", _extends({
|
|
253
|
+
className: "neeto-ui-tags-wrapper flex w-full flex-col items-start"
|
|
254
|
+
}, containerProps), showTitleBar && /*#__PURE__*/React__default["default"].createElement(Title, {
|
|
255
|
+
isUpdating: isUpdating,
|
|
256
|
+
setIsTagsDropdownVisible: setIsTagsDropdownVisible,
|
|
257
|
+
showAddTagsOnTitle: showAddTagsOnTitle,
|
|
258
|
+
title: title,
|
|
259
|
+
titleProps: titleProps
|
|
260
|
+
}), isTagsBodyVisible && /*#__PURE__*/React__default["default"].createElement("div", _extends({
|
|
261
|
+
className: "neeto-ui-bg-white neeto-ui-border-gray-300 neeto-ui-rounded-lg w-full border p-4"
|
|
262
|
+
}, bodyProps), pure.isNotEmpty(selectedTags) && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
263
|
+
className: "neeto-ui-flex neeto-ui-flex-row neeto-ui-flex-wrap neeto-ui-items-start neeto-ui-justify-start gap-2 break-all"
|
|
185
264
|
}, selectedTags === null || selectedTags === void 0 ? void 0 : selectedTags.map(function (tag, index) {
|
|
186
265
|
return /*#__PURE__*/React__default["default"].createElement(neetoui.Tag, _extends({
|
|
187
|
-
className: "neeto-ui-mb-2 neeto-ui-mr-2",
|
|
188
266
|
key: "".concat(index, "-").concat(tag.label),
|
|
189
267
|
label: tag.label,
|
|
190
268
|
style: "primary",
|
|
@@ -192,8 +270,10 @@ var Tags$2 = function Tags(_ref) {
|
|
|
192
270
|
return handleDeleteTag(tag);
|
|
193
271
|
}
|
|
194
272
|
}, tagProps));
|
|
195
|
-
})),
|
|
273
|
+
})), isTagsDropdownVisible && /*#__PURE__*/React__default["default"].createElement(neetoui.Select, _extends({
|
|
274
|
+
autoFocus: true,
|
|
196
275
|
isCreateable: true,
|
|
276
|
+
className: "neeto-ui-mt-4",
|
|
197
277
|
maxLength: 50,
|
|
198
278
|
options: tags,
|
|
199
279
|
placeholder: t("neetoTags.placeholder.selectOrCreateTag"),
|
|
@@ -201,18 +281,18 @@ var Tags$2 = function Tags(_ref) {
|
|
|
201
281
|
return handleAddExistingTag(event);
|
|
202
282
|
},
|
|
203
283
|
onCreateOption: function onCreateOption(event) {
|
|
204
|
-
|
|
284
|
+
setIsTagsDropdownVisible(false);
|
|
205
285
|
onTagCreate(event);
|
|
206
286
|
}
|
|
207
|
-
}, selectProps))
|
|
287
|
+
}, selectProps)), isAddTagsButtonVisible && /*#__PURE__*/React__default["default"].createElement(neetoui.Button, _extends({
|
|
208
288
|
icon: neetoIcons.Plus,
|
|
209
289
|
label: t("neetoTags.button.addTag", constants.SINGULAR),
|
|
210
290
|
size: "small",
|
|
211
291
|
style: "link",
|
|
212
292
|
onClick: function onClick() {
|
|
213
|
-
return
|
|
293
|
+
return setIsTagsDropdownVisible(true);
|
|
214
294
|
}
|
|
215
|
-
}, buttonProps)));
|
|
295
|
+
}, buttonProps))));
|
|
216
296
|
};
|
|
217
297
|
|
|
218
298
|
function _typeof(obj) {
|
|
@@ -1716,8 +1796,6 @@ var Tags = function Tags(_ref) {
|
|
|
1716
1796
|
};
|
|
1717
1797
|
var Tags$1 = withReactQuery(Tags);
|
|
1718
1798
|
|
|
1719
|
-
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|
|
1720
|
-
|
|
1721
1799
|
var css = ".neeto-tags-border{border-width:thin}.ntm-empty-state{height:100%;margin:auto;width:100%}.ntm-empty-state,.ntm-empty-state__image{align-items:center;display:flex;justify-content:center}.ntm-empty-state__image{margin-left:0 auto 4rem auto}.ntm-empty-state__title{font-size:1.25rem;line-height:1.75rem;margin-bottom:1rem;text-align:center}.ntm-empty-state__description{margin-bottom:1.5rem;text-align:center}.ntm-empty-state__action-block{display:flex;justify-content:center}.neeto-tags-table__wrapper{height:calc(100vh - var(--neeto-molecules-main-header-with-breadcrumbs-height) - var(--neeto-molecules-sub-header-height) - var(--neeto-molecules-sub-header-bottom-margin));padding:0 24px;width:100%}.neeto-tags-table__column{align-items:center;display:flex;gap:.5rem;justify-content:space-between}.neeto-tags-merge__wrapper{height:calc(100vh - var(--neeto-molecules-main-header-with-breadcrumbs-height));margin:0 auto;max-width:1200px;padding:0 24px 24px;width:100%}.neeto-tags-merge__wrapper .neeto-tags-merge__container{display:flex;flex-direction:row;height:100%;justify-content:space-between;width:100%}.neeto-tags-merge__wrapper .neeto-tags-merge__container .neeto-tags-merge__list{width:48%}.neeto-tags-merge__wrapper .neeto-tags-merge__container .neeto-tags-merge__list .neeto-tags-merge__items{height:calc(100vh - var(--neeto-molecules-main-header-height) - 120px);overflow-y:auto;padding-top:16px}";
|
|
1722
1800
|
n(css,{});
|
|
1723
1801
|
|