@atlassian/clientside-extensions-components 2.4.1 → 2.5.0-84fa90d-kwd5ix2w

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/dist/cjs/ExtensionPoint.js +4 -4
  2. package/dist/cjs/ExtensionPoint.js.map +1 -1
  3. package/dist/cjs/ExtensionPointInfo.js +8 -8
  4. package/dist/cjs/ExtensionPointInfo.js.map +1 -1
  5. package/dist/cjs/ExtensionsObservable.js +14 -12
  6. package/dist/cjs/ExtensionsObservable.js.map +1 -1
  7. package/dist/cjs/debug/useDebug.js +3 -3
  8. package/dist/cjs/debug/useDebug.js.map +1 -1
  9. package/dist/cjs/debug/useDiscovery.js +3 -3
  10. package/dist/cjs/debug/useDiscovery.js.map +1 -1
  11. package/dist/cjs/debug/useLogging.js +3 -3
  12. package/dist/cjs/debug/useLogging.js.map +1 -1
  13. package/dist/cjs/debug/useValidation.js +3 -3
  14. package/dist/cjs/debug/useValidation.js.map +1 -1
  15. package/dist/cjs/handlers/AsyncPanelHandler.js +10 -9
  16. package/dist/cjs/handlers/AsyncPanelHandler.js.map +1 -1
  17. package/dist/cjs/handlers/ButtonHandler.js +4 -3
  18. package/dist/cjs/handlers/ButtonHandler.js.map +1 -1
  19. package/dist/cjs/handlers/LinkHandler.js +4 -3
  20. package/dist/cjs/handlers/LinkHandler.js.map +1 -1
  21. package/dist/cjs/handlers/ModalHandler.js +16 -14
  22. package/dist/cjs/handlers/ModalHandler.js.map +1 -1
  23. package/dist/cjs/handlers/PanelHandler.js +6 -5
  24. package/dist/cjs/handlers/PanelHandler.js.map +1 -1
  25. package/dist/cjs/handlers/SectionHandler.js +3 -2
  26. package/dist/cjs/handlers/SectionHandler.js.map +1 -1
  27. package/dist/cjs/handlers/index.js +1 -0
  28. package/dist/cjs/handlers/index.js.map +1 -1
  29. package/dist/cjs/index.js +11 -10
  30. package/dist/cjs/index.js.map +1 -1
  31. package/dist/cjs/renderElementAsReact.js +3 -3
  32. package/dist/cjs/renderElementAsReact.js.map +1 -1
  33. package/dist/cjs/styled.js +13 -13
  34. package/dist/cjs/styled.js.map +1 -1
  35. package/dist/cjs/useExtensions.js +18 -14
  36. package/dist/cjs/useExtensions.js.map +1 -1
  37. package/dist/cjs/useWebPanelRenderer.js +4 -4
  38. package/dist/cjs/useWebPanelRenderer.js.map +1 -1
  39. package/dist/esm/ExtensionPointInfo.js.map +1 -1
  40. package/dist/esm/ExtensionsObservable.js.map +1 -1
  41. package/dist/esm/debug/types.js +1 -0
  42. package/dist/esm/handlers/types.js +1 -0
  43. package/dist/esm/renderElementAsReact.js +1 -1
  44. package/dist/esm/renderElementAsReact.js.map +1 -1
  45. package/dist/esm/useWebPanelRenderer.js.map +1 -1
  46. package/dist/types/ExtensionPointInfo.d.ts.map +1 -1
  47. package/dist/types/styled.d.ts +7 -7
  48. package/dist/types/styled.d.ts.map +1 -1
  49. package/lib/ExtensionPointInfo.tsx +1 -0
  50. package/lib/ExtensionsObservable.test.ts +2 -2
  51. package/package.json +12 -11
  52. package/dist/cjs/ExtensionPoint.test.js +0 -96
  53. package/dist/cjs/ExtensionPoint.test.js.map +0 -1
  54. package/dist/cjs/ExtensionPointInfo.test.js +0 -189
  55. package/dist/cjs/ExtensionPointInfo.test.js.map +0 -1
  56. package/dist/cjs/ExtensionsObservable.test.js +0 -349
  57. package/dist/cjs/ExtensionsObservable.test.js.map +0 -1
  58. package/dist/cjs/debug/useDebug.test.js +0 -49
  59. package/dist/cjs/debug/useDebug.test.js.map +0 -1
  60. package/dist/cjs/debug/useDiscovery.test.js +0 -49
  61. package/dist/cjs/debug/useDiscovery.test.js.map +0 -1
  62. package/dist/cjs/debug/useLogging.test.js +0 -49
  63. package/dist/cjs/debug/useLogging.test.js.map +0 -1
  64. package/dist/cjs/debug/useValidation.test.js +0 -49
  65. package/dist/cjs/debug/useValidation.test.js.map +0 -1
  66. package/dist/cjs/handlers/AsyncPanelHandler.test.js +0 -189
  67. package/dist/cjs/handlers/AsyncPanelHandler.test.js.map +0 -1
  68. package/dist/cjs/handlers/ButtonHandler.test.js +0 -40
  69. package/dist/cjs/handlers/ButtonHandler.test.js.map +0 -1
  70. package/dist/cjs/handlers/LinkHandler.test.js +0 -43
  71. package/dist/cjs/handlers/LinkHandler.test.js.map +0 -1
  72. package/dist/cjs/handlers/ModalHandler.test.js +0 -189
  73. package/dist/cjs/handlers/ModalHandler.test.js.map +0 -1
  74. package/dist/cjs/handlers/PanelHandler.test.js +0 -88
  75. package/dist/cjs/handlers/PanelHandler.test.js.map +0 -1
  76. package/dist/cjs/handlers/SectionHandler.test.js +0 -17
  77. package/dist/cjs/handlers/SectionHandler.test.js.map +0 -1
  78. package/dist/cjs/index.test.js +0 -7
  79. package/dist/cjs/index.test.js.map +0 -1
  80. package/dist/cjs/renderElementAsReact.test.js +0 -54
  81. package/dist/cjs/renderElementAsReact.test.js.map +0 -1
  82. package/dist/cjs/useExtensions.test.js +0 -647
  83. package/dist/cjs/useExtensions.test.js.map +0 -1
  84. package/dist/esm/ExtensionPoint.test.js +0 -93
  85. package/dist/esm/ExtensionPoint.test.js.map +0 -1
  86. package/dist/esm/ExtensionPointInfo.test.js +0 -186
  87. package/dist/esm/ExtensionPointInfo.test.js.map +0 -1
  88. package/dist/esm/ExtensionsObservable.test.js +0 -346
  89. package/dist/esm/ExtensionsObservable.test.js.map +0 -1
  90. package/dist/esm/debug/useDebug.test.js +0 -46
  91. package/dist/esm/debug/useDebug.test.js.map +0 -1
  92. package/dist/esm/debug/useDiscovery.test.js +0 -46
  93. package/dist/esm/debug/useDiscovery.test.js.map +0 -1
  94. package/dist/esm/debug/useLogging.test.js +0 -46
  95. package/dist/esm/debug/useLogging.test.js.map +0 -1
  96. package/dist/esm/debug/useValidation.test.js +0 -46
  97. package/dist/esm/debug/useValidation.test.js.map +0 -1
  98. package/dist/esm/handlers/AsyncPanelHandler.test.js +0 -186
  99. package/dist/esm/handlers/AsyncPanelHandler.test.js.map +0 -1
  100. package/dist/esm/handlers/ButtonHandler.test.js +0 -37
  101. package/dist/esm/handlers/ButtonHandler.test.js.map +0 -1
  102. package/dist/esm/handlers/LinkHandler.test.js +0 -40
  103. package/dist/esm/handlers/LinkHandler.test.js.map +0 -1
  104. package/dist/esm/handlers/ModalHandler.test.js +0 -186
  105. package/dist/esm/handlers/ModalHandler.test.js.map +0 -1
  106. package/dist/esm/handlers/PanelHandler.test.js +0 -85
  107. package/dist/esm/handlers/PanelHandler.test.js.map +0 -1
  108. package/dist/esm/handlers/SectionHandler.test.js +0 -14
  109. package/dist/esm/handlers/SectionHandler.test.js.map +0 -1
  110. package/dist/esm/index.test.js +0 -7
  111. package/dist/esm/index.test.js.map +0 -1
  112. package/dist/esm/renderElementAsReact.test.js +0 -51
  113. package/dist/esm/renderElementAsReact.test.js.map +0 -1
  114. package/dist/esm/useExtensions.test.js +0 -644
  115. package/dist/esm/useExtensions.test.js.map +0 -1
  116. package/dist/types/ExtensionPoint.test.d.ts +0 -2
  117. package/dist/types/ExtensionPoint.test.d.ts.map +0 -1
  118. package/dist/types/ExtensionPointInfo.test.d.ts +0 -2
  119. package/dist/types/ExtensionPointInfo.test.d.ts.map +0 -1
  120. package/dist/types/ExtensionsObservable.test.d.ts +0 -2
  121. package/dist/types/ExtensionsObservable.test.d.ts.map +0 -1
  122. package/dist/types/debug/useDebug.test.d.ts +0 -2
  123. package/dist/types/debug/useDebug.test.d.ts.map +0 -1
  124. package/dist/types/debug/useDiscovery.test.d.ts +0 -2
  125. package/dist/types/debug/useDiscovery.test.d.ts.map +0 -1
  126. package/dist/types/debug/useLogging.test.d.ts +0 -2
  127. package/dist/types/debug/useLogging.test.d.ts.map +0 -1
  128. package/dist/types/debug/useValidation.test.d.ts +0 -2
  129. package/dist/types/debug/useValidation.test.d.ts.map +0 -1
  130. package/dist/types/handlers/AsyncPanelHandler.test.d.ts +0 -2
  131. package/dist/types/handlers/AsyncPanelHandler.test.d.ts.map +0 -1
  132. package/dist/types/handlers/ButtonHandler.test.d.ts +0 -2
  133. package/dist/types/handlers/ButtonHandler.test.d.ts.map +0 -1
  134. package/dist/types/handlers/LinkHandler.test.d.ts +0 -2
  135. package/dist/types/handlers/LinkHandler.test.d.ts.map +0 -1
  136. package/dist/types/handlers/ModalHandler.test.d.ts +0 -2
  137. package/dist/types/handlers/ModalHandler.test.d.ts.map +0 -1
  138. package/dist/types/handlers/PanelHandler.test.d.ts +0 -2
  139. package/dist/types/handlers/PanelHandler.test.d.ts.map +0 -1
  140. package/dist/types/handlers/SectionHandler.test.d.ts +0 -2
  141. package/dist/types/handlers/SectionHandler.test.d.ts.map +0 -1
  142. package/dist/types/index.test.d.ts +0 -1
  143. package/dist/types/index.test.d.ts.map +0 -1
  144. package/dist/types/renderElementAsReact.test.d.ts +0 -2
  145. package/dist/types/renderElementAsReact.test.d.ts.map +0 -1
  146. package/dist/types/useExtensions.test.d.ts +0 -2
  147. package/dist/types/useExtensions.test.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"AsyncPanelHandler.js","sourceRoot":"","sources":["../../../lib/handlers/AsyncPanelHandler.tsx"],"names":[],"mappings":";;;;AACA,uDAAoE;AAEpE,wFAAiE;AAGjE,iDAA8C;AAc9C,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAEtB,MAAM,UAAU,GAAG,KAAK,EACpB,cAA8G,EAC9G,YAAoB,EACpB,QAAgB,EACsC,EAAE;IACxD,IAAI;QACA,MAAM,cAAc,GAAG,MAAM,cAAc,EAAE,CAAC;QAC9C,gDAAgD;QAChD,IAAI,CAAC,cAAc,IAAI,CAAC,cAAc,CAAC,UAAU,IAAI,OAAO,cAAc,CAAC,OAAO,KAAK,UAAU,EAAE;YAC/F,qCAAO,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;gBACpB,KAAK,EAAE,KAAK;gBAEZ,OAAO,EAAE,6CAA6C,YAAY,kBAAkB,QAAQ,kEAAkE;gBA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AmB,CAAC;oBACjC,IAAI,EAAE;wBACF,QAAQ;wBACR,SAAS,EAAE,YAAY;qBAC1B;iBACJ,CAAC,CAAC,CAAC;aACP;SACJ;QAED,OAAO,YAAY,CAAC;IACxB,CAAC,EAAE,CAAC,eAAe,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;IAE9C,iBAAS,CACL,SAAS,uBAAuB;QAC5B,IAAI,SAAS,GAAG,KAAK,CAAC;QAEtB,KAAK,UAAU,kBAAkB;YAC7B,iBAAiB,CAAC,KAAK,CAAC,CAAC;YACzB,WAAW,CAAC,OAAO,GAAG,SAAS,CAAC;YAEhC,MAAM,gBAAgB,GAAG,MAAM,UAAU,CAAC,cAAc,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;YAElF,IAAI,SAAS,EAAE;gBACX,OAAO;aACV;YAED,WAAW,CAAC,OAAO,GAAG,gBAAgB,CAAC;YACvC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC;QAED,kBAAkB,EAAE,CAAC;QAErB,OAAO,GAAG,EAAE;YACR,SAAS,GAAG,IAAI,CAAC;QACrB,CAAC,CAAC;IACN,CAAC,EACD,CAAC,cAAc,EAAE,YAAY,EAAE,QAAQ,CAAC,CAC3C,CAAC;IAEF,IAAI,CAAC,cAAc,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE;QACzC,OAAO,QAAQ,CAAC,CAAC,CAAC,8DAAG,QAAQ,CAAI,CAAC,CAAC,CAAC,IAAI,CAAC;KAC5C;IAED,OAAO,8BAAC,2BAAY,IAAC,MAAM,EAAE,WAAW,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAI,CAAC;AAC/F,CAAC,CAAC","sourcesContent":["import type { FunctionComponent } from 'react';\nimport React, { useEffect, useRef, useState, useMemo } from 'react';\nimport type { AsyncPanelExtension } from '@atlassian/clientside-extensions';\nimport { onDebug } from '@atlassian/clientside-extensions-debug';\nimport type { Context } from '@atlassian/clientside-extensions-registry';\nimport type { PanelHandlerProps } from './PanelHandler';\nimport { PanelHandler } from './PanelHandler';\n\nexport type AsyncPanelRenderExtension = () => Promise<{ default: AsyncPanelExtension.AsyncPanelRenderExtension; __esModule: boolean }>;\n\nexport interface AsyncPanelHandlerProps {\n fallback?: JSX.Element | string;\n location: string;\n pluginKey: string;\n extensionKey?: string;\n renderProvider: AsyncPanelRenderExtension;\n contextProvider?: () => Context<{}>;\n RootType?: PanelHandlerProps['RootType'];\n}\n\nconst noop = () => {};\n\nconst loadModule = async (\n moduleProvider: () => Promise<{ default: AsyncPanelExtension.AsyncPanelRenderExtension; __esModule: boolean }>,\n extensionKey: string,\n location: string,\n): Promise<AsyncPanelExtension.AsyncPanelRenderExtension> => {\n try {\n const resolvedModule = await moduleProvider();\n // eslint-disable-next-line no-underscore-dangle\n if (!resolvedModule || !resolvedModule.__esModule || typeof resolvedModule.default !== 'function') {\n onDebug(({ error }) => ({\n level: error,\n\n message: `The provided dynamic import of extension \"${extensionKey}\" at location \"${location}\" does not look like a module that can be asynchronously loaded.`,\n components: ['AsyncPanelHandler'],\n meta: {\n location,\n extension: extensionKey,\n },\n }));\n\n return noop;\n }\n\n return resolvedModule.default;\n } catch (e) {\n onDebug(({ error }) => ({\n level: error,\n\n message: `Failed trying to execute the dynamic import from extension \"${extensionKey}\" for the async panel at location \"${location}\"`,\n components: ['AsyncPanelHandler'],\n meta: {\n location,\n extension: extensionKey,\n error: e,\n },\n }));\n\n return noop;\n }\n};\n\nexport const AsyncPanelHandler: FunctionComponent<AsyncPanelHandlerProps> = ({\n contextProvider,\n fallback,\n location,\n pluginKey,\n extensionKey = pluginKey,\n renderProvider,\n RootType,\n}) => {\n const rendererRef = useRef<AsyncPanelExtension.AsyncPanelRenderExtension>();\n const [isModuleLoaded, setIsModuleLoaded] = useState(false);\n\n const context = useMemo<Context<{}>>(() => {\n let contextValue: Context<{}> = {};\n\n if (typeof contextProvider === 'function') {\n try {\n contextValue = contextProvider();\n } catch (e) {\n onDebug(({ error }) => ({\n level: error,\n\n message: `Failed to invoke \"contextProvider\" function for extension \"${extensionKey}\" at location \"${location}\".\\nError: ${e}`,\n components: ['AsyncPanelHandler'],\n meta: {\n location,\n extension: extensionKey,\n },\n }));\n }\n }\n\n return contextValue;\n }, [contextProvider, location, extensionKey]);\n\n useEffect(\n function asyncLoadRendererModule() {\n let didCancel = false;\n\n async function loadRendererModule() {\n setIsModuleLoaded(false);\n rendererRef.current = undefined;\n\n const resolvedRenderer = await loadModule(renderProvider, extensionKey, location);\n\n if (didCancel) {\n return;\n }\n\n rendererRef.current = resolvedRenderer;\n setIsModuleLoaded(true);\n }\n\n loadRendererModule();\n\n return () => {\n didCancel = true;\n };\n },\n [renderProvider, extensionKey, location],\n );\n\n if (!isModuleLoaded || !rendererRef.current) {\n return fallback ? <>{fallback}</> : null;\n }\n\n return <PanelHandler render={rendererRef.current} RootType={RootType} context={context} />;\n};\n"]}
