@atlaskit/editor-toolbar 0.13.0 → 0.14.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 +14 -0
- package/dist/cjs/ui/ToolbarDropdownMenuContext.js +16 -6
- package/dist/cjs/ui/ToolbarNestedDropdownMenu.js +4 -1
- package/dist/cjs/ui/ToolbarSection.js +0 -1
- package/dist/es2019/ui/ToolbarDropdownMenuContext.js +17 -5
- package/dist/es2019/ui/ToolbarNestedDropdownMenu.js +3 -1
- package/dist/es2019/ui/ToolbarSection.js +0 -1
- package/dist/esm/ui/ToolbarDropdownMenuContext.js +16 -6
- package/dist/esm/ui/ToolbarNestedDropdownMenu.js +4 -1
- package/dist/esm/ui/ToolbarSection.js +0 -1
- package/dist/types/ui/Toolbar.d.ts +3 -3
- package/dist/types/ui/ToolbarDropdownMenuContext.d.ts +3 -1
- package/dist/types/ui/ToolbarNestedDropdownMenu.d.ts +2 -1
- package/dist/types-ts4.5/ui/Toolbar.d.ts +3 -3
- package/dist/types-ts4.5/ui/ToolbarDropdownMenuContext.d.ts +3 -1
- package/dist/types-ts4.5/ui/ToolbarNestedDropdownMenu.d.ts +2 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-toolbar
|
|
2
2
|
|
|
3
|
+
## 0.14.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`d5cf7cd71a821`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d5cf7cd71a821) -
|
|
8
|
+
ED-29124: Fixed format neste menu on top of top toolbar
|
|
9
|
+
|
|
10
|
+
## 0.14.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- [`872bd8d576773`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/872bd8d576773) -
|
|
15
|
+
[ux] ED-29272 Add missing tooltip and shortcut for TextColorDropdownMenu
|
|
16
|
+
|
|
3
17
|
## 0.13.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -14,21 +14,31 @@ var useToolbarDropdownMenu = exports.useToolbarDropdownMenu = function useToolba
|
|
|
14
14
|
return (0, _react.useContext)(ToolbarDropdownMenuContext);
|
|
15
15
|
};
|
|
16
16
|
var ToolbarDropdownMenuProvider = exports.ToolbarDropdownMenuProvider = function ToolbarDropdownMenuProvider(_ref) {
|
|
17
|
-
var children = _ref.children
|
|
17
|
+
var children = _ref.children,
|
|
18
|
+
isOpen = _ref.isOpen,
|
|
19
|
+
setIsOpen = _ref.setIsOpen;
|
|
18
20
|
var _useState = (0, _react.useState)(false),
|
|
19
21
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
isOpenInternal = _useState2[0],
|
|
23
|
+
setIsOpenInternal = _useState2[1];
|
|
22
24
|
var openMenu = function openMenu() {
|
|
23
|
-
|
|
25
|
+
if (setIsOpen !== undefined) {
|
|
26
|
+
setIsOpen(true);
|
|
27
|
+
} else {
|
|
28
|
+
setIsOpenInternal(true);
|
|
29
|
+
}
|
|
24
30
|
};
|
|
25
31
|
var closeMenu = function closeMenu() {
|
|
26
|
-
setIsOpen
|
|
32
|
+
if (setIsOpen !== undefined) {
|
|
33
|
+
setIsOpen(false);
|
|
34
|
+
} else {
|
|
35
|
+
setIsOpenInternal(false);
|
|
36
|
+
}
|
|
27
37
|
};
|
|
28
38
|
var contextValue = {
|
|
29
39
|
openMenu: openMenu,
|
|
30
40
|
closeMenu: closeMenu,
|
|
31
|
-
isOpen: isOpen
|
|
41
|
+
isOpen: isOpen !== undefined ? isOpen : isOpenInternal
|
|
32
42
|
};
|
|
33
43
|
return /*#__PURE__*/_react.default.createElement(ToolbarDropdownMenuContext.Provider, {
|
|
34
44
|
value: contextValue
|
|
@@ -29,8 +29,11 @@ var ToolbarNestedDropdownMenu = exports.ToolbarNestedDropdownMenu = function Too
|
|
|
29
29
|
dropdownTestId = _ref.dropdownTestId,
|
|
30
30
|
_ref$enableMaxHeight = _ref.enableMaxHeight,
|
|
31
31
|
enableMaxHeight = _ref$enableMaxHeight === void 0 ? false : _ref$enableMaxHeight,
|
|
32
|
-
_onClick = _ref.onClick
|
|
32
|
+
_onClick = _ref.onClick,
|
|
33
|
+
_ref$shouldFitContain = _ref.shouldFitContainer,
|
|
34
|
+
shouldFitContainer = _ref$shouldFitContain === void 0 ? false : _ref$shouldFitContain;
|
|
33
35
|
return /*#__PURE__*/React.createElement(_dropdownMenu.default, {
|
|
36
|
+
shouldFitContainer: shouldFitContainer,
|
|
34
37
|
placement: "right-start",
|
|
35
38
|
testId: dropdownTestId,
|
|
36
39
|
trigger: function trigger(triggerProps) {
|
|
@@ -4,17 +4,29 @@ export const useToolbarDropdownMenu = () => {
|
|
|
4
4
|
return useContext(ToolbarDropdownMenuContext);
|
|
5
5
|
};
|
|
6
6
|
export const ToolbarDropdownMenuProvider = ({
|
|
7
|
-
children
|
|
7
|
+
children,
|
|
8
|
+
isOpen,
|
|
9
|
+
setIsOpen
|
|
8
10
|
}) => {
|
|
9
|
-
const [
|
|
10
|
-
const openMenu = () =>
|
|
11
|
+
const [isOpenInternal, setIsOpenInternal] = useState(false);
|
|
12
|
+
const openMenu = () => {
|
|
13
|
+
if (setIsOpen !== undefined) {
|
|
14
|
+
setIsOpen(true);
|
|
15
|
+
} else {
|
|
16
|
+
setIsOpenInternal(true);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
11
19
|
const closeMenu = () => {
|
|
12
|
-
setIsOpen
|
|
20
|
+
if (setIsOpen !== undefined) {
|
|
21
|
+
setIsOpen(false);
|
|
22
|
+
} else {
|
|
23
|
+
setIsOpenInternal(false);
|
|
24
|
+
}
|
|
13
25
|
};
|
|
14
26
|
const contextValue = {
|
|
15
27
|
openMenu,
|
|
16
28
|
closeMenu,
|
|
17
|
-
isOpen
|
|
29
|
+
isOpen: isOpen !== undefined ? isOpen : isOpenInternal
|
|
18
30
|
};
|
|
19
31
|
return /*#__PURE__*/React.createElement(ToolbarDropdownMenuContext.Provider, {
|
|
20
32
|
value: contextValue
|
|
@@ -19,9 +19,11 @@ export const ToolbarNestedDropdownMenu = ({
|
|
|
19
19
|
testId,
|
|
20
20
|
dropdownTestId,
|
|
21
21
|
enableMaxHeight = false,
|
|
22
|
-
onClick
|
|
22
|
+
onClick,
|
|
23
|
+
shouldFitContainer = false
|
|
23
24
|
}) => {
|
|
24
25
|
return /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
26
|
+
shouldFitContainer: shouldFitContainer,
|
|
25
27
|
placement: "right-start",
|
|
26
28
|
testId: dropdownTestId,
|
|
27
29
|
trigger: triggerProps => /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -5,21 +5,31 @@ export var useToolbarDropdownMenu = function useToolbarDropdownMenu() {
|
|
|
5
5
|
return useContext(ToolbarDropdownMenuContext);
|
|
6
6
|
};
|
|
7
7
|
export var ToolbarDropdownMenuProvider = function ToolbarDropdownMenuProvider(_ref) {
|
|
8
|
-
var children = _ref.children
|
|
8
|
+
var children = _ref.children,
|
|
9
|
+
isOpen = _ref.isOpen,
|
|
10
|
+
setIsOpen = _ref.setIsOpen;
|
|
9
11
|
var _useState = useState(false),
|
|
10
12
|
_useState2 = _slicedToArray(_useState, 2),
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
isOpenInternal = _useState2[0],
|
|
14
|
+
setIsOpenInternal = _useState2[1];
|
|
13
15
|
var openMenu = function openMenu() {
|
|
14
|
-
|
|
16
|
+
if (setIsOpen !== undefined) {
|
|
17
|
+
setIsOpen(true);
|
|
18
|
+
} else {
|
|
19
|
+
setIsOpenInternal(true);
|
|
20
|
+
}
|
|
15
21
|
};
|
|
16
22
|
var closeMenu = function closeMenu() {
|
|
17
|
-
setIsOpen
|
|
23
|
+
if (setIsOpen !== undefined) {
|
|
24
|
+
setIsOpen(false);
|
|
25
|
+
} else {
|
|
26
|
+
setIsOpenInternal(false);
|
|
27
|
+
}
|
|
18
28
|
};
|
|
19
29
|
var contextValue = {
|
|
20
30
|
openMenu: openMenu,
|
|
21
31
|
closeMenu: closeMenu,
|
|
22
|
-
isOpen: isOpen
|
|
32
|
+
isOpen: isOpen !== undefined ? isOpen : isOpenInternal
|
|
23
33
|
};
|
|
24
34
|
return /*#__PURE__*/React.createElement(ToolbarDropdownMenuContext.Provider, {
|
|
25
35
|
value: contextValue
|
|
@@ -20,8 +20,11 @@ export var ToolbarNestedDropdownMenu = function ToolbarNestedDropdownMenu(_ref)
|
|
|
20
20
|
dropdownTestId = _ref.dropdownTestId,
|
|
21
21
|
_ref$enableMaxHeight = _ref.enableMaxHeight,
|
|
22
22
|
enableMaxHeight = _ref$enableMaxHeight === void 0 ? false : _ref$enableMaxHeight,
|
|
23
|
-
_onClick = _ref.onClick
|
|
23
|
+
_onClick = _ref.onClick,
|
|
24
|
+
_ref$shouldFitContain = _ref.shouldFitContainer,
|
|
25
|
+
shouldFitContainer = _ref$shouldFitContain === void 0 ? false : _ref$shouldFitContain;
|
|
24
26
|
return /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
27
|
+
shouldFitContainer: shouldFitContainer,
|
|
25
28
|
placement: "right-start",
|
|
26
29
|
testId: dropdownTestId,
|
|
27
30
|
trigger: function trigger(triggerProps) {
|
|
@@ -5,9 +5,9 @@ type ToolbarProps = {
|
|
|
5
5
|
children?: ReactNode;
|
|
6
6
|
/**
|
|
7
7
|
* aria-label for the toolbar (No localisation needed as it won't be read by screen readers).
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
*
|
|
9
|
+
* use case: query select the toolbar to position floating toolbar
|
|
10
|
+
*/
|
|
11
11
|
label: string;
|
|
12
12
|
testId?: string;
|
|
13
13
|
} & ViewEventEmitterProps;
|
|
@@ -7,6 +7,8 @@ interface ToolbarDropdownMenuContextValue {
|
|
|
7
7
|
export declare const useToolbarDropdownMenu: () => ToolbarDropdownMenuContextValue | undefined;
|
|
8
8
|
interface ToolbarDropdownMenuProviderProps {
|
|
9
9
|
children: React.ReactNode;
|
|
10
|
+
isOpen?: boolean;
|
|
11
|
+
setIsOpen?: (isOpen: boolean) => void;
|
|
10
12
|
}
|
|
11
|
-
export declare const ToolbarDropdownMenuProvider: ({ children }: ToolbarDropdownMenuProviderProps) => React.JSX.Element;
|
|
13
|
+
export declare const ToolbarDropdownMenuProvider: ({ children, isOpen, setIsOpen, }: ToolbarDropdownMenuProviderProps) => React.JSX.Element;
|
|
12
14
|
export {};
|
|
@@ -14,8 +14,9 @@ type ToolbarNestedDropdownMenuProps = {
|
|
|
14
14
|
enableMaxHeight?: boolean;
|
|
15
15
|
isDisabled?: boolean;
|
|
16
16
|
onClick?: (e: React.MouseEvent | React.KeyboardEvent) => void;
|
|
17
|
+
shouldFitContainer?: boolean;
|
|
17
18
|
testId?: string;
|
|
18
19
|
text?: string;
|
|
19
20
|
};
|
|
20
|
-
export declare const ToolbarNestedDropdownMenu: ({ elemBefore, text, elemAfter, children, isDisabled, testId, dropdownTestId, enableMaxHeight, onClick, }: ToolbarNestedDropdownMenuProps) => JSX.Element;
|
|
21
|
+
export declare const ToolbarNestedDropdownMenu: ({ elemBefore, text, elemAfter, children, isDisabled, testId, dropdownTestId, enableMaxHeight, onClick, shouldFitContainer, }: ToolbarNestedDropdownMenuProps) => JSX.Element;
|
|
21
22
|
export {};
|
|
@@ -5,9 +5,9 @@ type ToolbarProps = {
|
|
|
5
5
|
children?: ReactNode;
|
|
6
6
|
/**
|
|
7
7
|
* aria-label for the toolbar (No localisation needed as it won't be read by screen readers).
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
*
|
|
9
|
+
* use case: query select the toolbar to position floating toolbar
|
|
10
|
+
*/
|
|
11
11
|
label: string;
|
|
12
12
|
testId?: string;
|
|
13
13
|
} & ViewEventEmitterProps;
|
|
@@ -7,6 +7,8 @@ interface ToolbarDropdownMenuContextValue {
|
|
|
7
7
|
export declare const useToolbarDropdownMenu: () => ToolbarDropdownMenuContextValue | undefined;
|
|
8
8
|
interface ToolbarDropdownMenuProviderProps {
|
|
9
9
|
children: React.ReactNode;
|
|
10
|
+
isOpen?: boolean;
|
|
11
|
+
setIsOpen?: (isOpen: boolean) => void;
|
|
10
12
|
}
|
|
11
|
-
export declare const ToolbarDropdownMenuProvider: ({ children }: ToolbarDropdownMenuProviderProps) => React.JSX.Element;
|
|
13
|
+
export declare const ToolbarDropdownMenuProvider: ({ children, isOpen, setIsOpen, }: ToolbarDropdownMenuProviderProps) => React.JSX.Element;
|
|
12
14
|
export {};
|
|
@@ -14,8 +14,9 @@ type ToolbarNestedDropdownMenuProps = {
|
|
|
14
14
|
enableMaxHeight?: boolean;
|
|
15
15
|
isDisabled?: boolean;
|
|
16
16
|
onClick?: (e: React.MouseEvent | React.KeyboardEvent) => void;
|
|
17
|
+
shouldFitContainer?: boolean;
|
|
17
18
|
testId?: string;
|
|
18
19
|
text?: string;
|
|
19
20
|
};
|
|
20
|
-
export declare const ToolbarNestedDropdownMenu: ({ elemBefore, text, elemAfter, children, isDisabled, testId, dropdownTestId, enableMaxHeight, onClick, }: ToolbarNestedDropdownMenuProps) => JSX.Element;
|
|
21
|
+
export declare const ToolbarNestedDropdownMenu: ({ elemBefore, text, elemAfter, children, isDisabled, testId, dropdownTestId, enableMaxHeight, onClick, shouldFitContainer, }: ToolbarNestedDropdownMenuProps) => JSX.Element;
|
|
21
22
|
export {};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"registry": "https://registry.npmjs.org/"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.14.1",
|
|
7
7
|
"description": "Common UI for Toolbars across the platform",
|
|
8
8
|
"atlassian": {
|
|
9
9
|
"team": "Editor: Jenga",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@atlaskit/dropdown-menu": "^16.3.0",
|
|
28
28
|
"@atlaskit/icon": "^28.4.0",
|
|
29
29
|
"@atlaskit/icon-lab": "^5.9.0",
|
|
30
|
-
"@atlaskit/logo": "^19.
|
|
30
|
+
"@atlaskit/logo": "^19.9.0",
|
|
31
31
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
32
32
|
"@atlaskit/platform-feature-flags-react": "^0.3.0",
|
|
33
33
|
"@atlaskit/popup": "^4.4.0",
|