@atlaskit/editor-toolbar 0.5.1 → 0.6.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 +20 -0
- package/dist/cjs/index.js +20 -0
- package/dist/cjs/ui/ResponsiveContainer.compiled.css +12 -0
- package/dist/cjs/ui/ResponsiveContainer.js +71 -0
- package/dist/cjs/ui/Show.js +43 -0
- package/dist/cjs/ui/Toolbar.compiled.css +2 -0
- package/dist/cjs/ui/Toolbar.js +18 -4
- package/dist/cjs/ui/ToolbarButton.js +2 -1
- package/dist/cjs/ui/ToolbarButtonGroup.js +2 -1
- package/dist/cjs/ui/ToolbarDropdownItem.js +8 -1
- package/dist/cjs/ui/ToolbarDropdownMenu.compiled.css +3 -1
- package/dist/cjs/ui/ToolbarDropdownMenu.js +34 -21
- package/dist/cjs/ui/ToolbarDropdownMenuContext.js +10 -2
- package/dist/cjs/ui/ToolbarSection.js +2 -1
- package/dist/es2019/index.js +3 -1
- package/dist/es2019/ui/ResponsiveContainer.compiled.css +12 -0
- package/dist/es2019/ui/ResponsiveContainer.js +65 -0
- package/dist/es2019/ui/Show.js +36 -0
- package/dist/es2019/ui/Toolbar.compiled.css +2 -0
- package/dist/es2019/ui/Toolbar.js +18 -4
- package/dist/es2019/ui/ToolbarButton.js +2 -1
- package/dist/es2019/ui/ToolbarButtonGroup.js +2 -1
- package/dist/es2019/ui/ToolbarDropdownItem.js +8 -1
- package/dist/es2019/ui/ToolbarDropdownMenu.compiled.css +3 -1
- package/dist/es2019/ui/ToolbarDropdownMenu.js +33 -22
- package/dist/es2019/ui/ToolbarDropdownMenuContext.js +7 -1
- package/dist/es2019/ui/ToolbarSection.js +2 -1
- package/dist/esm/index.js +3 -1
- package/dist/esm/ui/ResponsiveContainer.compiled.css +12 -0
- package/dist/esm/ui/ResponsiveContainer.js +64 -0
- package/dist/esm/ui/Show.js +35 -0
- package/dist/esm/ui/Toolbar.compiled.css +2 -0
- package/dist/esm/ui/Toolbar.js +18 -4
- package/dist/esm/ui/ToolbarButton.js +2 -1
- package/dist/esm/ui/ToolbarButtonGroup.js +2 -1
- package/dist/esm/ui/ToolbarDropdownItem.js +8 -1
- package/dist/esm/ui/ToolbarDropdownMenu.compiled.css +3 -1
- package/dist/esm/ui/ToolbarDropdownMenu.js +34 -21
- package/dist/esm/ui/ToolbarDropdownMenuContext.js +9 -1
- package/dist/esm/ui/ToolbarSection.js +2 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/types/ui/ResponsiveContainer.d.ts +54 -0
- package/dist/types/ui/Show.d.ts +22 -0
- package/dist/types/ui/Toolbar.d.ts +3 -1
- package/dist/types/ui/ToolbarDropdownMenu.d.ts +5 -1
- package/dist/types/ui/ToolbarDropdownMenuContext.d.ts +3 -1
- package/dist/types-ts4.5/index.d.ts +3 -1
- package/dist/types-ts4.5/ui/ResponsiveContainer.d.ts +54 -0
- package/dist/types-ts4.5/ui/Show.d.ts +22 -0
- package/dist/types-ts4.5/ui/Toolbar.d.ts +3 -1
- package/dist/types-ts4.5/ui/ToolbarDropdownMenu.d.ts +5 -1
- package/dist/types-ts4.5/ui/ToolbarDropdownMenuContext.d.ts +3 -1
- package/package.json +3 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { type ReactNode } from 'react';
|
|
2
|
+
import type { ResponsiveContainerProps } from './ResponsiveContainer';
|
|
2
3
|
type ToolbarProps = {
|
|
3
4
|
children?: ReactNode;
|
|
4
5
|
/**
|
|
@@ -12,8 +13,9 @@ type ToolbarProps = {
|
|
|
12
13
|
* A simple component representing a toolbar with box shadows - used to represent a secondary/floating toolbar
|
|
13
14
|
*/
|
|
14
15
|
export declare const Toolbar: ({ children, label }: ToolbarProps) => React.JSX.Element;
|
|
16
|
+
type PrimaryToolbarProps = ToolbarProps & ResponsiveContainerProps;
|
|
15
17
|
/**
|
|
16
18
|
* A simple component representing a toolbar without box shadows - used to represent a primary toolbar
|
|
17
19
|
*/
|
|
18
|
-
export declare const PrimaryToolbar: ({ children, label }:
|
|
20
|
+
export declare const PrimaryToolbar: ({ children, label, reducedBreakpoints }: PrimaryToolbarProps) => React.JSX.Element;
|
|
19
21
|
export {};
|
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
import React, { type ReactNode } from 'react';
|
|
6
6
|
type ToolbarDropdownMenuProps = {
|
|
7
7
|
children?: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Enforeces a max height of 320px for menus - when menu is larger a scroll is introduced
|
|
10
|
+
*/
|
|
11
|
+
enableMaxHeight?: boolean;
|
|
8
12
|
/**
|
|
9
13
|
* Whether to add margin around sections to align with 4px block padding existing in current editor dropdown
|
|
10
14
|
*/
|
|
@@ -14,5 +18,5 @@ type ToolbarDropdownMenuProps = {
|
|
|
14
18
|
label?: string;
|
|
15
19
|
testId?: string;
|
|
16
20
|
};
|
|
17
|
-
export declare const ToolbarDropdownMenu: ({ iconBefore, children, isDisabled, testId, label, hasSectionMargin, }: ToolbarDropdownMenuProps) => JSX.Element;
|
|
21
|
+
export declare const ToolbarDropdownMenu: ({ iconBefore, children, isDisabled, testId, label, hasSectionMargin, enableMaxHeight, }: ToolbarDropdownMenuProps) => JSX.Element;
|
|
18
22
|
export {};
|
|
@@ -4,7 +4,9 @@ interface ToolbarDropdownMenuContextValue {
|
|
|
4
4
|
isOpen: boolean;
|
|
5
5
|
openMenu: () => void;
|
|
6
6
|
}
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const useToolbarDropdownMenuOld: () => ToolbarDropdownMenuContextValue;
|
|
8
|
+
export declare const useToolbarDropdownMenuNew: () => ToolbarDropdownMenuContextValue | undefined;
|
|
9
|
+
export declare const useToolbarDropdownMenu: (...args: never[]) => ToolbarDropdownMenuContextValue | undefined;
|
|
8
10
|
interface ToolbarDropdownMenuProviderProps {
|
|
9
11
|
children: React.ReactNode;
|
|
10
12
|
}
|
|
@@ -9,7 +9,9 @@ export { ToolbarKeyboardShortcutHint } from './ui/ToolbarKeyboardShortcutHint';
|
|
|
9
9
|
export { ToolbarSection } from './ui/ToolbarSection';
|
|
10
10
|
export { ToolbarTooltip } from './ui/ToolbarTooltip';
|
|
11
11
|
export { ToolbarColorSwatch } from './ui/ToolbarColorSwatch';
|
|
12
|
-
export { useToolbarDropdownMenu } from './ui/ToolbarDropdownMenuContext';
|
|
12
|
+
export { useToolbarDropdownMenu, ToolbarDropdownMenuProvider, } from './ui/ToolbarDropdownMenuContext';
|
|
13
|
+
export { ResponsiveContainer } from './ui/ResponsiveContainer';
|
|
14
|
+
export { Show } from './ui/Show';
|
|
13
15
|
export { AIAdjustLengthIcon } from './ui/icons/AIAdjustLengthIcon';
|
|
14
16
|
export { AIChatIcon } from './ui/icons/AIChatIcon';
|
|
15
17
|
export { AIBriefcaseIcon } from './ui/icons/AIProfessionalIcon';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
export type ResponsiveContainerProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
/**
|
|
5
|
+
* This flag changes the breakpoint definitions, which reduces them to cater for smaller editor widths.
|
|
6
|
+
*
|
|
7
|
+
* Usages - for smaller editors such as comments
|
|
8
|
+
*/
|
|
9
|
+
reducedBreakpoints?: boolean;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* A responsive container that enables container query-based responsive design using CSS container queries.
|
|
13
|
+
* This component establishes a containment context named 'toolbar-container' that child components can
|
|
14
|
+
* reference for responsive behavior based on the container's width rather than the viewport width.
|
|
15
|
+
*
|
|
16
|
+
* The container defines breakpoints at:
|
|
17
|
+
* - sm: 410px
|
|
18
|
+
* - md: 476px
|
|
19
|
+
* - lg: 768px
|
|
20
|
+
* - xl: 1024px
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* Basic usage with Show component for responsive visibility:
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <ResponsiveContainer>
|
|
26
|
+
* <Show above="md">
|
|
27
|
+
* <Button>Only visible when container is wider than 476px</Button>
|
|
28
|
+
* </Show>
|
|
29
|
+
* <Show below="sm">
|
|
30
|
+
* <Icon>Only visible when container is narrower than 410px</Icon>
|
|
31
|
+
* </Show>
|
|
32
|
+
* </ResponsiveContainer>
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* Combining multiple Show components for different breakpoints:
|
|
37
|
+
* ```tsx
|
|
38
|
+
* <ResponsiveContainer>
|
|
39
|
+
* <Show above="lg">
|
|
40
|
+
* <FullToolbar />
|
|
41
|
+
* </Show>
|
|
42
|
+
* <Show below="lg" above="md">
|
|
43
|
+
* <CompactToolbar />
|
|
44
|
+
* </Show>
|
|
45
|
+
* <Show below="md">
|
|
46
|
+
* <MinimalToolbar />
|
|
47
|
+
* </Show>
|
|
48
|
+
* </ResponsiveContainer>
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @param children - React nodes to render within the responsive container context
|
|
52
|
+
* @returns A Box component with container query styles applied
|
|
53
|
+
*/
|
|
54
|
+
export declare const ResponsiveContainer: ({ children, reducedBreakpoints }: ResponsiveContainerProps) => React.JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
type Breakpoint = 'sm' | 'md' | 'lg' | 'xl';
|
|
3
|
+
type AboveProp = {
|
|
4
|
+
above: Breakpoint;
|
|
5
|
+
below?: never;
|
|
6
|
+
};
|
|
7
|
+
type BelowProp = {
|
|
8
|
+
above?: never;
|
|
9
|
+
below: Breakpoint;
|
|
10
|
+
};
|
|
11
|
+
type ShowProps = {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
} & (AboveProp | BelowProp);
|
|
14
|
+
/**
|
|
15
|
+
* Conditionally renders children based on responsive breakpoints.
|
|
16
|
+
* Use either `above` or `below` prop to control visibility.
|
|
17
|
+
*
|
|
18
|
+
* *note:* This component must be an ancestor of a ResponsiveContainer component to work correctly
|
|
19
|
+
* as it relies on CSS container queries.
|
|
20
|
+
*/
|
|
21
|
+
export declare const Show: ({ children, above, below }: ShowProps) => React.JSX.Element;
|
|
22
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { type ReactNode } from 'react';
|
|
2
|
+
import type { ResponsiveContainerProps } from './ResponsiveContainer';
|
|
2
3
|
type ToolbarProps = {
|
|
3
4
|
children?: ReactNode;
|
|
4
5
|
/**
|
|
@@ -12,8 +13,9 @@ type ToolbarProps = {
|
|
|
12
13
|
* A simple component representing a toolbar with box shadows - used to represent a secondary/floating toolbar
|
|
13
14
|
*/
|
|
14
15
|
export declare const Toolbar: ({ children, label }: ToolbarProps) => React.JSX.Element;
|
|
16
|
+
type PrimaryToolbarProps = ToolbarProps & ResponsiveContainerProps;
|
|
15
17
|
/**
|
|
16
18
|
* A simple component representing a toolbar without box shadows - used to represent a primary toolbar
|
|
17
19
|
*/
|
|
18
|
-
export declare const PrimaryToolbar: ({ children, label }:
|
|
20
|
+
export declare const PrimaryToolbar: ({ children, label, reducedBreakpoints }: PrimaryToolbarProps) => React.JSX.Element;
|
|
19
21
|
export {};
|
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
import React, { type ReactNode } from 'react';
|
|
6
6
|
type ToolbarDropdownMenuProps = {
|
|
7
7
|
children?: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Enforeces a max height of 320px for menus - when menu is larger a scroll is introduced
|
|
10
|
+
*/
|
|
11
|
+
enableMaxHeight?: boolean;
|
|
8
12
|
/**
|
|
9
13
|
* Whether to add margin around sections to align with 4px block padding existing in current editor dropdown
|
|
10
14
|
*/
|
|
@@ -14,5 +18,5 @@ type ToolbarDropdownMenuProps = {
|
|
|
14
18
|
label?: string;
|
|
15
19
|
testId?: string;
|
|
16
20
|
};
|
|
17
|
-
export declare const ToolbarDropdownMenu: ({ iconBefore, children, isDisabled, testId, label, hasSectionMargin, }: ToolbarDropdownMenuProps) => JSX.Element;
|
|
21
|
+
export declare const ToolbarDropdownMenu: ({ iconBefore, children, isDisabled, testId, label, hasSectionMargin, enableMaxHeight, }: ToolbarDropdownMenuProps) => JSX.Element;
|
|
18
22
|
export {};
|
|
@@ -4,7 +4,9 @@ interface ToolbarDropdownMenuContextValue {
|
|
|
4
4
|
isOpen: boolean;
|
|
5
5
|
openMenu: () => void;
|
|
6
6
|
}
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const useToolbarDropdownMenuOld: () => ToolbarDropdownMenuContextValue;
|
|
8
|
+
export declare const useToolbarDropdownMenuNew: () => ToolbarDropdownMenuContextValue | undefined;
|
|
9
|
+
export declare const useToolbarDropdownMenu: (...args: never[]) => ToolbarDropdownMenuContextValue | undefined;
|
|
8
10
|
interface ToolbarDropdownMenuProviderProps {
|
|
9
11
|
children: React.ReactNode;
|
|
10
12
|
}
|
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.6.1",
|
|
7
7
|
"description": "Common UI for Toolbars across the platform",
|
|
8
8
|
"atlassian": {
|
|
9
9
|
"team": "Editor: Jenga",
|
|
@@ -28,9 +28,10 @@
|
|
|
28
28
|
"@atlaskit/icon": "^28.1.0",
|
|
29
29
|
"@atlaskit/icon-lab": "^5.7.0",
|
|
30
30
|
"@atlaskit/logo": "^19.7.0",
|
|
31
|
+
"@atlaskit/platform-feature-flags-react": "^0.3.0",
|
|
31
32
|
"@atlaskit/popup": "^4.3.0",
|
|
32
33
|
"@atlaskit/primitives": "^14.12.0",
|
|
33
|
-
"@atlaskit/tmp-editor-statsig": "^11.
|
|
34
|
+
"@atlaskit/tmp-editor-statsig": "^11.12.0",
|
|
34
35
|
"@atlaskit/tokens": "^6.1.0",
|
|
35
36
|
"@atlaskit/tooltip": "^20.4.0",
|
|
36
37
|
"@babel/runtime": "^7.0.0",
|