@atlaskit/editor-toolbar 0.0.5 → 0.0.7

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 (70) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/afm-rovo-extension/tsconfig.json +54 -0
  3. package/afm-townsquare/tsconfig.json +54 -0
  4. package/dist/cjs/ui/Toolbar.compiled.css +1 -1
  5. package/dist/cjs/ui/Toolbar.js +1 -1
  6. package/dist/cjs/ui/ToolbarButton.compiled.css +1 -1
  7. package/dist/cjs/ui/ToolbarButton.js +3 -14
  8. package/dist/cjs/ui/ToolbarColorSwatch.compiled.css +9 -0
  9. package/dist/cjs/ui/ToolbarColorSwatch.js +25 -0
  10. package/dist/cjs/ui/ToolbarDropdownMenu.js +2 -4
  11. package/dist/cjs/ui/icons/AIChatIcon.compiled.css +5 -0
  12. package/dist/cjs/ui/icons/AIChatIcon.js +12 -3
  13. package/dist/cjs/ui/icons/TextColorIcon.compiled.css +1 -0
  14. package/dist/cjs/ui/icons/TextColorIcon.js +30 -7
  15. package/dist/es2019/ui/Toolbar.compiled.css +1 -1
  16. package/dist/es2019/ui/Toolbar.js +1 -1
  17. package/dist/es2019/ui/ToolbarButton.compiled.css +1 -1
  18. package/dist/es2019/ui/ToolbarButton.js +3 -14
  19. package/dist/es2019/ui/ToolbarColorSwatch.compiled.css +9 -0
  20. package/dist/es2019/ui/ToolbarColorSwatch.js +19 -0
  21. package/dist/es2019/ui/ToolbarDropdownMenu.js +2 -4
  22. package/dist/es2019/ui/icons/AIChatIcon.compiled.css +5 -0
  23. package/dist/es2019/ui/icons/AIChatIcon.js +12 -3
  24. package/dist/es2019/ui/icons/TextColorIcon.compiled.css +1 -0
  25. package/dist/es2019/ui/icons/TextColorIcon.js +30 -2
  26. package/dist/esm/ui/Toolbar.compiled.css +1 -1
  27. package/dist/esm/ui/Toolbar.js +1 -1
  28. package/dist/esm/ui/ToolbarButton.compiled.css +1 -1
  29. package/dist/esm/ui/ToolbarButton.js +3 -14
  30. package/dist/esm/ui/ToolbarColorSwatch.compiled.css +9 -0
  31. package/dist/esm/ui/ToolbarColorSwatch.js +18 -0
  32. package/dist/esm/ui/ToolbarDropdownMenu.js +2 -4
  33. package/dist/esm/ui/icons/AIChatIcon.compiled.css +5 -0
  34. package/dist/esm/ui/icons/AIChatIcon.js +12 -3
  35. package/dist/esm/ui/icons/TextColorIcon.compiled.css +1 -0
  36. package/dist/esm/ui/icons/TextColorIcon.js +29 -2
  37. package/dist/types/ui/ToolbarButton.d.ts +2 -3
  38. package/dist/types/ui/ToolbarColorSwatch.d.ts +7 -0
  39. package/dist/types/ui/ToolbarDropdownMenu.d.ts +3 -4
  40. package/dist/types/ui/icons/TextColorIcon.d.ts +9 -1
  41. package/dist/types-ts4.5/ui/ToolbarButton.d.ts +2 -3
  42. package/dist/types-ts4.5/ui/ToolbarColorSwatch.d.ts +7 -0
  43. package/dist/types-ts4.5/ui/ToolbarDropdownMenu.d.ts +3 -4
  44. package/dist/types-ts4.5/ui/icons/TextColorIcon.d.ts +9 -1
  45. package/examples/toolbar/examples/ExampleManuallyComposedToolbar.tsx +62 -58
  46. package/package.json +4 -4
  47. package/src/ui/Toolbar.tsx +1 -1
  48. package/src/ui/ToolbarButton.tsx +5 -18
  49. package/src/ui/ToolbarColorSwatch.tsx +40 -0
  50. package/src/ui/ToolbarDropdownMenu.tsx +4 -7
  51. package/src/ui/icons/AIChatIcon.tsx +15 -1
  52. package/src/ui/icons/TextColorIcon.tsx +43 -2
  53. package/dist/cjs/ui/ColorIndicatorWrapper.compiled.css +0 -4
  54. package/dist/cjs/ui/ColorIndicatorWrapper.js +0 -26
  55. package/dist/cjs/ui/ToolbarDivider.compiled.css +0 -6
  56. package/dist/cjs/ui/ToolbarDivider.js +0 -20
  57. package/dist/es2019/ui/ColorIndicatorWrapper.compiled.css +0 -4
  58. package/dist/es2019/ui/ColorIndicatorWrapper.js +0 -18
  59. package/dist/es2019/ui/ToolbarDivider.compiled.css +0 -6
  60. package/dist/es2019/ui/ToolbarDivider.js +0 -13
  61. package/dist/esm/ui/ColorIndicatorWrapper.compiled.css +0 -4
  62. package/dist/esm/ui/ColorIndicatorWrapper.js +0 -19
  63. package/dist/esm/ui/ToolbarDivider.compiled.css +0 -6
  64. package/dist/esm/ui/ToolbarDivider.js +0 -13
  65. package/dist/types/ui/ColorIndicatorWrapper.d.ts +0 -7
  66. package/dist/types/ui/ToolbarDivider.d.ts +0 -2
  67. package/dist/types-ts4.5/ui/ColorIndicatorWrapper.d.ts +0 -7
  68. package/dist/types-ts4.5/ui/ToolbarDivider.d.ts +0 -2
  69. package/src/ui/ColorIndicatorWrapper.tsx +0 -25
  70. package/src/ui/ToolbarDivider.tsx +0 -20
