@legion-ui-kit/react-core
Version:
<div align="center"> <img height="108" width="116" src="https://legion.digitaltelkom.id/favicon.svg?v=4643a71fb65fa61a5f2b266b769ea7b1" /> <h1 align="center">Legion UI Kit - React Core</h1> </div>
1 lines • 4.27 kB
Source Map (JSON)
{"version":3,"file":"Dropdown.helper.cjs","sources":["../../../../src/components/Dropdown/Dropdown.helper.ts"],"sourcesContent":["// Types\r\nimport type { TGetDropdownPosition } from './Dropdown.type';\r\n\r\n// Constants\r\nimport { DROPDOWN_GAP, DROPDOWN_POSITION } from './Dropdown.constant';\r\n\r\nexport const getDropdownPosition: TGetDropdownPosition = (params) => {\r\n const { position, dropdownHeight, dropdownWidth, triggerHeight, triggerWidth, triggerTop, triggerLeft } = params;\r\n\r\n switch (position) {\r\n case DROPDOWN_POSITION['top-left']: {\r\n return {\r\n top: triggerTop - dropdownHeight - DROPDOWN_GAP,\r\n left: triggerLeft\r\n };\r\n }\r\n case DROPDOWN_POSITION['top-right']: {\r\n return {\r\n top: triggerTop - dropdownHeight - DROPDOWN_GAP,\r\n left: triggerLeft + triggerWidth - dropdownWidth\r\n };\r\n }\r\n case DROPDOWN_POSITION['right-top']: {\r\n return {\r\n top: triggerTop,\r\n left: triggerLeft + triggerWidth + DROPDOWN_GAP\r\n };\r\n }\r\n case DROPDOWN_POSITION['right-center']: {\r\n return {\r\n top: triggerTop + triggerHeight / 2 - dropdownHeight / 2,\r\n left: triggerLeft + triggerWidth + DROPDOWN_GAP\r\n };\r\n }\r\n case DROPDOWN_POSITION['right-bottom']: {\r\n return {\r\n top: triggerTop + triggerHeight - dropdownHeight,\r\n left: triggerLeft + triggerWidth + DROPDOWN_GAP\r\n };\r\n }\r\n case DROPDOWN_POSITION['bottom-left']: {\r\n return {\r\n top: triggerTop + triggerHeight + DROPDOWN_GAP,\r\n left: triggerLeft\r\n };\r\n }\r\n case DROPDOWN_POSITION['bottom-center']: {\r\n return {\r\n top: triggerTop + triggerHeight + DROPDOWN_GAP,\r\n left: triggerLeft + triggerWidth / 2 - dropdownWidth / 2\r\n };\r\n }\r\n case DROPDOWN_POSITION['bottom-right']: {\r\n return {\r\n top: triggerTop + triggerHeight + DROPDOWN_GAP,\r\n left: triggerLeft + triggerWidth - dropdownWidth\r\n };\r\n }\r\n case DROPDOWN_POSITION['left-top']: {\r\n return {\r\n top: triggerTop,\r\n left: triggerLeft - dropdownWidth - DROPDOWN_GAP\r\n };\r\n }\r\n case DROPDOWN_POSITION['left-center']: {\r\n return {\r\n top: triggerTop + triggerHeight / 2 - dropdownHeight / 2,\r\n left: triggerLeft - dropdownWidth - DROPDOWN_GAP\r\n };\r\n }\r\n case DROPDOWN_POSITION['left-bottom']: {\r\n return {\r\n top: triggerTop + triggerHeight - dropdownHeight,\r\n left: triggerLeft - dropdownWidth - DROPDOWN_GAP\r\n };\r\n }\r\n default: {\r\n return {\r\n top: triggerTop - dropdownHeight - DROPDOWN_GAP,\r\n left: triggerLeft + triggerWidth / 2 - dropdownWidth / 2\r\n };\r\n }\r\n }\r\n};\r\n"],"names":["params","position","dropdownHeight","dropdownWidth","triggerHeight","triggerWidth","triggerTop","triggerLeft","DROPDOWN_POSITION","top","DROPDOWN_GAP","left"],"mappings":"kFAM0DA,IACxD,MAAMC,SAAEA,EAAQC,eAAEA,EAAcC,cAAEA,EAAaC,cAAEA,EAAaC,aAAEA,EAAYC,WAAEA,EAAUC,YAAEA,GAAgBP,EAE1G,OAAQC,GACN,KAAKO,EAAAA,kBAAkB,YACrB,MAAO,CACLC,IAAKH,EAAaJ,EAAiBQ,EAAAA,aACnCC,KAAMJ,GAGV,KAAKC,EAAAA,kBAAkB,aACrB,MAAO,CACLC,IAAKH,EAAaJ,EAAiBQ,EAAAA,aACnCC,KAAMJ,EAAcF,EAAeF,GAGvC,KAAKK,EAAAA,kBAAkB,aACrB,MAAO,CACLC,IAAKH,EACLK,KAAMJ,EAAcF,EAAeK,EAAAA,cAGvC,KAAKF,EAAAA,kBAAkB,gBACrB,MAAO,CACLC,IAAKH,EA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