@atlaskit/editor-plugin-insert-block 3.2.0 → 3.2.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 +10 -0
- package/dist/cjs/ui/ElementBrowser/InsertMenu.js +2 -1
- package/dist/cjs/ui/ToolbarInsertBlock/index.js +5 -4
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +2 -1
- package/dist/es2019/ui/ToolbarInsertBlock/index.js +3 -2
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +2 -1
- package/dist/esm/ui/ToolbarInsertBlock/index.js +3 -2
- package/package.json +16 -13
- package/dist/cjs/ui/ToolbarInsertBlock/table-selector-popup-with-listeners.js +0 -258
- package/dist/cjs/ui/ToolbarInsertBlock/table-selector-popup.js +0 -158
- package/dist/es2019/ui/ToolbarInsertBlock/table-selector-popup-with-listeners.js +0 -250
- package/dist/es2019/ui/ToolbarInsertBlock/table-selector-popup.js +0 -150
- package/dist/esm/ui/ToolbarInsertBlock/table-selector-popup-with-listeners.js +0 -252
- package/dist/esm/ui/ToolbarInsertBlock/table-selector-popup.js +0 -150
- package/dist/types/ui/ToolbarInsertBlock/table-selector-popup-with-listeners.d.ts +0 -20
- package/dist/types/ui/ToolbarInsertBlock/table-selector-popup.d.ts +0 -31
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/table-selector-popup-with-listeners.d.ts +0 -20
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/table-selector-popup.d.ts +0 -31
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import { useContext, useEffect, useMemo, useRef } from 'react';
|
|
6
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
|
-
import { css, jsx } from '@emotion/react';
|
|
8
|
-
import { injectIntl } from 'react-intl-next';
|
|
9
|
-
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
10
|
-
import { OutsideClickTargetRefContext } from '@atlaskit/editor-common/ui-react';
|
|
11
|
-
import { Stack } from '@atlaskit/primitives';
|
|
12
|
-
import { B100 } from '@atlaskit/theme/colors';
|
|
13
|
-
export var TABLE_SELECTOR_BUTTON_GAP = 2;
|
|
14
|
-
export var TABLE_SELECTOR_BUTTON_SIZE = 17;
|
|
15
|
-
var selectedButtonStyles = css({
|
|
16
|
-
backgroundColor: "var(--ds-background-accent-blue-subtlest, #579DFF)",
|
|
17
|
-
border: "1px solid ".concat("var(--ds-background-accent-blue-subtle, #579DFF)")
|
|
18
|
-
});
|
|
19
|
-
var buttonStyles = css({
|
|
20
|
-
height: "".concat(TABLE_SELECTOR_BUTTON_SIZE, "px"),
|
|
21
|
-
width: "".concat(TABLE_SELECTOR_BUTTON_SIZE, "px"),
|
|
22
|
-
border: "1px solid ".concat("var(--ds-border, #091e4224)"),
|
|
23
|
-
backgroundColor: "var(--ds-background-input, #ffffff)",
|
|
24
|
-
borderRadius: '3px',
|
|
25
|
-
cursor: 'pointer',
|
|
26
|
-
display: 'block',
|
|
27
|
-
'&:focus': {
|
|
28
|
-
outline: 'none',
|
|
29
|
-
border: "1px solid ".concat("var(--ds-border-focused, ".concat(B100, ")")),
|
|
30
|
-
boxShadow: "0 0 0 0.5px ".concat("var(--ds-border-focused, ".concat(B100, ")"))
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
var selectionSizeTextStyles = css({
|
|
34
|
-
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
35
|
-
lineHeight: '14px',
|
|
36
|
-
display: 'flex',
|
|
37
|
-
justifyContent: 'center',
|
|
38
|
-
marginTop: "var(--ds-space-075, 5px)",
|
|
39
|
-
padding: "var(--ds-space-075, 10px)"
|
|
40
|
-
});
|
|
41
|
-
var TableSelectorButton = function TableSelectorButton(_ref) {
|
|
42
|
-
var row = _ref.row,
|
|
43
|
-
col = _ref.col,
|
|
44
|
-
isActive = _ref.isActive,
|
|
45
|
-
_onClick = _ref.onClick,
|
|
46
|
-
label = _ref.label,
|
|
47
|
-
onKeyDown = _ref.onKeyDown,
|
|
48
|
-
isFocused = _ref.isFocused,
|
|
49
|
-
handleInitialButtonFocus = _ref.handleInitialButtonFocus;
|
|
50
|
-
var btnRef = useRef(null);
|
|
51
|
-
useEffect(function () {
|
|
52
|
-
if (btnRef.current) {
|
|
53
|
-
if (isFocused) {
|
|
54
|
-
btnRef.current.focus();
|
|
55
|
-
} else {
|
|
56
|
-
btnRef.current.blur();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}, [isFocused, btnRef]);
|
|
60
|
-
var handleFocus = col === 1 && row === 1 ? function () {
|
|
61
|
-
return handleInitialButtonFocus();
|
|
62
|
-
} : undefined;
|
|
63
|
-
return jsx("button", {
|
|
64
|
-
type: "button",
|
|
65
|
-
css: [buttonStyles, isActive ? selectedButtonStyles : undefined],
|
|
66
|
-
onClick: function onClick() {
|
|
67
|
-
return _onClick(row, col);
|
|
68
|
-
},
|
|
69
|
-
"aria-label": label,
|
|
70
|
-
onKeyDown: onKeyDown,
|
|
71
|
-
ref: btnRef,
|
|
72
|
-
onFocus: handleFocus
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
var createArray = function createArray(maxCols, maxRows) {
|
|
76
|
-
var arr = [];
|
|
77
|
-
for (var i = 1; i < maxRows + 1; i++) {
|
|
78
|
-
for (var j = 1; j < maxCols + 1; j++) {
|
|
79
|
-
arr.push({
|
|
80
|
-
col: j,
|
|
81
|
-
row: i
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return arr;
|
|
86
|
-
};
|
|
87
|
-
var gridWrapperStyles = function gridWrapperStyles(_ref2) {
|
|
88
|
-
var maxCols = _ref2.maxCols,
|
|
89
|
-
maxRows = _ref2.maxRows;
|
|
90
|
-
return css({
|
|
91
|
-
display: 'grid',
|
|
92
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
93
|
-
gridTemplateColumns: "repeat(".concat(maxCols, ", 1fr)"),
|
|
94
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
95
|
-
gridTemplateRows: "repeat(".concat(maxRows, ", 1fr)"),
|
|
96
|
-
gap: "".concat("var(--ds-space-025, ".concat("".concat(TABLE_SELECTOR_BUTTON_GAP, "px"), ")"))
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
var TableSelectorPopup = function TableSelectorPopup(_ref3) {
|
|
100
|
-
var maxCols = _ref3.maxCols,
|
|
101
|
-
maxRows = _ref3.maxRows,
|
|
102
|
-
onSelection = _ref3.onSelection,
|
|
103
|
-
selectedCol = _ref3.selectedCol,
|
|
104
|
-
selectedRow = _ref3.selectedRow,
|
|
105
|
-
onKeyDown = _ref3.onKeyDown,
|
|
106
|
-
isFocused = _ref3.isFocused,
|
|
107
|
-
handleInitialButtonFocus = _ref3.handleInitialButtonFocus,
|
|
108
|
-
formatMessage = _ref3.intl.formatMessage;
|
|
109
|
-
var buttons = useMemo(function () {
|
|
110
|
-
return createArray(maxCols, maxRows);
|
|
111
|
-
}, [maxCols, maxRows]);
|
|
112
|
-
var setOutsideClickTargetRef = useContext(OutsideClickTargetRefContext);
|
|
113
|
-
return jsx(Stack, {
|
|
114
|
-
ref: setOutsideClickTargetRef
|
|
115
|
-
}, jsx("div", {
|
|
116
|
-
"aria-label": "".concat(formatMessage(messages.tableSizeSelectorPopup)),
|
|
117
|
-
css:
|
|
118
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
119
|
-
gridWrapperStyles({
|
|
120
|
-
maxCols: maxCols,
|
|
121
|
-
maxRows: maxRows
|
|
122
|
-
})
|
|
123
|
-
}, buttons.map(function (_ref4, index) {
|
|
124
|
-
var col = _ref4.col,
|
|
125
|
-
row = _ref4.row;
|
|
126
|
-
var isCurrentFocused = isFocused && selectedCol === col && selectedRow === row;
|
|
127
|
-
var isActive = selectedCol >= col && selectedRow >= row ? true : false;
|
|
128
|
-
return jsx(TableSelectorButton
|
|
129
|
-
// Ignored via go/ees005
|
|
130
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
131
|
-
, {
|
|
132
|
-
key: index,
|
|
133
|
-
isActive: isActive,
|
|
134
|
-
col: col,
|
|
135
|
-
row: row,
|
|
136
|
-
onClick: onSelection,
|
|
137
|
-
label: "".concat(formatMessage(messages.tableSizeSelectorButton, {
|
|
138
|
-
numberOfColumns: col,
|
|
139
|
-
numberOfRows: row
|
|
140
|
-
})),
|
|
141
|
-
onKeyDown: onKeyDown,
|
|
142
|
-
isFocused: isCurrentFocused,
|
|
143
|
-
handleInitialButtonFocus: handleInitialButtonFocus
|
|
144
|
-
});
|
|
145
|
-
})), jsx("span", {
|
|
146
|
-
css: selectionSizeTextStyles,
|
|
147
|
-
"aria-hidden": true
|
|
148
|
-
}, "".concat(selectedCol, " x ").concat(selectedRow)));
|
|
149
|
-
};
|
|
150
|
-
export default injectIntl(TableSelectorPopup);
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import { jsx } from '@emotion/react';
|
|
6
|
-
import type { OnTableSizeSelection } from './table-selector-popup';
|
|
7
|
-
type SimpleEventHandler<T> = (event: T) => void;
|
|
8
|
-
export interface TableSelectorPopupProps {
|
|
9
|
-
onUnmount?: () => void;
|
|
10
|
-
onSelection: OnTableSizeSelection;
|
|
11
|
-
target?: HTMLElement;
|
|
12
|
-
popupsMountPoint?: HTMLElement;
|
|
13
|
-
popupsBoundariesElement?: HTMLElement;
|
|
14
|
-
popupsScrollableElement?: HTMLElement;
|
|
15
|
-
handleClickOutside?: SimpleEventHandler<MouseEvent>;
|
|
16
|
-
handleEscapeKeydown?: SimpleEventHandler<KeyboardEvent>;
|
|
17
|
-
isOpenedByKeyboard: boolean;
|
|
18
|
-
}
|
|
19
|
-
export declare const TableSelectorPopup: (props: TableSelectorPopupProps) => jsx.JSX.Element;
|
|
20
|
-
export default TableSelectorPopup;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { KeyboardEventHandler, SyntheticEvent } from 'react';
|
|
2
|
-
import type { WrappedComponentProps } from 'react-intl-next';
|
|
3
|
-
export declare const TABLE_SELECTOR_BUTTON_GAP = 2;
|
|
4
|
-
export declare const TABLE_SELECTOR_BUTTON_SIZE = 17;
|
|
5
|
-
export interface TableSelectorButtonProps {
|
|
6
|
-
row: number;
|
|
7
|
-
col: number;
|
|
8
|
-
isActive: boolean;
|
|
9
|
-
onClick: OnTableSizeSelection;
|
|
10
|
-
label: string;
|
|
11
|
-
onKeyDown: KeyboardEventHandler<HTMLButtonElement>;
|
|
12
|
-
isFocused: boolean;
|
|
13
|
-
handleInitialButtonFocus: () => void;
|
|
14
|
-
}
|
|
15
|
-
export interface OnTableSizeSelection {
|
|
16
|
-
(rowsCount: number, colsCount: number, event?: SyntheticEvent): void;
|
|
17
|
-
}
|
|
18
|
-
interface TableSelectorPopupProps {
|
|
19
|
-
maxCols: number;
|
|
20
|
-
maxRows: number;
|
|
21
|
-
onSelection: OnTableSizeSelection;
|
|
22
|
-
selectedCol: number;
|
|
23
|
-
selectedRow: number;
|
|
24
|
-
onKeyDown: KeyboardEventHandler<HTMLButtonElement>;
|
|
25
|
-
isFocused: boolean;
|
|
26
|
-
handleInitialButtonFocus: () => void;
|
|
27
|
-
}
|
|
28
|
-
declare const _default: import("react").FC<import("react-intl-next").WithIntlProps<TableSelectorPopupProps & WrappedComponentProps>> & {
|
|
29
|
-
WrappedComponent: import("react").ComponentType<TableSelectorPopupProps & WrappedComponentProps>;
|
|
30
|
-
};
|
|
31
|
-
export default _default;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import { jsx } from '@emotion/react';
|
|
6
|
-
import type { OnTableSizeSelection } from './table-selector-popup';
|
|
7
|
-
type SimpleEventHandler<T> = (event: T) => void;
|
|
8
|
-
export interface TableSelectorPopupProps {
|
|
9
|
-
onUnmount?: () => void;
|
|
10
|
-
onSelection: OnTableSizeSelection;
|
|
11
|
-
target?: HTMLElement;
|
|
12
|
-
popupsMountPoint?: HTMLElement;
|
|
13
|
-
popupsBoundariesElement?: HTMLElement;
|
|
14
|
-
popupsScrollableElement?: HTMLElement;
|
|
15
|
-
handleClickOutside?: SimpleEventHandler<MouseEvent>;
|
|
16
|
-
handleEscapeKeydown?: SimpleEventHandler<KeyboardEvent>;
|
|
17
|
-
isOpenedByKeyboard: boolean;
|
|
18
|
-
}
|
|
19
|
-
export declare const TableSelectorPopup: (props: TableSelectorPopupProps) => jsx.JSX.Element;
|
|
20
|
-
export default TableSelectorPopup;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { KeyboardEventHandler, SyntheticEvent } from 'react';
|
|
2
|
-
import type { WrappedComponentProps } from 'react-intl-next';
|
|
3
|
-
export declare const TABLE_SELECTOR_BUTTON_GAP = 2;
|
|
4
|
-
export declare const TABLE_SELECTOR_BUTTON_SIZE = 17;
|
|
5
|
-
export interface TableSelectorButtonProps {
|
|
6
|
-
row: number;
|
|
7
|
-
col: number;
|
|
8
|
-
isActive: boolean;
|
|
9
|
-
onClick: OnTableSizeSelection;
|
|
10
|
-
label: string;
|
|
11
|
-
onKeyDown: KeyboardEventHandler<HTMLButtonElement>;
|
|
12
|
-
isFocused: boolean;
|
|
13
|
-
handleInitialButtonFocus: () => void;
|
|
14
|
-
}
|
|
15
|
-
export interface OnTableSizeSelection {
|
|
16
|
-
(rowsCount: number, colsCount: number, event?: SyntheticEvent): void;
|
|
17
|
-
}
|
|
18
|
-
interface TableSelectorPopupProps {
|
|
19
|
-
maxCols: number;
|
|
20
|
-
maxRows: number;
|
|
21
|
-
onSelection: OnTableSizeSelection;
|
|
22
|
-
selectedCol: number;
|
|
23
|
-
selectedRow: number;
|
|
24
|
-
onKeyDown: KeyboardEventHandler<HTMLButtonElement>;
|
|
25
|
-
isFocused: boolean;
|
|
26
|
-
handleInitialButtonFocus: () => void;
|
|
27
|
-
}
|
|
28
|
-
declare const _default: import("react").FC<import("react-intl-next").WithIntlProps<TableSelectorPopupProps & WrappedComponentProps>> & {
|
|
29
|
-
WrappedComponent: import("react").ComponentType<TableSelectorPopupProps & WrappedComponentProps>;
|
|
30
|
-
};
|
|
31
|
-
export default _default;
|