@atlaskit/editor-toolbar 0.2.3 → 0.3.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.
Files changed (109) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/cjs/index.js +15 -7
  3. package/dist/cjs/ui/ColorPalette/Color.compiled.css +25 -0
  4. package/dist/cjs/ui/ColorPalette/Color.js +76 -0
  5. package/dist/cjs/ui/ColorPalette/getColorMessage.js +20 -0
  6. package/dist/cjs/ui/ColorPalette/index.compiled.css +1 -0
  7. package/dist/cjs/ui/ColorPalette/index.js +118 -0
  8. package/dist/cjs/ui/ColorPalette/types.js +5 -0
  9. package/dist/cjs/ui/ColorPalette/utils.js +94 -0
  10. package/dist/cjs/ui/ToolbarButton.compiled.css +1 -13
  11. package/dist/cjs/ui/ToolbarButton.js +2 -6
  12. package/dist/cjs/ui/ToolbarButtonGroup.compiled.css +7 -1
  13. package/dist/cjs/ui/ToolbarButtonGroup.js +17 -5
  14. package/dist/cjs/ui/ToolbarDropdownItem.compiled.css +4 -2
  15. package/dist/cjs/ui/ToolbarDropdownItem.js +1 -1
  16. package/dist/cjs/ui/ToolbarDropdownItemSection.js +7 -10
  17. package/dist/cjs/ui/ToolbarDropdownMenu.compiled.css +1 -0
  18. package/dist/cjs/ui/ToolbarDropdownMenu.js +51 -6
  19. package/dist/cjs/ui/ToolbarDropdownMenuContext.js +40 -0
  20. package/dist/es2019/index.js +2 -1
  21. package/dist/es2019/ui/ColorPalette/Color.compiled.css +25 -0
  22. package/dist/es2019/ui/ColorPalette/Color.js +65 -0
  23. package/dist/es2019/ui/ColorPalette/getColorMessage.js +18 -0
  24. package/dist/es2019/ui/ColorPalette/index.compiled.css +1 -0
  25. package/dist/es2019/ui/ColorPalette/index.js +110 -0
  26. package/dist/es2019/ui/ColorPalette/types.js +1 -0
  27. package/dist/es2019/ui/ColorPalette/utils.js +83 -0
  28. package/dist/es2019/ui/ToolbarButton.compiled.css +1 -13
  29. package/dist/es2019/ui/ToolbarButton.js +2 -6
  30. package/dist/es2019/ui/ToolbarButtonGroup.compiled.css +7 -1
  31. package/dist/es2019/ui/ToolbarButtonGroup.js +14 -3
  32. package/dist/es2019/ui/ToolbarDropdownItem.compiled.css +4 -2
  33. package/dist/es2019/ui/ToolbarDropdownItem.js +1 -1
  34. package/dist/es2019/ui/ToolbarDropdownItemSection.js +7 -10
  35. package/dist/es2019/ui/ToolbarDropdownMenu.compiled.css +1 -0
  36. package/dist/es2019/ui/ToolbarDropdownMenu.js +50 -6
  37. package/dist/es2019/ui/ToolbarDropdownMenuContext.js +26 -0
  38. package/dist/esm/index.js +2 -1
  39. package/dist/esm/ui/ColorPalette/Color.compiled.css +25 -0
  40. package/dist/esm/ui/ColorPalette/Color.js +67 -0
  41. package/dist/esm/ui/ColorPalette/getColorMessage.js +14 -0
  42. package/dist/esm/ui/ColorPalette/index.compiled.css +1 -0
  43. package/dist/esm/ui/ColorPalette/index.js +109 -0
  44. package/dist/esm/ui/ColorPalette/types.js +1 -0
  45. package/dist/esm/ui/ColorPalette/utils.js +84 -0
  46. package/dist/esm/ui/ToolbarButton.compiled.css +1 -13
  47. package/dist/esm/ui/ToolbarButton.js +2 -6
  48. package/dist/esm/ui/ToolbarButtonGroup.compiled.css +7 -1
  49. package/dist/esm/ui/ToolbarButtonGroup.js +14 -3
  50. package/dist/esm/ui/ToolbarDropdownItem.compiled.css +4 -2
  51. package/dist/esm/ui/ToolbarDropdownItem.js +1 -1
  52. package/dist/esm/ui/ToolbarDropdownItemSection.js +7 -10
  53. package/dist/esm/ui/ToolbarDropdownMenu.compiled.css +1 -0
  54. package/dist/esm/ui/ToolbarDropdownMenu.js +49 -6
  55. package/dist/esm/ui/ToolbarDropdownMenuContext.js +31 -0
  56. package/dist/types/index.d.ts +3 -2
  57. package/dist/types/types.d.ts +0 -1
  58. package/dist/types/ui/ColorPalette/Color.d.ts +11 -0
  59. package/dist/types/ui/ColorPalette/getColorMessage.d.ts +8 -0
  60. package/dist/types/ui/ColorPalette/index.d.ts +15 -0
  61. package/dist/types/ui/ColorPalette/types.d.ts +89 -0
  62. package/dist/types/ui/ColorPalette/utils.d.ts +40 -0
  63. package/dist/types/ui/ToolbarButton.d.ts +0 -2
  64. package/dist/types/ui/ToolbarButtonGroup.d.ts +6 -2
  65. package/dist/types/ui/ToolbarDropdownItemSection.d.ts +3 -1
  66. package/dist/types/ui/ToolbarDropdownMenu.d.ts +9 -3
  67. package/dist/types/ui/ToolbarDropdownMenuContext.d.ts +12 -0
  68. package/dist/types/ui/ToolbarTooltip.d.ts +1 -1
  69. package/dist/types-ts4.5/index.d.ts +3 -2
  70. package/dist/types-ts4.5/types.d.ts +0 -1
  71. package/dist/types-ts4.5/ui/ColorPalette/Color.d.ts +11 -0
  72. package/dist/types-ts4.5/ui/ColorPalette/getColorMessage.d.ts +8 -0
  73. package/dist/types-ts4.5/ui/ColorPalette/index.d.ts +15 -0
  74. package/dist/types-ts4.5/ui/ColorPalette/types.d.ts +89 -0
  75. package/dist/types-ts4.5/ui/ColorPalette/utils.d.ts +40 -0
  76. package/dist/types-ts4.5/ui/ToolbarButton.d.ts +0 -2
  77. package/dist/types-ts4.5/ui/ToolbarButtonGroup.d.ts +6 -2
  78. package/dist/types-ts4.5/ui/ToolbarDropdownItemSection.d.ts +3 -1
  79. package/dist/types-ts4.5/ui/ToolbarDropdownMenu.d.ts +9 -3
  80. package/dist/types-ts4.5/ui/ToolbarDropdownMenuContext.d.ts +12 -0
  81. package/dist/types-ts4.5/ui/ToolbarTooltip.d.ts +1 -1
  82. package/examples/toolbar/examples/ExampleManuallyComposedToolbar.tsx +2 -12
  83. package/package.json +5 -3
  84. package/src/index.ts +4 -2
  85. package/src/types.ts +0 -1
  86. package/src/ui/ColorPalette/Color.tsx +118 -0
  87. package/src/ui/ColorPalette/getColorMessage.ts +27 -0
  88. package/src/ui/ColorPalette/index.tsx +125 -0
  89. package/src/ui/ColorPalette/types.ts +96 -0
  90. package/src/ui/ColorPalette/utils.ts +102 -0
  91. package/src/ui/ToolbarButton.tsx +0 -28
  92. package/src/ui/ToolbarButtonGroup.tsx +42 -3
  93. package/src/ui/ToolbarDropdownItem.tsx +4 -2
  94. package/src/ui/ToolbarDropdownItemSection.tsx +13 -11
  95. package/src/ui/ToolbarDropdownMenu.tsx +68 -9
  96. package/src/ui/ToolbarDropdownMenuContext.tsx +44 -0
  97. package/src/ui/ToolbarTooltip.tsx +1 -1
  98. package/dist/cjs/ui/ToolbarDropdownDivider.compiled.css +0 -3
  99. package/dist/cjs/ui/ToolbarDropdownDivider.js +0 -20
  100. package/dist/cjs/ui/ToolbarDropdownItemSection.compiled.css +0 -2
  101. package/dist/es2019/ui/ToolbarDropdownDivider.compiled.css +0 -3
  102. package/dist/es2019/ui/ToolbarDropdownDivider.js +0 -12
  103. package/dist/es2019/ui/ToolbarDropdownItemSection.compiled.css +0 -2
  104. package/dist/esm/ui/ToolbarDropdownDivider.compiled.css +0 -3
  105. package/dist/esm/ui/ToolbarDropdownDivider.js +0 -12
  106. package/dist/esm/ui/ToolbarDropdownItemSection.compiled.css +0 -2
  107. package/dist/types/ui/ToolbarDropdownDivider.d.ts +0 -1
  108. package/dist/types-ts4.5/ui/ToolbarDropdownDivider.d.ts +0 -1
  109. package/src/ui/ToolbarDropdownDivider.tsx +0 -20
