iguazio.dashboard-react-controls 3.2.4 → 3.2.6

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.
Files changed (84) hide show
  1. package/dist/components/ActionsMenu/ActionsMenu.mjs.map +1 -1
  2. package/dist/components/Backdrop/Backdrop.mjs.map +1 -1
  3. package/dist/components/BlockerSpy/BlockerSpy.mjs.map +1 -1
  4. package/dist/components/Button/Button.mjs.map +1 -1
  5. package/dist/components/ConfirmDialog/ConfirmDialog.mjs.map +1 -1
  6. package/dist/components/CopyToClipboard/CopyToClipboard.mjs.map +1 -1
  7. package/dist/components/ErrorMessage/ErrorMessage.mjs.map +1 -1
  8. package/dist/components/FormCheckBox/FormCheckBox.mjs.map +1 -1
  9. package/dist/components/FormChipCell/FormChip/FormChip.mjs.map +1 -1
  10. package/dist/components/FormChipCell/FormChipCell.mjs.map +1 -1
  11. package/dist/components/FormChipCell/FormChipCellView.mjs.map +1 -1
  12. package/dist/components/FormChipCell/HiddenChipsBlock/HiddenChipsBlock.mjs.map +1 -1
  13. package/dist/components/FormChipCell/NewChipForm/NewChipForm.mjs +54 -54
  14. package/dist/components/FormChipCell/NewChipForm/NewChipForm.mjs.map +1 -1
  15. package/dist/components/FormChipCell/NewChipInput/NewChipInput.mjs.map +1 -1
  16. package/dist/components/FormChipCell/formChipCell.util.mjs.map +1 -1
  17. package/dist/components/FormCombobox/FormCombobox.mjs.map +1 -1
  18. package/dist/components/FormInput/FormInput.mjs.map +1 -1
  19. package/dist/components/FormInput/InputNumberButtons/InputNumberButtons.mjs.map +1 -1
  20. package/dist/components/FormKeyValueTable/FormKeyValueTable.mjs.map +1 -1
  21. package/dist/components/FormOnChange/FormOnChange.mjs.map +1 -1
  22. package/dist/components/FormRadio/FormRadio.mjs +2 -2
  23. package/dist/components/FormRadio/FormRadio.mjs.map +1 -1
  24. package/dist/components/FormSelect/FormSelect.mjs.map +1 -1
  25. package/dist/components/FormTextarea/FormTextarea.mjs +5 -5
  26. package/dist/components/FormTextarea/FormTextarea.mjs.map +1 -1
  27. package/dist/components/FormToggle/FormToggle.mjs.map +1 -1
  28. package/dist/components/LoadButton/LoadButton.mjs.map +1 -1
  29. package/dist/components/Loader/Loader.mjs.map +1 -1
  30. package/dist/components/Loader/LoaderForSuspenseFallback.mjs +2 -2
  31. package/dist/components/Loader/LoaderForSuspenseFallback.mjs.map +1 -1
  32. package/dist/components/Modal/Modal.mjs.map +1 -1
  33. package/dist/components/PopUpDialog/PopUpDialog.mjs.map +1 -1
  34. package/dist/components/ReadOnlyChips/ReadOnlyChips.mjs.map +1 -1
  35. package/dist/components/RoundedIcon/RoundedIcon.mjs.map +1 -1
  36. package/dist/components/TableCell/TableCell.mjs.map +1 -1
  37. package/dist/components/TabsSlider/TabsSlider.mjs.map +1 -1
  38. package/dist/components/Tip/Tip.mjs.map +1 -1
  39. package/dist/components/Tooltip/Tooltip.mjs.map +1 -1
  40. package/dist/components/TooltipTemplate/TextTooltipTemplate.mjs.map +1 -1
  41. package/dist/components/Wizard/Wizard.mjs.map +1 -1
  42. package/dist/components/Wizard/WizardSteps/WizardSteps.mjs.map +1 -1
  43. package/dist/constants.mjs.map +1 -1
  44. package/dist/elements/ActionsMenuItem/ActionsMenuItem.mjs.map +1 -1
  45. package/dist/elements/FormActionButton/FormActionButton.mjs.map +1 -1
  46. package/dist/elements/FormRowActions/FormRowActions.mjs.map +1 -1
  47. package/dist/elements/OptionsMenu/OptionsMenu.mjs.map +1 -1
  48. package/dist/elements/SelectOption/SelectOption.mjs.map +1 -1
  49. package/dist/elements/TableHead/TableHead.mjs.map +1 -1
  50. package/dist/elements/TableLinkCell/TableLinkCell.mjs.map +1 -1
  51. package/dist/elements/TableTypeCell/TableTypeCell.mjs.map +1 -1
  52. package/dist/elements/ValidationTemplate/ValidationTemplate.mjs.map +1 -1
  53. package/dist/hooks/useChipCell.hook.mjs +34 -34
  54. package/dist/hooks/useChipCell.hook.mjs.map +1 -1
  55. package/dist/hooks/useDebounce.hook.mjs.map +1 -1
  56. package/dist/hooks/useDetails.hook.mjs.map +1 -1
  57. package/dist/hooks/useDetailsHeader.hook.mjs.map +1 -1
  58. package/dist/hooks/useDetectOutsideClick.hook.mjs.map +1 -1
  59. package/dist/hooks/useFormTable.hook.mjs.map +1 -1
  60. package/dist/hooks/useHiddenChipsBlock.hook.mjs.map +1 -1
  61. package/dist/hooks/useTable.hook.mjs.map +1 -1
  62. package/dist/images/back-arrow.svg.mjs.map +1 -1
  63. package/dist/images/history.svg.mjs.map +1 -1
  64. package/dist/images/ml-enlarge.svg.mjs.map +1 -1
  65. package/dist/images/popout.svg.mjs.map +1 -1
  66. package/dist/images/question-mark.svg.mjs.map +1 -1
  67. package/dist/images/warning.svg.mjs.map +1 -1
  68. package/dist/index.css +1 -1
  69. package/dist/reducers/commonDetailsReducer.mjs.map +1 -1
  70. package/dist/reducers/notificationReducer.mjs.map +1 -1
  71. package/dist/types.mjs.map +1 -1
  72. package/dist/utils/chips.util.mjs.map +1 -1
  73. package/dist/utils/common.util.mjs.map +1 -1
  74. package/dist/utils/datetime.util.d.ts +10 -1
  75. package/dist/utils/datetime.util.d.ts.map +1 -1
  76. package/dist/utils/datetime.util.mjs +36 -21
  77. package/dist/utils/datetime.util.mjs.map +1 -1
  78. package/dist/utils/filter.util.mjs.map +1 -1
  79. package/dist/utils/form.util.mjs.map +1 -1
  80. package/dist/utils/generateChipsList.util.mjs.map +1 -1
  81. package/dist/utils/notification.util.mjs.map +1 -1
  82. package/dist/utils/string.util.mjs.map +1 -1
  83. package/dist/utils/validation.util.mjs.map +1 -1
  84. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"LoaderForSuspenseFallback.mjs","sources":["../../../src/lib/components/Loader/LoaderForSuspenseFallback.jsx"],"sourcesContent":["/*\nCopyright 2019 Iguazio Systems Ltd.\n\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\n\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, { useLayoutEffect } from 'react'\n\nimport Loader from './Loader'\n\nconst LoaderForSuspenseFallback = () => {\n useLayoutEffect(() => {\n const overlayContainer = document.getElementById('overlay_container')\n const savedVisibilityStyle = overlayContainer ? overlayContainer.style.visibility : 'visible'\n\n if (overlayContainer) overlayContainer.style.visibility = 'hidden'\n\n return () => {\n if (overlayContainer) overlayContainer.style.visibility = savedVisibilityStyle\n }\n }, [])\n\n return <Loader />\n}\n\nexport default React.memo(LoaderForSuspenseFallback)\n"],"names":["LoaderForSuspenseFallback","useLayoutEffect","overlayContainer","savedVisibilityStyle","Loader","LoaderForSuspenseFallback$1","React"],"mappings":";;;AAuBA,MAAMA,IAA4B,OAChCC,EAAgB,MAAM;AACd,QAAAC,IAAmB,SAAS,eAAe,mBAAmB,GAC9DC,IAAuBD,IAAmBA,EAAiB,MAAM,aAAa;AAEhF,SAAAA,MAAmCA,EAAA,MAAM,aAAa,WAEnD,MAAM;AACP,IAAAA,MAAmCA,EAAA,MAAM,aAAaC;AAAA,EAC5D;AACF,GAAG,EAAE,qBAEGC,GAAO,EAAA,IAGjBC,IAAeC,EAAM,KAAKN,CAAyB;"}