@@ -2,8 +2,7 @@ import React from 'react';
2
2
  import DropdownMenu from '@atlaskit/dropdown-menu';
3
3
  import { ToolbarButton } from './ToolbarButton';
4
4
  export var ToolbarDropdownMenu = function ToolbarDropdownMenu(_ref) {
5
- var icon = _ref.icon,
6
- label = _ref.label,
5
+ var iconBefore = _ref.iconBefore,
7
6
  groupLocation = _ref.groupLocation,
8
7
  children = _ref.children,
9
8
  isDisabled = _ref.isDisabled;
@@ -19,8 +18,7 @@ export var ToolbarDropdownMenu = function ToolbarDropdownMenu(_ref) {
19
18
  onClick: triggerProps.onClick,
20
19
  onFocus: triggerProps.onFocus,
21
20
  testId: triggerProps.testId,
22
- icon: icon,
23
- label: label,
21
+ iconBefore: iconBefore,
24
22
  groupLocation: groupLocation,
25
23
  isDisabled: isDisabled
26
24
  });
@@ -0,0 +1,5 @@
1
+ ._1bah1h6o{justify-content:center}
2
+ ._1bsb1crf{width:9pt}
3
+ ._1e0c1txw{display:flex}
4
+ ._4cvr1h6o{align-items:center}
5
+ ._4t3i1crf{height:9pt}
@@ -1,11 +1,20 @@
1
+ /* AIChatIcon.tsx generated by @compiled/babel-plugin v0.36.1 */
2
+ import "./AIChatIcon.compiled.css";
3
+ import { ax, ix } from "@compiled/react/runtime";
1
4
  import React from 'react';
2
5
  import { RovoIcon as RovoLogoIcon } from '@atlaskit/logo';
6
+ import { Box } from '@atlaskit/primitives/compiled';
7
+ var styles = {
8
+ small: "_1e0c1txw _4cvr1h6o _1bah1h6o _4t3i1crf _1bsb1crf"
9
+ };
3
10
  export var AIChatIcon = function AIChatIcon(_ref) {
4
11
  var label = _ref.label,
5
12
  testId = _ref.testId;
6
- return /*#__PURE__*/React.createElement(RovoLogoIcon, {
13
+ return /*#__PURE__*/React.createElement(Box, {
14
+ xcss: styles.small
15
+ }, /*#__PURE__*/React.createElement(RovoLogoIcon, {
7
16
  label: label,
8
17
  testId: testId,
9
- size: "small"
10
- });
18
+ size: "xxsmall"
19
+ }));
11
20
  };
@@ -0,0 +1 @@
1
+ ._19pk1b66{margin-top:var(--ds-space-050,4px)}
@@ -1,2 +1,29 @@
1
- /* eslint-disable @atlaskit/editor/no-re-export */
2
- export { default as TextColorIcon } from '@atlaskit/icon/core/text-style';
1
+ /* TextColorIcon.tsx generated by @compiled/babel-plugin v0.36.1 */
2
+ import "./TextColorIcon.compiled.css";
3
+ import { ax, ix } from "@compiled/react/runtime";
4
+ import React from 'react';
5
+ import Icon from '@atlaskit/icon/core/text-style';
6
+ import { Box } from '@atlaskit/primitives/compiled';
7
+ var styles = {
8
+ icon: "_19pk1b66"
9
+ };
10
+ export var TextColorIcon = function TextColorIcon(_ref) {
11
+ var label = _ref.label,
12
+ shouldRecommendSmallIcon = _ref.shouldRecommendSmallIcon,
13
+ size = _ref.size,
14
+ spacing = _ref.spacing,
15
+ testId = _ref.testId,
16
+ iconColor = _ref.iconColor,
17
+ isDisabled = _ref.isDisabled;
18
+ return /*#__PURE__*/React.createElement(Box, {
19
+ as: "span",
20
+ xcss: styles.icon
21
+ }, /*#__PURE__*/React.createElement(Icon, {
22
+ label: label,
23
+ testId: testId,
24
+ color: isDisabled ? "var(--ds-icon-disabled, #091E424F)" : iconColor,
25
+ shouldRecommendSmallIcon: shouldRecommendSmallIcon,
26
+ spacing: spacing,
27
+ size: size
28
+ }));
29
+ };
@@ -1,6 +1,6 @@
1
1
  import React, { type ReactNode } from 'react';
