@atlaskit/editor-plugin-type-ahead 2.0.4 → 2.1.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.
@@ -1,66 +0,0 @@
1
- import React, { useCallback } from 'react';
2
- import { useIntl } from 'react-intl-next';
3
- import { elementInsertSidePanel } from '@atlaskit/editor-common/messages';
4
- import { typeAheadListMessages } from '@atlaskit/editor-common/type-ahead';
5
- import { SideInsertPanel } from '@atlaskit/editor-element-browser';
6
- import AddIcon from '@atlaskit/icon/core/add';
7
- import { Pressable, xcss } from '@atlaskit/primitives';
8
- const viewAllButtonStyles = xcss({
9
- background: "var(--ds-background-input-pressed, #FFFFFF)",
10
- position: 'sticky',
11
- bottom: '-4px',
12
- width: '100%',
13
- height: '40px',
14
- color: 'color.text.subtle',
15
- fontWeight: "var(--ds-font-weight-medium, 500)",
16
- ':hover': {
17
- textDecoration: 'underline'
18
- },
19
- ':active': {
20
- color: 'color.text'
21
- }
22
- });
23
- const INSERT_PANEL_WIDTH = 320;
24
- export const ViewAllButton = ({
25
- items,
26
- editorApi,
27
- onItemInsert,
28
- onPanelOpen
29
- }) => {
30
- const {
31
- formatMessage
32
- } = useIntl();
33
- const handleClick = useCallback(() => {
34
- var _editorApi$contextPan, _editorApi$contextPan2;
35
- const showContextPanel = editorApi === null || editorApi === void 0 ? void 0 : (_editorApi$contextPan = editorApi.contextPanel) === null || _editorApi$contextPan === void 0 ? void 0 : (_editorApi$contextPan2 = _editorApi$contextPan.actions) === null || _editorApi$contextPan2 === void 0 ? void 0 : _editorApi$contextPan2.showPanel;
36
- if (!showContextPanel || !items) {
37
- return;
38
- }
39
-
40
- // Opens main editor controls side panel
41
- showContextPanel({
42
- id: 'editor-element-insert-sidebar-panel',
43
- headerComponentElements: {
44
- headerLabel: elementInsertSidePanel.title,
45
- HeaderIcon: () => /*#__PURE__*/React.createElement(AddIcon, {
46
- label: formatMessage(elementInsertSidePanel.title)
47
- })
48
- },
49
- BodyComponent: () => {
50
- return /*#__PURE__*/React.createElement(SideInsertPanel, {
51
- items: items,
52
- onItemInsert: onItemInsert
53
- });
54
- }
55
- }, 'push', INSERT_PANEL_WIDTH);
56
-
57
- // Closes typeahead
58
- if (onPanelOpen) {
59
- onPanelOpen();
60
- }
61
- }, [editorApi, formatMessage, items, onItemInsert, onPanelOpen]);
62
- return /*#__PURE__*/React.createElement(Pressable, {
63
- xcss: viewAllButtonStyles,
64
- onClick: handleClick
65
- }, formatMessage(typeAheadListMessages.viewAllInserts));
66
- };
@@ -1,66 +0,0 @@
1
- import React, { useCallback } from 'react';
2
- import { useIntl } from 'react-intl-next';
3
- import { elementInsertSidePanel } from '@atlaskit/editor-common/messages';
4
- import { typeAheadListMessages } from '@atlaskit/editor-common/type-ahead';
5
- import { SideInsertPanel } from '@atlaskit/editor-element-browser';
6
- import AddIcon from '@atlaskit/icon/core/add';
7
- import { Pressable, xcss } from '@atlaskit/primitives';
8
- var viewAllButtonStyles = xcss({
9
- background: "var(--ds-background-input-pressed, #FFFFFF)",
10
- position: 'sticky',
11
- bottom: '-4px',
12
- width: '100%',
13
- height: '40px',
14
- color: 'color.text.subtle',
15
- fontWeight: "var(--ds-font-weight-medium, 500)",
16
- ':hover': {
17
- textDecoration: 'underline'
18
- },
19
- ':active': {
20
- color: 'color.text'
21
- }
22
- });
23
- var INSERT_PANEL_WIDTH = 320;
24
- export var ViewAllButton = function ViewAllButton(_ref) {
25
- var items = _ref.items,
26
- editorApi = _ref.editorApi,
27
- onItemInsert = _ref.onItemInsert,
28
- onPanelOpen = _ref.onPanelOpen;
29
- var _useIntl = useIntl(),
30
- formatMessage = _useIntl.formatMessage;
31
- var handleClick = useCallback(function () {
32
- var _editorApi$contextPan;
33
- var showContextPanel = editorApi === null || editorApi === void 0 || (_editorApi$contextPan = editorApi.contextPanel) === null || _editorApi$contextPan === void 0 || (_editorApi$contextPan = _editorApi$contextPan.actions) === null || _editorApi$contextPan === void 0 ? void 0 : _editorApi$contextPan.showPanel;
34
- if (!showContextPanel || !items) {
35
- return;
36
- }
37
-
38
- // Opens main editor controls side panel
39
- showContextPanel({
40
- id: 'editor-element-insert-sidebar-panel',
41
- headerComponentElements: {
42
- headerLabel: elementInsertSidePanel.title,
43
- HeaderIcon: function HeaderIcon() {
44
- return /*#__PURE__*/React.createElement(AddIcon, {
45
- label: formatMessage(elementInsertSidePanel.title)
46
- });
47
- }
48
- },
49
- BodyComponent: function BodyComponent() {
50
- return /*#__PURE__*/React.createElement(SideInsertPanel, {
51
- items: items,
52
- onItemInsert: onItemInsert
53
- });
54
- }
55
- }, 'push', INSERT_PANEL_WIDTH);
56
-
57
- // Closes typeahead
58
- if (onPanelOpen) {
59
- onPanelOpen();
60
- }
61
- }, [editorApi, formatMessage, items, onItemInsert, onPanelOpen]);
62
- return /*#__PURE__*/React.createElement(Pressable, {
63
- xcss: viewAllButtonStyles,
64
- onClick: handleClick
65
- }, formatMessage(typeAheadListMessages.viewAllInserts));
66
- };
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
3
- import type { PublicPluginAPI } from '@atlaskit/editor-common/types';
4
- import type { SideInsertPanelItem } from '@atlaskit/editor-element-browser';
5
- import type { ContextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
6
- type ViewAllButtonProps = {
7
- items: SideInsertPanelItem[];
8
- onItemInsert: (mode: SelectItemMode, index: number) => void;
9
- onPanelOpen?: () => void;
10
- editorApi?: PublicPluginAPI<ContextPanelPlugin>;
11
- };
12
- export declare const ViewAllButton: ({ items, editorApi, onItemInsert, onPanelOpen, }: ViewAllButtonProps) => React.JSX.Element;
13
- export {};
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
3
- import type { PublicPluginAPI } from '@atlaskit/editor-common/types';
4
- import type { SideInsertPanelItem } from '@atlaskit/editor-element-browser';
5
- import type { ContextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
6
- type ViewAllButtonProps = {
7
- items: SideInsertPanelItem[];
8
- onItemInsert: (mode: SelectItemMode, index: number) => void;
9
- onPanelOpen?: () => void;
10
- editorApi?: PublicPluginAPI<ContextPanelPlugin>;
11
- };
12
- export declare const ViewAllButton: ({ items, editorApi, onItemInsert, onPanelOpen, }: ViewAllButtonProps) => React.JSX.Element;
13
- export {};