1
+ {"version":3,"file":"AsyncPanelHandler.js","sourceRoot":"","sources":["../../../lib/handlers/AsyncPanelHandler.tsx"],"names":[],"mappings":";;;;AACA,4DAAoE;AAEpE,wFAAiE;AAGjE,iDAA8C;AAc9C,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAEtB,MAAM,UAAU,GAAG,KAAK,EACpB,cAA8G,EAC9G,YAAoB,EACpB,QAAgB,EACsC,EAAE;IACxD,IAAI;QACA,MAAM,cAAc,GAAG,MAAM,cAAc,EAAE,CAAC;QAC9C,gDAAgD;QAChD,IAAI,CAAC,cAAc,IAAI,CAAC,cAAc,CAAC,UAAU,IAAI,OAAO,cAAc,CAAC,OAAO,KAAK,UAAU,EAAE;YAC/F,IAAA,qCAAO,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;gBACpB,KAAK,EAAE,KAAK;gBAEZ,OAAO,EAAE,6CAA6C,YAAY,kBAAkB,QAAQ,kEAAkE;gBAC9J,UAAU,EAAE,CAAC,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AC,mBAAmB,CAAC;oBACjC,IAAI,EAAE;wBACF,QAAQ;wBACR,SAAS,EAAE,YAAY;qBAC1B;iBACJ,CAAC,CAAC,CAAC;aACP;SACJ;QAED,OAAO,YAAY,CAAC;IACxB,CAAC,EAAE,CAAC,eAAe,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;IAE9C,IAAA,iBAAS,EACL,SAAS,uBAAuB;QAC5B,IAAI,SAAS,GAAG,KAAK,CAAC;QAEtB,KAAK,UAAU,kBAAkB;YAC7B,iBAAiB,CAAC,KAAK,CAAC,CAAC;YACzB,WAAW,CAAC,OAAO,GAAG,SAAS,CAAC;YAEhC,MAAM,gBAAgB,GAAG,MAAM,UAAU,CAAC,cAAc,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;YAElF,IAAI,SAAS,EAAE;gBACX,OAAO;aACV;YAED,WAAW,CAAC,OAAO,GAAG,gBAAgB,CAAC;YACvC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC;QAED,kBAAkB,EAAE,CAAC;QAErB,OAAO,GAAG,EAAE;YACR,SAAS,GAAG,IAAI,CAAC;QACrB,CAAC,CAAC;IACN,CAAC,EACD,CAAC,cAAc,EAAE,YAAY,EAAE,QAAQ,CAAC,CAC3C,CAAC;IAEF,IAAI,CAAC,cAAc,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE;QACzC,OAAO,QAAQ,CAAC,CAAC,CAAC,8DAAG,QAAQ,CAAI,CAAC,CAAC,CAAC,IAAI,CAAC;KAC5C;IAED,OAAO,8BAAC,2BAAY,IAAC,MAAM,EAAE,WAAW,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAI,CAAC;AAC/F,CAAC,CAAC;AAnEW,QAAA,iBAAiB,qBAmE5B","sourcesContent":["import type { FunctionComponent } from 'react';\nimport React, { useEffect, useRef, useState, useMemo } from 'react';\nimport type { AsyncPanelExtension } from '@atlassian/clientside-extensions';\nimport { onDebug } from '@atlassian/clientside-extensions-debug';\nimport type { Context } from '@atlassian/clientside-extensions-registry';\nimport type { PanelHandlerProps } from './PanelHandler';\nimport { PanelHandler } from './PanelHandler';\n\nexport type AsyncPanelRenderExtension = () => Promise<{ default: AsyncPanelExtension.AsyncPanelRenderExtension; __esModule: boolean }>;\n\nexport interface AsyncPanelHandlerProps {\n fallback?: JSX.Element | string;\n location: string;\n pluginKey: string;\n extensionKey?: string;\n renderProvider: AsyncPanelRenderExtension;\n contextProvider?: () => Context<{}>;\n RootType?: PanelHandlerProps['RootType'];\n}\n\nconst noop = () => {};\n\nconst loadModule = async (\n moduleProvider: () => Promise<{ default: AsyncPanelExtension.AsyncPanelRenderExtension; __esModule: boolean }>,\n extensionKey: string,\n location: string,\n): Promise<AsyncPanelExtension.AsyncPanelRenderExtension> => {\n try {\n const resolvedModule = await moduleProvider();\n // eslint-disable-next-line no-underscore-dangle\n if (!resolvedModule || !resolvedModule.__esModule || typeof resolvedModule.default !== 'function') {\n onDebug(({ error }) => ({\n level: error,\n\n message: `The provided dynamic import of extension \"${extensionKey}\" at location \"${location}\" does not look like a module that can be asynchronously loaded.`,\n components: ['AsyncPanelHandler'],\n meta: {\n location,\n extension: extensionKey,\n },\n }));\n\n return noop;\n }\n\n return resolvedModule.default;\n } catch (e) {\n onDebug(({ error }) => ({\n level: error,\n\n message: `Failed trying to execute the dynamic import from extension \"${extensionKey}\" for the async panel at location \"${location}\"`,\n components: ['AsyncPanelHandler'],\n meta: {\n location,\n extension: extensionKey,\n error: e,\n },\n }));\n\n return noop;\n }\n};\n\nexport const AsyncPanelHandler: FunctionComponent<AsyncPanelHandlerProps> = ({\n contextProvider,\n fallback,\n location,\n pluginKey,\n extensionKey = pluginKey,\n renderProvider,\n RootType,\n}) => {\n const rendererRef = useRef<AsyncPanelExtension.AsyncPanelRenderExtension>();\n const [isModuleLoaded, setIsModuleLoaded] = useState(false);\n\n const context = useMemo<Context<{}>>(() => {\n let contextValue: Context<{}> = {};\n\n if (typeof contextProvider === 'function') {\n try {\n contextValue = contextProvider();\n } catch (e) {\n onDebug(({ error }) => ({\n level: error,\n\n message: `Failed to invoke \"contextProvider\" function for extension \"${extensionKey}\" at location \"${location}\".\\nError: ${e}`,\n components: ['AsyncPanelHandler'],\n meta: {\n location,\n extension: extensionKey,\n },\n }));\n }\n }\n\n return contextValue;\n }, [contextProvider, location, extensionKey]);\n\n useEffect(\n function asyncLoadRendererModule() {\n let didCancel = false;\n\n async function loadRendererModule() {\n setIsModuleLoaded(false);\n rendererRef.current = undefined;\n\n const resolvedRenderer = await loadModule(renderProvider, extensionKey, location);\n\n if (didCancel) {\n return;\n }\n\n rendererRef.current = resolvedRenderer;\n setIsModuleLoaded(true);\n }\n\n loadRendererModule();\n\n return () => {\n didCancel = true;\n };\n },\n [renderProvider, extensionKey, location],\n );\n\n if (!isModuleLoaded || !rendererRef.current) {\n return fallback ? <>{fallback}</> : null;\n }\n\n return <PanelHandler render={rendererRef.current} RootType={RootType} context={context} />;\n};\n"]}
@@ -2,12 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ButtonHandler = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const react_1 = tslib_1.__importDefault(require("react"));
6
- const standard_button_1 = tslib_1.__importDefault(require("@atlaskit/button/standard-button"));
7
- exports.ButtonHandler = ({ appearance, children, disabled, hidden, iconAfter, iconBefore, onAction, spacing, }) => {
5
+ const react_1 = (0, tslib_1.__importDefault)(require("react"));
6
+ const standard_button_1 = (0, tslib_1.__importDefault)(require("@atlaskit/button/standard-button"));
7
+ const ButtonHandler = ({ appearance, children, disabled, hidden, iconAfter, iconBefore, onAction, spacing, }) => {
8
8
  if (hidden) {
9
9
  return null;
10
10
  }
11
11
  return (react_1.default.createElement(standard_button_1.default, { type: "button", appearance: appearance, iconAfter: iconAfter, iconBefore: iconBefore, isDisabled: disabled, onClick: onAction, spacing: spacing }, children));
12
12
  };
13
+ exports.ButtonHandler = ButtonHandler;
13
14
  //# sourceMappingURL=ButtonHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonHandler.js","sourceRoot":"","sources":["../../../lib/handlers/ButtonHandler.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAC1B,+FAAsD;AAMzC,QAAA,aAAa,GAA0C,CAAC,EACjE,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,SAAS,EACT,UAAU,EACV,QAAQ,EACR,OAAO,GACV,EAAE,EAAE;IACD,IAAI,MAAM,EAAE;QACR,OAAO,IAAI,CAAC;KACf;IAED,OAAO,CACH,8BAAC,yBAAM,IACH,IAAI,EAAC,QAAQ,EACb,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,QAAQ,EACpB,OAAO,EAAE,QAAQ,EACjB,OAAO,EAAE,OAAO,IAEf,QAAQ,CACJ,CACZ,CAAC;AACN,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport Button from '@atlaskit/button/standard-button';\nimport type { FunctionComponent } from 'react';\nimport type { OnClickHandler } from './types';\n\nexport interface ButtonHandlerProps extends OnClickHandler {}\n\nexport const ButtonHandler: FunctionComponent<ButtonHandlerProps> = ({\n appearance,\n children,\n disabled,\n hidden,\n iconAfter,\n iconBefore,\n onAction,\n spacing,\n}) => {\n if (hidden) {\n return null;\n }\n\n return (\n <Button\n type=\"button\"\n appearance={appearance}\n iconAfter={iconAfter}\n iconBefore={iconBefore}\n isDisabled={disabled}\n onClick={onAction}\n spacing={spacing}\n >\n {children}\n </Button>\n );\n};\n"]}
1
+ {"version":3,"file":"ButtonHandler.js","sourceRoot":"","sources":["../../../lib/handlers/ButtonHandler.tsx"],"names":[],"mappings":";;;;AAAA,+DAA0B;AAC1B,oGAAsD;AAM/C,MAAM,aAAa,GAA0C,CAAC,EACjE,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,SAAS,EACT,UAAU,EACV,QAAQ,EACR,OAAO,GACV,EAAE,EAAE;IACD,IAAI,MAAM,EAAE;QACR,OAAO,IAAI,CAAC;KACf;IAED,OAAO,CACH,8BAAC,yBAAM,IACH,IAAI,EAAC,QAAQ,EACb,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,QAAQ,EACpB,OAAO,EAAE,QAAQ,EACjB,OAAO,EAAE,OAAO,IAEf,QAAQ,CACJ,CACZ,CAAC;AACN,CAAC,CAAC;AA3BW,QAAA,aAAa,iBA2BxB","sourcesContent":["import React from 'react';\nimport Button from '@atlaskit/button/standard-button';\nimport type { FunctionComponent } from 'react';\nimport type { OnClickHandler } from './types';\n\nexport interface ButtonHandlerProps extends OnClickHandler {}\n\nexport const ButtonHandler: FunctionComponent<ButtonHandlerProps> = ({\n appearance,\n children,\n disabled,\n hidden,\n iconAfter,\n iconBefore,\n onAction,\n spacing,\n}) => {\n if (hidden) {\n return null;\n }\n\n return (\n <Button\n type=\"button\"\n appearance={appearance}\n iconAfter={iconAfter}\n iconBefore={iconBefore}\n isDisabled={disabled}\n onClick={onAction}\n spacing={spacing}\n >\n {children}\n </Button>\n );\n};\n"]}
@@ -2,12 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LinkHandler = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const react_1 = tslib_1.__importDefault(require("react"));
6
- const standard_button_1 = tslib_1.__importDefault(require("@atlaskit/button/standard-button"));
7
- exports.LinkHandler = ({ appearance = 'link', children, disabled, hidden, href, iconAfter, iconBefore, onAction, spacing, }) => {
5
+ const react_1 = (0, tslib_1.__importDefault)(require("react"));
6
+ const standard_button_1 = (0, tslib_1.__importDefault)(require("@atlaskit/button/standard-button"));
7
+ const LinkHandler = ({ appearance = 'link', children, disabled, hidden, href, iconAfter, iconBefore, onAction, spacing, }) => {
8
8
  if (hidden) {
9
9
  return null;
10
10
  }
11
11
  return (react_1.default.createElement(standard_button_1.default, { appearance: appearance, href: href, iconAfter: iconAfter, iconBefore: iconBefore, isDisabled: disabled, onClick: onAction, spacing: spacing }, children));
12
12
  };
13
+ exports.LinkHandler = LinkHandler;
13
14
  //# sourceMappingURL=LinkHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LinkHandler.js","sourceRoot":"","sources":["../../../lib/handlers/LinkHandler.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAC1B,+FAAsD;AAQzC,QAAA,WAAW,GAAwC,CAAC,EAC7D,UAAU,GAAG,MAAM,EACnB,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,SAAS,EACT,UAAU,EACV,QAAQ,EACR,OAAO,GACV,EAAE,EAAE;IACD,IAAI,MAAM,EAAE;QACR,OAAO,IAAI,CAAC;KACf;IAED,OAAO,CACH,8BAAC,yBAAM,IACH,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,QAAQ,EACpB,OAAO,EAAE,QAAQ,EACjB,OAAO,EAAE,OAAO,IAEf,QAAQ,CACJ,CACZ,CAAC;AACN,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport Button from '@atlaskit/button/standard-button';\nimport type { FunctionComponent } from 'react';\nimport type { OnClickHandler } from './types';\n\nexport interface LinkHandlerProps extends Partial<OnClickHandler> {\n href: string;\n}\n\nexport const LinkHandler: FunctionComponent<LinkHandlerProps> = ({\n appearance = 'link',\n children,\n disabled,\n hidden,\n href,\n iconAfter,\n iconBefore,\n onAction,\n spacing,\n}) => {\n if (hidden) {\n return null;\n }\n\n return (\n <Button\n appearance={appearance}\n href={href}\n iconAfter={iconAfter}\n iconBefore={iconBefore}\n isDisabled={disabled}\n onClick={onAction}\n spacing={spacing}\n >\n {children}\n </Button>\n );\n};\n"]}
1
+ {"version":3,"file":"LinkHandler.js","sourceRoot":"","sources":["../../../lib/handlers/LinkHandler.tsx"],"names":[],"mappings":";;;;AAAA,+DAA0B;AAC1B,oGAAsD;AAQ/C,MAAM,WAAW,GAAwC,CAAC,EAC7D,UAAU,GAAG,MAAM,EACnB,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,SAAS,EACT,UAAU,EACV,QAAQ,EACR,OAAO,GACV,EAAE,EAAE;IACD,IAAI,MAAM,EAAE;QACR,OAAO,IAAI,CAAC;KACf;IAED,OAAO,CACH,8BAAC,yBAAM,IACH,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,QAAQ,EACpB,OAAO,EAAE,QAAQ,EACjB,OAAO,EAAE,OAAO,IAEf,QAAQ,CACJ,CACZ,CAAC;AACN,CAAC,CAAC;AA5BW,QAAA,WAAW,eA4BtB","sourcesContent":["import React from 'react';\nimport Button from '@atlaskit/button/standard-button';\nimport type { FunctionComponent } from 'react';\nimport type { OnClickHandler } from './types';\n\nexport interface LinkHandlerProps extends Partial<OnClickHandler> {\n href: string;\n}\n\nexport const LinkHandler: FunctionComponent<LinkHandlerProps> = ({\n appearance = 'link',\n children,\n disabled,\n hidden,\n href,\n iconAfter,\n iconBefore,\n onAction,\n spacing,\n}) => {\n if (hidden) {\n return null;\n }\n\n return (\n <Button\n appearance={appearance}\n href={href}\n iconAfter={iconAfter}\n iconBefore={iconBefore}\n isDisabled={disabled}\n onClick={onAction}\n spacing={spacing}\n >\n {children}\n </Button>\n );\n};\n"]}
@@ -2,14 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ModalWithActionHandler = exports.ModalHandler = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const react_1 = tslib_1.__importStar(require("react"));
6
- const modal_dialog_1 = tslib_1.__importStar(require("@atlaskit/modal-dialog"));
7
- const loading_button_1 = tslib_1.__importDefault(require("@atlaskit/button/loading-button"));
5
+ const react_1 = (0, tslib_1.__importStar)(require("react"));
6
+ const modal_dialog_1 = (0, tslib_1.__importStar)(require("@atlaskit/modal-dialog"));
7
+ const loading_button_1 = (0, tslib_1.__importDefault)(require("@atlaskit/button/loading-button"));
8
8
  const clientside_extensions_1 = require("@atlassian/clientside-extensions");
9
9
  const ButtonHandler_1 = require("./ButtonHandler");
10
10
  const ModalInnerBody = ({ modalApi }) => {
11
- const ref = react_1.useRef(null);
12
- react_1.useEffect(() => {
11
+ const ref = (0, react_1.useRef)(null);
12
+ (0, react_1.useEffect)(() => {
13
13
  const node = ref.current;
14
14
  if (node) {
15
15
  modalApi.getRenderCallback()(node);
@@ -22,9 +22,9 @@ const ModalInnerBody = ({ modalApi }) => {
22
22
  }, [modalApi]);
23
23
  return react_1.default.createElement("div", { ref: ref });
24
24
  };
25
- exports.ModalHandler = ({ render, isOpen, onClose, __withoutTransition = false, __disableFocusLock = false, }) => {
26
- const [actions, setActions] = react_1.useState([]);
27
- const modalApi = react_1.useMemo(() => {
25
+ const ModalHandler = ({ render, isOpen, onClose, __withoutTransition = false, __disableFocusLock = false, }) => {
26
+ const [actions, setActions] = (0, react_1.useState)([]);
27
+ const modalApi = (0, react_1.useMemo)(() => {
28
28
  const api = new clientside_extensions_1.ModalExtension.Api(onClose, setActions);
29
29
  render(api);
30
30
  return api;
@@ -34,14 +34,14 @@ exports.ModalHandler = ({ render, isOpen, onClose, __withoutTransition = false,
34
34
  // When the stackIndex > 0 this will disable the focus lock of the Modal. That's quite naive implementation since we are abusing
35
35
  // the Atlaskit stacking mechanism.
36
36
  const stackIndex = __disableFocusLock ? 1 : 0;
37
- const onCloseHandler = react_1.useCallback((e) => {
37
+ const onCloseHandler = (0, react_1.useCallback)((e) => {
38
38
  const closeResult = modalApi.getOnCloseCallback()(e);
39
39
  // prevent closing of modal if "closeRequest" is "false"
40
40
  if (closeResult !== false) {
41
41
  onClose();
42
42
  }
43
43
  }, [modalApi, onClose]);
44
- const actionsAsButtons = react_1.useMemo(() => actions.map(({ testId, isLoading, text, onClick, isDisabled }, index) => (
44
+ const actionsAsButtons = (0, react_1.useMemo)(() => actions.map(({ testId, isLoading, text, onClick, isDisabled }, index) => (
45
45
  // eslint-disable-next-line react/no-array-index-key
46
46
  react_1.default.createElement(loading_button_1.default, { key: index, isLoading: isLoading, testId: testId, isDisabled: isDisabled, onClick: onClick }, text))), [actions]);
47
47
  return (react_1.default.createElement(Wrapper, null, isOpen && (react_1.default.createElement(modal_dialog_1.default, { testId: "client-extensions-modal", width: modalApi.getWidth(), onClose: onCloseHandler, stackIndex: stackIndex },
@@ -51,16 +51,17 @@ exports.ModalHandler = ({ render, isOpen, onClose, __withoutTransition = false,
51
51
  react_1.default.createElement(ModalInnerBody, { modalApi: modalApi })),
52
52
  react_1.default.createElement(modal_dialog_1.ModalFooter, null, actionsAsButtons)))));
53
53
  };
54
- exports.ModalWithActionHandler = ({
54
+ exports.ModalHandler = ModalHandler;
55
+ const ModalWithActionHandler = ({
55
56
  // Action Handler Properties
56
57
  appearance, children, disabled, hidden, iconAfter, iconBefore, spacing,
57
58
  // Modal Handler Properties
58
59
  render, __withoutTransition, __disableFocusLock, }) => {
59
- const [isOpen, setIsOpen] = react_1.useState(false);
60
- const openModal = react_1.useCallback(() => {
60
+ const [isOpen, setIsOpen] = (0, react_1.useState)(false);
61
+ const openModal = (0, react_1.useCallback)(() => {
61
62
  setIsOpen(true);
62
63
  }, []);
63
- const closeModal = react_1.useCallback(() => {
64
+ const closeModal = (0, react_1.useCallback)(() => {
64
65
  setIsOpen(false);
65
66
  }, []);
66
67
  if (hidden) {
@@ -70,4 +71,5 @@ render, __withoutTransition, __disableFocusLock, }) => {
70
71
  react_1.default.createElement(ButtonHandler_1.ButtonHandler, { appearance: appearance, iconAfter: iconAfter, iconBefore: iconBefore, disabled: disabled, hidden: hidden, onAction: openModal, spacing: spacing }, children),
71
72
  react_1.default.createElement(exports.ModalHandler, { isOpen: isOpen, onClose: closeModal, render: render, __disableFocusLock: __disableFocusLock, __withoutTransition: __withoutTransition })));
72
73
  };
74
+ exports.ModalWithActionHandler = ModalWithActionHandler;
73
75
  //# sourceMappingURL=ModalHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ModalHandler.js","sourceRoot":"","sources":["../../../lib/handlers/ModalHandler.tsx"],"names":[],"mappings":";;;;AACA,uDAA2F;AAC3F,+EAAuH;AACvH,6FAA4D;AAC5D,4EAAkE;AAElE,mDAAgD;AAEhD,MAAM,cAAc,GAAwD,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACzF,MAAM,GAAG,GAAG,cAAM,CAAiB,IAAI,CAAC,CAAC;IAEzC,iBAAS,CAAC,GAAG,EAAE;QACX,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC;QAEzB,IAAI,IAAI,EAAE;YACN,QAAQ,CAAC,iBAAiB,EAAE,CAAC,IAAI,CAAC,CAAC;SACtC;QAED,OAAO,GAAG,EAAE;YACR,IAAI,IAAI,EAAE;gBACN,QAAQ,CAAC,kBAAkB,EAAE,CAAC,IAAI,CAAC,CAAC;aACvC;QACL,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,uCAAK,GAAG,EAAE,GAAG,GAAI,CAAC;AAC7B,CAAC,CAAC;AAUW,QAAA,YAAY,GAAyC,CAAC,EAC/D,MAAM,EACN,MAAM,EACN,OAAO,EACP,mBAAmB,GAAG,KAAK,EAC3B,kBAAkB,GAAG,KAAK,GAC7B,EAAE,EAAE;IACD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,gBAAQ,CAA+B,EAAE,CAAC,CAAC;IACzE,MAAM,QAAQ,GAAG,eAAO,CAAC,GAAG,EAAE;QAC1B,MAAM,GAAG,GAAG,IAAI,sCAAc,CAAC,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QACxD,MAAM,CAAC,GAAG,CAAC,CAAC;QACZ,OAAO,GAAG,CAAC;IACf,CAAC,EAAE,CAAC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Q,EAAE,CAAc,CAC1E;QACd,8BAAC,wBAAS;YACN,8BAAC,cAAc,IAAC,QAAQ,EAAE,QAAQ,GAAI,CAC9B;QACZ,8BAAC,0BAAW,QAAE,gBAAgB,CAAe,CACnC,CACjB,CACK,CACb,CAAC;AACN,CAAC,CAAC;AAQW,QAAA,sBAAsB,GAAmD,CAAC;AACnF,4BAA4B;AAC5B,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,SAAS,EACT,UAAU,EACV,OAAO;AAEP,2BAA2B;AAC3B,MAAM,EACN,mBAAmB,EACnB,kBAAkB,GACrB,EAAE,EAAE;IACD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,gBAAQ,CAAC,KAAK,CAAC,CAAC;IAE5C,MAAM,SAAS,GAAG,mBAAW,CAAC,GAAG,EAAE;QAC/B,SAAS,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,UAAU,GAAG,mBAAW,CAAC,GAAG,EAAE;QAChC,SAAS,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAI,MAAM,EAAE;QACR,OAAO,IAAI,CAAC;KACf;IAED,OAAO,CACH;QACI,8BAAC,6BAAa,IACV,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,SAAS,EACnB,OAAO,EAAE,OAAO,IAEf,QAAQ,CACG;QAChB,8BAAC,oBAAY,IACT,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,MAAM,EACd,kBAAkB,EAAE,kBAAkB,EACtC,mBAAmB,EAAE,mBAAmB,GAC1C,CACH,CACN,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { FunctionComponent } from 'react';\nimport React, { Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport ModalDialog, { ModalTransition, ModalBody, ModalHeader, ModalFooter, ModalTitle } from '@atlaskit/modal-dialog';\nimport LoadingButton from '@atlaskit/button/loading-button';\nimport { ModalExtension } from '@atlassian/clientside-extensions';\nimport type { OnClickHandler } from './types';\nimport { ButtonHandler } from './ButtonHandler';\n\nconst ModalInnerBody: FunctionComponent<{ modalApi: ModalExtension.Api }> = ({ modalApi }) => {\n const ref = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const node = ref.current;\n\n if (node) {\n modalApi.getRenderCallback()(node);\n }\n\n return () => {\n if (node) {\n modalApi.getCleanupCallback()(node);\n }\n };\n }, [modalApi]);\n\n return <div ref={ref} />;\n};\n\nexport interface ModalHandlerProps {\n render: ModalExtension.ModalRenderExtension;\n isOpen: boolean;\n onClose: () => void;\n __withoutTransition?: boolean;\n __disableFocusLock?: boolean;\n}\n\nexport const ModalHandler: FunctionComponent<ModalHandlerProps> = ({\n render,\n isOpen,\n onClose,\n __withoutTransition = false,\n __disableFocusLock = false,\n}) => {\n const [actions, setActions] = useState<ModalExtension.ModalAction[]>([]);\n const modalApi = useMemo(() => {\n const api = new ModalExtension.Api(onClose, setActions);\n render(api);\n return api;\n }, [render, onClose]);\n\n const Wrapper = __withoutTransition ? Fragment : ModalTransition;\n\n // Here will be dragons. That's a fishy solution for programmatically disabling the focus lock of the Atlaskit Modal component.\n // When the stackIndex > 0 this will disable the focus lock of the Modal. That's quite naive implementation since we are abusing\n // the Atlaskit stacking mechanism.\n const stackIndex = __disableFocusLock ? 1 : 0;\n\n const onCloseHandler = useCallback(\n (e) => {\n const closeResult = modalApi.getOnCloseCallback()(e);\n // prevent closing of modal if \"closeRequest\" is \"false\"\n if (closeResult !== false) {\n onClose();\n }\n },\n [modalApi, onClose],\n );\n\n const actionsAsButtons: JSX.Element[] = useMemo<JSX.Element[]>(\n () =>\n actions.map(({ testId, isLoading, text, onClick, isDisabled }, index) => (\n // eslint-disable-next-line react/no-array-index-key\n <LoadingButton key={index} isLoading={isLoading} testId={testId} isDisabled={isDisabled} onClick={onClick}>\n {text}\n </LoadingButton>\n )),\n [actions],\n );\n\n return (\n <Wrapper>\n {isOpen && (\n <ModalDialog testId=\"client-extensions-modal\" width={modalApi.getWidth()} onClose={onCloseHandler} stackIndex={stackIndex}>\n <ModalHeader>\n <ModalTitle appearance={modalApi.getAppearance()}>{modalApi.getTitle()}</ModalTitle>\n </ModalHeader>\n <ModalBody>\n <ModalInnerBody modalApi={modalApi} />\n </ModalBody>\n <ModalFooter>{actionsAsButtons}</ModalFooter>\n </ModalDialog>\n )}\n </Wrapper>\n );\n};\n\nexport interface ModalWithActionHandlerProps extends Omit<OnClickHandler, 'onAction'> {\n render: ModalExtension.ModalRenderExtension;\n __withoutTransition?: boolean;\n __disableFocusLock?: boolean;\n}\n\nexport const ModalWithActionHandler: FunctionComponent<ModalWithActionHandlerProps> = ({\n // Action Handler Properties\n appearance,\n children,\n disabled,\n hidden,\n iconAfter,\n iconBefore,\n spacing,\n\n // Modal Handler Properties\n render,\n __withoutTransition,\n __disableFocusLock,\n}) => {\n const [isOpen, setIsOpen] = useState(false);\n\n const openModal = useCallback(() => {\n setIsOpen(true);\n }, []);\n\n const closeModal = useCallback(() => {\n setIsOpen(false);\n }, []);\n\n if (hidden) {\n return null;\n }\n\n return (\n <>\n <ButtonHandler\n appearance={appearance}\n iconAfter={iconAfter}\n iconBefore={iconBefore}\n disabled={disabled}\n hidden={hidden}\n onAction={openModal}\n spacing={spacing}\n >\n {children}\n </ButtonHandler>\n <ModalHandler\n isOpen={isOpen}\n onClose={closeModal}\n render={render}\n __disableFocusLock={__disableFocusLock}\n __withoutTransition={__withoutTransition}\n />\n </>\n );\n};\n"]}
1
+ {"version":3,"file":"ModalHandler.js","sourceRoot":"","sources":["../../../lib/handlers/ModalHandler.tsx"],"names":[],"mappings":";;;;AACA,4DAA2F;AAC3F,oFAAuH;AACvH,kGAA4D;AAC5D,4EAAkE;AAElE,mDAAgD;A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sB,GAAmD,CAAC;AACnF,4BAA4B;AAC5B,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,SAAS,EACT,UAAU,EACV,OAAO;AAEP,2BAA2B;AAC3B,MAAM,EACN,mBAAmB,EACnB,kBAAkB,GACrB,EAAE,EAAE;IACD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAE5C,MAAM,SAAS,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QAC/B,SAAS,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,UAAU,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QAChC,SAAS,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAI,MAAM,EAAE;QACR,OAAO,IAAI,CAAC;KACf;IAED,OAAO,CACH;QACI,8BAAC,6BAAa,IACV,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,SAAS,EACnB,OAAO,EAAE,OAAO,IAEf,QAAQ,CACG;QAChB,8BAAC,oBAAY,IACT,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,MAAM,EACd,kBAAkB,EAAE,kBAAkB,EACtC,mBAAmB,EAAE,mBAAmB,GAC1C,CACH,CACN,CAAC;AACN,CAAC,CAAC;AAnDW,QAAA,sBAAsB,0BAmDjC","sourcesContent":["import type { FunctionComponent } from 'react';\nimport React, { Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport ModalDialog, { ModalTransition, ModalBody, ModalHeader, ModalFooter, ModalTitle } from '@atlaskit/modal-dialog';\nimport LoadingButton from '@atlaskit/button/loading-button';\nimport { ModalExtension } from '@atlassian/clientside-extensions';\nimport type { OnClickHandler } from './types';\nimport { ButtonHandler } from './ButtonHandler';\n\nconst ModalInnerBody: FunctionComponent<{ modalApi: ModalExtension.Api }> = ({ modalApi }) => {\n const ref = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const node = ref.current;\n\n if (node) {\n modalApi.getRenderCallback()(node);\n }\n\n return () => {\n if (node) {\n modalApi.getCleanupCallback()(node);\n }\n };\n }, [modalApi]);\n\n return <div ref={ref} />;\n};\n\nexport interface ModalHandlerProps {\n render: ModalExtension.ModalRenderExtension;\n isOpen: boolean;\n onClose: () => void;\n __withoutTransition?: boolean;\n __disableFocusLock?: boolean;\n}\n\nexport const ModalHandler: FunctionComponent<ModalHandlerProps> = ({\n render,\n isOpen,\n onClose,\n __withoutTransition = false,\n __disableFocusLock = false,\n}) => {\n const [actions, setActions] = useState<ModalExtension.ModalAction[]>([]);\n const modalApi = useMemo(() => {\n const api = new ModalExtension.Api(onClose, setActions);\n render(api);\n return api;\n }, [render, onClose]);\n\n const Wrapper = __withoutTransition ? Fragment : ModalTransition;\n\n // Here will be dragons. That's a fishy solution for programmatically disabling the focus lock of the Atlaskit Modal component.\n // When the stackIndex > 0 this will disable the focus lock of the Modal. That's quite naive implementation since we are abusing\n // the Atlaskit stacking mechanism.\n const stackIndex = __disableFocusLock ? 1 : 0;\n\n const onCloseHandler = useCallback(\n (e) => {\n const closeResult = modalApi.getOnCloseCallback()(e);\n // prevent closing of modal if \"closeRequest\" is \"false\"\n if (closeResult !== false) {\n onClose();\n }\n },\n [modalApi, onClose],\n );\n\n const actionsAsButtons: JSX.Element[] = useMemo<JSX.Element[]>(\n () =>\n actions.map(({ testId, isLoading, text, onClick, isDisabled }, index) => (\n // eslint-disable-next-line react/no-array-index-key\n <LoadingButton key={index} isLoading={isLoading} testId={testId} isDisabled={isDisabled} onClick={onClick}>\n {text}\n </LoadingButton>\n )),\n [actions],\n );\n\n return (\n <Wrapper>\n {isOpen && (\n <ModalDialog testId=\"client-extensions-modal\" width={modalApi.getWidth()} onClose={onCloseHandler} stackIndex={stackIndex}>\n <ModalHeader>\n <ModalTitle appearance={modalApi.getAppearance()}>{modalApi.getTitle()}</ModalTitle>\n </ModalHeader>\n <ModalBody>\n <ModalInnerBody modalApi={modalApi} />\n </ModalBody>\n <ModalFooter>{actionsAsButtons}</ModalFooter>\n </ModalDialog>\n )}\n </Wrapper>\n );\n};\n\nexport interface ModalWithActionHandlerProps extends Omit<OnClickHandler, 'onAction'> {\n render: ModalExtension.ModalRenderExtension;\n __withoutTransition?: boolean;\n __disableFocusLock?: boolean;\n}\n\nexport const ModalWithActionHandler: FunctionComponent<ModalWithActionHandlerProps> = ({\n // Action Handler Properties\n appearance,\n children,\n disabled,\n hidden,\n iconAfter,\n iconBefore,\n spacing,\n\n // Modal Handler Properties\n render,\n __withoutTransition,\n __disableFocusLock,\n}) => {\n const [isOpen, setIsOpen] = useState(false);\n\n const openModal = useCallback(() => {\n setIsOpen(true);\n }, []);\n\n const closeModal = useCallback(() => {\n setIsOpen(false);\n }, []);\n\n if (hidden) {\n return null;\n }\n\n return (\n <>\n <ButtonHandler\n appearance={appearance}\n iconAfter={iconAfter}\n iconBefore={iconBefore}\n disabled={disabled}\n hidden={hidden}\n onAction={openModal}\n spacing={spacing}\n >\n {children}\n </ButtonHandler>\n <ModalHandler\n isOpen={isOpen}\n onClose={closeModal}\n render={render}\n __disableFocusLock={__disableFocusLock}\n __withoutTransition={__withoutTransition}\n />\n </>\n );\n};\n"]}
@@ -2,13 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PanelHandler = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const react_1 = tslib_1.__importStar(require("react"));
5
+ const react_1 = (0, tslib_1.__importStar)(require("react"));
6
6
  const clientside_extensions_1 = require("@atlassian/clientside-extensions");
7
7
  const isDiv = (RooType) => RooType === 'div';
8
- exports.PanelHandler = ({ render, RootType = 'div', context }) => {
9
- const panelApi = react_1.useMemo(() => new clientside_extensions_1.PanelExtension.Api(), []);
10
- const ref = react_1.useRef(null);
11
- react_1.useEffect(function callMountAndUnmountLifecycleCallbacks() {
8
+ const PanelHandler = ({ render, RootType = 'div', context }) => {
9
+ const panelApi = (0, react_1.useMemo)(() => new clientside_extensions_1.PanelExtension.Api(), []);
10
+ const ref = (0, react_1.useRef)(null);
11
+ (0, react_1.useEffect)(function callMountAndUnmountLifecycleCallbacks() {
12
12
  const node = ref.current;
13
13
  if (render) {
14
14
  render(panelApi, context);
@@ -27,4 +27,5 @@ exports.PanelHandler = ({ render, RootType = 'div', context }) => {
27
27
  }
28
28
  return react_1.default.createElement(RootType, { ref: ref });
29
29
  };
30
+ exports.PanelHandler = PanelHandler;
30
31
  //# sourceMappingURL=PanelHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PanelHandler.js","sourceRoot":"","sources":["../../../lib/handlers/PanelHandler.tsx"],"names":[],"mappings":";;;;AACA,uDAA0D;AAE1D,4EAAkE;AAelE,MAAM,KAAK,GAAG,CAAC,OAAe,EAAoB,EAAE,CAAC,OAAO,KAAK,KAAK,CAAC;AAE1D,QAAA,YAAY,GAAyC,CAAC,EAAE,MAAM,EAAE,QAAQ,GAAG,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE;IACxG,MAAM,QAAQ,GAAG,eAAO,CAAC,GAAG,EAAE,CAAC,IAAI,sCAAc,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7D,MAAM,GAAG,GAAG,cAAM,CAAmC,IAAI,CAAC,CAAC;IAE3D,iBAAS,CACL,SAAS,qCAAqC;QAC1C,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC;QAEzB,IAAI,MAAM,EAAE;YACR,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;SAC7B;QAED,IAAI,IAAI,EAAE;YACN,QAAQ,CAAC,iBAAiB,EAAE,CAAC,IAAI,CAAC,CAAC;SACtC;QAED,OAAO,GAAG,EAAE;YACR,IAAI,IAAI,EAAE;gBACN,QAAQ,CAAC,kBAAkB,EAAE,CAAC,IAAI,CAAC,CAAC;aACvC;QACL,CAAC,CAAC;IACN,CAAC,EACD,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAC9B,CAAC;IAEF,IAAI,KAAK,CAAC,QAAQ,CAAC,EAAE;QACjB,OAAO,8BAAC,QAAQ,IAAC,GAAG,EAAE,GAAuC,GAAI,CAAC;KACrE;IAED,OAAO,8BAAC,QAAQ,IAAC,GAAG,EAAE,GAAwC,GAAI,CAAC;AACvE,CAAC,CAAC","sourcesContent":["import type { FunctionComponent, MutableRefObject } from 'react';\nimport React, { useEffect, useMemo, useRef } from 'react';\nimport type { Context } from '@atlassian/clientside-extensions-registry';\nimport { PanelExtension } from '@atlassian/clientside-extensions';\n\nexport interface PanelHandlerProps {\n render: PanelExtension.PanelRenderExtension;\n RootType?: 'div' | 'span';\n /*\n Hello dear reader of inline comments. You might rightfully ask: what the hell is \"context\" doing here.\n Well turns out you are not the first.\n The reason is, that async-panel is reusing the panel handler under the hood. And the only way to let the panel have\n access to the context is by passing it through via a \"contextProvider\" (check the AsyncPanelExtension).\n So yeah, that is why we are here. And that is why \"context\" has to stay.\n */\n context?: Context<{}>;\n}\n\nconst isDiv = (RooType: string): RooType is 'div' => RooType === 'div';\n\nexport const PanelHandler: FunctionComponent<PanelHandlerProps> = ({ render, RootType = 'div', context }) => {\n const panelApi = useMemo(() => new PanelExtension.Api(), []);\n const ref = useRef<HTMLDivElement | HTMLSpanElement>(null);\n\n useEffect(\n function callMountAndUnmountLifecycleCallbacks() {\n const node = ref.current;\n\n if (render) {\n render(panelApi, context);\n }\n\n if (node) {\n panelApi.getRenderCallback()(node);\n }\n\n return () => {\n if (node) {\n panelApi.getCleanupCallback()(node);\n }\n };\n },\n [panelApi, render, context],\n );\n\n if (isDiv(RootType)) {\n return <RootType ref={ref as MutableRefObject<HTMLDivElement>} />;\n }\n\n return <RootType ref={ref as MutableRefObject<HTMLSpanElement>} />;\n};\n"]}
1
+ {"version":3,"file":"PanelHandler.js","sourceRoot":"","sources":["../../../lib/handlers/PanelHandler.tsx"],"names":[],"mappings":";;;;AACA,4DAA0D;AAE1D,4EAAkE;AAelE,MAAM,KAAK,GAAG,CAAC,OAAe,EAAoB,EAAE,CAAC,OAAO,KAAK,KAAK,CAAC;AAEhE,MAAM,YAAY,GAAyC,CAAC,EAAE,MAAM,EAAE,QAAQ,GAAG,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE;IACxG,MAAM,QAAQ,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,IAAI,sCAAc,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7D,MAAM,GAAG,GAAG,IAAA,cAAM,EAAmC,IAAI,CAAC,CAAC;IAE3D,IAAA,iBAAS,EACL,SAAS,qCAAqC;QAC1C,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC;QAEzB,IAAI,MAAM,EAAE;YACR,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;SAC7B;QAED,IAAI,IAAI,EAAE;YACN,QAAQ,CAAC,iBAAiB,EAAE,CAAC,IAAI,CAAC,CAAC;SACtC;QAED,OAAO,GAAG,EAAE;YACR,IAAI,IAAI,EAAE;gBACN,QAAQ,CAAC,kBAAkB,EAAE,CAAC,IAAI,CAAC,CAAC;aACvC;QACL,CAAC,CAAC;IACN,CAAC,EACD,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAC9B,CAAC;IAEF,IAAI,KAAK,CAAC,QAAQ,CAAC,EAAE;QACjB,OAAO,8BAAC,QAAQ,IAAC,GAAG,EAAE,GAAuC,GAAI,CAAC;KACrE;IAED,OAAO,8BAAC,QAAQ,IAAC,GAAG,EAAE,GAAwC,GAAI,CAAC;AACvE,CAAC,CAAC;AA9BW,QAAA,YAAY,gBA8BvB","sourcesContent":["import type { FunctionComponent, MutableRefObject } from 'react';\nimport React, { useEffect, useMemo, useRef } from 'react';\nimport type { Context } from '@atlassian/clientside-extensions-registry';\nimport { PanelExtension } from '@atlassian/clientside-extensions';\n\nexport interface PanelHandlerProps {\n render: PanelExtension.PanelRenderExtension;\n RootType?: 'div' | 'span';\n /*\n Hello dear reader of inline comments. You might rightfully ask: what the hell is \"context\" doing here.\n Well turns out you are not the first.\n The reason is, that async-panel is reusing the panel handler under the hood. And the only way to let the panel have\n access to the context is by passing it through via a \"contextProvider\" (check the AsyncPanelExtension).\n So yeah, that is why we are here. And that is why \"context\" has to stay.\n */\n context?: Context<{}>;\n}\n\nconst isDiv = (RooType: string): RooType is 'div' => RooType === 'div';\n\nexport const PanelHandler: FunctionComponent<PanelHandlerProps> = ({ render, RootType = 'div', context }) => {\n const panelApi = useMemo(() => new PanelExtension.Api(), []);\n const ref = useRef<HTMLDivElement | HTMLSpanElement>(null);\n\n useEffect(\n function callMountAndUnmountLifecycleCallbacks() {\n const node = ref.current;\n\n if (render) {\n render(panelApi, context);\n }\n\n if (node) {\n panelApi.getRenderCallback()(node);\n }\n\n return () => {\n if (node) {\n panelApi.getCleanupCallback()(node);\n }\n };\n },\n [panelApi, render, context],\n );\n\n if (isDiv(RootType)) {\n return <RootType ref={ref as MutableRefObject<HTMLDivElement>} />;\n }\n\n return <RootType ref={ref as MutableRefObject<HTMLSpanElement>} />;\n};\n"]}
@@ -2,9 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SectionHandler = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const react_1 = tslib_1.__importDefault(require("react"));
5
+ const react_1 = (0, tslib_1.__importDefault)(require("react"));
6
6
  // eslint-disable-next-line import/prefer-default-export
7
- exports.SectionHandler = ({ children }) => {
7
+ const SectionHandler = ({ children }) => {
8
8
  return react_1.default.createElement(react_1.default.Fragment, null, children);
9
9
  };
10
+ exports.SectionHandler = SectionHandler;
10
11
  //# sourceMappingURL=SectionHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SectionHandler.js","sourceRoot":"","sources":["../../../lib/handlers/SectionHandler.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAG1B,wDAAwD;AAC3C,QAAA,cAAc,GAAsB,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC9D,OAAO,8DAAG,QAAQ,CAAI,CAAC;AAC3B,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport type { FunctionComponent } from 'react';\n\n// eslint-disable-next-line import/prefer-default-export\nexport const SectionHandler: FunctionComponent = ({ children }) => {\n return <>{children}</>;\n};\n"]}
1
+ {"version":3,"file":"SectionHandler.js","sourceRoot":"","sources":["../../../lib/handlers/SectionHandler.tsx"],"names":[],"mappings":";;;;AAAA,+DAA0B;AAG1B,wDAAwD;AACjD,MAAM,cAAc,GAAsB,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC9D,OAAO,8DAAG,QAAQ,CAAI,CAAC;AAC3B,CAAC,CAAC;AAFW,QAAA,cAAc,kBAEzB","sourcesContent":["import React from 'react';\nimport type { FunctionComponent } from 'react';\n\n// eslint-disable-next-line import/prefer-default-export\nexport const SectionHandler: FunctionComponent = ({ children }) => {\n return <>{children}</>;\n};\n"]}
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExtensionType = exports.SectionHandler = exports.PanelHandler = exports.LinkHandler = exports.ButtonHandler = exports.ModalWithActionHandler = exports.ModalHandler = exports.AsyncPanelHandler = void 0;
3
4
  var AsyncPanelHandler_1 = require("./AsyncPanelHandler");
4
5
  Object.defineProperty(exports, "AsyncPanelHandler", { enumerable: true, get: function () { return AsyncPanelHandler_1.AsyncPanelHandler; } });
5
6
  var ModalHandler_1 = require("./ModalHandler");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/handlers/index.ts"],"names":[],"mappings":";;AAAA,yDAA2G;AAAlG,sHAAA,iBAAiB,OAAA;AAC1B,+CAAsH;AAA7G,4GAAA,YAAY,OAAA;AAAqB,sHAAA,sBAAsB,OAAA;AAChE,iDAAoE;AAA3D,8GAAA,aAAa,OAAA;AACtB,6CAA8D;AAArD,0GAAA,WAAW,OAAA;AACpB,+CAAiE;AAAxD,4GAAA,YAAY,OAAA;AACrB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AAEvB,0EAAiE;AAAxD,sHAAA,aAAa,OAAA","sourcesContent":["export { AsyncPanelHandler, AsyncPanelHandlerProps, AsyncPanelRenderExtension } from './AsyncPanelHandler';\nexport { ModalHandler, ModalHandlerProps, ModalWithActionHandler, ModalWithActionHandlerProps } from './ModalHandler';\nexport { ButtonHandler, ButtonHandlerProps } from './ButtonHandler';\nexport { LinkHandler, LinkHandlerProps } from './LinkHandler';\nexport { PanelHandler, PanelHandlerProps } from './PanelHandler';\nexport { SectionHandler } from './SectionHandler';\n\nexport { ExtensionType } from '@atlassian/clientside-extensions';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/handlers/index.ts"],"names":[],"mappings":";;;AAAA,yDAA2G;AAAlG,sHAAA,iBAAiB,OAAA;AAC1B,+CAAsH;AAA7G,4GAAA,YAAY,OAAA;AAAqB,sHAAA,sBAAsB,OAAA;AAChE,iDAAoE;AAA3D,8GAAA,aAAa,OAAA;AACtB,6CAA8D;AAArD,0GAAA,WAAW,OAAA;AACpB,+CAAiE;AAAxD,4GAAA,YAAY,OAAA;AACrB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AAEvB,0EAAiE;AAAxD,sHAAA,aAAa,OAAA","sourcesContent":["export { AsyncPanelHandler, AsyncPanelHandlerProps, AsyncPanelRenderExtension } from './AsyncPanelHandler';\nexport { ModalHandler, ModalHandlerProps, ModalWithActionHandler, ModalWithActionHandlerProps } from './ModalHandler';\nexport { ButtonHandler, ButtonHandlerProps } from './ButtonHandler';\nexport { LinkHandler, LinkHandlerProps } from './LinkHandler';\nexport { PanelHandler, PanelHandlerProps } from './PanelHandler';\nexport { SectionHandler } from './SectionHandler';\n\nexport { ExtensionType } from '@atlassian/clientside-extensions';\n"]}
package/dist/cjs/index.js CHANGED
@@ -1,24 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useDiscovery = exports.useValidation = exports.useLogging = exports.useDebug = exports.useWebPanelRenderer = exports.getValidatedExtensions = exports.renderElementAsReact = exports.ExtensionPointInfo = exports.ExtensionPoint = void 0;
3
4
  const tslib_1 = require("tslib");
4
5
  var ExtensionPoint_1 = require("./ExtensionPoint");
5
- Object.defineProperty(exports, "ExtensionPoint", { enumerable: true, get: function () { return ExtensionPoint_1.default; } });
6
+ Object.defineProperty(exports, "ExtensionPoint", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(ExtensionPoint_1).default; } });
6
7
  var ExtensionPointInfo_1 = require("./ExtensionPointInfo");
7
- Object.defineProperty(exports, "ExtensionPointInfo", { enumerable: true, get: function () { return ExtensionPointInfo_1.default; } });
8
+ Object.defineProperty(exports, "ExtensionPointInfo", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(ExtensionPointInfo_1).default; } });
8
9
  var renderElementAsReact_1 = require("./renderElementAsReact");
9
- Object.defineProperty(exports, "renderElementAsReact", { enumerable: true, get: function () { return renderElementAsReact_1.default; } });
10
+ Object.defineProperty(exports, "renderElementAsReact", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(renderElementAsReact_1).default; } });
10
11
  var ExtensionsObservable_1 = require("./ExtensionsObservable");
11
12
  Object.defineProperty(exports, "getValidatedExtensions", { enumerable: true, get: function () { return ExtensionsObservable_1.getValidatedExtensions; } });
12
- tslib_1.__exportStar(require("./useExtensions"), exports);
13
- tslib_1.__exportStar(require("./handlers"), exports);
13
+ (0, tslib_1.__exportStar)(require("./useExtensions"), exports);
14
+ (0, tslib_1.__exportStar)(require("./handlers"), exports);
14
15
  var useWebPanelRenderer_1 = require("./useWebPanelRenderer");
15
- Object.defineProperty(exports, "useWebPanelRenderer", { enumerable: true, get: function () { return useWebPanelRenderer_1.default; } });
16
+ Object.defineProperty(exports, "useWebPanelRenderer", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(useWebPanelRenderer_1).default; } });
16
17
  var useDebug_1 = require("./debug/useDebug");
17
- Object.defineProperty(exports, "useDebug", { enumerable: true, get: function () { return useDebug_1.default; } });
18
+ Object.defineProperty(exports, "useDebug", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(useDebug_1).default; } });
18
19
  var useLogging_1 = require("./debug/useLogging");
19
- Object.defineProperty(exports, "useLogging", { enumerable: true, get: function () { return useLogging_1.default; } });
20
+ Object.defineProperty(exports, "useLogging", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(useLogging_1).default; } });
20
21
  var useValidation_1 = require("./debug/useValidation");
21
- Object.defineProperty(exports, "useValidation", { enumerable: true, get: function () { return useValidation_1.default; } });
22
+ Object.defineProperty(exports, "useValidation", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(useValidation_1).default; } });
22
23
  var useDiscovery_1 = require("./debug/useDiscovery");
23
- Object.defineProperty(exports, "useDiscovery", { enumerable: true, get: function () { return useDiscovery_1.default; } });
24
+ Object.defineProperty(exports, "useDiscovery", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(useDiscovery_1).default; } });
24
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":";;;AAAA,mDAAkF;AAAzE,gHAAA,OAAO,OAAkB;AAClC,2DAAqE;AAA5D,wHAAA,OAAO,OAAsB;AACtC,+DAAyE;AAAhE,4HAAA,OAAO,OAAwB;AACxC,+DAAgE;AAAvD,8HAAA,sBAAsB,OAAA;AAE/B,0DAAgC;AAChC,qDAA2B;AAE3B,6DAAuE;AAA9D,0HAAA,OAAO,OAAuB;AAIvC,6CAAuD;AAA9C,oGAAA,OAAO,OAAY;AAC5B,iDAA2D;AAAlD,wGAAA,OAAO,OAAc;AAC9B,uDAAiE;AAAxD,8GAAA,OAAO,OAAiB;AACjC,qDAA+D;AAAtD,4GAAA,OAAO,OAAgB","sourcesContent":["export { default as ExtensionPoint, ExtensionPointProps } from './ExtensionPoint';\nexport { default as ExtensionPointInfo } from './ExtensionPointInfo';\nexport { default as renderElementAsReact } from './renderElementAsReact';\nexport { getValidatedExtensions } from './ExtensionsObservable';\n\nexport * from './useExtensions';\nexport * from './handlers';\n\nexport { default as useWebPanelRenderer } from './useWebPanelRenderer';\n\nexport type { Options, ExtensionState } from './types';\n\nexport { default as useDebug } from './debug/useDebug';\nexport { default as useLogging } from './debug/useLogging';\nexport { default as useValidation } from './debug/useValidation';\nexport { default as useDiscovery } from './debug/useDiscovery';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":";;;;AAAA,mDAAkF;AAAzE,8IAAA,OAAO,OAAkB;AAClC,2DAAqE;AAA5D,sJAAA,OAAO,OAAsB;AACtC,+DAAyE;AAAhE,0JAAA,OAAO,OAAwB;AACxC,+DAAgE;AAAvD,8HAAA,sBAAsB,OAAA;AAE/B,+DAAgC;AAChC,0DAA2B;AAE3B,6DAAuE;AAA9D,wJAAA,OAAO,OAAuB;AAIvC,6CAAuD;AAA9C,kIAAA,OAAO,OAAY;AAC5B,iDAA2D;AAAlD,sIAAA,OAAO,OAAc;AAC9B,uDAAiE;AAAxD,4IAAA,OAAO,OAAiB;AACjC,qDAA+D;AAAtD,0IAAA,OAAO,OAAgB","sourcesContent":["export { default as ExtensionPoint, ExtensionPointProps } from './ExtensionPoint';\nexport { default as ExtensionPointInfo } from './ExtensionPointInfo';\nexport { default as renderElementAsReact } from './renderElementAsReact';\nexport { getValidatedExtensions } from './ExtensionsObservable';\n\nexport * from './useExtensions';\nexport * from './handlers';\n\nexport { default as useWebPanelRenderer } from './useWebPanelRenderer';\n\nexport type { Options, ExtensionState } from './types';\n\nexport { default as useDebug } from './debug/useDebug';\nexport { default as useLogging } from './debug/useLogging';\nexport { default as useValidation } from './debug/useValidation';\nexport { default as useDiscovery } from './debug/useDiscovery';\n"]}
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const react_dom_1 = tslib_1.__importDefault(require("react-dom"));
5
- const react_1 = tslib_1.__importDefault(require("react"));
4
+ const react_dom_1 = (0, tslib_1.__importDefault)(require("react-dom"));
5
+ const react_1 = (0, tslib_1.__importDefault)(require("react"));
6
6
  function renderElementAsReact(renderApi, RenderElement, additionalProps) {
7
7
  renderApi
8
8
  .onMount((element) => {
9
9
  // eslint-disable-next-line react/jsx-props-no-spreading
10
- react_dom_1.default.render(react_1.default.createElement(RenderElement, Object.assign({}, additionalProps)), element);
10
+ react_dom_1.default.render(react_1.default.createElement(RenderElement, { ...additionalProps }), element);
11
11
  })
12
12
  .onUnmount((element) => {
13
13
  react_dom_1.default.unmountComponentAtNode(element);
@@ -1 +1 @@
1
- {"version":3,"file":"renderElementAsReact.js","sourceRoot":"","sources":["../../lib/renderElementAsReact.tsx"],"names":[],"mappings":";;;AAAA,kEAAiC;AAEjC,0DAA0B;AAG1B,SAAS,oBAAoB,CAAS,SAA6B,EAAE,aAAoC,EAAE,eAAwB;IAC/H,SAAS;SACJ,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QACjB,wDAAwD;QACxD,mBAAQ,CAAC,MAAM,CAAC,8BAAC,aAAa,oBAAM,eAA0B,EAAI,EAAE,OAAO,CAAC,CAAC;IACjF,CAAC,CAAC;SACD,SAAS,CAAC,CAAC,OAAO,EAAE,EAAE;QACnB,mBAAQ,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACX,CAAC;AAED,kBAAe,oBAAoB,CAAC","sourcesContent":["import ReactDOM from 'react-dom';\nimport type { ComponentType } from 'react';\nimport React from 'react';\nimport type { MountableExtension } from '@atlassian/clientside-extensions';\n\nfunction renderElementAsReact<PropsT>(renderApi: MountableExtension, RenderElement: ComponentType<PropsT>, additionalProps?: PropsT) {\n renderApi\n .onMount((element) => {\n // eslint-disable-next-line react/jsx-props-no-spreading\n ReactDOM.render(<RenderElement {...(additionalProps as PropsT)} />, element);\n })\n .onUnmount((element) => {\n ReactDOM.unmountComponentAtNode(element);\n });\n}\n\nexport default renderElementAsReact;\n"]}
1
+ {"version":3,"file":"renderElementAsReact.js","sourceRoot":"","sources":["../../lib/renderElementAsReact.tsx"],"names":[],"mappings":";;;AAAA,uEAAiC;AAEjC,+DAA0B;AAG1B,SAAS,oBAAoB,CAAS,SAA6B,EAAE,aAAoC,EAAE,eAAwB;IAC/H,SAAS;SACJ,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QACjB,wDAAwD;QACxD,mBAAQ,CAAC,MAAM,CAAC,8BAAC,aAAa,OAAM,eAA0B,GAAI,EAAE,OAAO,CAAC,CAAC;IACjF,CAAC,CAAC;SACD,SAAS,CAAC,CAAC,OAAO,EAAE,EAAE;QACnB,mBAAQ,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACX,CAAC;AAED,kBAAe,oBAAoB,CAAC","sourcesContent":["import ReactDOM from 'react-dom';\nimport type { ComponentType } from 'react';\nimport React from 'react';\nimport type { MountableExtension } from '@atlassian/clientside-extensions';\n\nfunction renderElementAsReact<PropsT>(renderApi: MountableExtension, RenderElement: ComponentType<PropsT>, additionalProps?: PropsT) {\n renderApi\n .onMount((element) => {\n // eslint-disable-next-line react/jsx-props-no-spreading\n ReactDOM.render(<RenderElement {...(additionalProps as PropsT)} />, element);\n })\n .onUnmount((element) => {\n ReactDOM.unmountComponentAtNode(element);\n });\n}\n\nexport default renderElementAsReact;\n"]}
@@ -2,15 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TableCell = exports.TableRow = exports.HeadCell = exports.HeadRow = exports.Table = exports.Blinker = exports.BlinkerContainer = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const styled_1 = tslib_1.__importDefault(require("@emotion/styled"));
5
+ const styled_1 = (0, tslib_1.__importDefault)(require("@emotion/styled"));
6
6
  const core_1 = require("@emotion/core");
7
- const colors = tslib_1.__importStar(require("@atlaskit/theme/colors"));
7
+ const colors = (0, tslib_1.__importStar)(require("@atlaskit/theme/colors"));
8
8
  const components_1 = require("@atlaskit/theme/components");
9
9
  const constants_1 = require("@atlaskit/theme/constants");
10
10
  exports.BlinkerContainer = styled_1.default.span `
11
11
  position: relative;
12
12
  `;
13
- const blinkAnimation = core_1.keyframes `
13
+ const blinkAnimation = (0, core_1.keyframes) `
14
14
  from {
15
15
  transform: scale(1);
16
16
  }
@@ -46,16 +46,16 @@ exports.Blinker = styled_1.default.button `
46
46
  // Using AK theme to be compatible with their dark mode.
47
47
  // Styles copied from: https://bitbucket.org/atlassian/atlassian-frontend/src/master/packages/design-system/dynamic-table/src/styled/
48
48
  const rowTheme = {
49
- focusOutline: components_1.themed({ light: colors.B100, dark: colors.B100 }),
50
- borderColor: components_1.themed({ light: colors.N40, dark: colors.DN50 }),
51
- highlightedBackground: components_1.themed({ light: colors.N20, dark: colors.DN50 }),
52
- hoverBackground: components_1.themed({ light: colors.N10, dark: colors.DN40 }),
53
- hoverHighlightedBackground: components_1.themed({ light: colors.N30, dark: colors.DN60 }),
49
+ focusOutline: (0, components_1.themed)({ light: colors.B100, dark: colors.B100 }),
50
+ borderColor: (0, components_1.themed)({ light: colors.N40, dark: colors.DN50 }),
51
+ highlightedBackground: (0, components_1.themed)({ light: colors.N20, dark: colors.DN50 }),
52
+ hoverBackground: (0, components_1.themed)({ light: colors.N10, dark: colors.DN40 }),
53
+ hoverHighlightedBackground: (0, components_1.themed)({ light: colors.N30, dark: colors.DN60 }),
54
54
  };
55
55
  const headTheme = {
56
- focusOutline: components_1.themed({ light: colors.B100, dark: colors.B100 }),
57
- borderColor: components_1.themed({ light: colors.N40, dark: colors.DN50 }),
58
- textColor: components_1.themed({ light: colors.N300, dark: colors.DN300 }),
56
+ focusOutline: (0, components_1.themed)({ light: colors.B100, dark: colors.B100 }),
57
+ borderColor: (0, components_1.themed)({ light: colors.N40, dark: colors.DN50 }),
58
+ textColor: (0, components_1.themed)({ light: colors.N300, dark: colors.DN300 }),
59
59
  };
60
60
  exports.Table = styled_1.default.table `
61
61
  border-collapse: collapse;
@@ -65,7 +65,7 @@ exports.HeadRow = styled_1.default.tr `
65
65
  border-bottom: 2px solid ${headTheme.borderColor};
66
66
  `;
67
67
  exports.HeadCell = styled_1.default.th `
68
- padding: ${constants_1.gridSize() / 2}px ${constants_1.gridSize}px;
68
+ padding: ${(0, constants_1.gridSize)() / 2}px ${constants_1.gridSize}px;
69
69
  &:first-of-type {
70
70
  padding-left: 0;
71
71
  }
@@ -97,7 +97,7 @@ exports.TableRow = styled_1.default.tr `
97
97
  `;
98
98
  exports.TableCell = styled_1.default.td `
99
99
  border: none;
100
- padding: ${constants_1.gridSize() / 1.2}px ${constants_1.gridSize}px;
100
+ padding: ${(0, constants_1.gridSize)() / 1.2}px ${constants_1.gridSize}px;
101
101
  text-align: left;
102
102
 
103
103
  &:first-of-type {
@@ -1 +1 @@
1
- {"version":3,"file":"styled.js","sourceRoot":"","sources":["../../lib/styled.ts"],"names":[],"mappings":";;;;AAAA,qEAAqC;AACrC,wCAA0C;AAC1C,uEAAiD;AACjD,2DAAoD;AACpD,yDAAqD;AAExC,QAAA,gBAAgB,GAAG,gBAAM,CAAC,IAAI,CAAA;;CAE1C,CAAC;AAEF,MAAM,cAAc,GAAG,gBAAS,CAAA;;;;;;;;CAQ/B,CAAC;AAEW,QAAA,OAAO,GAAG,gBAAM,CAAC,MAAM,CAAA;;;;;iBAKnB,cAAc;;;;;;;;;;;;;;;;;CAiB9B,CAAC;AAEF,qDAAqD;AACrD,wDAAwD;AACxD,qIAAqI;AACrI,MAAM,QAAQ,GAAG;IACb,YAAY,EAAE,mBAAM,CAAC,EAAE,KAAK,EAAE,MAAM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CAAC,YAAY;;CAElD,CAAC;AAEF,MAAM,YAAY,GAAG,KAAK,CAAC;AAEd,QAAA,QAAQ,GAAG,gBAAM,CAAC,EAAE,CAAA;+BACF,QAAQ,CAAC,WAAW;;4BAEvB,QAAQ,CAAC,eAAe;;;mBAGjC,YAAY,UAAU,QAAQ,CAAC,YAAY;2BACnC,YAAY;;CAEtC,CAAC;AAEW,QAAA,SAAS,GAAG,gBAAM,CAAC,EAAE,CAAA;;eAEnB,oBAAQ,EAAE,GAAG,GAAG,MAAM,oBAAQ;;;;;;;;;CAS5C,CAAC","sourcesContent":["import styled from '@emotion/styled';\nimport { keyframes } from '@emotion/core';\nimport * as colors from '@atlaskit/theme/colors';\nimport { themed } from '@atlaskit/theme/components';\nimport { gridSize } from '@atlaskit/theme/constants';\n\nexport const BlinkerContainer = styled.span`\n position: relative;\n`;\n\nconst blinkAnimation = keyframes`\n from {\n transform: scale(1);\n }\n\n to {\n transform: scale(1.3);\n }\n`;\n\nexport const Blinker = styled.button`\n height: 22px;\n width: 22px;\n background: rgba(7, 71, 166, 0.5);\n border-radius: 50%;\n animation: ${blinkAnimation} 1s ease-in-out infinite;\n animation-direction: alternate;\n cursor: pointer;\n border: none;\n\n &:after {\n display: block;\n background: rgb(7, 71, 166, 0.8);\n position: absolute;\n height: 12px;\n width: 12px;\n content: '';\n left: 50%;\n top: 50%;\n margin: -6px 0 0 -6px;\n border-radius: 50%;\n }\n`;\n\n// AK doesn't provide a plain Table styled component.\n// Using AK theme to be compatible with their dark mode.\n// Styles copied from: https://bitbucket.org/atlassian/atlassian-frontend/src/master/packages/design-system/dynamic-table/src/styled/\nconst rowTheme = {\n focusOutline: themed({ light: colors.B100, dark: colors.B100 }),\n borderColor: themed({ light: colors.N40, dark: colors.DN50 }),\n highlightedBackground: themed({ light: colors.N20, dark: colors.DN50 }),\n hoverBackground: themed({ light: colors.N10, dark: colors.DN40 }),\n hoverHighlightedBackground: themed({ light: colors.N30, dark: colors.DN60 }),\n};\n\nconst headTheme = {\n focusOutline: themed({ light: colors.B100, dark: colors.B100 }),\n borderColor: themed({ light: colors.N40, dark: colors.DN50 }),\n textColor: themed({ light: colors.N300, dark: colors.DN300 }),\n};\n\nexport const Table = styled.table`\n border-collapse: collapse;\n width: 100%;\n`;\n\nexport const HeadRow = styled.tr`\n border-bottom: 2px solid ${headTheme.borderColor};\n`;\n\nexport const HeadCell = styled.th`\n padding: ${gridSize() / 2}px ${gridSize}px;\n &:first-of-type {\n padding-left: 0;\n }\n &:last-of-type {\n padding-right: 0;\n }\n border: none;\n color: ${headTheme.textColor};\n box-sizing: border-box;\n font-size: 12px;\n font-weight: bold;\n position: relative;\n text-align: left;\n vertical-align: top;\n &:focus {\n outline: solid 2px ${headTheme.focusOutline};\n }\n`;\n\nconst outlineWidth = '2px';\n\nexport const TableRow = styled.tr`\n border-bottom: 2px solid ${rowTheme.borderColor};\n &:hover {\n background-color: ${rowTheme.hoverBackground};\n }\n &:focus {\n outline: ${outlineWidth} solid ${rowTheme.focusOutline};\n outline-offset: -${outlineWidth};\n }\n`;\n\nexport const TableCell = styled.td`\n border: none;\n padding: ${gridSize() / 1.2}px ${gridSize}px;\n text-align: left;\n\n &:first-of-type {\n padding-left: 0;\n }\n &:last-of-type {\n padding-right: 0;\n }\n`;\n"]}
1
+ {"version":3,"file":"styled.js","sourceRoot":"","sources":["../../lib/styled.ts"],"names":[],"mappings":";;;;AAAA,0EAAqC;AACrC,wCAA0C;AAC1C,4EAAiD;AACjD,2DAAoD;AACpD,yDAAqD;AAExC,QAAA,gBAAgB,GAAG,gBAAM,CAAC,IAAI,CAAA;;CAE1C,CAAC;AAEF,MAAM,cAAc,GAAG,IAAA,gBAAS,EAAA;;;;;;;;CAQ/B,CAAC;AAEW,QAAA,OAAO,GAAG,gBAAM,CAAC,MAAM,CAAA;;;;;iBAKnB,cAAc;;;;;;;;;;;;;;;;;CAiB9B,CAAC;AAEF,qDAAqD;AACrD,wDAAwD;AACxD,qIAAqI;AACrI,MAAM,Q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AE,CAAA;eAClB,IAAA,oBAAQ,GAAE,GAAG,CAAC,MAAM,oBAAQ;;;;;;;;aAQ9B,SAAS,CAAC,SAAS;;;;;;;;6BAQH,SAAS,CAAC,YAAY;;CAElD,CAAC;AAEF,MAAM,YAAY,GAAG,KAAK,CAAC;AAEd,QAAA,QAAQ,GAAG,gBAAM,CAAC,EAAE,CAAA;+BACF,QAAQ,CAAC,WAAW;;4BAEvB,QAAQ,CAAC,eAAe;;;mBAGjC,YAAY,UAAU,QAAQ,CAAC,YAAY;2BACnC,YAAY;;CAEtC,CAAC;AAEW,QAAA,SAAS,GAAG,gBAAM,CAAC,EAAE,CAAA;;eAEnB,IAAA,oBAAQ,GAAE,GAAG,GAAG,MAAM,oBAAQ;;;;;;;;;CAS5C,CAAC","sourcesContent":["import styled from '@emotion/styled';\nimport { keyframes } from '@emotion/core';\nimport * as colors from '@atlaskit/theme/colors';\nimport { themed } from '@atlaskit/theme/components';\nimport { gridSize } from '@atlaskit/theme/constants';\n\nexport const BlinkerContainer = styled.span`\n position: relative;\n`;\n\nconst blinkAnimation = keyframes`\n from {\n transform: scale(1);\n }\n\n to {\n transform: scale(1.3);\n }\n`;\n\nexport const Blinker = styled.button`\n height: 22px;\n width: 22px;\n background: rgba(7, 71, 166, 0.5);\n border-radius: 50%;\n animation: ${blinkAnimation} 1s ease-in-out infinite;\n animation-direction: alternate;\n cursor: pointer;\n border: none;\n\n &:after {\n display: block;\n background: rgb(7, 71, 166, 0.8);\n position: absolute;\n height: 12px;\n width: 12px;\n content: '';\n left: 50%;\n top: 50%;\n margin: -6px 0 0 -6px;\n border-radius: 50%;\n }\n`;\n\n// AK doesn't provide a plain Table styled component.\n// Using AK theme to be compatible with their dark mode.\n// Styles copied from: https://bitbucket.org/atlassian/atlassian-frontend/src/master/packages/design-system/dynamic-table/src/styled/\nconst rowTheme = {\n focusOutline: themed({ light: colors.B100, dark: colors.B100 }),\n borderColor: themed({ light: colors.N40, dark: colors.DN50 }),\n highlightedBackground: themed({ light: colors.N20, dark: colors.DN50 }),\n hoverBackground: themed({ light: colors.N10, dark: colors.DN40 }),\n hoverHighlightedBackground: themed({ light: colors.N30, dark: colors.DN60 }),\n};\n\nconst headTheme = {\n focusOutline: themed({ light: colors.B100, dark: colors.B100 }),\n borderColor: themed({ light: colors.N40, dark: colors.DN50 }),\n textColor: themed({ light: colors.N300, dark: colors.DN300 }),\n};\n\nexport const Table = styled.table`\n border-collapse: collapse;\n width: 100%;\n`;\n\nexport const HeadRow = styled.tr`\n border-bottom: 2px solid ${headTheme.borderColor};\n`;\n\nexport const HeadCell = styled.th`\n padding: ${gridSize() / 2}px ${gridSize}px;\n &:first-of-type {\n padding-left: 0;\n }\n &:last-of-type {\n padding-right: 0;\n }\n border: none;\n color: ${headTheme.textColor};\n box-sizing: border-box;\n font-size: 12px;\n font-weight: bold;\n position: relative;\n text-align: left;\n vertical-align: top;\n &:focus {\n outline: solid 2px ${headTheme.focusOutline};\n }\n`;\n\nconst outlineWidth = '2px';\n\nexport const TableRow = styled.tr`\n border-bottom: 2px solid ${rowTheme.borderColor};\n &:hover {\n background-color: ${rowTheme.hoverBackground};\n }\n &:focus {\n outline: ${outlineWidth} solid ${rowTheme.focusOutline};\n outline-offset: -${outlineWidth};\n }\n`;\n\nexport const TableCell = styled.td`\n border: none;\n padding: ${gridSize() / 1.2}px ${gridSize}px;\n text-align: left;\n\n &:first-of-type {\n padding-left: 0;\n }\n &:last-of-type {\n padding-right: 0;\n }\n`;\n"]}
@@ -3,23 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useExtensionsLoadingState = exports.useExtensionsUnsupported = exports.useExtensions = exports.useExtensionsAll = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = require("react");
6
- const lodash_isequal_1 = tslib_1.__importDefault(require("lodash.isequal"));
6
+ const lodash_isequal_1 = (0, tslib_1.__importDefault)(require("lodash.isequal"));
7
7
  const clientside_extensions_debug_1 = require("@atlassian/clientside-extensions-debug");
8
8
  const ExtensionsObservable_1 = require("./ExtensionsObservable");
9
9
  const useDeepCompareMemoize = (value) => {
10
- const ref = react_1.useRef({});
11
- if (!lodash_isequal_1.default(value, ref.current)) {
10
+ const ref = (0, react_1.useRef)({});
11
+ if (!(0, lodash_isequal_1.default)(value, ref.current)) {
12
12
  ref.current = value;
13
13
  }
14
14
  return ref.current;
15
15
  };
16
- exports.useExtensionsAll = (extensionPoint, context, options) => {
17
- const [descriptorsState, setDescriptorsState] = react_1.useState([[], [], true]);
16
+ const useExtensionsAll = (extensionPoint, context, options) => {
17
+ const [descriptorsState, setDescriptorsState] = (0, react_1.useState)([[], [], true]);
18
18
  const cachedContext = useDeepCompareMemoize(context);
19
19
  const cachedOptions = useDeepCompareMemoize(options);
20
- react_1.useEffect(() => {
21
- const subscription = ExtensionsObservable_1.getValidatedExtensions(extensionPoint, cachedContext, cachedOptions).subscribe((update) => {
22
- clientside_extensions_debug_1.onDebug(({ debug }) => ({
20
+ (0, react_1.useEffect)(() => {
21
+ const subscription = (0, ExtensionsObservable_1.getValidatedExtensions)(extensionPoint, cachedContext, cachedOptions).subscribe((update) => {
22
+ (0, clientside_extensions_debug_1.onDebug)(({ debug }) => ({
23
23
  level: debug,
24
24
  message: `useExtensionsAll React hook received a new state`,
25
25
  components: 'useExtensionsAll',
@@ -35,16 +35,20 @@ exports.useExtensionsAll = (extensionPoint, context, options) => {
35
35
  }, [extensionPoint, cachedContext, cachedOptions]);
36
36
  return descriptorsState;
37
37
  };
38
- exports.useExtensions = (extensionPoint, context, options) => {
39
- const extensionsPayload = exports.useExtensionsAll(extensionPoint, context, options);
38
+ exports.useExtensionsAll = useExtensionsAll;
39
+ const useExtensions = (extensionPoint, context, options) => {
40
+ const extensionsPayload = (0, exports.useExtensionsAll)(extensionPoint, context, options);
40
41
  return extensionsPayload[0];
41
42
  };
42
- exports.useExtensionsUnsupported = (name, context, options) => {
43
- const extensionsPayload = exports.useExtensionsAll(name, context, options);
43
+ exports.useExtensions = useExtensions;
44
+ const useExtensionsUnsupported = (name, context, options) => {
45
+ const extensionsPayload = (0, exports.useExtensionsAll)(name, context, options);
44
46
  return extensionsPayload[1];
45
47
  };
46
- exports.useExtensionsLoadingState = (name, context, options) => {
47
- const extensionsPayload = exports.useExtensionsAll(name, context, options);
48
+ exports.useExtensionsUnsupported = useExtensionsUnsupported;
49
+ const useExtensionsLoadingState = (name, context, options) => {
50
+ const extensionsPayload = (0, exports.useExtensionsAll)(name, context, options);
48
51
  return extensionsPayload[2];
49
52
  };
53
+ exports.useExtensionsLoadingState = useExtensionsLoadingState;
50
54
  //# sourceMappingURL=useExtensions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useExtensions.js","sourceRoot":"","sources":["../../lib/useExtensions.ts"],"names":[],"mappings":";;;;AAAA,iCAAoD;AACpD,4EAAqC;AAErC,wFAAiE;AACjE,iEAAgE;AAGhE,MAAM,qBAAqB,GAAG,CAAI,KAAQ,EAAK,EAAE;IAC7C,MAAM,GAAG,GAAG,cAAM,CAAI,EAAO,CAAC,CAAC;IAE/B,IAAI,CAAC,wBAAO,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE;QAC9B,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;KACvB;IAED,OAAO,GAAG,CAAC,OAAO,CAAC;AACvB,CAAC,CAAC;AAEW,QAAA,gBAAgB,GAAG,CAC5B,cAAsB,EACtB,OAAiB,EACjB,OAAgB,EACW,EAAE;IAC7B,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,gBAAQ,CAA8B,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;IACtG,MAAM,aAAa,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;IACrD,MAAM,aAAa,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAErD,iBAAS,CAAC,GAAG,EAAE;QACX,MAAM,YAAY,GAAG,6CAAsB,CAAwB,cAAc,EAAE,aAAa,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["import { useEffect, useRef, useState } from 'react';\nimport isEqual from 'lodash.isequal';\nimport type { ExtensionAttributes, Context } from '@atlassian/clientside-extensions-registry';\nimport { onDebug } from '@atlassian/clientside-extensions-debug';\nimport { getValidatedExtensions } from './ExtensionsObservable';\nimport type { ExtensionState, Options } from './types';\n\nconst useDeepCompareMemoize = <T>(value: T): T => {\n const ref = useRef<T>({} as T);\n\n if (!isEqual(value, ref.current)) {\n ref.current = value;\n }\n\n return ref.current;\n};\n\nexport const useExtensionsAll = <ContextT extends Context<{}> | null = null, AttributesT extends ExtensionAttributes = ExtensionAttributes>(\n extensionPoint: string,\n context: ContextT,\n options: Options,\n): ExtensionState<AttributesT> => {\n const [descriptorsState, setDescriptorsState] = useState<ExtensionState<AttributesT>>([[], [], true]);\n const cachedContext = useDeepCompareMemoize(context);\n const cachedOptions = useDeepCompareMemoize(options);\n\n useEffect(() => {\n const subscription = getValidatedExtensions<ContextT, AttributesT>(extensionPoint, cachedContext, cachedOptions).subscribe(\n (update) => {\n onDebug(({ debug }) => ({\n level: debug,\n message: `useExtensionsAll React hook received a new state`,\n components: 'useExtensionsAll',\n meta: {\n extensionPoint,\n context: cachedContext,\n update,\n },\n }));\n\n setDescriptorsState(update);\n },\n );\n\n return () => subscription.unsubscribe();\n }, [extensionPoint, cachedContext, cachedOptions]);\n\n return descriptorsState;\n};\n\nexport const useExtensions = <ContextT extends Context<{}> | null = null, AttributesT extends ExtensionAttributes = ExtensionAttributes>(\n extensionPoint: string,\n context: ContextT,\n options: Options,\n) => {\n const extensionsPayload = useExtensionsAll<ContextT, AttributesT>(extensionPoint, context, options);\n return extensionsPayload[0];\n};\n\nexport const useExtensionsUnsupported = <\n ContextT extends Context<{}> | null = null,\n AttributesU extends ExtensionAttributes = ExtensionAttributes,\n>(\n name: string,\n context: ContextT,\n options: Options,\n) => {\n const extensionsPayload = useExtensionsAll<ContextT, AttributesU>(name, context, options);\n return extensionsPayload[1];\n};\n\nexport const useExtensionsLoadingState = <\n ContextT extends Context<{}> | null = null,\n AttributesU extends ExtensionAttributes = ExtensionAttributes,\n>(\n name: string,\n context: ContextT,\n options: Options,\n) => {\n const extensionsPayload = useExtensionsAll<ContextT, AttributesU>(name, context, options);\n return extensionsPayload[2];\n};\n"]}
1
+ {"version":3,"file":"useExtensions.js","sourceRoot":"","sources":["../../lib/useExtensions.ts"],"names":[],"mappings":";;;;AAAA,iCAAoD;AACpD,iFAAqC;AAErC,wFAAiE;AACjE,iEAAgE;AAGhE,MAAM,qBAAqB,GAAG,CAAI,KAAQ,EAAK,EAAE;IAC7C,MAAM,GAAG,GAAG,IAAA,cAAM,EAAI,EAAO,CAAC,CAAC;IAE/B,IAAI,CAAC,IAAA,wBAAO,EAAC,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE;QAC9B,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;KACvB;IAED,OAAO,GAAG,CAAC,OAAO,CAAC;AACvB,CAAC,CAAC;AAEK,MAAM,gBAAgB,GAAG,CAC5B,cAAsB,EACtB,OAAiB,EACjB,OAAgB,EACW,EAAE;IAC7B,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,IAAA,gBAAQ,EAA8B,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;IACtG,MAAM,aAAa,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;IACrD,MAAM,aAAa,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAErD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACX,MAAM,YAAY,GAAG,IAAA,6CAAsB,EAAwB,cAAc,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC,SAAS,CACtH,CAAC,MAAM,EAAE,EAAE;YACP,IAAA,qCAAO,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;gBACpB,KAAK,EAAE,KAAK;gBACZ,OAAO,EAAE,kDAAkD;gBAC3D,UAAU,EAAE,kBAAkB;gBAC9B,IAAI,EAAE;oBACF,cAAc;oBACd,OAAO,EAAE,aAAa;oBACtB,MAAM;iBACT;aACJ,CAAC,CAAC,CAAC;YAEJ,mBAAmB,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC,CACJ,CAAC;QAEF,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;IAC5C,CAAC,EAAE,CAAC,cAAc,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC;IAEnD,OAAO,gBAAgB,CAAC;AAC5B,CAAC,CAAC;AA/BW,QAAA,gBAAgB,oBA+B3B;AAEK,MAAM,aAAa,GAAG,CACzB,cAAsB,EACtB,OAAiB,EACjB,OAAgB,EAClB,EAAE;IACA,MAAM,iBAAiB,GAAG,IAAA,wBAAgB,EAAwB,cAAc,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACpG,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAChC,CAAC,CAAC;AAPW,QAAA,aAAa,iBAOxB;AAEK,MAAM,wBAAwB,GAAG,CAIpC,IAAY,EACZ,OAAiB,EACjB,OAAgB,EAClB,EAAE;IACA,MAAM,iBAAiB,GAAG,IAAA,wBAAgB,EAAwB,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC1F,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAChC,CAAC,CAAC;AAVW,QAAA,wBAAwB,4BAUnC;AAEK,MAAM,yBAAyB,GAAG,CAIrC,IAAY,EACZ,OAAiB,EACjB,OAAgB,EAClB,EAAE;IACA,MAAM,iBAAiB,GAAG,IAAA,wBAAgB,EAAwB,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC1F,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAChC,CAAC,CAAC;AAVW,QAAA,yBAAyB,6BAUpC","sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport isEqual from 'lodash.isequal';\nimport type { ExtensionAttributes, Context } from '@atlassian/clientside-extensions-registry';\nimport { onDebug } from '@atlassian/clientside-extensions-debug';\nimport { getValidatedExtensions } from './ExtensionsObservable';\nimport type { ExtensionState, Options } from './types';\n\nconst useDeepCompareMemoize = <T>(value: T): T => {\n const ref = useRef<T>({} as T);\n\n if (!isEqual(value, ref.current)) {\n ref.current = value;\n }\n\n return ref.current;\n};\n\nexport const useExtensionsAll = <ContextT extends Context<{}> | null = null, AttributesT extends ExtensionAttributes = ExtensionAttributes>(\n extensionPoint: string,\n context: ContextT,\n options: Options,\n): ExtensionState<AttributesT> => {\n const [descriptorsState, setDescriptorsState] = useState<ExtensionState<AttributesT>>([[], [], true]);\n const cachedContext = useDeepCompareMemoize(context);\n const cachedOptions = useDeepCompareMemoize(options);\n\n useEffect(() => {\n const subscription = getValidatedExtensions<ContextT, AttributesT>(extensionPoint, cachedContext, cachedOptions).subscribe(\n (update) => {\n onDebug(({ debug }) => ({\n level: debug,\n message: `useExtensionsAll React hook received a new state`,\n components: 'useExtensionsAll',\n meta: {\n extensionPoint,\n context: cachedContext,\n update,\n },\n }));\n\n setDescriptorsState(update);\n },\n );\n\n return () => subscription.unsubscribe();\n }, [extensionPoint, cachedContext, cachedOptions]);\n\n return descriptorsState;\n};\n\nexport const useExtensions = <ContextT extends Context<{}> | null = null, AttributesT extends ExtensionAttributes = ExtensionAttributes>(\n extensionPoint: string,\n context: ContextT,\n options: Options,\n) => {\n const extensionsPayload = useExtensionsAll<ContextT, AttributesT>(extensionPoint, context, options);\n return extensionsPayload[0];\n};\n\nexport const useExtensionsUnsupported = <\n ContextT extends Context<{}> | null = null,\n AttributesU extends ExtensionAttributes = ExtensionAttributes,\n>(\n name: string,\n context: ContextT,\n options: Options,\n) => {\n const extensionsPayload = useExtensionsAll<ContextT, AttributesU>(name, context, options);\n return extensionsPayload[1];\n};\n\nexport const useExtensionsLoadingState = <\n ContextT extends Context<{}> | null = null,\n AttributesU extends ExtensionAttributes = ExtensionAttributes,\n>(\n name: string,\n context: ContextT,\n options: Options,\n) => {\n const extensionsPayload = useExtensionsAll<ContextT, AttributesU>(name, context, options);\n return extensionsPayload[2];\n};\n"]}
@@ -18,7 +18,7 @@ const evaluateScripts = (originalScript) => {
18
18
  document.head.appendChild(script);
19
19
  }
20
20
  catch (e) {
21
- clientside_extensions_debug_1.onDebug(({ error }) => ({
21
+ (0, clientside_extensions_debug_1.onDebug)(({ error }) => ({
22
22
  level: error,
23
23
  message: `An inline script in a WebPanel failed to execute.`,
24
24
  meta: {
@@ -30,7 +30,7 @@ const evaluateScripts = (originalScript) => {
30
30
  script.remove();
31
31
  }
32
32
  catch (e) {
33
- clientside_extensions_debug_1.onDebug(({ error }) => ({
33
+ (0, clientside_extensions_debug_1.onDebug)(({ error }) => ({
34
34
  level: error,
35
35
  message: `Failed to remove inline script associated with WebPanel.`,
36
36
  meta: {
@@ -48,8 +48,8 @@ const injectAndEvaluateInlineScripts = (node, html) => {
48
48
  scripts.forEach((script) => evaluateScripts(script));
49
49
  };
50
50
  const useWebPanelRenderer = (html) => {
51
- const ref = react_1.useRef(null);
52
- const setRef = react_1.useCallback((node) => {
51
+ const ref = (0, react_1.useRef)(null);
52
+ const setRef = (0, react_1.useCallback)((node) => {
53
53
  var _a;
54
54
  // eslint-disable-next-line no-underscore-dangle
55
55
  if ((_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.__cse_webpanel_initialized) {