@bigbinary/neeto-tags-frontend 0.0.26 → 0.0.28

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.js CHANGED
@@ -18,7 +18,7 @@ import _createClass$1 from '@babel/runtime/helpers/createClass';
18
18
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
19
19
  import { useHistory, Switch, Route } from 'react-router-dom';
20
20
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
21
- import { Tag, Dropdown, Button, Toastr, Pane, Typography, PageLoader, Table, Alert, Input as Input$1, Modal } from '@bigbinary/neetoui';
21
+ import { Tag, Dropdown, Toastr, Pane, Typography, Button, PageLoader, Table, Alert, Input as Input$1, Modal } from '@bigbinary/neetoui';
22
22
  import * as yup from 'yup';
23
23
  import { MenuHorizontal, Plus } from '@bigbinary/neeto-icons';
24
24
  import _inheritsLoose from '@babel/runtime/helpers/esm/inheritsLoose';
@@ -3396,11 +3396,12 @@ var plcHolder = "Type to search tag…";
3396
3396
  var manage = "Manage Tags";
3397
3397
  var remove = "Remove {{tag}} tag";
3398
3398
  var exists = "{{tag}} already exists.";
3399
+ var edit = "Edit";
3399
3400
  var addTag = "Add Tag";
3400
3401
  var selectOrCreate = "Select or Create tag";
3401
3402
  var select = "Select {{what}}";
3402
3403
  var search = "Search {{where}}";
3403
- var addNew = "Add New {{what}}";
3404
+ var addNew = "Add {{what}}";
3404
3405
  var tag = "Tag";
3405
3406
  var noTagsFound = "No Tags Found";
3406
3407
  var deleteItem = "Are you sure you want to delete {{type}}";
@@ -3408,11 +3409,17 @@ var cannotBeUndone = "This action cannot be undone.";
3408
3409
  var proceed = "Proceed";
3409
3410
  var cancel = "Cancel";
3410
3411
  var name = "Name";
3412
+ var required = "{{what}} is a required field.";
3413
+ var maxLength = "{{what}} must be less than {{length}} characters.";
3414
+ var type = "{{what}} must be a {{type}}.";
3411
3415
  var description = "Description";
3412
3416
  var editItem = "Edit {{what}}";
3413
3417
  var createSuccess = "Tag created successfully.";
3414
3418
  var updateSuccess = "Tag updated successfully.";
3415
3419
  var deleteSuccess = "Tag deleted successfully.";
