@devtron-labs/devtron-fe-common-lib 0.0.10-beta-12 → 0.0.10-beta-13

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
@@ -22986,17 +22986,6 @@ var ImageTagsContainer = function (_a) {
22986
22986
  var ImageTagButton = function (_a) {
22987
22987
  var text = _a.text, isSoftDeleted = _a.isSoftDeleted, isEditing = _a.isEditing, onSoftDeleteClick = _a.onSoftDeleteClick, onHardDeleteClick = _a.onHardDeleteClick, tagId = _a.tagId, softDeleteTags = _a.softDeleteTags, isSuperAdmin = _a.isSuperAdmin, duplicateTag = _a.duplicateTag;
22988
22988
  var IconComponent = isSoftDeleted ? SvgIcArrowCounterClockwise : SvgIcMinus;
22989
- var _b = __read(React.useState(false), 2), isHovered = _b[0], setIsHovered = _b[1];
22990
- var handleMouseEnter = function () {
22991
- if (isEditing) {
22992
- setIsHovered(true);
22993
- }
22994
- };
22995
- var handleMouseLeave = function () {
22996
- if (isEditing) {
22997
- setIsHovered(false);
22998
- }
22999
- };
23000
22989
  var isInSoftDeleteTags = isSoftDeleted && softDeleteTags.some(function (tag) { return tag.tagName === text; });
23001
22990
  var canTagBeHardDelete = tagId === 0 || isSuperAdmin;
23002
22991
  var tabColor = function () {
@@ -23010,9 +22999,7 @@ var ImageTagButton = function (_a) {
23010
22999
  return 'cn-9';
23011
23000
  }
23012
23001
  };
23013
- return (jsxRuntime.jsx("div", __assign({ className: "br-4 en-2 bw-1 dc__w-fit-content dc__word-wrap-anywhere mr-8 bcn-0 flex mb-4 ".concat(tabColor()), onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave }, { children: jsxRuntime.jsxs("div", __assign({ className: "flex pt-2 pl-8 pr-8 pb-2" }, { children: [duplicateTag ? (jsxRuntime.jsx(SvgIcErrorExclamation, { className: "icon-dim-12 mr-4" })) : (isHovered &&
23014
- isEditing &&
23015
- (isInSoftDeleteTags || (tagId !== 0 && !isSoftDeleted)) && (jsxRuntime.jsx(Tippy, __assign({ className: "default-tt", arrow: true, placement: "top", content: isInSoftDeleteTags ? 'Restore tag' : 'Soft delete tag' }, { children: jsxRuntime.jsx(IconComponent, { className: "icon-dim-12 mr-4 cursor ".concat(isSoftDeleted ? 'scn-6' : 'fcn-6'), "data-testid": "".concat(text, "-tag-soft-delete"), onClick: onSoftDeleteClick }) })))), text, isHovered && isEditing && canTagBeHardDelete && (jsxRuntime.jsx(Tippy, __assign({ className: "default-tt", arrow: true, placement: "top", content: "Remove tag" }, { children: jsxRuntime.jsx(SvgIcCross, { className: "icon-dim-12 ml-4 fcn-6 cn-5 cursor", "data-testid": "".concat(text, "-tag-hard-delete"), onClick: onHardDeleteClick }) })))] })) })));
23002
+ return (jsxRuntime.jsxs("div", __assign({ className: "br-4 en-2 bw-1 mr-8 bcn-0 mb-4 pt-2 pr-8 pb-2 pl-8 tag-class flex ".concat(isEditing ? 'icon-hover' : '', " ").concat(tabColor()) }, { children: [duplicateTag ? (jsxRuntime.jsx(SvgIcErrorExclamation, { className: "icon-dim-12 mr-4" })) : (jsxRuntime.jsx(Tippy, __assign({ className: "default-tt", arrow: true, placement: "top", content: isInSoftDeleteTags ? 'Restore tag' : 'Soft delete tag' }, { children: jsxRuntime.jsx("div", __assign({ className: "action-icon mr-4 lh-16 pt-3 ".concat(isInSoftDeleteTags || (tagId !== 0 && !isSoftDeleted) ? 'show-icon' : '') }, { children: jsxRuntime.jsx(IconComponent, { className: "icon-dim-12 cursor".concat(isSoftDeleted ? 'scn-6' : 'fcn-6', " "), "data-testid": "".concat(text, "-tag-soft-delete"), onClick: onSoftDeleteClick }) })) }))), text, jsxRuntime.jsx(Tippy, __assign({ className: "default-tt", arrow: true, placement: "top", content: "Remove tag" }, { children: jsxRuntime.jsx("div", __assign({ className: "action-icon ml-4 lh-16 pt-3 ".concat(canTagBeHardDelete ? 'show-icon' : '') }, { children: jsxRuntime.jsx(SvgIcCross, { className: "icon-dim-12 fcn-6 cursor", "data-testid": "".concat(text, "-tag-hard-delete"), onClick: onHardDeleteClick }) })) }))] })));
23016
23003
  };
23017
23004
  var AddImageButton = function (_a) {
23018
23005
  var handleEditClick = _a.handleEditClick;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtron-labs/devtron-fe-common-lib",
3
- "version": "0.0.10-beta-12",
3
+ "version": "0.0.10-beta-13",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -59,11 +59,11 @@ export const ImageTagsContainer = ({
59
59
  }, [appReleaseTagNames])
60
60
 
61
61
  useEffect(() => {
62
- if(saveData){
62
+ if (saveData) {
63
63
  handleSave()
64
64
  setSaveData(false)
65
65
  }
66
- },[saveData])
66
+ }, [saveData])
67
67
 
68
68
  async function initialise() {
69
69
  try {
@@ -207,8 +207,8 @@ export const ImageTagsContainer = ({
207
207
  }
208
208
 
209
209
  const handleSave = async () => {
210
- if(tagErrorMessage) return
211
-
210
+ if (tagErrorMessage) return
211
+
212
212
  const payload = {
213
213
  createTags: createTags,
214
214
  softDeleteTags: softDeleteTags,
@@ -337,7 +337,7 @@ export const ImageTagsContainer = ({
337
337
  }
338
338
 
339
339
  const onClickSave = () => {
340
- if(textInput.trim()){
340
+ if (textInput.trim()) {
341
341
  handleTagCreate(textInput)
342
342
  }
343
343
  setSaveData(true)
@@ -515,19 +515,6 @@ export const ImageTagButton = ({
515
515
  duplicateTag,
516
516
  }: ImageButtonType) => {
517
517
  const IconComponent = isSoftDeleted ? Redo : Minus
518
-
519
- const [isHovered, setIsHovered] = useState(false)
520
- const handleMouseEnter = () => {
521
- if (isEditing) {
522
- setIsHovered(true)
523
- }
524
- }
525
- const handleMouseLeave = () => {
526
- if (isEditing) {
527
- setIsHovered(false)
528
- }
529
- }
530
-
531
518
  const isInSoftDeleteTags = isSoftDeleted && softDeleteTags.some((tag) => tag.tagName === text)
532
519
  const canTagBeHardDelete = tagId === 0 || isSuperAdmin
533
520
 
@@ -543,42 +530,42 @@ export const ImageTagButton = ({
543
530
 
544
531
  return (
545
532
  <div
546
- className={`br-4 en-2 bw-1 dc__w-fit-content dc__word-wrap-anywhere mr-8 bcn-0 flex mb-4 ${tabColor()}`}
547
- onMouseEnter={handleMouseEnter}
548
- onMouseLeave={handleMouseLeave}
533
+ className={`br-4 en-2 bw-1 mr-8 bcn-0 mb-4 pt-2 pr-8 pb-2 pl-8 tag-class flex ${
534
+ isEditing ? 'icon-hover' : ''
535
+ } ${tabColor()}`}
549
536
  >
550
- <div className="flex pt-2 pl-8 pr-8 pb-2">
551
- {duplicateTag ? (
552
- <Warning className="icon-dim-12 mr-4" />
553
- ) : (
554
- isHovered &&
555
- isEditing &&
556
- (isInSoftDeleteTags || (tagId !== 0 && !isSoftDeleted)) && (
557
- <Tippy
558
- className="default-tt"
559
- arrow={true}
560
- placement="top"
561
- content={isInSoftDeleteTags ? 'Restore tag' : 'Soft delete tag'}
562
- >
563
- <IconComponent
564
- className={`icon-dim-12 mr-4 cursor ${isSoftDeleted ? 'scn-6' : 'fcn-6'}`}
565
- data-testid={`${text}-tag-soft-delete`}
566
- onClick={onSoftDeleteClick}
567
- />
568
- </Tippy>
569
- )
570
- )}
571
- {text}
572
- {isHovered && isEditing && canTagBeHardDelete && (
573
- <Tippy className="default-tt" arrow={true} placement="top" content="Remove tag">
574
- <Close
575
- className="icon-dim-12 ml-4 fcn-6 cn-5 cursor"
576
- data-testid={`${text}-tag-hard-delete`}
577
- onClick={onHardDeleteClick}
537
+ {duplicateTag ? (
538
+ <Warning className="icon-dim-12 mr-4" />
539
+ ) : (
540
+ <Tippy
541
+ className="default-tt"
542
+ arrow={true}
543
+ placement="top"
544
+ content={isInSoftDeleteTags ? 'Restore tag' : 'Soft delete tag'}
545
+ >
546
+ <div
547
+ className={`action-icon mr-4 lh-16 pt-3 ${
548
+ isInSoftDeleteTags || (tagId !== 0 && !isSoftDeleted) ? 'show-icon' : ''
549
+ }`}
550
+ >
551
+ <IconComponent
552
+ className={`icon-dim-12 cursor${isSoftDeleted ? 'scn-6' : 'fcn-6'} `}
553
+ data-testid={`${text}-tag-soft-delete`}
554
+ onClick={onSoftDeleteClick}
578
555
  />
579
- </Tippy>
580
- )}
581
- </div>
556
+ </div>
557
+ </Tippy>
558
+ )}
559
+ {text}
560
+ <Tippy className="default-tt" arrow={true} placement="top" content="Remove tag">
561
+ <div className={`action-icon ml-4 lh-16 pt-3 ${canTagBeHardDelete ? 'show-icon' : ''}`}>
562
+ <Close
563
+ className="icon-dim-12 fcn-6 cursor"
564
+ data-testid={`${text}-tag-hard-delete`}
565
+ onClick={onHardDeleteClick}
566
+ />
567
+ </div>
568
+ </Tippy>
582
569
  </div>
583
570
  )
584
571
  }