iguazio.dashboard-react-controls 3.2.4 → 3.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ActionsMenu/ActionsMenu.mjs.map +1 -1
- package/dist/components/Backdrop/Backdrop.mjs.map +1 -1
- package/dist/components/BlockerSpy/BlockerSpy.mjs.map +1 -1
- package/dist/components/Button/Button.mjs.map +1 -1
- package/dist/components/ConfirmDialog/ConfirmDialog.mjs.map +1 -1
- package/dist/components/CopyToClipboard/CopyToClipboard.mjs.map +1 -1
- package/dist/components/ErrorMessage/ErrorMessage.mjs.map +1 -1
- package/dist/components/FormCheckBox/FormCheckBox.mjs.map +1 -1
- package/dist/components/FormChipCell/FormChip/FormChip.mjs.map +1 -1
- package/dist/components/FormChipCell/FormChipCell.mjs.map +1 -1
- package/dist/components/FormChipCell/FormChipCellView.mjs.map +1 -1
- package/dist/components/FormChipCell/HiddenChipsBlock/HiddenChipsBlock.mjs.map +1 -1
- package/dist/components/FormChipCell/NewChipForm/NewChipForm.mjs +54 -54
- package/dist/components/FormChipCell/NewChipForm/NewChipForm.mjs.map +1 -1
- package/dist/components/FormChipCell/NewChipInput/NewChipInput.mjs.map +1 -1
- package/dist/components/FormChipCell/formChipCell.util.mjs.map +1 -1
- package/dist/components/FormCombobox/FormCombobox.mjs.map +1 -1
- package/dist/components/FormInput/FormInput.mjs.map +1 -1
- package/dist/components/FormInput/InputNumberButtons/InputNumberButtons.mjs.map +1 -1
- package/dist/components/FormKeyValueTable/FormKeyValueTable.mjs.map +1 -1
- package/dist/components/FormOnChange/FormOnChange.mjs.map +1 -1
- package/dist/components/FormRadio/FormRadio.mjs +2 -2
- package/dist/components/FormRadio/FormRadio.mjs.map +1 -1
- package/dist/components/FormSelect/FormSelect.mjs.map +1 -1
- package/dist/components/FormTextarea/FormTextarea.mjs +5 -5
- package/dist/components/FormTextarea/FormTextarea.mjs.map +1 -1
- package/dist/components/FormToggle/FormToggle.mjs.map +1 -1
- package/dist/components/LoadButton/LoadButton.mjs.map +1 -1
- package/dist/components/Loader/Loader.mjs.map +1 -1
- package/dist/components/Loader/LoaderForSuspenseFallback.mjs +2 -2
- package/dist/components/Loader/LoaderForSuspenseFallback.mjs.map +1 -1
- package/dist/components/Modal/Modal.mjs.map +1 -1
- package/dist/components/PopUpDialog/PopUpDialog.mjs.map +1 -1
- package/dist/components/ReadOnlyChips/ReadOnlyChips.mjs.map +1 -1
- package/dist/components/RoundedIcon/RoundedIcon.mjs.map +1 -1
- package/dist/components/TableCell/TableCell.mjs.map +1 -1
- package/dist/components/TabsSlider/TabsSlider.mjs.map +1 -1
- package/dist/components/Tip/Tip.mjs.map +1 -1
- package/dist/components/Tooltip/Tooltip.mjs.map +1 -1
- package/dist/components/TooltipTemplate/TextTooltipTemplate.mjs.map +1 -1
- package/dist/components/Wizard/Wizard.mjs.map +1 -1
- package/dist/components/Wizard/WizardSteps/WizardSteps.mjs.map +1 -1
- package/dist/constants.mjs.map +1 -1
- package/dist/elements/ActionsMenuItem/ActionsMenuItem.mjs.map +1 -1
- package/dist/elements/FormActionButton/FormActionButton.mjs.map +1 -1
- package/dist/elements/FormRowActions/FormRowActions.mjs.map +1 -1
- package/dist/elements/OptionsMenu/OptionsMenu.mjs.map +1 -1
- package/dist/elements/SelectOption/SelectOption.mjs.map +1 -1
- package/dist/elements/TableHead/TableHead.mjs.map +1 -1
- package/dist/elements/TableLinkCell/TableLinkCell.mjs.map +1 -1
- package/dist/elements/TableTypeCell/TableTypeCell.mjs.map +1 -1
- package/dist/elements/ValidationTemplate/ValidationTemplate.mjs.map +1 -1
- package/dist/hooks/useChipCell.hook.mjs +34 -34
- package/dist/hooks/useChipCell.hook.mjs.map +1 -1
- package/dist/hooks/useDebounce.hook.mjs.map +1 -1
- package/dist/hooks/useDetails.hook.mjs.map +1 -1
- package/dist/hooks/useDetailsHeader.hook.mjs.map +1 -1
- package/dist/hooks/useDetectOutsideClick.hook.mjs.map +1 -1
- package/dist/hooks/useFormTable.hook.mjs.map +1 -1
- package/dist/hooks/useHiddenChipsBlock.hook.mjs.map +1 -1
- package/dist/hooks/useTable.hook.mjs.map +1 -1
- package/dist/images/back-arrow.svg.mjs.map +1 -1
- package/dist/images/history.svg.mjs.map +1 -1
- package/dist/images/ml-enlarge.svg.mjs.map +1 -1
- package/dist/images/popout.svg.mjs.map +1 -1
- package/dist/images/question-mark.svg.mjs.map +1 -1
- package/dist/images/warning.svg.mjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/reducers/commonDetailsReducer.mjs.map +1 -1
- package/dist/reducers/notificationReducer.mjs.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/chips.util.mjs.map +1 -1
- package/dist/utils/common.util.mjs.map +1 -1
- package/dist/utils/datetime.util.mjs.map +1 -1
- package/dist/utils/filter.util.mjs.map +1 -1
- package/dist/utils/form.util.mjs.map +1 -1
- package/dist/utils/generateChipsList.util.mjs.map +1 -1
- package/dist/utils/notification.util.mjs.map +1 -1
- package/dist/utils/string.util.mjs.map +1 -1
- package/dist/utils/validation.util.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionsMenu.mjs","sources":["../../../src/lib/components/ActionsMenu/ActionsMenu.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, useRef, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport { isEmpty } from 'lodash'\nimport classnames from 'classnames'\n\nimport ActionsMenuItem from '../../elements/ActionsMenuItem/ActionsMenuItem'\nimport PopUpDialog from '../PopUpDialog/PopUpDialog'\nimport RoundedIcon from '../RoundedIcon/RoundedIcon'\n\nimport { ACTIONS_MENU } from '../../types'\n\nimport ActionMenuIcon from '../../images/elipsis.svg?react'\n\nimport './actionsMenu.scss'\n\nconst ActionsMenu = ({\n dataItem = {},\n menu,\n menuPosition = '',\n time = 100,\n withQuickActions = false\n}) => {\n const [[actionMenu, quickActions], setActionMenuContent] = useState(menu)\n const [isIconDisplayed, setIsIconDisplayed] = useState(false)\n const [isShowMenu, setIsShowMenu] = useState(false)\n const actionMenuRef = useRef()\n const actionMenuBtnRef = useRef()\n const dropDownMenuRef = useRef()\n const mainActionsWrapperRef = useRef()\n\n let idTimeout = null\n\n const actionMenuClassNames = classnames(\n 'actions-menu__container',\n withQuickActions &&\n (actionMenu.length > 0 || quickActions.length > 1) &&\n 'actions-menu__container_extended',\n isShowMenu && 'actions-menu__container-active'\n )\n\n const clickHandler = useCallback(\n event => {\n if (!event.target.closest('.actions-menu-button')) {\n setIsShowMenu(false)\n }\n },\n [setIsShowMenu]\n )\n\n const scrollHandler = useCallback(\n event => {\n if (!event.target.closest('.actions-menu__body')) {\n setIsShowMenu(false)\n }\n },\n [setIsShowMenu]\n )\n\n const onMouseOut = () => {\n if (isShowMenu) {\n idTimeout = setTimeout(() => {\n setIsShowMenu(false)\n }, time)\n }\n }\n\n const handleMouseOver = event => {\n if (mainActionsWrapperRef.current?.contains(event.target)) {\n setIsShowMenu(false)\n }\n\n if (idTimeout) clearTimeout(idTimeout)\n }\n\n useEffect(() => {\n if (!isEmpty(dataItem)) {\n setActionMenuContent(typeof menu === 'function' ? menu(dataItem, menuPosition) : menu)\n }\n }, [dataItem, menu, menuPosition])\n\n useEffect(() => {\n setIsIconDisplayed(actionMenu?.some(menuItem => menuItem.icon))\n }, [actionMenu])\n\n useEffect(() => {\n window.addEventListener('click', clickHandler)\n window.addEventListener('scroll', scrollHandler, true)\n\n return () => {\n window.removeEventListener('click', clickHandler)\n window.removeEventListener('scroll', scrollHandler, true)\n }\n }, [clickHandler, scrollHandler])\n\n return (\n <div\n className={actionMenuClassNames}\n onMouseOut={onMouseOut}\n onMouseOver={handleMouseOver}\n ref={actionMenuRef}\n >\n {withQuickActions && (\n <div className=\"actions-menu__main-actions-wrapper\" ref={mainActionsWrapperRef}>\n {quickActions.map(\n mainAction =>\n !mainAction.hidden && (\n <RoundedIcon\n disabled={mainAction.disabled}\n id={`quick-link-${mainAction.id}`}\n onClick={() => mainAction.onClick(dataItem)}\n tooltipText={mainAction.label}\n key={mainAction.label}\n >\n {mainAction.icon}\n </RoundedIcon>\n )\n )}\n </div>\n )}\n {actionMenu.length > 0 && (\n <div className=\"actions-menu\" data-testid=\"actions-menu\">\n <RoundedIcon\n className=\"actions-menu-button\"\n isActive={isShowMenu}\n id=\"actions-menu-button\"\n onClick={() => {\n setIsShowMenu(prevValue => !prevValue)\n }}\n ref={actionMenuBtnRef}\n tooltipText=\"More actions\"\n >\n <ActionMenuIcon />\n </RoundedIcon>\n {isShowMenu && (\n <PopUpDialog\n className=\"actions-menu__body\"\n customPosition={{\n element: actionMenuBtnRef,\n position: 'bottom-left',\n autoVerticalPosition: true\n }}\n headerIsHidden\n ref={dropDownMenuRef}\n >\n <ul data-testid=\"actions-drop-down-menu\" className=\"actions-menu__list\">\n {actionMenu.map(\n (menuItem, idx) =>\n !menuItem.hidden && (\n <ActionsMenuItem\n dataItem={dataItem}\n index={idx}\n isIconDisplayed={isIconDisplayed}\n key={menuItem.label}\n menuItem={menuItem}\n />\n )\n )}\n </ul>\n </PopUpDialog>\n )}\n </div>\n )}\n </div>\n )\n}\n\nActionsMenu.propTypes = {\n dataItem: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),\n menu: ACTIONS_MENU.isRequired,\n menuPosition: PropTypes.string,\n time: PropTypes.number,\n withQuickActions: PropTypes.bool\n}\n\nexport default ActionsMenu\n"],"names":["ActionsMenu","dataItem","menu","menuPosition","time","withQuickActions","actionMenu","quickActions","setActionMenuContent","useState","isIconDisplayed","setIsIconDisplayed","isShowMenu","setIsShowMenu","actionMenuRef","useRef","actionMenuBtnRef","dropDownMenuRef","mainActionsWrapperRef","idTimeout","actionMenuClassNames","classnames","clickHandler","useCallback","event","scrollHandler","onMouseOut","handleMouseOver","_a","useEffect","isEmpty","menuItem","jsxs","mainAction","jsx","RoundedIcon","prevValue","ActionMenuIcon","PopUpDialog","idx","ActionsMenuItem","PropTypes","ACTIONS_MENU"],"mappings":";;;;;;;;;;;AAkCA,MAAMA,IAAc,CAAC;AAAA,EACnB,UAAAC,IAAW,
|
|
1
|
+
{"version":3,"file":"ActionsMenu.mjs","sources":["../../../src/lib/components/ActionsMenu/ActionsMenu.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, useRef, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport { isEmpty } from 'lodash'\nimport classnames from 'classnames'\n\nimport ActionsMenuItem from '../../elements/ActionsMenuItem/ActionsMenuItem'\nimport PopUpDialog from '../PopUpDialog/PopUpDialog'\nimport RoundedIcon from '../RoundedIcon/RoundedIcon'\n\nimport { ACTIONS_MENU } from '../../types'\n\nimport ActionMenuIcon from '../../images/elipsis.svg?react'\n\nimport './actionsMenu.scss'\n\nconst ActionsMenu = ({\n dataItem = {},\n menu,\n menuPosition = '',\n time = 100,\n withQuickActions = false\n}) => {\n const [[actionMenu, quickActions], setActionMenuContent] = useState(menu)\n const [isIconDisplayed, setIsIconDisplayed] = useState(false)\n const [isShowMenu, setIsShowMenu] = useState(false)\n const actionMenuRef = useRef()\n const actionMenuBtnRef = useRef()\n const dropDownMenuRef = useRef()\n const mainActionsWrapperRef = useRef()\n\n let idTimeout = null\n\n const actionMenuClassNames = classnames(\n 'actions-menu__container',\n withQuickActions &&\n (actionMenu.length > 0 || quickActions.length > 1) &&\n 'actions-menu__container_extended',\n isShowMenu && 'actions-menu__container-active'\n )\n\n const clickHandler = useCallback(\n event => {\n if (!event.target.closest('.actions-menu-button')) {\n setIsShowMenu(false)\n }\n },\n [setIsShowMenu]\n )\n\n const scrollHandler = useCallback(\n event => {\n if (!event.target.closest('.actions-menu__body')) {\n setIsShowMenu(false)\n }\n },\n [setIsShowMenu]\n )\n\n const onMouseOut = () => {\n if (isShowMenu) {\n idTimeout = setTimeout(() => {\n setIsShowMenu(false)\n }, time)\n }\n }\n\n const handleMouseOver = event => {\n if (mainActionsWrapperRef.current?.contains(event.target)) {\n setIsShowMenu(false)\n }\n\n if (idTimeout) clearTimeout(idTimeout)\n }\n\n useEffect(() => {\n if (!isEmpty(dataItem)) {\n setActionMenuContent(typeof menu === 'function' ? menu(dataItem, menuPosition) : menu)\n }\n }, [dataItem, menu, menuPosition])\n\n useEffect(() => {\n setIsIconDisplayed(actionMenu?.some(menuItem => menuItem.icon))\n }, [actionMenu])\n\n useEffect(() => {\n window.addEventListener('click', clickHandler)\n window.addEventListener('scroll', scrollHandler, true)\n\n return () => {\n window.removeEventListener('click', clickHandler)\n window.removeEventListener('scroll', scrollHandler, true)\n }\n }, [clickHandler, scrollHandler])\n\n return (\n <div\n className={actionMenuClassNames}\n onMouseOut={onMouseOut}\n onMouseOver={handleMouseOver}\n ref={actionMenuRef}\n >\n {withQuickActions && (\n <div className=\"actions-menu__main-actions-wrapper\" ref={mainActionsWrapperRef}>\n {quickActions.map(\n mainAction =>\n !mainAction.hidden && (\n <RoundedIcon\n disabled={mainAction.disabled}\n id={`quick-link-${mainAction.id}`}\n onClick={() => mainAction.onClick(dataItem)}\n tooltipText={mainAction.label}\n key={mainAction.label}\n >\n {mainAction.icon}\n </RoundedIcon>\n )\n )}\n </div>\n )}\n {actionMenu.length > 0 && (\n <div className=\"actions-menu\" data-testid=\"actions-menu\">\n <RoundedIcon\n className=\"actions-menu-button\"\n isActive={isShowMenu}\n id=\"actions-menu-button\"\n onClick={() => {\n setIsShowMenu(prevValue => !prevValue)\n }}\n ref={actionMenuBtnRef}\n tooltipText=\"More actions\"\n >\n <ActionMenuIcon />\n </RoundedIcon>\n {isShowMenu && (\n <PopUpDialog\n className=\"actions-menu__body\"\n customPosition={{\n element: actionMenuBtnRef,\n position: 'bottom-left',\n autoVerticalPosition: true\n }}\n headerIsHidden\n ref={dropDownMenuRef}\n >\n <ul data-testid=\"actions-drop-down-menu\" className=\"actions-menu__list\">\n {actionMenu.map(\n (menuItem, idx) =>\n !menuItem.hidden && (\n <ActionsMenuItem\n dataItem={dataItem}\n index={idx}\n isIconDisplayed={isIconDisplayed}\n key={menuItem.label}\n menuItem={menuItem}\n />\n )\n )}\n </ul>\n </PopUpDialog>\n )}\n </div>\n )}\n </div>\n )\n}\n\nActionsMenu.propTypes = {\n dataItem: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),\n menu: ACTIONS_MENU.isRequired,\n menuPosition: PropTypes.string,\n time: PropTypes.number,\n withQuickActions: PropTypes.bool\n}\n\nexport default ActionsMenu\n"],"names":["ActionsMenu","dataItem","menu","menuPosition","time","withQuickActions","actionMenu","quickActions","setActionMenuContent","useState","isIconDisplayed","setIsIconDisplayed","isShowMenu","setIsShowMenu","actionMenuRef","useRef","actionMenuBtnRef","dropDownMenuRef","mainActionsWrapperRef","idTimeout","actionMenuClassNames","classnames","clickHandler","useCallback","event","scrollHandler","onMouseOut","handleMouseOver","_a","useEffect","isEmpty","menuItem","jsxs","mainAction","jsx","RoundedIcon","prevValue","ActionMenuIcon","PopUpDialog","idx","ActionsMenuItem","PropTypes","ACTIONS_MENU"],"mappings":";;;;;;;;;;;AAkCA,MAAMA,IAAc,CAAC;AAAA,EACnB,UAAAC,IAAW,CAAA;AAAA,EACX,MAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,MAAAC,IAAO;AAAA,EACP,kBAAAC,IAAmB;AACrB,MAAM;AACJ,QAAM,CAAC,CAACC,GAAYC,CAAY,GAAGC,CAAoB,IAAIC,EAASP,CAAI,GAClE,CAACQ,GAAiBC,CAAkB,IAAIF,EAAS,EAAK,GACtD,CAACG,GAAYC,CAAa,IAAIJ,EAAS,EAAK,GAC5CK,IAAgBC,EAAA,GAChBC,IAAmBD,EAAA,GACnBE,IAAkBF,EAAA,GAClBG,IAAwBH,EAAA;AAE9B,MAAII,IAAY;AAEhB,QAAMC,IAAuBC;AAAA,IAC3B;AAAA,IACAhB,MACGC,EAAW,SAAS,KAAKC,EAAa,SAAS,MAChD;AAAA,IACFK,KAAc;AAAA,EAAA,GAGVU,IAAeC;AAAA,IACnB,CAAAC,MAAS;AACP,MAAKA,EAAM,OAAO,QAAQ,sBAAsB,KAC9CX,EAAc,EAAK;AAAA,IAEvB;AAAA,IACA,CAACA,CAAa;AAAA,EAAA,GAGVY,IAAgBF;AAAA,IACpB,CAAAC,MAAS;AACP,MAAKA,EAAM,OAAO,QAAQ,qBAAqB,KAC7CX,EAAc,EAAK;AAAA,IAEvB;AAAA,IACA,CAACA,CAAa;AAAA,EAAA,GAGVa,IAAa,MAAM;AACvB,IAAId,MACFO,IAAY,WAAW,MAAM;AAC3B,MAAAN,EAAc,EAAK;AAAA,IACrB,GAAGT,CAAI;AAAA,EAEX,GAEMuB,IAAkB,CAAAH,MAAS;;AAC/B,KAAII,IAAAV,EAAsB,YAAtB,QAAAU,EAA+B,SAASJ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AU;AAAA,cACV,UAAUvB;AAAA,cACV,IAAG;AAAA,cACH,SAAS,MAAM;AACb,gBAAAC,EAAc,CAAAuB,MAAa,CAACA,CAAS;AAAA,cACvC;AAAA,cACA,KAAKpB;AAAA,cACL,aAAY;AAAA,cAEZ,4BAACqB,GAAA,CAAA,CAAe;AAAA,YAAA;AAAA,UAAA;AAAA,UAEjBzB,KACC,gBAAAsB;AAAA,YAACI;AAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,gBAAgB;AAAA,gBACd,SAAStB;AAAA,gBACT,UAAU;AAAA,gBACV,sBAAsB;AAAA,cAAA;AAAA,cAExB,gBAAc;AAAA,cACd,KAAKC;AAAA,cAEL,4BAAC,MAAA,EAAG,eAAY,0BAAyB,WAAU,sBAChD,UAAAX,EAAW;AAAA,gBACV,CAACyB,GAAUQ,MACT,CAACR,EAAS,UACR,gBAAAG;AAAA,kBAACM;AAAA,kBAAA;AAAA,oBACC,UAAAvC;AAAA,oBACA,OAAOsC;AAAA,oBACP,iBAAA7B;AAAA,oBAEA,UAAAqB;AAAA,kBAAA;AAAA,kBADKA,EAAS;AAAA,gBAAA;AAAA,cAEhB,EAEN,CACF;AAAA,YAAA;AAAA,UAAA;AAAA,QACF,EAAA,CAEJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR;AAEA/B,EAAY,YAAY;AAAA,EACtB,UAAUyC,EAAU,UAAU,CAACA,EAAU,QAAQA,EAAU,MAAM,CAAC;AAAA,EAClE,MAAMC,EAAa;AAAA,EACnB,cAAcD,EAAU;AAAA,EACxB,MAAMA,EAAU;AAAA,EAChB,kBAAkBA,EAAU;AAC9B;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Backdrop.mjs","sources":["../../../src/lib/components/Backdrop/Backdrop.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'\n\nimport './Backdrop.scss'\n\nconst Backdrop = ({ duration = 300, show = false, onClose = null }) => {\n const nodeRef = useRef(null)\n\n return (\n <CSSTransition\n nodeRef={nodeRef}\n in={show}\n timeout={duration}\n classNames=\"backdrop-transition\"\n mountOnEnter\n unmountOnExit\n >\n <div className=\"backdrop\" onClick={onClose} ref={nodeRef}></div>\n </CSSTransition>\n )\n}\n\nBackdrop.propTypes = {\n duration: PropTypes.number,\n onClose: PropTypes.func,\n show: PropTypes.bool\n}\n\nexport default Backdrop\n"],"names":["Backdrop","duration","show","onClose","nodeRef","useRef","jsx","CSSTransition","PropTypes"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"Backdrop.mjs","sources":["../../../src/lib/components/Backdrop/Backdrop.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'\n\nimport './Backdrop.scss'\n\nconst Backdrop = ({ duration = 300, show = false, onClose = null }) => {\n const nodeRef = useRef(null)\n\n return (\n <CSSTransition\n nodeRef={nodeRef}\n in={show}\n timeout={duration}\n classNames=\"backdrop-transition\"\n mountOnEnter\n unmountOnExit\n >\n <div className=\"backdrop\" onClick={onClose} ref={nodeRef}></div>\n </CSSTransition>\n )\n}\n\nBackdrop.propTypes = {\n duration: PropTypes.number,\n onClose: PropTypes.func,\n show: PropTypes.bool\n}\n\nexport default Backdrop\n"],"names":["Backdrop","duration","show","onClose","nodeRef","useRef","jsx","CSSTransition","PropTypes"],"mappings":";;;;;AAsBA,MAAMA,IAAW,CAAC,EAAE,UAAAC,IAAW,KAAK,MAAAC,IAAO,IAAO,SAAAC,IAAU,WAAW;AACrE,QAAMC,IAAUC,EAAO,IAAI;AAE3B,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,SAAAH;AAAA,MACA,IAAIF;AAAA,MACJ,SAASD;AAAA,MACT,YAAW;AAAA,MACX,cAAY;AAAA,MACZ,eAAa;AAAA,MAEb,4BAAC,OAAA,EAAI,WAAU,YAAW,SAASE,GAAS,KAAKC,EAAA,CAAS;AAAA,IAAA;AAAA,EAAA;AAGhE;AAEAJ,EAAS,YAAY;AAAA,EACnB,UAAUQ,EAAU;AAAA,EACpB,SAASA,EAAU;AAAA,EACnB,MAAMA,EAAU;AAClB;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockerSpy.mjs","sources":["../../../src/lib/components/BlockerSpy/BlockerSpy.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, { useEffect } from 'react'\nimport PropTypes from 'prop-types'\nimport { useBlocker } from 'react-router-dom'\n\nconst BlockerSpy = ({ setBlocker, shouldBlock }) => {\n const blocker = useBlocker(shouldBlock)\n\n useEffect(() => {\n setBlocker(blocker)\n }, [setBlocker, blocker])\n\n return <></>\n}\n\nBlockerSpy.propTypes = {\n setBlocker: PropTypes.func.isRequired,\n shouldBlock: PropTypes.func.isRequired\n}\n\nexport default BlockerSpy\n"],"names":["BlockerSpy","setBlocker","shouldBlock","blocker","useBlocker","useEffect","jsx","Fragment","PropTypes"],"mappings":";;;;AAuBA,MAAMA,IAAa,CAAC,EAAE,YAAAC,GAAY,aAAAC,QAAkB;
|
|
1
|
+
{"version":3,"file":"BlockerSpy.mjs","sources":["../../../src/lib/components/BlockerSpy/BlockerSpy.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, { useEffect } from 'react'\nimport PropTypes from 'prop-types'\nimport { useBlocker } from 'react-router-dom'\n\nconst BlockerSpy = ({ setBlocker, shouldBlock }) => {\n const blocker = useBlocker(shouldBlock)\n\n useEffect(() => {\n setBlocker(blocker)\n }, [setBlocker, blocker])\n\n return <></>\n}\n\nBlockerSpy.propTypes = {\n setBlocker: PropTypes.func.isRequired,\n shouldBlock: PropTypes.func.isRequired\n}\n\nexport default BlockerSpy\n"],"names":["BlockerSpy","setBlocker","shouldBlock","blocker","useBlocker","useEffect","jsx","Fragment","PropTypes"],"mappings":";;;;AAuBA,MAAMA,IAAa,CAAC,EAAE,YAAAC,GAAY,aAAAC,QAAkB;AAClD,QAAMC,IAAUC,EAAWF,CAAW;AAEtC,SAAAG,EAAU,MAAM;AACd,IAAAJ,EAAWE,CAAO;AAAA,EACpB,GAAG,CAACF,GAAYE,CAAO,CAAC,GAEjB,gBAAAG,EAAAC,GAAA,EAAE;AACX;AAEAP,EAAW,YAAY;AAAA,EACrB,YAAYQ,EAAU,KAAK;AAAA,EAC3B,aAAaA,EAAU,KAAK;AAC9B;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.mjs","sources":["../../../src/lib/components/Button/Button.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 { BUTTON_VARIANTS, DENSITY } from '../../types'\nimport { TERTIARY_BUTTON } from '../../constants'\n\nimport './Button.scss'\n\nlet Button = (\n {\n className = '',\n density = 'normal',\n icon = null,\n iconPosition = 'left',\n id = 'btn',\n label = 'Button',\n tooltip = '',\n variant = TERTIARY_BUTTON,\n ...restProps\n },\n ref\n) => {\n const buttonClassName = classNames('btn', `btn-${variant}`, `btn-${density}`, className)\n\n return (\n <button {...restProps} className={buttonClassName} ref={ref} data-testid={id}>\n {icon && iconPosition === 'left' && icon}\n {(tooltip || label) && (\n <Tooltip template={<TextTooltipTemplate text={tooltip || label} />}>\n {label && <span>{label}</span>}\n </Tooltip>\n )}\n {icon && iconPosition === 'right' && icon}\n </button>\n )\n}\n\nButton = forwardRef(Button)\n\nButton.displayName = 'Button'\n\nButton.propTypes = {\n className: PropTypes.string,\n density: DENSITY,\n icon: PropTypes.element,\n iconPosition: PropTypes.oneOf(['left', 'right']),\n id: PropTypes.string,\n label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n tooltip: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n variant: BUTTON_VARIANTS\n}\n\nexport default Button\n"],"names":["Button","className","density","icon","iconPosition","id","label","tooltip","variant","TERTIARY_BUTTON","restProps","ref","buttonClassName","classNames","jsxs","jsx","Tooltip","TextTooltipTemplate","forwardRef","PropTypes","DENSITY","BUTTON_VARIANTS","Button$1"],"mappings":";;;;;;;;;AA4BA,IAAIA,IAAS,CACX;AAAA,EACE,WAAAC,IAAY;AAAA,EACZ,SAAAC,IAAU;AAAA,EACV,MAAAC,IAAO;AAAA,EACP,cAAAC,IAAe;AAAA,EACf,IAAAC,IAAK;AAAA,EACL,OAAAC,IAAQ;AAAA,EACR,SAAAC,IAAU;AAAA,EACV,SAAAC,IAAUC;AAAA,EACV,GAAGC;AACL,GACAC,MACG;
|
|
1
|
+
{"version":3,"file":"Button.mjs","sources":["../../../src/lib/components/Button/Button.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 { BUTTON_VARIANTS, DENSITY } from '../../types'\nimport { TERTIARY_BUTTON } from '../../constants'\n\nimport './Button.scss'\n\nlet Button = (\n {\n className = '',\n density = 'normal',\n icon = null,\n iconPosition = 'left',\n id = 'btn',\n label = 'Button',\n tooltip = '',\n variant = TERTIARY_BUTTON,\n ...restProps\n },\n ref\n) => {\n const buttonClassName = classNames('btn', `btn-${variant}`, `btn-${density}`, className)\n\n return (\n <button {...restProps} className={buttonClassName} ref={ref} data-testid={id}>\n {icon && iconPosition === 'left' && icon}\n {(tooltip || label) && (\n <Tooltip template={<TextTooltipTemplate text={tooltip || label} />}>\n {label && <span>{label}</span>}\n </Tooltip>\n )}\n {icon && iconPosition === 'right' && icon}\n </button>\n )\n}\n\nButton = forwardRef(Button)\n\nButton.displayName = 'Button'\n\nButton.propTypes = {\n className: PropTypes.string,\n density: DENSITY,\n icon: PropTypes.element,\n iconPosition: PropTypes.oneOf(['left', 'right']),\n id: PropTypes.string,\n label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n tooltip: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n variant: BUTTON_VARIANTS\n}\n\nexport default Button\n"],"names":["Button","className","density","icon","iconPosition","id","label","tooltip","variant","TERTIARY_BUTTON","restProps","ref","buttonClassName","classNames","jsxs","jsx","Tooltip","TextTooltipTemplate","forwardRef","PropTypes","DENSITY","BUTTON_VARIANTS","Button$1"],"mappings":";;;;;;;;;AA4BA,IAAIA,IAAS,CACX;AAAA,EACE,WAAAC,IAAY;AAAA,EACZ,SAAAC,IAAU;AAAA,EACV,MAAAC,IAAO;AAAA,EACP,cAAAC,IAAe;AAAA,EACf,IAAAC,IAAK;AAAA,EACL,OAAAC,IAAQ;AAAA,EACR,SAAAC,IAAU;AAAA,EACV,SAAAC,IAAUC;AAAA,EACV,GAAGC;AACL,GACAC,MACG;AACH,QAAMC,IAAkBC,EAAW,OAAO,OAAOL,CAAO,IAAI,OAAON,CAAO,IAAID,CAAS;AAEvF,SACE,gBAAAa,EAAC,YAAQ,GAAGJ,GAAW,WAAWE,GAAiB,KAAAD,GAAU,eAAaN,GACvE,UAAA;AAAA,IAAAF,KAAQC,MAAiB,UAAUD;AAAA,KAClCI,KAAWD,MACX,gBAAAS,EAACC,GAAA,EAAQ,UAAU,gBAAAD,EAACE,GAAA,EAAoB,MAAMV,KAAWD,GAAO,GAC7D,UAAAA,KAAS,gBAAAS,EAAC,QAAA,EAAM,aAAM,GACzB;AAAA,IAEDZ,KAAQC,MAAiB,WAAWD;AAAA,EAAA,GACvC;AAEJ;AAEAH,IAASkB,EAAWlB,CAAM;AAE1BA,EAAO,cAAc;AAErBA,EAAO,YAAY;AAAA,EACjB,WAAWmB,EAAU;AAAA,EACrB,SAASC;AAAA,EACT,MAAMD,EAAU;AAAA,EAChB,cAAcA,EAAU,MAAM,CAAC,QAAQ,OAAO,CAAC;AAAA,EAC/C,IAAIA,EAAU;AAAA,EACd,OAAOA,EAAU,UAAU,CAACA,EAAU,QAAQA,EAAU,OAAO,CAAC;AAAA,EAChE,SAASA,EAAU,UAAU,CAACA,EAAU,QAAQA,EAAU,OAAO,CAAC;AAAA,EAClE,SAASE;AACX;AAEA,MAAAC,IAAetB;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmDialog.mjs","sources":["../../../src/lib/components/ConfirmDialog/ConfirmDialog.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'\n\nimport Button from '../Button/Button'\nimport PopUpDialog from '../PopUpDialog/PopUpDialog'\n\nimport {\n CONFIRM_DIALOG_CANCEL_BUTTON,\n CONFIRM_DIALOG_MESSAGE,\n CONFIRM_DIALOG_SUBMIT_BUTTON\n} from '../../types'\n\nimport './confirmDialog.scss'\n\nconst ConfirmDialog = ({\n cancelButton = null,\n children = null,\n className = '',\n closePopUp = null,\n confirmButton = null,\n customPosition = {},\n header = '',\n isOpen = false,\n message = '',\n messageOnly = false,\n onResolve = null\n}) => {\n const messageClassNames = classnames(\n 'confirm-dialog__message',\n messageOnly && 'confirm-dialog__message-only'\n )\n\n const handleCancelDialog = event => {\n onResolve && onResolve()\n cancelButton.handler && cancelButton.handler(event)\n }\n\n const handleCloseDialog = event => {\n onResolve && onResolve()\n closePopUp && closePopUp(event)\n }\n\n const handleConfirmDialog = event => {\n onResolve && onResolve()\n confirmButton.handler && confirmButton.handler(event)\n }\n\n return (\n isOpen && (\n <PopUpDialog\n className={className}\n closePopUp={handleCloseDialog}\n customPosition={customPosition}\n headerText={header}\n >\n <div className=\"confirm-dialog\">\n {message && <div className={messageClassNames}>{message}</div>}\n {children && <div className=\"confirm-dialog__body\">{children}</div>}\n <div className=\"confirm-dialog__btn-container\">\n {cancelButton && (\n <Button\n className=\"pop-up-dialog__btn_cancel\"\n label={cancelButton.label}\n onClick={handleCancelDialog}\n variant={cancelButton.variant}\n disabled={cancelButton.disabled}\n />\n )}\n {confirmButton && (\n <Button\n label={confirmButton.label}\n onClick={handleConfirmDialog}\n variant={confirmButton.variant}\n disabled={confirmButton.disabled}\n />\n )}\n </div>\n </div>\n </PopUpDialog>\n )\n )\n}\n\nConfirmDialog.propTypes = {\n cancelButton: CONFIRM_DIALOG_CANCEL_BUTTON,\n children: PropTypes.node,\n className: PropTypes.string,\n closePopUp: PropTypes.func,\n confirmButton: CONFIRM_DIALOG_SUBMIT_BUTTON,\n customPosition: PropTypes.object,\n header: PropTypes.string,\n isOpen: PropTypes.bool,\n message: CONFIRM_DIALOG_MESSAGE,\n messageOnly: PropTypes.bool,\n onResolve: PropTypes.func\n}\n\nexport default ConfirmDialog\n"],"names":["ConfirmDialog","cancelButton","children","className","closePopUp","confirmButton","customPosition","header","isOpen","message","messageOnly","onResolve","messageClassNames","classnames","handleCancelDialog","event","handleCloseDialog","handleConfirmDialog","jsx","PopUpDialog","jsxs","Button","CONFIRM_DIALOG_CANCEL_BUTTON","PropTypes","CONFIRM_DIALOG_SUBMIT_BUTTON","CONFIRM_DIALOG_MESSAGE"],"mappings":";;;;;;;;AA+BA,MAAMA,IAAgB,CAAC;AAAA,EACrB,cAAAC,IAAe;AAAA,EACf,UAAAC,IAAW;AAAA,EACX,WAAAC,IAAY;AAAA,EACZ,YAAAC,IAAa;AAAA,EACb,eAAAC,IAAgB;AAAA,EAChB,gBAAAC,IAAiB,
|
|
1
|
+
{"version":3,"file":"ConfirmDialog.mjs","sources":["../../../src/lib/components/ConfirmDialog/ConfirmDialog.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'\n\nimport Button from '../Button/Button'\nimport PopUpDialog from '../PopUpDialog/PopUpDialog'\n\nimport {\n CONFIRM_DIALOG_CANCEL_BUTTON,\n CONFIRM_DIALOG_MESSAGE,\n CONFIRM_DIALOG_SUBMIT_BUTTON\n} from '../../types'\n\nimport './confirmDialog.scss'\n\nconst ConfirmDialog = ({\n cancelButton = null,\n children = null,\n className = '',\n closePopUp = null,\n confirmButton = null,\n customPosition = {},\n header = '',\n isOpen = false,\n message = '',\n messageOnly = false,\n onResolve = null\n}) => {\n const messageClassNames = classnames(\n 'confirm-dialog__message',\n messageOnly && 'confirm-dialog__message-only'\n )\n\n const handleCancelDialog = event => {\n onResolve && onResolve()\n cancelButton.handler && cancelButton.handler(event)\n }\n\n const handleCloseDialog = event => {\n onResolve && onResolve()\n closePopUp && closePopUp(event)\n }\n\n const handleConfirmDialog = event => {\n onResolve && onResolve()\n confirmButton.handler && confirmButton.handler(event)\n }\n\n return (\n isOpen && (\n <PopUpDialog\n className={className}\n closePopUp={handleCloseDialog}\n customPosition={customPosition}\n headerText={header}\n >\n <div className=\"confirm-dialog\">\n {message && <div className={messageClassNames}>{message}</div>}\n {children && <div className=\"confirm-dialog__body\">{children}</div>}\n <div className=\"confirm-dialog__btn-container\">\n {cancelButton && (\n <Button\n className=\"pop-up-dialog__btn_cancel\"\n label={cancelButton.label}\n onClick={handleCancelDialog}\n variant={cancelButton.variant}\n disabled={cancelButton.disabled}\n />\n )}\n {confirmButton && (\n <Button\n label={confirmButton.label}\n onClick={handleConfirmDialog}\n variant={confirmButton.variant}\n disabled={confirmButton.disabled}\n />\n )}\n </div>\n </div>\n </PopUpDialog>\n )\n )\n}\n\nConfirmDialog.propTypes = {\n cancelButton: CONFIRM_DIALOG_CANCEL_BUTTON,\n children: PropTypes.node,\n className: PropTypes.string,\n closePopUp: PropTypes.func,\n confirmButton: CONFIRM_DIALOG_SUBMIT_BUTTON,\n customPosition: PropTypes.object,\n header: PropTypes.string,\n isOpen: PropTypes.bool,\n message: CONFIRM_DIALOG_MESSAGE,\n messageOnly: PropTypes.bool,\n onResolve: PropTypes.func\n}\n\nexport default ConfirmDialog\n"],"names":["ConfirmDialog","cancelButton","children","className","closePopUp","confirmButton","customPosition","header","isOpen","message","messageOnly","onResolve","messageClassNames","classnames","handleCancelDialog","event","handleCloseDialog","handleConfirmDialog","jsx","PopUpDialog","jsxs","Button","CONFIRM_DIALOG_CANCEL_BUTTON","PropTypes","CONFIRM_DIALOG_SUBMIT_BUTTON","CONFIRM_DIALOG_MESSAGE"],"mappings":";;;;;;;;AA+BA,MAAMA,IAAgB,CAAC;AAAA,EACrB,cAAAC,IAAe;AAAA,EACf,UAAAC,IAAW;AAAA,EACX,WAAAC,IAAY;AAAA,EACZ,YAAAC,IAAa;AAAA,EACb,eAAAC,IAAgB;AAAA,EAChB,gBAAAC,IAAiB,CAAA;AAAA,EACjB,QAAAC,IAAS;AAAA,EACT,QAAAC,IAAS;AAAA,EACT,SAAAC,IAAU;AAAA,EACV,aAAAC,IAAc;AAAA,EACd,WAAAC,IAAY;AACd,MAAM;AACJ,QAAMC,IAAoBC;AAAA,IACxB;AAAA,IACAH,KAAe;AAAA,EAAA,GAGXI,IAAqB,CAAAC,MAAS;AAClC,IAAAJ,KAAaA,EAAA,GACbV,EAAa,WAAWA,EAAa,QAAQc,CAAK;AAAA,EACpD,GAEMC,IAAoB,CAAAD,MAAS;AACjC,IAAAJ,KAAaA,EA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U;AAAA,EACvB,WAAWA,EAAU;AACvB;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CopyToClipboard.mjs","sources":["../../../src/lib/components/CopyToClipboard/CopyToClipboard.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 PropTypes from 'prop-types'\nimport { useMemo } from 'react'\nimport { useDispatch } from 'react-redux'\n\nimport RoundedIcon from '../RoundedIcon/RoundedIcon'\nimport TextTooltipTemplate from '../TooltipTemplate/TextTooltipTemplate'\nimport Tooltip from '../Tooltip/Tooltip'\n\nimport { setNotification } from '../../reducers/notificationReducer'\nimport { showErrorNotification } from '../../utils/notification.util'\n\nimport Copy from '../../images/copy-to-clipboard-icon.svg?react'\n\nconst CopyToClipboard = ({\n children = null,\n className = '',\n disabled = false,\n textToCopy = '',\n tooltipText\n}) => {\n const dispatch = useDispatch()\n const copyIsDisabled = useMemo(() => disabled || !textToCopy, [disabled, textToCopy])\n\n const copyToClipboard = textToCopy => {\n navigator.clipboard\n .writeText(textToCopy)\n .then(() => {\n dispatch(\n setNotification({\n status: 200,\n id: Math.random(),\n message: 'Copied to clipboard successfully'\n })\n )\n })\n .catch(error => {\n showErrorNotification(dispatch, error, '', 'Copy to clipboard failed')\n })\n }\n\n return (\n <div className={className} data-testid=\"copy-to-clipboard\">\n {children ? (\n <Tooltip template={<TextTooltipTemplate text={tooltipText} />} textShow>\n <span onClick={() => copyToClipboard(textToCopy)}>{children}</span>\n </Tooltip>\n ) : (\n <RoundedIcon\n tooltipText={tooltipText}\n onClick={() => copyToClipboard(textToCopy)}\n disabled={copyIsDisabled}\n >\n <Copy />\n </RoundedIcon>\n )}\n </div>\n )\n}\n\nCopyToClipboard.propTypes = {\n children: PropTypes.oneOfType([PropTypes.string, PropTypes.array, PropTypes.element]),\n className: PropTypes.string,\n disabled: PropTypes.bool,\n textToCopy: PropTypes.string,\n tooltipText: PropTypes.string.isRequired\n}\n\nexport default CopyToClipboard\n"],"names":["CopyToClipboard","children","className","disabled","textToCopy","tooltipText","dispatch","useDispatch","copyIsDisabled","useMemo","copyToClipboard","setNotification","error","showErrorNotification","jsx","Tooltip","TextTooltipTemplate","RoundedIcon","Copy","PropTypes"],"mappings":";;;;;;;;;;AAgCA,MAAMA,IAAkB,CAAC;AAAA,EACvB,UAAAC,IAAW;AAAA,EACX,WAAAC,IAAY;AAAA,EACZ,UAAAC,IAAW;AAAA,EACX,YAAAC,IAAa;AAAA,EACb,aAAAC;AACF,MAAM;AACJ,QAAMC,IAAWC,
|
|
1
|
+
{"version":3,"file":"CopyToClipboard.mjs","sources":["../../../src/lib/components/CopyToClipboard/CopyToClipboard.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 PropTypes from 'prop-types'\nimport { useMemo } from 'react'\nimport { useDispatch } from 'react-redux'\n\nimport RoundedIcon from '../RoundedIcon/RoundedIcon'\nimport TextTooltipTemplate from '../TooltipTemplate/TextTooltipTemplate'\nimport Tooltip from '../Tooltip/Tooltip'\n\nimport { setNotification } from '../../reducers/notificationReducer'\nimport { showErrorNotification } from '../../utils/notification.util'\n\nimport Copy from '../../images/copy-to-clipboard-icon.svg?react'\n\nconst CopyToClipboard = ({\n children = null,\n className = '',\n disabled = false,\n textToCopy = '',\n tooltipText\n}) => {\n const dispatch = useDispatch()\n const copyIsDisabled = useMemo(() => disabled || !textToCopy, [disabled, textToCopy])\n\n const copyToClipboard = textToCopy => {\n navigator.clipboard\n .writeText(textToCopy)\n .then(() => {\n dispatch(\n setNotification({\n status: 200,\n id: Math.random(),\n message: 'Copied to clipboard successfully'\n })\n )\n })\n .catch(error => {\n showErrorNotification(dispatch, error, '', 'Copy to clipboard failed')\n })\n }\n\n return (\n <div className={className} data-testid=\"copy-to-clipboard\">\n {children ? (\n <Tooltip template={<TextTooltipTemplate text={tooltipText} />} textShow>\n <span onClick={() => copyToClipboard(textToCopy)}>{children}</span>\n </Tooltip>\n ) : (\n <RoundedIcon\n tooltipText={tooltipText}\n onClick={() => copyToClipboard(textToCopy)}\n disabled={copyIsDisabled}\n >\n <Copy />\n </RoundedIcon>\n )}\n </div>\n )\n}\n\nCopyToClipboard.propTypes = {\n children: PropTypes.oneOfType([PropTypes.string, PropTypes.array, PropTypes.element]),\n className: PropTypes.string,\n disabled: PropTypes.bool,\n textToCopy: PropTypes.string,\n tooltipText: PropTypes.string.isRequired\n}\n\nexport default CopyToClipboard\n"],"names":["CopyToClipboard","children","className","disabled","textToCopy","tooltipText","dispatch","useDispatch","copyIsDisabled","useMemo","copyToClipboard","setNotification","error","showErrorNotification","jsx","Tooltip","TextTooltipTemplate","RoundedIcon","Copy","PropTypes"],"mappings":";;;;;;;;;;AAgCA,MAAMA,IAAkB,CAAC;AAAA,EACvB,UAAAC,IAAW;AAAA,EACX,WAAAC,IAAY;AAAA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ources":["../../../src/lib/components/ErrorMessage/ErrorMessage.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'\n\nimport Tooltip from '../Tooltip/Tooltip'\nimport TextTooltipTemplate from '../TooltipTemplate/TextTooltipTemplate'\n\nimport UnsuccessAlert from '../../images/unsuccess_alert.svg?react'\nimport Close from '../../images/close.svg?react'\n\nimport './errorMessage.scss'\n\nconst ErrorMessage = ({ closeError = null, message }) => {\n return (\n <div data-testid=\"error-message\" className=\"error\">\n <div className=\"error__data\">\n <div>\n <UnsuccessAlert className=\"error__icon\" />\n </div>\n <div className=\"error__message\">{message}</div>\n </div>\n {closeError && (\n <button data-testid=\"close\" onClick={closeError}>\n <Tooltip template={<TextTooltipTemplate text=\"Close\" />}>\n <Close />\n </Tooltip>\n </button>\n )}\n </div>\n )\n}\n\nErrorMessage.propTypes = {\n closeError: PropTypes.func,\n message: PropTypes.string.isRequired\n}\n\nexport default ErrorMessage\n"],"names":["ErrorMessage","closeError","message","jsxs","jsx","UnsuccessAlert","Tooltip","TextTooltipTemplate","Close","PropTypes"],"mappings":";;;;;;;;AA8BA,MAAMA,IAAe,CAAC,EAAE,YAAAC,IAAa,MAAM,SAAAC,
|
|
1
|
+
{"version":3,"file":"ErrorMessage.mjs","sources":["../../../src/lib/components/ErrorMessage/ErrorMessage.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'\n\nimport Tooltip from '../Tooltip/Tooltip'\nimport TextTooltipTemplate from '../TooltipTemplate/TextTooltipTemplate'\n\nimport UnsuccessAlert from '../../images/unsuccess_alert.svg?react'\nimport Close from '../../images/close.svg?react'\n\nimport './errorMessage.scss'\n\nconst ErrorMessage = ({ closeError = null, message }) => {\n return (\n <div data-testid=\"error-message\" className=\"error\">\n <div className=\"error__data\">\n <div>\n <UnsuccessAlert className=\"error__icon\" />\n </div>\n <div className=\"error__message\">{message}</div>\n </div>\n {closeError && (\n <button data-testid=\"close\" onClick={closeError}>\n <Tooltip template={<TextTooltipTemplate text=\"Close\" />}>\n <Close />\n </Tooltip>\n </button>\n )}\n </div>\n )\n}\n\nErrorMessage.propTypes = {\n closeError: PropTypes.func,\n message: PropTypes.string.isRequired\n}\n\nexport default ErrorMessage\n"],"names":["ErrorMessage","closeError","message","jsxs","jsx","UnsuccessAlert","Tooltip","TextTooltipTemplate","Close","PropTypes"],"mappings":";;;;;;;;AA8BA,MAAMA,IAAe,CAAC,EAAE,YAAAC,IAAa,MAAM,SAAAC,QAEvC,gBAAAC,EAAC,OAAA,EAAI,eAAY,iBAAgB,WAAU,SACzC,UAAA;AAAA,EAAA,gBAAAA,EAAC,OAAA,EAAI,WAAU,eACb,UAAA;AAAA,IAAA,gBAAAC,EAAC,OAAA,EACC,UAAA,gBAAAA,EAACC,GAAA,EAAe,WAAU,eAAc,GAC1C;AAAA,IACA,gBAAAD,EAAC,OAAA,EAAI,WAAU,kBAAkB,UAAAF,EAAA,CAAQ;AAAA,EAAA,GAC3C;AAAA,EACCD,KACC,gBAAAG,EAAC,UAAA,EAAO,eAAY,SAAQ,SAASH,GACnC,UAAA,gBAAAG,EAACE,GAAA,EAAQ,UAAU,gBAAAF,EAACG,KAAoB,MAAK,QAAA,CAAQ,GACnD,UAAA,gBAAAH,EAACI,GAAA,CAAA,CAAM,GACT,EAAA,CACF;AAAA,GAEJ;AAIJR,EAAa,YAAY;AAAA,EACvB,YAAYS,EAAU;AAAA,EACtB,SAASA,EAAU,OAAO;AAC5B;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormCheckBox.mjs","sources":["../../../src/lib/components/FormCheckBox/FormCheckBox.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 { Field } from 'react-final-form'\nimport classNames from 'classnames'\n\nimport './formCheckBox.scss'\n\nlet FormCheckBox = ({\n children = null,\n className = '',\n highlightLabel = false,\n label = '',\n name,\n readOnly = false,\n ...inputProps\n}) => {\n const formFieldClassNames = classNames(\n 'form-field-checkbox',\n readOnly && 'form-field-checkbox_readonly',\n className\n )\n const labelClassNames = classNames(highlightLabel && 'highlighted')\n const inputRef = useRef(null)\n\n return (\n <Field name={name} value={inputProps.value} type=\"checkbox\">\n {({ input }) => {\n return (\n <div className={formFieldClassNames} data-testid=\"form-field-checkbox\">\n <input\n ref={inputRef}\n className={classNames(input.checked ? 'checked' : 'unchecked')}\n type=\"checkbox\"\n data-testid={name ? `${name}-form-checkbox` : 'form-checkbox'}\n id={inputProps.value ?? name}\n {...{ ...input, ...inputProps }}\n value={String(input.checked)}\n />\n <label htmlFor={inputProps.value ?? name} className={labelClassNames}>\n {label ? label : ''}\n {children}\n </label>\n </div>\n )\n }}\n </Field>\n )\n}\n\nFormCheckBox.propTypes = {\n children: PropTypes.node,\n className: PropTypes.string,\n highlightLabel: PropTypes.bool,\n label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n name: PropTypes.string.isRequired,\n readOnly: PropTypes.bool\n}\n\nFormCheckBox = React.memo(FormCheckBox)\n\nexport default FormCheckBox\n"],"names":["FormCheckBox","children","className","highlightLabel","label","name","readOnly","inputProps","formFieldClassNames","classNames","labelClassNames","inputRef","useRef","jsx","Field","input","jsxs","PropTypes","React","FormCheckBox$1"],"mappings":";;;;;;AAuBA,IAAIA,IAAe,CAAC;AAAA,EAClB,UAAAC,IAAW;AAAA,EACX,WAAAC,IAAY;AAAA,EACZ,gBAAAC,IAAiB;AAAA,EACjB,OAAAC,IAAQ;AAAA,EACR,MAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAsBC;AAAAA,IAC1B;AAAA,IACAH,KAAY;AAAA,IACZJ;AAAA,
|
|
1
|
+
{"version":3,"file":"FormCheckBox.mjs","sources":["../../../src/lib/components/FormCheckBox/FormCheckBox.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 { Field } from 'react-final-form'\nimport classNames from 'classnames'\n\nimport './formCheckBox.scss'\n\nlet FormCheckBox = ({\n children = null,\n className = '',\n highlightLabel = false,\n label = '',\n name,\n readOnly = false,\n ...inputProps\n}) => {\n const formFieldClassNames = classNames(\n 'form-field-checkbox',\n readOnly && 'form-field-checkbox_readonly',\n className\n )\n const labelClassNames = classNames(highlightLabel && 'highlighted')\n const inputRef = useRef(null)\n\n return (\n <Field name={name} value={inputProps.value} type=\"checkbox\">\n {({ input }) => {\n return (\n <div className={formFieldClassNames} data-testid=\"form-field-checkbox\">\n <input\n ref={inputRef}\n className={classNames(input.checked ? 'checked' : 'unchecked')}\n type=\"checkbox\"\n data-testid={name ? `${name}-form-checkbox` : 'form-checkbox'}\n id={inputProps.value ?? name}\n {...{ ...input, ...inputProps }}\n value={String(input.checked)}\n />\n <label htmlFor={inputProps.value ?? name} className={labelClassNames}>\n {label ? label : ''}\n {children}\n </label>\n </div>\n )\n }}\n </Field>\n )\n}\n\nFormCheckBox.propTypes = {\n children: PropTypes.node,\n className: PropTypes.string,\n highlightLabel: PropTypes.bool,\n label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n name: PropTypes.string.isRequired,\n readOnly: PropTypes.bool\n}\n\nFormCheckBox = React.memo(FormCheckBox)\n\nexport default FormCheckBox\n"],"names":["FormCheckBox","children","className","highlightLabel","label","name","readOnly","inputProps","formFieldClassNames","classNames","labelClassNames","inputRef","useRef","jsx","Field","input","jsxs","PropTypes","React","FormCheckBox$1"],"mappings":";;;;;;AAuB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IAAekB,EAAM,KAAKlB,CAAY;AAEtC,MAAAmB,IAAenB;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormChip.mjs","sources":["../../../../src/lib/components/FormChipCell/FormChip/FormChip.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, { useLayoutEffect, forwardRef } from 'react'\nimport PropTypes from 'prop-types'\n\nimport NewChipForm from '../NewChipForm/NewChipForm'\n\nimport { CHIP_OPTIONS } from '../../../types'\n\nimport './formChip.scss'\n\nlet FormChip = (\n {\n chip,\n chipIndex,\n chipSizeIsRecalculated,\n setChipSizeIsRecalculated,\n chipOptions = {\n background: 'purple',\n boldValue: false,\n borderRadius: 'primary',\n borderColor: 'transparent',\n density: 'dense',\n font: 'purple'\n },\n editConfig,\n handleEditChip,\n handleRemoveChip,\n handleToEditMode,\n isDeletable = false,\n isEditable = false,\n keyName = '',\n meta,\n setChipsSizes,\n setEditConfig,\n validationRules = {},\n valueName = ''\n },\n ref\n) => {\n const chipRef = React.useRef()\n useLayoutEffect(() => {\n if (chipRef.current && setChipsSizes && chipSizeIsRecalculated) {\n setChipsSizes(state => ({\n ...state,\n [chipIndex]: chipRef.current?.getBoundingClientRect?.()?.width ?? 50\n }))\n }\n }, [chipIndex, chipSizeIsRecalculated, setChipsSizes])\n\n return (\n <div onClick={event => handleToEditMode(event, chipIndex, keyName)} ref={chipRef}>\n <NewChipForm\n chip={chip}\n chipIndex={chipIndex}\n chipOptions={chipOptions}\n className=\"input-label-key\"\n editConfig={editConfig}\n handleRemoveChip={handleRemoveChip}\n isDeletable={isDeletable}\n isEditable={isEditable}\n keyName={keyName}\n meta={meta}\n onChange={handleEditChip}\n ref={ref}\n setChipSizeIsRecalculated={setChipSizeIsRecalculated}\n setEditConfig={setEditConfig}\n validationRules={validationRules}\n valueName={valueName}\n />\n </div>\n )\n}\n\nFormChip = forwardRef(FormChip)\n\nFormChip.displayName = 'FormChip'\n\nFormChip.propTypes = {\n chip: PropTypes.object.isRequired,\n chipSizeIsRecalculated: PropTypes.bool.isRequired,\n setChipSizeIsRecalculated: PropTypes.func.isRequired,\n chipIndex: PropTypes.number.isRequired,\n chipOptions: CHIP_OPTIONS,\n editConfig: PropTypes.object.isRequired,\n handleEditChip: PropTypes.func.isRequired,\n handleRemoveChip: PropTypes.func.isRequired,\n handleToEditMode: PropTypes.func.isRequired,\n isDeletable: PropTypes.bool,\n isEditable: PropTypes.bool,\n keyName: PropTypes.string,\n meta: PropTypes.object.isRequired,\n setChipsSizes: PropTypes.func.isRequired,\n setEditConfig: PropTypes.func.isRequired,\n validationRules: PropTypes.object,\n valueName: PropTypes.string\n}\n\nexport default FormChip\n"],"names":["FormChip","chip","chipIndex","chipSizeIsRecalculated","setChipSizeIsRecalculated","chipOptions","editConfig","handleEditChip","handleRemoveChip","handleToEditMode","isDeletable","isEditable","keyName","meta","setChipsSizes","setEditConfig","validationRules","valueName","ref","chipRef","React","useLayoutEffect","state","_c","_b","_a","jsx","event","NewChipForm","forwardRef","PropTypes","CHIP_OPTIONS","FormChip$1"],"mappings":";;;;;;AAyBA,IAAIA,IAAW,CACb;AAAA,EACE,MAAAC;AAAA,EACA,WAAAC;AAAA,EACA,wBAAAC;AAAA,EACA,2BAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,IACZ,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,aAAa;AAAA,IACb,SAAS;AAAA,IACT,MAAM;AAAA,
|
|
1
|
+
{"version":3,"file":"FormChip.mjs","sources":["../../../../src/lib/components/FormChipCell/FormChip/FormChip.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, { useLayoutEffect, forwardRef } from 'react'\nimport PropTypes from 'prop-types'\n\nimport NewChipForm from '../NewChipForm/NewChipForm'\n\nimport { CHIP_OPTIONS } from '../../../types'\n\nimport './formChip.scss'\n\nlet FormChip = (\n {\n chip,\n chipIndex,\n chipSizeIsRecalculated,\n setChipSizeIsRecalculated,\n chipOptions = {\n background: 'purple',\n boldValue: false,\n borderRadius: 'primary',\n borderColor: 'transparent',\n density: 'dense',\n font: 'purple'\n },\n editConfig,\n handleEditChip,\n handleRemoveChip,\n handleToEditMode,\n isDeletable = false,\n isEditable = false,\n keyName = '',\n meta,\n setChipsSizes,\n setEditConfig,\n validationRules = {},\n valueName = ''\n },\n ref\n) => {\n const chipRef = React.useRef()\n useLayoutEffect(() => {\n if (chipRef.current && setChipsSizes && chipSizeIsRecalculated) {\n setChipsSizes(state => ({\n ...state,\n [chipIndex]: chipRef.current?.getBoundingClientRect?.()?.width ?? 50\n }))\n }\n }, [chipIndex, chipSizeIsRecalculated, setChipsSizes])\n\n return (\n <div onClick={event => handleToEditMode(event, chipIndex, keyName)} ref={chipRef}>\n <NewChipForm\n chip={chip}\n chipIndex={chipIndex}\n chipOptions={chipOptions}\n className=\"input-label-key\"\n editConfig={editConfig}\n handleRemoveChip={handleRemoveChip}\n isDeletable={isDeletable}\n isEditable={isEditable}\n keyName={keyName}\n meta={meta}\n onChange={handleEditChip}\n ref={ref}\n setChipSizeIsRecalculated={setChipSizeIsRecalculated}\n setEditConfig={setEditConfig}\n validationRules={validationRules}\n valueName={valueName}\n />\n </div>\n )\n}\n\nFormChip = forwardRef(FormChip)\n\nFormChip.displayName = 'FormChip'\n\nFormChip.propTypes = {\n chip: PropTypes.object.isRequired,\n chipSizeIsRecalculated: PropTypes.bool.isRequired,\n setChipSizeIsRecalculated: PropTypes.func.isRequired,\n chipIndex: PropTypes.number.isRequired,\n chipOptions: CHIP_OPTIONS,\n editConfig: PropTypes.object.isRequired,\n handleEditChip: PropTypes.func.isRequired,\n handleRemoveChip: PropTypes.func.isRequired,\n handleToEditMode: PropTypes.func.isRequired,\n isDeletable: PropTypes.bool,\n isEditable: PropTypes.bool,\n keyName: PropTypes.string,\n meta: PropTypes.object.isRequired,\n setChipsSizes: PropTypes.func.isRequired,\n setEditConfig: PropTypes.func.isRequired,\n validationRules: PropTypes.object,\n valueName: PropTypes.string\n}\n\nexport default FormChip\n"],"names":["FormChip","chip","chipIndex","chipSizeIsRecalculated","setChipSizeIsRecalculated","chipOptions","editConfig","handleEditChip","handleRemoveChip","handleToEditMode","isDeletable","isEditable","keyName","meta","setChipsSizes","setEditConfig","validationRules","valueName","ref","chipRef","React","useLayoutEffect","state","_c","_b","_a","jsx","event","NewChipForm","forwardRef","PropTypes","CHIP_OPTIONS","FormChip$1"],"mappings":";;;;;;AAyBA,IAAIA,IAAW,CACb;AAAA,EACE,MAAAC;AAAA,EACA,WAAAC;AAAA,EACA,wBAAAC;AAAA,EACA,2BAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,IACZ,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,aAAa;AAAA,IACb,SAAS;AAAA,IACT,MAAM;AAA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AA,EACvB,wBAAwBA,EAAU,KAAK;AAAA,EACvC,2BAA2BA,EAAU,KAAK;AAAA,EAC1C,WAAWA,EAAU,OAAO;AAAA,EAC5B,aAAaC;AAAA,EACb,YAAYD,EAAU,OAAO;AAAA,EAC7B,gBAAgBA,EAAU,KAAK;AAAA,EAC/B,kBAAkBA,EAAU,KAAK;AAAA,EACjC,kBAAkBA,EAAU,KAAK;AAAA,EACjC,aAAaA,EAAU;AAAA,EACvB,YAAYA,EAAU;AAAA,EACtB,SAASA,EAAU;AAAA,EACnB,MAAMA,EAAU,OAAO;AAAA,EACvB,eAAeA,EAAU,KAAK;AAAA,EAC9B,eAAeA,EAAU,KAAK;AAAA,EAC9B,iBAAiBA,EAAU;AAAA,EAC3B,WAAWA,EAAU;AACvB;AAEA,MAAAE,IAAehC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormChipCell.mjs","sources":["../../../src/lib/components/FormChipCell/FormChipCell.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, useCallback, useMemo } from 'react'\nimport lodash, { get, isEmpty, set, isNil } from 'lodash'\nimport classnames from 'classnames'\nimport PropTypes from 'prop-types'\n\nimport FormChipCellView from './FormChipCellView'\n\nimport { CHIP_OPTIONS, VISIBLE_CHIPS_MAX_LENGTH } from '../../types'\nimport { CLICK, TAB, TAB_SHIFT } from '../../constants'\nimport { areArraysEqual } from '../../utils/common.util'\nimport { checkPatternsValidity } from '../../utils/validation.util'\nimport { generateChipsList } from '../../utils/generateChipsList.util'\nimport { uniquenessError } from './formChipCell.util'\nimport { useChipCell } from '../../hooks'\n\nimport './formChipCell.scss'\n\nlet FormChipCell = ({\n chipOptions = {\n background: 'purple',\n boldValue: false,\n borderRadius: 'primary',\n borderColor: 'transparent',\n density: 'dense',\n font: 'purple'\n },\n className = '',\n children,\n delimiter = null,\n formState,\n initialValues,\n isDeletable = false,\n isEditable = false,\n label = null,\n name,\n onClick = () => {},\n onExitEditModeCallback = null,\n shortChips = false,\n validationRules = {},\n validator = null,\n visibleChipsMaxLength = null,\n withInitialParentWidth = false\n}) => {\n const chipsClassName = classnames('chips', className)\n const [chipSizeIsRecalculated, setChipSizeIsRecalculated] = useState(false)\n const {\n chipsCellRef,\n chipsWrapperRef,\n handleShowElements,\n hiddenChipsCounterRef,\n hiddenChipsPopUpRef,\n setChipsSizes,\n setShowHiddenChips,\n showChips,\n showHiddenChips,\n visibleChipsCount\n } = useChipCell(isEditable, visibleChipsMaxLength, withInitialParentWidth)\n\n const [editConfig, setEditConfig] = useState({\n chipIndex: null,\n isEdit: false,\n isKeyFocused: false,\n isValueFocused: false,\n isNewChip: false\n })\n\n let chips = useMemo(() => {\n return isEditable || visibleChipsMaxLength === 'all'\n ? {\n visibleChips: get(formState.values, name),\n hiddenChips: []\n }\n : generateChipsList(\n get(formState.values, name),\n visibleChipsMaxLength ? visibleChipsMaxLength : visibleChipsCount\n )\n }, [visibleChipsMaxLength, isEditable, visibleChipsCount, formState.values, name])\n\n const checkChipsList = useCallback(\n currentChipsList => {\n if (areArraysEqual(get(initialValues, name), currentChipsList, ['id'])) {\n set(formState.initialValues, name, currentChipsList)\n }\n\n formState.form.mutators.setFieldState(name, { modified: true })\n formState.form.mutators.setFieldState(name, { touched: true })\n },\n [initialValues, name, formState]\n )\n\n const handleAddNewChip = useCallback(\n (event, fields) => {\n const fieldsLength = fields.value?.length || 0\n\n if (!editConfig.isEdit && !editConfig.chipIndex) {\n formState.form.mutators.push(name, {\n id: fieldsLength + new Date(),\n key: '',\n value: '',\n delimiter: delimiter\n })\n }\n\n if (showHiddenChips) {\n setShowHiddenChips(false)\n }\n\n setEditConfig({\n chipIndex: fieldsLength,\n isEdit: true,\n isKeyFocused: true,\n isValueFocused: false,\n isNewChip: true\n })\n\n event && event.preventDefault()\n },\n [\n editConfig.isEdit,\n editConfig.chipIndex,\n showHiddenChips,\n formState.form.mutators,\n name,\n delimiter,\n setShowHiddenChips\n ]\n )\n\n const handleRemoveChip = useCallback(\n (event, fields, chipIndex, isOutsideClick = false) => {\n checkChipsList(\n lodash\n .chain(formState)\n .get(['values', name])\n .filter((_, index) => index !== chipIndex)\n .value()\n )\n\n if (fields.length === 1) {\n formState.form.change(name, [])\n } else {\n fields.remove(chipIndex)\n }\n\n onExitEditModeCallback && onExitEditModeCallback()\n event && !isOutsideClick && event.stopPropagation()\n },\n [checkChipsList, formState, name, onExitEditModeCallback]\n )\n\n const handleEditChip = useCallback(\n (event, fields, nameEvent, isOutsideClick) => {\n const { key, value } = fields.value[editConfig.chipIndex]\n const isChipNotEmpty = !!(key?.trim() && value?.trim())\n\n if (nameEvent === CLICK) {\n if (!isChipNotEmpty) {\n handleRemoveChip(event, fields, editConfig.chipIndex, isOutsideClick)\n }\n\n setEditConfig({\n chipIndex: null,\n isEdit: false,\n isKeyFocused: false,\n isValueFocused: false,\n isNewChip: false\n })\n isChipNotEmpty && onExitEditModeCallback && onExitEditModeCallback()\n } else if (nameEvent === TAB) {\n if (!isChipNotEmpty) {\n handleRemoveChip(event, fields, editConfig.chipIndex)\n }\n\n setEditConfig(prevState => {\n const lastChipSelected = prevState.chipIndex + 1 > fields.value.length - 1\n\n isChipNotEmpty && lastChipSelected && onExitEditModeCallback && onExitEditModeCallback()\n\n return {\n chipIndex: lastChipSelected ? null : prevState.chipIndex + 1,\n isEdit: !lastChipSelected,\n isKeyFocused: !lastChipSelected,\n isValueFocused: false,\n isNewChip: false\n }\n })\n } else if (nameEvent === TAB_SHIFT) {\n if (!isChipNotEmpty) {\n handleRemoveChip(event, fields, editConfig.chipIndex)\n }\n\n setEditConfig(prevState => {\n const firstChipIsSelected = prevState.chipIndex === 0\n\n isChipNotEmpty &&\n firstChipIsSelected &&\n onExitEditModeCallback &&\n onExitEditModeCallback()\n\n return {\n chipIndex: firstChipIsSelected ? null : prevState.chipIndex - 1,\n isEdit: !firstChipIsSelected,\n isKeyFocused: false,\n isValueFocused: !firstChipIsSelected,\n isNewChip: false\n }\n })\n }\n\n checkChipsList(get(formState.values, name))\n\n if (\n (editConfig.chipIndex > 0 && editConfig.chipIndex < fields.value.length - 1) ||\n (fields.value.length > 1 && editConfig.chipIndex === 0 && nameEvent !== TAB_SHIFT) ||\n (fields.value.length > 1 &&\n editConfig.chipIndex === fields.value.length - 1 &&\n nameEvent !== TAB)\n ) {\n event && event.preventDefault()\n }\n },\n [\n editConfig.chipIndex,\n checkChipsList,\n formState.values,\n name,\n onExitEditModeCallback,\n handleRemoveChip\n ]\n )\n\n const handleToEditMode = useCallback(\n (event, chipIndex, keyName) => {\n if (isEditable) {\n const { clientX: pointerCoordinateX, clientY: pointerCoordinateY } = event\n let isKeyClicked = false\n const isClickedInsideInputElement = (\n pointerCoordinateX,\n pointerCoordinateY,\n inputElement\n ) => {\n if (inputElement) {\n const {\n top: topPosition,\n left: leftPosition,\n right: rightPosition,\n bottom: bottomPosition\n } = inputElement.getBoundingClientRect()\n if (pointerCoordinateX > rightPosition || pointerCoordinateX < leftPosition)\n return false\n if (pointerCoordinateY > bottomPosition || pointerCoordinateY < topPosition)\n return false\n\n return true\n }\n }\n event.stopPropagation()\n\n if (event.target.nodeName !== 'INPUT') {\n if (event.target.firstElementChild) {\n isKeyClicked = isClickedInsideInputElement(\n pointerCoordinateX,\n pointerCoordinateY,\n event.target.firstElementChild\n )\n }\n } else {\n isKeyClicked = event.target.name === keyName\n }\n\n setEditConfig(preState => ({\n ...preState,\n chipIndex,\n isEdit: true,\n isKeyFocused: isKeyClicked,\n isValueFocused: !isKeyClicked\n }))\n }\n\n onClick && onClick()\n },\n [isEditable, onClick]\n )\n\n const validateFields = fieldsArray => {\n if (!fieldsArray) return null\n\n let errorData = []\n\n const uniquenessValidator = (newValue, idx) => {\n return !fieldsArray.some(({ key }, index) => {\n return newValue === key && index !== idx\n })\n }\n\n if (!isEmpty(validationRules)) {\n errorData = fieldsArray.map(chip => {\n const [keyValidation, valueValidation] = validateChip(chip)\n\n if (keyValidation && valueValidation) return { key: keyValidation, value: valueValidation }\n\n if (keyValidation) return { key: keyValidation }\n\n if (valueValidation) return { value: valueValidation }\n\n return null\n })\n }\n\n // uniqueness\n fieldsArray.forEach((chip, index) => {\n const isUnique = uniquenessValidator(chip.key, index)\n\n if (!isUnique) {\n if (get(errorData, [index, 'key'], false)) {\n errorData.at(index).key.push(uniquenessError)\n } else {\n set(errorData, [index, 'key'], [uniquenessError])\n }\n }\n })\n\n if (isEmpty(errorData) && validator) {\n errorData = validator(fieldsArray)\n }\n\n if (errorData.every(label => isNil(label))) {\n return null\n }\n\n return errorData\n }\n\n const validateChip = ({ key, value, disabled }) => {\n const validateField = (value, field) => {\n const [newRules, isValidField] = checkPatternsValidity(\n validationRules[field].filter(rule => rule.pattern),\n value\n )\n\n if (isValidField) return null\n\n const invalidRules = newRules.filter(rule => !rule.isValid)\n\n return invalidRules.map(rule => ({ name: rule.name, label: rule.label }))\n }\n\n return disabled ? [null, null] : [validateField(key, 'key'), validateField(value, 'value')]\n }\n\n return (\n <div className={chipsClassName} data-testid={`${name}-chips`}>\n {label && <div className=\"chips__label\">{label}</div>}\n <div className={label ? 'chips__wrapper' : ''}>\n <FormChipCellView\n chipOptions={chipOptions}\n chipSizeIsRecalculated={chipSizeIsRecalculated}\n chips={chips}\n editConfig={editConfig}\n formState={formState}\n handleAddNewChip={handleAddNewChip}\n handleEditChip={handleEditChip}\n handleRemoveChip={handleRemoveChip}\n handleShowElements={handleShowElements}\n handleToEditMode={handleToEditMode}\n isDeletable={isDeletable}\n isEditable={isEditable}\n name={name}\n ref={{ chipsCellRef, chipsWrapperRef, hiddenChipsCounterRef, hiddenChipsPopUpRef }}\n setChipSizeIsRecalculated={setChipSizeIsRecalculated}\n setChipsSizes={setChipsSizes}\n setEditConfig={setEditConfig}\n shortChips={shortChips}\n showChips={showChips}\n showHiddenChips={showHiddenChips}\n validateFields={validateFields}\n validationRules={validationRules}\n visibleChipsMaxLength={visibleChipsMaxLength}\n >\n {children}\n </FormChipCellView>\n </div>\n </div>\n )\n}\n\nFormChipCell.propTypes = {\n chipOptions: CHIP_OPTIONS,\n children: PropTypes.node,\n className: PropTypes.string,\n delimiter: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n formState: PropTypes.object.isRequired,\n initialValues: PropTypes.object.isRequired,\n isDeletable: PropTypes.bool,\n isEditable: PropTypes.bool,\n label: PropTypes.string,\n name: PropTypes.string.isRequired,\n onClick: PropTypes.func,\n onExitEditModeCallback: PropTypes.func,\n shortChips: PropTypes.bool,\n validationRules: PropTypes.object,\n validator: PropTypes.func,\n visibleChipsMaxLength: VISIBLE_CHIPS_MAX_LENGTH,\n withInitialParentWidth: PropTypes.bool\n}\n\nFormChipCell = React.memo(FormChipCell)\n\nexport default FormChipCell\n"],"names":["FormChipCell","chipOptions","className","children","delimiter","formState","initialValues","isDeletable","isEditable","label","name","onClick","onExitEditModeCallback","shortChips","validationRules","validator","visibleChipsMaxLength","withInitialParentWidth","chipsClassName","classnames","chipSizeIsRecalculated","setChipSizeIsRecalculated","useState","chipsCellRef","chipsWrapperRef","handleShowElements","hiddenChipsCounterRef","hiddenChipsPopUpRef","setChipsSizes","setShowHiddenChips","showChips","showHiddenChips","visibleChipsCount","useChipCell","editConfig","setEditConfig","chips","useMemo","get","generateChipsList","checkChipsList","useCallback","currentChipsList","areArraysEqual","set","handleAddNewChip","event","fields","fieldsLength","_a","handleRemoveChip","chipIndex","isOutsideClick","lodash","_","index","handleEditChip","nameEvent","key","value","isChipNotEmpty","CLICK","TAB","prevState","lastChipSelected","TAB_SHIFT","firstChipIsSelected","handleToEditMode","keyName","pointerCoordinateX","pointerCoordinateY","isKeyClicked","isClickedInsideInputElement","inputElement","topPosition","leftPosition","rightPosition","bottomPosition","preState","validateFields","fieldsArray","errorData","uniquenessValidator","newValue","idx","isEmpty","chip","keyValidation","valueValidation","validateChip","uniquenessError","isNil","disabled","validateField","field","newRules","isValidField","checkPatternsValidity","rule","jsx","FormChipCellView","CHIP_OPTIONS","PropTypes","VISIBLE_CHIPS_MAX_LENGTH","React","FormChipCell$1"],"mappings":";;;;;;;;;;;;;;;AAiCA,IAAIA,IAAe,CAAC;AAAA,EAClB,aAAAC,IAAc;AAAA,IACZ,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,aAAa;AAAA,IACb,SAAS;AAAA,IACT,MAAM;AAAA,EACR;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,YAAAC,IAAa;AAAA,EACb,OAAAC,IAAQ;AAAA,EACR,MAAAC;AAAA,EACA,SAAAC,IAAU,MAAM;AAAA,EAAC;AAAA,EACjB,wBAAAC,IAAyB;AAAA,EACzB,YAAAC,IAAa;AAAA,EACb,iBAAAC,IAAkB,CAAC;AAAA,EACnB,WAAAC,IAAY;AAAA,EACZ,uBAAAC,IAAwB;AAAA,EACxB,wBAAAC,IAAyB;AAC3B,MAAM;AACE,QAAAC,IAAiBC,GAAW,SAASjB,CAAS,GAC9C,CAACkB,GAAwBC,CAAyB,IAAIC,EAAS,EAAK,GACpE;AAAA,IACJ,cAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,WA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AAAmB;AAAA,QACA,OAAAgB;AAAA,QACA,YAAAF;AAAA,QACA,WAAA7B;AAAA,QACA,kBAAAwC;AAAA,QACA,gBAAAW;AAAA,QACA,kBAAAN;AAAA,QACA,oBAAAzB;AAAA,QACA,kBAAA0C;AAAA,QACA,aAAA5D;AAAA,QACA,YAAAC;AAAA,QACA,MAAAE;AAAA,QACA,KAAK,EAAE,cAAAa,GAAc,iBAAAC,GAAiB,uBAAAE,GAAuB,qBAAAC,EAAoB;AAAA,QACjF,2BAAAN;AAAA,QACA,eAAAO;AAAA,QACA,eAAAO;AAAA,QACA,YAAAtB;AAAA,QACA,WAAAiB;AAAA,QACA,iBAAAC;AAAA,QACA,gBAAAgD;AAAA,QACA,iBAAAjE;AAAA,QACA,uBAAAE;AAAA,QAEC,UAAAb;AAAA,MAAA;AAAA,IAAA,EAEL,CAAA;AAAA,EAAA,GACF;AAEJ;AAEAH,EAAa,YAAY;AAAA,EACvB,aAAaqG;AAAA,EACb,UAAUC,EAAU;AAAA,EACpB,WAAWA,EAAU;AAAA,EACrB,WAAWA,EAAU,UAAU,CAACA,EAAU,QAAQA,EAAU,OAAO,CAAC;AAAA,EACpE,WAAWA,EAAU,OAAO;AAAA,EAC5B,eAAeA,EAAU,OAAO;AAAA,EAChC,aAAaA,EAAU;AAAA,EACvB,YAAYA,EAAU;AAAA,EACtB,OAAOA,EAAU;AAAA,EACjB,MAAMA,EAAU,OAAO;AAAA,EACvB,SAASA,EAAU;AAAA,EACnB,wBAAwBA,EAAU;AAAA,EAClC,YAAYA,EAAU;AAAA,EACtB,iBAAiBA,EAAU;AAAA,EAC3B,WAAWA,EAAU;AAAA,EACrB,uBAAuBC;AAAA,EACvB,wBAAwBD,EAAU;AACpC;AAEAtG,IAAewG,GAAM,KAAKxG,CAAY;AAEtC,MAAAyG,KAAezG;"}
|
|
1
|
+
{"version":3,"file":"FormChipCell.mjs","sources":["../../../src/lib/components/FormChipCell/FormChipCell.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, useCallback, useMemo } from 'react'\nimport lodash, { get, isEmpty, set, isNil } from 'lodash'\nimport classnames from 'classnames'\nimport PropTypes from 'prop-types'\n\nimport FormChipCellView from './FormChipCellView'\n\nimport { CHIP_OPTIONS, VISIBLE_CHIPS_MAX_LENGTH } from '../../types'\nimport { CLICK, TAB, TAB_SHIFT } from '../../constants'\nimport { areArraysEqual } from '../../utils/common.util'\nimport { checkPatternsValidity } from '../../utils/validation.util'\nimport { generateChipsList } from '../../utils/generateChipsList.util'\nimport { uniquenessError } from './formChipCell.util'\nimport { useChipCell } from '../../hooks'\n\nimport './formChipCell.scss'\n\nlet FormChipCell = ({\n chipOptions = {\n background: 'purple',\n boldValue: false,\n borderRadius: 'primary',\n borderColor: 'transparent',\n density: 'dense',\n font: 'purple'\n },\n className = '',\n children,\n delimiter = null,\n formState,\n initialValues,\n isDeletable = false,\n isEditable = false,\n label = null,\n name,\n onClick = () => {},\n onExitEditModeCallback = null,\n shortChips = false,\n validationRules = {},\n validator = null,\n visibleChipsMaxLength = null,\n withInitialParentWidth = false\n}) => {\n const chipsClassName = classnames('chips', className)\n const [chipSizeIsRecalculated, setChipSizeIsRecalculated] = useState(false)\n const {\n chipsCellRef,\n chipsWrapperRef,\n handleShowElements,\n hiddenChipsCounterRef,\n hiddenChipsPopUpRef,\n setChipsSizes,\n setShowHiddenChips,\n showChips,\n showHiddenChips,\n visibleChipsCount\n } = useChipCell(isEditable, visibleChipsMaxLength, withInitialParentWidth)\n\n const [editConfig, setEditConfig] = useState({\n chipIndex: null,\n isEdit: false,\n isKeyFocused: false,\n isValueFocused: false,\n isNewChip: false\n })\n\n let chips = useMemo(() => {\n return isEditable || visibleChipsMaxLength === 'all'\n ? {\n visibleChips: get(formState.values, name),\n hiddenChips: []\n }\n : generateChipsList(\n get(formState.values, name),\n visibleChipsMaxLength ? visibleChipsMaxLength : visibleChipsCount\n )\n }, [visibleChipsMaxLength, isEditable, visibleChipsCount, formState.values, name])\n\n const checkChipsList = useCallback(\n currentChipsList => {\n if (areArraysEqual(get(initialValues, name), currentChipsList, ['id'])) {\n set(formState.initialValues, name, currentChipsList)\n }\n\n formState.form.mutators.setFieldState(name, { modified: true })\n formState.form.mutators.setFieldState(name, { touched: true })\n },\n [initialValues, name, formState]\n )\n\n const handleAddNewChip = useCallback(\n (event, fields) => {\n const fieldsLength = fields.value?.length || 0\n\n if (!editConfig.isEdit && !editConfig.chipIndex) {\n formState.form.mutators.push(name, {\n id: fieldsLength + new Date(),\n key: '',\n value: '',\n delimiter: delimiter\n })\n }\n\n if (showHiddenChips) {\n setShowHiddenChips(false)\n }\n\n setEditConfig({\n chipIndex: fieldsLength,\n isEdit: true,\n isKeyFocused: true,\n isValueFocused: false,\n isNewChip: true\n })\n\n event && event.preventDefault()\n },\n [\n editConfig.isEdit,\n editConfig.chipIndex,\n showHiddenChips,\n formState.form.mutators,\n name,\n delimiter,\n setShowHiddenChips\n ]\n )\n\n const handleRemoveChip = useCallback(\n (event, fields, chipIndex, isOutsideClick = false) => {\n checkChipsList(\n lodash\n .chain(formState)\n .get(['values', name])\n .filter((_, index) => index !== chipIndex)\n .value()\n )\n\n if (fields.length === 1) {\n formState.form.change(name, [])\n } else {\n fields.remove(chipIndex)\n }\n\n onExitEditModeCallback && onExitEditModeCallback()\n event && !isOutsideClick && event.stopPropagation()\n },\n [checkChipsList, formState, name, onExitEditModeCallback]\n )\n\n const handleEditChip = useCallback(\n (event, fields, nameEvent, isOutsideClick) => {\n const { key, value } = fields.value[editConfig.chipIndex]\n const isChipNotEmpty = !!(key?.trim() && value?.trim())\n\n if (nameEvent === CLICK) {\n if (!isChipNotEmpty) {\n handleRemoveChip(event, fields, editConfig.chipIndex, isOutsideClick)\n }\n\n setEditConfig({\n chipIndex: null,\n isEdit: false,\n isKeyFocused: false,\n isValueFocused: false,\n isNewChip: false\n })\n isChipNotEmpty && onExitEditModeCallback && onExitEditModeCallback()\n } else if (nameEvent === TAB) {\n if (!isChipNotEmpty) {\n handleRemoveChip(event, fields, editConfig.chipIndex)\n }\n\n setEditConfig(prevState => {\n const lastChipSelected = prevState.chipIndex + 1 > fields.value.length - 1\n\n isChipNotEmpty && lastChipSelected && onExitEditModeCallback && onExitEditModeCallback()\n\n return {\n chipIndex: lastChipSelected ? null : prevState.chipIndex + 1,\n isEdit: !lastChipSelected,\n isKeyFocused: !lastChipSelected,\n isValueFocused: false,\n isNewChip: false\n }\n })\n } else if (nameEvent === TAB_SHIFT) {\n if (!isChipNotEmpty) {\n handleRemoveChip(event, fields, editConfig.chipIndex)\n }\n\n setEditConfig(prevState => {\n const firstChipIsSelected = prevState.chipIndex === 0\n\n isChipNotEmpty &&\n firstChipIsSelected &&\n onExitEditModeCallback &&\n onExitEditModeCallback()\n\n return {\n chipIndex: firstChipIsSelected ? null : prevState.chipIndex - 1,\n isEdit: !firstChipIsSelected,\n isKeyFocused: false,\n isValueFocused: !firstChipIsSelected,\n isNewChip: false\n }\n })\n }\n\n checkChipsList(get(formState.values, name))\n\n if (\n (editConfig.chipIndex > 0 && editConfig.chipIndex < fields.value.length - 1) ||\n (fields.value.length > 1 && editConfig.chipIndex === 0 && nameEvent !== TAB_SHIFT) ||\n (fields.value.length > 1 &&\n editConfig.chipIndex === fields.value.length - 1 &&\n nameEvent !== TAB)\n ) {\n event && event.preventDefault()\n }\n },\n [\n editConfig.chipIndex,\n checkChipsList,\n formState.values,\n name,\n onExitEditModeCallback,\n handleRemoveChip\n ]\n )\n\n const handleToEditMode = useCallback(\n (event, chipIndex, keyName) => {\n if (isEditable) {\n const { clientX: pointerCoordinateX, clientY: pointerCoordinateY } = event\n let isKeyClicked = false\n const isClickedInsideInputElement = (\n pointerCoordinateX,\n pointerCoordinateY,\n inputElement\n ) => {\n if (inputElement) {\n const {\n top: topPosition,\n left: leftPosition,\n right: rightPosition,\n bottom: bottomPosition\n } = inputElement.getBoundingClientRect()\n if (pointerCoordinateX > rightPosition || pointerCoordinateX < leftPosition)\n return false\n if (pointerCoordinateY > bottomPosition || pointerCoordinateY < topPosition)\n return false\n\n return true\n }\n }\n event.stopPropagation()\n\n if (event.target.nodeName !== 'INPUT') {\n if (event.target.firstElementChild) {\n isKeyClicked = isClickedInsideInputElement(\n pointerCoordinateX,\n pointerCoordinateY,\n event.target.firstElementChild\n )\n }\n } else {\n isKeyClicked = event.target.name === keyName\n }\n\n setEditConfig(preState => ({\n ...preState,\n chipIndex,\n isEdit: true,\n isKeyFocused: isKeyClicked,\n isValueFocused: !isKeyClicked\n }))\n }\n\n onClick && onClick()\n },\n [isEditable, onClick]\n )\n\n const validateFields = fieldsArray => {\n if (!fieldsArray) return null\n\n let errorData = []\n\n const uniquenessValidator = (newValue, idx) => {\n return !fieldsArray.some(({ key }, index) => {\n return newValue === key && index !== idx\n })\n }\n\n if (!isEmpty(validationRules)) {\n errorData = fieldsArray.map(chip => {\n const [keyValidation, valueValidation] = validateChip(chip)\n\n if (keyValidation && valueValidation) return { key: keyValidation, value: valueValidation }\n\n if (keyValidation) return { key: keyValidation }\n\n if (valueValidation) return { value: valueValidation }\n\n return null\n })\n }\n\n // uniqueness\n fieldsArray.forEach((chip, index) => {\n const isUnique = uniquenessValidator(chip.key, index)\n\n if (!isUnique) {\n if (get(errorData, [index, 'key'], false)) {\n errorData.at(index).key.push(uniquenessError)\n } else {\n set(errorData, [index, 'key'], [uniquenessError])\n }\n }\n })\n\n if (isEmpty(errorData) && validator) {\n errorData = validator(fieldsArray)\n }\n\n if (errorData.every(label => isNil(label))) {\n return null\n }\n\n return errorData\n }\n\n const validateChip = ({ key, value, disabled }) => {\n const validateField = (value, field) => {\n const [newRules, isValidField] = checkPatternsValidity(\n validationRules[field].filter(rule => rule.pattern),\n value\n )\n\n if (isValidField) return null\n\n const invalidRules = newRules.filter(rule => !rule.isValid)\n\n return invalidRules.map(rule => ({ name: rule.name, label: rule.label }))\n }\n\n return disabled ? [null, null] : [validateField(key, 'key'), validateField(value, 'value')]\n }\n\n return (\n <div className={chipsClassName} data-testid={`${name}-chips`}>\n {label && <div className=\"chips__label\">{label}</div>}\n <div className={label ? 'chips__wrapper' : ''}>\n <FormChipCellView\n chipOptions={chipOptions}\n chipSizeIsRecalculated={chipSizeIsRecalculated}\n chips={chips}\n editConfig={editConfig}\n formState={formState}\n handleAddNewChip={handleAddNewChip}\n handleEditChip={handleEditChip}\n handleRemoveChip={handleRemoveChip}\n handleShowElements={handleShowElements}\n handleToEditMode={handleToEditMode}\n isDeletable={isDeletable}\n isEditable={isEditable}\n name={name}\n ref={{ chipsCellRef, chipsWrapperRef, hiddenChipsCounterRef, hiddenChipsPopUpRef }}\n setChipSizeIsRecalculated={setChipSizeIsRecalculated}\n setChipsSizes={setChipsSizes}\n setEditConfig={setEditConfig}\n shortChips={shortChips}\n showChips={showChips}\n showHiddenChips={showHiddenChips}\n validateFields={validateFields}\n validationRules={validationRules}\n visibleChipsMaxLength={visibleChipsMaxLength}\n >\n {children}\n </FormChipCellView>\n </div>\n </div>\n )\n}\n\nFormChipCell.propTypes = {\n chipOptions: CHIP_OPTIONS,\n children: PropTypes.node,\n className: PropTypes.string,\n delimiter: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n formState: PropTypes.object.isRequired,\n initialValues: PropTypes.object.isRequired,\n isDeletable: PropTypes.bool,\n isEditable: PropTypes.bool,\n label: PropTypes.string,\n name: PropTypes.string.isRequired,\n onClick: PropTypes.func,\n onExitEditModeCallback: PropTypes.func,\n shortChips: PropTypes.bool,\n validationRules: PropTypes.object,\n validator: PropTypes.func,\n visibleChipsMaxLength: VISIBLE_CHIPS_MAX_LENGTH,\n withInitialParentWidth: PropTypes.bool\n}\n\nFormChipCell = React.memo(FormChipCell)\n\nexport default FormChipCell\n"],"names":["FormChipCell","chipOptions","className","children","delimiter","formState","initialValues","isDeletable","isEditable","label","name","onClick","onExitEditModeCallback","shortChips","validationRules","validator","visibleChipsMaxLength","withInitialParentWidth","chipsClassName","classnames","chipSizeIsRecalculated","setChipSizeIsRecalculated","useState","chipsCellRef","chipsWrapperRef","handleShowElements","hiddenChipsCounterRef","hiddenChipsPopUpRef","setChipsSizes","setShowHiddenChips","showChips","showHiddenChips","visibleChipsCount","useChipCell","editConfig","setEditConfig","chips","useMemo","get","generateChipsList","checkChipsList","useCallback","currentChipsList","areArraysEqual","set","handleAddNewChip","event","fields","fieldsLength","_a","handleRemoveChip","chipIndex","isOutsideClick","lodash","_","index","handleEditChip","nameEvent","key","value","isChipNotEmpty","CLICK","TAB","prevState","lastChipSelected","TAB_SHIFT","firstChipIsSelected","handleToEditMode","keyName","pointerCoordinateX","pointerCoordinateY","isKeyClicked","isClickedInsideInputElement","inputElement","topPosition","leftPosition","rightPosition","bottomPosition","preState","validateFields","fieldsArray","errorData","uniquenessValidator","newValue","idx","isEmpty","chip","keyValidation","valueValidation","validateChip","uniquenessError","isNil","disabled","validateField","field","newRules","isValidField","checkPatternsValidity","rule","jsx","FormChipCellView","CHIP_OPTIONS","PropTypes","VISIBLE_CHIPS_MAX_LENGTH","React","FormChipCell$1"],"mappings":";;;;;;;;;;;;;;;AAiCA,IAAIA,IAAe,CAAC;AAAA,EAClB,aAAAC,IAAc;AAAA,IACZ,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,aAAa;AAAA,IACb,SAAS;AAAA,IACT,MAAM;AAAA,EAAA;AAAA,EAER,WAAAC,IAAY;AAAA,EACZ,UAAAC;AAAA,EACA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ACpB,WAAWA,EAAU;AAAA,EACrB,WAAWA,EAAU,UAAU,CAACA,EAAU,QAAQA,EAAU,OAAO,CAAC;AAAA,EACpE,WAAWA,EAAU,OAAO;AAAA,EAC5B,eAAeA,EAAU,OAAO;AAAA,EAChC,aAAaA,EAAU;AAAA,EACvB,YAAYA,EAAU;AAAA,EACtB,OAAOA,EAAU;AAAA,EACjB,MAAMA,EAAU,OAAO;AAAA,EACvB,SAASA,EAAU;AAAA,EACnB,wBAAwBA,EAAU;AAAA,EAClC,YAAYA,EAAU;AAAA,EACtB,iBAAiBA,EAAU;AAAA,EAC3B,WAAWA,EAAU;AAAA,EACrB,uBAAuBC;AAAA,EACvB,wBAAwBD,EAAU;AACpC;AAEAtG,IAAewG,GAAM,KAAKxG,CAAY;AAEtC,MAAAyG,KAAezG;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormChipCellView.mjs","sources":["../../../src/lib/components/FormChipCell/FormChipCellView.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'\nimport { FieldArray } from 'react-final-form-arrays'\nimport { isEmpty } from 'lodash'\n\nimport FormChip from './FormChip/FormChip'\nimport HiddenChipsBlock from './HiddenChipsBlock/HiddenChipsBlock'\nimport TextTooltipTemplate from '../TooltipTemplate/TextTooltipTemplate'\nimport Tooltip from '../Tooltip/Tooltip'\n\nimport { CHIP_OPTIONS, VISIBLE_CHIPS_MAX_LENGTH } from '../../types'\nimport { isEveryObjectValueEmpty } from '../../utils/common.util'\nimport { uniquenessError } from './formChipCell.util'\n\nimport Add from '../../images/add.svg?react'\n\nlet FormChipCellView = (\n {\n chipOptions = {\n background: 'purple',\n boldValue: false,\n borderRadius: 'primary',\n borderColor: 'transparent',\n density: 'dense',\n font: 'purple'\n },\n chipSizeIsRecalculated,\n setChipSizeIsRecalculated,\n children,\n chips,\n editConfig,\n handleAddNewChip,\n handleEditChip,\n handleRemoveChip,\n handleShowElements,\n handleToEditMode,\n isDeletable = false,\n isEditable = false,\n name,\n setChipsSizes,\n setEditConfig,\n shortChips = false,\n showChips,\n showHiddenChips,\n validateFields,\n validationRules = {},\n visibleChipsMaxLength = null\n },\n { chipsCellRef, chipsWrapperRef, hiddenChipsCounterRef, hiddenChipsPopUpRef }\n) => {\n const buttonAddClassNames = classnames(\n 'button-add',\n chipOptions.background && `button-add-background_${chipOptions.background}`,\n chipOptions.borderColor && `button-add-border_${chipOptions.borderColor}`,\n chipOptions.font && `button-add-font_${chipOptions.font}`,\n chipOptions.density && `button-add-density_${chipOptions.density}`\n )\n const wrapperClassNames = classnames(\n 'chips-wrapper',\n isEditable && 'fixed-max-width',\n chips.visibleChips?.length > 0 && !chipSizeIsRecalculated && 'chip_invisible',\n visibleChipsMaxLength === 'all' && 'chips-wrapper_all-visible'\n )\n const chipClassNames = classnames(\n 'chip',\n 'chip__content',\n isEditable && 'data-ellipsis',\n shortChips && 'chip_short',\n chips.hiddenChips && 'chip_hidden',\n chipOptions.density && `chip-density_${chipOptions.density}`,\n chipOptions.borderRadius && `chip-border_${chipOptions.borderRadius}`,\n chipOptions.background && `chip-background_${chipOptions.background}`,\n chipOptions.borderColor && `chip-border_${chipOptions.borderColor}`,\n chipOptions.font && `chip-font_${chipOptions.font}`,\n isEditable && 'editable',\n (showChips || isEditable) && 'chip_visible'\n )\n\n return (\n <FieldArray name={name} validate={validateFields}>\n {({ fields, meta }) => {\n let newValidationRules = { ...validationRules }\n\n if (\n !isEmpty(validationRules) &&\n validationRules.key.every(rule => rule.name !== uniquenessError.name)\n ) {\n newValidationRules = {\n ...validationRules,\n key: [...validationRules.key, uniquenessError]\n }\n }\n\n return (\n (isEditable || !isEveryObjectValueEmpty(fields)) && (\n <div className=\"chips-cell\" ref={chipsCellRef}>\n <div className={wrapperClassNames} ref={chipsWrapperRef}>\n {fields.map((contentItem, index) => {\n const chipData = fields.value[index]\n\n return (\n index < chips.visibleChips?.length && (\n <div className=\"chip-block\" key={chipData.id}>\n <Tooltip\n hidden={editConfig.isEdit && !chipData.tooltip}\n key={chipData.id}\n template={\n <TextTooltipTemplate\n text={\n chipData.tooltip || (\n <span className=\"chip__content\">\n <span className=\"chip__content-item\">{chipData.key}</span>\n {!chipData.isKeyOnly && (\n <>\n <span className=\"chip__delimiter\">\n {chipData.delimiter ? chipData.delimiter : ':'}\n </span>\n <span className=\"chip__content-item\">{chipData.value}</span>\n </>\n )}\n </span>\n )\n }\n />\n }\n >\n <FormChip\n chip={chipData}\n chipSizeIsRecalculated={chipSizeIsRecalculated}\n setChipSizeIsRecalculated={setChipSizeIsRecalculated}\n chipIndex={index}\n chipOptions={chipOptions}\n editConfig={editConfig}\n handleEditChip={(event, nameEvent, isOutsideClick) =>\n handleEditChip(event, fields, nameEvent, isOutsideClick)\n }\n handleRemoveChip={(event, index) =>\n handleRemoveChip(event, fields, index)\n }\n handleToEditMode={handleToEditMode}\n isDeletable={isDeletable}\n isEditable={isEditable}\n keyName={`${contentItem}.key`}\n meta={meta}\n ref={chipsCellRef}\n setChipsSizes={setChipsSizes}\n setEditConfig={setEditConfig}\n validationRules={newValidationRules}\n valueName={`${contentItem}.value`}\n />\n </Tooltip>\n </div>\n )\n )\n })}\n\n <div className=\"chip-block\">\n {chips.hiddenChips.length > 0 && showHiddenChips && (\n <HiddenChipsBlock\n chipClassNames={chipClassNames}\n chipOptions={chipOptions}\n chips={chips.hiddenChips}\n handleShowElements={handleShowElements}\n ref={{ hiddenChipsCounterRef, hiddenChipsPopUpRef }}\n textOverflowEllipsis\n />\n )}\n {chips.hiddenChipsNumber && (\n <span\n ref={hiddenChipsCounterRef}\n className={`${chipClassNames} chips_button`}\n onClick={handleShowElements}\n >\n {chips.hiddenChipsNumber}\n </span>\n )}\n </div>\n\n {isEditable && (\n <button\n data-testid={`${name}-add-chip`}\n className={buttonAddClassNames}\n onClick={e => handleAddNewChip(e, fields)}\n >\n <Add />\n </button>\n )}\n {children}\n </div>\n </div>\n )\n )\n }}\n </FieldArray>\n )\n}\n\nFormChipCellView = forwardRef(FormChipCellView)\n\nFormChipCellView.displayName = 'FormChipCellView'\n\nFormChipCellView.propTypes = {\n chipOptions: CHIP_OPTIONS,\n chipSizeIsRecalculated: PropTypes.bool.isRequired,\n setChipSizeIsRecalculated: PropTypes.func.isRequired,\n children: PropTypes.node,\n chips: PropTypes.object.isRequired,\n editConfig: PropTypes.object.isRequired,\n formState: PropTypes.object.isRequired,\n handleAddNewChip: PropTypes.func.isRequired,\n handleEditChip: PropTypes.func.isRequired,\n handleRemoveChip: PropTypes.func.isRequired,\n handleShowElements: PropTypes.func.isRequired,\n handleToEditMode: PropTypes.func.isRequired,\n isDeletable: PropTypes.bool,\n isEditable: PropTypes.bool,\n name: PropTypes.string.isRequired,\n setChipsSizes: PropTypes.func.isRequired,\n setEditConfig: PropTypes.func.isRequired,\n shortChips: PropTypes.bool,\n showChips: PropTypes.bool.isRequired,\n showHiddenChips: PropTypes.bool.isRequired,\n validateFields: PropTypes.func.isRequired,\n validationRules: PropTypes.object,\n visibleChipsMaxLength: VISIBLE_CHIPS_MAX_LENGTH\n}\n\nexport default FormChipCellView\n"],"names":["FormChipCellView","chipOptions","chipSizeIsRecalculated","setChipSizeIsRecalculated","children","chips","editConfig","handleAddNewChip","handleEditChip","handleRemoveChip","handleShowElements","handleToEditMode","isDeletable","isEditable","name","setChipsSizes","setEditConfig","shortChips","showChips","showHiddenChips","validateFields","validationRules","visibleChipsMaxLength","chipsCellRef","chipsWrapperRef","hiddenChipsCounterRef","hiddenChipsPopUpRef","buttonAddClassNames","classnames","wrapperClassNames","_a","chipClassNames","jsx","FieldArray","fields","meta","newValidationRules","isEmpty","rule","uniquenessError","isEveryObjectValueEmpty","jsxs","contentItem","index","chipData","Tooltip","TextTooltipTemplate","Fragment","FormChip","event","nameEvent","isOutsideClick","HiddenChipsBlock","e","Add","forwardRef","CHIP_OPTIONS","PropTypes","VISIBLE_CHIPS_MAX_LENGTH","FormChipCellView$1"],"mappings":";;;;;;;;;;;;;;AAiCA,IAAIA,IAAmB,CACrB;AAAA,EACE,aAAAC,IAAc;AAAA,IACZ,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,aAAa;AAAA,IACb,SAAS;AAAA,IACT,MAAM;AAAA,EACR;AAAA,EACA,wBAAAC;AAAA,EACA,2BAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,YAAAC,IAAa;AAAA,EACb,MAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,WAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,iBAAAC,IAAkB,CAAC;AAAA,EACnB,uBAAAC,IAAwB;AAC1B,GACA,EAAE,cAAAC,GAAc,iBAAAC,GAAiB,uBAAAC,GAAuB,qBAAAC,QACrD;;AACH,QAAMC,IAAsBC;AAAA,IAC1B;AAAA,IACA3B,EAAY,cAAc,yBAAyBA,EAAY,UAAU;AAAA,IACzEA,EAAY,eAAe,qBAAqBA,EAAY,WAAW;AAAA,IACvEA,EAAY,QAAQ,mBAAmBA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A,EAAU,KAAK;AAAA,EACjC,gBAAgBA,EAAU,KAAK;AAAA,EAC/B,kBAAkBA,EAAU,KAAK;AAAA,EACjC,oBAAoBA,EAAU,KAAK;AAAA,EACnC,kBAAkBA,EAAU,KAAK;AAAA,EACjC,aAAaA,EAAU;AAAA,EACvB,YAAYA,EAAU;AAAA,EACtB,MAAMA,EAAU,OAAO;AAAA,EACvB,eAAeA,EAAU,KAAK;AAAA,EAC9B,eAAeA,EAAU,KAAK;AAAA,EAC9B,YAAYA,EAAU;AAAA,EACtB,WAAWA,EAAU,KAAK;AAAA,EAC1B,iBAAiBA,EAAU,KAAK;AAAA,EAChC,gBAAgBA,EAAU,KAAK;AAAA,EAC/B,iBAAiBA,EAAU;AAAA,EAC3B,uBAAuBC;AACzB;AAEA,MAAAC,KAAe3D;"}
|
|
1
|
+
{"version":3,"file":"FormChipCellView.mjs","sources":["../../../src/lib/components/FormChipCell/FormChipCellView.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'\nimport { FieldArray } from 'react-final-form-arrays'\nimport { isEmpty } from 'lodash'\n\nimport FormChip from './FormChip/FormChip'\nimport HiddenChipsBlock from './HiddenChipsBlock/HiddenChipsBlock'\nimport TextTooltipTemplate from '../TooltipTemplate/TextTooltipTemplate'\nimport Tooltip from '../Tooltip/Tooltip'\n\nimport { CHIP_OPTIONS, VISIBLE_CHIPS_MAX_LENGTH } from '../../types'\nimport { isEveryObjectValueEmpty } from '../../utils/common.util'\nimport { uniquenessError } from './formChipCell.util'\n\nimport Add from '../../images/add.svg?react'\n\nlet FormChipCellView = (\n {\n chipOptions = {\n background: 'purple',\n boldValue: false,\n borderRadius: 'primary',\n borderColor: 'transparent',\n density: 'dense',\n font: 'purple'\n },\n chipSizeIsRecalculated,\n setChipSizeIsRecalculated,\n children,\n chips,\n editConfig,\n handleAddNewChip,\n handleEditChip,\n handleRemoveChip,\n handleShowElements,\n handleToEditMode,\n isDeletable = false,\n isEditable = false,\n name,\n setChipsSizes,\n setEditConfig,\n shortChips = false,\n showChips,\n showHiddenChips,\n validateFields,\n validationRules = {},\n visibleChipsMaxLength = null\n },\n { chipsCellRef, chipsWrapperRef, hiddenChipsCounterRef, hiddenChipsPopUpRef }\n) => {\n const buttonAddClassNames = classnames(\n 'button-add',\n chipOptions.background && `button-add-background_${chipOptions.background}`,\n chipOptions.borderColor && `button-add-border_${chipOptions.borderColor}`,\n chipOptions.font && `button-add-font_${chipOptions.font}`,\n chipOptions.density && `button-add-density_${chipOptions.density}`\n )\n const wrapperClassNames = classnames(\n 'chips-wrapper',\n isEditable && 'fixed-max-width',\n chips.visibleChips?.length > 0 && !chipSizeIsRecalculated && 'chip_invisible',\n visibleChipsMaxLength === 'all' && 'chips-wrapper_all-visible'\n )\n const chipClassNames = classnames(\n 'chip',\n 'chip__content',\n isEditable && 'data-ellipsis',\n shortChips && 'chip_short',\n chips.hiddenChips && 'chip_hidden',\n chipOptions.density && `chip-density_${chipOptions.density}`,\n chipOptions.borderRadius && `chip-border_${chipOptions.borderRadius}`,\n chipOptions.background && `chip-background_${chipOptions.background}`,\n chipOptions.borderColor && `chip-border_${chipOptions.borderColor}`,\n chipOptions.font && `chip-font_${chipOptions.font}`,\n isEditable && 'editable',\n (showChips || isEditable) && 'chip_visible'\n )\n\n return (\n <FieldArray name={name} validate={validateFields}>\n {({ fields, meta }) => {\n let newValidationRules = { ...validationRules }\n\n if (\n !isEmpty(validationRules) &&\n validationRules.key.every(rule => rule.name !== uniquenessError.name)\n ) {\n newValidationRules = {\n ...validationRules,\n key: [...validationRules.key, uniquenessError]\n }\n }\n\n return (\n (isEditable || !isEveryObjectValueEmpty(fields)) && (\n <div className=\"chips-cell\" ref={chipsCellRef}>\n <div className={wrapperClassNames} ref={chipsWrapperRef}>\n {fields.map((contentItem, index) => {\n const chipData = fields.value[index]\n\n return (\n index < chips.visibleChips?.length && (\n <div className=\"chip-block\" key={chipData.id}>\n <Tooltip\n hidden={editConfig.isEdit && !chipData.tooltip}\n key={chipData.id}\n template={\n <TextTooltipTemplate\n text={\n chipData.tooltip || (\n <span className=\"chip__content\">\n <span className=\"chip__content-item\">{chipData.key}</span>\n {!chipData.isKeyOnly && (\n <>\n <span className=\"chip__delimiter\">\n {chipData.delimiter ? chipData.delimiter : ':'}\n </span>\n <span className=\"chip__content-item\">{chipData.value}</span>\n </>\n )}\n </span>\n )\n }\n />\n }\n >\n <FormChip\n chip={chipData}\n chipSizeIsRecalculated={chipSizeIsRecalculated}\n setChipSizeIsRecalculated={setChipSizeIsRecalculated}\n chipIndex={index}\n chipOptions={chipOptions}\n editConfig={editConfig}\n handleEditChip={(event, nameEvent, isOutsideClick) =>\n handleEditChip(event, fields, nameEvent, isOutsideClick)\n }\n handleRemoveChip={(event, index) =>\n handleRemoveChip(event, fields, index)\n }\n handleToEditMode={handleToEditMode}\n isDeletable={isDeletable}\n isEditable={isEditable}\n keyName={`${contentItem}.key`}\n meta={meta}\n ref={chipsCellRef}\n setChipsSizes={setChipsSizes}\n setEditConfig={setEditConfig}\n validationRules={newValidationRules}\n valueName={`${contentItem}.value`}\n />\n </Tooltip>\n </div>\n )\n )\n })}\n\n <div className=\"chip-block\">\n {chips.hiddenChips.length > 0 && showHiddenChips && (\n <HiddenChipsBlock\n chipClassNames={chipClassNames}\n chipOptions={chipOptions}\n chips={chips.hiddenChips}\n handleShowElements={handleShowElements}\n ref={{ hiddenChipsCounterRef, hiddenChipsPopUpRef }}\n textOverflowEllipsis\n />\n )}\n {chips.hiddenChipsNumber && (\n <span\n ref={hiddenChipsCounterRef}\n className={`${chipClassNames} chips_button`}\n onClick={handleShowElements}\n >\n {chips.hiddenChipsNumber}\n </span>\n )}\n </div>\n\n {isEditable && (\n <button\n data-testid={`${name}-add-chip`}\n className={buttonAddClassNames}\n onClick={e => handleAddNewChip(e, fields)}\n >\n <Add />\n </button>\n )}\n {children}\n </div>\n </div>\n )\n )\n }}\n </FieldArray>\n )\n}\n\nFormChipCellView = forwardRef(FormChipCellView)\n\nFormChipCellView.displayName = 'FormChipCellView'\n\nFormChipCellView.propTypes = {\n chipOptions: CHIP_OPTIONS,\n chipSizeIsRecalculated: PropTypes.bool.isRequired,\n setChipSizeIsRecalculated: PropTypes.func.isRequired,\n children: PropTypes.node,\n chips: PropTypes.object.isRequired,\n editConfig: PropTypes.object.isRequired,\n formState: PropTypes.object.isRequired,\n handleAddNewChip: PropTypes.func.isRequired,\n handleEditChip: PropTypes.func.isRequired,\n handleRemoveChip: PropTypes.func.isRequired,\n handleShowElements: PropTypes.func.isRequired,\n handleToEditMode: PropTypes.func.isRequired,\n isDeletable: PropTypes.bool,\n isEditable: PropTypes.bool,\n name: PropTypes.string.isRequired,\n setChipsSizes: PropTypes.func.isRequired,\n setEditConfig: PropTypes.func.isRequired,\n shortChips: PropTypes.bool,\n showChips: PropTypes.bool.isRequired,\n showHiddenChips: PropTypes.bool.isRequired,\n validateFields: PropTypes.func.isRequired,\n validationRules: PropTypes.object,\n visibleChipsMaxLength: VISIBLE_CHIPS_MAX_LENGTH\n}\n\nexport default FormChipCellView\n"],"names":["FormChipCellView","chipOptions","chipSizeIsRecalculated","setChipSizeIsRecalculated","children","chips","editConfig","handleAddNewChip","handleEditChip","handleRemoveChip","handleShowElements","handleToEditMode","isDeletable","isEditable","name","setChipsSizes","setEditConfig","shortChips","showChips","showHiddenChips","validateFields","validationRules","visibleChipsMaxLength","chipsCellRef","chipsWrapperRef","hiddenChipsCounterRef","hiddenChipsPopUpRef","buttonAddClassNames","classnames","wrapperClassNames","_a","chipClassNames","jsx","FieldArray","fields","meta","newValidationRules","isEmpty","rule","uniquenessError","isEveryObjectValueEmpty","jsxs","contentItem","index","chipData","Tooltip","TextTooltipTemplate","Fragment","FormChip","event","nameEvent","isOutsideClick","HiddenChipsBlock","e","Add","forwardRef","CHIP_OPTIONS","PropTypes","VISIBLE_CHIPS_MAX_LENGTH","FormChipCellView$1"],"mappings":";;;;;;;;;;;;;;AAiCA,IAAIA,IAAmB,CACrB;AAAA,EACE,aAAAC,IAAc;AAAA,IACZ,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,aAAa;AAAA,IACb,SAAS;AAAA,IACT,MAAM;AAAA,EAAA;AAAA,EAER,wBAAAC;AAAA,EACA,2BAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,YAAAC,IAAa;AAAA,EACb,MAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,WAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,iBAAAC,IAAkB,CAAA;AAAA,EAClB,uBAAAC,IAAwB;AAC1B,GACA,EAAE,cAAAC,GAAc,iBAAAC,GAAiB,uBAAAC,GAAuB,qBAAAC,QACrD;;AACH,QAAMC,IAAsBC;AAAA,IAC1B;AAAA,IACA3B,EAAY,cAAc,yBAAyBA,EAAY,UAAU;AAAA,IACzEA,EAAY,eAAe,qBAAqBA,EAAY,WAAW;AAAA,IACvEA,EAAY,QAAQ,mBAAmBA,EAAY,IAAI;AAAA,IAC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,EACjC,gBAAgBA,EAAU,KAAK;AAAA,EAC/B,kBAAkBA,EAAU,KAAK;AAAA,EACjC,oBAAoBA,EAAU,KAAK;AAAA,EACnC,kBAAkBA,EAAU,KAAK;AAAA,EACjC,aAAaA,EAAU;AAAA,EACvB,YAAYA,EAAU;AAAA,EACtB,MAAMA,EAAU,OAAO;AAAA,EACvB,eAAeA,EAAU,KAAK;AAAA,EAC9B,eAAeA,EAAU,KAAK;AAAA,EAC9B,YAAYA,EAAU;AAAA,EACtB,WAAWA,EAAU,KAAK;AAAA,EAC1B,iBAAiBA,EAAU,KAAK;AAAA,EAChC,gBAAgBA,EAAU,KAAK;AAAA,EAC/B,iBAAiBA,EAAU;AAAA,EAC3B,uBAAuBC;AACzB;AAEA,MAAAC,KAAe3D;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HiddenChipsBlock.mjs","sources":["../../../../src/lib/components/FormChipCell/HiddenChipsBlock/HiddenChipsBlock.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, useEffect } from 'react'\nimport { createPortal } from 'react-dom'\nimport PropTypes from 'prop-types'\nimport classnames from 'classnames'\n\nimport Tooltip from '../../Tooltip/Tooltip'\nimport TextTooltipTemplate from '../../TooltipTemplate/TextTooltipTemplate'\n\nimport { CHIP_OPTIONS } from '../../../types'\nimport { useHiddenChipsBlock } from '../../../hooks'\n\nlet HiddenChipsBlock = (\n { chipClassNames, chipOptions, chips, handleShowElements, textOverflowEllipsis = false },\n { hiddenChipsCounterRef, hiddenChipsPopUpRef }\n) => {\n const { hiddenChipsBlockClassNames } = useHiddenChipsBlock(\n hiddenChipsCounterRef,\n hiddenChipsPopUpRef\n )\n\n const chipLabelClassNames = classnames('chip__label', textOverflowEllipsis && 'data-ellipsis')\n const chipValueClassNames = classnames(\n 'chip__value',\n textOverflowEllipsis && 'data-ellipsis',\n chipOptions.boldValue && 'chip-value_bold'\n )\n\n const generateChipData = chip => {\n return chip.isKeyOnly\n ? chip.key\n : `${chip.key}${chip.delimiter ? chip.delimiter : ':'} ${chip.value}`\n }\n\n useEffect(() => {\n if (chips.length === 0) {\n handleShowElements()\n }\n })\n\n return createPortal(\n <div\n ref={hiddenChipsPopUpRef}\n className={hiddenChipsBlockClassNames}\n onClick={event => event.stopPropagation()}\n >\n <div className=\"chip-block-hidden__scrollable-container\">\n {chips?.map(element => {\n return (\n <Tooltip\n key={element.id}\n template={\n <TextTooltipTemplate\n text={\n element.delimiter ? (\n <span className=\"chip__content\">\n {element.key}\n {!element.isKeyOnly && (\n <>\n <span className=\"chip__delimiter\">{element.delimiter}</span>\n {element.value}\n </>\n )}\n </span>\n ) : (\n generateChipData(element)\n )\n }\n />\n }\n >\n <div className={chipClassNames}>\n {element.key && <div className={chipLabelClassNames}>{element.key}</div>}\n {element.value && (\n <>\n <div className=\"chip__delimiter\">{element.delimiter ?? ':'}</div>\n <div className={chipValueClassNames}>{element.value}</div>\n </>\n )}\n </div>\n </Tooltip>\n )\n })}\n </div>\n </div>,\n document.getElementById('overlay_container')\n )\n}\n\nHiddenChipsBlock = forwardRef(HiddenChipsBlock)\n\nHiddenChipsBlock.displayName = 'HiddenChipsBlock'\n\nHiddenChipsBlock.propTypes = {\n chipClassNames: PropTypes.string.isRequired,\n chipOptions: CHIP_OPTIONS.isRequired,\n chips: PropTypes.array.isRequired,\n handleShowElements: PropTypes.func.isRequired,\n textOverflowEllipsis: PropTypes.bool\n}\n\nexport default HiddenChipsBlock\n"],"names":["HiddenChipsBlock","chipClassNames","chipOptions","chips","handleShowElements","textOverflowEllipsis","hiddenChipsCounterRef","hiddenChipsPopUpRef","hiddenChipsBlockClassNames","useHiddenChipsBlock","chipLabelClassNames","classnames","chipValueClassNames","generateChipData","chip","useEffect","createPortal","jsx","event","element","Tooltip","TextTooltipTemplate","jsxs","Fragment","forwardRef","PropTypes","CHIP_OPTIONS","HiddenChipsBlock$1"],"mappings":";;;;;;;;;;AA2BA,IAAIA,IAAmB,CACrB,EAAE,gBAAAC,GAAgB,aAAAC,GAAa,OAAAC,GAAO,oBAAAC,GAAoB,sBAAAC,IAAuB,
|
|
1
|
+
{"version":3,"file":"HiddenChipsBlock.mjs","sources":["../../../../src/lib/components/FormChipCell/HiddenChipsBlock/HiddenChipsBlock.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, useEffect } from 'react'\nimport { createPortal } from 'react-dom'\nimport PropTypes from 'prop-types'\nimport classnames from 'classnames'\n\nimport Tooltip from '../../Tooltip/Tooltip'\nimport TextTooltipTemplate from '../../TooltipTemplate/TextTooltipTemplate'\n\nimport { CHIP_OPTIONS } from '../../../types'\nimport { useHiddenChipsBlock } from '../../../hooks'\n\nlet HiddenChipsBlock = (\n { chipClassNames, chipOptions, chips, handleShowElements, textOverflowEllipsis = false },\n { hiddenChipsCounterRef, hiddenChipsPopUpRef }\n) => {\n const { hiddenChipsBlockClassNames } = useHiddenChipsBlock(\n hiddenChipsCounterRef,\n hiddenChipsPopUpRef\n )\n\n const chipLabelClassNames = classnames('chip__label', textOverflowEllipsis && 'data-ellipsis')\n const chipValueClassNames = classnames(\n 'chip__value',\n textOverflowEllipsis && 'data-ellipsis',\n chipOptions.boldValue && 'chip-value_bold'\n )\n\n const generateChipData = chip => {\n return chip.isKeyOnly\n ? chip.key\n : `${chip.key}${chip.delimiter ? chip.delimiter : ':'} ${chip.value}`\n }\n\n useEffect(() => {\n if (chips.length === 0) {\n handleShowElements()\n }\n })\n\n return createPortal(\n <div\n ref={hiddenChipsPopUpRef}\n className={hiddenChipsBlockClassNames}\n onClick={event => event.stopPropagation()}\n >\n <div className=\"chip-block-hidden__scrollable-container\">\n {chips?.map(element => {\n return (\n <Tooltip\n key={element.id}\n template={\n <TextTooltipTemplate\n text={\n element.delimiter ? (\n <span className=\"chip__content\">\n {element.key}\n {!element.isKeyOnly && (\n <>\n <span className=\"chip__delimiter\">{element.delimiter}</span>\n {element.value}\n </>\n )}\n </span>\n ) : (\n generateChipData(element)\n )\n }\n />\n }\n >\n <div className={chipClassNames}>\n {element.key && <div className={chipLabelClassNames}>{element.key}</div>}\n {element.value && (\n <>\n <div className=\"chip__delimiter\">{element.delimiter ?? ':'}</div>\n <div className={chipValueClassNames}>{element.value}</div>\n </>\n )}\n </div>\n </Tooltip>\n )\n })}\n </div>\n </div>,\n document.getElementById('overlay_container')\n )\n}\n\nHiddenChipsBlock = forwardRef(HiddenChipsBlock)\n\nHiddenChipsBlock.displayName = 'HiddenChipsBlock'\n\nHiddenChipsBlock.propTypes = {\n chipClassNames: PropTypes.string.isRequired,\n chipOptions: CHIP_OPTIONS.isRequired,\n chips: PropTypes.array.isRequired,\n handleShowElements: PropTypes.func.isRequired,\n textOverflowEllipsis: PropTypes.bool\n}\n\nexport default HiddenChipsBlock\n"],"names":["HiddenChipsBlock","chipClassNames","chipOptions","chips","handleShowElements","textOverflowEllipsis","hiddenChipsCounterRef","hiddenChipsPopUpRef","hiddenChipsBlockClassNames","useHiddenChipsBlock","chipLabelClassNames","classnames","chipValueClassNames","generateChipData","chip","useEffect","createPortal","jsx","event","element","Tooltip","TextTooltipTemplate","jsxs","Fragment","forwardRef","PropTypes","CHIP_OPTIONS","HiddenChipsBlock$1"],"mappings":";;;;;;;;;;AA2BA,IAAIA,IAAmB,CACrB,EAAE,gBAAAC,GAAgB,aAAAC,GAAa,OAAAC,GAAO,oBAAAC,GAAoB,sBAAAC,IAAuB,GAAA,GACjF,EAAE,uBAAAC,GAAuB,qBAAAC,QACtB;AACH,QAAM,EAAE,4BAAAC,MAA+BC;AAAA,IACrCH;AAAA,IACAC;AAAA,EAAA,GAGIG,IAAsBC,EAAW,eAAeN,KAAwB,eAAe,GACvFO,IAAsBD;AAAA,IAC1B;AAAA,IACAN,KAAwB;AAAA,IACxBH,EAAY,aAAa;AAAA,EAAA,GAGrBW,IAAmB,CAAAC,MAChBA,EAAK,YACRA,EAAK,MACL,GAAGA,EAAK,GAAG,GAAGA,EAAK,YAAYA,EAAK,YAAY,GAAG,IAAIA,EAAK,KAAK;AAGvE,SAAAC,EAAU,MAAM;AACd,IAAIZ,EAAM,WAAW,KACnBC,EAAA;AAAA,EAEJ,CAAC,GAEMY;AAAA,IACL,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAKV;AAAA,QACL,WAAWC;AAAA,QACX,SAAS,CAAAU,MAASA,EAAM,gBAAA;AAAA,QAExB,4BAAC,OAAA,EAAI,WAAU,2CACZ,UAAAf,KAAA,gBAAAA,EAAO,IAAI,CAAAgB,MAER,gBAAAF;AAAA,UAACG;AAAA,UAAA;AAAA,YAEC,UACE,gBAAAH;AAAA,cAACI;AAAA,cAAA;AAAA,gBACC,MACEF,EAAQ,YACN,gBAAAG,EAAC,QAAA,EAAK,WAAU,iBACb,UAAA;AAAA,kBAAAH,EAAQ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