@@ -1,16 +1,39 @@
1
- import React from 'react';
1
+ /* ToolbarDropdownMenu.tsx generated by @compiled/babel-plugin v0.36.1 */
2
+ import "./ToolbarDropdownMenu.compiled.css";
3
+ import { ax, ix } from "@compiled/react/runtime";
4
+ import React, { useCallback } from 'react';
2
5
  import DropdownMenu from '@atlaskit/dropdown-menu';
3
6
  import { useToolbarUI } from '../hooks/ui-context';
4
7
  import { ToolbarButton } from './ToolbarButton';
5
- export var ToolbarDropdownMenu = function ToolbarDropdownMenu(_ref) {
8
+ import { ToolbarDropdownMenuProvider, useToolbarDropdownMenu } from './ToolbarDropdownMenuContext';
9
+ var styles = {
10
+ sectionMargin: "_1mou1b66"
11
+ };
12
+ var ToolbarDropdownMenuContent = function ToolbarDropdownMenuContent(_ref) {
6
13
  var iconBefore = _ref.iconBefore,
7
- groupLocation = _ref.groupLocation,
8
14
  children = _ref.children,
9
15
  isDisabled = _ref.isDisabled,
10
16
  testId = _ref.testId,
11
17
  label = _ref.label;
12
18
  var _useToolbarUI = useToolbarUI(),
13
19
  onDropdownOpenChanged = _useToolbarUI.onDropdownOpenChanged;
20
+ var _useToolbarDropdownMe = useToolbarDropdownMenu(),
21
+ closeMenu = _useToolbarDropdownMe.closeMenu,
22
+ isOpen = _useToolbarDropdownMe.isOpen,
23
+ openMenu = _useToolbarDropdownMe.openMenu;
24
+ var handleOpenChange = useCallback(function (args) {
25
+ onDropdownOpenChanged(args);
26
+ if (!args.isOpen) {
27
+ closeMenu();
28
+ }
29
+ }, [closeMenu, onDropdownOpenChanged]);
30
+ var handleClick = useCallback(function () {
31
+ if (!isOpen) {
32
+ openMenu();
33
+ } else {
34
+ closeMenu();
35
+ }
36
+ }, [closeMenu, openMenu, isOpen]);
14
37
  return /*#__PURE__*/React.createElement(DropdownMenu, {
15
38
  trigger: function trigger(triggerProps) {
16
39
  return /*#__PURE__*/React.createElement(ToolbarButton, {
@@ -20,15 +43,35 @@ export var ToolbarDropdownMenu = function ToolbarDropdownMenu(_ref) {
20
43
  "aria-haspopup": triggerProps['aria-haspopup'],
21
44
  "aria-controls": triggerProps['aria-controls'],
22
45
  onBlur: triggerProps.onBlur,
23
- onClick: triggerProps.onClick,
46
+ onClick: function onClick(e) {
47
+ handleClick();
48
+ triggerProps.onClick && triggerProps.onClick(e);
49
+ },
24
50
  onFocus: triggerProps.onFocus,
25
51
  testId: testId,
26
52
  iconBefore: iconBefore,
27
- groupLocation: groupLocation,
28
53
  isDisabled: isDisabled,
29
54
  label: label
30
55
  });
31
56
  },
32
- onOpenChange: onDropdownOpenChanged
57
+ onOpenChange: handleOpenChange,
58
+ isOpen: isOpen
33
59
  }, children);
60
+ };
61
+ export var ToolbarDropdownMenu = function ToolbarDropdownMenu(_ref2) {
62
+ var iconBefore = _ref2.iconBefore,
63
+ children = _ref2.children,
64
+ isDisabled = _ref2.isDisabled,
65
+ testId = _ref2.testId,
66
+ label = _ref2.label,
67
+ _ref2$hasSectionMargi = _ref2.hasSectionMargin,
68
+ hasSectionMargin = _ref2$hasSectionMargi === void 0 ? true : _ref2$hasSectionMargi;
69
+ return /*#__PURE__*/React.createElement(ToolbarDropdownMenuProvider, null, /*#__PURE__*/React.createElement(ToolbarDropdownMenuContent, {
70
+ iconBefore: iconBefore,
71
+ isDisabled: isDisabled,
72
+ testId: testId,
73
+ label: label
74
+ }, /*#__PURE__*/React.createElement("div", {
75
+ className: ax([hasSectionMargin && styles.sectionMargin])
76
+ }, children)));
34
77
  };
@@ -0,0 +1,31 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import React, { createContext, useContext, useState } from 'react';
3
+ var ToolbarDropdownMenuContext = /*#__PURE__*/createContext(undefined);
4
+ export var useToolbarDropdownMenu = function useToolbarDropdownMenu() {
5
+ var context = useContext(ToolbarDropdownMenuContext);
6
+ if (!context) {
7
+ throw new Error('useToolbarDropdownMenu must be used within ToolbarDropdownMenuProvider');
8
+ }
9
+ return context;
10
+ };
11
+ export var ToolbarDropdownMenuProvider = function ToolbarDropdownMenuProvider(_ref) {
12
+ var children = _ref.children;
13
+ var _useState = useState(false),
14
+ _useState2 = _slicedToArray(_useState, 2),
15
+ isOpen = _useState2[0],
16
+ setIsOpen = _useState2[1];
17
+ var openMenu = function openMenu() {
18
+ return setIsOpen(true);
19
+ };
20
+ var closeMenu = function closeMenu() {
21
+ setIsOpen(false);
22
+ };
23
+ var contextValue = {
24
+ openMenu: openMenu,
25
+ closeMenu: closeMenu,
26
+ isOpen: isOpen
27
+ };
28
+ return /*#__PURE__*/React.createElement(ToolbarDropdownMenuContext.Provider, {
29
+ value: contextValue
30
+ }, children);
31
+ };
@@ -8,8 +8,8 @@ export { ToolbarNestedDropdownMenu } from './ui/ToolbarNestedDropdownMenu';
8
8
  export { ToolbarKeyboardShortcutHint } from './ui/ToolbarKeyboardShortcutHint';
9
9
  export { ToolbarSection } from './ui/ToolbarSection';
10
10
  export { ToolbarTooltip } from './ui/ToolbarTooltip';
11
- export { ToolbarDropdownDivider } from './ui/ToolbarDropdownDivider';
12
11
  export { ToolbarColorSwatch } from './ui/ToolbarColorSwatch';
12
+ export { useToolbarDropdownMenu } from './ui/ToolbarDropdownMenuContext';
13
13
  export { AIAdjustLengthIcon } from './ui/icons/AIAdjustLengthIcon';
14
14
  export { AIChatIcon } from './ui/icons/AIChatIcon';
15
15
  export { AIBriefcaseIcon } from './ui/icons/AIProfessionalIcon';
@@ -55,5 +55,6 @@ export { AlignTextCenterIcon } from './ui/icons/AlignTextCenterIcon';
55
55
  export { AlignTextRightIcon } from './ui/icons/AlignTextRightIcon';
56
56
  export { IndentIcon } from './ui/icons/IndentIcon';
57
57
  export { OutdentIcon } from './ui/icons/OutdentIcon';
58
- export type { IconComponent, ToolbarButtonGroupLocation } from './types';
58
+ export { default as ColorPalette } from './ui/ColorPalette';
59
+ export type { IconComponent } from './types';
59
60
  export { useToolbarUI, ToolbarUIProvider } from './hooks/ui-context';
@@ -1,3 +1,2 @@
1
1
  import { type NewCoreIconProps } from '@atlaskit/icon';
2
- export type ToolbarButtonGroupLocation = 'start' | 'middle' | 'end';
3
2
  export type IconComponent = (props: NewCoreIconProps) => JSX.Element;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import React from 'react';
6
+ import type { ColorProps } from './types';
7
+ /**
8
+ * Individual color palette item component
9
+ * Displays a single color swatch with tooltip and selection state
10
+ */
11
+ export declare const Color: React.NamedExoticComponent<ColorProps>;
@@ -0,0 +1,8 @@
1
+ import { type MessageDescriptor } from 'react-intl-next';
2
+ /**
3
+ * Retrieves the appropriate internationalization message for a given color
4
+ * @param messages - Record of color values to message descriptors
5
+ * @param color - The color value to look up
6
+ * @returns The message descriptor or undefined if not found
7
+ */
8
+ export default function getColorMessage(messages: Record<string | number, MessageDescriptor>, color: string): MessageDescriptor | undefined;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import type { ColorPaletteProps } from './types';
3
+ /**
4
+ * ColorPalette component for displaying a grid of selectable colors
5
+ *
6
+ * Features:
7
+ * - Responsive grid layout
8
+ * - Keyboard navigation support
9
+ * - Accessibility compliance (ARIA attributes)
10
+ * - Theme-aware tooltips
11
+ * - Design token integration
12
+ * - Customizable color mapping
13
+ */
14
+ declare const ColorPalette: ({ cols, onClick, onKeyDown, selectedColor, paletteOptions, }: ColorPaletteProps) => React.JSX.Element;
15
+ export default ColorPalette;
@@ -0,0 +1,89 @@
1
+ import { type ReactElement } from 'react';
2
+ import { type MessageDescriptor } from 'react-intl-next';
3
+ /**
4
+ * Represents a single color in the palette
5
+ */
6
+ export interface PaletteColor {
7
+ /** The color value (hex, token, etc.) */
8
+ value: string;
9
+ /** Display label for the color */
10
+ label: string;
11
+ /** Border color for the color swatch */
12
+ border: string;
13
+ /** Optional internationalization message */
14
+ message?: MessageDescriptor;
15
+ /** Optional decorator element to display instead of checkmark */
16
+ decorator?: ReactElement;
17
+ }
18
+ /**
19
+ * Array of palette colors
20
+ */
21
+ export type Palette = Array<PaletteColor>;
22
+ /**
23
+ * Tooltip messages for different themes
24
+ */
25
+ export type PaletteTooltipMessages = {
26
+ dark: Record<string, MessageDescriptor>;
27
+ light: Record<string, MessageDescriptor>;
28
+ };
29
+ /**
30
+ * Configuration options for the color palette
31
+ */
32
+ export interface PaletteOptions {
33
+ /** Array of colors to display */
34
+ palette: PaletteColor[];
35
+ /**
36
+ * Function to convert hex codes to design system tokens
37
+ * Different color palettes may use different mapping functions
38
+ */
39
+ hexToPaletteColor?: (hexColor: string) => string | undefined;
40
+ /**
41
+ * Tooltip messages for different color themes
42
+ * Consumer determines which tooltip messages to use
43
+ */
44
+ paletteColorTooltipMessages?: PaletteTooltipMessages;
45
+ }
46
+ /**
47
+ * Props for the main ColorPalette component
48
+ */
49
+ export interface ColorPaletteProps {
50
+ /** Currently selected color value */
51
+ selectedColor: string | null;
52
+ /** Callback when a color is clicked */
53
+ onClick: (value: string, label: string) => void;
54
+ /** Optional callback for keyboard navigation */
55
+ onKeyDown?: (value: string, label: string, event: React.KeyboardEvent) => void;
56
+ /** Number of columns in the palette grid */
57
+ cols?: number;
58
+ /** Optional CSS class name */
59
+ className?: string;
60
+ /** Palette configuration options */
61
+ paletteOptions: PaletteOptions;
62
+ }
63
+ /**
64
+ * Props for individual color palette items
65
+ */
66
+ export interface ColorProps {
67
+ /** The color value */
68
+ value: string;
69
+ /** Display label for accessibility */
70
+ label: string;
71
+ /** Tab index for keyboard navigation */
72
+ tabIndex?: number;
73
+ /** Whether this color is currently selected */
74
+ isSelected?: boolean;
75
+ /** Click handler */
76
+ onClick: (value: string, label: string) => void;
77
+ /** Keyboard event handler */
78
+ onKeyDown?: (value: string, label: string, event: React.KeyboardEvent) => void;
79
+ /** Border color for the swatch */
80
+ borderColor: string;
81
+ /** Color for the checkmark icon */
82
+ checkMarkColor?: string;
83
+ /** Whether to auto-focus this item */
84
+ autoFocus?: boolean;
85
+ /** Function to convert hex to palette color */
86
+ hexToPaletteColor?: (hexColor: string) => string | undefined;
87
+ /** Optional decorator element */
88
+ decorator?: ReactElement;
89
+ }
@@ -0,0 +1,40 @@
1
+ import type { PaletteColor } from './types';
2
+ /**
3
+ * Default number of columns in the color picker
4
+ */
5
+ export declare const DEFAULT_COLOR_PICKER_COLUMNS = 7;
6
+ /**
7
+ * Splits a palette array into rows based on the specified number of columns
8
+ * @param palette - Array of palette colors
9
+ * @param cols - Number of columns per row
10
+ * @returns Array of color rows
11
+ */
12
+ export declare function getColorsPerRowFromPalette(palette: PaletteColor[], cols?: number): PaletteColor[][];
13
+ /**
14
+ * Finds the row and column indices of a selected color in the palette grid
15
+ * @param colorsPerRow - 2D array of colors organized by rows
16
+ * @param selectedColor - The currently selected color value
17
+ * @returns Object containing row and column indices
18
+ */
19
+ export declare function getSelectedRowAndColumn(colorsPerRow: PaletteColor[][], selectedColor: string | null): {
20
+ selectedRowIndex: number;
21
+ selectedColumnIndex: number;
22
+ };
23
+ /**
24
+ * Finds the row and column indices of a selected color in a flat palette array
25
+ * @param palette - Flat array of palette colors
26
+ * @param selectedColor - The currently selected color value
27
+ * @param cols - Number of columns per row
28
+ * @returns Object containing row and column indices
29
+ */
30
+ export declare function getSelectedRowAndColumnFromPalette(palette: PaletteColor[], selectedColor: string | null, cols?: number): {
31
+ selectedRowIndex: number;
32
+ selectedColumnIndex: number;
33
+ };
34
+ /**
35
+ * Extracts the actual color value from a CSS variable expression
36
+ * Handles both token variables and fallback values
37
+ * @param variableExpression - CSS variable expression (e.g., "var(--ds-background-accent-blue-subtle, #0052CC)")
38
+ * @returns The resolved color value or empty string if not found
39
+ */
40
+ export declare const getTokenCSSVariableValue: (variableExpression: string) => string;
@@ -1,6 +1,5 @@
1
1
  import React, { type ReactNode } from 'react';
2
2
  import { type TriggerProps } from '@atlaskit/popup';
3
- import { type ToolbarButtonGroupLocation } from '../types';
4
3
  type ToolbarButtonProps = Partial<TriggerProps> & {
5
4
  children?: ReactNode;
6
5
  isSelected?: boolean;
@@ -9,7 +8,6 @@ type ToolbarButtonProps = Partial<TriggerProps> & {
9
8
  onFocus?: (event: React.FocusEvent<HTMLButtonElement>) => void;
10
9
  testId?: string;
11
10
  iconBefore: React.ReactNode;
12
- groupLocation?: ToolbarButtonGroupLocation;
13
11
  isDisabled?: boolean;
14
12
  ariaKeyshortcuts?: string;
15
13
  label?: string;
@@ -1,6 +1,10 @@
1
- import React, { type ReactNode } from 'react';
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import { type ReactNode } from 'react';
2
6
  type ToolbarButtonGroupProps = {
3
7
  children?: ReactNode;
4
8
  };
5
- export declare const ToolbarButtonGroup: ({ children }: ToolbarButtonGroupProps) => React.JSX.Element;
9
+ export declare const ToolbarButtonGroup: ({ children }: ToolbarButtonGroupProps) => JSX.Element;
6
10
  export {};
@@ -1,6 +1,8 @@
1
1
  import React, { type ReactNode } from 'react';
2
2
  type ToolbarDropdownItemSectionProps = {
3
3
  children?: ReactNode;
4
+ hasSeparator?: boolean;
5
+ title?: string;
4
6
  };
5
- export declare const ToolbarDropdownItemSection: ({ children }: ToolbarDropdownItemSectionProps) => React.JSX.Element;
7
+ export declare const ToolbarDropdownItemSection: ({ children, hasSeparator, title, }: ToolbarDropdownItemSectionProps) => React.JSX.Element;
6
8
  export {};
@@ -1,12 +1,18 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
1
5
  import React, { type ReactNode } from 'react';
2
- import { type ToolbarButtonGroupLocation } from '../types';
3
6
  type ToolbarDropdownMenuProps = {
4
7
  iconBefore: React.ReactNode;
5
8
  children?: ReactNode;
6
- groupLocation?: ToolbarButtonGroupLocation;
7
9
  isDisabled?: boolean;
8
10
  testId?: string;
9
11
  label?: string;
12
+ /**
13
+ * Whether to add margin around sections to align with 4px block padding existing in current editor dropdown
14
+ */
15
+ hasSectionMargin?: boolean;
10
16
  };
11
- export declare const ToolbarDropdownMenu: ({ iconBefore, groupLocation, children, isDisabled, testId, label, }: ToolbarDropdownMenuProps) => React.JSX.Element;
17
+ export declare const ToolbarDropdownMenu: ({ iconBefore, children, isDisabled, testId, label, hasSectionMargin, }: ToolbarDropdownMenuProps) => JSX.Element;
12
18
  export {};
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ interface ToolbarDropdownMenuContextValue {
3
+ openMenu: () => void;
4
+ closeMenu: () => void;
5
+ isOpen: boolean;
6
+ }
7
+ export declare const useToolbarDropdownMenu: () => ToolbarDropdownMenuContextValue;
8
+ interface ToolbarDropdownMenuProviderProps {
9
+ children: React.ReactNode;
10
+ }
11
+ export declare const ToolbarDropdownMenuProvider: ({ children }: ToolbarDropdownMenuProviderProps) => React.JSX.Element;
12
+ export {};
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { PositionType } from '@atlaskit/tooltip';
3
3
  type ToolbarTooltipProps = {
4
- content: string;
4
+ content: React.ReactNode;
5
5
  children: React.ReactNode;
6
6
  position?: PositionType;
7
7
  };
@@ -8,8 +8,8 @@ export { ToolbarNestedDropdownMenu } from './ui/ToolbarNestedDropdownMenu';
8
8
  export { ToolbarKeyboardShortcutHint } from './ui/ToolbarKeyboardShortcutHint';
9
9
  export { ToolbarSection } from './ui/ToolbarSection';
10
10
  export { ToolbarTooltip } from './ui/ToolbarTooltip';
11
- export { ToolbarDropdownDivider } from './ui/ToolbarDropdownDivider';
12
11
  export { ToolbarColorSwatch } from './ui/ToolbarColorSwatch';
12
+ export { useToolbarDropdownMenu } from './ui/ToolbarDropdownMenuContext';
13
13
  export { AIAdjustLengthIcon } from './ui/icons/AIAdjustLengthIcon';
14
14
  export { AIChatIcon } from './ui/icons/AIChatIcon';
15
15
  export { AIBriefcaseIcon } from './ui/icons/AIProfessionalIcon';
@@ -55,5 +55,6 @@ export { AlignTextCenterIcon } from './ui/icons/AlignTextCenterIcon';
55
55
  export { AlignTextRightIcon } from './ui/icons/AlignTextRightIcon';
56
56
  export { IndentIcon } from './ui/icons/IndentIcon';
57
57
  export { OutdentIcon } from './ui/icons/OutdentIcon';
58
- export type { IconComponent, ToolbarButtonGroupLocation } from './types';
58
+ export { default as ColorPalette } from './ui/ColorPalette';
59
+ export type { IconComponent } from './types';
59
60
  export { useToolbarUI, ToolbarUIProvider } from './hooks/ui-context';
@@ -1,3 +1,2 @@
1
1
  import { type NewCoreIconProps } from '@atlaskit/icon';
2
- export type ToolbarButtonGroupLocation = 'start' | 'middle' | 'end';
3
2
  export type IconComponent = (props: NewCoreIconProps) => JSX.Element;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import React from 'react';
6
+ import type { ColorProps } from './types';
7
+ /**
8
+ * Individual color palette item component
9
+ * Displays a single color swatch with tooltip and selection state
10
+ */
11
+ export declare const Color: React.NamedExoticComponent<ColorProps>;
@@ -0,0 +1,8 @@
1
+ import { type MessageDescriptor } from 'react-intl-next';
2
+ /**
3
+ * Retrieves the appropriate internationalization message for a given color
4
+ * @param messages - Record of color values to message descriptors
5
+ * @param color - The color value to look up
6
+ * @returns The message descriptor or undefined if not found
7
+ */
8
+ export default function getColorMessage(messages: Record<string | number, MessageDescriptor>, color: string): MessageDescriptor | undefined;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import type { ColorPaletteProps } from './types';
3
+ /**
4
+ * ColorPalette component for displaying a grid of selectable colors
5
+ *
6
+ * Features:
7
+ * - Responsive grid layout
8
+ * - Keyboard navigation support
9
+ * - Accessibility compliance (ARIA attributes)
10
+ * - Theme-aware tooltips
11
+ * - Design token integration
12
+ * - Customizable color mapping
13
+ */
14
+ declare const ColorPalette: ({ cols, onClick, onKeyDown, selectedColor, paletteOptions, }: ColorPaletteProps) => React.JSX.Element;
15
+ export default ColorPalette;
@@ -0,0 +1,89 @@
1
+ import { type ReactElement } from 'react';
2
+ import { type MessageDescriptor } from 'react-intl-next';
3
+ /**
4
+ * Represents a single color in the palette
5
+ */
6
+ export interface PaletteColor {
7
+ /** The color value (hex, token, etc.) */
8
+ value: string;
9
+ /** Display label for the color */
10
+ label: string;
11
+ /** Border color for the color swatch */
12
+ border: string;
13
+ /** Optional internationalization message */
14
+ message?: MessageDescriptor;
15
+ /** Optional decorator element to display instead of checkmark */
16
+ decorator?: ReactElement;
17
+ }
18
+ /**
19
+ * Array of palette colors
20
+ */
21
+ export type Palette = Array<PaletteColor>;
22
+ /**
23
+ * Tooltip messages for different themes
24
+ */
25
+ export type PaletteTooltipMessages = {
26
+ dark: Record<string, MessageDescriptor>;
27
+ light: Record<string, MessageDescriptor>;
28
+ };
29
+ /**
30
+ * Configuration options for the color palette
31
+ */
32
+ export interface PaletteOptions {
33
+ /** Array of colors to display */
34
+ palette: PaletteColor[];
35
+ /**
36
+ * Function to convert hex codes to design system tokens
37
+ * Different color palettes may use different mapping functions
38
+ */
39
+ hexToPaletteColor?: (hexColor: string) => string | undefined;
40
+ /**
41
+ * Tooltip messages for different color themes
42
+ * Consumer determines which tooltip messages to use
43
+ */
44
+ paletteColorTooltipMessages?: PaletteTooltipMessages;
45
+ }
46
+ /**
47
+ * Props for the main ColorPalette component
48
+ */
49
+ export interface ColorPaletteProps {
50
+ /** Currently selected color value */
51
+ selectedColor: string | null;
52
+ /** Callback when a color is clicked */
53
+ onClick: (value: string, label: string) => void;
54
+ /** Optional callback for keyboard navigation */
55
+ onKeyDown?: (value: string, label: string, event: React.KeyboardEvent) => void;
56
+ /** Number of columns in the palette grid */
57
+ cols?: number;
58
+ /** Optional CSS class name */
59
+ className?: string;
60
+ /** Palette configuration options */
61
+ paletteOptions: PaletteOptions;
62
+ }
63
+ /**
64
+ * Props for individual color palette items
65
+ */
66
+ export interface ColorProps {
67
+ /** The color value */
68
+ value: string;
69
+ /** Display label for accessibility */
70
+ label: string;
71
+ /** Tab index for keyboard navigation */
72
+ tabIndex?: number;
73
+ /** Whether this color is currently selected */
74
+ isSelected?: boolean;
75
+ /** Click handler */
76
+ onClick: (value: string, label: string) => void;
77
+ /** Keyboard event handler */
78
+ onKeyDown?: (value: string, label: string, event: React.KeyboardEvent) => void;
79
+ /** Border color for the swatch */
80
+ borderColor: string;
81
+ /** Color for the checkmark icon */
82
+ checkMarkColor?: string;
83
+ /** Whether to auto-focus this item */
84
+ autoFocus?: boolean;
85
+ /** Function to convert hex to palette color */
86
+ hexToPaletteColor?: (hexColor: string) => string | undefined;
87
+ /** Optional decorator element */
88
+ decorator?: ReactElement;
89
+ }
@@ -0,0 +1,40 @@
1
+ import type { PaletteColor } from './types';
2
+ /**
3
+ * Default number of columns in the color picker
4
+ */
5
+ export declare const DEFAULT_COLOR_PICKER_COLUMNS = 7;
6
+ /**
7
+ * Splits a palette array into rows based on the specified number of columns
8
+ * @param palette - Array of palette colors
9
+ * @param cols - Number of columns per row
10
+ * @returns Array of color rows
11
+ */
12
+ export declare function getColorsPerRowFromPalette(palette: PaletteColor[], cols?: number): PaletteColor[][];
13
+ /**
14
+ * Finds the row and column indices of a selected color in the palette grid
15
+ * @param colorsPerRow - 2D array of colors organized by rows
16
+ * @param selectedColor - The currently selected color value
17
+ * @returns Object containing row and column indices
18
+ */
19
+ export declare function getSelectedRowAndColumn(colorsPerRow: PaletteColor[][], selectedColor: string | null): {
20
+ selectedRowIndex: number;
21
+ selectedColumnIndex: number;
22
+ };
23
+ /**
24
+ * Finds the row and column indices of a selected color in a flat palette array
25
+ * @param palette - Flat array of palette colors
26
+ * @param selectedColor - The currently selected color value
27
+ * @param cols - Number of columns per row
28
+ * @returns Object containing row and column indices
29
+ */
30
+ export declare function getSelectedRowAndColumnFromPalette(palette: PaletteColor[], selectedColor: string | null, cols?: number): {
31
+ selectedRowIndex: number;
32
+ selectedColumnIndex: number;
33
+ };
34
+ /**
35
+ * Extracts the actual color value from a CSS variable expression
36
+ * Handles both token variables and fallback values
37
+ * @param variableExpression - CSS variable expression (e.g., "var(--ds-background-accent-blue-subtle, #0052CC)")
38
+ * @returns The resolved color value or empty string if not found
39
+ */
40
+ export declare const getTokenCSSVariableValue: (variableExpression: string) => string;
@@ -1,6 +1,5 @@
1
1
  import React, { type ReactNode } from 'react';
2
2
  import { type TriggerProps } from '@atlaskit/popup';
3
- import { type ToolbarButtonGroupLocation } from '../types';
4
3
  type ToolbarButtonProps = Partial<TriggerProps> & {
5
4
  children?: ReactNode;
6
5
  isSelected?: boolean;
@@ -9,7 +8,6 @@ type ToolbarButtonProps = Partial<TriggerProps> & {
9
8
  onFocus?: (event: React.FocusEvent<HTMLButtonElement>) => void;
10
9
  testId?: string;
11
10
  iconBefore: React.ReactNode;
12
- groupLocation?: ToolbarButtonGroupLocation;
13
11
  isDisabled?: boolean;
14
12
  ariaKeyshortcuts?: string;
15
13
  label?: string;
@@ -1,6 +1,10 @@
1
- import React, { type ReactNode } from 'react';
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import { type ReactNode } from 'react';
2
6
  type ToolbarButtonGroupProps = {
3
7
  children?: ReactNode;
4
8
  };
5
- export declare const ToolbarButtonGroup: ({ children }: ToolbarButtonGroupProps) => React.JSX.Element;
9
+ export declare const ToolbarButtonGroup: ({ children }: ToolbarButtonGroupProps) => JSX.Element;
6
10
  export {};
@@ -1,6 +1,8 @@
1
1
  import React, { type ReactNode } from 'react';
2
2
  type ToolbarDropdownItemSectionProps = {
3
3
  children?: ReactNode;
4
+ hasSeparator?: boolean;
5
+ title?: string;
4
6
  };
5
- export declare const ToolbarDropdownItemSection: ({ children }: ToolbarDropdownItemSectionProps) => React.JSX.Element;
7
+ export declare const ToolbarDropdownItemSection: ({ children, hasSeparator, title, }: ToolbarDropdownItemSectionProps) => React.JSX.Element;
6
8
  export {};
@@ -1,12 +1,18 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
1
5
  import React, { type ReactNode } from 'react';
2
- import { type ToolbarButtonGroupLocation } from '../types';
3
6
  type ToolbarDropdownMenuProps = {
4
7
  iconBefore: React.ReactNode;
5
8
  children?: ReactNode;
6
- groupLocation?: ToolbarButtonGroupLocation;
7
9
  isDisabled?: boolean;
8
10
  testId?: string;
9
11
  label?: string;
12
+ /**
13
+ * Whether to add margin around sections to align with 4px block padding existing in current editor dropdown
14
+ */
15
+ hasSectionMargin?: boolean;
10
16
  };
11
- export declare const ToolbarDropdownMenu: ({ iconBefore, groupLocation, children, isDisabled, testId, label, }: ToolbarDropdownMenuProps) => React.JSX.Element;
17
+ export declare const ToolbarDropdownMenu: ({ iconBefore, children, isDisabled, testId, label, hasSectionMargin, }: ToolbarDropdownMenuProps) => JSX.Element;
12
18
  export {};