@atlaskit/editor-common 69.2.2 → 69.3.0
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 +21 -0
- package/analytics/package.json +8 -0
- package/core-utils/package.json +8 -0
- package/dist/cjs/analytics/api.js +5 -0
- package/dist/cjs/analytics/index.js +223 -0
- package/dist/cjs/analytics/types/avatar.js +5 -0
- package/dist/cjs/analytics/types/block.js +5 -0
- package/dist/cjs/analytics/types/config-panel-events.js +5 -0
- package/dist/cjs/analytics/types/cut-copy-events.js +5 -0
- package/dist/cjs/analytics/types/date-events.js +5 -0
- package/dist/cjs/analytics/types/dispatch-analytics-event.js +5 -0
- package/dist/cjs/analytics/types/element-browser-events.js +5 -0
- package/dist/cjs/analytics/types/enums.js +350 -0
- package/dist/cjs/analytics/types/events.js +5 -0
- package/dist/cjs/analytics/types/experimental-events.js +5 -0
- package/dist/cjs/analytics/types/extension-events.js +22 -0
- package/dist/cjs/analytics/types/find-replace-events.js +5 -0
- package/dist/cjs/analytics/types/format-events.js +24 -0
- package/dist/cjs/analytics/types/general-events.js +40 -0
- package/dist/cjs/analytics/types/index.js +249 -0
- package/dist/cjs/analytics/types/inline-comment-events.js +14 -0
- package/dist/cjs/analytics/types/insert-events.js +51 -0
- package/dist/cjs/analytics/types/link-tool-bar-events.js +5 -0
- package/dist/cjs/analytics/types/list-events.js +25 -0
- package/dist/cjs/analytics/types/media-events.js +5 -0
- package/dist/cjs/analytics/types/node-events.js +26 -0
- package/dist/cjs/analytics/types/paste-events.js +55 -0
- package/dist/cjs/analytics/types/performance-report.js +5 -0
- package/dist/cjs/analytics/types/selection-events.js +5 -0
- package/dist/cjs/analytics/types/smart-links.js +19 -0
- package/dist/cjs/analytics/types/substitute-events.js +24 -0
- package/dist/cjs/analytics/types/table-events.js +43 -0
- package/dist/cjs/analytics/types/toolbar-button.js +26 -0
- package/dist/cjs/analytics/types/type-ahead.js +5 -0
- package/dist/cjs/analytics/types/utils.js +28 -0
- package/dist/cjs/core-utils/index.js +13 -0
- package/dist/cjs/core-utils/inside.js +17 -0
- package/dist/cjs/event-dispatcher/index.js +88 -0
- package/dist/cjs/keymaps/consts.js +30 -0
- package/dist/cjs/keymaps/index.js +362 -0
- package/dist/cjs/messages/index.js +137 -1
- package/dist/cjs/messages/insert-block.js +177 -0
- package/dist/cjs/node-width/index.js +85 -0
- package/dist/cjs/react-node-view/index.js +252 -0
- package/dist/cjs/react-node-view/types.js +5 -0
- package/dist/cjs/selection/gap-cursor/selection.js +196 -0
- package/dist/cjs/selection/gap-cursor/utils/index.js +21 -0
- package/dist/cjs/selection/gap-cursor/utils/is-ignored.js +14 -0
- package/dist/cjs/selection/gap-cursor/utils/is-valid-target-node.js +14 -0
- package/dist/cjs/selection/index.js +67 -0
- package/dist/cjs/selection/types.js +15 -0
- package/dist/cjs/selection/utils.js +50 -0
- package/dist/cjs/styles/index.js +29 -1
- package/dist/cjs/styles/shared/extension.js +13 -0
- package/dist/cjs/styles/shared/layout.js +13 -0
- package/dist/cjs/styles/shared/table.js +3 -1
- package/dist/cjs/transforms/expand.js +52 -0
- package/dist/cjs/transforms/extension.js +34 -0
- package/dist/cjs/transforms/index.js +59 -0
- package/dist/cjs/transforms/layout.js +72 -0
- package/dist/cjs/types/command.js +5 -0
- package/dist/cjs/types/context-panel.js +5 -0
- package/dist/cjs/types/editor-actions.js +5 -0
- package/dist/cjs/types/editor-appearance.js +5 -0
- package/dist/cjs/types/editor-container-width.js +5 -0
- package/dist/cjs/types/editor-plugin.js +5 -0
- package/dist/cjs/types/editor-react-context.js +5 -0
- package/dist/cjs/types/empty-state-handler.js +5 -0
- package/dist/cjs/types/feature-flags.js +5 -0
- package/dist/cjs/types/floating-toolbar.js +5 -0
- package/dist/cjs/types/index.js +20 -0
- package/dist/cjs/types/plugin-factory.js +5 -0
- package/dist/cjs/types/prosemirror-config.js +5 -0
- package/dist/cjs/types/quick-insert.js +5 -0
- package/dist/cjs/types/supported-browsers.js +6 -0
- package/dist/cjs/types/toolbar.js +39 -0
- package/dist/cjs/types/ui-components.js +5 -0
- package/dist/cjs/ui/DropList/index.js +217 -0
- package/dist/cjs/ui/ErrorBoundary/index.js +100 -0
- package/dist/cjs/ui/Layer/index.js +245 -0
- package/dist/cjs/ui/Layer/internal/helpers.js +70 -0
- package/dist/cjs/ui/PortalProvider/PortalProviderThemesProvider.js +60 -0
- package/dist/cjs/ui/PortalProvider/index.js +294 -0
- package/dist/cjs/ui-color/ColorPalette/Color/index.js +115 -0
- package/dist/cjs/ui-color/ColorPalette/Color/styles.js +32 -0
- package/dist/cjs/ui-color/ColorPalette/Palettes/cellBackgroundColorPalette.js +30 -0
- package/dist/cjs/ui-color/ColorPalette/Palettes/common.js +37 -0
- package/dist/cjs/ui-color/ColorPalette/Palettes/getColorMessage.js +17 -0
- package/dist/cjs/ui-color/ColorPalette/Palettes/index.js +13 -0
- package/dist/cjs/ui-color/ColorPalette/Palettes/paletteMessages.js +123 -0
- package/dist/cjs/ui-color/ColorPalette/Palettes/panelBackgroundPalette.js +164 -0
- package/dist/cjs/ui-color/ColorPalette/Palettes/statusColorPalette.js +72 -0
- package/dist/cjs/ui-color/ColorPalette/Palettes/textColorPalette.js +41 -0
- package/dist/cjs/ui-color/ColorPalette/Palettes/type.js +5 -0
- package/dist/cjs/ui-color/ColorPalette/index.js +90 -0
- package/dist/cjs/ui-color/ColorPalette/styles.js +19 -0
- package/dist/cjs/ui-color/index.js +89 -0
- package/dist/cjs/ui-menu/Dropdown/index.js +127 -0
- package/dist/cjs/ui-menu/DropdownMenu/index.js +294 -0
- package/dist/cjs/ui-menu/DropdownMenu/types.js +5 -0
- package/dist/cjs/ui-menu/ToolbarButton/index.js +127 -0
- package/dist/cjs/ui-menu/ToolbarButton/styles.js +26 -0
- package/dist/cjs/ui-menu/index.js +43 -0
- package/dist/cjs/ui-react/ReactEditorViewContext.js +15 -0
- package/dist/cjs/ui-react/index.js +23 -0
- package/dist/cjs/ui-react/with-react-editor-view-outer-listeners.js +159 -0
- package/dist/cjs/utils/dom.js +138 -0
- package/dist/cjs/utils/editor-core-utils.js +108 -0
- package/dist/cjs/utils/index.js +222 -0
- package/dist/cjs/utils/is-text-input.js +31 -0
- package/dist/cjs/utils/nodes.js +134 -0
- package/dist/cjs/utils/plugin-state-factory.js +113 -0
- package/dist/cjs/utils/slice.js +77 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/with-plugin-state/index.js +316 -0
- package/dist/cjs/with-plugin-state/types.js +5 -0
- package/dist/es2019/analytics/api.js +1 -0
- package/dist/es2019/analytics/index.js +1 -0
- package/dist/es2019/analytics/types/avatar.js +1 -0
- package/dist/es2019/analytics/types/block.js +1 -0
- package/dist/es2019/analytics/types/config-panel-events.js +1 -0
- package/dist/es2019/analytics/types/cut-copy-events.js +1 -0
- package/dist/es2019/analytics/types/date-events.js +1 -0
- package/dist/es2019/analytics/types/dispatch-analytics-event.js +1 -0
- package/dist/es2019/analytics/types/element-browser-events.js +1 -0
- package/dist/es2019/analytics/types/enums.js +336 -0
- package/dist/es2019/analytics/types/events.js +1 -0
- package/dist/es2019/analytics/types/experimental-events.js +1 -0
- package/dist/es2019/analytics/types/extension-events.js +13 -0
- package/dist/es2019/analytics/types/find-replace-events.js +1 -0
- package/dist/es2019/analytics/types/format-events.js +16 -0
- package/dist/es2019/analytics/types/general-events.js +30 -0
- package/dist/es2019/analytics/types/index.js +14 -0
- package/dist/es2019/analytics/types/inline-comment-events.js +7 -0
- package/dist/es2019/analytics/types/insert-events.js +41 -0
- package/dist/es2019/analytics/types/link-tool-bar-events.js +1 -0
- package/dist/es2019/analytics/types/list-events.js +17 -0
- package/dist/es2019/analytics/types/media-events.js +1 -0
- package/dist/es2019/analytics/types/node-events.js +18 -0
- package/dist/es2019/analytics/types/paste-events.js +46 -0
- package/dist/es2019/analytics/types/performance-report.js +1 -0
- package/dist/es2019/analytics/types/selection-events.js +1 -0
- package/dist/es2019/analytics/types/smart-links.js +12 -0
- package/dist/es2019/analytics/types/substitute-events.js +16 -0
- package/dist/es2019/analytics/types/table-events.js +34 -0
- package/dist/es2019/analytics/types/toolbar-button.js +19 -0
- package/dist/es2019/analytics/types/type-ahead.js +1 -0
- package/dist/es2019/analytics/types/utils.js +20 -0
- package/dist/es2019/core-utils/index.js +1 -0
- package/dist/es2019/core-utils/inside.js +8 -0
- package/dist/es2019/event-dispatcher/index.js +60 -0
- package/dist/es2019/keymaps/consts.js +12 -0
- package/dist/es2019/keymaps/index.js +186 -0
- package/dist/es2019/messages/index.js +125 -1
- package/dist/es2019/messages/insert-block.js +168 -0
- package/dist/es2019/node-width/index.js +74 -0
- package/dist/es2019/react-node-view/index.js +199 -0
- package/dist/es2019/react-node-view/types.js +1 -0
- package/dist/es2019/selection/gap-cursor/selection.js +136 -0
- package/dist/es2019/selection/gap-cursor/utils/index.js +2 -0
- package/dist/es2019/selection/gap-cursor/utils/is-ignored.js +5 -0
- package/dist/es2019/selection/gap-cursor/utils/is-valid-target-node.js +4 -0
- package/dist/es2019/selection/index.js +4 -0
- package/dist/es2019/selection/types.js +8 -0
- package/dist/es2019/selection/utils.js +38 -0
- package/dist/es2019/styles/index.js +3 -1
- package/dist/es2019/styles/shared/extension.js +3 -0
- package/dist/es2019/styles/shared/layout.js +3 -0
- package/dist/es2019/styles/shared/table.js +3 -1
- package/dist/es2019/transforms/expand.js +36 -0
- package/dist/es2019/transforms/extension.js +26 -0
- package/dist/es2019/transforms/index.js +3 -0
- package/dist/es2019/transforms/layout.js +54 -0
- package/dist/es2019/types/command.js +1 -0
- package/dist/es2019/types/context-panel.js +1 -0
- package/dist/es2019/types/editor-actions.js +1 -0
- package/dist/es2019/types/editor-appearance.js +1 -0
- package/dist/es2019/types/editor-container-width.js +1 -0
- package/dist/es2019/types/editor-plugin.js +1 -0
- package/dist/es2019/types/editor-react-context.js +1 -0
- package/dist/es2019/types/empty-state-handler.js +1 -0
- package/dist/es2019/types/feature-flags.js +1 -0
- package/dist/es2019/types/floating-toolbar.js +1 -0
- package/dist/es2019/types/index.js +2 -1
- package/dist/es2019/types/plugin-factory.js +1 -0
- package/dist/es2019/types/prosemirror-config.js +1 -0
- package/dist/es2019/types/quick-insert.js +1 -0
- package/dist/es2019/types/supported-browsers.js +2 -0
- package/dist/es2019/types/toolbar.js +30 -0
- package/dist/es2019/types/ui-components.js +1 -0
- package/dist/es2019/ui/DropList/index.js +187 -0
- package/dist/es2019/ui/ErrorBoundary/index.js +52 -0
- package/dist/es2019/ui/Layer/index.js +195 -0
- package/dist/es2019/ui/Layer/internal/helpers.js +62 -0
- package/dist/es2019/ui/PortalProvider/PortalProviderThemesProvider.js +43 -0
- package/dist/es2019/ui/PortalProvider/index.js +193 -0
- package/dist/es2019/ui-color/ColorPalette/Color/index.js +72 -0
- package/dist/es2019/ui-color/ColorPalette/Color/styles.js +35 -0
- package/dist/es2019/ui-color/ColorPalette/Palettes/cellBackgroundColorPalette.js +15 -0
- package/dist/es2019/ui-color/ColorPalette/Palettes/common.js +25 -0
- package/dist/es2019/ui-color/ColorPalette/Palettes/getColorMessage.js +14 -0
- package/dist/es2019/ui-color/ColorPalette/Palettes/index.js +1 -0
- package/dist/es2019/ui-color/ColorPalette/Palettes/paletteMessages.js +113 -0
- package/dist/es2019/ui-color/ColorPalette/Palettes/panelBackgroundPalette.js +143 -0
- package/dist/es2019/ui-color/ColorPalette/Palettes/statusColorPalette.js +56 -0
- package/dist/es2019/ui-color/ColorPalette/Palettes/textColorPalette.js +25 -0
- package/dist/es2019/ui-color/ColorPalette/Palettes/type.js +1 -0
- package/dist/es2019/ui-color/ColorPalette/index.js +68 -0
- package/dist/es2019/ui-color/ColorPalette/styles.js +7 -0
- package/dist/es2019/ui-color/index.js +8 -0
- package/dist/es2019/ui-menu/Dropdown/index.js +83 -0
- package/dist/es2019/ui-menu/DropdownMenu/index.js +244 -0
- package/dist/es2019/ui-menu/DropdownMenu/types.js +1 -0
- package/dist/es2019/ui-menu/ToolbarButton/index.js +94 -0
- package/dist/es2019/ui-menu/ToolbarButton/styles.js +12 -0
- package/dist/es2019/ui-menu/index.js +3 -0
- package/dist/es2019/ui-react/ReactEditorViewContext.js +3 -0
- package/dist/es2019/ui-react/index.js +2 -0
- package/dist/es2019/ui-react/with-react-editor-view-outer-listeners.js +103 -0
- package/dist/es2019/utils/dom.js +113 -0
- package/dist/es2019/utils/editor-core-utils.js +72 -0
- package/dist/es2019/utils/index.js +6 -0
- package/dist/es2019/utils/is-text-input.js +19 -0
- package/dist/es2019/utils/nodes.js +88 -0
- package/dist/es2019/utils/plugin-state-factory.js +107 -0
- package/dist/es2019/utils/slice.js +56 -0
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/with-plugin-state/index.js +263 -0
- package/dist/es2019/with-plugin-state/types.js +1 -0
- package/dist/esm/analytics/api.js +1 -0
- package/dist/esm/analytics/index.js +1 -0
- package/dist/esm/analytics/types/avatar.js +1 -0
- package/dist/esm/analytics/types/block.js +1 -0
- package/dist/esm/analytics/types/config-panel-events.js +1 -0
- package/dist/esm/analytics/types/cut-copy-events.js +1 -0
- package/dist/esm/analytics/types/date-events.js +1 -0
- package/dist/esm/analytics/types/dispatch-analytics-event.js +1 -0
- package/dist/esm/analytics/types/element-browser-events.js +1 -0
- package/dist/esm/analytics/types/enums.js +336 -0
- package/dist/esm/analytics/types/events.js +1 -0
- package/dist/esm/analytics/types/experimental-events.js +1 -0
- package/dist/esm/analytics/types/extension-events.js +13 -0
- package/dist/esm/analytics/types/find-replace-events.js +1 -0
- package/dist/esm/analytics/types/format-events.js +16 -0
- package/dist/esm/analytics/types/general-events.js +30 -0
- package/dist/esm/analytics/types/index.js +14 -0
- package/dist/esm/analytics/types/inline-comment-events.js +7 -0
- package/dist/esm/analytics/types/insert-events.js +41 -0
- package/dist/esm/analytics/types/link-tool-bar-events.js +1 -0
- package/dist/esm/analytics/types/list-events.js +17 -0
- package/dist/esm/analytics/types/media-events.js +1 -0
- package/dist/esm/analytics/types/node-events.js +18 -0
- package/dist/esm/analytics/types/paste-events.js +46 -0
- package/dist/esm/analytics/types/performance-report.js +1 -0
- package/dist/esm/analytics/types/selection-events.js +1 -0
- package/dist/esm/analytics/types/smart-links.js +12 -0
- package/dist/esm/analytics/types/substitute-events.js +16 -0
- package/dist/esm/analytics/types/table-events.js +34 -0
- package/dist/esm/analytics/types/toolbar-button.js +19 -0
- package/dist/esm/analytics/types/type-ahead.js +1 -0
- package/dist/esm/analytics/types/utils.js +20 -0
- package/dist/esm/core-utils/index.js +1 -0
- package/dist/esm/core-utils/inside.js +7 -0
- package/dist/esm/event-dispatcher/index.js +74 -0
- package/dist/esm/keymaps/consts.js +12 -0
- package/dist/esm/keymaps/index.js +184 -0
- package/dist/esm/messages/index.js +125 -1
- package/dist/esm/messages/insert-block.js +168 -0
- package/dist/esm/node-width/index.js +72 -0
- package/dist/esm/react-node-view/index.js +244 -0
- package/dist/esm/react-node-view/types.js +1 -0
- package/dist/esm/selection/gap-cursor/selection.js +176 -0
- package/dist/esm/selection/gap-cursor/utils/index.js +2 -0
- package/dist/esm/selection/gap-cursor/utils/is-ignored.js +5 -0
- package/dist/esm/selection/gap-cursor/utils/is-valid-target-node.js +4 -0
- package/dist/esm/selection/index.js +4 -0
- package/dist/esm/selection/types.js +8 -0
- package/dist/esm/selection/utils.js +38 -0
- package/dist/esm/styles/index.js +3 -1
- package/dist/esm/styles/shared/extension.js +3 -0
- package/dist/esm/styles/shared/layout.js +3 -0
- package/dist/esm/styles/shared/table.js +3 -1
- package/dist/esm/transforms/expand.js +34 -0
- package/dist/esm/transforms/extension.js +24 -0
- package/dist/esm/transforms/index.js +3 -0
- package/dist/esm/transforms/layout.js +58 -0
- package/dist/esm/types/command.js +1 -0
- package/dist/esm/types/context-panel.js +1 -0
- package/dist/esm/types/editor-actions.js +1 -0
- package/dist/esm/types/editor-appearance.js +1 -0
- package/dist/esm/types/editor-container-width.js +1 -0
- package/dist/esm/types/editor-plugin.js +1 -0
- package/dist/esm/types/editor-react-context.js +1 -0
- package/dist/esm/types/empty-state-handler.js +1 -0
- package/dist/esm/types/feature-flags.js +1 -0
- package/dist/esm/types/floating-toolbar.js +1 -0
- package/dist/esm/types/index.js +2 -1
- package/dist/esm/types/plugin-factory.js +1 -0
- package/dist/esm/types/prosemirror-config.js +1 -0
- package/dist/esm/types/quick-insert.js +1 -0
- package/dist/esm/types/supported-browsers.js +2 -0
- package/dist/esm/types/toolbar.js +30 -0
- package/dist/esm/types/ui-components.js +1 -0
- package/dist/esm/ui/DropList/index.js +205 -0
- package/dist/esm/ui/ErrorBoundary/index.js +84 -0
- package/dist/esm/ui/Layer/index.js +228 -0
- package/dist/esm/ui/Layer/internal/helpers.js +62 -0
- package/dist/esm/ui/PortalProvider/PortalProviderThemesProvider.js +43 -0
- package/dist/esm/ui/PortalProvider/index.js +275 -0
- package/dist/esm/ui-color/ColorPalette/Color/index.js +93 -0
- package/dist/esm/ui-color/ColorPalette/Color/styles.js +19 -0
- package/dist/esm/ui-color/ColorPalette/Palettes/cellBackgroundColorPalette.js +15 -0
- package/dist/esm/ui-color/ColorPalette/Palettes/common.js +24 -0
- package/dist/esm/ui-color/ColorPalette/Palettes/getColorMessage.js +10 -0
- package/dist/esm/ui-color/ColorPalette/Palettes/index.js +1 -0
- package/dist/esm/ui-color/ColorPalette/Palettes/paletteMessages.js +113 -0
- package/dist/esm/ui-color/ColorPalette/Palettes/panelBackgroundPalette.js +153 -0
- package/dist/esm/ui-color/ColorPalette/Palettes/statusColorPalette.js +56 -0
- package/dist/esm/ui-color/ColorPalette/Palettes/textColorPalette.js +25 -0
- package/dist/esm/ui-color/ColorPalette/Palettes/type.js +1 -0
- package/dist/esm/ui-color/ColorPalette/index.js +70 -0
- package/dist/esm/ui-color/ColorPalette/styles.js +7 -0
- package/dist/esm/ui-color/index.js +8 -0
- package/dist/esm/ui-menu/Dropdown/index.js +105 -0
- package/dist/esm/ui-menu/DropdownMenu/index.js +265 -0
- package/dist/esm/ui-menu/DropdownMenu/types.js +1 -0
- package/dist/esm/ui-menu/ToolbarButton/index.js +102 -0
- package/dist/esm/ui-menu/ToolbarButton/styles.js +12 -0
- package/dist/esm/ui-menu/index.js +3 -0
- package/dist/esm/ui-react/ReactEditorViewContext.js +3 -0
- package/dist/esm/ui-react/index.js +2 -0
- package/dist/esm/ui-react/with-react-editor-view-outer-listeners.js +138 -0
- package/dist/esm/utils/dom.js +113 -0
- package/dist/esm/utils/editor-core-utils.js +72 -0
- package/dist/esm/utils/index.js +6 -0
- package/dist/esm/utils/is-text-input.js +18 -0
- package/dist/esm/utils/nodes.js +100 -0
- package/dist/esm/utils/plugin-state-factory.js +106 -0
- package/dist/esm/utils/slice.js +59 -0
- package/dist/esm/version.json +1 -1
- package/dist/esm/with-plugin-state/index.js +311 -0
- package/dist/esm/with-plugin-state/types.js +1 -0
- package/dist/types/analytics/api.d.ts +5 -0
- package/dist/types/analytics/index.d.ts +3 -0
- package/dist/types/analytics/types/avatar.d.ts +5 -0
- package/dist/types/analytics/types/block.d.ts +3 -0
- package/dist/types/analytics/types/config-panel-events.d.ts +17 -0
- package/dist/types/analytics/types/cut-copy-events.d.ts +12 -0
- package/dist/types/analytics/types/date-events.d.ts +17 -0
- package/dist/types/analytics/types/dispatch-analytics-event.d.ts +2 -0
- package/dist/types/analytics/types/element-browser-events.d.ts +11 -0
- package/dist/types/analytics/types/enums.d.ts +313 -0
- package/dist/types/analytics/types/events.d.ts +125 -0
- package/dist/types/analytics/types/experimental-events.d.ts +17 -0
- package/dist/types/analytics/types/extension-events.d.ts +37 -0
- package/dist/types/analytics/types/find-replace-events.d.ts +23 -0
- package/dist/types/analytics/types/format-events.d.ts +49 -0
- package/dist/types/analytics/types/general-events.d.ts +179 -0
- package/dist/types/analytics/types/index.d.ts +34 -0
- package/dist/types/analytics/types/inline-comment-events.d.ts +17 -0
- package/dist/types/analytics/types/insert-events.d.ts +128 -0
- package/dist/types/analytics/types/link-tool-bar-events.d.ts +76 -0
- package/dist/types/analytics/types/list-events.d.ts +52 -0
- package/dist/types/analytics/types/media-events.d.ts +16 -0
- package/dist/types/analytics/types/node-events.d.ts +56 -0
- package/dist/types/analytics/types/paste-events.d.ts +39 -0
- package/dist/types/analytics/types/performance-report.d.ts +24 -0
- package/dist/types/analytics/types/selection-events.d.ts +18 -0
- package/dist/types/analytics/types/smart-links.d.ts +13 -0
- package/dist/types/analytics/types/substitute-events.d.ts +26 -0
- package/dist/types/analytics/types/table-events.d.ts +94 -0
- package/dist/types/analytics/types/toolbar-button.d.ts +22 -0
- package/dist/types/analytics/types/type-ahead.d.ts +27 -0
- package/dist/types/analytics/types/utils.d.ts +46 -0
- package/dist/types/core-utils/index.d.ts +1 -0
- package/dist/types/core-utils/inside.d.ts +2 -0
- package/dist/types/event-dispatcher/index.d.ts +19 -0
- package/dist/types/keymaps/consts.d.ts +12 -0
- package/dist/types/keymaps/index.d.ts +89 -0
- package/dist/types/messages/index.d.ts +124 -0
- package/dist/types/messages/insert-block.d.ts +167 -0
- package/dist/types/node-width/index.d.ts +7 -0
- package/dist/types/react-node-view/index.d.ts +52 -0
- package/dist/types/react-node-view/types.d.ts +12 -0
- package/dist/types/selection/gap-cursor/selection.d.ts +40 -0
- package/dist/types/selection/gap-cursor/utils/index.d.ts +2 -0
- package/dist/types/selection/gap-cursor/utils/is-ignored.d.ts +2 -0
- package/dist/types/selection/gap-cursor/utils/is-valid-target-node.d.ts +2 -0
- package/dist/types/selection/index.d.ts +5 -0
- package/dist/types/selection/types.d.ts +26 -0
- package/dist/types/selection/utils.d.ts +4 -0
- package/dist/types/styles/index.d.ts +2 -0
- package/dist/types/styles/shared/extension.d.ts +2 -0
- package/dist/types/styles/shared/layout.d.ts +2 -0
- package/dist/types/styles/shared/table.d.ts +2 -0
- package/dist/types/transforms/expand.d.ts +5 -0
- package/dist/types/transforms/extension.d.ts +6 -0
- package/dist/types/transforms/index.d.ts +3 -0
- package/dist/types/transforms/layout.d.ts +15 -0
- package/dist/types/types/command.d.ts +5 -0
- package/dist/types/types/context-panel.d.ts +3 -0
- package/dist/types/types/editor-actions.d.ts +19 -0
- package/dist/types/types/editor-appearance.d.ts +1 -0
- package/dist/types/types/editor-container-width.d.ts +6 -0
- package/dist/types/types/editor-plugin.d.ts +61 -0
- package/dist/types/types/editor-react-context.d.ts +6 -0
- package/dist/types/types/empty-state-handler.d.ts +7 -0
- package/dist/types/types/feature-flags.d.ts +344 -0
- package/dist/types/types/floating-toolbar.d.ts +183 -0
- package/dist/types/types/index.d.ts +17 -1
- package/dist/types/types/plugin-factory.d.ts +27 -0
- package/dist/types/types/prosemirror-config.d.ts +14 -0
- package/dist/types/types/quick-insert.d.ts +26 -0
- package/dist/types/types/supported-browsers.d.ts +10 -0
- package/dist/types/types/toolbar.d.ts +30 -0
- package/dist/types/types/type-ahead.d.ts +50 -1
- package/dist/types/types/ui-components.d.ts +22 -0
- package/dist/types/ui/DropList/index.d.ts +19 -0
- package/dist/types/ui/ErrorBoundary/index.d.ts +24 -0
- package/dist/types/ui/Layer/index.d.ts +47 -0
- package/dist/types/ui/Layer/internal/helpers.d.ts +5 -0
- package/dist/types/ui/PortalProvider/PortalProviderThemesProvider.d.ts +6 -0
- package/dist/types/ui/PortalProvider/index.d.ts +50 -0
- package/dist/types/ui-color/ColorPalette/Color/index.d.ts +19 -0
- package/dist/types/ui-color/ColorPalette/Color/styles.d.ts +4 -0
- package/dist/types/ui-color/ColorPalette/Palettes/cellBackgroundColorPalette.d.ts +3 -0
- package/dist/types/ui-color/ColorPalette/Palettes/common.d.ts +2 -0
- package/dist/types/ui-color/ColorPalette/Palettes/getColorMessage.d.ts +2 -0
- package/dist/types/ui-color/ColorPalette/Palettes/index.d.ts +2 -0
- package/dist/types/ui-color/ColorPalette/Palettes/paletteMessages.d.ts +113 -0
- package/dist/types/ui-color/ColorPalette/Palettes/panelBackgroundPalette.d.ts +4 -0
- package/dist/types/ui-color/ColorPalette/Palettes/statusColorPalette.d.ts +4 -0
- package/dist/types/ui-color/ColorPalette/Palettes/textColorPalette.d.ts +3 -0
- package/dist/types/ui-color/ColorPalette/Palettes/type.d.ts +8 -0
- package/dist/types/ui-color/ColorPalette/index.d.ts +15 -0
- package/dist/types/ui-color/ColorPalette/styles.d.ts +1 -0
- package/dist/types/ui-color/index.d.ts +9 -0
- package/dist/types/ui-menu/Dropdown/index.d.ts +32 -0
- package/dist/types/ui-menu/DropdownMenu/index.d.ts +19 -0
- package/dist/types/ui-menu/DropdownMenu/types.d.ts +43 -0
- package/dist/types/ui-menu/ToolbarButton/index.d.ts +53 -0
- package/dist/types/ui-menu/ToolbarButton/styles.d.ts +4 -0
- package/dist/types/ui-menu/index.d.ts +5 -0
- package/dist/types/ui-react/ReactEditorViewContext.d.ts +8 -0
- package/dist/types/ui-react/index.d.ts +2 -0
- package/dist/types/ui-react/with-react-editor-view-outer-listeners.d.ts +9 -0
- package/dist/types/utils/dom.d.ts +26 -0
- package/dist/types/utils/editor-core-utils.d.ts +23 -0
- package/dist/types/utils/getModeFromTheme.d.ts +1 -1
- package/dist/types/utils/index.d.ts +9 -0
- package/dist/types/utils/is-text-input.d.ts +2 -0
- package/dist/types/utils/nodes.d.ts +35 -0
- package/dist/types/utils/plugin-state-factory.d.ts +16 -0
- package/dist/types/utils/slice.d.ts +11 -0
- package/dist/types/with-plugin-state/index.d.ts +86 -0
- package/dist/types/with-plugin-state/types.d.ts +10 -0
- package/error-boundary/package.json +8 -0
- package/event-dispatcher/package.json +8 -0
- package/keymaps/package.json +8 -0
- package/node-width/package.json +8 -0
- package/package.json +27 -5
- package/portal-provider/package.json +8 -0
- package/react-node-view/package.json +8 -0
- package/selection/package.json +8 -0
- package/transforms/package.json +8 -0
- package/ui-color/package.json +8 -0
- package/ui-menu/package.json +8 -0
- package/ui-react/package.json +8 -0
- package/with-plugin-state/package.json +8 -0
|
@@ -0,0 +1,205 @@
|
|
|
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 { DN50, DN600, N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
|
|
21
|
+
import { themed } from '@atlaskit/theme/components';
|
|
22
|
+
import { borderRadius, gridSize } from '@atlaskit/theme/constants';
|
|
23
|
+
import { token } from '@atlaskit/tokens';
|
|
24
|
+
import Layer from '../Layer';
|
|
25
|
+
var packageName = "@atlaskit/editor-common";
|
|
26
|
+
var packageVersion = "69.3.0";
|
|
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:
|
|
145
|
+
/* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
|
|
146
|
+
function getChildContext() {
|
|
147
|
+
return {
|
|
148
|
+
shouldAllowMultilineItems: false
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
}, {
|
|
152
|
+
key: "render",
|
|
153
|
+
value: function render() {
|
|
154
|
+
var _this2 = this;
|
|
155
|
+
|
|
156
|
+
var _this$props = this.props,
|
|
157
|
+
children = _this$props.children,
|
|
158
|
+
isOpen = _this$props.isOpen,
|
|
159
|
+
position = _this$props.position,
|
|
160
|
+
trigger = _this$props.trigger,
|
|
161
|
+
onPositioned = _this$props.onPositioned,
|
|
162
|
+
testId = _this$props.testId;
|
|
163
|
+
var layerContent = isOpen ? jsx("div", {
|
|
164
|
+
css: function css(theme) {
|
|
165
|
+
return _this2.menuWrapper({
|
|
166
|
+
theme: theme
|
|
167
|
+
});
|
|
168
|
+
},
|
|
169
|
+
"data-role": "droplistContent",
|
|
170
|
+
"data-testid": testId && "".concat(testId, "--content"),
|
|
171
|
+
ref: this.handleContentRef
|
|
172
|
+
}, children) : null;
|
|
173
|
+
return jsx("div", {
|
|
174
|
+
css: this.wrapperStyles
|
|
175
|
+
}, jsx(Layer, {
|
|
176
|
+
content: layerContent,
|
|
177
|
+
offset: dropOffset,
|
|
178
|
+
position: position,
|
|
179
|
+
onPositioned: onPositioned
|
|
180
|
+
}, jsx("div", {
|
|
181
|
+
css: this.triggerStyles,
|
|
182
|
+
ref: this.handleTriggerRef
|
|
183
|
+
}, trigger)));
|
|
184
|
+
}
|
|
185
|
+
}]);
|
|
186
|
+
|
|
187
|
+
return DropList;
|
|
188
|
+
}(Component);
|
|
189
|
+
|
|
190
|
+
var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
191
|
+
export default withAnalyticsContext({
|
|
192
|
+
componentName: 'droplist',
|
|
193
|
+
packageName: packageName,
|
|
194
|
+
packageVersion: packageVersion
|
|
195
|
+
})(withAnalyticsEvents({
|
|
196
|
+
onOpenChange: createAndFireEventOnAtlaskit({
|
|
197
|
+
action: 'toggled',
|
|
198
|
+
actionSubject: 'droplist',
|
|
199
|
+
attributes: {
|
|
200
|
+
componentName: 'droplist',
|
|
201
|
+
packageName: packageName,
|
|
202
|
+
packageVersion: packageVersion
|
|
203
|
+
}
|
|
204
|
+
})
|
|
205
|
+
})(DropList));
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
+
|
|
9
|
+
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); }; }
|
|
10
|
+
|
|
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
|
+
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import { ACTION, EVENT_TYPE } from '../../analytics';
|
|
15
|
+
export var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
16
|
+
_inherits(ErrorBoundary, _React$Component);
|
|
17
|
+
|
|
18
|
+
var _super = _createSuper(ErrorBoundary);
|
|
19
|
+
|
|
20
|
+
function ErrorBoundary() {
|
|
21
|
+
var _this;
|
|
22
|
+
|
|
23
|
+
_classCallCheck(this, ErrorBoundary);
|
|
24
|
+
|
|
25
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
26
|
+
args[_key] = arguments[_key];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
30
|
+
|
|
31
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
32
|
+
errorCaptured: false
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
return _this;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
_createClass(ErrorBoundary, [{
|
|
39
|
+
key: "hasFallback",
|
|
40
|
+
value: function hasFallback() {
|
|
41
|
+
return typeof this.props.fallbackComponent !== 'undefined';
|
|
42
|
+
}
|
|
43
|
+
}, {
|
|
44
|
+
key: "shouldRecover",
|
|
45
|
+
value: function shouldRecover() {
|
|
46
|
+
return this.hasFallback() && this.state.errorCaptured;
|
|
47
|
+
}
|
|
48
|
+
}, {
|
|
49
|
+
key: "componentDidCatch",
|
|
50
|
+
value: function componentDidCatch(error, errorInfo) {
|
|
51
|
+
if (this.props.dispatchAnalyticsEvent) {
|
|
52
|
+
this.props.dispatchAnalyticsEvent({
|
|
53
|
+
action: ACTION.EDITOR_CRASHED,
|
|
54
|
+
actionSubject: this.props.component,
|
|
55
|
+
actionSubjectId: this.props.componentId,
|
|
56
|
+
eventType: EVENT_TYPE.OPERATIONAL,
|
|
57
|
+
attributes: {
|
|
58
|
+
error: error,
|
|
59
|
+
errorInfo: errorInfo,
|
|
60
|
+
// @ts-expect-error
|
|
61
|
+
errorRethrown: !this.hasFallback()
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (this.hasFallback()) {
|
|
67
|
+
this.setState({
|
|
68
|
+
errorCaptured: true
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}, {
|
|
73
|
+
key: "render",
|
|
74
|
+
value: function render() {
|
|
75
|
+
if (this.shouldRecover()) {
|
|
76
|
+
return this.props.fallbackComponent;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return this.props.children;
|
|
80
|
+
}
|
|
81
|
+
}]);
|
|
82
|
+
|
|
83
|
+
return ErrorBoundary;
|
|
84
|
+
}(React.Component);
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
+
|
|
9
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
+
|
|
11
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
|
+
|
|
13
|
+
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); }; }
|
|
14
|
+
|
|
15
|
+
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; } }
|
|
16
|
+
|
|
17
|
+
import React, { Component } from 'react';
|
|
18
|
+
import Popper from 'popper.js'; // eslint-disable-line import/extensions
|
|
19
|
+
|
|
20
|
+
import rafSchedule from 'raf-schd';
|
|
21
|
+
import { positionPropToPopperPosition } from './internal/helpers';
|
|
22
|
+
var defaultState = {
|
|
23
|
+
hasExtractedStyles: false,
|
|
24
|
+
// We set these default offsets to prevent a flash of popper content in the wrong position
|
|
25
|
+
// which can cause incorrect height calculations. Popper will calculate these values
|
|
26
|
+
offsets: {
|
|
27
|
+
popper: {
|
|
28
|
+
left: -9999,
|
|
29
|
+
top: -9999,
|
|
30
|
+
position: null
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
// fix Safari parent width: https://product-fabric.atlassian.net/browse/ED-1784
|
|
34
|
+
cssPosition: 'absolute',
|
|
35
|
+
originalHeight: null,
|
|
36
|
+
maxHeight: null
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
var Layer = /*#__PURE__*/function (_Component) {
|
|
40
|
+
_inherits(Layer, _Component);
|
|
41
|
+
|
|
42
|
+
var _super = _createSuper(Layer);
|
|
43
|
+
|
|
44
|
+
// working with extract-react-types
|
|
45
|
+
function Layer(props) {
|
|
46
|
+
var _this;
|
|
47
|
+
|
|
48
|
+
_classCallCheck(this, Layer);
|
|
49
|
+
|
|
50
|
+
_this = _super.call(this, props);
|
|
51
|
+
|
|
52
|
+
_defineProperty(_assertThisInitialized(_this), "targetRef", /*#__PURE__*/React.createRef());
|
|
53
|
+
|
|
54
|
+
_defineProperty(_assertThisInitialized(_this), "contentRef", /*#__PURE__*/React.createRef());
|
|
55
|
+
|
|
56
|
+
_defineProperty(_assertThisInitialized(_this), "extractStyles", function (state) {
|
|
57
|
+
if (state) {
|
|
58
|
+
var popperHeight = state.offsets.popper.height;
|
|
59
|
+
var left = Math.round(state.offsets.popper.left);
|
|
60
|
+
var top = Math.round(state.offsets.popper.top);
|
|
61
|
+
var cssPosition = 'absolute';
|
|
62
|
+
var originalHeight = _this.state.originalHeight || popperHeight;
|
|
63
|
+
|
|
64
|
+
var maxHeight = _this.calculateMaxHeight(originalHeight, popperHeight, top, cssPosition);
|
|
65
|
+
|
|
66
|
+
_this.setState({
|
|
67
|
+
// position: fixed or absolute
|
|
68
|
+
cssPosition: cssPosition,
|
|
69
|
+
hasExtractedStyles: true,
|
|
70
|
+
transform: "translate3d(".concat(left, "px, ").concat(top, "px, 0px)"),
|
|
71
|
+
originalHeight: originalHeight,
|
|
72
|
+
maxHeight: maxHeight
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
_this.state = defaultState;
|
|
78
|
+
_this.extractStyles = rafSchedule(_this.extractStyles.bind(_assertThisInitialized(_this)));
|
|
79
|
+
return _this;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
_createClass(Layer, [{
|
|
83
|
+
key: "componentDidMount",
|
|
84
|
+
value: function componentDidMount() {
|
|
85
|
+
this.applyPopper(this.props);
|
|
86
|
+
}
|
|
87
|
+
}, {
|
|
88
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
89
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
90
|
+
this.applyPopper(nextProps);
|
|
91
|
+
}
|
|
92
|
+
}, {
|
|
93
|
+
key: "componentDidUpdate",
|
|
94
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
95
|
+
var onPositioned = this.props.onPositioned;
|
|
96
|
+
var hasExtractedStyles = this.state.hasExtractedStyles; // This flag is set the first time the position is calculated from Popper and applied to the content
|
|
97
|
+
|
|
98
|
+
if (!prevState.hasExtractedStyles && hasExtractedStyles && onPositioned) {
|
|
99
|
+
onPositioned();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}, {
|
|
103
|
+
key: "componentWillUnmount",
|
|
104
|
+
value: function componentWillUnmount() {
|
|
105
|
+
// this.extractStyles.cancel();
|
|
106
|
+
if (this.popper) {
|
|
107
|
+
this.popper.destroy();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/* Calculate the max height of the popper if it's height is greater than the viewport to prevent
|
|
111
|
+
* the bottom of the popper not being viewable.
|
|
112
|
+
* Only works if the popper uses viewport as the boundary and has a fixed position ancestor.
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
}, {
|
|
116
|
+
key: "calculateMaxHeight",
|
|
117
|
+
value: function calculateMaxHeight(originalHeight, currentHeight, positionTop, cssPosition) {
|
|
118
|
+
var DocumentElementClientHeight = 0;
|
|
119
|
+
|
|
120
|
+
if (document.documentElement) {
|
|
121
|
+
DocumentElementClientHeight = document.documentElement.clientHeight;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (cssPosition !== 'fixed') {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
var viewportHeight = Math.max(DocumentElementClientHeight, window.innerHeight || 0);
|
|
129
|
+
return viewportHeight < originalHeight && currentHeight + positionTop >= viewportHeight - 50 ? // allow some spacing either side of viewport height
|
|
130
|
+
viewportHeight - 12 : null;
|
|
131
|
+
}
|
|
132
|
+
}, {
|
|
133
|
+
key: "applyPopper",
|
|
134
|
+
value: function applyPopper(props) {
|
|
135
|
+
if (!this.targetRef.current || !this.contentRef.current) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (this.popper) {
|
|
140
|
+
this.popper.destroy();
|
|
141
|
+
} // "new Popper(...)" operation is very expensive when called on virtual DOM.
|
|
142
|
+
// This condition reduces the number of calls so we can run our tests faster
|
|
143
|
+
// (time was reduced from 100s to 13s).
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
if (!props.content) {
|
|
147
|
+
return;
|
|
148
|
+
} // we wrap our target in a div so that we can safely get a reference to it, but we pass the
|
|
149
|
+
// actual target to popper
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
var isAlwaysFixed = false;
|
|
153
|
+
var actualTarget = this.targetRef.current.children[0];
|
|
154
|
+
var popperOpts = {
|
|
155
|
+
placement: positionPropToPopperPosition(props.position),
|
|
156
|
+
onCreate: this.extractStyles,
|
|
157
|
+
onUpdate: this.extractStyles,
|
|
158
|
+
modifiers: {
|
|
159
|
+
applyStyle: {
|
|
160
|
+
enabled: false
|
|
161
|
+
},
|
|
162
|
+
hide: {
|
|
163
|
+
enabled: false
|
|
164
|
+
},
|
|
165
|
+
offset: {
|
|
166
|
+
enabled: true,
|
|
167
|
+
offset: this.props.offset
|
|
168
|
+
},
|
|
169
|
+
flip: {
|
|
170
|
+
enabled: false,
|
|
171
|
+
flipVariations: true,
|
|
172
|
+
boundariesElement: 'viewport',
|
|
173
|
+
padding: 0 // leave 0 pixels between popper and the boundariesElement
|
|
174
|
+
|
|
175
|
+
},
|
|
176
|
+
preventOverflow: {
|
|
177
|
+
enabled: false,
|
|
178
|
+
escapeWithReference: true
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
positionFixed: isAlwaysFixed
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
if (actualTarget) {
|
|
185
|
+
this.popper = new Popper(actualTarget, this.contentRef.current, popperOpts);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}, {
|
|
189
|
+
key: "render",
|
|
190
|
+
value: function render() {
|
|
191
|
+
var _this$state = this.state,
|
|
192
|
+
transform = _this$state.transform,
|
|
193
|
+
hasExtractedStyles = _this$state.hasExtractedStyles,
|
|
194
|
+
maxHeight = _this$state.maxHeight;
|
|
195
|
+
var opacity = hasExtractedStyles ? {} : {
|
|
196
|
+
opacity: 0
|
|
197
|
+
};
|
|
198
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
199
|
+
ref: this.targetRef
|
|
200
|
+
}, this.props.children), /*#__PURE__*/React.createElement("div", {
|
|
201
|
+
ref: this.contentRef,
|
|
202
|
+
style: _objectSpread({
|
|
203
|
+
top: 0,
|
|
204
|
+
left: 0,
|
|
205
|
+
position: 'absolute',
|
|
206
|
+
transform: transform,
|
|
207
|
+
maxHeight: maxHeight ? maxHeight : 'auto'
|
|
208
|
+
}, opacity)
|
|
209
|
+
}, this.props.content));
|
|
210
|
+
}
|
|
211
|
+
}]);
|
|
212
|
+
|
|
213
|
+
return Layer;
|
|
214
|
+
}(Component);
|
|
215
|
+
|
|
216
|
+
_defineProperty(Layer, "defaultProps", {
|
|
217
|
+
boundariesElement: 'viewport',
|
|
218
|
+
children: null,
|
|
219
|
+
content: null,
|
|
220
|
+
offset: '0, 0',
|
|
221
|
+
position: 'right middle',
|
|
222
|
+
zIndex: 400,
|
|
223
|
+
lockScroll: false,
|
|
224
|
+
isAlwaysFixed: false,
|
|
225
|
+
onPositioned: function onPositioned() {}
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
export { Layer as default };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
var positionMap = {
|
|
2
|
+
'top left': {
|
|
3
|
+
position: 'top-start',
|
|
4
|
+
animation: 'top'
|
|
5
|
+
},
|
|
6
|
+
'top center': {
|
|
7
|
+
position: 'top',
|
|
8
|
+
animation: 'top'
|
|
9
|
+
},
|
|
10
|
+
'top right': {
|
|
11
|
+
position: 'top-end',
|
|
12
|
+
animation: 'top'
|
|
13
|
+
},
|
|
14
|
+
'right top': {
|
|
15
|
+
position: 'right-start',
|
|
16
|
+
animation: 'right'
|
|
17
|
+
},
|
|
18
|
+
'right middle': {
|
|
19
|
+
position: 'right',
|
|
20
|
+
animation: 'right'
|
|
21
|
+
},
|
|
22
|
+
'right bottom': {
|
|
23
|
+
position: 'right-end',
|
|
24
|
+
animation: 'right'
|
|
25
|
+
},
|
|
26
|
+
'bottom left': {
|
|
27
|
+
position: 'bottom-start',
|
|
28
|
+
animation: 'bottom'
|
|
29
|
+
},
|
|
30
|
+
'bottom center': {
|
|
31
|
+
position: 'bottom',
|
|
32
|
+
animation: 'bottom'
|
|
33
|
+
},
|
|
34
|
+
'bottom right': {
|
|
35
|
+
position: 'bottom-end',
|
|
36
|
+
animation: 'bottom'
|
|
37
|
+
},
|
|
38
|
+
'left top': {
|
|
39
|
+
position: 'left-start',
|
|
40
|
+
animation: 'left'
|
|
41
|
+
},
|
|
42
|
+
'left middle': {
|
|
43
|
+
position: 'left',
|
|
44
|
+
animation: 'left'
|
|
45
|
+
},
|
|
46
|
+
'left bottom': {
|
|
47
|
+
position: 'left-end',
|
|
48
|
+
animation: 'left'
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
export var POSITION_ATTRIBUTE_ENUM = {
|
|
52
|
+
values: ['top left', 'top center', 'top right', 'right top', 'right middle', 'right bottom', 'bottom left', 'bottom center', 'bottom right', 'left top', 'left middle', 'left bottom'],
|
|
53
|
+
default: 'right middle'
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
function positionToPopper(position) {
|
|
57
|
+
return position && positionMap[position] ? positionMap[position].position : null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function positionPropToPopperPosition(position) {
|
|
61
|
+
return positionToPopper(position) || positionMap[POSITION_ATTRIBUTE_ENUM.default].position;
|
|
62
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ThemeProvider } from '@emotion/react';
|
|
4
|
+
import AtlaskitTheme from '@atlaskit/theme/components';
|
|
5
|
+
import { CHANNEL } from '@atlaskit/theme/constants';
|
|
6
|
+
export function PortalProviderThemeProviders(props) {
|
|
7
|
+
var children = props.children,
|
|
8
|
+
mode = props.mode;
|
|
9
|
+
var styledComponentsAndEmotionTheme = React.useMemo( // This return value should only be one of the following
|
|
10
|
+
// - { [CHANNEL]: { mode },
|
|
11
|
+
// - { theme: { [CHANNEL]: { mode } }
|
|
12
|
+
// However, it appears that consumers have inconsistent expectations
|
|
13
|
+
// regarding the shape.
|
|
14
|
+
// This can be revisited in future work, and for the purposes of
|
|
15
|
+
// fixing https://product-fabric.atlassian.net/browse/ED-14956
|
|
16
|
+
// we are merging the two shapes consumers expect.
|
|
17
|
+
function () {
|
|
18
|
+
var _ref;
|
|
19
|
+
|
|
20
|
+
return _ref = {}, _defineProperty(_ref, CHANNEL, {
|
|
21
|
+
mode: mode
|
|
22
|
+
}), _defineProperty(_ref, "theme", _defineProperty({}, CHANNEL, {
|
|
23
|
+
mode: mode
|
|
24
|
+
})), _ref;
|
|
25
|
+
}, [mode]);
|
|
26
|
+
var atlaskitTheme = React.useCallback(function () {
|
|
27
|
+
return {
|
|
28
|
+
mode: mode
|
|
29
|
+
};
|
|
30
|
+
}, [mode]);
|
|
31
|
+
return (
|
|
32
|
+
/*#__PURE__*/
|
|
33
|
+
// TODO: ED-15585
|
|
34
|
+
// import { ThemeProvider as DeprectateStyledComponentsProvider } from 'styled-components';
|
|
35
|
+
// <DeprectateStyledComponentsProvider theme={styledComponentsAndEmotionTheme}>
|
|
36
|
+
// </DeprectateStyledComponentsProvider>
|
|
37
|
+
React.createElement(ThemeProvider, {
|
|
38
|
+
theme: styledComponentsAndEmotionTheme
|
|
39
|
+
}, /*#__PURE__*/React.createElement(AtlaskitTheme.Provider, {
|
|
40
|
+
value: atlaskitTheme
|
|
41
|
+
}, children))
|
|
42
|
+
);
|
|
43
|
+
}
|