3420
+ var types = {
3421
+ string: "string"
3422
+ };
3416
3423
  var merge$1 = {
3417
3424
  sourceTag: "Source Tag",
3418
3425
  destinationTag: "Destination Tag",
@@ -3432,6 +3439,8 @@ var en = {
3432
3439
  remove: remove,
3433
3440
  exists: exists,
3434
3441
  "new": "Create new tag",
3442
+ "delete": "Delete",
3443
+ edit: edit,
3435
3444
  addTag: addTag,
3436
3445
  selectOrCreate: selectOrCreate,
3437
3446
  select: select,
@@ -3444,11 +3453,15 @@ var en = {
3444
3453
  proceed: proceed,
3445
3454
  cancel: cancel,
3446
3455
  name: name,
3456
+ required: required,
3457
+ maxLength: maxLength,
3458
+ type: type,
3447
3459
  description: description,
3448
3460
  editItem: editItem,
3449
3461
  createSuccess: createSuccess,
3450
3462
  updateSuccess: updateSuccess,
3451
3463
  deleteSuccess: deleteSuccess,
3464
+ types: types,
3452
3465
  merge: merge$1
3453
3466
  };
3454
3467
 
@@ -3467,18 +3480,18 @@ instance.use(initReactI18next).init({
3467
3480
  var DEFAULT_PAGE_INDEX = 1;
3468
3481
  var DEFAULT_PAGE_SIZE = 10;
3469
3482
  var COMMON_COLUMNS = [{
3470
- title: "Name",
3483
+ title: instance.t("Name"),
3471
3484
  dataIndex: "name",
3472
3485
  key: "name",
3473
3486
  render: function render(name) {
3474
3487
  return /*#__PURE__*/React.createElement(Tag, {
3475
3488
  label: name,
3476
- color: "blue"
3489
+ style: "secondary"
3477
3490
  });
3478
3491
  },
3479
3492
  width: "30%"
3480
3493
  }, {
3481
- title: "Description",
3494
+ title: instance.t("Description"),
3482
3495
  dataIndex: "description",
3483
3496
  key: "description",
3484
3497
  render: function render(description) {
@@ -3487,8 +3500,22 @@ var COMMON_COLUMNS = [{
3487
3500
  width: "40%"
3488
3501
  }];
3489
3502
  var TAG_SCHEMA = yup.object({
3490
- name: yup.string().typeError("Name must be a string.").required("Name is a required field.").max(50, "Name should not exceed 50 characters."),
3491
- description: yup.string().typeError("Description must be a string.").nullable().max(255, "Description should not exceed 255 characters.")
3503
+ name: yup.string().typeError(instance.t("type", {
3504
+ what: instance.t("name"),
3505
+ type: instance.t("types.string")
3506
+ })).required(instance.t("required", {
3507
+ what: instance.t("name")
3508
+ })).max(50, instance.t("max", {
3509
+ what: instance.t("name"),
3510
+ max: 50
3511
+ })),
3512
+ description: yup.string().typeError(instance.t("type", {
3513
+ what: instance.t("description"),
3514
+ type: instance.t("types.string")
3515
+ })).nullable().max(100, instance.t("max", {
3516
+ what: instance.t("description"),
3517
+ max: 255
3518
+ }))
3492
3519
  });
3493
3520
  var PANE_TYPES = {
3494
3521
  CREATE: "CREATE_TAG",
@@ -3502,40 +3529,37 @@ var PLURAL = {
3502
3529
  count: 2
3503
3530
  };
3504
3531
 
3532
+ var Menu$1 = Dropdown.Menu,
3533
+ MenuItem = Dropdown.MenuItem;
3505
3534
  var renderColumnData = function renderColumnData(columns, handleEdit, handleDelete) {
3506
3535
  return [].concat(_toConsumableArray(columns), [{
3507
3536
  id: "actions",
3508
3537
  width: "10%",
3509
3538
  render: function render(_, tag) {
3510
- return /*#__PURE__*/React.createElement(Dropdown, {
3539
+ return /*#__PURE__*/React.createElement("div", {
3540
+ onClick: function onClick(e) {
3541
+ return e.stopPropagation();
3542
+ }
3543
+ }, /*#__PURE__*/React.createElement(Dropdown, {
3544
+ autoWidth: true,
3511
3545
  icon: MenuHorizontal,
3512
3546
  buttonProps: {
3513
3547
  style: "text"
3514
3548
  },
3515
3549
  position: "bottom-end",
3516
- autoWidth: true,
3517
3550
  strategy: "fixed"
3518
- }, /*#__PURE__*/React.createElement("li", {
3519
- className: "neeto-tag-dropdown__item"
3520
- }, /*#__PURE__*/React.createElement(Button, {
3551
+ }, /*#__PURE__*/React.createElement(Menu$1, null, /*#__PURE__*/React.createElement(MenuItem.Button, {
3552
+ "data-cy": "tags-edit-button",
3521
3553
  onClick: function onClick() {
3522
3554
  return handleEdit(tag);
3523
- },
3524
- label: "Edit",
3525
- style: "text",
3526
- className: "neeto-tag-dropdown__button",
3527
- "data-cy": "tags-edit-button"
3528
- })), /*#__PURE__*/React.createElement("li", {
3529
- className: "neeto-tag-dropdown__item"
3530
- }, /*#__PURE__*/React.createElement(Button, {
3531
- label: "Delete",
3555
+ }
3556
+ }, instance.t("edit")), /*#__PURE__*/React.createElement(MenuItem.Button, {
3557
+ style: "danger",
3558
+ "data-cy": "tags-delete-button",
3532
3559
  onClick: function onClick() {
3533
3560
  return handleDelete(tag);
3534
- },
3535
- style: "danger-text",
3536
- className: "neeto-tag-dropdown__button",
3537
- "data-cy": "tags-delete-button"
3538
- })));
3561
+ }
3562
+ }, instance.t("delete")))));
3539
3563
  }
3540
3564
  }]);
3541
3565
  };
@@ -6922,9 +6946,7 @@ var ManageTags = function ManageTags(_ref) {
6922
6946
  rows: 3,
6923
6947
  "data-cy": "tag-description-text-area",
6924
6948
  maxLength: 255
6925
- }))), /*#__PURE__*/React.createElement(Pane.Footer, {
6926
- className: "flex items-center space-x-2"
6927
- }, /*#__PURE__*/React.createElement(ActionBlock, {
6949
+ }))), /*#__PURE__*/React.createElement(Pane.Footer, null, /*#__PURE__*/React.createElement(ActionBlock, {
6928
6950
  className: "flex items-center space-x-2",
6929
6951
  cancelButtonProps: {
6930
6952
  onClick: onClose
@@ -7029,6 +7051,7 @@ var EmptyState = function EmptyState(_ref) {
7029
7051
  weight: "normal",
7030
7052
  className: "mb-8 text-gray-600"
7031
7053
  }, "For more information, please visit our", " ", /*#__PURE__*/React.createElement(Button, {
7054
+ size: "small",
7032
7055
  style: "link",
7033
7056
  label: "knowledge base.",
7034
7057
  href: kbArticleUrl,
@@ -7164,7 +7187,6 @@ var Dashboard = function Dashboard(_ref) {
7164
7187
  })
7165
7188
  },
7166
7189
  actionBlock: /*#__PURE__*/React.createElement(React.Fragment, null, tagsMergable && /*#__PURE__*/React.createElement(Button, {
7167
- size: "large",
7168
7190
  style: "secondary",
7169
7191
  label: t("merge.mergeTags"),
7170
7192
  onClick: function onClick() {
@@ -7173,7 +7195,6 @@ var Dashboard = function Dashboard(_ref) {
7173
7195
  disabled: (data === null || data === void 0 ? void 0 : data.tags.length) < PLURAL.count
7174
7196
  }), /*#__PURE__*/React.createElement(Button, {
7175
7197
  icon: Plus,
7176
- size: "large",
7177
7198
  label: t("addNew", {
7178
7199
  what: t("tag")
7179
7200
  }),
@@ -7189,7 +7210,6 @@ var Dashboard = function Dashboard(_ref) {
7189
7210
  kbArticleUrl: kbArticleUrl,
7190
7211
  actionBlock: /*#__PURE__*/React.createElement(Button, {
7191
7212
  icon: Plus,
7192
- size: "large",
7193
7213
  label: t("addNew", {
7194
7214
  what: t("tag")
7195
7215
  }),
@@ -7401,7 +7421,6 @@ var MergeAlert = function MergeAlert(_ref) {
7401
7421
  }, /*#__PURE__*/React.createElement(Button, {
7402
7422
  label: t("proceed"),
7403
7423
  onClick: handleSubmit,
7404
- size: "large",
7405
7424
  loading: isSubmitting,
7406
7425
  disabled: isSubmitting
7407
7426
  }), /*#__PURE__*/React.createElement(Button, {
@@ -7409,8 +7428,7 @@ var MergeAlert = function MergeAlert(_ref) {
7409
7428
  label: t("cancel"),
7410
7429
  onClick: function onClick() {
7411
7430
  return setShowModal(false);
7412
- },
7413
- size: "large"
7431
+ }
7414
7432
  })));
7415
7433
  };
7416
7434
 
@@ -7494,7 +7512,6 @@ var Merge = function Merge(_ref) {
7494
7512
  title: t("merge.mergeTags"),
7495
7513
  menuBarToggle: displayMenu ? handleMenuToggle : null,
7496
7514
  actionBlock: /*#__PURE__*/React.createElement(Button, {
7497
- size: "large",
7498
7515
  disabled: !(sourceTag !== null && sourceTag !== void 0 && sourceTag.id && destinationTag !== null && destinationTag !== void 0 && destinationTag.id),
7499
7516
  onClick: function onClick() {
7500
7517
  setIsModalOpen(true);
@@ -7506,6 +7523,7 @@ var Merge = function Merge(_ref) {
7506
7523
  title: "Tags Not Found",
7507
7524
  kbArticleUrl: kbArticleUrl,
7508
7525
  actionBlock: /*#__PURE__*/React.createElement(Button, {
7526
+ size: "small",
7509
7527
  onClick: function onClick() {
7510
7528
  return history.push(tagsPath);
7511
7529
  },