2
2
  import { type TriggerProps } from '@atlaskit/popup';
3
- import { type IconComponent, type ToolbarButtonGroupLocation } from '../types';
3
+ import { type ToolbarButtonGroupLocation } from '../types';
4
4
  type ToolbarButtonProps = Partial<TriggerProps> & {
5
5
  children?: ReactNode;
6
6
  isSelected?: boolean;
@@ -8,8 +8,7 @@ type ToolbarButtonProps = Partial<TriggerProps> & {
8
8
  onBlur?: (event: React.FocusEvent<HTMLButtonElement>) => void;
9
9
  onFocus?: (event: React.FocusEvent<HTMLButtonElement>) => void;
10
10
  testId?: string;
11
- label: string;
12
- icon: IconComponent;
11
+ iconBefore: React.ReactNode;
13
12
  groupLocation?: ToolbarButtonGroupLocation;
14
13
  isDisabled?: boolean;
15
14
  ariaKeyshortcuts?: string;
@@ -0,0 +1,7 @@
1
+ import React, { type ReactNode } from 'react';
2
+ type ToolbarColorSwatchProps = {
3
+ children?: ReactNode;
4
+ highlightColor?: string;
5
+ };
6
+ export declare const ToolbarColorSwatch: ({ children, highlightColor, }: ToolbarColorSwatchProps) => React.JSX.Element;
7
+ export {};
@@ -1,11 +1,10 @@
1
1
  import React, { type ReactNode } from 'react';
2
- import { type IconComponent, type ToolbarButtonGroupLocation } from '../types';
2
+ import { type ToolbarButtonGroupLocation } from '../types';
3
3
  type ToolbarDropdownMenuProps = {
4
- icon: IconComponent;
5
- label: string;
4
+ iconBefore: React.ReactNode;
6
5
  children?: ReactNode;
7
6
  groupLocation?: ToolbarButtonGroupLocation;
8
7
  isDisabled?: boolean;
9
8
  };
10
- export declare const ToolbarDropdownMenu: ({ icon, label, groupLocation, children, isDisabled, }: ToolbarDropdownMenuProps) => React.JSX.Element;
9
+ export declare const ToolbarDropdownMenu: ({ iconBefore, groupLocation, children, isDisabled, }: ToolbarDropdownMenuProps) => React.JSX.Element;
11
10
  export {};
@@ -1 +1,9 @@
1
- export { default as TextColorIcon } from '@atlaskit/icon/core/text-style';
1
+ import React from 'react';
2
+ import { type NewCoreIconProps } from '@atlaskit/icon/types';
3
+ import { type IconColor } from '@atlaskit/tokens/css-type-schema';
4
+ type TextColorIconProps = NewCoreIconProps & {
5
+ iconColor?: IconColor;
6
+ isDisabled?: boolean;
7
+ };
8
+ export declare const TextColorIcon: ({ label, shouldRecommendSmallIcon, size, spacing, testId, iconColor, isDisabled, }: TextColorIconProps) => React.JSX.Element;
9
+ export {};
@@ -1,6 +1,6 @@
1
1
  import React, { type ReactNode } from 'react';
2
2
  import { type TriggerProps } from '@atlaskit/popup';
3
- import { type IconComponent, type ToolbarButtonGroupLocation } from '../types';
3
+ import { type ToolbarButtonGroupLocation } from '../types';
4
4
  type ToolbarButtonProps = Partial<TriggerProps> & {
5
5
  children?: ReactNode;
6
6
  isSelected?: boolean;
@@ -8,8 +8,7 @@ type ToolbarButtonProps = Partial<TriggerProps> & {
8
8
  onBlur?: (event: React.FocusEvent<HTMLButtonElement>) => void;
9
9
  onFocus?: (event: React.FocusEvent<HTMLButtonElement>) => void;
10
10
  testId?: string;
11
- label: string;
12
- icon: IconComponent;
11
+ iconBefore: React.ReactNode;
13
12
  groupLocation?: ToolbarButtonGroupLocation;
14
13
  isDisabled?: boolean;
15
14
  ariaKeyshortcuts?: string;
@@ -0,0 +1,7 @@
1
+ import React, { type ReactNode } from 'react';
2
+ type ToolbarColorSwatchProps = {
3
+ children?: ReactNode;
4
+ highlightColor?: string;
5
+ };
6
+ export declare const ToolbarColorSwatch: ({ children, highlightColor, }: ToolbarColorSwatchProps) => React.JSX.Element;
7
+ export {};
@@ -1,11 +1,10 @@
1
1
  import React, { type ReactNode } from 'react';
2
- import { type IconComponent, type ToolbarButtonGroupLocation } from '../types';
2
+ import { type ToolbarButtonGroupLocation } from '../types';
3
3
  type ToolbarDropdownMenuProps = {
4
- icon: IconComponent;
5
- label: string;
4
+ iconBefore: React.ReactNode;
6
5
  children?: ReactNode;
7
6
  groupLocation?: ToolbarButtonGroupLocation;
8
7
  isDisabled?: boolean;
9
8
  };
10
- export declare const ToolbarDropdownMenu: ({ icon, label, groupLocation, children, isDisabled, }: ToolbarDropdownMenuProps) => React.JSX.Element;
9
+ export declare const ToolbarDropdownMenu: ({ iconBefore, groupLocation, children, isDisabled, }: ToolbarDropdownMenuProps) => React.JSX.Element;
11
10
  export {};
@@ -1 +1,9 @@
1
- export { default as TextColorIcon } from '@atlaskit/icon/core/text-style';
1
+ import React from 'react';
2
+ import { type NewCoreIconProps } from '@atlaskit/icon/types';
3
+ import { type IconColor } from '@atlaskit/tokens/css-type-schema';
4
+ type TextColorIconProps = NewCoreIconProps & {
5
+ iconColor?: IconColor;
6
+ isDisabled?: boolean;
7
+ };
8
+ export declare const TextColorIcon: ({ label, shouldRecommendSmallIcon, size, spacing, testId, iconColor, isDisabled, }: TextColorIconProps) => React.JSX.Element;
9
+ export {};
@@ -3,8 +3,8 @@ import React, { useState } from 'react';
3
3
  import { Box } from '@atlaskit/primitives/compiled';
4
4
  import Toggle from '@atlaskit/toggle';
5
5
  import { token } from '@atlaskit/tokens';
6
+ import { type IconColor } from '@atlaskit/tokens/css-type-schema';
6
7
 
7
- import { ColorIndicatorWrapper } from '../../../src/ui/ColorIndicatorWrapper';
8
8
  import { AddIcon } from '../../../src/ui/icons/AddIcon';
9
9
  import { AIAdjustLengthIcon } from '../../../src/ui/icons/AIAdjustLengthIcon';
10
10
  import { AICasualIcon } from '../../../src/ui/icons/AICasualIcon';
@@ -41,8 +41,7 @@ import { TextIcon } from '../../../src/ui/icons/TextIcon';
41
41
  import { Toolbar } from '../../../src/ui/Toolbar';
42
42
  import { ToolbarButton } from '../../../src/ui/ToolbarButton';
43
43
  import { ToolbarButtonGroup } from '../../../src/ui/ToolbarButtonGroup';
44
- import { ToolbarDivider } from '../../../src/ui/ToolbarDivider';
45
- import { ToolbarDropdownDivider } from '../../../src/ui/ToolbarDropdownDivider';
44
+ import { ToolbarColorSwatch } from '../../../src/ui/ToolbarColorSwatch';
46
45
  import { ToolbarDropdownItem } from '../../../src/ui/ToolbarDropdownItem';
47
46
  import { ToolbarDropdownItemSection } from '../../../src/ui/ToolbarDropdownItemSection';
48
47
  import { ToolbarDropdownMenu } from '../../../src/ui/ToolbarDropdownMenu';
@@ -139,8 +138,7 @@ export const ExampleManuallyComposedToolbar = () => {
139
138
  <ToolbarButtonGroup>
140
139
  <ToolbarTooltip content="Ask Rovo">
141
140
  <ToolbarButton
142
- icon={AIChatIcon}
143
- label="Ask Rovo"
141
+ iconBefore={<AIChatIcon label="Ask Rovo" />}
144
142
  onClick={onClick('Ask Rovo')}
145
143
  groupLocation="start"
146
144
  isDisabled={isRovoDisabled}
@@ -148,7 +146,10 @@ export const ExampleManuallyComposedToolbar = () => {
148
146
  Ask Rovo
149
147
  </ToolbarButton>
150
148
  </ToolbarTooltip>
151
- <ToolbarDropdownMenu icon={MoreItemsIcon} label="More formatting" groupLocation="end">
149
+ <ToolbarDropdownMenu
150
+ iconBefore={<MoreItemsIcon label="More formatting" />}
151
+ groupLocation="end"
152
+ >
152
153
  <ToolbarDropdownItemSection>
153
154
  <ToolbarNestedDropdownMenu
154
155
  elemBefore={<AIAdjustLengthIcon label="Adjust length" />}
@@ -235,8 +236,7 @@ export const ExampleManuallyComposedToolbar = () => {
235
236
  <ToolbarButtonGroup>
236
237
  <ToolbarTooltip content="Improve writing">
237
238
  <ToolbarButton
238
- icon={AICommandIcon}
239
- label="Improve writing"
239
+ iconBefore={<AICommandIcon label="Improve writing" />}
240
240
  onClick={onClick('Improve writing')}
241
241
  isDisabled={isImproveWritingDisabled}
242
242
  >
@@ -246,26 +246,23 @@ export const ExampleManuallyComposedToolbar = () => {
246
246
  </ToolbarButtonGroup>
247
247
  </ToolbarSection>
248
248
 
249
- <ToolbarDivider />
250
-
251
249
  <ToolbarSection>
252
250
  <ToolbarButtonGroup>
253
251
  <ToolbarTooltip content="Text styles">
254
252
  <ToolbarDropdownMenu
255
- icon={
253
+ iconBefore={
256
254
  {
257
- none: TextIcon,
258
- normal: TextIcon,
259
- heading1: HeadingOneIcon,
260
- heading2: HeadingTwoIcon,
261
- heading3: HeadingThreeIcon,
262
- heading4: HeadingFourIcon,
263
- heading5: HeadingFiveIcon,
264
- heading6: HeadingSixIcon,
265
- quote: QuoteIcon,
255
+ none: <TextIcon label="Normal text" />,
256
+ normal: <TextIcon label="Normal text" />,
257
+ heading1: <HeadingOneIcon label="Heading One" />,
258
+ heading2: <HeadingTwoIcon label="Heading Two" />,
259
+ heading3: <HeadingThreeIcon label="Heading Three" />,
260
+ heading4: <HeadingFourIcon label="Heading Four" />,
261
+ heading5: <HeadingFiveIcon label="Heading Five" />,
262
+ heading6: <HeadingSixIcon label="Heading Six" />,
263
+ quote: <QuoteIcon label="Quote" />,
266
264
  }[textStyle]
267
265
  }
268
- label="Text styles"
269
266
  isDisabled={isTextStylesDisabled}
270
267
  >
271
268
  <ToolbarDropdownItemSection>
@@ -357,8 +354,13 @@ export const ExampleManuallyComposedToolbar = () => {
357
354
  <ToolbarButtonGroup>
358
355
  <ToolbarTooltip content={formatting.italic && !formatting.bold ? 'Italic' : 'Bold'}>
359
356
  <ToolbarButton
360
- icon={formatting.italic && !formatting.bold ? ItalicIcon : BoldIcon}
361
- label={formatting.italic && !formatting.bold ? 'Italic' : 'Bold'}
357
+ iconBefore={
358
+ formatting.italic && !formatting.bold ? (
359
+ <ItalicIcon label="Italic" />
360
+ ) : (
361
+ <BoldIcon label="Bold" />
362
+ )
363
+ }
362
364
  onClick={onClick(
363
365
  formatting.italic && !formatting.bold ? 'Italic' : 'Bold',
364
366
  onToggleFormatting(formatting.italic && !formatting.bold ? 'italic' : 'bold'),
@@ -369,7 +371,10 @@ export const ExampleManuallyComposedToolbar = () => {
369
371
  ariaKeyshortcuts={formatting.italic && !formatting.bold ? '⌘I' : '⌘B'}
370
372
  />
371
373
  </ToolbarTooltip>
372
- <ToolbarDropdownMenu icon={MoreItemsIcon} label="More formatting" groupLocation="end">
374
+ <ToolbarDropdownMenu
375
+ iconBefore={<MoreItemsIcon label="More formatting" />}
376
+ groupLocation="end"
377
+ >
373
378
  <ToolbarDropdownItemSection>
374
379
  <ToolbarDropdownItem
375
380
  elemBefore={<BoldIcon label="Bold" />}
@@ -392,7 +397,6 @@ export const ExampleManuallyComposedToolbar = () => {
392
397
  Italic
393
398
  </ToolbarDropdownItem>
394
399
  </ToolbarDropdownItemSection>
395
- <ToolbarDropdownDivider />
396
400
  <ToolbarDropdownItemSection>
397
401
  <ToolbarDropdownItem
398
402
  elemBefore={<ClearFormattingIcon label="Clear formatting" />}
@@ -405,23 +409,23 @@ export const ExampleManuallyComposedToolbar = () => {
405
409
  </ToolbarDropdownItemSection>
406
410
  </ToolbarDropdownMenu>
407
411
  </ToolbarButtonGroup>
408
-
409
412
  <ToolbarButtonGroup>
410
413
  <ToolbarTooltip content="Text color">
411
414
  <ToolbarDropdownMenu
412
- icon={({ label, color, shouldRecommendSmallIcon, size, spacing, testId }) => (
413
- <ColorIndicatorWrapper color={token('color.border.accent.blue')}>
415
+ iconBefore={
416
+ <ToolbarColorSwatch
417
+ highlightColor={token('color.background.accent.blue.subtlest')}
418
+ >
414
419
  <TextColorIcon
415
- label={label}
416
- color={color}
417
- shouldRecommendSmallIcon={shouldRecommendSmallIcon}
418
- size={size}
419
- spacing={spacing}
420
- testId={testId}
420
+ label={'Text color'}
421
+ iconColor={token('color.text.accent.magenta') as IconColor}
422
+ shouldRecommendSmallIcon={true}
423
+ size={'small'}
424
+ isDisabled={isTextColorDisabled}
425
+ spacing={'compact'}
421
426
  />
422
- </ColorIndicatorWrapper>
423
- )}
424
- label="Text color"
427
+ </ToolbarColorSwatch>
428
+ }
425
429
  isDisabled={isTextColorDisabled}
426
430
  >
427
431
  <ToolbarDropdownItemSection>
@@ -441,8 +445,13 @@ export const ExampleManuallyComposedToolbar = () => {
441
445
  content={listOrAlignment === 'numbered' ? 'Numbered list' : 'Bulleted list'}
442
446
  >
443
447
  <ToolbarButton
444
- icon={listOrAlignment === 'numbered' ? ListNumberedIcon : ListBulletedIcon}
445
- label={listOrAlignment === 'numbered' ? 'Numbered list' : 'Bulleted list'}
448
+ iconBefore={
449
+ listOrAlignment === 'numbered' ? (
450
+ <ListNumberedIcon label="Numbered list" />
451
+ ) : (
452
+ <ListBulletedIcon label="Bulleted list" />
453
+ )
454
+ }
446
455
  onClick={onClick(
447
456
  listOrAlignment === 'numbered' ? 'Numbered list' : 'Bulleted list',
448
457
  onToggleListOrAlignment(listOrAlignment === 'numbered' ? 'numbered' : 'bulleted'),
@@ -455,8 +464,7 @@ export const ExampleManuallyComposedToolbar = () => {
455
464
  />
456
465
  </ToolbarTooltip>
457
466
  <ToolbarDropdownMenu
458
- icon={MoreItemsIcon}
459
- label="Lists, indentation and alignment"
467
+ iconBefore={<MoreItemsIcon label="Lists, indentation and alignment" />}
460
468
  groupLocation="end"
461
469
  >
462
470
  <ToolbarDropdownItemSection>
@@ -485,14 +493,11 @@ export const ExampleManuallyComposedToolbar = () => {
485
493
  </ToolbarButtonGroup>
486
494
  </ToolbarSection>
487
495
 
488
- <ToolbarDivider />
489
-
490
496
  <ToolbarSection>
491
497
  <ToolbarButtonGroup>
492
498
  <ToolbarTooltip content="Link">
493
499
  <ToolbarButton
494
- icon={LinkIcon}
495
- label="Link"
500
+ iconBefore={<LinkIcon label="Link" />}
496
501
  onClick={onClick('Link')}
497
502
  isDisabled={isLinkDisabled}
498
503
  />
@@ -500,29 +505,25 @@ export const ExampleManuallyComposedToolbar = () => {
500
505
  </ToolbarButtonGroup>
501
506
  </ToolbarSection>
502
507
 
503
- <ToolbarDivider />
504
-
505
508
  <ToolbarSection>
506
509
  <ToolbarButtonGroup>
507
510
  <ToolbarTooltip content="Comment">
508
511
  <ToolbarButton
509
- icon={CommentIcon}
510
- label="Comment"
512
+ iconBefore={<CommentIcon label="Comment" />}
511
513
  onClick={onClick('Comment')}
512
514
  isDisabled={isCommentDisabled}
513
- />
515
+ >
516
+ Comment
517
+ </ToolbarButton>
514
518
  </ToolbarTooltip>
515
519
  </ToolbarButtonGroup>
516
520
  </ToolbarSection>
517
521
 
518
- <ToolbarDivider />
519
-
520
522
  <ToolbarSection>
521
523
  <ToolbarButtonGroup>
522
524
  <ToolbarTooltip content="Apps and extensions">
523
525
  <ToolbarDropdownMenu
524
- icon={AppsIcon}
525
- label="Apps and extensions"
526
+ iconBefore={<AppsIcon label="Apps and extensions" />}
526
527
  isDisabled={isAppsAndExtensionsDisabled}
527
528
  >
528
529
  <ToolbarDropdownItemSection>
@@ -539,16 +540,19 @@ export const ExampleManuallyComposedToolbar = () => {
539
540
  </ToolbarButtonGroup>
540
541
  </ToolbarSection>
541
542
 
542
- <ToolbarDivider />
543
-
544
543
  <ToolbarSection>
545
544
  <ToolbarButtonGroup>
546
545
  <ToolbarTooltip
547
546
  content={pinning === 'pinned' ? 'Unpin the toolbar' : 'Pin the toolbar at the top'}
548
547
  >
549
548
  <ToolbarButton
550
- icon={pinning === 'pinned' ? PinnedIcon : PinIcon}
551
- label={pinning === 'pinned' ? 'Unpin toolbar' : 'Pin toolbar'}
549
+ iconBefore={
550
+ pinning === 'pinned' ? (
551
+ <PinnedIcon label="Unpin toolbar" />
552
+ ) : (
553
+ <PinIcon label="Pin toolbar" />
554
+ )
555
+ }
552
556
  onClick={onClick(
553
557
  pinning === 'pinned' ? 'Unpin toolbar' : 'Pin toolbar',
554
558
  onTogglePinning,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "registry": "https://registry.npmjs.org/"
5
5
  },
6
- "version": "0.0.5",
6
+ "version": "0.0.7",
7
7
  "description": "Common UI for Toolbars across the platform",
8
8
  "atlassian": {
9
9
  "team": "Editor: Jenga",
@@ -28,12 +28,12 @@
28
28
  "@atlaskit/button": "^23.3.0",
29
29
  "@atlaskit/css": "^0.12.0",
30
30
  "@atlaskit/dropdown-menu": "^16.3.0",
31
- "@atlaskit/icon": "^27.8.0",
32
- "@atlaskit/icon-lab": "^5.2.0",
31
+ "@atlaskit/icon": "^27.9.0",
32
+ "@atlaskit/icon-lab": "^5.3.0",
33
33
  "@atlaskit/logo": "^19.6.0",
34
34
  "@atlaskit/popup": "^4.3.0",
35
35
  "@atlaskit/primitives": "^14.11.0",
36
- "@atlaskit/tokens": "^5.6.0",
36
+ "@atlaskit/tokens": "^6.0.0",
37
37
  "@atlaskit/tooltip": "^20.4.0",
38
38
  "@babel/runtime": "^7.0.0",
39
39
  "@compiled/react": "^0.18.3"
@@ -10,7 +10,7 @@ const styles = cssMap({
10
10
  paddingLeft: token('space.050'),
11
11
  boxShadow: token('elevation.shadow.overlay'),
12
12
  borderRadius: '6px',
13
- height: '40px',
13
+ height: '36px',
14
14
  width: 'min-content',
15
15
  display: 'flex',
16
16
  alignItems: 'center',
@@ -5,13 +5,7 @@ import { type TriggerProps } from '@atlaskit/popup';
5
5
  import { Pressable } from '@atlaskit/primitives/compiled';
6
6
  import { token } from '@atlaskit/tokens';
7
7
 
8
- import { type IconComponent, type ToolbarButtonGroupLocation } from '../types';
9
-
10
- const ICON_COLOR = {
11
- default: token('color.icon.subtle'),
12
- disabled: token('color.icon.disabled'),
13
- selected: token('color.icon.selected'),
14
- };
8
+ import { type ToolbarButtonGroupLocation } from '../types';
15
9
 
16
10
  const styles = cssMap({
17
11
  button: {
@@ -22,7 +16,7 @@ const styles = cssMap({
22
16
  alignItems: 'center',
23
17
  justifyContent: 'center',
24
18
  borderRadius: token('border.radius.100'),
25
- minHeight: '32px',
19
+ minHeight: '28px',
26
20
  color: token('color.text.subtle'),
27
21
  fontWeight: token('font.weight.medium'),
28
22
  paddingLeft: token('space.100'),
@@ -85,8 +79,7 @@ type ToolbarButtonProps = Partial<TriggerProps> & {
85
79
  onBlur?: (event: React.FocusEvent<HTMLButtonElement>) => void;
86
80
  onFocus?: (event: React.FocusEvent<HTMLButtonElement>) => void;
87
81
  testId?: string;
88
- label: string;
89
- icon: IconComponent;
82
+ iconBefore: React.ReactNode;
90
83
  groupLocation?: ToolbarButtonGroupLocation;
91
84
  isDisabled?: boolean;
92
85
  ariaKeyshortcuts?: string;
@@ -95,8 +88,7 @@ type ToolbarButtonProps = Partial<TriggerProps> & {
95
88
  export const ToolbarButton = forwardRef(
96
89
  (
97
90
  {
98
- icon: IconComponent,
99
- label,
91
+ iconBefore,
100
92
  children,
101
93
  onClick,
102
94
  isSelected,
@@ -113,11 +105,6 @@ export const ToolbarButton = forwardRef(
113
105
  }: ToolbarButtonProps,
114
106
  ref: Ref<HTMLButtonElement>,
115
107
  ) => {
116
- const iconColor = isDisabled
117
- ? ICON_COLOR.disabled
118
- : isSelected
119
- ? ICON_COLOR.selected
120
- : ICON_COLOR.default;
121
108
  return (
122
109
  <Pressable
123
110
  ref={ref}
@@ -140,7 +127,7 @@ export const ToolbarButton = forwardRef(
140
127
  testId={testId}
141
128
  isDisabled={isDisabled}
142
129
  >
143
- <IconComponent label={label} size="medium" color={iconColor} />
130
+ {iconBefore}
144
131
  {children}
145
132
  </Pressable>
146
133
  );
@@ -0,0 +1,40 @@
1
+ import React, { type ReactNode } from 'react';
2
+
3
+ import { cssMap } from '@atlaskit/css';
4
+ import { Box } from '@atlaskit/primitives/compiled';
5
+ import { token } from '@atlaskit/tokens';
6
+
7
+ type ToolbarColorSwatchProps = {
8
+ children?: ReactNode;
9
+ highlightColor?: string;
10
+ };
11
+
12
+ const styles = cssMap({
13
+ colorSwatch: {
14
+ display: 'flex',
15
+ justifyContent: 'center',
16
+ alignItems: 'center',
17
+ border: `${token('border.width')} solid ${token('color.border')}`,
18
+ borderRadius: token('border.radius.100'),
19
+ width: '20px',
20
+ height: '20px',
21
+ marginLeft: token('space.negative.050'),
22
+ marginRight: token('space.negative.050'),
23
+ },
24
+ });
25
+
26
+ export const ToolbarColorSwatch = ({
27
+ children,
28
+ highlightColor,
29
+ }: ToolbarColorSwatchProps) => {
30
+ return (
31
+ <Box
32
+ xcss={styles.colorSwatch}
33
+ style={{
34
+ backgroundColor: highlightColor,
35
+ }}
36
+ >
37
+ {children}
38
+ </Box>
39
+ );
40
+ };
@@ -2,21 +2,19 @@ import React, { type ReactNode } from 'react';
2
2
 
3
3
  import DropdownMenu from '@atlaskit/dropdown-menu';
4
4
 
5
- import { type IconComponent, type ToolbarButtonGroupLocation } from '../types';
5
+ import { type ToolbarButtonGroupLocation } from '../types';
6
6
 
7
7
  import { ToolbarButton } from './ToolbarButton';
8
8
 
9
9
  type ToolbarDropdownMenuProps = {
10
- icon: IconComponent;
11
- label: string;
10
+ iconBefore: React.ReactNode;
12
11
  children?: ReactNode;
13
12
  groupLocation?: ToolbarButtonGroupLocation;
14
13
  isDisabled?: boolean;
15
14
  };
16
15
 
17
16
  export const ToolbarDropdownMenu = ({
18
- icon,
19
- label,
17
+ iconBefore,
20
18
  groupLocation,
21
19
  children,
22
20
  isDisabled,
@@ -34,8 +32,7 @@ export const ToolbarDropdownMenu = ({
34
32
  onClick={triggerProps.onClick}
35
33
  onFocus={triggerProps.onFocus}
36
34
  testId={triggerProps.testId}
37
- icon={icon}
38
- label={label}
35
+ iconBefore={iconBefore}
39
36
  groupLocation={groupLocation}
40
37
  isDisabled={isDisabled}
41
38
  />
@@ -1,12 +1,26 @@
1
1
  import React from 'react';
2
2
 
3
+ import { cssMap } from '@atlaskit/css';
3
4
  import { RovoIcon as RovoLogoIcon } from '@atlaskit/logo';
5
+ import { Box } from '@atlaskit/primitives/compiled';
4
6
 
5
7
  type AIChatIconProps = {
6
8
  label: string;
7
9
  testId?: string;
8
10
  };
9
11
 
12
+ const styles = cssMap({
13
+ small: {
14
+ display: 'flex',
15
+ alignItems: 'center',
16
+ justifyContent: 'center',
17
+ height: '12px',
18
+ width: '12px',
19
+ },
20
+ });
21
+
10
22
  export const AIChatIcon = ({ label, testId }: AIChatIconProps) => (
11
- <RovoLogoIcon label={label} testId={testId} size="small" />
23
+ <Box xcss={styles.small}>
24
+ <RovoLogoIcon label={label} testId={testId} size="xxsmall" />
25
+ </Box>
12
26
  );