1
+ {"version":3,"file":"LoaderForSuspenseFallback.mjs","sources":["../../../src/lib/components/Loader/LoaderForSuspenseFallback.jsx"],"sourcesContent":["/*\nCopyright 2019 Iguazio Systems Ltd.\n\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\n\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, { useLayoutEffect } from 'react'\n\nimport Loader from './Loader'\n\nconst LoaderForSuspenseFallback = () => {\n useLayoutEffect(() => {\n const overlayContainer = document.getElementById('overlay_container')\n const savedVisibilityStyle = overlayContainer ? overlayContainer.style.visibility : 'visible'\n\n if (overlayContainer) overlayContainer.style.visibility = 'hidden'\n\n return () => {\n if (overlayContainer) overlayContainer.style.visibility = savedVisibilityStyle\n }\n }, [])\n\n return <Loader />\n}\n\nexport default React.memo(LoaderForSuspenseFallback)\n"],"names":["LoaderForSuspenseFallback","useLayoutEffect","overlayContainer","savedVisibilityStyle","Loader","LoaderForSuspenseFallback_default","React"],"mappings":";;;AAuBA,MAAMA,IAA4B,OAChCC,EAAgB,MAAM;AACpB,QAAMC,IAAmB,SAAS,eAAe,mBAAmB,GAC9DC,IAAuBD,IAAmBA,EAAiB,MAAM,aAAa;AAEpF,SAAIA,MAAkBA,EAAiB,MAAM,aAAa,WAEnD,MAAM;AACX,IAAIA,MAAkBA,EAAiB,MAAM,aAAaC;AAAA,EAC5D;AACF,GAAG,CAAA,CAAE,qBAEGC,GAAA,EAAO,IAGjBC,IAAeC,EAAM,KAAKN,CAAyB;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.mjs","sources":["../../../src/lib/components/Modal/Modal.jsx"],"sourcesContent":["/*\nCopyright 2022 Iguazio Systems Ltd.\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, { useRef } from 'react'\nimport PropTypes from 'prop-types'\nimport { CSSTransition } from 'react-transition-group'\nimport classNames from 'classnames'\n\nimport Backdrop from '../Backdrop/Backdrop'\nimport RoundedIcon from '../RoundedIcon/RoundedIcon'\n\nimport { MODAL_MD } from '../../constants'\nimport { MODAL_SIZES } from '../../types'\n\nimport CloseIcon from '../../images/close.svg?react'\n\nimport './Modal.scss'\n\nconst Modal = ({\n actions = [],\n children,\n className = '',\n noHeader = false,\n onClose,\n previewText = '',\n show = false,\n size = MODAL_MD,\n subTitle = null,\n title = ''\n}) => {\n const nodeRef = useRef(null)\n const modalClassNames = classNames('modal', className, size && `modal-${size}`)\n\n return (\n <>\n <Backdrop onClose={onClose} show={show} />\n <CSSTransition\n nodeRef={nodeRef}\n in={show}\n timeout={300}\n classNames=\"modal-transition\"\n unmountOnExit\n >\n <div className={modalClassNames} data-testid=\"modal\" ref={nodeRef}>\n <div className=\"modal__header-button\">\n <RoundedIcon data-testid=\"pop-up-close-btn\" onClick={onClose} tooltipText=\"Close\">\n <CloseIcon />\n </RoundedIcon>\n </div>\n <div className=\"modal__content\">\n {!noHeader && (\n <div className=\"modal__header\">\n {previewText && <div className=\"modal__header-preview-text\">{previewText}</div>}\n <h5 className=\"modal__header-title\">{title}</h5>\n {subTitle && <h6 className=\"modal__header-sub-title\">{subTitle}</h6>}\n </div>\n )}\n <div className=\"modal__body\">{children}</div>\n {actions && actions.length > 0 && (\n <div className=\"modal__footer\">\n <div className=\"modal__footer-actions\">\n {actions.map((action, idx) => (\n <div key={idx}>{action}</div>\n ))}\n </div>\n </div>\n )}\n </div>\n </div>\n </CSSTransition>\n </>\n )\n}\n\nModal.propTypes = {\n actions: PropTypes.array,\n children: PropTypes.oneOfType([\n PropTypes.element,\n PropTypes.object,\n PropTypes.node,\n PropTypes.string\n ]).isRequired,\n className: PropTypes.string,\n noHeader: PropTypes.bool,\n onClose: PropTypes.func.isRequired,\n previewText: PropTypes.string,\n show: PropTypes.bool,\n size: MODAL_SIZES,\n subTitle: PropTypes.string,\n title: PropTypes.string\n}\n\nexport default Modal\n"],"names":["Modal","actions","children","className","noHeader","onClose","previewText","show","size","MODAL_MD","subTitle","title","nodeRef","useRef","modalClassNames","classNames","jsxs","Fragment","jsx","Backdrop","CSSTransition","RoundedIcon","CloseIcon","action","idx","PropTypes","MODAL_SIZES"],"mappings":";;;;;;;;;;;AA+BA,MAAMA,IAAQ,CAAC;AAAA,EACb,SAAAC,IAAU,CAAC;AAAA,EACX,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,UAAAC,IAAW;AAAA,EACX,SAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,MAAAC,IAAO;AAAA,EACP,MAAAC,IAAOC;AAAA,EACP,UAAAC,IAAW;AAAA,EACX,OAAAC,IAAQ;AACV,MAAM;AACE,QAAAC,IAAUC,EAAO,IAAI,GACrBC,IAAkBC,EAAW,SAASZ,GAAWK,KAAQ,SAASA,CAAI,EAAE;AAE9E,SAEI,gBAAAQ,EAAAC,GAAA,EAAA,UAAA;AAAA,IAAC,gBAAAC,EAAAC,GAAA,EAAS,SAAAd,GAAkB,MAAAE,EAAY,CAAA;AAAA,IACxC,gBAAAW;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,SAAAR;AAAA,QACA,IAAIL;AAAA,QACJ,SAAS;AAAA,QACT,YAAW;AAAA,QACX,eAAa;AAAA,QAEb,4BAAC,OAAI,EAAA,WAAWO,GAAiB,eAAY,SAAQ,KAAKF,GACxD,UAAA;AAAA,UAAA,gBAAAM,EAAC,OAAI,EAAA,WAAU,wBACb,UAAA,gBAAAA,EAACG,KAAY,eAAY,o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
+ {"version":3,"file":"Modal.mjs","sources":["../../../src/lib/components/Modal/Modal.jsx"],"sourcesContent":["/*\nCopyright 2022 Iguazio Systems Ltd.\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, { useRef } from 'react'\nimport PropTypes from 'prop-types'\nimport { CSSTransition } from 'react-transition-group'\nimport classNames from 'classnames'\n\nimport Backdrop from '../Backdrop/Backdrop'\nimport RoundedIcon from '../RoundedIcon/RoundedIcon'\n\nimport { MODAL_MD } from '../../constants'\nimport { MODAL_SIZES } from '../../types'\n\nimport CloseIcon from '../../images/close.svg?react'\n\nimport './Modal.scss'\n\nconst Modal = ({\n actions = [],\n children,\n className = '',\n noHeader = false,\n onClose,\n previewText = '',\n show = false,\n size = MODAL_MD,\n subTitle = null,\n title = ''\n}) => {\n const nodeRef = useRef(null)\n const modalClassNames = classNames('modal', className, size && `modal-${size}`)\n\n return (\n <>\n <Backdrop onClose={onClose} show={show} />\n <CSSTransition\n nodeRef={nodeRef}\n in={show}\n timeout={300}\n classNames=\"modal-transition\"\n unmountOnExit\n >\n <div className={modalClassNames} data-testid=\"modal\" ref={nodeRef}>\n <div className=\"modal__header-button\">\n <RoundedIcon data-testid=\"pop-up-close-btn\" onClick={onClose} tooltipText=\"Close\">\n <CloseIcon />\n </RoundedIcon>\n </div>\n <div className=\"modal__content\">\n {!noHeader && (\n <div className=\"modal__header\">\n {previewText && <div className=\"modal__header-preview-text\">{previewText}</div>}\n <h5 className=\"modal__header-title\">{title}</h5>\n {subTitle && <h6 className=\"modal__header-sub-title\">{subTitle}</h6>}\n </div>\n )}\n <div className=\"modal__body\">{children}</div>\n {actions && actions.length > 0 && (\n <div className=\"modal__footer\">\n <div className=\"modal__footer-actions\">\n {actions.map((action, idx) => (\n <div key={idx}>{action}</div>\n ))}\n </div>\n </div>\n )}\n </div>\n </div>\n </CSSTransition>\n </>\n )\n}\n\nModal.propTypes = {\n actions: PropTypes.array,\n children: PropTypes.oneOfType([\n PropTypes.element,\n PropTypes.object,\n PropTypes.node,\n PropTypes.string\n ]).isRequired,\n className: PropTypes.string,\n noHeader: PropTypes.bool,\n onClose: PropTypes.func.isRequired,\n previewText: PropTypes.string,\n show: PropTypes.bool,\n size: MODAL_SIZES,\n subTitle: PropTypes.string,\n title: PropTypes.string\n}\n\nexport default Modal\n"],"names":["Modal","actions","children","className","noHeader","onClose","previewText","show","size","MODAL_MD","subTitle","title","nodeRef","useRef","modalClassNames","classNames","jsxs","Fragment","jsx","Backdrop","CSSTransition","RoundedIcon","CloseIcon","action","idx","PropTypes","MODAL_SIZES"],"mappings":";;;;;;;;;;;AA+BA,MAAMA,IAAQ,CAAC;AAAA,EACb,SAAAC,IAAU,CAAA;AAAA,EACV,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,UAAAC,IAAW;AAAA,EACX,SAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,MAAAC,IAAO;AAAA,EACP,MAAAC,IAAOC;AAAA,EACP,UAAAC,IAAW;AAAA,EACX,OAAAC,IAAQ;AACV,MAAM;AACJ,QAAMC,IAAUC,EAAO,IAAI,GACrBC,IAAkBC,EAAW,SAASZ,GAAWK,KAAQ,SAASA,CAAI,EAAE;AAE9E,SACE,gBAAAQ,EAAAC,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAC,EAACC,GAAA,EAAS,SAAAd,GAAkB,MAAAE,EAAA,CAAY;AAAA,IACxC,gBAAAW;AAAA,MAACE;AAAA,MAAA;AAAA,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,EAAU;AAAA,EAAA,CACX,EAAE;AAAA,EACH,WAAWA,EAAU;AAAA,EACrB,UAAUA,EAAU;AAAA,EACpB,SAASA,EAAU,KAAK;AAAA,EACxB,aAAaA,EAAU;AAAA,EACvB,MAAMA,EAAU;AAAA,EAChB,MAAMC;AAAA,EACN,UAAUD,EAAU;AAAA,EACpB,OAAOA,EAAU;AACnB;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PopUpDialog.mjs","sources":["../../../src/lib/components/PopUpDialog/PopUpDialog.jsx"],"sourcesContent":["/*\nCopyright 2022 Iguazio Systems Ltd.\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, { forwardRef, useCallback, useEffect, useLayoutEffect, useRef } from 'react'\nimport PropTypes from 'prop-types'\nimport classnames from 'classnames'\nimport { createPortal } from 'react-dom'\nimport { throttle } from 'lodash'\n\nimport RoundedIcon from '../RoundedIcon/RoundedIcon'\nimport Tooltip from '../Tooltip/Tooltip'\nimport TextTooltipTemplate from '../TooltipTemplate/TextTooltipTemplate'\n\nimport { POP_UP_CUSTOM_POSITION } from '../../types'\nimport CloseIcon from '../../images/close.svg?react'\n\nimport './popUpDialog.scss'\n\nlet PopUpDialog = (\n {\n children,\n className = '',\n closePopUp = null,\n customPosition = {},\n headerIsHidden = false,\n headerText = '',\n isOpen = true,\n onResolve = null,\n style = {},\n tooltipText = ''\n },\n ref\n) => {\n const popUpOverlayRef = useRef(null)\n ref ??= popUpOverlayRef\n const popUpClassNames = classnames(\n className,\n 'pop-up-dialog__overlay',\n customPosition.element && 'custom-position'\n )\n\n const handleClosePopUp = useCallback(() => {\n closePopUp && closePopUp()\n onResolve && onResolve()\n }, [closePopUp, onResolve])\n\n const calculateCustomPopUpPosition = useCallback(() => {\n if (customPosition?.element?.current && ref?.current) {\n const elementRect = customPosition.element.current.getBoundingClientRect()\n const popUpRect = ref.current.getBoundingClientRect()\n const [verticalPosition, horizontalPosition] = customPosition.position.split('-')\n const popupMargin = 15\n const elementMargin = 5\n const isEnoughSpaceFromLeft = elementRect.right >= popUpRect.width + popupMargin\n const isEnoughSpaceFromRight =\n window.innerWidth - elementRect.left >= popUpRect.width + popupMargin\n const isEnoughSpaceFromTop = elementRect.top > popUpRect.height + popupMargin + elementMargin\n const isEnoughSpaceFromBottom =\n elementRect.bottom + popUpRect.height + popupMargin + elementMargin <= window.innerHeight\n let leftPosition =\n horizontalPosition === 'left' ? elementRect.right - popUpRect.width : elementRect.left\n\n let topPosition\n\n if (verticalPosition === 'top') {\n topPosition = isEnoughSpaceFromTop\n ? elementRect.top - popUpRect.height - elementMargin\n : popupMargin\n } else {\n topPosition = isEnoughSpaceFromBottom\n ? elementRect.bottom + elementMargin\n : window.innerHeight - popUpRect.height - popupMargin\n }\n\n if (customPosition.autoVerticalPosition) {\n if (verticalPosition === 'top') {\n if (!isEnoughSpaceFromTop && isEnoughSpaceFromBottom) {\n topPosition = elementRect.bottom + elementMargin\n }\n } else {\n if (isEnoughSpaceFromTop && !isEnoughSpaceFromBottom) {\n topPosition = elementRect.top - popUpRect.height - elementMargin\n }\n }\n }\n\n if (customPosition.autoHorizontalPosition) {\n if (verticalPosition === 'left') {\n if (!isEnoughSpaceFromLeft && isEnoughSpaceFromRight) {\n leftPosition = elementRect.left\n } else if (!isEnoughSpaceFromLeft && !isEnoughSpaceFromRight) {\n leftPosition = popupMargin\n }\n } else {\n if (isEnoughSpaceFromLeft && !isEnoughSpaceFromRight) {\n leftPosition = elementRect.right - popUpRect.width\n } else if (!isEnoughSpaceFromLeft && !isEnoughSpaceFromRight) {\n leftPosition = window.innerWidth - popUpRect.width - popupMargin\n }\n }\n }\n\n ref.current.style.top = `${topPosition}px`\n\n if (style.left && !(customPosition.autoHorizontalPosition && isEnoughSpaceFromRight)) {\n ref.current.style.left = `calc(${leftPosition}px + ${style.left})`\n } else {\n ref.current.style.left = `${leftPosition}px`\n }\n }\n }, [customPosition, style.left, ref])\n\n useLayoutEffect(() => {\n calculateCustomPopUpPosition()\n }, [calculateCustomPopUpPosition])\n\n useEffect(() => {\n if (isOpen) {\n const throttledCalculatedCustomPopUpPosition = throttle(calculateCustomPopUpPosition, 100, {\n trailing: true,\n leading: true\n })\n const popupObserver = new ResizeObserver(throttledCalculatedCustomPopUpPosition)\n const popupElement = ref.current\n\n popupObserver.observe(popupElement)\n window.addEventListener('resize', throttledCalculatedCustomPopUpPosition)\n\n return () => {\n popupObserver.unobserve(popupElement)\n window.removeEventListener('resize', throttledCalculatedCustomPopUpPosition)\n }\n }\n }, [calculateCustomPopUpPosition, ref, isOpen])\n\n return isOpen\n ? createPortal(\n <div ref={ref} className={popUpClassNames} style={style}>\n <div data-testid=\"pop-up-dialog\" className=\"pop-up-dialog\">\n {!headerIsHidden && (\n <div className=\"pop-up-dialog__header\">\n {headerText && (\n <div data-testid=\"pop-up-dialog-header\" className=\"pop-up-dialog__header-text\">\n <Tooltip template={<TextTooltipTemplate text={tooltipText || headerText} />}>\n <span>{headerText}</span>\n </Tooltip>\n </div>\n )}\n <RoundedIcon\n className=\"pop-up-dialog__btn_close\"\n onClick={handleClosePopUp}\n tooltipText=\"Close\"\n data-testid=\"pop-up-close-btn\"\n >\n <CloseIcon />\n </RoundedIcon>\n </div>\n )}\n {children}\n </div>\n </div>,\n document.getElementById('overlay_container')\n )\n : null\n}\n\nPopUpDialog = forwardRef(PopUpDialog)\n\nPopUpDialog.displayName = 'PopUpDialog'\n\nPopUpDialog.propTypes = {\n children: PropTypes.node.isRequired,\n className: PropTypes.string,\n closePopUp: PropTypes.func,\n customPosition: POP_UP_CUSTOM_POSITION,\n isOpen: PropTypes.bool,\n headerIsHidden: PropTypes.bool,\n headerText: PropTypes.string,\n onResolve: PropTypes.func,\n showPopUpDialog: PropTypes.bool,\n style: PropTypes.object,\n tooltipText: PropTypes.string\n}\n\nexport default PopUpDialog\n"],"names":["PopUpDialog","children","className","closePopUp","customPosition","headerIsHidden","headerText","isOpen","onResolve","style","tooltipText","ref","popUpOverlayRef","useRef","popUpClassNames","classnames","handleClosePopUp","useCallback","calculateCustomPopUpPosition","_a","elementRect","popUpRect","verticalPosition","horizontalPosition","popupMargin","elementMargin","isEnoughSpaceFromLeft","isEnoughSpaceFromRight","isEnoughSpaceFromTop","isEnoughSpaceFromBottom","leftPosition","topPosition","useLayoutEffect","useEffect","throttledCalculatedCustomPopUpPosition","throttle","popupObserver","popupElement","createPortal","jsx","jsxs","Tooltip","TextTooltipTemplate","RoundedIcon","CloseIcon","forwardRef","PropTypes","POP_UP_CUSTOM_POSITION","PopUpDialog$1"],"mappings":";;;;;;;;;;;;AA+BA,IAAIA,IAAc,CAChB;AAAA,EACE,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,YAAAC,IAAa;AAAA,EACb,gBAAAC,IAAiB,CAAC;AAAA,EAClB,gBAAAC,IAAiB;AAAA,EACjB,YAAAC,IAAa;AAAA,EACb,QAAAC,IAAS;AAAA,EACT,WAAAC,IAAY;AAAA,EACZ,OAAAC,IAAQ,CAAC;AAAA,EACT,aAAAC,IAAc;AAChB,GACAC,MACG;AACG,QAAAC,IAAkBC,EAAO,IAAI;AAC3B,EAAAF,UAAAC;AACR,QAAME,IAAkBC;AAAA,IACtBb;AAAA,IACA;AAAA,IACAE,EAAe,WAAW;AAAA,EAC5B,GAEMY,IAAmBC,EAAY,MAAM;AACzC,IAAAd,KAAcA,EAAW,GACzBK,KAAaA,EAAU;AAAA,EAAA,GACtB,CAACL,GAAYK,CAAS,CAAC,GAEpBU,IAA+B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A,MACb,GACF;AAAA,MAED3C;AAAA,IAAA,EAAA,CACH,EACF,CAAA;AAAA,IACA,SAAS,eAAe,mBAAmB;AAAA,EAAA,IAE7C;AACN;AAEAD,IAAc6C,EAAW7C,CAAW;AAEpCA,EAAY,cAAc;AAE1BA,EAAY,YAAY;AAAA,EACtB,UAAU8C,EAAU,KAAK;AAAA,EACzB,WAAWA,EAAU;AAAA,EACrB,YAAYA,EAAU;AAAA,EACtB,gBAAgBC;AAAA,EAChB,QAAQD,EAAU;AAAA,EAClB,gBAAgBA,EAAU;AAAA,EAC1B,YAAYA,EAAU;AAAA,EACtB,WAAWA,EAAU;AAAA,EACrB,iBAAiBA,EAAU;AAAA,EAC3B,OAAOA,EAAU;AAAA,EACjB,aAAaA,EAAU;AACzB;AAEA,MAAAE,KAAehD;"}
1
+ {"version":3,"file":"PopUpDialog.mjs","sources":["../../../src/lib/components/PopUpDialog/PopUpDialog.jsx"],"sourcesContent":["/*\nCopyright 2022 Iguazio Systems Ltd.\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, { forwardRef, useCallback, useEffect, useLayoutEffect, useRef } from 'react'\nimport PropTypes from 'prop-types'\nimport classnames from 'classnames'\nimport { createPortal } from 'react-dom'\nimport { throttle } from 'lodash'\n\nimport RoundedIcon from '../RoundedIcon/RoundedIcon'\nimport Tooltip from '../Tooltip/Tooltip'\nimport TextTooltipTemplate from '../TooltipTemplate/TextTooltipTemplate'\n\nimport { POP_UP_CUSTOM_POSITION } from '../../types'\nimport CloseIcon from '../../images/close.svg?react'\n\nimport './popUpDialog.scss'\n\nlet PopUpDialog = (\n {\n children,\n className = '',\n closePopUp = null,\n customPosition = {},\n headerIsHidden = false,\n headerText = '',\n isOpen = true,\n onResolve = null,\n style = {},\n tooltipText = ''\n },\n ref\n) => {\n const popUpOverlayRef = useRef(null)\n ref ??= popUpOverlayRef\n const popUpClassNames = classnames(\n className,\n 'pop-up-dialog__overlay',\n customPosition.element && 'custom-position'\n )\n\n const handleClosePopUp = useCallback(() => {\n closePopUp && closePopUp()\n onResolve && onResolve()\n }, [closePopUp, onResolve])\n\n const calculateCustomPopUpPosition = useCallback(() => {\n if (customPosition?.element?.current && ref?.current) {\n const elementRect = customPosition.element.current.getBoundingClientRect()\n const popUpRect = ref.current.getBoundingClientRect()\n const [verticalPosition, horizontalPosition] = customPosition.position.split('-')\n const popupMargin = 15\n const elementMargin = 5\n const isEnoughSpaceFromLeft = elementRect.right >= popUpRect.width + popupMargin\n const isEnoughSpaceFromRight =\n window.innerWidth - elementRect.left >= popUpRect.width + popupMargin\n const isEnoughSpaceFromTop = elementRect.top > popUpRect.height + popupMargin + elementMargin\n const isEnoughSpaceFromBottom =\n elementRect.bottom + popUpRect.height + popupMargin + elementMargin <= window.innerHeight\n let leftPosition =\n horizontalPosition === 'left' ? elementRect.right - popUpRect.width : elementRect.left\n\n let topPosition\n\n if (verticalPosition === 'top') {\n topPosition = isEnoughSpaceFromTop\n ? elementRect.top - popUpRect.height - elementMargin\n : popupMargin\n } else {\n topPosition = isEnoughSpaceFromBottom\n ? elementRect.bottom + elementMargin\n : window.innerHeight - popUpRect.height - popupMargin\n }\n\n if (customPosition.autoVerticalPosition) {\n if (verticalPosition === 'top') {\n if (!isEnoughSpaceFromTop && isEnoughSpaceFromBottom) {\n topPosition = elementRect.bottom + elementMargin\n }\n } else {\n if (isEnoughSpaceFromTop && !isEnoughSpaceFromBottom) {\n topPosition = elementRect.top - popUpRect.height - elementMargin\n }\n }\n }\n\n if (customPosition.autoHorizontalPosition) {\n if (verticalPosition === 'left') {\n if (!isEnoughSpaceFromLeft && isEnoughSpaceFromRight) {\n leftPosition = elementRect.left\n } else if (!isEnoughSpaceFromLeft && !isEnoughSpaceFromRight) {\n leftPosition = popupMargin\n }\n } else {\n if (isEnoughSpaceFromLeft && !isEnoughSpaceFromRight) {\n leftPosition = elementRect.right - popUpRect.width\n } else if (!isEnoughSpaceFromLeft && !isEnoughSpaceFromRight) {\n leftPosition = window.innerWidth - popUpRect.width - popupMargin\n }\n }\n }\n\n ref.current.style.top = `${topPosition}px`\n\n if (style.left && !(customPosition.autoHorizontalPosition && isEnoughSpaceFromRight)) {\n ref.current.style.left = `calc(${leftPosition}px + ${style.left})`\n } else {\n ref.current.style.left = `${leftPosition}px`\n }\n }\n }, [customPosition, style.left, ref])\n\n useLayoutEffect(() => {\n calculateCustomPopUpPosition()\n }, [calculateCustomPopUpPosition])\n\n useEffect(() => {\n if (isOpen) {\n const throttledCalculatedCustomPopUpPosition = throttle(calculateCustomPopUpPosition, 100, {\n trailing: true,\n leading: true\n })\n const popupObserver = new ResizeObserver(throttledCalculatedCustomPopUpPosition)\n const popupElement = ref.current\n\n popupObserver.observe(popupElement)\n window.addEventListener('resize', throttledCalculatedCustomPopUpPosition)\n\n return () => {\n popupObserver.unobserve(popupElement)\n window.removeEventListener('resize', throttledCalculatedCustomPopUpPosition)\n }\n }\n }, [calculateCustomPopUpPosition, ref, isOpen])\n\n return isOpen\n ? createPortal(\n <div ref={ref} className={popUpClassNames} style={style}>\n <div data-testid=\"pop-up-dialog\" className=\"pop-up-dialog\">\n {!headerIsHidden && (\n <div className=\"pop-up-dialog__header\">\n {headerText && (\n <div data-testid=\"pop-up-dialog-header\" className=\"pop-up-dialog__header-text\">\n <Tooltip template={<TextTooltipTemplate text={tooltipText || headerText} />}>\n <span>{headerText}</span>\n </Tooltip>\n </div>\n )}\n <RoundedIcon\n className=\"pop-up-dialog__btn_close\"\n onClick={handleClosePopUp}\n tooltipText=\"Close\"\n data-testid=\"pop-up-close-btn\"\n >\n <CloseIcon />\n </RoundedIcon>\n </div>\n )}\n {children}\n </div>\n </div>,\n document.getElementById('overlay_container')\n )\n : null\n}\n\nPopUpDialog = forwardRef(PopUpDialog)\n\nPopUpDialog.displayName = 'PopUpDialog'\n\nPopUpDialog.propTypes = {\n children: PropTypes.node.isRequired,\n className: PropTypes.string,\n closePopUp: PropTypes.func,\n customPosition: POP_UP_CUSTOM_POSITION,\n isOpen: PropTypes.bool,\n headerIsHidden: PropTypes.bool,\n headerText: PropTypes.string,\n onResolve: PropTypes.func,\n showPopUpDialog: PropTypes.bool,\n style: PropTypes.object,\n tooltipText: PropTypes.string\n}\n\nexport default PopUpDialog\n"],"names":["PopUpDialog","children","className","closePopUp","customPosition","headerIsHidden","headerText","isOpen","onResolve","style","tooltipText","ref","popUpOverlayRef","useRef","popUpClassNames","classnames","handleClosePopUp","useCallback","calculateCustomPopUpPosition","_a","elementRect","popUpRect","verticalPosition","horizontalPosition","popupMargin","elementMargin","isEnoughSpaceFromLeft","isEnoughSpaceFromRight","isEnoughSpaceFromTop","isEnoughSpaceFromBottom","leftPosition","topPosition","useLayoutEffect","useEffect","throttledCalculatedCustomPopUpPosition","throttle","popupObserver","popupElement","createPortal","jsx","jsxs","Tooltip","TextTooltipTemplate","RoundedIcon","CloseIcon","forwardRef","PropTypes","POP_UP_CUSTOM_POSITION","PopUpDialog$1"],"mappings":";;;;;;;;;;;;AA+BA,IAAIA,IAAc,CAChB;AAAA,EACE,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,YAAAC,IAAa;AAAA,EACb,gBAAAC,IAAiB,CAAA;AAAA,EACjB,gBAAAC,IAAiB;AAAA,EACjB,YAAAC,IAAa;AAAA,EACb,QAAAC,IAAS;AAAA,EACT,WAAAC,IAAY;AAAA,EACZ,OAAAC,IAAQ,CAAA;AAAA,EACR,aAAAC,IAAc;AAChB,GACAC,MACG;AACH,QAAMC,IA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AAA,CAAY,GACvE,4BAAC,QAAA,EAAM,UAAAA,GAAW,GACpB,EAAA,CACF;AAAA,QAEF,gBAAAiC;AAAA,UAACI;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,SAAS3B;AAAA,YACT,aAAY;AAAA,YACZ,eAAY;AAAA,YAEZ,4BAAC4B,GAAA,CAAA,CAAU;AAAA,UAAA;AAAA,QAAA;AAAA,MACb,GACF;AAAA,MAED3C;AAAA,IAAA,EAAA,CACH,EAAA,CACF;AAAA,IACA,SAAS,eAAe,mBAAmB;AAAA,EAAA,IAE7C;AACN;AAEAD,IAAc6C,EAAW7C,CAAW;AAEpCA,EAAY,cAAc;AAE1BA,EAAY,YAAY;AAAA,EACtB,UAAU8C,EAAU,KAAK;AAAA,EACzB,WAAWA,EAAU;AAAA,EACrB,YAAYA,EAAU;AAAA,EACtB,gBAAgBC;AAAA,EAChB,QAAQD,EAAU;AAAA,EAClB,gBAAgBA,EAAU;AAAA,EAC1B,YAAYA,EAAU;AAAA,EACtB,WAAWA,EAAU;AAAA,EACrB,iBAAiBA,EAAU;AAAA,EAC3B,OAAOA,EAAU;AAAA,EACjB,aAAaA,EAAU;AACzB;AAEA,MAAAE,KAAehD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ReadOnlyChips.mjs","sources":["../../../src/lib/components/ReadOnlyChips/ReadOnlyChips.jsx"],"sourcesContent":["/*\nCopyright 2019 Iguazio Systems Ltd.\n\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\n\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React from 'react'\nimport { Form } from 'react-final-form'\nimport { createForm } from 'final-form'\nimport PropTypes from 'prop-types'\nimport arrayMutators from 'final-form-arrays'\n\nimport { FormChipCell } from '../index'\n\nimport { getChipOptions } from '../../utils/chips.util'\nimport { setFieldState } from '../../utils/form.util'\nimport { CHIP_OPTIONS } from '../../types'\n\nconst defaultChipOptions = getChipOptions('metrics')\n\nconst ReadOnlyChips = ({ chipOptions = defaultChipOptions, labels = [], ...args }) => {\n const formRef = React.useRef(\n createForm({\n initialValues: { labels: labels },\n mutators: { ...arrayMutators, setFieldState },\n onSubmit: () => {}\n })\n )\n\n return (\n <Form form={formRef.current} onSubmit={() => {}}>\n {formState => {\n return (\n <FormChipCell\n chipOptions={chipOptions}\n formState={formState}\n isEditable={false}\n initialValues={formState.initialValues}\n name=\"labels\"\n {...args}\n />\n )\n }}\n </Form>\n )\n}\n\nReadOnlyChips.propTypes = {\n chipOptions: CHIP_OPTIONS,\n labels: PropTypes.array\n}\n\nexport default ReadOnlyChips\n"],"names":["defaultChipOptions","getChipOptions","ReadOnlyChips","chipOptions","labels","args","formRef","React","createForm","arrayMutators","setFieldState","Form","formState","jsx","FormChipCell","CHIP_OPTIONS","PropTypes"],"mappings":";;;;;;;;;;;AA+BA,MAAMA,IAAqBC,EAAe,SAAS,GAE7CC,IAAgB,CAAC,EAAE,aAAAC,IAAcH,GAAoB,QAAAI,IAAS,CAAC,GAAG,GAAGC,QAAW;AACpF,QAAMC,IAAUC,EAAM;AAAA,IACpBC,EAAW;AAAA,MACT,eAAe,EAAE,QAAAJ,EAAe;AAAA,MAChC,UAAU,EAAE,GAAGK,GAAe,eAAAC,EAAc;AAAA,MAC5C,UAAU,MAAM;AAAA,MAAA;AAAA,IACjB,CAAA;AAAA,EACH;AAEA,2BACGC,GAAK,EAAA,MAAML,EAAQ,SAAS,UAAU,MAAM;AAAA,EAAA,GAC1C,UAAa,CAAAM,MAEV,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,aAAAX;AAAA,MACA,WAAAS;AAAA,MACA,YAAY;AAAA,MACZ,eAAeA,EAAU;AAAA,MACzB,MAAK;AAAA,MACJ,GAAGP;AAAA,IAAA;AAAA,EACN,GAGN;AAEJ;AAEAH,EAAc,YAAY;AAAA,EACxB,aAAaa;AAAA,EACb,QAAQC,EAAU;AACpB;"}
1
+ {"version":3,"file":"ReadOnlyChips.mjs","sources":["../../../src/lib/components/ReadOnlyChips/ReadOnlyChips.jsx"],"sourcesContent":["/*\nCopyright 2019 Iguazio Systems Ltd.\n\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\n\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React from 'react'\nimport { Form } from 'react-final-form'\nimport { createForm } from 'final-form'\nimport PropTypes from 'prop-types'\nimport arrayMutators from 'final-form-arrays'\n\nimport { FormChipCell } from '../index'\n\nimport { getChipOptions } from '../../utils/chips.util'\nimport { setFieldState } from '../../utils/form.util'\nimport { CHIP_OPTIONS } from '../../types'\n\nconst defaultChipOptions = getChipOptions('metrics')\n\nconst ReadOnlyChips = ({ chipOptions = defaultChipOptions, labels = [], ...args }) => {\n const formRef = React.useRef(\n createForm({\n initialValues: { labels: labels },\n mutators: { ...arrayMutators, setFieldState },\n onSubmit: () => {}\n })\n )\n\n return (\n <Form form={formRef.current} onSubmit={() => {}}>\n {formState => {\n return (\n <FormChipCell\n chipOptions={chipOptions}\n formState={formState}\n isEditable={false}\n initialValues={formState.initialValues}\n name=\"labels\"\n {...args}\n />\n )\n }}\n </Form>\n )\n}\n\nReadOnlyChips.propTypes = {\n chipOptions: CHIP_OPTIONS,\n labels: PropTypes.array\n}\n\nexport default ReadOnlyChips\n"],"names":["defaultChipOptions","getChipOptions","ReadOnlyChips","chipOptions","labels","args","formRef","React","createForm","arrayMutators","setFieldState","Form","formState","jsx","FormChipCell","CHIP_OPTIONS","PropTypes"],"mappings":";;;;;;;;;;;AA+BA,MAAMA,IAAqBC,EAAe,SAAS,GAE7CC,IAAgB,CAAC,EAAE,aAAAC,IAAcH,GAAoB,QAAAI,IAAS,CAAA,GAAI,GAAGC,QAAW;AACpF,QAAMC,IAAUC,EAAM;AAAA,IACpBC,EAAW;AAAA,MACT,eAAe,EAAE,QAAAJ,EAAA;AAAA,MACjB,UAAU,EAAE,GAAGK,GAAe,eAAAC,EAAA;AAAA,MAC9B,UAAU,MAAM;AAAA,MAAC;AAAA,IAAA,CAClB;AAAA,EAAA;AAGH,2BACGC,GAAA,EAAK,MAAML,EAAQ,SAAS,UAAU,MAAM;AAAA,EAAC,GAC3C,UAAA,CAAAM,MAEG,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,aAAAX;AAAA,MACA,WAAAS;AAAA,MACA,YAAY;AAAA,MACZ,eAAeA,EAAU;AAAA,MACzB,MAAK;AAAA,MACJ,GAAGP;AAAA,IAAA;AAAA,EAAA,GAIZ;AAEJ;AAEAH,EAAc,YAAY;AAAA,EACxB,aAAaa;AAAA,EACb,QAAQC,EAAU;AACpB;"}
@@ -1 +1 @@
1
- {"version":3,"file":"RoundedIcon.mjs","sources":["../../../src/lib/components/RoundedIcon/RoundedIcon.jsx"],"sourcesContent":["/*\nCopyright 2022 Iguazio Systems Ltd.\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, { forwardRef } from 'react'\nimport PropTypes from 'prop-types'\nimport classNames from 'classnames'\n\nimport Tooltip from '../Tooltip/Tooltip'\nimport TextTooltipTemplate from '../TooltipTemplate/TextTooltipTemplate'\n\nimport './roundedIcon.scss'\n\nlet RoundedIcon = (\n {\n children,\n className = '',\n disabled = false,\n id = '',\n isActive = false,\n onClick = () => {},\n tooltipText = ''\n },\n ref\n) => {\n const wrapperClassNames = classNames('round-icon-cp', className)\n const IconClassNames = classNames(\n 'round-icon-cp__circle',\n isActive && 'round-icon-cp__circle-active',\n disabled && 'round-icon-cp__circle-disabled'\n )\n\n return (\n <div className={wrapperClassNames} ref={ref} data-testid={id}>\n <Tooltip hidden={!tooltipText} id={id} template={<TextTooltipTemplate text={tooltipText} />}>\n <button onClick={onClick} disabled={disabled} className={IconClassNames}>\n {children}\n </button>\n </Tooltip>\n </div>\n )\n}\n\nRoundedIcon = React.memo(forwardRef(RoundedIcon))\n\nRoundedIcon.displayName = 'RoundedIcon'\n\nRoundedIcon.propTypes = {\n children: PropTypes.node.isRequired,\n className: PropTypes.string,\n disabled: PropTypes.bool,\n id: PropTypes.string,\n isActive: PropTypes.bool,\n onClick: PropTypes.func,\n tooltipText: PropTypes.string\n}\n\nexport default RoundedIcon\n"],"names":["RoundedIcon","children","className","disabled","id","isActive","onClick","tooltipText","ref","wrapperClassNames","classNames","IconClassNames","jsx","Tooltip","TextTooltipTemplate","React","forwardRef","PropTypes","RoundedIcon$1"],"mappings":";;;;;;;AAyBA,IAAIA,IAAc,CAChB;AAAA,EACE,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,UAAAC,IAAW;AAAA,EACX,IAAAC,IAAK;AAAA,EACL,UAAAC,IAAW;AAAA,EACX,SAAAC,IAAU,MAAM;AAAA,EAAC;AAAA,EACjB,aAAAC,IAAc;AAChB,GACAC,MACG;AACG,QAAAC,IAAoBC,EAAW,iBAAiBR,CAAS,GACzDS,IAAiBD;AAAAA,IACrB;AAAA,IACAL,KAAY;AAAA,IACZF,KAAY;AAAA,EACd;AAGE,SAAA,gBAAAS,EAAC,OAAI,EAAA,WAAWH,GAAmB,KAAAD,GAAU,eAAaJ,GACxD,UAAC,gBAAAQ,EAAAC,GAAA,EAAQ,QAAQ,CAACN,GAAa,IAAAH,GAAQ,UAAU,gBAAAQ,EAACE,GAAoB,EAAA,MAAMP,EAAa,CAAA,GACvF,UAAC,gBAAAK,EAAA,UAAA,EAAO,SAAAN,GAAkB,UAAAH,GAAoB,WAAWQ,GACtD,UAAAV,EACH,CAAA,EACF,CAAA,GACF;AAEJ;AAEAD,IAAce,EAAM,KAAKC,EAAWhB,CAAW,CAAC;AAEhDA,EAAY,cAAc;AAE1BA,EAAY,YAAY;AAAA,EACtB,UAAUiB,EAAU,KAAK;AAAA,EACzB,WAAWA,EAAU;AAAA,EACrB,UAAUA,EAAU;AAAA,EACpB,IAAIA,EAAU;AAAA,EACd,UAAUA,EAAU;AAAA,EACpB,SAASA,EAAU;AAAA,EACnB,aAAaA,EAAU;AACzB;AAEA,MAAAC,IAAelB;"}
1
+ {"version":3,"file":"RoundedIcon.mjs","sources":["../../../src/lib/components/RoundedIcon/RoundedIcon.jsx"],"sourcesContent":["/*\nCopyright 2022 Iguazio Systems Ltd.\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, { forwardRef } from 'react'\nimport PropTypes from 'prop-types'\nimport classNames from 'classnames'\n\nimport Tooltip from '../Tooltip/Tooltip'\nimport TextTooltipTemplate from '../TooltipTemplate/TextTooltipTemplate'\n\nimport './roundedIcon.scss'\n\nlet RoundedIcon = (\n {\n children,\n className = '',\n disabled = false,\n id = '',\n isActive = false,\n onClick = () => {},\n tooltipText = ''\n },\n ref\n) => {\n const wrapperClassNames = classNames('round-icon-cp', className)\n const IconClassNames = classNames(\n 'round-icon-cp__circle',\n isActive && 'round-icon-cp__circle-active',\n disabled && 'round-icon-cp__circle-disabled'\n )\n\n return (\n <div className={wrapperClassNames} ref={ref} data-testid={id}>\n <Tooltip hidden={!tooltipText} id={id} template={<TextTooltipTemplate text={tooltipText} />}>\n <button onClick={onClick} disabled={disabled} className={IconClassNames}>\n {children}\n </button>\n </Tooltip>\n </div>\n )\n}\n\nRoundedIcon = React.memo(forwardRef(RoundedIcon))\n\nRoundedIcon.displayName = 'RoundedIcon'\n\nRoundedIcon.propTypes = {\n children: PropTypes.node.isRequired,\n className: PropTypes.string,\n disabled: PropTypes.bool,\n id: PropTypes.string,\n isActive: PropTypes.bool,\n onClick: PropTypes.func,\n tooltipText: PropTypes.string\n}\n\nexport default RoundedIcon\n"],"names":["RoundedIcon","children","className","disabled","id","isActive","onClick","tooltipText","ref","wrapperClassNames","classNames","IconClassNames","jsx","Tooltip","TextTooltipTemplate","React","forwardRef","PropTypes","RoundedIcon$1"],"mappings":";;;;;;;AAyBA,IAAIA,IAAc,CAChB;AAAA,EACE,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,UAAAC,IAAW;AAAA,EACX,IAAAC,IAAK;AAAA,EACL,UAAAC,IAAW;AAAA,EACX,SAAAC,IAAU,MAAM;AAAA,EAAC;AAAA,EACjB,aAAAC,IAAc;AAChB,GACAC,MACG;AACH,QAAMC,IAAoBC,EAAW,iBAAiBR,CAAS,GACzDS,IAAiBD;AAAAA,IACrB;AAAA,IACAL,KAAY;AAAA,IACZF,KAAY;AAAA,EAAA;AAGd,SACE,gBAAAS,EAAC,OAAA,EAAI,WAAWH,GAAmB,KAAAD,GAAU,eAAaJ,GACxD,UAAA,gBAAAQ,EAACC,GAAA,EAAQ,QAAQ,CAACN,GAAa,IAAAH,GAAQ,UAAU,gBAAAQ,EAACE,GAAA,EAAoB,MAAMP,EAAA,CAAa,GACvF,UAAA,gBAAAK,EAAC,UAAA,EAAO,SAAAN,GAAkB,UAAAH,GAAoB,WAAWQ,GACtD,UAAAV,EAAA,CACH,EAAA,CACF,GACF;AAEJ;AAEAD,IAAce,EAAM,KAAKC,EAAWhB,CAAW,CAAC;AAEhDA,EAAY,cAAc;AAE1BA,EAAY,YAAY;AAAA,EACtB,UAAUiB,EAAU,KAAK;AAAA,EACzB,WAAWA,EAAU;AAAA,EACrB,UAAUA,EAAU;AAAA,EACpB,IAAIA,EAAU;AAAA,EACd,UAAUA,EAAU;AAAA,EACpB,SAASA,EAAU;AAAA,EACnB,aAAaA,EAAU;AACzB;AAEA,MAAAC,IAAelB;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TableCell.mjs","sources":["../../../src/lib/components/TableCell/TableCell.jsx"],"sourcesContent":["/*\nCopyright 2019 Iguazio Systems Ltd.\n\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\n\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, { cloneElement } from 'react'\nimport PropTypes from 'prop-types'\nimport classnames from 'classnames'\n\nimport Tooltip from '../Tooltip/Tooltip'\nimport ReadOnlyChips from '../ReadOnlyChips/ReadOnlyChips'\nimport TableLinkCell from '../../elements/TableLinkCell/TableLinkCell'\nimport TableTypeCell from '../../elements/TableTypeCell/TableTypeCell'\nimport TextTooltipTemplate from '../TooltipTemplate/TextTooltipTemplate'\n\nimport { getChipOptions } from '../../utils/chips.util'\nimport { truncateUid } from '../../utils/string.util'\n\nimport Arrow from '../../images/arrow.svg?react'\n\nconst TableCell = ({\n cellData,\n className = '',\n firstCell = false,\n item,\n link = '',\n onClick = null,\n selectItem = () => {},\n selectedItem = {},\n showExpandButton = false,\n toggleRow = null\n}) => {\n const { value: stateValue, label: stateLabel, className: stateClassName } = item.state ?? {}\n const cellClassNames = classnames(\n 'table-body__cell',\n cellData.className,\n className,\n cellData.bodyCellClassName,\n onClick && 'link'\n )\n\n if (cellData.template) {\n return cloneElement(cellData.template, {\n className\n })\n } else if (link && cellData.type !== 'hidden') {\n return (\n <TableLinkCell\n className={className}\n cellData={cellData}\n item={item}\n link={link}\n selectItem={selectItem}\n selectedItem={selectedItem}\n showExpandButton={showExpandButton}\n toggleRow={toggleRow}\n />\n )\n } else if (firstCell && !link) {\n return (\n <td\n onClick={() => cellData.value && onClick && onClick(cellData.value)}\n className={cellClassNames}\n >\n <div className=\"data-ellipsis\">\n {cellData && (\n <Tooltip\n template={<TextTooltipTemplate text={cellData.tooltip || cellData.value || ''} />}\n >\n {cellData.value}\n </Tooltip>\n )}\n </div>\n {item.state && stateValue && stateLabel && (\n <Tooltip className=\"status\" template={<TextTooltipTemplate text={stateLabel} />}>\n <i className={stateClassName} />\n </Tooltip>\n )}\n {!item.state && item.status && (\n <Tooltip className=\"status\" template={<TextTooltipTemplate text={item.status} />}>\n <i className={`${item.status[0].toLowerCase()}${item.status.slice(1)}`} />\n </Tooltip>\n )}\n {showExpandButton && (\n <Arrow onClick={e => toggleRow && toggleRow(e, item)} className=\"expand-arrow\" />\n )}\n </td>\n )\n } else if (cellData.type === 'type') {\n return <TableTypeCell className={className} cellData={cellData} />\n } else if (cellData.type === 'icons') {\n return (\n <td data-testid={cellData.headerId} className={cellClassNames}>\n {cellData.value.map((valueItem, index) => (\n <Tooltip\n key={valueItem.tooltip + index}\n template={<TextTooltipTemplate text={valueItem.tooltip} />}\n >\n {valueItem.icon}\n </Tooltip>\n ))}\n </td>\n )\n } else if (Array.isArray(cellData.value)) {\n return (\n <td data-testid={cellData.headerId} className={cellClassNames}>\n <ReadOnlyChips\n chipOptions={getChipOptions(cellData.type)}\n labels={cellData.value}\n shortChips\n />\n </td>\n )\n } else if (cellData.type === 'hash') {\n return (\n <td data-testid={cellData.headerId} className={cellClassNames}>\n <Tooltip template={<TextTooltipTemplate text={cellData.value} />}>\n <span>{truncateUid(cellData.value)}</span>\n </Tooltip>\n </td>\n )\n } else if (cellData.type === 'hidden') {\n return null\n } else if (cellData.type === 'component') {\n return (\n <td data-testid={cellData.headerId} className={cellClassNames}>\n {cellData.value}\n </td>\n )\n } else {\n return (\n <td\n data-testid={cellData?.headerId}\n className={cellClassNames}\n onClick={() => cellData.value && onClick && onClick(cellData.value)}\n >\n <Tooltip\n className=\"text_small\"\n template={<TextTooltipTemplate text={cellData.tooltip || cellData.value || ''} />}\n >\n {cellData.value}\n </Tooltip>\n </td>\n )\n }\n}\n\nTableCell.propTypes = {\n cellData: PropTypes.object.isRequired,\n className: PropTypes.string,\n firstCell: PropTypes.bool,\n item: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]),\n link: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),\n onClick: PropTypes.func,\n selectItem: PropTypes.func,\n selectedItem: PropTypes.object,\n showExpandButton: PropTypes.bool,\n toggleRow: PropTypes.func\n}\n\nexport default TableCell\n"],"names":["TableCell","cellData","className","firstCell","item","link","onClick","selectItem","selectedItem","showExpandButton","toggleRow","stateValue","stateLabel","stateClassName","cellClassNames","classnames","cloneElement","jsx","TableLinkCell","jsxs","Tooltip","TextTooltipTemplate","Arrow","e","TableTypeCell","valueItem","index","ReadOnlyChips","getChipOptions","PropTypes"],"mappings":";;;;;;;;;;;;AAkCA,MAAMA,IAAY,CAAC;AAAA,EACjB,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,WAAAC,IAAY;AAAA,EACZ,MAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,SAAAC,IAAU;AAAA,EACV,YAAAC,IAAa,MAAM;AAAA,EAAC;AAAA,EACpB,cAAAC,IAAe,CAAC;AAAA,EAChB,kBAAAC,IAAmB;AAAA,EACnB,WAAAC,IAAY;AACd,MAAM;AACE,QAAA,EAAE,OAAOC,GAAY,OAAOC,GAAY,WAAWC,EAAe,IAAIT,EAAK,SAAS,CAAC,GACrFU,IAAiBC;AAAA,IACrB;AAAA,IACAd,EAAS;AAAA,IACTC;AAAA,IACAD,EAAS;AAAA,IACTK,KAAW;AAAA,EACb;AAEA,SAAIL,EAAS,WACJe,EAAaf,EAAS,UAAU;AAAA,IACrC,WAAAC;AAAA,EAAA,CACD,IACQG,KAAQJ,EAAS,SAAS,WAEjC,gBAAAgB;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,WAAAhB;AAAA,MACA,UAAAD;AAAA,MACA,MAAAG;AAAA,MACA,MAAAC;AAAA,MACA,YAAAE;AAAA,MACA,cAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,WAAAC;AAAA,IAAA;AAAA,EACF,IAEOP,KAAa,CAACE,IAErB,gBAAAc;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAS,MAAMlB,EAAS,SAASK,KAAWA,EAAQL,EAAS,KAAK;AAAA,MAClE,WAAWa;AAAA,MAEX,UAAA;AAAA,QAAC,gBAAAG,EAAA,OAAA,EAAI,WAAU,iBACZ,UACChB,KAAA,gBAAAgB;AAAA,UAACG;AAAA,UAAA;AAAA,YACC,4BAAWC,GAAoB,EAAA,MAAMpB,EAAS,WAAWA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AA,EAC5B,WAAWA,EAAU;AACvB;"}
1
+ {"version":3,"file":"TableCell.mjs","sources":["../../../src/lib/components/TableCell/TableCell.jsx"],"sourcesContent":["/*\nCopyright 2019 Iguazio Systems Ltd.\n\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\n\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, { cloneElement } from 'react'\nimport PropTypes from 'prop-types'\nimport classnames from 'classnames'\n\nimport Tooltip from '../Tooltip/Tooltip'\nimport ReadOnlyChips from '../ReadOnlyChips/ReadOnlyChips'\nimport TableLinkCell from '../../elements/TableLinkCell/TableLinkCell'\nimport TableTypeCell from '../../elements/TableTypeCell/TableTypeCell'\nimport TextTooltipTemplate from '../TooltipTemplate/TextTooltipTemplate'\n\nimport { getChipOptions } from '../../utils/chips.util'\nimport { truncateUid } from '../../utils/string.util'\n\nimport Arrow from '../../images/arrow.svg?react'\n\nconst TableCell = ({\n cellData,\n className = '',\n firstCell = false,\n item,\n link = '',\n onClick = null,\n selectItem = () => {},\n selectedItem = {},\n showExpandButton = false,\n toggleRow = null\n}) => {\n const { value: stateValue, label: stateLabel, className: stateClassName } = item.state ?? {}\n const cellClassNames = classnames(\n 'table-body__cell',\n cellData.className,\n className,\n cellData.bodyCellClassName,\n onClick && 'link'\n )\n\n if (cellData.template) {\n return cloneElement(cellData.template, {\n className\n })\n } else if (link && cellData.type !== 'hidden') {\n return (\n <TableLinkCell\n className={className}\n cellData={cellData}\n item={item}\n link={link}\n selectItem={selectItem}\n selectedItem={selectedItem}\n showExpandButton={showExpandButton}\n toggleRow={toggleRow}\n />\n )\n } else if (firstCell && !link) {\n return (\n <td\n onClick={() => cellData.value && onClick && onClick(cellData.value)}\n className={cellClassNames}\n >\n <div className=\"data-ellipsis\">\n {cellData && (\n <Tooltip\n template={<TextTooltipTemplate text={cellData.tooltip || cellData.value || ''} />}\n >\n {cellData.value}\n </Tooltip>\n )}\n </div>\n {item.state && stateValue && stateLabel && (\n <Tooltip className=\"status\" template={<TextTooltipTemplate text={stateLabel} />}>\n <i className={stateClassName} />\n </Tooltip>\n )}\n {!item.state && item.status && (\n <Tooltip className=\"status\" template={<TextTooltipTemplate text={item.status} />}>\n <i className={`${item.status[0].toLowerCase()}${item.status.slice(1)}`} />\n </Tooltip>\n )}\n {showExpandButton && (\n <Arrow onClick={e => toggleRow && toggleRow(e, item)} className=\"expand-arrow\" />\n )}\n </td>\n )\n } else if (cellData.type === 'type') {\n return <TableTypeCell className={className} cellData={cellData} />\n } else if (cellData.type === 'icons') {\n return (\n <td data-testid={cellData.headerId} className={cellClassNames}>\n {cellData.value.map((valueItem, index) => (\n <Tooltip\n key={valueItem.tooltip + index}\n template={<TextTooltipTemplate text={valueItem.tooltip} />}\n >\n {valueItem.icon}\n </Tooltip>\n ))}\n </td>\n )\n } else if (Array.isArray(cellData.value)) {\n return (\n <td data-testid={cellData.headerId} className={cellClassNames}>\n <ReadOnlyChips\n chipOptions={getChipOptions(cellData.type)}\n labels={cellData.value}\n shortChips\n />\n </td>\n )\n } else if (cellData.type === 'hash') {\n return (\n <td data-testid={cellData.headerId} className={cellClassNames}>\n <Tooltip template={<TextTooltipTemplate text={cellData.value} />}>\n <span>{truncateUid(cellData.value)}</span>\n </Tooltip>\n </td>\n )\n } else if (cellData.type === 'hidden') {\n return null\n } else if (cellData.type === 'component') {\n return (\n <td data-testid={cellData.headerId} className={cellClassNames}>\n {cellData.value}\n </td>\n )\n } else {\n return (\n <td\n data-testid={cellData?.headerId}\n className={cellClassNames}\n onClick={() => cellData.value && onClick && onClick(cellData.value)}\n >\n <Tooltip\n className=\"text_small\"\n template={<TextTooltipTemplate text={cellData.tooltip || cellData.value || ''} />}\n >\n {cellData.value}\n </Tooltip>\n </td>\n )\n }\n}\n\nTableCell.propTypes = {\n cellData: PropTypes.object.isRequired,\n className: PropTypes.string,\n firstCell: PropTypes.bool,\n item: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]),\n link: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),\n onClick: PropTypes.func,\n selectItem: PropTypes.func,\n selectedItem: PropTypes.object,\n showExpandButton: PropTypes.bool,\n toggleRow: PropTypes.func\n}\n\nexport default TableCell\n"],"names":["TableCell","cellData","className","firstCell","item","link","onClick","selectItem","selectedItem","showExpandButton","toggleRow","stateValue","stateLabel","stateClassName","cellClassNames","classnames","cloneElement","jsx","TableLinkCell","jsxs","Tooltip","TextTooltipTemplate","Arrow","e","TableTypeCell","valueItem","index","ReadOnlyChips","getChipOptions","PropTypes"],"mappings":";;;;;;;;;;;;AAkCA,MAAMA,IAAY,CAAC;AAAA,EACjB,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,WAAAC,IAAY;AAAA,EACZ,MAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,SAAAC,IAAU;AAAA,EACV,YAAAC,IAAa,MAAM;AAAA,EAAC;AAAA,EACpB,cAAAC,IAAe,CAAA;AAAA,EACf,kBAAAC,IAAmB;AAAA,EACnB,WAAAC,IAAY;AACd,MAAM;AACJ,QAAM,EAAE,OAAOC,GAAY,OAAOC,GAAY,WAAWC,EAAA,IAAmBT,EAAK,SAAS,CAAA,GACpFU,IAAiBC;AAAA,IACrB;AAAA,IACAd,EAAS;AAAA,IACTC;AAAA,IACAD,EAAS;AAAA,IACTK,KAAW;AAAA,EAAA;AAGb,SAAIL,EAAS,WACJe,EAAaf,EAAS,UAAU;AAAA,IACrC,WAAAC;AAAA,EAAA,CACD,IACQG,KAAQJ,EAAS,SAAS,WAEjC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U;AAAA,UACV,4BAAWC,GAAA,EAAoB,MAAMpB,EAAS,WAAWA,EAAS,SAAS,IAAI;AAAA,UAE9E,UAAAA,EAAS;AAAA,QAAA;AAAA,MAAA;AAAA,IACZ;AAAA,EAAA;AAIR;AAEAD,EAAU,YAAY;AAAA,EACpB,UAAU6B,EAAU,OAAO;AAAA,EAC3B,WAAWA,EAAU;AAAA,EACrB,WAAWA,EAAU;AAAA,EACrB,MAAMA,EAAU,UAAU,CAACA,EAAU,QAAQA,EAAU,IAAI,CAAC;AAAA,EAC5D,MAAMA,EAAU,UAAU,CAACA,EAAU,QAAQA,EAAU,IAAI,CAAC;AAAA,EAC5D,SAASA,EAAU;AAAA,EACnB,YAAYA,EAAU;AAAA,EACtB,cAAcA,EAAU;AAAA,EACxB,kBAAkBA,EAAU;AAAA,EAC5B,WAAWA,EAAU;AACvB;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TabsSlider.mjs","sources":["../../../src/lib/components/TabsSlider/TabsSlider.jsx"],"sourcesContent":["/*\nCopyright 2019 Iguazio Systems Ltd.\n\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\n\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, { useCallback, useEffect, useState, useRef } from 'react'\nimport { Link, useLocation, useParams } from 'react-router-dom'\nimport PropTypes from 'prop-types'\nimport classnames from 'classnames'\n\nimport Tip from '../Tip/Tip'\n\nimport { SLIDER_TABS } from '../../types'\nimport { generateUrlFromRouterPath } from '../../utils/common.util'\n\nimport Arrow from '../../images/arrow.svg?react'\n\nconst TabsSlider = ({\n fontSize = 'sm',\n initialTab = '',\n isDetailsPopUp = false,\n onClick = () => {},\n skipLink = false,\n tabsList\n}) => {\n const [selectedTab, setSelectedTab] = useState(initialTab)\n const [arrowsAreHidden, setArrowsAreHidden] = useState(true)\n const [scrolledWidth, setScrolledWidth] = useState(0)\n const [rightArrowDisabled, setRightArrowDisabled] = useState(false)\n const tabsWrapperRef = useRef()\n const tabsRef = useRef()\n const location = useLocation()\n const params = useParams()\n const menuOffsetHalfWidth = 2\n const tabOffset = 1.5\n\n const leftArrowClassNames = classnames(\n 'tabs-slider__arrow',\n 'tabs-slider__arrow_left',\n arrowsAreHidden && 'tabs-slider__arrow_hidden',\n scrolledWidth === 0 && 'tabs-slider__arrow_disabled'\n )\n const rightArrowClassNames = classnames(\n 'tabs-slider__arrow',\n 'tabs-slider__arrow_right',\n arrowsAreHidden && 'tabs-slider__arrow_hidden',\n rightArrowDisabled && 'tabs-slider__arrow_disabled'\n )\n\n const scrollTabs = toRight => {\n let scrollWidth\n\n if (toRight) {\n if (\n tabsRef.current?.scrollWidth <\n tabsWrapperRef.current?.offsetWidth * tabOffset + scrolledWidth\n ) {\n scrollWidth = tabsRef.current?.scrollWidth - tabsWrapperRef.current?.offsetWidth\n\n setRightArrowDisabled(true)\n } else {\n scrollWidth = scrolledWidth + tabsWrapperRef.current?.offsetWidth / menuOffsetHalfWidth\n }\n } else {\n scrollWidth = Math.max(\n 0,\n scrolledWidth - tabsWrapperRef.current?.offsetWidth / menuOffsetHalfWidth\n )\n\n setRightArrowDisabled(false)\n }\n\n setScrolledWidth(scrollWidth)\n }\n\n const handleHideArrows = useCallback(() => {\n const scrollIsHidden = tabsRef.current?.offsetWidth === tabsRef.current?.scrollWidth\n\n setArrowsAreHidden(scrollIsHidden)\n\n if (rightArrowDisabled) {\n setScrolledWidth(tabsRef.current?.scrollWidth - tabsWrapperRef.current?.offsetWidth)\n }\n\n if (scrollIsHidden) {\n setScrolledWidth(0)\n setRightArrowDisabled(false)\n }\n }, [rightArrowDisabled, tabsRef, tabsWrapperRef])\n\n const moveToSelectedTab = useCallback(() => {\n const selectedTabNode = document.querySelector(`[data-tab='${selectedTab}']`)\n const centeredTabPosition =\n selectedTabNode?.offsetLeft -\n tabsWrapperRef.current?.offsetWidth / menuOffsetHalfWidth +\n selectedTabNode?.offsetWidth / menuOffsetHalfWidth\n\n if (centeredTabPosition <= 0) {\n setScrolledWidth(0)\n setRightArrowDisabled(false)\n } else if (\n tabsRef.current?.scrollWidth <\n tabsWrapperRef.current?.offsetWidth / menuOffsetHalfWidth +\n selectedTabNode?.offsetLeft +\n selectedTabNode?.offsetWidth\n ) {\n setScrolledWidth(tabsRef.current?.scrollWidth - tabsWrapperRef.current?.offsetWidth)\n setRightArrowDisabled(true)\n } else {\n setScrolledWidth(centeredTabPosition)\n setRightArrowDisabled(false)\n }\n }, [selectedTab])\n\n const onSelectTab = newTab => {\n setSelectedTab(newTab)\n onClick && onClick(newTab)\n }\n\n useEffect(() => {\n window.addEventListener('resize', handleHideArrows)\n\n return () => window.removeEventListener('resize', handleHideArrows)\n }, [handleHideArrows])\n\n useEffect(() => {\n window.addEventListener('resize', moveToSelectedTab)\n\n return () => window.removeEventListener('resize', moveToSelectedTab)\n }, [moveToSelectedTab])\n\n useEffect(() => {\n handleHideArrows()\n }, [tabsList, handleHideArrows])\n\n useEffect(() => {\n moveToSelectedTab()\n }, [moveToSelectedTab])\n\n useEffect(() => {\n if (params.tab && params.tab !== selectedTab && !isDetailsPopUp) {\n setSelectedTab(tabsList.find(tab => tab.id === params.tab)?.id)\n }\n }, [isDetailsPopUp, params.tab, selectedTab, tabsList])\n\n const getTabContent = useCallback(tab => {\n return (\n <span\n className={(tab.icon && 'content-menu__tab-icon') || (tab.tip && 'content-menu__tab-tip')}\n >\n {tab.icon && <div>{tab.icon}</div>}\n {tab.label}\n {tab.tip && <Tip text={tab.tip} />}\n </span>\n )\n }, [])\n\n return (\n <div className=\"content-menu\">\n <div\n className={leftArrowClassNames}\n onClick={() => {\n scrollTabs(false)\n }}\n >\n <Arrow />\n </div>\n <div className=\"content-menu__tabs-wrapper\" ref={tabsWrapperRef}>\n <div\n ref={tabsRef}\n className=\"content-menu__tabs\"\n style={{\n transform: `translateX(${-scrolledWidth}px)`\n }}\n >\n {tabsList.map(tab => {\n const tabClassName = classnames(\n 'content-menu__tab',\n `content-menu__tab-${fontSize}`,\n selectedTab === tab.id && 'content-menu__tab_active'\n )\n\n return (\n !tab.hidden &&\n (!skipLink ? (\n <Link\n to={generateUrlFromRouterPath(\n `${window.location.pathname?.replace(/^$|([^/]+$)/, tab.id)}${location.search ?? ''}${tab.query ?? ''}`\n )}\n className={tabClassName}\n key={tab.id}\n data-tab={tab.id}\n onClick={() => onSelectTab(tab.id)}\n >\n {getTabContent(tab)}\n </Link>\n ) : (\n <div\n className={tabClassName}\n key={tab.id}\n data-tab={tab.id}\n onClick={() => onSelectTab(tab.id)}\n >\n {getTabContent(tab)}\n </div>\n ))\n )\n })}\n </div>\n </div>\n <div className={rightArrowClassNames} onClick={() => scrollTabs(true)}>\n <Arrow />\n </div>\n </div>\n )\n}\n\nTabsSlider.propTypes = {\n fontSize: PropTypes.oneOf(['sm', 'md', 'lg']),\n initialTab: PropTypes.string,\n isDetailsPopUp: PropTypes.bool,\n onClick: PropTypes.func,\n skipLink: PropTypes.bool,\n tabsList: SLIDER_TABS.isRequired\n}\n\nexport default TabsSlider\n"],"names":["TabsSlider","fontSize","initialTab","isDetailsPopUp","onClick","skipLink","tabsList","selectedTab","setSelectedTab","useState","arrowsAreHidden","setArrowsAreHidden","scrolledWidth","setScrolledWidth","rightArrowDisabled","setRightArrowDisabled","tabsWrapperRef","useRef","tabsRef","location","useLocation","params","useParams","menuOffsetHalfWidth","tabOffset","leftArrowClassNames","classnames","rightArrowClassNames","scrollTabs","toRight","scrollWidth","_a","_b","_c","_d","_e","_f","handleHideArrows","useCallback","scrollIsHidden","moveToSelectedTab","selectedTabNode","centeredTabPosition","onSelectTab","newTab","useEffect","tab","getTabContent","jsxs","jsx","Tip","Arrow","tabClassName","Link","generateUrlFromRouterPath","PropTypes","SLIDER_TABS"],"mappings":";;;;;;;;;AA+BA,MAAMA,IAAa,CAAC;AAAA,EAClB,UAAAC,IAAW;AAAA,EACX,YAAAC,IAAa;AAAA,EACb,gBAAAC,IAAiB;AAAA,EACjB,SAAAC,IAAU,MAAM;AAAA,EAAC;AAAA,EACjB,UAAAC,IAAW;AAAA,EACX,UAAAC;AACF,MAAM;AACJ,QAAM,CAACC,GAAaC,CAAc,IAAIC,EAASP,CAAU,GACnD,CAACQ,GAAiBC,CAAkB,IAAIF,EAAS,EAAI,GACrD,CAACG,GAAeC,CAAgB,IAAIJ,EAAS,CAAC,GAC9C,CAACK,GAAoBC,CAAqB,IAAIN,EAAS,EAAK,GAC5DO,IAAiBC,EAAO,GACxBC,IAAUD,EAAO,GACjBE,IAAWC,EAAY,GACvBC,IAASC,EAAU,GACnBC,IAAsB,GACtBC,IAAY,KAEZC,IAAsBC;AAAA,IAC1B;AAAA,IACA;AAAA,IACAhB,KAAmB;AAAA,IACnBE,MAAkB,KAAK;AAAA,EACzB,GACMe,IAAuBD;AAAA,IAC3B;AAAA,IACA;AAAA,IACAhB,KAAmB;AAAA,IACnBI,KAAsB;AAAA,EACxB,GAEMc,IAAa,CAAWC,MAAA;;AACxB,QAAAC;AAEJ,IAAID,MAEAE,IAAAb,EAAQ,YAAR,gBAAAa,EAAiB,iBACjBC,IAAAhB,EAAe,YAAf,gBAAAgB,EAAwB,eAAcR,IAAYZ,KAElDkB,MAAcG,IAAAf,EAAQ,YAAR,gBAAAe,EAAiB,iBAAcC,IAAAlB,EAAe,YAAf,gBAAAkB,EAAwB,cAErEnB,EAAsB,EAAI,KAEZe,IAAAlB,MAAgBuB,IAAAnB,EAAe,YAAf,gBAAAmB,EAAwB,eAAcZ,KAGtEO,IAAc,KAAK;AAAA,MACjB;AAAA,MACAlB,MAAgBwB,IAAApB,EAAe,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AM,CAAC,MAAM,MAAM,IAAI,CAAC;AAAA,EAC5C,YAAYA,EAAU;AAAA,EACtB,gBAAgBA,EAAU;AAAA,EAC1B,SAASA,EAAU;AAAA,EACnB,UAAUA,EAAU;AAAA,EACpB,UAAUC,EAAY;AACxB;"}
1
+ {"version":3,"file":"TabsSlider.mjs","sources":["../../../src/lib/components/TabsSlider/TabsSlider.jsx"],"sourcesContent":["/*\nCopyright 2019 Iguazio Systems Ltd.\n\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\n\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, { useCallback, useEffect, useState, useRef } from 'react'\nimport { Link, useLocation, useParams } from 'react-router-dom'\nimport PropTypes from 'prop-types'\nimport classnames from 'classnames'\n\nimport Tip from '../Tip/Tip'\n\nimport { SLIDER_TABS } from '../../types'\nimport { generateUrlFromRouterPath } from '../../utils/common.util'\n\nimport Arrow from '../../images/arrow.svg?react'\n\nconst TabsSlider = ({\n fontSize = 'sm',\n initialTab = '',\n isDetailsPopUp = false,\n onClick = () => {},\n skipLink = false,\n tabsList\n}) => {\n const [selectedTab, setSelectedTab] = useState(initialTab)\n const [arrowsAreHidden, setArrowsAreHidden] = useState(true)\n const [scrolledWidth, setScrolledWidth] = useState(0)\n const [rightArrowDisabled, setRightArrowDisabled] = useState(false)\n const tabsWrapperRef = useRef()\n const tabsRef = useRef()\n const location = useLocation()\n const params = useParams()\n const menuOffsetHalfWidth = 2\n const tabOffset = 1.5\n\n const leftArrowClassNames = classnames(\n 'tabs-slider__arrow',\n 'tabs-slider__arrow_left',\n arrowsAreHidden && 'tabs-slider__arrow_hidden',\n scrolledWidth === 0 && 'tabs-slider__arrow_disabled'\n )\n const rightArrowClassNames = classnames(\n 'tabs-slider__arrow',\n 'tabs-slider__arrow_right',\n arrowsAreHidden && 'tabs-slider__arrow_hidden',\n rightArrowDisabled && 'tabs-slider__arrow_disabled'\n )\n\n const scrollTabs = toRight => {\n let scrollWidth\n\n if (toRight) {\n if (\n tabsRef.current?.scrollWidth <\n tabsWrapperRef.current?.offsetWidth * tabOffset + scrolledWidth\n ) {\n scrollWidth = tabsRef.current?.scrollWidth - tabsWrapperRef.current?.offsetWidth\n\n setRightArrowDisabled(true)\n } else {\n scrollWidth = scrolledWidth + tabsWrapperRef.current?.offsetWidth / menuOffsetHalfWidth\n }\n } else {\n scrollWidth = Math.max(\n 0,\n scrolledWidth - tabsWrapperRef.current?.offsetWidth / menuOffsetHalfWidth\n )\n\n setRightArrowDisabled(false)\n }\n\n setScrolledWidth(scrollWidth)\n }\n\n const handleHideArrows = useCallback(() => {\n const scrollIsHidden = tabsRef.current?.offsetWidth === tabsRef.current?.scrollWidth\n\n setArrowsAreHidden(scrollIsHidden)\n\n if (rightArrowDisabled) {\n setScrolledWidth(tabsRef.current?.scrollWidth - tabsWrapperRef.current?.offsetWidth)\n }\n\n if (scrollIsHidden) {\n setScrolledWidth(0)\n setRightArrowDisabled(false)\n }\n }, [rightArrowDisabled, tabsRef, tabsWrapperRef])\n\n const moveToSelectedTab = useCallback(() => {\n const selectedTabNode = document.querySelector(`[data-tab='${selectedTab}']`)\n const centeredTabPosition =\n selectedTabNode?.offsetLeft -\n tabsWrapperRef.current?.offsetWidth / menuOffsetHalfWidth +\n selectedTabNode?.offsetWidth / menuOffsetHalfWidth\n\n if (centeredTabPosition <= 0) {\n setScrolledWidth(0)\n setRightArrowDisabled(false)\n } else if (\n tabsRef.current?.scrollWidth <\n tabsWrapperRef.current?.offsetWidth / menuOffsetHalfWidth +\n selectedTabNode?.offsetLeft +\n selectedTabNode?.offsetWidth\n ) {\n setScrolledWidth(tabsRef.current?.scrollWidth - tabsWrapperRef.current?.offsetWidth)\n setRightArrowDisabled(true)\n } else {\n setScrolledWidth(centeredTabPosition)\n setRightArrowDisabled(false)\n }\n }, [selectedTab])\n\n const onSelectTab = newTab => {\n setSelectedTab(newTab)\n onClick && onClick(newTab)\n }\n\n useEffect(() => {\n window.addEventListener('resize', handleHideArrows)\n\n return () => window.removeEventListener('resize', handleHideArrows)\n }, [handleHideArrows])\n\n useEffect(() => {\n window.addEventListener('resize', moveToSelectedTab)\n\n return () => window.removeEventListener('resize', moveToSelectedTab)\n }, [moveToSelectedTab])\n\n useEffect(() => {\n handleHideArrows()\n }, [tabsList, handleHideArrows])\n\n useEffect(() => {\n moveToSelectedTab()\n }, [moveToSelectedTab])\n\n useEffect(() => {\n if (params.tab && params.tab !== selectedTab && !isDetailsPopUp) {\n setSelectedTab(tabsList.find(tab => tab.id === params.tab)?.id)\n }\n }, [isDetailsPopUp, params.tab, selectedTab, tabsList])\n\n const getTabContent = useCallback(tab => {\n return (\n <span\n className={(tab.icon && 'content-menu__tab-icon') || (tab.tip && 'content-menu__tab-tip')}\n >\n {tab.icon && <div>{tab.icon}</div>}\n {tab.label}\n {tab.tip && <Tip text={tab.tip} />}\n </span>\n )\n }, [])\n\n return (\n <div className=\"content-menu\">\n <div\n className={leftArrowClassNames}\n onClick={() => {\n scrollTabs(false)\n }}\n >\n <Arrow />\n </div>\n <div className=\"content-menu__tabs-wrapper\" ref={tabsWrapperRef}>\n <div\n ref={tabsRef}\n className=\"content-menu__tabs\"\n style={{\n transform: `translateX(${-scrolledWidth}px)`\n }}\n >\n {tabsList.map(tab => {\n const tabClassName = classnames(\n 'content-menu__tab',\n `content-menu__tab-${fontSize}`,\n selectedTab === tab.id && 'content-menu__tab_active'\n )\n\n return (\n !tab.hidden &&\n (!skipLink ? (\n <Link\n to={generateUrlFromRouterPath(\n `${window.location.pathname?.replace(/^$|([^/]+$)/, tab.id)}${location.search ?? ''}${tab.query ?? ''}`\n )}\n className={tabClassName}\n key={tab.id}\n data-tab={tab.id}\n onClick={() => onSelectTab(tab.id)}\n >\n {getTabContent(tab)}\n </Link>\n ) : (\n <div\n className={tabClassName}\n key={tab.id}\n data-tab={tab.id}\n onClick={() => onSelectTab(tab.id)}\n >\n {getTabContent(tab)}\n </div>\n ))\n )\n })}\n </div>\n </div>\n <div className={rightArrowClassNames} onClick={() => scrollTabs(true)}>\n <Arrow />\n </div>\n </div>\n )\n}\n\nTabsSlider.propTypes = {\n fontSize: PropTypes.oneOf(['sm', 'md', 'lg']),\n initialTab: PropTypes.string,\n isDetailsPopUp: PropTypes.bool,\n onClick: PropTypes.func,\n skipLink: PropTypes.bool,\n tabsList: SLIDER_TABS.isRequired\n}\n\nexport default TabsSlider\n"],"names":["TabsSlider","fontSize","initialTab","isDetailsPopUp","onClick","skipLink","tabsList","selectedTab","setSelectedTab","useState","arrowsAreHidden","setArrowsAreHidden","scrolledWidth","setScrolledWidth","rightArrowDisabled","setRightArrowDisabled","tabsWrapperRef","useRef","tabsRef","location","useLocation","params","useParams","menuOffsetHalfWidth","tabOffset","leftArrowClassNames","classnames","rightArrowClassNames","scrollTabs","toRight","scrollWidth","_a","_b","_c","_d","_e","_f","handleHideArrows","useCallback","scrollIsHidden","moveToSelectedTab","selectedTabNode","centeredTabPosition","onSelectTab","newTab","useEffect","tab","getTabContent","jsxs","jsx","Tip","Arrow","tabClassName","Link","generateUrlFromRouterPath","PropTypes","SLIDER_TABS"],"mappings":";;;;;;;;;AA+BA,MAAMA,IAAa,CAAC;AAAA,EAClB,UAAAC,IAAW;AAAA,EACX,YAAAC,IAAa;AAAA,EACb,gBAAAC,IAAiB;AAAA,EACjB,SAAAC,IAAU,MAAM;AAAA,EAAC;AAAA,EACjB,UAAAC,IAAW;AAAA,EACX,UAAAC;AACF,MAAM;AACJ,QAAM,CAACC,GAAaC,CAAc,IAAIC,EAASP,CAAU,GACnD,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AAM;AAAA,UAAA;AAG5B,iBACE,CAACA,EAAI,WACHzC,IAaA,gBAAA4C;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAWG;AAAA,cAEX,YAAUN,EAAI;AAAA,cACd,SAAS,MAAMH,EAAYG,EAAI,EAAE;AAAA,cAEhC,YAAcA,CAAG;AAAA,YAAA;AAAA,YAJbA,EAAI;AAAA,UAAA,IAdX,gBAAAG;AAAA,YAACI;AAAA,YAAA;AAAA,cACC,IAAIC;AAAA,gBACF,IAAGvB,IAAA,OAAO,SAAS,aAAhB,gBAAAA,EAA0B,QAAQ,eAAee,EAAI,GAAG,GAAG3B,EAAS,UAAU,EAAE,GAAG2B,EAAI,SAAS,EAAE;AAAA,cAAA;AAAA,cAEvG,WAAWM;AAAA,cAEX,YAAUN,EAAI;AAAA,cACd,SAAS,MAAMH,EAAYG,EAAI,EAAE;AAAA,cAEhC,YAAcA,CAAG;AAAA,YAAA;AAAA,YAJbA,EAAI;AAAA,UAAA;AAAA,QAiBjB,CAAC;AAAA,MAAA;AAAA,IAAA,GAEL;AAAA,IACA,gBAAAG,EAAC,OAAA,EAAI,WAAWtB,GAAsB,SAAS,MAAMC,EAAW,EAAI,GAClE,UAAA,gBAAAqB,EAACE,GAAA,CAAA,CAAM,EAAA,CACT;AAAA,EAAA,GACF;AAEJ;AAEAnD,EAAW,YAAY;AAAA,EACrB,UAAUuD,EAAU,MAAM,CAAC,MAAM,MAAM,IAAI,CAAC;AAAA,EAC5C,YAAYA,EAAU;AAAA,EACtB,gBAAgBA,EAAU;AAAA,EAC1B,SAASA,EAAU;AAAA,EACnB,UAAUA,EAAU;AAAA,EACpB,UAAUC,EAAY;AACxB;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Tip.mjs","sources":["../../../src/lib/components/Tip/Tip.jsx"],"sourcesContent":["/*\nCopyright 2022 Iguazio Systems Ltd.\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, { useState, useRef, useEffect, useCallback, useMemo } from 'react'\nimport PropTypes from 'prop-types'\nimport { CSSTransition } from 'react-transition-group'\nimport classnames from 'classnames'\nimport { createPortal } from 'react-dom'\n\nimport { getScssVariableValue } from '../../utils/common.util'\n\nimport QuestionMarkIcon from '../../images/question-mark.svg?react'\nimport ExclamationMarkIcon from '../../images/exclamation-mark.svg?react'\n\nimport './tip.scss'\n\nconst Tip = ({ className = '', text, withExclamationMark = false }) => {\n const [isShow, setIsShow] = useState(false)\n const [tipClassName, setTipClassName] = useState('tip_top tip_left')\n\n const arrowLength = useMemo(() => parseInt(getScssVariableValue('--tipArrowLength')), [])\n const arrowOffset = useMemo(() => parseInt(getScssVariableValue('--tipArrowOffset')), [])\n const iconLength = useMemo(() => parseInt(getScssVariableValue('--tipIconLength')), [])\n\n const minTextLength = 40\n\n const iconRef = useRef()\n const tipBodyRef = useRef()\n\n const tipContainerClassNames = classnames(className, 'tip-container')\n const tipClassNames = classnames(\n 'tip',\n tipClassName,\n text.length <= minTextLength ? 'tip_small' : 'tip_big'\n )\n\n const handleMouseEnter = useCallback(() => {\n setIsShow(true)\n }, [])\n\n useEffect(() => {\n if (isShow) {\n const iconRect = iconRef.current.getBoundingClientRect()\n const tipRect = tipBodyRef.current.getBoundingClientRect()\n const widthPosition = iconRect.left > tipRect.width - arrowOffset ? 'tip_left' : 'tip_right'\n const heightPosition = iconRect.top > tipRect.height + arrowLength ? 'tip_top' : 'tip_bottom'\n\n setTipClassName(`${heightPosition} ${widthPosition}`)\n\n if (widthPosition === 'tip_left') {\n const computedArrowOffset = arrowOffset + (iconLength + arrowLength) / 2\n tipBodyRef.current.style.left = `${iconRect.left - (tipRect.width - computedArrowOffset)}px`\n } else {\n const computedArrowOffset = arrowOffset - (iconLength - arrowLength) / 2\n tipBodyRef.current.style.left = `${iconRect.left - computedArrowOffset}px`\n }\n\n tipBodyRef.current.style.top =\n heightPosition === 'tip_top'\n ? `${iconRect.top - tipRect.height - arrowLength}px`\n : `${iconRect.bottom + arrowLength}px`\n }\n }, [arrowLength, arrowOffset, iconLength, isShow])\n\n const handleMouseLeave = () => {\n setIsShow(false)\n }\n\n useEffect(() => {\n const node = iconRef.current\n\n if (iconRef.current) {\n node.addEventListener('mouseenter', handleMouseEnter)\n node.addEventListener('mouseleave', handleMouseLeave)\n\n return () => {\n node.removeEventListener('mouseenter', handleMouseEnter)\n node.removeEventListener('mouseleave', handleMouseLeave)\n }\n }\n }, [handleMouseEnter, isShow])\n\n return (\n <div data-testid=\"tip\" className={tipContainerClassNames}>\n <div ref={iconRef} className=\"tip-wrapper\">\n {withExclamationMark ? (\n <ExclamationMarkIcon data-testid=\"tip-icon\" />\n ) : (\n <QuestionMarkIcon data-testid=\"tip-icon\" />\n )}\n </div>\n {createPortal(\n <CSSTransition\n nodeRef={tipBodyRef}\n in={isShow}\n timeout={200}\n classNames=\"fade\"\n unmountOnExit\n >\n <div ref={tipBodyRef} data-testid=\"tip-text\" className={tipClassNames}>\n {text}\n </div>\n </CSSTransition>,\n document.getElementById('overlay_container')\n )}\n </div>\n )\n}\n\nTip.propTypes = {\n className: PropTypes.string,\n text: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,\n withExclamationMark: PropTypes.bool\n}\n\nexport default Tip\n"],"names":["Tip","className","text","withExclamationMark","isShow","setIsShow","useState","tipClassName","setTipClassName","arrowLength","useMemo","getScssVariableValue","arrowOffset","iconLength","minTextLength","iconRef","useRef","tipBodyRef","tipContainerClassNames","classnames","tipClassNames","handleMouseEnter","useCallback","useEffect","iconRect","tipRect","widthPosition","heightPosition","computedArrowOffset","handleMouseLeave","node","jsxs","jsx","ExclamationMarkIcon","QuestionMarkIcon","createPortal","CSSTransition","PropTypes"],"mappings":";;;;;;;;;;AA6BM,MAAAA,IAAM,CAAC,EAAE,WAAAC,IAAY,IAAI,MAAAC,GAAM,qBAAAC,IAAsB,SAAY;AACrE,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GACpC,CAACC,GAAcC,CAAe,IAAIF,EAAS,kBAAkB,GAE7DG,IAAcC,EAAQ,MAAM,SAASC,EAAqB,kBAAkB,CAAC,GAAG,EAAE,GAClFC,IAAcF,EAAQ,MAAM,SAASC,EAAqB,kBAAkB,CAAC,GAAG,EAAE,GAClFE,IAAaH,EAAQ,MAAM,SAASC,EAAqB,iBAAiB,CAAC,GAAG,EAAE,GAEhFG,IAAgB,IAEhBC,IAAUC,EAAO,GACjBC,IAAaD,EAAO,GAEpBE,IAAyBC,EAAWlB,GAAW,eAAe,GAC9DmB,IAAgBD;AAAA,IACpB;AAAA,IACAZ;AAAA,IACAL,EAAK,UAAUY,IAAgB,cAAc;AAAA,EAC/C,GAEMO,IAAmBC,EAAY,MAAM;AACzC,IAAAjB,EAAU,EAAI;AAAA,EAChB,GAAG,EAAE;AAEL,EAAAkB,EAAU,MAAM;AACd,QAAInB,GAAQ;AACJ,YAAAoB,IAAWT,EAAQ,QAAQ,sBAAsB,GACjDU,IAAUR,EAAW,QAAQ,sBAAsB,GACnDS,IAAgBF,EAAS,OAAOC,EAAQ,QAAQb,IAAc,aAAa,aAC3Ee,IAAiBH,EAAS,MAAMC,EAAQ,SAAShB,IAAc,YAAY;AAIjF,UAFAD,EAAgB,GAAGmB,CAAc,IAAID,CAAa,EAAE,GAEhDA,MAAkB,YAAY;AAC1B,cAAAE,IAAsBhB,KAAeC,IAAaJ,KAAe;AAC5D,QAAAQ,EAAA,QAAQ,MAAM,OAAO,GAAGO,EAAS,QAAQC,EAAQ,QAAQG,EA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AS,eAAe,mBAAmB;AAAA,IAAA;AAAA,EAC7C,GACF;AAEJ;AAEAF,EAAI,YAAY;AAAA,EACd,WAAWqC,EAAU;AAAA,EACrB,MAAMA,EAAU,UAAU,CAACA,EAAU,QAAQA,EAAU,OAAO,CAAC,EAAE;AAAA,EACjE,qBAAqBA,EAAU;AACjC;"}
1
+ {"version":3,"file":"Tip.mjs","sources":["../../../src/lib/components/Tip/Tip.jsx"],"sourcesContent":["/*\nCopyright 2022 Iguazio Systems Ltd.\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, { useState, useRef, useEffect, useCallback, useMemo } from 'react'\nimport PropTypes from 'prop-types'\nimport { CSSTransition } from 'react-transition-group'\nimport classnames from 'classnames'\nimport { createPortal } from 'react-dom'\n\nimport { getScssVariableValue } from '../../utils/common.util'\n\nimport QuestionMarkIcon from '../../images/question-mark.svg?react'\nimport ExclamationMarkIcon from '../../images/exclamation-mark.svg?react'\n\nimport './tip.scss'\n\nconst Tip = ({ className = '', text, withExclamationMark = false }) => {\n const [isShow, setIsShow] = useState(false)\n const [tipClassName, setTipClassName] = useState('tip_top tip_left')\n\n const arrowLength = useMemo(() => parseInt(getScssVariableValue('--tipArrowLength')), [])\n const arrowOffset = useMemo(() => parseInt(getScssVariableValue('--tipArrowOffset')), [])\n const iconLength = useMemo(() => parseInt(getScssVariableValue('--tipIconLength')), [])\n\n const minTextLength = 40\n\n const iconRef = useRef()\n const tipBodyRef = useRef()\n\n const tipContainerClassNames = classnames(className, 'tip-container')\n const tipClassNames = classnames(\n 'tip',\n tipClassName,\n text.length <= minTextLength ? 'tip_small' : 'tip_big'\n )\n\n const handleMouseEnter = useCallback(() => {\n setIsShow(true)\n }, [])\n\n useEffect(() => {\n if (isShow) {\n const iconRect = iconRef.current.getBoundingClientRect()\n const tipRect = tipBodyRef.current.getBoundingClientRect()\n const widthPosition = iconRect.left > tipRect.width - arrowOffset ? 'tip_left' : 'tip_right'\n const heightPosition = iconRect.top > tipRect.height + arrowLength ? 'tip_top' : 'tip_bottom'\n\n setTipClassName(`${heightPosition} ${widthPosition}`)\n\n if (widthPosition === 'tip_left') {\n const computedArrowOffset = arrowOffset + (iconLength + arrowLength) / 2\n tipBodyRef.current.style.left = `${iconRect.left - (tipRect.width - computedArrowOffset)}px`\n } else {\n const computedArrowOffset = arrowOffset - (iconLength - arrowLength) / 2\n tipBodyRef.current.style.left = `${iconRect.left - computedArrowOffset}px`\n }\n\n tipBodyRef.current.style.top =\n heightPosition === 'tip_top'\n ? `${iconRect.top - tipRect.height - arrowLength}px`\n : `${iconRect.bottom + arrowLength}px`\n }\n }, [arrowLength, arrowOffset, iconLength, isShow])\n\n const handleMouseLeave = () => {\n setIsShow(false)\n }\n\n useEffect(() => {\n const node = iconRef.current\n\n if (iconRef.current) {\n node.addEventListener('mouseenter', handleMouseEnter)\n node.addEventListener('mouseleave', handleMouseLeave)\n\n return () => {\n node.removeEventListener('mouseenter', handleMouseEnter)\n node.removeEventListener('mouseleave', handleMouseLeave)\n }\n }\n }, [handleMouseEnter, isShow])\n\n return (\n <div data-testid=\"tip\" className={tipContainerClassNames}>\n <div ref={iconRef} className=\"tip-wrapper\">\n {withExclamationMark ? (\n <ExclamationMarkIcon data-testid=\"tip-icon\" />\n ) : (\n <QuestionMarkIcon data-testid=\"tip-icon\" />\n )}\n </div>\n {createPortal(\n <CSSTransition\n nodeRef={tipBodyRef}\n in={isShow}\n timeout={200}\n classNames=\"fade\"\n unmountOnExit\n >\n <div ref={tipBodyRef} data-testid=\"tip-text\" className={tipClassNames}>\n {text}\n </div>\n </CSSTransition>,\n document.getElementById('overlay_container')\n )}\n </div>\n )\n}\n\nTip.propTypes = {\n className: PropTypes.string,\n text: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,\n withExclamationMark: PropTypes.bool\n}\n\nexport default Tip\n"],"names":["Tip","className","text","withExclamationMark","isShow","setIsShow","useState","tipClassName","setTipClassName","arrowLength","useMemo","getScssVariableValue","arrowOffset","iconLength","minTextLength","iconRef","useRef","tipBodyRef","tipContainerClassNames","classnames","tipClassNames","handleMouseEnter","useCallback","useEffect","iconRect","tipRect","widthPosition","heightPosition","computedArrowOffset","handleMouseLeave","node","jsxs","jsx","ExclamationMarkIcon","QuestionMarkIcon","createPortal","CSSTransition","PropTypes"],"mappings":";;;;;;;;;;AA6BA,MAAMA,IAAM,CAAC,EAAE,WAAAC,IAAY,IAAI,MAAAC,GAAM,qBAAAC,IAAsB,SAAY;AACrE,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GACpC,CAACC,GAAcC,CAAe,IAAIF,EAAS,kBAAkB,GAE7DG,IAAcC,EAAQ,MAAM,SAASC,EAAqB,kBAAkB,CAAC,GAAG,EAAE,GAClFC,IAAcF,EAAQ,MAAM,SAASC,EAAqB,kBAAkB,CAAC,GAAG,EAAE,GAClFE,IAAaH,EAAQ,MAAM,SAASC,EAAqB,iBAAiB,CAAC,GAAG,EAAE,GAEhFG,IAAgB,IAEhBC,IAAUC,EAAA,GACVC,IAAaD,EAAA,GAEbE,IAAyBC,EAAWlB,GAAW,eAAe,GAC9DmB,IAAgBD;AAAA,IACpB;AAAA,IACAZ;AAAA,IACAL,EAAK,UAAUY,IAAgB,cAAc;AAAA,EAAA,GAGzCO,IAAmBC,EAAY,MAAM;AACzC,IAAAjB,EAAU,EAAI;AAAA,EAChB,GAAG,CAAA,CAAE;AAEL,EAAAkB,EAAU,MAAM;AACd,QAAInB,GAAQ;AACV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,IACC,gBAAA6B,EAACC,GAAA,EAAoB,eAAY,YAAW,IAE5C,gBAAAD,EAACE,GAAA,EAAiB,eAAY,YAAW,GAE7C;AAAA,IACCC;AAAA,MACC,gBAAAH;AAAA,QAACI;AAAA,QAAA;AAAA,UACC,SAASnB;AAAA,UACT,IAAIb;AAAA,UACJ,SAAS;AAAA,UACT,YAAW;AAAA,UACX,eAAa;AAAA,UAEb,UAAA,gBAAA4B,EAAC,SAAI,KAAKf,GAAY,eAAY,YAAW,WAAWG,GACrD,UAAAlB,EAAA,CACH;AAAA,QAAA;AAAA,MAAA;AAAA,MAEF,SAAS,eAAe,mBAAmB;AAAA,IAAA;AAAA,EAC7C,GACF;AAEJ;AAEAF,EAAI,YAAY;AAAA,EACd,WAAWqC,EAAU;AAAA,EACrB,MAAMA,EAAU,UAAU,CAACA,EAAU,QAAQA,EAAU,OAAO,CAAC,EAAE;AAAA,EACjE,qBAAqBA,EAAU;AACjC;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.mjs","sources":["../../../src/lib/components/Tooltip/Tooltip.jsx"],"sourcesContent":["/*\nCopyright 2022 Iguazio Systems Ltd.\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, { useRef, useState, useEffect, useCallback } from 'react'\nimport { createPortal } from 'react-dom'\nimport PropTypes from 'prop-types'\nimport { CSSTransition } from 'react-transition-group'\nimport classnames from 'classnames'\nimport { debounce } from 'lodash'\n\nimport { isEveryObjectValueEmpty } from '../../utils/common.util'\n\nimport './tooltip.scss'\n\nlet Tooltip = ({\n children = '',\n className = '',\n tooltipBodyClassName = '',\n hidden = false,\n id = '',\n renderChildAsHtml = false,\n template,\n textShow = false\n}) => {\n const [show, setShow] = useState(false)\n const [style, setStyle] = useState({})\n\n const tooltipWrapperClassNames = classnames('data-ellipsis', 'tooltip-wrapper', className)\n const tooltipBodyClassNames = classnames('tooltip', tooltipBodyClassName)\n const duration = 200\n const parentRef = useRef()\n const tooltipRef = useRef()\n const offset = 10\n\n const handleScroll = () => {\n setShow(false)\n }\n\n const handleMouseLeave = useCallback(\n event => {\n if (\n !tooltipRef.current ||\n hidden ||\n (tooltipRef.current &&\n !tooltipRef.current.contains(event.relatedTarget) &&\n parentRef.current &&\n !parentRef.current.contains(event.relatedTarget))\n ) {\n setShow(false)\n }\n },\n [hidden]\n )\n\n const handleMouseEnter = useCallback(\n event => {\n if (!show) {\n const [child] = parentRef.current.childNodes\n let show =\n !hidden &&\n (textShow\n ? true\n : !child\n ? false\n : (child.nodeType !== Node.TEXT_NODE &&\n child.childNodes?.[0]?.nodeType !== Node.TEXT_NODE) ||\n /*\n If the child node is a text node and the text of the child node inside the container is greater than the width of the container, then show tooltip.\n */\n ((child.nodeType === Node.TEXT_NODE ||\n child.childNodes?.[0]?.nodeType === Node.TEXT_NODE) &&\n parentRef.current.scrollWidth > parentRef.current.offsetWidth))\n\n setShow(show)\n\n setTimeout(() => {\n if (show) {\n let { height, top, bottom } = parentRef?.current?.getBoundingClientRect() ?? {}\n const { height: tooltipHeight, width: tooltipWidth } =\n tooltipRef.current?.getBoundingClientRect() ?? {\n height: 0,\n width: 0\n }\n const leftPosition = event.x - (event.x + tooltipWidth - window.innerWidth + offset)\n const left =\n event.x + tooltipWidth + offset > window.innerWidth\n ? leftPosition > offset\n ? leftPosition\n : offset\n : event.x + offset\n\n if (top + height + offset + tooltipHeight >= window.innerHeight) {\n const topPosition = bottom - height - offset - tooltipHeight\n\n setStyle({\n top: topPosition > 0 ? topPosition : offset,\n left\n })\n } else {\n setStyle({\n top: top + height + offset,\n left\n })\n }\n }\n }, 0)\n }\n },\n [hidden, textShow, show]\n )\n\n const clearStyles = debounce(() => {\n if (!isEveryObjectValueEmpty(style)) {\n setStyle({})\n }\n }, 100)\n\n useEffect(() => {\n const parentNode = parentRef.current\n\n if (parentNode) {\n parentNode.addEventListener('mouseenter', handleMouseEnter)\n parentNode.addEventListener('mouseleave', handleMouseLeave)\n\n return () => {\n parentNode.removeEventListener('mouseenter', handleMouseEnter)\n parentNode.removeEventListener('mouseleave', handleMouseLeave)\n }\n }\n }, [parentRef, handleMouseEnter, handleMouseLeave])\n\n useEffect(() => {\n const tooltipNode = tooltipRef.current\n\n if (tooltipNode && show) {\n tooltipNode.addEventListener('mouseleave', handleMouseLeave)\n\n return () => {\n tooltipNode.removeEventListener('mouseleave', handleMouseLeave)\n }\n }\n }, [tooltipRef, handleMouseEnter, handleMouseLeave, show])\n\n useEffect(() => {\n if (show) {\n window.addEventListener('scroll', handleScroll, true)\n }\n\n return () => window.removeEventListener('scroll', handleScroll, true)\n }, [show])\n\n useEffect(() => {\n window.addEventListener('resize', clearStyles)\n\n return () => {\n window.removeEventListener('resize', clearStyles)\n }\n }, [clearStyles, style])\n\n return (\n <>\n {renderChildAsHtml ? (\n <div\n data-testid={id ? `${id}-tooltip-wrapper` : 'tooltip-wrapper'}\n ref={parentRef}\n className={tooltipWrapperClassNames}\n dangerouslySetInnerHTML={{ __html: children }}\n onClick={handleMouseLeave}\n />\n ) : (\n <div\n data-testid={id ? `${id}-tooltip-wrapper` : 'tooltip-wrapper'}\n ref={parentRef}\n className={tooltipWrapperClassNames}\n onClick={handleMouseLeave}\n >\n {children}\n </div>\n )}\n {!hidden &&\n createPortal(\n <CSSTransition\n nodeRef={tooltipRef}\n classNames=\"fade\"\n in={show}\n timeout={duration}\n unmountOnExit\n >\n <div\n data-testid={id ? `${id}-tooltip` : 'tooltip'}\n ref={tooltipRef}\n style={{\n ...style\n }}\n className={tooltipBodyClassNames}\n >\n {template}\n </div>\n </CSSTransition>,\n document.getElementById('overlay_container')\n )}\n </>\n )\n}\n\nTooltip.propTypes = {\n children: PropTypes.any,\n className: PropTypes.string,\n tooltipBodyClassName: PropTypes.string,\n hidden: PropTypes.bool,\n id: PropTypes.string,\n renderChildAsHtml: PropTypes.bool,\n template: PropTypes.element.isRequired,\n textShow: PropTypes.bool\n}\n\nTooltip = React.memo(Tooltip)\n\nexport default Tooltip\n"],"names":["Tooltip","children","className","tooltipBodyClassName","hidden","id","renderChildAsHtml","template","textShow","show","setShow","useState","style","setStyle","tooltipWrapperClassNames","classnames","tooltipBodyClassNames","duration","parentRef","useRef","tooltipRef","offset","handleScroll","handleMouseLeave","useCallback","event","handleMouseEnter","child","_b","_a","_d","_c","height","top","bottom","tooltipHeight","tooltipWidth","leftPosition","left","topPosition","clearStyles","debounce","isEveryObjectValueEmpty","useEffect","parentNode","tooltipNode","jsxs","Fragment","jsx","createPortal","CSSTransition","PropTypes","React"],"mappings":";;;;;;;;;AA2BA,IAAIA,IAAU,CAAC;AAAA,EACb,UAAAC,IAAW;AAAA,EACX,WAAAC,IAAY;AAAA,EACZ,sBAAAC,IAAuB;AAAA,EACvB,QAAAC,IAAS;AAAA,EACT,IAAAC,IAAK;AAAA,EACL,mBAAAC,IAAoB;AAAA,EACpB,UAAAC;AAAA,EACA,UAAAC,IAAW;AACb,MAAM;AACJ,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAS,EAAK,GAChC,CAACC,GAAOC,CAAQ,IAAIF,EAAS,CAAA,CAAE,GAE/BG,IAA2BC,EAAW,iBAAiB,mBAAmBb,CAAS,GACnFc,IAAwBD,EAAW,WAAWZ,CAAoB,GAClEc,IAAW,KACXC,IAAYC,EAAO,GACnBC,IAAaD,EAAO,GACpBE,IAAS,IAETC,IAAe,MAAM;AACzB,IAAAZ,EAAQ,EAAK;AAAA,EACf,GAEMa,IAAmBC;AAAA,IACvB,CAASC,MAAA;AAEL,OA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Tooltip/Tooltip.jsx"],"sourcesContent":["/*\nCopyright 2022 Iguazio Systems Ltd.\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, { useRef, useState, useEffect, useCallback } from 'react'\nimport { createPortal } from 'react-dom'\nimport PropTypes from 'prop-types'\nimport { CSSTransition } from 'react-transition-group'\nimport classnames from 'classnames'\nimport { debounce } from 'lodash'\n\nimport { isEveryObjectValueEmpty } from '../../utils/common.util'\n\nimport './tooltip.scss'\n\nlet Tooltip = ({\n children = '',\n className = '',\n tooltipBodyClassName = '',\n hidden = false,\n id = '',\n renderChildAsHtml = false,\n template,\n textShow = false\n}) => {\n const [show, setShow] = useState(false)\n const [style, setStyle] = useState({})\n\n const tooltipWrapperClassNames = classnames('data-ellipsis', 'tooltip-wrapper', className)\n const tooltipBodyClassNames = classnames('tooltip', tooltipBodyClassName)\n const duration = 200\n const parentRef = useRef()\n const tooltipRef = useRef()\n const offset = 10\n\n const handleScroll = () => {\n setShow(false)\n }\n\n const handleMouseLeave = useCallback(\n event => {\n if (\n !tooltipRef.current ||\n hidden ||\n (tooltipRef.current &&\n !tooltipRef.current.contains(event.relatedTarget) &&\n parentRef.current &&\n !parentRef.current.contains(event.relatedTarget))\n ) {\n setShow(false)\n }\n },\n [hidden]\n )\n\n const handleMouseEnter = useCallback(\n event => {\n if (!show) {\n const [child] = parentRef.current.childNodes\n let show =\n !hidden &&\n (textShow\n ? true\n : !child\n ? false\n : (child.nodeType !== Node.TEXT_NODE &&\n child.childNodes?.[0]?.nodeType !== Node.TEXT_NODE) ||\n /*\n If the child node is a text node and the text of the child node inside the container is greater than the width of the container, then show tooltip.\n */\n ((child.nodeType === Node.TEXT_NODE ||\n child.childNodes?.[0]?.nodeType === Node.TEXT_NODE) &&\n parentRef.current.scrollWidth > parentRef.current.offsetWidth))\n\n setShow(show)\n\n setTimeout(() => {\n if (show) {\n let { height, top, bottom } = parentRef?.current?.getBoundingClientRect() ?? {}\n const { height: tooltipHeight, width: tooltipWidth } =\n tooltipRef.current?.getBoundingClientRect() ?? {\n height: 0,\n width: 0\n }\n const leftPosition = event.x - (event.x + tooltipWidth - window.innerWidth + offset)\n const left =\n event.x + tooltipWidth + offset > window.innerWidth\n ? leftPosition > offset\n ? leftPosition\n : offset\n : event.x + offset\n\n if (top + height + offset + tooltipHeight >= window.innerHeight) {\n const topPosition = bottom - height - offset - tooltipHeight\n\n setStyle({\n top: topPosition > 0 ? topPosition : offset,\n left\n })\n } else {\n setStyle({\n top: top + height + offset,\n left\n })\n }\n }\n }, 0)\n }\n },\n [hidden, textShow, show]\n )\n\n const clearStyles = debounce(() => {\n if (!isEveryObjectValueEmpty(style)) {\n setStyle({})\n }\n }, 100)\n\n useEffect(() => {\n const parentNode = parentRef.current\n\n if (parentNode) {\n parentNode.addEventListener('mouseenter', handleMouseEnter)\n parentNode.addEventListener('mouseleave', handleMouseLeave)\n\n return () => {\n parentNode.removeEventListener('mouseenter', handleMouseEnter)\n parentNode.removeEventListener('mouseleave', handleMouseLeave)\n }\n }\n }, [parentRef, handleMouseEnter, handleMouseLeave])\n\n useEffect(() => {\n const tooltipNode = tooltipRef.current\n\n if (tooltipNode && show) {\n tooltipNode.addEventListener('mouseleave', handleMouseLeave)\n\n return () => {\n tooltipNode.removeEventListener('mouseleave', handleMouseLeave)\n }\n }\n }, [tooltipRef, handleMouseEnter, handleMouseLeave, show])\n\n useEffect(() => {\n if (show) {\n window.addEventListener('scroll', handleScroll, true)\n }\n\n return () => window.removeEventListener('scroll', handleScroll, true)\n }, [show])\n\n useEffect(() => {\n window.addEventListener('resize', clearStyles)\n\n return () => {\n window.removeEventListener('resize', clearStyles)\n }\n }, [clearStyles, style])\n\n return (\n <>\n {renderChildAsHtml ? (\n <div\n data-testid={id ? `${id}-tooltip-wrapper` : 'tooltip-wrapper'}\n ref={parentRef}\n className={tooltipWrapperClassNames}\n dangerouslySetInnerHTML={{ __html: children }}\n onClick={handleMouseLeave}\n />\n ) : (\n <div\n data-testid={id ? `${id}-tooltip-wrapper` : 'tooltip-wrapper'}\n ref={parentRef}\n className={tooltipWrapperClassNames}\n onClick={handleMouseLeave}\n >\n {children}\n </div>\n )}\n {!hidden &&\n createPortal(\n <CSSTransition\n nodeRef={tooltipRef}\n classNames=\"fade\"\n in={show}\n timeout={duration}\n unmountOnExit\n >\n <div\n data-testid={id ? `${id}-tooltip` : 'tooltip'}\n ref={tooltipRef}\n style={{\n ...style\n }}\n className={tooltipBodyClassNames}\n >\n {template}\n </div>\n </CSSTransition>,\n document.getElementById('overlay_container')\n )}\n </>\n )\n}\n\nTooltip.propTypes = {\n children: PropTypes.any,\n className: PropTypes.string,\n tooltipBodyClassName: PropTypes.string,\n hidden: PropTypes.bool,\n id: PropTypes.string,\n renderChildAsHtml: PropTypes.bool,\n template: PropTypes.element.isRequired,\n textShow: PropTypes.bool\n}\n\nTooltip = React.memo(Tooltip)\n\nexport default Tooltip\n"],"names":["Tooltip","children","className","tooltipBodyClassName","hidden","id","renderChildAsHtml","template","textShow","show","setShow","useState","style","setStyle","tooltipWrapperClassNames","classnames","tooltipBodyClassNames","duration","parentRef","useRef","tooltipRef","offset","handleScroll","handleMouseLeave","useCallback","event","handleMouseEnter","child","_b","_a","_d","_c","height","top","bottom","tooltipHeight","tooltipWidth","leftPosition","left","topPosition","clearStyles","debounce","isEveryObjectValueEmpty","useEffect","parentNode","tooltipNode","jsxs","Fragment","jsx","createPortal","CSSTransition","PropTypes","React"],"mappings":";;;;;;;;;AA2BA,IA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AA,YAAA;AAAA,cACC,eAAa3C,IAAK,GAAGA,CAAE,aAAa;AAAA,cACpC,KAAKe;AAAA,cACL,OAAO;AAAA,gBACL,GAAGR;AAAA,cAAA;AAAA,cAEL,WAAWI;AAAA,cAEV,UAAAT;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,MAEF,SAAS,eAAe,mBAAmB;AAAA,IAAA;AAAA,EAC7C,GACJ;AAEJ;AAEAP,EAAQ,YAAY;AAAA,EAClB,UAAUmD,EAAU;AAAA,EACpB,WAAWA,EAAU;AAAA,EACrB,sBAAsBA,EAAU;AAAA,EAChC,QAAQA,EAAU;AAAA,EAClB,IAAIA,EAAU;AAAA,EACd,mBAAmBA,EAAU;AAAA,EAC7B,UAAUA,EAAU,QAAQ;AAAA,EAC5B,UAAUA,EAAU;AACtB;AAEAnD,IAAUoD,EAAM,KAAKpD,CAAO;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TextTooltipTemplate.mjs","sources":["../../../src/lib/components/TooltipTemplate/TextTooltipTemplate.jsx"],"sourcesContent":["/*\nCopyright 2022 Iguazio Systems Ltd.\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, { useRef } from 'react'\nimport PropTypes from 'prop-types'\nimport classnames from 'classnames'\n\nimport './textTooltipTemplate.scss'\n\nconst TextTooltipTemplate = ({ text = '', warning = false }) => {\n const textRef = useRef()\n\n const tooltipClassNames = classnames(\n 'tooltip-template',\n 'tooltip__text',\n warning && 'tooltip__warning'\n )\n\n return (\n <div className={tooltipClassNames}>\n <span ref={textRef}>{text}</span>\n </div>\n )\n}\n\nTextTooltipTemplate.propTypes = {\n text: PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.number]),\n warning: PropTypes.bool\n}\n\nexport default TextTooltipTemplate\n"],"names":["TextTooltipTemplate","text","warning","textRef","useRef","tooltipClassNames","classnames","jsx","PropTypes"],"mappings":";;;;;AAsBA,MAAMA,IAAsB,CAAC,EAAE,MAAAC,IAAO,IAAI,SAAAC,IAAU,SAAY;AAC9D,QAAMC,IAAUC,EAAO,GAEjBC,IAAoBC;AAAA,IACxB;AAAA,IACA;AAAA,IACAJ,KAAW;AAAA,EACb;AAGE,SAAA,gBAAAK,EAAC,SAAI,WAAWF,GACd,4BAAC,QAAK,EAAA,KAAKF,GAAU,UAAAF,EAAA,CAAK,EAC5B,CAAA;AAEJ;AAEAD,EAAoB,YAAY;AAAA,EAC9B,MAAMQ,EAAU,UAAU,CAACA,EAAU,QAAQA,EAAU,SAASA,EAAU,MAAM,CAAC;AAAA,EACjF,SAASA,EAAU;AACrB;"}
1
+ {"version":3,"file":"TextTooltipTemplate.mjs","sources":["../../../src/lib/components/TooltipTemplate/TextTooltipTemplate.jsx"],"sourcesContent":["/*\nCopyright 2022 Iguazio Systems Ltd.\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, { useRef } from 'react'\nimport PropTypes from 'prop-types'\nimport classnames from 'classnames'\n\nimport './textTooltipTemplate.scss'\n\nconst TextTooltipTemplate = ({ text = '', warning = false }) => {\n const textRef = useRef()\n\n const tooltipClassNames = classnames(\n 'tooltip-template',\n 'tooltip__text',\n warning && 'tooltip__warning'\n )\n\n return (\n <div className={tooltipClassNames}>\n <span ref={textRef}>{text}</span>\n </div>\n )\n}\n\nTextTooltipTemplate.propTypes = {\n text: PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.number]),\n warning: PropTypes.bool\n}\n\nexport default TextTooltipTemplate\n"],"names":["TextTooltipTemplate","text","warning","textRef","useRef","tooltipClassNames","classnames","jsx","PropTypes"],"mappings":";;;;;AAsBA,MAAMA,IAAsB,CAAC,EAAE,MAAAC,IAAO,IAAI,SAAAC,IAAU,SAAY;AAC9D,QAAMC,IAAUC,EAAA,GAEVC,IAAoBC;AAAA,IACxB;AAAA,IACA;AAAA,IACAJ,KAAW;AAAA,EAAA;AAGb,SACE,gBAAAK,EAAC,SAAI,WAAWF,GACd,4BAAC,QAAA,EAAK,KAAKF,GAAU,UAAAF,EAAA,CAAK,EAAA,CAC5B;AAEJ;AAEAD,EAAoB,YAAY;AAAA,EAC9B,MAAMQ,EAAU,UAAU,CAACA,EAAU,QAAQA,EAAU,SAASA,EAAU,MAAM,CAAC;AAAA,EACjF,SAASA,EAAU;AACrB;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Wizard.mjs","sources":["../../../src/lib/components/Wizard/Wizard.jsx"],"sourcesContent":["/*\nCopyright 2022 Iguazio Systems Ltd.\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, { useEffect, useLayoutEffect, useMemo, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport classNames from 'classnames'\nimport { isEmpty, isNumber } from 'lodash'\n\nimport Button from '../Button/Button'\nimport Modal from '../Modal/Modal'\nimport WizardSteps from './WizardSteps/WizardSteps'\n\nimport { MODAL_MD, TERTIARY_BUTTON } from '../../constants'\nimport { MODAL_SIZES, WIZARD_STEPS_CONFIG } from '../../types'\n\nimport Back from '../../images/back-arrow.svg?react'\n\nimport './Wizard.scss'\n\nconst Wizard = ({\n children,\n className = '',\n getActions = null,\n isWizardOpen,\n onWizardResolve,\n previewText = '',\n size = MODAL_MD,\n stepsConfig = [],\n subTitle = null,\n title\n}) => {\n const wizardClasses = classNames('wizard-form', className)\n const [jumpingToFirstInvalid, setJumpingToFirstInvalid] = useState(false)\n const [activeStepNumber, setActiveStepNumber] = useState(0)\n const [firstDisabledStepIdx, setFirstDisabledStepIdx] = useState(null)\n\n const visibleSteps = useMemo(() => {\n return stepsConfig?.filter(step => !step.hidden) || []\n }, [stepsConfig])\n\n useLayoutEffect(() => {\n const disabledStep = visibleSteps.find((step, stepIdx) => {\n if (step.disabled) {\n setFirstDisabledStepIdx(stepIdx)\n }\n\n return step.disabled\n })\n\n if (!disabledStep) {\n setFirstDisabledStepIdx(null)\n }\n }, [visibleSteps])\n\n useEffect(() => {\n const firstInvalidStepIdx = visibleSteps.findIndex(step => step.invalid)\n\n if (jumpingToFirstInvalid && isNumber(firstInvalidStepIdx) && firstInvalidStepIdx !== -1) {\n setActiveStepNumber(firstInvalidStepIdx)\n setJumpingToFirstInvalid(false)\n }\n }, [jumpingToFirstInvalid, visibleSteps])\n\n const stepsTemplate = useMemo(() => {\n return React.Children.toArray(children)\n .filter((child, idx) => !isEmpty(stepsConfig) && !stepsConfig[idx].hidden)\n .map((child, idx) => {\n const stepIsActive = idx === activeStepNumber\n const newChild =\n !isNumber(firstDisabledStepIdx) || idx < firstDisabledStepIdx\n ? React.cloneElement(child, { stepIsActive })\n : null\n\n return (\n <div\n key={idx}\n className={\n !stepIsActive\n ? 'wizard-form__hidden-content-item'\n : 'wizard-form__visible-content-item'\n }\n >\n {newChild}\n </div>\n )\n })\n }, [activeStepNumber, children, firstDisabledStepIdx, stepsConfig])\n\n const totalSteps = useMemo(() => {\n return visibleSteps.length - 1 || 0\n }, [visibleSteps])\n\n const isLastStep = useMemo(() => {\n return activeStepNumber === totalSteps\n }, [activeStepNumber, totalSteps])\n\n const goToNextStep = () => {\n setActiveStepNumber(prevStep => Math.min(++prevStep, totalSteps))\n }\n\n const goToPreviousStep = () => setActiveStepNumber(prevStep => Math.max(--prevStep, 0))\n\n const goToFirstInvalidStep = () => {\n setJumpingToFirstInvalid(true)\n }\n\n const jumpToStep = idx => {\n return setActiveStepNumber(idx)\n }\n\n const getDefaultActions = stepConfig => {\n const defaultActions = []\n\n if (activeStepNumber !== 0) {\n defaultActions.push(\n <Button\n id=\"wizard-btn-back\"\n icon={<Back />}\n className=\"wizard-form__back-button\"\n onClick={goToPreviousStep}\n disabled={activeStepNumber === 0}\n label=\"Back\"\n type=\"button\"\n variant={TERTIARY_BUTTON}\n />\n )\n }\n\n defaultActions.push(\n <Button\n id=\"wizard-btn-next\"\n icon={<Back />}\n iconPosition=\"right\"\n className=\"wizard-form__next-button\"\n disabled={stepConfig?.nextIsDisabled || isLastStep}\n onClick={goToNextStep}\n label=\"Next\"\n type=\"button\"\n variant={TERTIARY_BUTTON}\n />\n )\n\n return defaultActions\n }\n\n const renderModalActions = () => {\n if (isEmpty(visibleSteps)) return []\n\n const actionsList = getDefaultActions(visibleSteps[activeStepNumber])\n const allStepsAreEnabled = visibleSteps.every(step => !step.disabled)\n\n if (getActions) {\n const actions = getActions({ allStepsAreEnabled, jumpToStep, goToFirstInvalidStep })\n const mainActions = actions.map((action, index) => <Button {...action} key={index} />)\n actionsList.push(...mainActions)\n }\n\n return actionsList\n }\n\n return (\n <Modal\n actions={renderModalActions()}\n className={wizardClasses}\n onClose={onWizardResolve}\n previewText={previewText}\n show={isWizardOpen}\n size={size}\n subTitle={subTitle}\n title={title}\n >\n <WizardSteps\n activeStepNumber={activeStepNumber}\n firstDisabledStepIdx={firstDisabledStepIdx}\n jumpToStep={jumpToStep}\n steps={visibleSteps}\n />\n <div className=\"wizard-form__content-container\">\n <div className=\"wizard-form__content\">{stepsTemplate}</div>\n </div>\n </Modal>\n )\n}\n\nWizard.propTypes = {\n children: PropTypes.node.isRequired,\n className: PropTypes.string,\n getActions: PropTypes.func,\n isWizardOpen: PropTypes.bool.isRequired,\n onWizardResolve: PropTypes.func.isRequired,\n previewText: PropTypes.string,\n size: MODAL_SIZES,\n stepsConfig: WIZARD_STEPS_CONFIG,\n subTitle: PropTypes.string,\n title: PropTypes.string.isRequired\n}\n\nWizard.Step = ({ children }) => children\n\nexport default Wizard\n"],"names":["Wizard","children","className","getActions","isWizardOpen","onWizardResolve","previewText","size","MODAL_MD","stepsConfig","subTitle","title","wizardClasses","classNames","jumpingToFirstInvalid","setJumpingToFirstInvalid","useState","activeStepNumber","setActiveStepNumber","firstDisabledStepIdx","setFirstDisabledStepIdx","visibleSteps","useMemo","step","useLayoutEffect","stepIdx","useEffect","firstInvalidStepIdx","isNumber","stepsTemplate","React","child","idx","isEmpty","stepIsActive","newChild","jsx","totalSteps","isLastStep","goToNextStep","prevStep","goToPreviousStep","goToFirstInvalidStep","jumpToStep","getDefaultActions","stepConfig","defaultActions","Button","Back","TERTIARY_BUTTON","jsxs","Modal","actionsList","allStepsAreEnabled","mainActions","action","index","createElement","WizardSteps","PropTypes","MODAL_SIZES","WIZARD_STEPS_CONFIG"],"mappings":";;;;;;;;;;;;AAgCA,MAAMA,IAAS,CAAC;AAAA,EACd,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,YAAAC,IAAa;AAAA,EACb,cAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,aAAAC,I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,CAAC,EAAE,UAAAC,EAAA,MAAeA;"}
1
+ {"version":3,"file":"Wizard.mjs","sources":["../../../src/lib/components/Wizard/Wizard.jsx"],"sourcesContent":["/*\nCopyright 2022 Iguazio Systems Ltd.\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, { useEffect, useLayoutEffect, useMemo, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport classNames from 'classnames'\nimport { isEmpty, isNumber } from 'lodash'\n\nimport Button from '../Button/Button'\nimport Modal from '../Modal/Modal'\nimport WizardSteps from './WizardSteps/WizardSteps'\n\nimport { MODAL_MD, TERTIARY_BUTTON } from '../../constants'\nimport { MODAL_SIZES, WIZARD_STEPS_CONFIG } from '../../types'\n\nimport Back from '../../images/back-arrow.svg?react'\n\nimport './Wizard.scss'\n\nconst Wizard = ({\n children,\n className = '',\n getActions = null,\n isWizardOpen,\n onWizardResolve,\n previewText = '',\n size = MODAL_MD,\n stepsConfig = [],\n subTitle = null,\n title\n}) => {\n const wizardClasses = classNames('wizard-form', className)\n const [jumpingToFirstInvalid, setJumpingToFirstInvalid] = useState(false)\n const [activeStepNumber, setActiveStepNumber] = useState(0)\n const [firstDisabledStepIdx, setFirstDisabledStepIdx] = useState(null)\n\n const visibleSteps = useMemo(() => {\n return stepsConfig?.filter(step => !step.hidden) || []\n }, [stepsConfig])\n\n useLayoutEffect(() => {\n const disabledStep = visibleSteps.find((step, stepIdx) => {\n if (step.disabled) {\n setFirstDisabledStepIdx(stepIdx)\n }\n\n return step.disabled\n })\n\n if (!disabledStep) {\n setFirstDisabledStepIdx(null)\n }\n }, [visibleSteps])\n\n useEffect(() => {\n const firstInvalidStepIdx = visibleSteps.findIndex(step => step.invalid)\n\n if (jumpingToFirstInvalid && isNumber(firstInvalidStepIdx) && firstInvalidStepIdx !== -1) {\n setActiveStepNumber(firstInvalidStepIdx)\n setJumpingToFirstInvalid(false)\n }\n }, [jumpingToFirstInvalid, visibleSteps])\n\n const stepsTemplate = useMemo(() => {\n return React.Children.toArray(children)\n .filter((child, idx) => !isEmpty(stepsConfig) && !stepsConfig[idx].hidden)\n .map((child, idx) => {\n const stepIsActive = idx === activeStepNumber\n const newChild =\n !isNumber(firstDisabledStepIdx) || idx < firstDisabledStepIdx\n ? React.cloneElement(child, { stepIsActive })\n : null\n\n return (\n <div\n key={idx}\n className={\n !stepIsActive\n ? 'wizard-form__hidden-content-item'\n : 'wizard-form__visible-content-item'\n }\n >\n {newChild}\n </div>\n )\n })\n }, [activeStepNumber, children, firstDisabledStepIdx, stepsConfig])\n\n const totalSteps = useMemo(() => {\n return visibleSteps.length - 1 || 0\n }, [visibleSteps])\n\n const isLastStep = useMemo(() => {\n return activeStepNumber === totalSteps\n }, [activeStepNumber, totalSteps])\n\n const goToNextStep = () => {\n setActiveStepNumber(prevStep => Math.min(++prevStep, totalSteps))\n }\n\n const goToPreviousStep = () => setActiveStepNumber(prevStep => Math.max(--prevStep, 0))\n\n const goToFirstInvalidStep = () => {\n setJumpingToFirstInvalid(true)\n }\n\n const jumpToStep = idx => {\n return setActiveStepNumber(idx)\n }\n\n const getDefaultActions = stepConfig => {\n const defaultActions = []\n\n if (activeStepNumber !== 0) {\n defaultActions.push(\n <Button\n id=\"wizard-btn-back\"\n icon={<Back />}\n className=\"wizard-form__back-button\"\n onClick={goToPreviousStep}\n disabled={activeStepNumber === 0}\n label=\"Back\"\n type=\"button\"\n variant={TERTIARY_BUTTON}\n />\n )\n }\n\n defaultActions.push(\n <Button\n id=\"wizard-btn-next\"\n icon={<Back />}\n iconPosition=\"right\"\n className=\"wizard-form__next-button\"\n disabled={stepConfig?.nextIsDisabled || isLastStep}\n onClick={goToNextStep}\n label=\"Next\"\n type=\"button\"\n variant={TERTIARY_BUTTON}\n />\n )\n\n return defaultActions\n }\n\n const renderModalActions = () => {\n if (isEmpty(visibleSteps)) return []\n\n const actionsList = getDefaultActions(visibleSteps[activeStepNumber])\n const allStepsAreEnabled = visibleSteps.every(step => !step.disabled)\n\n if (getActions) {\n const actions = getActions({ allStepsAreEnabled, jumpToStep, goToFirstInvalidStep })\n const mainActions = actions.map((action, index) => <Button {...action} key={index} />)\n actionsList.push(...mainActions)\n }\n\n return actionsList\n }\n\n return (\n <Modal\n actions={renderModalActions()}\n className={wizardClasses}\n onClose={onWizardResolve}\n previewText={previewText}\n show={isWizardOpen}\n size={size}\n subTitle={subTitle}\n title={title}\n >\n <WizardSteps\n activeStepNumber={activeStepNumber}\n firstDisabledStepIdx={firstDisabledStepIdx}\n jumpToStep={jumpToStep}\n steps={visibleSteps}\n />\n <div className=\"wizard-form__content-container\">\n <div className=\"wizard-form__content\">{stepsTemplate}</div>\n </div>\n </Modal>\n )\n}\n\nWizard.propTypes = {\n children: PropTypes.node.isRequired,\n className: PropTypes.string,\n getActions: PropTypes.func,\n isWizardOpen: PropTypes.bool.isRequired,\n onWizardResolve: PropTypes.func.isRequired,\n previewText: PropTypes.string,\n size: MODAL_SIZES,\n stepsConfig: WIZARD_STEPS_CONFIG,\n subTitle: PropTypes.string,\n title: PropTypes.string.isRequired\n}\n\nWizard.Step = ({ children }) => children\n\nexport default Wizard\n"],"names":["Wizard","children","className","getActions","isWizardOpen","onWizardResolve","previewText","size","MODAL_MD","stepsConfig","subTitle","title","wizardClasses","classNames","jumpingToFirstInvalid","setJumpingToFirstInvalid","useState","activeStepNumber","setActiveStepNumber","firstDisabledStepIdx","setFirstDisabledStepIdx","visibleSteps","useMemo","step","useLayoutEffect","stepIdx","useEffect","firstInvalidStepIdx","isNumber","stepsTemplate","React","child","idx","isEmpty","stepIsActive","newChild","jsx","totalSteps","isLastStep","goToNextStep","prevStep","goToPreviousStep","goToFirstInvalidStep","jumpToStep","getDefaultActions","stepConfig","defaultActions","Button","Back","TERTIARY_BUTTON","jsxs","Modal","actionsList","allStepsAreEnabled","mainActions","action","index","createElement","WizardSteps","PropTypes","MODAL_SIZES","WIZARD_STEPS_CONFIG"],"mappings":";;;;;;;;;;;;AAgCA,MAAMA,IAAS,CAAC;AAAA,EACd,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,YAAAC,IAAa;AAAA,EACb,cAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,MAAAC,IAAOC;AAAA,EACP,aAAAC,IAAc,CAAA;AAAA,EACd,UAAAC,IAAW;AAAA,EACX,OAAAC;AACF,MAAM;AACJ,QAAMC,IAAgBC,EAAW,eAAeX,CAAS,GACnD,CAACY,GAAuBC,CAAwB,IAAIC,EAAS,EAAK,GAClE,CAACC,GAAkBC,CAAmB,IAAIF,EAAS,CAAC,GACpD,CAACG,GAAsBC,CAAuB,IAAIJ,EAAS,IAAI,GAE/DK,IAAeC,EAAQ,OACpBb,KAAA,gBAAAA,EAAa,OAAO,CAAAc,MAAQ,CAACA,EAAK,YAAW,CAAA,GACnD,CAACd,CAAW,CAAC;AAEhB,EAAAe,EAAgB,MAAM;AASpB,IARqBH,EAAa,KAAK,CAACE,GAAME,OACxCF,EAAK,YACPH,EAAwBK,CAAO,GAG1BF,EAAK,SACb,KAGCH,EAAwB,IAAI;AAAA,EAEhC,GAAG,CAACC,CAAY,CAAC,GAEjBK,EAAU,MAAM;AACd,UAAMC,IAAsBN,EAAa,UAAU,CAAAE,MAAQA,EAAK,OAAO;AAEvE,IAAIT,KAAyBc,EAASD,CAAmB,KAAKA,MAAwB,OACpFT,EAAoBS,CAAmB,GACvCZ,EAAyB,EAAK;AAAA,EAElC,GAAG,CAACD,GAAuBO,CA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CACb,4BAAC,OAAA,EAAI,WAAU,wBAAwB,UAAAP,EAAA,CAAc,EAAA,CACvD;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;AAEA7B,EAAO,YAAY;AAAA,EACjB,UAAU2D,EAAU,KAAK;AAAA,EACzB,WAAWA,EAAU;AAAA,EACrB,YAAYA,EAAU;AAAA,EACtB,cAAcA,EAAU,KAAK;AAAA,EAC7B,iBAAiBA,EAAU,KAAK;AAAA,EAChC,aAAaA,EAAU;AAAA,EACvB,MAAMC;AAAA,EACN,aAAaC;AAAA,EACb,UAAUF,EAAU;AAAA,EACpB,OAAOA,EAAU,OAAO;AAC1B;AAEA3D,EAAO,OAAO,CAAC,EAAE,UAAAC,EAAA,MAAeA;"}
@@ -1 +1 @@
1
- {"version":3,"file":"WizardSteps.mjs","sources":["../../../../src/lib/components/Wizard/WizardSteps/WizardSteps.jsx"],"sourcesContent":["/*\nCopyright 2022 Iguazio Systems Ltd.\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport classNames from 'classnames'\nimport { isNumber } from 'lodash'\n\nimport Button from '../../Button/Button'\n\nimport { WIZARD_STEPS_CONFIG } from '../../../types'\n\nimport './WizardSteps.scss'\n\nconst WizardSteps = ({ activeStepNumber, firstDisabledStepIdx = null, jumpToStep, steps }) => {\n const getStepClassNames = (idx, invalid) =>\n classNames(\n 'wizard-steps__item',\n idx === activeStepNumber && 'wizard-steps__item_active',\n invalid && 'wizard-steps__item_invalid'\n )\n\n const handleJumpToStep = (event, idx) => {\n event.preventDefault()\n jumpToStep(idx)\n }\n\n return (\n <div className=\"wizard-steps\">\n {steps.map(({ id, label, invalid }, idx) => {\n const stepIsDisabled = isNumber(firstDisabledStepIdx) && idx >= firstDisabledStepIdx\n\n return (\n <Button\n className={getStepClassNames(idx, invalid)}\n disabled={stepIsDisabled}\n icon={<span className=\"wizard-steps__indicator\">{idx + 1}</span>}\n key={id}\n label={label}\n onClick={e => handleJumpToStep(e, idx)}\n />\n )\n })}\n </div>\n )\n}\n\nWizardSteps.propTypes = {\n activeStepNumber: PropTypes.number.isRequired,\n firstDisabledStepIdx: PropTypes.oneOfType([PropTypes.number, PropTypes.oneOf([null])]),\n jumpToStep: PropTypes.func.isRequired,\n steps: WIZARD_STEPS_CONFIG.isRequired\n}\n\nexport default WizardSteps\n"],"names":["WizardSteps","activeStepNumber","firstDisabledStepIdx","jumpToStep","steps","getStepClassNames","idx","invalid","classNames","handleJumpToStep","event","jsx","id","label","stepIsDisabled","isNumber","Button","e","PropTypes","WIZARD_STEPS_CONFIG"],"mappings":";;;;;;;;AA2BM,MAAAA,IAAc,CAAC,EAAE,kBAAAC,GAAkB,sBAAAC,IAAuB,MAAM,YAAAC,GAAY,OAAAC,QAAY;AACtF,QAAAC,IAAoB,CAACC,GAAKC,MAC9BC;AAAAA,IACE;AAAA,IACAF,MAAQL,KAAoB;AAAA,IAC5BM,KAAW;AAAA,EACb,GAEIE,IAAmB,CAACC,GAAOJ,MAAQ;AACvC,IAAAI,EAAM,eAAe,GACrBP,EAAWG,CAAG;AAAA,EAChB;AAEA,SACG,gBAAAK,EAAA,OAAA,EAAI,WAAU,gBACZ,UAAMP,EAAA,IAAI,CAAC,EAAE,IAAAQ,GAAI,OAAAC,GAAO,SAAAN,EAAQ,GAAGD,MAAQ;AAC1C,UAAMQ,IAAiBC,EAASb,CAAoB,KAAKI,KAAOJ;AAG9D,WAAA,gBAAAS;AAAA,MAACK;AAAA,MAAA;AAAA,QACC,WAAWX,EAAkBC,GAAKC,CAAO;AAAA,QACzC,UAAUO;AAAA,QACV,MAAO,gBAAAH,EAAA,QAAA,EAAK,WAAU,2BAA2B,cAAM,GAAE;AAAA,QAEzD,OAAAE;AAAA,QACA,SAAS,CAAAI,MAAKR,EAAiBQ,GAAGX,CAAG;AAAA,MAAA;AAAA,MAFhCM;AAAA,IAGP;AAAA,EAEH,CAAA,GACH;AAEJ;AAEAZ,EAAY,YAAY;AAAA,EACtB,kBAAkBkB,EAAU,OAAO;AAAA,EACnC,sBAAsBA,EAAU,UAAU,CAACA,EAAU,QAAQA,EAAU,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AAAA,EACrF,YAAYA,EAAU,KAAK;AAAA,EAC3B,OAAOC,EAAoB;AAC7B;"}
1
+ {"version":3,"file":"WizardSteps.mjs","sources":["../../../../src/lib/components/Wizard/WizardSteps/WizardSteps.jsx"],"sourcesContent":["/*\nCopyright 2022 Iguazio Systems Ltd.\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport classNames from 'classnames'\nimport { isNumber } from 'lodash'\n\nimport Button from '../../Button/Button'\n\nimport { WIZARD_STEPS_CONFIG } from '../../../types'\n\nimport './WizardSteps.scss'\n\nconst WizardSteps = ({ activeStepNumber, firstDisabledStepIdx = null, jumpToStep, steps }) => {\n const getStepClassNames = (idx, invalid) =>\n classNames(\n 'wizard-steps__item',\n idx === activeStepNumber && 'wizard-steps__item_active',\n invalid && 'wizard-steps__item_invalid'\n )\n\n const handleJumpToStep = (event, idx) => {\n event.preventDefault()\n jumpToStep(idx)\n }\n\n return (\n <div className=\"wizard-steps\">\n {steps.map(({ id, label, invalid }, idx) => {\n const stepIsDisabled = isNumber(firstDisabledStepIdx) && idx >= firstDisabledStepIdx\n\n return (\n <Button\n className={getStepClassNames(idx, invalid)}\n disabled={stepIsDisabled}\n icon={<span className=\"wizard-steps__indicator\">{idx + 1}</span>}\n key={id}\n label={label}\n onClick={e => handleJumpToStep(e, idx)}\n />\n )\n })}\n </div>\n )\n}\n\nWizardSteps.propTypes = {\n activeStepNumber: PropTypes.number.isRequired,\n firstDisabledStepIdx: PropTypes.oneOfType([PropTypes.number, PropTypes.oneOf([null])]),\n jumpToStep: PropTypes.func.isRequired,\n steps: WIZARD_STEPS_CONFIG.isRequired\n}\n\nexport default WizardSteps\n"],"names":["WizardSteps","activeStepNumber","firstDisabledStepIdx","jumpToStep","steps","getStepClassNames","idx","invalid","classNames","handleJumpToStep","event","jsx","id","label","stepIsDisabled","isNumber","Button","e","PropTypes","WIZARD_STEPS_CONFIG"],"mappings":";;;;;;;;AA2BA,MAAMA,IAAc,CAAC,EAAE,kBAAAC,GAAkB,sBAAAC,IAAuB,MAAM,YAAAC,GAAY,OAAAC,QAAY;AAC5F,QAAMC,IAAoB,CAACC,GAAKC,MAC9BC;AAAAA,IACE;AAAA,IACAF,MAAQL,KAAoB;AAAA,IAC5BM,KAAW;AAAA,EAAA,GAGTE,IAAmB,CAACC,GAAOJ,MAAQ;AACvC,IAAAI,EAAM,eAAA,GACNP,EAAWG,CAAG;AAAA,EAChB;AAEA,SACE,gBAAAK,EAAC,OAAA,EAAI,WAAU,gBACZ,UAAAP,EAAM,IAAI,CAAC,EAAE,IAAAQ,GAAI,OAAAC,GAAO,SAAAN,EAAA,GAAWD,MAAQ;AAC1C,UAAMQ,IAAiBC,EAASb,CAAoB,KAAKI,KAAOJ;AAEhE,WACE,gBAAAS;AAAA,MAACK;AAAA,MAAA;AAAA,QACC,WAAWX,EAAkBC,GAAKC,CAAO;AAAA,QACzC,UAAUO;AAAA,QACV,MAAM,gBAAAH,EAAC,QAAA,EAAK,WAAU,2BAA2B,cAAM,GAAE;AAAA,QAEzD,OAAAE;AAAA,QACA,SAAS,CAAAI,MAAKR,EAAiBQ,GAAGX,CAAG;AAAA,MAAA;AAAA,MAFhCM;AAAA,IAAA;AAAA,EAKX,CAAC,EAAA,CACH;AAEJ;AAEAZ,EAAY,YAAY;AAAA,EACtB,kBAAkBkB,EAAU,OAAO;AAAA,EACnC,sBAAsBA,EAAU,UAAU,CAACA,EAAU,QAAQA,EAAU,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AAAA,EACrF,YAAYA,EAAU,KAAK;AAAA,EAC3B,OAAOC,EAAoB;AAC7B;"}
@@ -1 +1 @@
1
- {"version":3,"file":"constants.mjs","sources":["../src/lib/constants.js"],"sourcesContent":["/*\nCopyright 2022 Iguazio Systems Ltd.\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\n\n/*=========== GENERAL =============*/\n\nexport const VIEW_SEARCH_PARAMETER = 'view'\nexport const FULL_VIEW_MODE = 'full'\n\nexport const DENSITY_DENSE = 'dense'\nexport const DENSITY_NORMAL = 'normal'\nexport const DENSITY_MEDIUM = 'medium'\nexport const DENSITY_CHUNKY = 'chunky'\n\n/*=========== EVENT KEYS =============*/\nexport const BACKSPACE = 'Backspace'\nexport const CLICK = 'Click'\nexport const DELETE = 'Delete'\nexport const TAB = 'Tab'\nexport const TAB_SHIFT = 'Tab+Shift'\n\n/*=========== BUTTONS =============*/\n\nexport const PRIMARY_BUTTON = 'primary'\nexport const SECONDARY_BUTTON = 'secondary'\nexport const TERTIARY_BUTTON = 'tertiary'\nexport const DANGER_BUTTON = 'danger'\nexport const LABEL_BUTTON = 'label'\n\n/*=========== VALITATION =============*/\n\nexport const validation = {\n BEGIN_END_NOT_WITH: { LABEL: 'Must not begin and end with', NAME: 'beginEndNot' },\n BEGIN_END_WITH: { LABEL: 'Must begin and end with', NAME: 'beginEnd' },\n BEGIN_NOT_WITH: { LABEL: 'Must not begin with', NAME: 'beginNot' },\n BEGIN_WITH: { LABEL: 'Must begin with', NAME: 'begin' },\n END_NOT_WITH: { LABEL: 'Must not end with', NAME: 'endNot' },\n END_WITH: { LABEL: 'Must end with', NAME: 'end' },\n MUST_CONTAIN_EXACTLY_ONE: { LABEL: 'Must contain exactly one', NAME: 'exactlyOne' },\n MUST_HAVE_DOT_AFTER_AT: { LABEL: 'Must have at least one . after @', NAME: 'dotAfterAt' },\n MUST_NOT_BE: { LABEL: 'Must not be', NAME: 'mustNotBe' },\n NO_CONSECUTIVE_CHARACTER: { LABEL: 'No consecutive characters', NAME: 'noConsecutiveCharacters' },\n NOT_CONTAIN: { LABEL: 'Must not contain', NAME: 'notContainCharacters' },\n ONLY_AT_THE_BEGINNING: { LABEL: 'Only at the beginning', NAME: 'onlyAtTheBeginning' },\n REQUIRED: { LABEL: 'This field is required', NAME: 'required' },\n VALID_CHARACTERS_WITH_REFIX: { LABEL: 'Valid characters', NAME: 'validCharactersWithPrefix' },\n VALID_CHARACTERS: { LABEL: 'Valid characters', NAME: 'validCharacters' }\n}\n\n/*=========== STATUS CODES =============*/\n\nexport const BADREQUEST_ERROR_STATUS_CODE = 400\nexport const FORBIDDEN_ERROR_STATUS_CODE = 403\nexport const NOTFOUND_ERROR_STATUS_CODE = 404\nexport const CONFLICT_ERROR_STATUS_CODE = 409\nexport const INTERNAL_SERVER_ERROR_STATUS_CODE = 500\nexport const BAD_GATEWAY_ERROR_STATUS_CODE = 502\nexport const SERVICE_UNAVAILABLE_ERROR_STATUS_CODE = 503\nexport const GATEWAY_TIMEOUT_STATUS_CODE = 504\n\n/*=========== MODAL =============*/\n\nexport const MODAL_SM = 'sm'\nexport const MODAL_MD = 'md'\nexport const MODAL_LG = 'lg'\nexport const MODAL_MIN = 'min'\nexport const MODAL_MAX = 'max'\n\n/*=========== TABLE =============*/\n\nexport const MAIN_TABLE_ID = 'main-table'\nexport const MAIN_TABLE_BODY_ID = 'main-table-body'\n"],"names":["VIEW_SEARCH_PARAMETER","FULL_VIEW_MODE","DENSITY_DENSE","DENSITY_NORMAL","DENSITY_MEDIUM","DENSITY_CHUNKY","BACKSPACE","CLICK","DELETE","TAB","TAB_SHIFT","PRIMARY_BUTTON","SECONDARY_BUTTON","TERTIARY_BUTTON","DANGER_BUTTON","LABEL_BUTTON","validation","BADREQUEST_ERROR_STATUS_CODE","FORBIDDEN_ERROR_STATUS_CODE","NOTFOUND_ERROR_STATUS_CODE","CONFLICT_ERROR_STATUS_CODE","INTERNAL_SERVER_ERROR_STATUS_CODE","BAD_GATEWAY_ERROR_STATUS_CODE","SERVICE_UNAVAILABLE_ERROR_STATUS_CODE","GATEWAY_TIMEOUT_STATUS_CODE","MODAL_SM","MODAL_MD","MODAL_LG","MODAL_MIN","MODAL_MAX","MAIN_TABLE_ID","MAIN_TABLE_BODY_ID"],"mappings":"AAmBY,MAACA,IAAwB,QACxBC,IAAiB,QAEjBC,IAAgB,SAChBC,IAAiB,UACjBC,IAAiB,UACjBC,IAAiB,UAGjBC,IAAY,aACZC,IAAQ,SACRC,IAAS,UACTC,IAAM,OACNC,IAAY,aAIZC,IAAiB,WACjBC,IAAmB,aACnBC,IAAkB,YAClBC,IAAgB,UAChBC,IAAe,SAIfC,IAAa;AAAA,EACxB,oBAAoB,EAAE,OAAO,+BAA+B,MAAM,cAAe;AAAA,EACjF,gBAAgB,EAAE,OAAO,2BAA2B,MAAM,WAAY;AAAA,EACtE,gBAAgB,EAAE,OAAO,uBAAuB,MAAM,WAAY;AAAA,EAClE,YAAY,EAAE,OAAO,mBAAmB,MAAM,QAAS;AAAA,EACvD,cAAc,EAAE,OAAO,qBAAqB,MAAM,SAAU;AAAA,EAC5D,UAAU,EAAE,OAAO,iBAAiB,MAAM,MAAO;AAAA,EACjD,0BAA0B,EAAE,OAAO,4BAA4B,MAAM,aAAc;AAAA,EACnF,wBAAwB,EAAE,OAAO,oCAAoC,MAAM,aAAc;AAAA,EACzF,aAAa,EAAE,OAAO,eAAe,MAAM,YAAa;AAAA,EACxD,0BAA0B,EAAE,OAAO,6BAA6B,MAAM,0BAA2B;AAAA,EACjG,aAAa,EAAE,OAAO,oBAAoB,MAAM,uBAAwB;AAAA,EACxE,uBAAuB,EAAE,OAAO,yBAAyB,MAAM,qBAAsB;AAAA,EACrF,UAAU,EAAE,OAAO,0BAA0B,MAAM,WAAY;AAAA,EAC/D,6BAA6B,EAAE,OAAO,oBAAoB,MAAM,4BAA6B;AAAA,EAC7F,kBAAkB,EAAE,OAAO,oBAAoB,MAAM,kBAAiB;AACxE,GAIaC,IAA+B,KAC/BC,IAA8B,KAC9BC,IAA6B,KAC7BC,IAA6B,KAC7BC,IAAoC,KACpCC,IAAgC,KAChCC,IAAwC,KACxCC,IAA8B,KAI9BC,IAAW,MACXC,IAAW,MACXC,IAAW,MACXC,IAAY,OACZC,IAAY,OAIZC,IAAgB,cAChBC,IAAqB;"}
1
+ {"version":3,"file":"constants.mjs","sources":["../src/lib/constants.js"],"sourcesContent":["/*\nCopyright 2022 Iguazio Systems Ltd.\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\n\n/*=========== GENERAL =============*/\n\nexport const VIEW_SEARCH_PARAMETER = 'view'\nexport const FULL_VIEW_MODE = 'full'\n\nexport const DENSITY_DENSE = 'dense'\nexport const DENSITY_NORMAL = 'normal'\nexport const DENSITY_MEDIUM = 'medium'\nexport const DENSITY_CHUNKY = 'chunky'\n\n/*=========== EVENT KEYS =============*/\nexport const BACKSPACE = 'Backspace'\nexport const CLICK = 'Click'\nexport const DELETE = 'Delete'\nexport const TAB = 'Tab'\nexport const TAB_SHIFT = 'Tab+Shift'\n\n/*=========== BUTTONS =============*/\n\nexport const PRIMARY_BUTTON = 'primary'\nexport const SECONDARY_BUTTON = 'secondary'\nexport const TERTIARY_BUTTON = 'tertiary'\nexport const DANGER_BUTTON = 'danger'\nexport const LABEL_BUTTON = 'label'\n\n/*=========== VALITATION =============*/\n\nexport const validation = {\n BEGIN_END_NOT_WITH: { LABEL: 'Must not begin and end with', NAME: 'beginEndNot' },\n BEGIN_END_WITH: { LABEL: 'Must begin and end with', NAME: 'beginEnd' },\n BEGIN_NOT_WITH: { LABEL: 'Must not begin with', NAME: 'beginNot' },\n BEGIN_WITH: { LABEL: 'Must begin with', NAME: 'begin' },\n END_NOT_WITH: { LABEL: 'Must not end with', NAME: 'endNot' },\n END_WITH: { LABEL: 'Must end with', NAME: 'end' },\n MUST_CONTAIN_EXACTLY_ONE: { LABEL: 'Must contain exactly one', NAME: 'exactlyOne' },\n MUST_HAVE_DOT_AFTER_AT: { LABEL: 'Must have at least one . after @', NAME: 'dotAfterAt' },\n MUST_NOT_BE: { LABEL: 'Must not be', NAME: 'mustNotBe' },\n NO_CONSECUTIVE_CHARACTER: { LABEL: 'No consecutive characters', NAME: 'noConsecutiveCharacters' },\n NOT_CONTAIN: { LABEL: 'Must not contain', NAME: 'notContainCharacters' },\n ONLY_AT_THE_BEGINNING: { LABEL: 'Only at the beginning', NAME: 'onlyAtTheBeginning' },\n REQUIRED: { LABEL: 'This field is required', NAME: 'required' },\n VALID_CHARACTERS_WITH_REFIX: { LABEL: 'Valid characters', NAME: 'validCharactersWithPrefix' },\n VALID_CHARACTERS: { LABEL: 'Valid characters', NAME: 'validCharacters' }\n}\n\n/*=========== STATUS CODES =============*/\n\nexport const BADREQUEST_ERROR_STATUS_CODE = 400\nexport const FORBIDDEN_ERROR_STATUS_CODE = 403\nexport const NOTFOUND_ERROR_STATUS_CODE = 404\nexport const CONFLICT_ERROR_STATUS_CODE = 409\nexport const INTERNAL_SERVER_ERROR_STATUS_CODE = 500\nexport const BAD_GATEWAY_ERROR_STATUS_CODE = 502\nexport const SERVICE_UNAVAILABLE_ERROR_STATUS_CODE = 503\nexport const GATEWAY_TIMEOUT_STATUS_CODE = 504\n\n/*=========== MODAL =============*/\n\nexport const MODAL_SM = 'sm'\nexport const MODAL_MD = 'md'\nexport const MODAL_LG = 'lg'\nexport const MODAL_MIN = 'min'\nexport const MODAL_MAX = 'max'\n\n/*=========== TABLE =============*/\n\nexport const MAIN_TABLE_ID = 'main-table'\nexport const MAIN_TABLE_BODY_ID = 'main-table-body'\n"],"names":["VIEW_SEARCH_PARAMETER","FULL_VIEW_MODE","DENSITY_DENSE","DENSITY_NORMAL","DENSITY_MEDIUM","DENSITY_CHUNKY","BACKSPACE","CLICK","DELETE","TAB","TAB_SHIFT","PRIMARY_BUTTON","SECONDARY_BUTTON","TERTIARY_BUTTON","DANGER_BUTTON","LABEL_BUTTON","validation","BADREQUEST_ERROR_STATUS_CODE","FORBIDDEN_ERROR_STATUS_CODE","NOTFOUND_ERROR_STATUS_CODE","CONFLICT_ERROR_STATUS_CODE","INTERNAL_SERVER_ERROR_STATUS_CODE","BAD_GATEWAY_ERROR_ST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C/BC,IAA8B,KAC9BC,IAA6B,KAC7BC,IAA6B,KAC7BC,IAAoC,KACpCC,IAAgC,KAChCC,IAAwC,KACxCC,IAA8B,KAI9BC,IAAW,MACXC,IAAW,MACXC,IAAW,MACXC,IAAY,OACZC,IAAY,OAIZC,IAAgB,cAChBC,IAAqB;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ActionsMenuItem.mjs","sources":["../../../src/lib/elements/ActionsMenuItem/ActionsMenuItem.jsx"],"sourcesContent":["/*\nCopyright 2019 Iguazio Systems Ltd.\n\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\n\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport classnames from 'classnames'\nimport { useDispatch, useSelector } from 'react-redux'\n\nimport Tooltip from '../../components/Tooltip/Tooltip'\nimport TextTooltipTemplate from '../../components/TooltipTemplate/TextTooltipTemplate'\n\nimport { performDetailsActionHelper } from '../../utils/common.util'\n\nimport './actionsMenuItem.scss'\n\nconst ActionsMenuItem = ({ dataItem = {}, index, isIconDisplayed, menuItem }) => {\n const dispatch = useDispatch()\n const changes = useSelector(store => store.commonDetailsStore.changes)\n\n const iconClassNames = classnames(\n 'actions-menu__icon',\n isIconDisplayed && 'actions-menu__icon_visible'\n )\n const menuClassNames = classnames(\n 'actions-menu__option',\n menuItem.className && `actions-menu__option_${menuItem.className}`,\n menuItem.disabled && 'actions-menu__option_disabled'\n )\n\n const handleActionClick = async () => {\n if (!menuItem.disabled) {\n if (menuItem.allowLeaveWarning) {\n const actionCanBePerformed = await performDetailsActionHelper(changes, dispatch)\n\n if (actionCanBePerformed) {\n menuItem.onClick(dataItem)\n }\n } else {\n menuItem.onClick(dataItem)\n }\n }\n }\n\n return (\n <li\n data-testid={`actions-menu__option-${index}`}\n className={menuClassNames}\n onClick={handleActionClick}\n >\n <Tooltip\n template={<TextTooltipTemplate text={menuItem.tooltip} />}\n hidden={!menuItem.tooltip}\n key={menuItem.label}\n >\n <span className={iconClassNames}>{menuItem.icon}</span>\n {menuItem.label}\n </Tooltip>\n </li>\n )\n}\n\nActionsMenuItem.propTypes = {\n dataItem: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),\n index: PropTypes.number.isRequired,\n isIconDisplayed: PropTypes.bool.isRequired,\n menuItem: PropTypes.object.isRequired\n}\n\nexport default ActionsMenuItem\n"],"names":["ActionsMenuItem","dataItem","index","isIconDisplayed","menuItem","dispatch","useDispatch","changes","useSelector","store","iconClassNames","classnames","menuClassNames","handleActionClick","performDetailsActionHelper","jsx","jsxs","Tooltip","TextTooltipTemplate","PropTypes"],"mappings":";;;;;;;;;AA+BM,MAAAA,IAAkB,CAAC,EAAE,UAAAC,IAAW,CAAA,GAAI,OAAAC,GAAO,iBAAAC,GAAiB,UAAAC,QAAe;AAC/E,QAAMC,IAAWC,EAAY,GACvBC,IAAUC,EAAY,CAASC,MAAAA,EAAM,mBAAmB,OAAO,GAE/DC,IAAiBC;AAAA,IACrB;AAAA,IACAR,KAAmB;AAAA,EACrB,GACMS,IAAiBD;AAAA,IACrB;AAAA,IACAP,EAAS,aAAa,wBAAwBA,EAAS,SAAS;AAAA,IAChEA,EAAS,YAAY;AAAA,EACvB,GAEMS,IAAoB,YAAY;AAChC,IAACT,EAAS,aACRA,EAAS,oBACkB,MAAMU,EAA2BP,GAASF,CAAQ,KAG7ED,EAAS,QAAQH,CAAQ,IAG3BG,EAAS,QAAQH,CAAQ;AAAA,EAG/B;AAGE,SAAA,gBAAAc;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,eAAa,wBAAwBb,CAAK;AAAA,MAC1C,WAAWU;AAAA,MACX,SAASC;AAAA,MAET,UAAA,gBAAAG;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,UAAU,gBAAAF,EAACG,GAAoB,EAAA,MAAMd,EAAS,SAAS;AAAA,UACvD,QAAQ,CAACA,EAAS;AAAA,UAGlB,UAAA;AAAA,YAAA,gBAAAW,EAAC,QAAK,EAAA,WAAWL,GAAiB,UAAAN,EAAS,MAAK;AAAA,YAC/CA,EAAS;AAAA,UAAA;AAAA,QAAA;AAAA,QAHLA,EAAS;AAAA,MAAA;AAAA,IAIhB;AAAA,EACF;AAEJ;AAEAJ,EAAgB,YAAY;AAAA,EAC1B,UAAUmB,EAAU,UAAU,CAACA,EAAU,QAAQA,EAAU,MAAM,CAAC;AAAA,EAClE,OAAOA,EAAU,OAAO;AAAA,EACxB,iBAAiBA,EAAU,KAAK;AAAA,EAChC,UAAUA,EAAU,OAAO;AAC7B;"}
1
+ {"version":3,"file":"ActionsMenuItem.mjs","sources":["../../../src/lib/elements/ActionsMenuItem/ActionsMenuItem.jsx"],"sourcesContent":["/*\nCopyright 2019 Iguazio Systems Ltd.\n\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\n\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport classnames from 'classnames'\nimport { useDispatch, useSelector } from 'react-redux'\n\nimport Tooltip from '../../components/Tooltip/Tooltip'\nimport TextTooltipTemplate from '../../components/TooltipTemplate/TextTooltipTemplate'\n\nimport { performDetailsActionHelper } from '../../utils/common.util'\n\nimport './actionsMenuItem.scss'\n\nconst ActionsMenuItem = ({ dataItem = {}, index, isIconDisplayed, menuItem }) => {\n const dispatch = useDispatch()\n const changes = useSelector(store => store.commonDetailsStore.changes)\n\n const iconClassNames = classnames(\n 'actions-menu__icon',\n isIconDisplayed && 'actions-menu__icon_visible'\n )\n const menuClassNames = classnames(\n 'actions-menu__option',\n menuItem.className && `actions-menu__option_${menuItem.className}`,\n menuItem.disabled && 'actions-menu__option_disabled'\n )\n\n const handleActionClick = async () => {\n if (!menuItem.disabled) {\n if (menuItem.allowLeaveWarning) {\n const actionCanBePerformed = await performDetailsActionHelper(changes, dispatch)\n\n if (actionCanBePerformed) {\n menuItem.onClick(dataItem)\n }\n } else {\n menuItem.onClick(dataItem)\n }\n }\n }\n\n return (\n <li\n data-testid={`actions-menu__option-${index}`}\n className={menuClassNames}\n onClick={handleActionClick}\n >\n <Tooltip\n template={<TextTooltipTemplate text={menuItem.tooltip} />}\n hidden={!menuItem.tooltip}\n key={menuItem.label}\n >\n <span className={iconClassNames}>{menuItem.icon}</span>\n {menuItem.label}\n </Tooltip>\n </li>\n )\n}\n\nActionsMenuItem.propTypes = {\n dataItem: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),\n index: PropTypes.number.isRequired,\n isIconDisplayed: PropTypes.bool.isRequired,\n menuItem: PropTypes.object.isRequired\n}\n\nexport default ActionsMenuItem\n"],"names":["ActionsMenuItem","dataItem","index","isIconDisplayed","menuItem","dispatch","useDispatch","changes","useSelector","store","iconClassNames","classnames","menuClassNames","handleActionClick","performDetailsActionHelper","jsx","jsxs","Tooltip","TextTooltipTemplate","PropTypes"],"mappings":";;;;;;;;;AA+BA,MAAMA,IAAkB,CAAC,EAAE,UAAAC,IAAW,CAAA,GAAI,OAAAC,GAAO,iBAAAC,GAAiB,UAAAC,QAAe;AAC/E,QAAMC,IAAWC,EAAA,GACXC,IAAUC,EAAY,CAAAC,MAASA,EAAM,mBAAmB,OAAO,GAE/DC,IAAiBC;AAAA,IACrB;AAAA,IACAR,KAAmB;AAAA,EAAA,GAEfS,IAAiBD;AAAA,IACrB;AAAA,IACAP,EAAS,aAAa,wBAAwBA,EAAS,SAAS;AAAA,IAChEA,EAAS,YAAY;AAAA,EAAA,GAGjBS,IAAoB,YAAY;AACpC,IAAKT,EAAS,aACRA,EAAS,oBACkB,MAAMU,EAA2BP,GAASF,CAAQ,KAG7ED,EAAS,QAAQH,CAAQ,IAG3BG,EAAS,QAAQH,CAAQ;AAAA,EAG/B;AAEA,SACE,gBAAAc;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,eAAa,wBAAwBb,CAAK;AAAA,MAC1C,WAAWU;AAAA,MACX,SAASC;AAAA,MAET,UAAA,gBAAAG;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,UAAU,gBAAAF,EAACG,GAAA,EAAoB,MAAMd,EAAS,SAAS;AAAA,UACvD,QAAQ,CAACA,EAAS;AAAA,UAGlB,UAAA;AAAA,YAAA,gBAAAW,EAAC,QAAA,EAAK,WAAWL,GAAiB,UAAAN,EAAS,MAAK;AAAA,YAC/CA,EAAS;AAAA,UAAA;AAAA,QAAA;AAAA,QAHLA,EAAS;AAAA,MAAA;AAAA,IAIhB;AAAA,EAAA;AAGN;AAEAJ,EAAgB,YAAY;AAAA,EAC1B,UAAUmB,EAAU,UAAU,CAACA,EAAU,QAAQA,EAAU,MAAM,CAAC;AAAA,EAClE,OAAOA,EAAU,OAAO;AAAA,EACxB,iBAAiBA,EAAU,KAAK;AAAA,EAChC,UAAUA,EAAU,OAAO;AAC7B;"}
@@ -1 +1 @@
1
- {"version":3,"file":"FormActionButton.mjs","sources":["../../../src/lib/elements/FormActionButton/FormActionButton.jsx"],"sourcesContent":["/*\nCopyright 2019 Iguazio Systems Ltd.\n\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\n\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, { forwardRef } from 'react'\nimport PropTypes from 'prop-types'\n\nimport Plus from '../../images/plus.svg?react'\n\nlet FormActionButton = (\n {\n disabled = false,\n fields,\n fieldsPath,\n hidden = false,\n id = '',\n label = 'Add new item',\n onClick\n },\n ref\n) => {\n return (\n <>\n {!hidden && (\n <div className=\"form-table__row form-table__action-row no-hover\">\n <button\n data-testid={id ? id : `${fieldsPath}-add-btn`}\n onClick={event => onClick(event, fields, fieldsPath)}\n disabled={disabled}\n >\n <Plus />\n {label}\n </button>\n </div>\n )}\n {/*The tag `span` below is used as bottom point to scroll to if the new item is added to the list*/}\n <span ref={ref}></span>\n </>\n )\n}\n\nFormActionButton = forwardRef(FormActionButton)\n\nFormActionButton.displayName = 'FormActionButton'\n\nFormActionButton.propTypes = {\n disabled: PropTypes.bool,\n fields: PropTypes.shape({}).isRequired,\n fieldsPath: PropTypes.string.isRequired,\n hidden: PropTypes.bool,\n id: PropTypes.string,\n label: PropTypes.string,\n onClick: PropTypes.func.isRequired\n}\n\nexport default FormActionButton\n"],"names":["FormActionButton","disabled","fields","fieldsPath","hidden","id","label","onClick","ref","jsxs","Fragment","jsx","event","Plus","forwardRef","PropTypes","FormActionButton$1"],"mappings":";;;;AAwBA,IAAIA,IAAmB,CACrB;AAAA,EACE,UAAAC,IAAW;AAAA,EACX,QAAAC;AAAA,EACA,YAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,IAAAC,IAAK;AAAA,EACL,OAAAC,IAAQ;AAAA,EACR,SAAAC;AACF,GACAC,MAIK,gBAAAC,EAAAC,GAAA,EAAA,UAAA;AAAA,EAAA,CAACN,KACA,gBAAAO,EAAC,OAAI,EAAA,WAAU,mDACb,UAAA,gBAAAF;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,eAAaJ,KAAU,GAAGF,CAAU;AAAA,MACpC,SAAS,CAAAS,MAASL,EAAQK,GAAOV,GAAQC,CAAU;AAAA,MACnD,UAAAF;AAAA,MAEA,UAAA;AAAA,QAAA,gBAAAU,EAACE,GAAK,EAAA;AAAA,QACLP;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAEL;AAAA,EAGF,gBAAAK,EAAC,UAAK,KAAAH,EAAU,CAAA;AAAA,GAClB;AAIJR,IAAmBc,EAAWd,CAAgB;AAE9CA,EAAiB,cAAc;AAE/BA,EAAiB,YAAY;AAAA,EAC3B,UAAUe,EAAU;AAAA,EACpB,QAAQA,EAAU,MAAM,CAAA,CAAE,EAAE;AAAA,EAC5B,YAAYA,EAAU,OAAO;AAAA,EAC7B,QAAQA,EAAU;AAAA,EAClB,IAAIA,EAAU;AAAA,EACd,OAAOA,EAAU;AAAA,EACjB,SAASA,EAAU,KAAK;AAC1B;AAEA,MAAAC,IAAehB;"}
1
+ {"version":3,"file":"FormActionButton.mjs","sources":["../../../src/lib/elements/FormActionButton/FormActionButton.jsx"],"sourcesContent":["/*\nCopyright 2019 Iguazio Systems Ltd.\n\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\n\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, { forwardRef } from 'react'\nimport PropTypes from 'prop-types'\n\nimport Plus from '../../images/plus.svg?react'\n\nlet FormActionButton = (\n {\n disabled = false,\n fields,\n fieldsPath,\n hidden = false,\n id = '',\n label = 'Add new item',\n onClick\n },\n ref\n) => {\n return (\n <>\n {!hidden && (\n <div className=\"form-table__row form-table__action-row no-hover\">\n <button\n data-testid={id ? id : `${fieldsPath}-add-btn`}\n onClick={event => onClick(event, fields, fieldsPath)}\n disabled={disabled}\n >\n <Plus />\n {label}\n </button>\n </div>\n )}\n {/*The tag `span` below is used as bottom point to scroll to if the new item is added to the list*/}\n <span ref={ref}></span>\n </>\n )\n}\n\nFormActionButton = forwardRef(FormActionButton)\n\nFormActionButton.displayName = 'FormActionButton'\n\nFormActionButton.propTypes = {\n disabled: PropTypes.bool,\n fields: PropTypes.shape({}).isRequired,\n fieldsPath: PropTypes.string.isRequired,\n hidden: PropTypes.bool,\n id: PropTypes.string,\n label: PropTypes.string,\n onClick: PropTypes.func.isRequired\n}\n\nexport default FormActionButton\n"],"names":["FormActionButton","disabled","fields","fieldsPath","hidden","id","label","onClick","ref","jsxs","Fragment","jsx","event","Plus","forwardRef","PropTypes","FormActionButton$1"],"mappings":";;;;AAwBA,IAAIA,IAAmB,CACrB;AAAA,EACE,UAAAC,IAAW;AAAA,EACX,QAAAC;AAAA,EACA,YAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,IAAAC,IAAK;AAAA,EACL,OAAAC,IAAQ;AAAA,EACR,SAAAC;AACF,GACAC,MAGE,gBAAAC,EAAAC,GAAA,EACG,UAAA;AAAA,EAAA,CAACN,KACA,gBAAAO,EAAC,OAAA,EAAI,WAAU,mDACb,UAAA,gBAAAF;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,eAAaJ,KAAU,GAAGF,CAAU;AAAA,MACpC,SAAS,CAAAS,MAASL,EAAQK,GAAOV,GAAQC,CAAU;AAAA,MACnD,UAAAF;AAAA,MAEA,UAAA;AAAA,QAAA,gBAAAU,EAACE,GAAA,EAAK;AAAA,QACLP;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAEL;AAAA,EAGF,gBAAAK,EAAC,UAAK,KAAAH,EAAA,CAAU;AAAA,GAClB;AAIJR,IAAmBc,EAAWd,CAAgB;AAE9CA,EAAiB,cAAc;AAE/BA,EAAiB,YAAY;AAAA,EAC3B,UAAUe,EAAU;AAAA,EACpB,QAAQA,EAAU,MAAM,CAAA,CAAE,EAAE;AAAA,EAC5B,YAAYA,EAAU,OAAO;AAAA,EAC7B,QAAQA,EAAU;AAAA,EAClB,IAAIA,EAAU;AAAA,EACd,OAAOA,EAAU;AAAA,EACjB,SAASA,EAAU,KAAK;AAC1B;AAEA,MAAAC,IAAehB;"}