@atlaskit/editor-core 171.0.0 → 172.0.1
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/CHANGELOG.md +96 -0
- package/codemods/172.0.0-transform-smartlinks-prop.ts +8 -0
- package/codemods/__tests__/rename-smartlinks-prop.ts +204 -0
- package/codemods/migrates/rename-smartlinks-prop.ts +56 -0
- package/dist/cjs/create-editor/ReactEditorView.js +13 -4
- package/dist/cjs/create-editor/create-plugins-list.js +21 -12
- package/dist/cjs/editor.js +8 -23
- package/dist/cjs/labs/next/internal/hooks/use-editor/index.js +6 -1
- package/dist/cjs/labs/next/presets/default.js +1 -1
- package/dist/cjs/nodeviews/context-adapter.js +2 -2
- package/dist/cjs/plugins/analytics/plugin.js +24 -11
- package/dist/cjs/plugins/base/index.js +3 -3
- package/dist/cjs/plugins/base/pm-plugins/disable-spell-checking.js +84 -0
- package/dist/cjs/plugins/card/index.js +1 -1
- package/dist/cjs/plugins/card/toolbar.js +11 -5
- package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +5 -1
- package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +7 -7
- package/dist/cjs/plugins/clipboard/pm-plugins/main.js +4 -2
- package/dist/cjs/plugins/code-block/actions.js +13 -0
- package/dist/cjs/plugins/code-block/index.js +7 -0
- package/dist/cjs/plugins/code-block/nodeviews/code-block.js +2 -4
- package/dist/cjs/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +132 -0
- package/dist/cjs/plugins/code-block/pm-plugins/main.js +1 -23
- package/dist/cjs/plugins/code-block/styles.js +3 -36
- package/dist/cjs/plugins/code-block/toolbar.js +9 -0
- package/dist/cjs/plugins/code-block/ui/class-names.js +1 -2
- package/dist/cjs/plugins/copy-button/commands.js +40 -20
- package/dist/cjs/plugins/copy-button/toolbar.js +51 -0
- package/dist/cjs/plugins/copy-button/utils.js +16 -38
- package/dist/cjs/plugins/expand/toolbar.js +8 -2
- package/dist/cjs/plugins/extension/toolbar.js +5 -1
- package/dist/cjs/plugins/extension/ui/Extension/Extension/styles.js +1 -1
- package/dist/cjs/plugins/extension/ui/Extension/InlineExtension/styles.js +1 -1
- package/dist/cjs/plugins/extension/ui/Extension/styles.js +2 -4
- package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +29 -18
- package/dist/cjs/plugins/feedback-dialog/index.js +2 -2
- package/dist/cjs/plugins/find-replace/ui/FindReplaceToolbarButton.js +0 -20
- package/dist/cjs/plugins/floating-toolbar/ui/DropdownMenu.js +7 -32
- package/dist/cjs/plugins/hyperlink/Toolbar.js +146 -135
- package/dist/cjs/plugins/hyperlink/index.js +4 -4
- package/dist/cjs/plugins/hyperlink/ui/EditorLinkPicker/index.js +50 -0
- package/dist/cjs/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.js +38 -0
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +50 -5
- package/dist/cjs/plugins/indentation/commands/index.js +35 -7
- package/dist/cjs/plugins/indentation/commands/utils.js +11 -7
- package/dist/cjs/plugins/indentation/pm-plugins/keymap.js +5 -3
- package/dist/cjs/plugins/layout/toolbar.js +3 -1
- package/dist/cjs/plugins/media/toolbar/index.js +13 -5
- package/dist/cjs/plugins/mentions/analytics.js +5 -5
- package/dist/cjs/plugins/panel/toolbar.js +3 -3
- package/dist/cjs/plugins/paste/edge-cases/index.js +16 -3
- package/dist/cjs/plugins/paste/handlers.js +25 -2
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +16 -3
- package/dist/cjs/plugins/paste/pm-plugins/main.js +22 -3
- package/dist/cjs/plugins/status/analytics.js +3 -3
- package/dist/cjs/plugins/table/toolbar.js +2 -2
- package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/keymaps.js +43 -32
- package/dist/cjs/plugins/toolbar-lists-indentation/index.js +33 -13
- package/dist/cjs/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +122 -0
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/Toolbar.js +18 -12
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +10 -10
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/index.js +7 -1
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/onItemActivated.js +40 -19
- package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +10 -0
- package/dist/cjs/types/browser.js +6 -0
- package/dist/cjs/ui/Addon/click-area-helper.js +40 -19
- package/dist/cjs/ui/Appearance/Comment/Comment.js +2 -2
- package/dist/cjs/ui/ContentStyles/index.js +1 -3
- package/dist/cjs/ui/DropList/index.js +215 -0
- package/dist/cjs/ui/Dropdown/index.js +2 -5
- package/dist/cjs/ui/DropdownMenu/index.js +140 -86
- package/dist/cjs/ui/ElementBrowser/components/ElementList/ElementList.js +25 -14
- package/dist/cjs/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.js +2 -2
- package/dist/cjs/ui/ElementBrowser/components/ElementList/utils.js +28 -1
- package/dist/cjs/ui/ElementBrowser/constants.js +2 -7
- package/dist/cjs/ui/Layer/index.js +245 -0
- package/dist/cjs/ui/Layer/internal/helpers.js +70 -0
- package/dist/cjs/ui/PortalProvider/index.js +7 -26
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/ReactEditorView.js +15 -4
- package/dist/es2019/create-editor/create-plugins-list.js +21 -11
- package/dist/es2019/editor.js +9 -23
- package/dist/es2019/labs/next/internal/hooks/use-editor/index.js +6 -1
- package/dist/es2019/labs/next/presets/default.js +1 -1
- package/dist/es2019/nodeviews/context-adapter.js +2 -2
- package/dist/es2019/plugins/analytics/plugin.js +19 -4
- package/dist/es2019/plugins/base/index.js +3 -3
- package/dist/es2019/plugins/base/pm-plugins/disable-spell-checking.js +70 -0
- package/dist/es2019/plugins/card/index.js +1 -1
- package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -2
- package/dist/es2019/plugins/card/toolbar.js +10 -5
- package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +5 -1
- package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +7 -7
- package/dist/es2019/plugins/clipboard/pm-plugins/main.js +1 -2
- package/dist/es2019/plugins/code-block/actions.js +12 -0
- package/dist/es2019/plugins/code-block/index.js +4 -0
- package/dist/es2019/plugins/code-block/nodeviews/code-block.js +1 -1
- package/dist/es2019/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +112 -0
- package/dist/es2019/plugins/code-block/pm-plugins/main.js +1 -21
- package/dist/es2019/plugins/code-block/styles.js +2 -159
- package/dist/es2019/plugins/code-block/toolbar.js +8 -0
- package/dist/es2019/plugins/code-block/ui/class-names.js +1 -2
- package/dist/es2019/plugins/copy-button/commands.js +35 -15
- package/dist/es2019/plugins/copy-button/toolbar.js +29 -0
- package/dist/es2019/plugins/copy-button/utils.js +15 -27
- package/dist/es2019/plugins/expand/toolbar.js +4 -1
- package/dist/es2019/plugins/extension/toolbar.js +4 -1
- package/dist/es2019/plugins/extension/ui/Extension/Extension/styles.js +1 -1
- package/dist/es2019/plugins/extension/ui/Extension/InlineExtension/styles.js +1 -1
- package/dist/es2019/plugins/extension/ui/Extension/styles.js +1 -3
- package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +27 -15
- package/dist/es2019/plugins/feedback-dialog/index.js +1 -1
- package/dist/es2019/plugins/find-replace/ui/FindReplaceToolbarButton.js +0 -19
- package/dist/es2019/plugins/floating-toolbar/ui/DropdownMenu.js +14 -29
- package/dist/es2019/plugins/hyperlink/Toolbar.js +11 -5
- package/dist/es2019/plugins/hyperlink/index.js +4 -4
- package/dist/es2019/plugins/hyperlink/ui/EditorLinkPicker/index.js +24 -0
- package/dist/es2019/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.js +28 -0
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +50 -9
- package/dist/es2019/plugins/indentation/commands/index.js +24 -9
- package/dist/es2019/plugins/indentation/commands/utils.js +8 -3
- package/dist/es2019/plugins/indentation/pm-plugins/keymap.js +5 -4
- package/dist/es2019/plugins/layout/toolbar.js +2 -1
- package/dist/es2019/plugins/media/toolbar/index.js +10 -3
- package/dist/es2019/plugins/mentions/analytics.js +1 -1
- package/dist/es2019/plugins/panel/toolbar.js +1 -1
- package/dist/es2019/plugins/paste/edge-cases/index.js +15 -3
- package/dist/es2019/plugins/paste/handlers.js +27 -2
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +12 -3
- package/dist/es2019/plugins/paste/pm-plugins/main.js +24 -4
- package/dist/es2019/plugins/status/analytics.js +1 -1
- package/dist/es2019/plugins/table/toolbar.js +1 -1
- package/dist/es2019/plugins/table/ui/common-styles.js +2 -0
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +10 -10
- package/dist/es2019/plugins/toolbar-lists-indentation/index.js +23 -4
- package/dist/es2019/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +104 -0
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/Toolbar.js +18 -12
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +10 -10
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/index.js +7 -1
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +38 -16
- package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +9 -0
- package/dist/es2019/types/browser.js +2 -0
- package/dist/es2019/ui/Addon/click-area-helper.js +37 -18
- package/dist/es2019/ui/Appearance/Comment/Comment.js +2 -2
- package/dist/es2019/ui/ContentStyles/index.js +5 -9
- package/dist/es2019/ui/DropList/index.js +186 -0
- package/dist/es2019/ui/Dropdown/index.js +2 -6
- package/dist/es2019/ui/DropdownMenu/index.js +124 -75
- package/dist/es2019/ui/ElementBrowser/components/ElementList/ElementList.js +11 -22
- package/dist/es2019/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.js +3 -3
- package/dist/es2019/ui/ElementBrowser/components/ElementList/utils.js +26 -2
- package/dist/es2019/ui/ElementBrowser/constants.js +1 -4
- package/dist/es2019/ui/Layer/index.js +195 -0
- package/dist/es2019/ui/Layer/internal/helpers.js +62 -0
- package/dist/es2019/ui/PortalProvider/index.js +5 -23
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/ReactEditorView.js +13 -4
- package/dist/esm/create-editor/create-plugins-list.js +21 -12
- package/dist/esm/editor.js +9 -23
- package/dist/esm/labs/next/internal/hooks/use-editor/index.js +6 -1
- package/dist/esm/labs/next/presets/default.js +1 -1
- package/dist/esm/nodeviews/context-adapter.js +2 -2
- package/dist/esm/plugins/analytics/plugin.js +24 -11
- package/dist/esm/plugins/base/index.js +3 -3
- package/dist/esm/plugins/base/pm-plugins/disable-spell-checking.js +72 -0
- package/dist/esm/plugins/card/index.js +1 -1
- package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -2
- package/dist/esm/plugins/card/toolbar.js +11 -5
- package/dist/esm/plugins/card/ui/EditLinkToolbar.js +5 -1
- package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +7 -7
- package/dist/esm/plugins/clipboard/pm-plugins/main.js +1 -2
- package/dist/esm/plugins/code-block/actions.js +12 -0
- package/dist/esm/plugins/code-block/index.js +6 -0
- package/dist/esm/plugins/code-block/nodeviews/code-block.js +2 -4
- package/dist/esm/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +112 -0
- package/dist/esm/plugins/code-block/pm-plugins/main.js +1 -20
- package/dist/esm/plugins/code-block/styles.js +4 -32
- package/dist/esm/plugins/code-block/toolbar.js +8 -0
- package/dist/esm/plugins/code-block/ui/class-names.js +1 -2
- package/dist/esm/plugins/copy-button/commands.js +35 -15
- package/dist/esm/plugins/copy-button/toolbar.js +31 -0
- package/dist/esm/plugins/copy-button/utils.js +14 -29
- package/dist/esm/plugins/expand/toolbar.js +6 -2
- package/dist/esm/plugins/extension/toolbar.js +4 -1
- package/dist/esm/plugins/extension/ui/Extension/Extension/styles.js +1 -1
- package/dist/esm/plugins/extension/ui/Extension/InlineExtension/styles.js +1 -1
- package/dist/esm/plugins/extension/ui/Extension/styles.js +3 -4
- package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +28 -16
- package/dist/esm/plugins/feedback-dialog/index.js +1 -1
- package/dist/esm/plugins/find-replace/ui/FindReplaceToolbarButton.js +0 -21
- package/dist/esm/plugins/floating-toolbar/ui/DropdownMenu.js +8 -27
- package/dist/esm/plugins/hyperlink/Toolbar.js +144 -135
- package/dist/esm/plugins/hyperlink/index.js +4 -4
- package/dist/esm/plugins/hyperlink/ui/EditorLinkPicker/index.js +26 -0
- package/dist/esm/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.js +28 -0
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +46 -5
- package/dist/esm/plugins/indentation/commands/index.js +30 -9
- package/dist/esm/plugins/indentation/commands/utils.js +12 -8
- package/dist/esm/plugins/indentation/pm-plugins/keymap.js +5 -4
- package/dist/esm/plugins/layout/toolbar.js +2 -1
- package/dist/esm/plugins/media/toolbar/index.js +12 -5
- package/dist/esm/plugins/mentions/analytics.js +1 -1
- package/dist/esm/plugins/panel/toolbar.js +1 -1
- package/dist/esm/plugins/paste/edge-cases/index.js +15 -3
- package/dist/esm/plugins/paste/handlers.js +23 -2
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +13 -3
- package/dist/esm/plugins/paste/pm-plugins/main.js +23 -4
- package/dist/esm/plugins/status/analytics.js +1 -1
- package/dist/esm/plugins/table/toolbar.js +1 -1
- package/dist/esm/plugins/table/ui/common-styles.js +1 -1
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +37 -31
- package/dist/esm/plugins/toolbar-lists-indentation/index.js +32 -13
- package/dist/esm/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +105 -0
- package/dist/esm/plugins/toolbar-lists-indentation/ui/Toolbar.js +18 -12
- package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +10 -10
- package/dist/esm/plugins/toolbar-lists-indentation/ui/index.js +7 -1
- package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +38 -20
- package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +9 -0
- package/dist/esm/types/browser.js +2 -0
- package/dist/esm/ui/Addon/click-area-helper.js +37 -18
- package/dist/esm/ui/Appearance/Comment/Comment.js +2 -2
- package/dist/esm/ui/ContentStyles/index.js +2 -4
- package/dist/esm/ui/DropList/index.js +203 -0
- package/dist/esm/ui/Dropdown/index.js +2 -6
- package/dist/esm/ui/DropdownMenu/index.js +134 -88
- package/dist/esm/ui/ElementBrowser/components/ElementList/ElementList.js +27 -17
- package/dist/esm/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.js +3 -3
- package/dist/esm/ui/ElementBrowser/components/ElementList/utils.js +26 -2
- package/dist/esm/ui/ElementBrowser/constants.js +1 -4
- package/dist/esm/ui/Layer/index.js +228 -0
- package/dist/esm/ui/Layer/internal/helpers.js +62 -0
- package/dist/esm/ui/PortalProvider/index.js +7 -26
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/labs/next/presets/default.d.ts +2 -0
- package/dist/types/plugins/analytics/plugin.d.ts +5 -1
- package/dist/types/plugins/analytics/types/cut-copy-events.d.ts +2 -0
- package/dist/types/plugins/analytics/types/general-events.d.ts +1 -0
- package/dist/types/plugins/analytics/types/paste-events.d.ts +1 -0
- package/dist/types/plugins/base/index.d.ts +1 -1
- package/dist/types/plugins/base/pm-plugins/{fix-chrome-spell-checking.d.ts → disable-spell-checking.d.ts} +0 -0
- package/dist/types/plugins/card/index.d.ts +2 -7
- package/dist/types/plugins/card/nodeviews/genericCard.d.ts +2 -1
- package/dist/types/plugins/card/toolbar.d.ts +3 -5
- package/dist/types/plugins/card/types.d.ts +2 -0
- package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +4 -1
- package/dist/types/plugins/card/ui/LinkToolbarAppearance.d.ts +2 -1
- package/dist/types/plugins/clipboard/pm-plugins/main.d.ts +3 -0
- package/dist/types/plugins/code-block/nodeviews/code-block.d.ts +1 -1
- package/dist/types/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.d.ts +11 -0
- package/dist/types/plugins/code-block/styles.d.ts +0 -1
- package/dist/types/plugins/code-block/ui/class-names.d.ts +0 -1
- package/dist/types/plugins/copy-button/commands.d.ts +2 -2
- package/dist/types/plugins/copy-button/toolbar.d.ts +7 -0
- package/dist/types/plugins/copy-button/utils.d.ts +7 -6
- package/dist/types/plugins/floating-toolbar/types.d.ts +1 -2
- package/dist/types/plugins/hyperlink/Toolbar.d.ts +2 -1
- package/dist/types/plugins/hyperlink/index.d.ts +2 -2
- package/dist/types/plugins/hyperlink/types.d.ts +30 -0
- package/dist/types/plugins/hyperlink/ui/EditorLinkPicker/index.d.ts +7 -0
- package/dist/types/plugins/hyperlink/ui/EditorLinkPicker/useEscapeClickaway.d.ts +2 -0
- package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/index.d.ts +4 -3
- package/dist/types/plugins/indentation/commands/index.d.ts +6 -2
- package/dist/types/plugins/indentation/commands/utils.d.ts +8 -2
- package/dist/types/plugins/paste/edge-cases/index.d.ts +3 -2
- package/dist/types/plugins/paste/handlers.d.ts +1 -0
- package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +7 -1
- package/dist/types/plugins/tasks-and-decisions/pm-plugins/keymaps.d.ts +5 -0
- package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +2 -1
- package/dist/types/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.d.ts +14 -0
- package/dist/types/plugins/toolbar-lists-indentation/types.d.ts +2 -0
- package/dist/types/plugins/toolbar-lists-indentation/ui/index.d.ts +2 -0
- package/dist/types/types/browser.d.ts +10 -0
- package/dist/types/types/editor-props.d.ts +6 -5
- package/dist/types/types/feature-flags.d.ts +29 -24
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/ui/Addon/click-area-helper.d.ts +10 -0
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
- package/dist/types/ui/ConfigPanel/ConfigPanel.d.ts +1 -1
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/ui/DropList/index.d.ts +22 -0
- package/dist/types/ui/Dropdown/index.d.ts +2 -1
- package/dist/types/ui/DropdownMenu/index.d.ts +0 -1
- package/dist/types/ui/ElementBrowser/components/ElementList/cellSizeAndPositionGetter.d.ts +1 -1
- package/dist/types/ui/ElementBrowser/components/ElementList/utils.d.ts +1 -0
- package/dist/types/ui/ElementBrowser/constants.d.ts +1 -3
- package/dist/types/ui/Layer/index.d.ts +47 -0
- package/dist/types/ui/Layer/internal/helpers.d.ts +5 -0
- package/package.json +23 -18
- package/dist/cjs/plugins/base/pm-plugins/fix-chrome-spell-checking.js +0 -37
- package/dist/cjs/plugins/code-block/nodeviews/highlighting-code-block.js +0 -195
- package/dist/cjs/utils/check-if-mobile-bridge.js +0 -19
- package/dist/es2019/plugins/base/pm-plugins/fix-chrome-spell-checking.js +0 -22
- package/dist/es2019/plugins/code-block/nodeviews/highlighting-code-block.js +0 -152
- package/dist/es2019/utils/check-if-mobile-bridge.js +0 -12
- package/dist/esm/plugins/base/pm-plugins/fix-chrome-spell-checking.js +0 -24
- package/dist/esm/plugins/code-block/nodeviews/highlighting-code-block.js +0 -178
- package/dist/esm/utils/check-if-mobile-bridge.js +0 -12
- package/dist/types/plugins/code-block/nodeviews/highlighting-code-block.d.ts +0 -48
- package/dist/types/utils/check-if-mobile-bridge.d.ts +0 -1
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
+
|
|
10
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
11
|
+
|
|
12
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
13
|
+
|
|
14
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
15
|
+
|
|
16
|
+
/** @jsx jsx */
|
|
17
|
+
import { Component } from 'react';
|
|
18
|
+
import { css, jsx } from '@emotion/react';
|
|
19
|
+
import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
20
|
+
import Layer from '../Layer';
|
|
21
|
+
import { borderRadius, gridSize } from '@atlaskit/theme/constants';
|
|
22
|
+
import { N0, DN50, DN600, N50A, N60A, N900 } from '@atlaskit/theme/colors';
|
|
23
|
+
import { themed } from '@atlaskit/theme/components';
|
|
24
|
+
import { token } from '@atlaskit/tokens';
|
|
25
|
+
var packageName = "@atlaskit/editor-core";
|
|
26
|
+
var packageVersion = "172.0.1";
|
|
27
|
+
var halfFocusRing = 1;
|
|
28
|
+
var dropOffset = "0, ".concat(gridSize(), "px");
|
|
29
|
+
|
|
30
|
+
var DropList = /*#__PURE__*/function (_Component) {
|
|
31
|
+
_inherits(DropList, _Component);
|
|
32
|
+
|
|
33
|
+
var _super = _createSuper(DropList);
|
|
34
|
+
|
|
35
|
+
function DropList() {
|
|
36
|
+
var _this;
|
|
37
|
+
|
|
38
|
+
_classCallCheck(this, DropList);
|
|
39
|
+
|
|
40
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
41
|
+
args[_key] = arguments[_key];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
45
|
+
|
|
46
|
+
_defineProperty(_assertThisInitialized(_this), "wrapperStyles", css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n transition-duration: 0.2s;\n transition: box-shadow 0.15s cubic-bezier(0.47, 0.03, 0.49, 1.38);\n "])), _this.props.shouldFitContainer ? 'display: block; flex: 1 1 auto;' : 'display: inline-flex;'));
|
|
47
|
+
|
|
48
|
+
_defineProperty(_assertThisInitialized(_this), "triggerStyles", css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n transition-duration: 0.2s;\n transition: box-shadow 0.15s cubic-bezier(0.47, 0.03, 0.49, 1.38);\n ", "\n "])), _this.props.shouldFitContainer ? 'display: block; box-sizing: border-box;' : 'display: inline-flex;'));
|
|
49
|
+
|
|
50
|
+
_defineProperty(_assertThisInitialized(_this), "menuWrapper", function (theme) {
|
|
51
|
+
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n color: ", ";\n background-color: ", ";\n border-radius: ", "px;\n box-shadow: 0 ", "px ", "px -", "px ", ",\n 0 0 1px ", ";\n box-sizing: border-box;\n overflow: auto;\n padding: ", "px 0;\n max-height: 90vh;\n "])), themed({
|
|
52
|
+
light: token('color.text', N900),
|
|
53
|
+
dark: token('color.text', DN600)
|
|
54
|
+
})(theme), themed({
|
|
55
|
+
light: token('elevation.surface.overlay', N0),
|
|
56
|
+
dark: token('elevation.surface.overlay', DN50)
|
|
57
|
+
})(theme), borderRadius(), gridSize() / 2, gridSize(), gridSize() / 4, N50A, N60A, gridSize() / 2);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
_defineProperty(_assertThisInitialized(_this), "componentDidMount", function () {
|
|
61
|
+
_this.setContentWidth(); // We use a captured event here to avoid a radio or checkbox dropdown item firing its
|
|
62
|
+
// click event first, which would cause a re-render of the element and prevent DropList
|
|
63
|
+
// from detecting the actual source of this original click event.
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
document.addEventListener('click', _this.handleClickOutside, true);
|
|
67
|
+
document.addEventListener('keydown', _this.handleEsc);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
_defineProperty(_assertThisInitialized(_this), "componentDidUpdate", function () {
|
|
71
|
+
if (_this.props.isOpen) {
|
|
72
|
+
_this.setContentWidth();
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
_defineProperty(_assertThisInitialized(_this), "componentWillUnmount", function () {
|
|
77
|
+
document.removeEventListener('click', _this.handleClickOutside, true);
|
|
78
|
+
document.removeEventListener('keydown', _this.handleEsc);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
_defineProperty(_assertThisInitialized(_this), "setContentWidth", function () {
|
|
82
|
+
var _assertThisInitialize = _assertThisInitialized(_this),
|
|
83
|
+
dropContentRef = _assertThisInitialize.dropContentRef,
|
|
84
|
+
triggerRef = _assertThisInitialize.triggerRef;
|
|
85
|
+
|
|
86
|
+
var shouldFitContainer = _this.props.shouldFitContainer; // We need to manually set the content width to match the trigger width
|
|
87
|
+
|
|
88
|
+
if (shouldFitContainer && dropContentRef && triggerRef) {
|
|
89
|
+
dropContentRef.style.width = "".concat(triggerRef.offsetWidth - halfFocusRing * 2, "px");
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
_defineProperty(_assertThisInitialized(_this), "handleEsc", function (event) {
|
|
94
|
+
if ((event.key === 'Escape' || event.key === 'Esc') && _this.props.isOpen) {
|
|
95
|
+
_this.close(event);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
_defineProperty(_assertThisInitialized(_this), "handleClickOutside", function (event) {
|
|
100
|
+
if (_this.props.isOpen) {
|
|
101
|
+
if (event.target instanceof Node) {
|
|
102
|
+
// Rather than check for the target within the entire DropList, we specify the trigger/content.
|
|
103
|
+
// This aids with future effort in scroll-locking DropList when isMenuFixed is enabled; the scroll
|
|
104
|
+
// blanket which stretches to the viewport should not stop 'close' from being triggered.
|
|
105
|
+
var withinTrigger = _this.triggerRef && _this.triggerRef.contains(event.target);
|
|
106
|
+
|
|
107
|
+
var withinContent = _this.dropContentRef && _this.dropContentRef.contains(event.target);
|
|
108
|
+
|
|
109
|
+
if (!withinTrigger && !withinContent) {
|
|
110
|
+
_this.close(event);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
_defineProperty(_assertThisInitialized(_this), "close", function (event) {
|
|
117
|
+
if (_this.props.onOpenChange) {
|
|
118
|
+
_this.props.onOpenChange({
|
|
119
|
+
isOpen: false,
|
|
120
|
+
event: event
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
_defineProperty(_assertThisInitialized(_this), "handleContentRef", function (ref) {
|
|
126
|
+
_this.dropContentRef = ref; // If the dropdown has just been opened, we focus on the containing element so the
|
|
127
|
+
// user can tab to the first dropdown item. We will only receive this ref if isOpen
|
|
128
|
+
// is true or null, so no need to check for truthiness here.
|
|
129
|
+
|
|
130
|
+
if (ref) {
|
|
131
|
+
ref.focus();
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
_defineProperty(_assertThisInitialized(_this), "handleTriggerRef", function (ref) {
|
|
136
|
+
_this.triggerRef = ref;
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
return _this;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
_createClass(DropList, [{
|
|
143
|
+
key: "getChildContext",
|
|
144
|
+
value: function getChildContext() {
|
|
145
|
+
return {
|
|
146
|
+
shouldAllowMultilineItems: false
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}, {
|
|
150
|
+
key: "render",
|
|
151
|
+
value: function render() {
|
|
152
|
+
var _this2 = this;
|
|
153
|
+
|
|
154
|
+
var _this$props = this.props,
|
|
155
|
+
children = _this$props.children,
|
|
156
|
+
isOpen = _this$props.isOpen,
|
|
157
|
+
position = _this$props.position,
|
|
158
|
+
trigger = _this$props.trigger,
|
|
159
|
+
onPositioned = _this$props.onPositioned,
|
|
160
|
+
testId = _this$props.testId;
|
|
161
|
+
var layerContent = isOpen ? jsx("div", {
|
|
162
|
+
css: function css(theme) {
|
|
163
|
+
return _this2.menuWrapper({
|
|
164
|
+
theme: theme
|
|
165
|
+
});
|
|
166
|
+
},
|
|
167
|
+
"data-role": "droplistContent",
|
|
168
|
+
"data-testid": testId && "".concat(testId, "--content"),
|
|
169
|
+
ref: this.handleContentRef
|
|
170
|
+
}, children) : null;
|
|
171
|
+
return jsx("div", {
|
|
172
|
+
css: this.wrapperStyles
|
|
173
|
+
}, jsx(Layer, {
|
|
174
|
+
content: layerContent,
|
|
175
|
+
offset: dropOffset,
|
|
176
|
+
position: position,
|
|
177
|
+
onPositioned: onPositioned
|
|
178
|
+
}, jsx("div", {
|
|
179
|
+
css: this.triggerStyles,
|
|
180
|
+
ref: this.handleTriggerRef
|
|
181
|
+
}, trigger)));
|
|
182
|
+
}
|
|
183
|
+
}]);
|
|
184
|
+
|
|
185
|
+
return DropList;
|
|
186
|
+
}(Component);
|
|
187
|
+
|
|
188
|
+
var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
189
|
+
export default withAnalyticsContext({
|
|
190
|
+
componentName: 'droplist',
|
|
191
|
+
packageName: packageName,
|
|
192
|
+
packageVersion: packageVersion
|
|
193
|
+
})(withAnalyticsEvents({
|
|
194
|
+
onOpenChange: createAndFireEventOnAtlaskit({
|
|
195
|
+
action: 'toggled',
|
|
196
|
+
actionSubject: 'droplist',
|
|
197
|
+
attributes: {
|
|
198
|
+
componentName: 'droplist',
|
|
199
|
+
packageName: packageName,
|
|
200
|
+
packageVersion: packageVersion
|
|
201
|
+
}
|
|
202
|
+
})
|
|
203
|
+
})(DropList));
|
|
@@ -11,9 +11,8 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
11
11
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
12
|
|
|
13
13
|
import React from 'react';
|
|
14
|
-
import { PureComponent } from 'react';
|
|
15
|
-
|
|
16
|
-
import DropdownList from '@atlaskit/droplist';
|
|
14
|
+
import { PureComponent } from 'react';
|
|
15
|
+
import DropdownList from '../DropList';
|
|
17
16
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
18
17
|
import withOuterListeners from '../with-outer-listeners';
|
|
19
18
|
|
|
@@ -83,12 +82,9 @@ export var Dropdown = /*#__PURE__*/function (_PureComponent) {
|
|
|
83
82
|
minWidth: fitWidth || 0
|
|
84
83
|
}
|
|
85
84
|
}, /*#__PURE__*/React.createElement(DropdownList, {
|
|
86
|
-
disabled: true,
|
|
87
85
|
isOpen: true,
|
|
88
86
|
onOpenChange: onOpenChange,
|
|
89
|
-
appearance: "tall",
|
|
90
87
|
position: popupPlacement.join(' '),
|
|
91
|
-
shouldFlip: false,
|
|
92
88
|
shouldFitContainer: true
|
|
93
89
|
}, children)));
|
|
94
90
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
1
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
5
|
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
@@ -6,6 +8,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
6
8
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
10
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
11
|
+
var _excluded = ["children"];
|
|
9
12
|
|
|
10
13
|
var _templateObject, _templateObject2, _templateObject3;
|
|
11
14
|
|
|
@@ -14,29 +17,45 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
14
17
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
15
18
|
|
|
16
19
|
/** @jsx jsx */
|
|
17
|
-
import { PureComponent } from 'react';
|
|
18
|
-
import { css, jsx } from '@emotion/react';
|
|
19
|
-
|
|
20
|
-
import
|
|
21
|
-
|
|
22
|
-
import Item, { ItemGroup } from '@atlaskit/item';
|
|
20
|
+
import React, { PureComponent } from 'react';
|
|
21
|
+
import { css, jsx } from '@emotion/react';
|
|
22
|
+
import DropList from '../DropList';
|
|
23
|
+
import { CustomItem, MenuGroup } from '@atlaskit/menu';
|
|
23
24
|
import Tooltip from '@atlaskit/tooltip';
|
|
24
25
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
25
26
|
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
26
27
|
import withOuterListeners from '../with-outer-listeners';
|
|
28
|
+
import { DN600, DN80, N70, N900 } from '@atlaskit/theme/colors';
|
|
29
|
+
import { themed } from '@atlaskit/theme/components';
|
|
30
|
+
import { token } from '@atlaskit/tokens';
|
|
27
31
|
var wrapper = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* tooltip in ToolbarButton is display:block */\n & > div > div {\n display: flex;\n }\n"])));
|
|
28
|
-
var DropListWithOutsideListeners = withOuterListeners(DropList);
|
|
29
|
-
/**
|
|
30
|
-
* Hack for item to imitate old dropdown-menu selected styles
|
|
31
|
-
*/
|
|
32
|
-
// TODO: https://product-fabric.atlassian.net/browse/DSP-4500
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
var buttonStyles = function buttonStyles(isActive) {
|
|
34
|
+
return function (theme) {
|
|
35
|
+
if (isActive) {
|
|
36
|
+
/**
|
|
37
|
+
* Hack for item to imitate old dropdown-menu selected styles
|
|
38
|
+
*/
|
|
39
|
+
// TODO: https://product-fabric.atlassian.net/browse/DSP-4500
|
|
35
40
|
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
42
|
+
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n > span,\n > span:hover {\n background: #6c798f;\n color: #fff;\n }\n "])));
|
|
43
|
+
} else {
|
|
44
|
+
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n > span:hover[aria-disabled='false'] {\n color: ", ";\n background-color: ", ";\n }\n > span[aria-disabled='true'] {\n color: ", ";\n }\n "])), themed({
|
|
45
|
+
light: token('color.text', N900),
|
|
46
|
+
dark: token('color.text', DN600)
|
|
47
|
+
})(theme), themed({
|
|
48
|
+
light: token('color.background.neutral.subtle.hovered', 'rgb(244, 245, 247)'),
|
|
49
|
+
dark: token('color.background.neutral.subtle.hovered', 'rgb(59, 71, 92)')
|
|
50
|
+
})(theme), themed({
|
|
51
|
+
light: token('color.text.disabled', N70),
|
|
52
|
+
dark: token('color.text.disabled', DN80)
|
|
53
|
+
})(theme));
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
};
|
|
38
57
|
|
|
39
|
-
var
|
|
58
|
+
var DropListWithOutsideListeners = withOuterListeners(DropList);
|
|
40
59
|
/**
|
|
41
60
|
* Wrapper around @atlaskit/droplist which uses Popup and Portal to render
|
|
42
61
|
* dropdown-menu outside of "overflow: hidden" containers when needed.
|
|
@@ -92,62 +111,6 @@ var DropdownMenuWrapper = /*#__PURE__*/function (_PureComponent) {
|
|
|
92
111
|
}
|
|
93
112
|
|
|
94
113
|
_createClass(DropdownMenuWrapper, [{
|
|
95
|
-
key: "renderItem",
|
|
96
|
-
value: function renderItem(item) {
|
|
97
|
-
var _this$props = this.props,
|
|
98
|
-
onItemActivated = _this$props.onItemActivated,
|
|
99
|
-
_onMouseEnter = _this$props.onMouseEnter,
|
|
100
|
-
_onMouseLeave = _this$props.onMouseLeave,
|
|
101
|
-
shouldUseDefaultRole = _this$props.shouldUseDefaultRole; // onClick and value.name are the action indicators in the handlers
|
|
102
|
-
// If neither are present, don't wrap in an Item.
|
|
103
|
-
|
|
104
|
-
if (!item.onClick && !item.value && !item.value.name) {
|
|
105
|
-
return jsx("span", {
|
|
106
|
-
key: String(item.content)
|
|
107
|
-
}, item.content);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
var dropListItem = jsx("div", {
|
|
111
|
-
css: item.isActive ? itemWrapper : '',
|
|
112
|
-
key: item.key || item.content
|
|
113
|
-
}, jsx(Item, {
|
|
114
|
-
role: shouldUseDefaultRole ? 'button' : 'menuitem',
|
|
115
|
-
elemBefore: item.elemBefore,
|
|
116
|
-
elemAfter: item.elemAfter,
|
|
117
|
-
isDisabled: item.isDisabled,
|
|
118
|
-
onClick: function onClick() {
|
|
119
|
-
return onItemActivated && onItemActivated({
|
|
120
|
-
item: item
|
|
121
|
-
});
|
|
122
|
-
},
|
|
123
|
-
onMouseEnter: function onMouseEnter() {
|
|
124
|
-
return _onMouseEnter && _onMouseEnter({
|
|
125
|
-
item: item
|
|
126
|
-
});
|
|
127
|
-
},
|
|
128
|
-
onMouseLeave: function onMouseLeave() {
|
|
129
|
-
return _onMouseLeave && _onMouseLeave({
|
|
130
|
-
item: item
|
|
131
|
-
});
|
|
132
|
-
},
|
|
133
|
-
className: item.className,
|
|
134
|
-
"aria-label": item.label || String(item.content),
|
|
135
|
-
"aria-pressed": shouldUseDefaultRole ? item.isActive : undefined
|
|
136
|
-
}, jsx("span", {
|
|
137
|
-
css: !!item.elemBefore ? itemContentWrapper : ''
|
|
138
|
-
}, item.content)));
|
|
139
|
-
|
|
140
|
-
if (item.tooltipDescription) {
|
|
141
|
-
return jsx(Tooltip, {
|
|
142
|
-
key: item.key || item.content,
|
|
143
|
-
content: item.tooltipDescription,
|
|
144
|
-
position: item.tooltipPosition
|
|
145
|
-
}, dropListItem);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return dropListItem;
|
|
149
|
-
}
|
|
150
|
-
}, {
|
|
151
114
|
key: "renderDropdownMenu",
|
|
152
115
|
value: function renderDropdownMenu() {
|
|
153
116
|
var _this2 = this;
|
|
@@ -155,17 +118,17 @@ var DropdownMenuWrapper = /*#__PURE__*/function (_PureComponent) {
|
|
|
155
118
|
var _this$state = this.state,
|
|
156
119
|
target = _this$state.target,
|
|
157
120
|
popupPlacement = _this$state.popupPlacement;
|
|
158
|
-
var _this$
|
|
159
|
-
items = _this$
|
|
160
|
-
mountTo = _this$
|
|
161
|
-
boundariesElement = _this$
|
|
162
|
-
scrollableElement = _this$
|
|
163
|
-
offset = _this$
|
|
164
|
-
fitHeight = _this$
|
|
165
|
-
fitWidth = _this$
|
|
166
|
-
isOpen = _this$
|
|
167
|
-
zIndex = _this$
|
|
168
|
-
shouldUseDefaultRole = _this$
|
|
121
|
+
var _this$props = this.props,
|
|
122
|
+
items = _this$props.items,
|
|
123
|
+
mountTo = _this$props.mountTo,
|
|
124
|
+
boundariesElement = _this$props.boundariesElement,
|
|
125
|
+
scrollableElement = _this$props.scrollableElement,
|
|
126
|
+
offset = _this$props.offset,
|
|
127
|
+
fitHeight = _this$props.fitHeight,
|
|
128
|
+
fitWidth = _this$props.fitWidth,
|
|
129
|
+
isOpen = _this$props.isOpen,
|
|
130
|
+
zIndex = _this$props.zIndex,
|
|
131
|
+
shouldUseDefaultRole = _this$props.shouldUseDefaultRole;
|
|
169
132
|
return jsx(Popup, {
|
|
170
133
|
target: isOpen ? target : undefined,
|
|
171
134
|
mountTo: mountTo,
|
|
@@ -191,20 +154,29 @@ var DropdownMenuWrapper = /*#__PURE__*/function (_PureComponent) {
|
|
|
191
154
|
minWidth: fitWidth || 0
|
|
192
155
|
}
|
|
193
156
|
}), items.map(function (group, index) {
|
|
194
|
-
return jsx(
|
|
157
|
+
return jsx(MenuGroup, {
|
|
195
158
|
key: index,
|
|
196
159
|
role: shouldUseDefaultRole ? 'group' : 'menu'
|
|
197
160
|
}, group.items.map(function (item) {
|
|
198
|
-
|
|
161
|
+
var _item$key;
|
|
162
|
+
|
|
163
|
+
return jsx(DropdownMenuItem, {
|
|
164
|
+
key: (_item$key = item.key) !== null && _item$key !== void 0 ? _item$key : String(item.content),
|
|
165
|
+
item: item,
|
|
166
|
+
onItemActivated: _this2.props.onItemActivated,
|
|
167
|
+
shouldUseDefaultRole: _this2.props.shouldUseDefaultRole,
|
|
168
|
+
onMouseEnter: _this2.props.onMouseEnter,
|
|
169
|
+
onMouseLeave: _this2.props.onMouseLeave
|
|
170
|
+
});
|
|
199
171
|
}));
|
|
200
172
|
})));
|
|
201
173
|
}
|
|
202
174
|
}, {
|
|
203
175
|
key: "render",
|
|
204
176
|
value: function render() {
|
|
205
|
-
var _this$
|
|
206
|
-
children = _this$
|
|
207
|
-
isOpen = _this$
|
|
177
|
+
var _this$props2 = this.props,
|
|
178
|
+
children = _this$props2.children,
|
|
179
|
+
isOpen = _this$props2.isOpen;
|
|
208
180
|
return jsx("div", {
|
|
209
181
|
css: wrapper
|
|
210
182
|
}, jsx("div", {
|
|
@@ -216,4 +188,78 @@ var DropdownMenuWrapper = /*#__PURE__*/function (_PureComponent) {
|
|
|
216
188
|
return DropdownMenuWrapper;
|
|
217
189
|
}(PureComponent);
|
|
218
190
|
|
|
219
|
-
export { DropdownMenuWrapper as default };
|
|
191
|
+
export { DropdownMenuWrapper as default };
|
|
192
|
+
var DropdownMenuItemCustomComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
193
|
+
var children = props.children,
|
|
194
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
195
|
+
|
|
196
|
+
return jsx("span", _extends({
|
|
197
|
+
ref: ref
|
|
198
|
+
}, rest), children);
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
function DropdownMenuItem(_ref) {
|
|
202
|
+
var _item$key2;
|
|
203
|
+
|
|
204
|
+
var item = _ref.item,
|
|
205
|
+
onItemActivated = _ref.onItemActivated,
|
|
206
|
+
shouldUseDefaultRole = _ref.shouldUseDefaultRole,
|
|
207
|
+
_onMouseEnter = _ref.onMouseEnter,
|
|
208
|
+
_onMouseLeave = _ref.onMouseLeave;
|
|
209
|
+
|
|
210
|
+
// onClick and value.name are the action indicators in the handlers
|
|
211
|
+
// If neither are present, don't wrap in an Item.
|
|
212
|
+
if (!item.onClick && !(item.value && item.value.name)) {
|
|
213
|
+
return jsx("span", {
|
|
214
|
+
key: String(item.content)
|
|
215
|
+
}, item.content);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
var dropListItem = jsx("div", {
|
|
219
|
+
css: function css(theme) {
|
|
220
|
+
return buttonStyles(item.isActive)({
|
|
221
|
+
theme: theme
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}, jsx(CustomItem, {
|
|
225
|
+
item: item,
|
|
226
|
+
key: (_item$key2 = item.key) !== null && _item$key2 !== void 0 ? _item$key2 : String(item.content),
|
|
227
|
+
role: shouldUseDefaultRole ? 'button' : 'menuitem',
|
|
228
|
+
iconBefore: item.elemBefore,
|
|
229
|
+
iconAfter: item.elemAfter,
|
|
230
|
+
isDisabled: item.isDisabled,
|
|
231
|
+
onClick: function onClick() {
|
|
232
|
+
return onItemActivated && onItemActivated({
|
|
233
|
+
item: item
|
|
234
|
+
});
|
|
235
|
+
},
|
|
236
|
+
"aria-label": item['aria-label'] || String(item.content),
|
|
237
|
+
"aria-pressed": shouldUseDefaultRole ? item.isActive : undefined,
|
|
238
|
+
onMouseDown: function onMouseDown(e) {
|
|
239
|
+
e.preventDefault();
|
|
240
|
+
},
|
|
241
|
+
component: DropdownMenuItemCustomComponent,
|
|
242
|
+
onMouseEnter: function onMouseEnter() {
|
|
243
|
+
return _onMouseEnter && _onMouseEnter({
|
|
244
|
+
item: item
|
|
245
|
+
});
|
|
246
|
+
},
|
|
247
|
+
onMouseLeave: function onMouseLeave() {
|
|
248
|
+
return _onMouseLeave && _onMouseLeave({
|
|
249
|
+
item: item
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
}, item.content));
|
|
253
|
+
|
|
254
|
+
if (item.tooltipDescription) {
|
|
255
|
+
var _item$key3;
|
|
256
|
+
|
|
257
|
+
return jsx(Tooltip, {
|
|
258
|
+
key: (_item$key3 = item.key) !== null && _item$key3 !== void 0 ? _item$key3 : String(item.content),
|
|
259
|
+
content: item.tooltipDescription,
|
|
260
|
+
position: item.tooltipPosition
|
|
261
|
+
}, dropListItem);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
return dropListItem;
|
|
265
|
+
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
5
|
|
|
5
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10
|
|
6
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
6
7
|
|
|
7
8
|
var _excluded = ["items", "mode", "selectedItemIndex", "focusedItemIndex", "setColumnCount", "createAnalyticsEvent", "emptyStateHandler", "selectedCategory", "searchTerm"];
|
|
8
9
|
|
|
9
10
|
/** @jsx jsx */
|
|
10
|
-
import React, { Fragment, memo, useCallback, useEffect, useMemo } from 'react';
|
|
11
|
+
import React, { Fragment, memo, useCallback, useEffect, useMemo, useState } from 'react';
|
|
11
12
|
import { css, jsx } from '@emotion/react';
|
|
12
13
|
import { AutoSizer } from 'react-virtualized/dist/commonjs/AutoSizer';
|
|
13
14
|
import { Collection } from 'react-virtualized/dist/commonjs/Collection';
|
|
@@ -21,13 +22,13 @@ import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent } from '../../..
|
|
|
21
22
|
import IconFallback from '../../../../plugins/quick-insert/assets/fallback';
|
|
22
23
|
import { itemIcon } from '../../../../plugins/type-ahead/ui/TypeAheadListItem';
|
|
23
24
|
import { shortcutStyle } from '../../../styles';
|
|
24
|
-
import { ELEMENT_LIST_PADDING,
|
|
25
|
+
import { ELEMENT_LIST_PADDING, SCROLLBAR_WIDTH } from '../../constants';
|
|
25
26
|
import useContainerWidth from '../../hooks/use-container-width';
|
|
26
27
|
import useFocus from '../../hooks/use-focus';
|
|
27
28
|
import { Modes } from '../../types';
|
|
28
29
|
import cellSizeAndPositionGetter from './cellSizeAndPositionGetter';
|
|
29
30
|
import EmptyState from './EmptyState';
|
|
30
|
-
import { getColumnCount } from './utils';
|
|
31
|
+
import { getColumnCount, getScrollbarWidth } from './utils';
|
|
31
32
|
|
|
32
33
|
function ElementList(_ref) {
|
|
33
34
|
var items = _ref.items,
|
|
@@ -45,6 +46,11 @@ function ElementList(_ref) {
|
|
|
45
46
|
containerWidth = _useContainerWidth.containerWidth,
|
|
46
47
|
ContainerWidthMonitor = _useContainerWidth.ContainerWidthMonitor;
|
|
47
48
|
|
|
49
|
+
var _useState = useState(SCROLLBAR_WIDTH),
|
|
50
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
51
|
+
scrollbarWidth = _useState2[0],
|
|
52
|
+
setScrollbarWidth = _useState2[1];
|
|
53
|
+
|
|
48
54
|
var fullMode = mode === Modes.full;
|
|
49
55
|
useEffect(function () {
|
|
50
56
|
/**
|
|
@@ -53,8 +59,13 @@ function ElementList(_ref) {
|
|
|
53
59
|
**/
|
|
54
60
|
if (fullMode && containerWidth > 0) {
|
|
55
61
|
setColumnCount(getColumnCount(containerWidth));
|
|
62
|
+
var updatedScrollbarWidth = getScrollbarWidth();
|
|
63
|
+
|
|
64
|
+
if (updatedScrollbarWidth > 0) {
|
|
65
|
+
setScrollbarWidth(updatedScrollbarWidth);
|
|
66
|
+
}
|
|
56
67
|
}
|
|
57
|
-
}, [fullMode, containerWidth, setColumnCount]);
|
|
68
|
+
}, [fullMode, containerWidth, setColumnCount, scrollbarWidth]);
|
|
58
69
|
var onExternalLinkClick = useCallback(function () {
|
|
59
70
|
fireAnalyticsEvent(createAnalyticsEvent)({
|
|
60
71
|
payload: {
|
|
@@ -104,7 +115,7 @@ function ElementList(_ref) {
|
|
|
104
115
|
return jsx(Collection, {
|
|
105
116
|
cellCount: items.length,
|
|
106
117
|
cellRenderer: cellRenderer,
|
|
107
|
-
cellSizeAndPositionGetter: cellSizeAndPositionGetter(containerWidth),
|
|
118
|
+
cellSizeAndPositionGetter: cellSizeAndPositionGetter(containerWidth - ELEMENT_LIST_PADDING * 2, scrollbarWidth),
|
|
108
119
|
height: height,
|
|
109
120
|
width: containerWidth - ELEMENT_LIST_PADDING * 2 // containerWidth - padding on Left/Right (for focus outline)
|
|
110
121
|
|
|
@@ -226,22 +237,21 @@ var ItemContent = /*#__PURE__*/memo(function (_ref6) {
|
|
|
226
237
|
css: itemDescription
|
|
227
238
|
}, description)));
|
|
228
239
|
});
|
|
229
|
-
var
|
|
230
|
-
var
|
|
231
|
-
var
|
|
232
|
-
var itemBody = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n justify-content: space-between;\n line-height: 1.4;\n width: 100%;\n\n margin-top: -2px; // Fixes the Item Icon and text's alignment issue\n"])));
|
|
240
|
+
var elementItemsWrapper = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n flex: 1;\n flex-flow: row wrap;\n align-items: flex-start;\n justify-content: flex-start;\n overflow: hidden;\n padding: ", "px; // For Focus outline\n\n .ReactVirtualized__Collection {\n border-radius: 3px; // Standard border-radius across other components like Search or Item.\n outline: none;\n\n :focus {\n box-shadow: 0 0 0 ", "px\n ", ";\n }\n }\n .ReactVirtualized__Collection__innerScrollContainer {\n div[class='element-item-wrapper']:last-child {\n padding-bottom: 4px;\n }\n }\n"])), ELEMENT_LIST_PADDING, ELEMENT_LIST_PADDING, token('color.border.focused', B100));
|
|
241
|
+
var elementItemWrapper = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n div {\n button {\n height: 75px;\n align-items: flex-start;\n padding: 12px 12px 11px;\n }\n }\n"])));
|
|
242
|
+
var itemBody = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n justify-content: space-between;\n line-height: 1.4;\n width: 100%;\n\n margin-top: -2px; // Fixes the Item Icon and text's alignment issue\n"])));
|
|
233
243
|
/*
|
|
234
244
|
* -webkit-line-clamp is also supported by firefox 🎉
|
|
235
245
|
* https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/68#CSS
|
|
236
246
|
*/
|
|
237
247
|
|
|
238
|
-
var multilineStyle = css(
|
|
239
|
-
var itemDescription = css(
|
|
240
|
-
var itemText = css(
|
|
241
|
-
var itemTitleWrapper = css(
|
|
242
|
-
var itemTitle = css(
|
|
243
|
-
var itemAfter = css(
|
|
244
|
-
var itemIconStyle = css(
|
|
248
|
+
var multilineStyle = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n"])));
|
|
249
|
+
var itemDescription = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n ", ";\n\n overflow: hidden;\n font-size: ", ";\n color: ", ";\n margin-top: 2px;\n"])), multilineStyle, relativeFontSizeToBase16(11.67), token('color.text.subtle', N200));
|
|
250
|
+
var itemText = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n width: inherit;\n white-space: initial;\n"])));
|
|
251
|
+
var itemTitleWrapper = css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: space-between; // Title and keyboardshortcut are rendered in the same block\n"])));
|
|
252
|
+
var itemTitle = css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n width: 100%;\n overflow: hidden;\n\n white-space: nowrap;\n text-overflow: ellipsis;\n"])));
|
|
253
|
+
var itemAfter = css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n flex: 0 0 auto;\n"])));
|
|
254
|
+
var itemIconStyle = css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n img {\n height: 40px;\n width: 40px;\n object-fit: cover;\n }\n"])));
|
|
245
255
|
var MemoizedElementListWithAnalytics = /*#__PURE__*/memo(withAnalyticsContext({
|
|
246
256
|
component: 'ElementList'
|
|
247
257
|
})(ElementList));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ELEMENT_ITEM_HEIGHT
|
|
1
|
+
import { ELEMENT_ITEM_HEIGHT } from '../../constants';
|
|
2
2
|
import { generateVirtualizedContainerDatum } from './utils';
|
|
3
3
|
/**
|
|
4
4
|
* Callback responsible for returning size and offset/position information
|
|
@@ -6,7 +6,7 @@ import { generateVirtualizedContainerDatum } from './utils';
|
|
|
6
6
|
* https://github.com/bvaughn/react-virtualized/blob/master/docs/Collection.md
|
|
7
7
|
**/
|
|
8
8
|
|
|
9
|
-
export default function cellSizeAndPositionGetter(containerWidth) {
|
|
9
|
+
export default function cellSizeAndPositionGetter(containerWidth, scrollbarWidth) {
|
|
10
10
|
var GUTTER_SIZE = 4;
|
|
11
11
|
/**
|
|
12
12
|
* Save the currently rendered columnY positions.
|
|
@@ -19,7 +19,7 @@ export default function cellSizeAndPositionGetter(containerWidth) {
|
|
|
19
19
|
|
|
20
20
|
var _generateVirtualizedC = generateVirtualizedContainerDatum(containerWidth, {
|
|
21
21
|
gutterSize: GUTTER_SIZE,
|
|
22
|
-
scrollbarWidth:
|
|
22
|
+
scrollbarWidth: scrollbarWidth
|
|
23
23
|
}),
|
|
24
24
|
columnCount = _generateVirtualizedC.columnCount,
|
|
25
25
|
availableWidth = _generateVirtualizedC.availableWidth;
|