@atlaskit/editor-toolbar 0.0.1 → 0.0.3

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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-toolbar
2
2
 
3
+ ## 0.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#192616](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/192616)
8
+ [`b97ca8e19b601`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b97ca8e19b601) -
9
+ [ED-28595] add aria-attributes to toolbar button and toolbar dropdown item
10
+ - Updated dependencies
11
+
12
+ ## 0.0.2
13
+
14
+ ### Patch Changes
15
+
16
+ - [#189216](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/189216)
17
+ [`b4ba899b6cf55`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b4ba899b6cf55) -
18
+ [ux] ED-28546 add nested flyouts to ui primitive library
19
+ - Updated dependencies
20
+
3
21
  ## 0.0.1
4
22
 
5
23
  ### Patch Changes
@@ -7,10 +7,19 @@ import { token } from '@atlaskit/tokens';
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
+ import { AICasualIcon } from '../../../src/ui/icons/AICasualIcon';
11
+ import { AIChangeToneIcon } from '../../../src/ui/icons/AIChangeToneIcon';
10
12
  import { AIChatIcon } from '../../../src/ui/icons/AIChatIcon';
11
13
  import { AICommandIcon } from '../../../src/ui/icons/AICommandIcon';
14
+ import { AIHeartIcon } from '../../../src/ui/icons/AIHeartIcon';
15
+ import { AILenghtenIcon } from '../../../src/ui/icons/AILengthenIcon';
16
+ import { AIBriefcaseIcon } from '../../../src/ui/icons/AIProfessionalIcon';
17
+ import { AIShortenIcon } from '../../../src/ui/icons/AIShortenIcon';
18
+ import { AISpellcheckIcon } from '../../../src/ui/icons/AISpellcheckIcon';
19
+ import { AITranslateIcon } from '../../../src/ui/icons/AITranslateIcon';
12
20
  import { AppsIcon } from '../../../src/ui/icons/AppsIcon';
13
21
  import { BoldIcon } from '../../../src/ui/icons/BoldIcon';
22
+ import { ClearFormattingIcon } from '../../../src/ui/icons/ClearFormattingIcon';
14
23
  import { CommentIcon } from '../../../src/ui/icons/CommentIcon';
15
24
  import { HeadingFiveIcon } from '../../../src/ui/icons/HeadingFiveIcon';
16
25
  import { HeadingFourIcon } from '../../../src/ui/icons/HeadingFourIcon';
@@ -23,6 +32,7 @@ import { LinkIcon } from '../../../src/ui/icons/LinkIcon';
23
32
  import { ListBulletedIcon } from '../../../src/ui/icons/ListBulletedIcon';
24
33
  import { ListNumberedIcon } from '../../../src/ui/icons/ListNumberedIcon';
25
34
  import { MoreItemsIcon } from '../../../src/ui/icons/MoreItemsIcon';
35
+ import { NestedDropdownRightIcon } from '../../../src/ui/icons/NestedDropdownRightIcon';
26
36
  import { PinIcon } from '../../../src/ui/icons/PinIcon';
27
37
  import { PinnedIcon } from '../../../src/ui/icons/PinnedIcon';
28
38
  import { QuoteIcon } from '../../../src/ui/icons/QuoteIcon';
@@ -32,9 +42,12 @@ import { Toolbar } from '../../../src/ui/Toolbar';
32
42
  import { ToolbarButton } from '../../../src/ui/ToolbarButton';
33
43
  import { ToolbarButtonGroup } from '../../../src/ui/ToolbarButtonGroup';
34
44
  import { ToolbarDivider } from '../../../src/ui/ToolbarDivider';
45
+ import { ToolbarDropdownDivider } from '../../../src/ui/ToolbarDropdownDivider';
35
46
  import { ToolbarDropdownItem } from '../../../src/ui/ToolbarDropdownItem';
47
+ import { ToolbarDropdownItemSection } from '../../../src/ui/ToolbarDropdownItemSection';
36
48
  import { ToolbarDropdownMenu } from '../../../src/ui/ToolbarDropdownMenu';
37
49
  import { ToolbarKeyboardShortcutHint } from '../../../src/ui/ToolbarKeyboardShortcutHint';
50
+ import { ToolbarNestedDropdownMenu } from '../../../src/ui/ToolbarNestedDropdownMenu';
38
51
  import { ToolbarSection } from '../../../src/ui/ToolbarSection';
39
52
  import { ToolbarTooltip } from '../../../src/ui/ToolbarTooltip';
40
53
 
@@ -57,67 +70,67 @@ export const ExampleManuallyComposedToolbar = () => {
57
70
  const [isRovoDisabled, setIsRovoDisabled] = useState(false);
58
71
  const toggleRovoButton = () => {
59
72
  setIsRovoDisabled(!isRovoDisabled);
60
- }
73
+ };
61
74
 
62
75
  const [isAdjustLengthDisabled, setIsAdjustLengthDisabled] = useState(false);
63
76
  const toggleAdjustLengthButton = () => {
64
77
  setIsAdjustLengthDisabled(!isAdjustLengthDisabled);
65
- }
78
+ };
66
79
 
67
80
  const [isTextStylesDisabled, setIsTextStylesDisabled] = useState(false);
68
81
  const toggleTextStylesButton = () => {
69
82
  setIsTextStylesDisabled(!isTextStylesDisabled);
70
- }
83
+ };
71
84
 
72
85
  const [isImproveWritingDisabled, setIsImproveWritingDisabled] = useState(false);
73
86
  const toggleImproveWritingButton = () => {
74
87
  setIsImproveWritingDisabled(!isImproveWritingDisabled);
75
- }
88
+ };
76
89
 
77
90
  const [isBoldDisabled, setIsBoldDisabled] = useState(false);
78
91
  const toggleBoldStyle = () => {
79
92
  setIsBoldDisabled(!isBoldDisabled);
80
- }
93
+ };
81
94
 
82
95
  const [isItalicDisabled, setIsItalicDisabled] = useState(false);
83
96
  const toggleItalicStyle = () => {
84
97
  setIsItalicDisabled(!isItalicDisabled);
85
- }
98
+ };
86
99
 
87
100
  const [isTextColorDisabled, setIsTextColorDisabled] = useState(false);
88
101
  const toggleTextColorButton = () => {
89
102
  setIsTextColorDisabled(!isTextColorDisabled);
90
- }
103
+ };
91
104
 
92
105
  const [isBulletedListDisabled, setIsBulletedListDisabled] = useState(false);
93
106
  const toggleBulletedListButton = () => {
94
107
  setIsBulletedListDisabled(!isBulletedListDisabled);
95
- }
108
+ };
96
109
 
97
110
  const [isNumberedListDisabled, setIsNumberedListDisabled] = useState(false);
98
111
  const toggleNumberedListButton = () => {
99
112
  setIsNumberedListDisabled(!isNumberedListDisabled);
100
- }
113
+ };
101
114
 
102
115
  const [isLinkDisabled, setIsLinkDisabled] = useState(false);
103
116
  const toggleLinkButton = () => {
104
117
  setIsLinkDisabled(!isLinkDisabled);
105
- }
118
+ };
106
119
 
107
120
  const [isCommentDisabled, setIsCommentDisabled] = useState(false);
108
121
  const toggleCommentButton = () => {
109
122
  setIsCommentDisabled(!isCommentDisabled);
110
- }
123
+ };
111
124
 
112
125
  const [isCreateJiraWorkItemDisabled, setIsCreateJiraWorkItemDisabled] = useState(false);
113
126
  const toggleCreateJiraWorkItemButton = () => {
114
127
  setIsCreateJiraWorkItemDisabled(!isCreateJiraWorkItemDisabled);
115
- }
128
+ };
116
129
 
117
130
  const [isAppsAndExtensionsDisabled, setIsAppsAndExtensionsDisabled] = useState(false);
118
131
  const toggleAppsAndExtensionsButton = () => {
119
132
  setIsAppsAndExtensionsDisabled(!isAppsAndExtensionsDisabled);
120
- }
133
+ };
121
134
 
122
135
  return (
123
136
  <>
@@ -136,16 +149,89 @@ export const ExampleManuallyComposedToolbar = () => {
136
149
  </ToolbarButton>
137
150
  </ToolbarTooltip>
138
151
  <ToolbarDropdownMenu icon={MoreItemsIcon} label="More formatting" groupLocation="end">
139
- <ToolbarDropdownItem
140
- elemBefore={<AIAdjustLengthIcon label="Adjust length" />}
141
- onClick={onClick('Adjust length')}
142
- isDisabled={isAdjustLengthDisabled}
143
- >
144
- Adjust length
145
- </ToolbarDropdownItem>
152
+ <ToolbarDropdownItemSection>
153
+ <ToolbarNestedDropdownMenu
154
+ elemBefore={<AIAdjustLengthIcon label="Adjust length" />}
155
+ text="Adjust length"
156
+ elemAfter={<NestedDropdownRightIcon label={'Choose desired tone'} />}
157
+ isDisabled={isAdjustLengthDisabled}
158
+ >
159
+ <ToolbarDropdownItemSection>
160
+ <ToolbarDropdownItem
161
+ elemBefore={<AIShortenIcon label="Make shorter" />}
162
+ onClick={onClick('Make shorter')}
163
+ >
164
+ Make shorter
165
+ </ToolbarDropdownItem>
166
+ <ToolbarDropdownItem
167
+ elemBefore={<AILenghtenIcon label="Make longer" />}
168
+ onClick={onClick('Make longer')}
169
+ >
170
+ Make longer
171
+ </ToolbarDropdownItem>
172
+ </ToolbarDropdownItemSection>
173
+ </ToolbarNestedDropdownMenu>
174
+ <ToolbarNestedDropdownMenu
175
+ elemBefore={<AIChangeToneIcon label="Change tone" />}
176
+ text="Change tone"
177
+ elemAfter={<NestedDropdownRightIcon label={'Choose desired tone'} />}
178
+ >
179
+ <ToolbarDropdownItemSection>
180
+ <ToolbarDropdownItem
181
+ elemBefore={<AIBriefcaseIcon label="More professional" />}
182
+ onClick={onClick('More professional')}
183
+ >
184
+ More professional
185
+ </ToolbarDropdownItem>
186
+ <ToolbarDropdownItem
187
+ elemBefore={<AICasualIcon label="More casual" />}
188
+ onClick={onClick('More casual')}
189
+ >
190
+ More casual
191
+ </ToolbarDropdownItem>
192
+ <ToolbarDropdownItem
193
+ elemBefore={<AIHeartIcon label="More empathetic" />}
194
+ onClick={onClick('More empathetic')}
195
+ >
196
+ More empathetic
197
+ </ToolbarDropdownItem>
198
+ </ToolbarDropdownItemSection>
199
+ </ToolbarNestedDropdownMenu>
200
+ <ToolbarDropdownItem
201
+ elemBefore={<AISpellcheckIcon label="Fix spelling and grammar" />}
202
+ onClick={onClick('Fix spelling and grammar')}
203
+ >
204
+ Fix spelling and grammar
205
+ </ToolbarDropdownItem>
206
+ <ToolbarNestedDropdownMenu
207
+ elemBefore={<AITranslateIcon label="Translate" />}
208
+ text="Translate"
209
+ elemAfter={<NestedDropdownRightIcon label={'Choose language option'} />}
210
+ >
211
+ <ToolbarDropdownItemSection>
212
+ <ToolbarDropdownItem
213
+ elemBefore={<AITranslateIcon label="Language 1" />}
214
+ onClick={onClick('Language 1')}
215
+ >
216
+ Language 1
217
+ </ToolbarDropdownItem>
218
+ <ToolbarDropdownItem
219
+ elemBefore={<AITranslateIcon label="Language 2" />}
220
+ onClick={onClick('More casual')}
221
+ >
222
+ Language 2
223
+ </ToolbarDropdownItem>
224
+ <ToolbarDropdownItem
225
+ elemBefore={<AITranslateIcon label="Language 3" />}
226
+ onClick={onClick('Language 3')}
227
+ >
228
+ Language 3
229
+ </ToolbarDropdownItem>
230
+ </ToolbarDropdownItemSection>
231
+ </ToolbarNestedDropdownMenu>
232
+ </ToolbarDropdownItemSection>
146
233
  </ToolbarDropdownMenu>
147
234
  </ToolbarButtonGroup>
148
-
149
235
  <ToolbarButtonGroup>
150
236
  <ToolbarTooltip content="Improve writing">
151
237
  <ToolbarButton
@@ -182,78 +268,88 @@ export const ExampleManuallyComposedToolbar = () => {
182
268
  label="Text styles"
183
269
  isDisabled={isTextStylesDisabled}
184
270
  >
185
- <ToolbarDropdownItem
186
- elemBefore={<TextIcon label="Normal text" />}
187
- elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⌥0" />}
188
- onClick={onClick('Normal text', onSetTextStyle('normal'))}
189
- isSelected={textStyle === 'normal'}
190
- textStyle="normal"
191
- >
192
- Normal text
193
- </ToolbarDropdownItem>
194
- <ToolbarDropdownItem
195
- elemBefore={<HeadingOneIcon label="Heading One" />}
196
- elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⌥1" />}
197
- onClick={onClick('Heading one', onSetTextStyle('heading1'))}
198
- isSelected={textStyle === 'heading1'}
199
- textStyle="heading1"
200
- >
201
- Heading 1
202
- </ToolbarDropdownItem>
203
- <ToolbarDropdownItem
204
- elemBefore={<HeadingTwoIcon label="Heading Two" />}
205
- elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⌥2" />}
206
- onClick={onClick('Heading two', onSetTextStyle('heading2'))}
207
- isSelected={textStyle === 'heading2'}
208
- textStyle="heading2"
209
- >
210
- Heading 2
211
- </ToolbarDropdownItem>
212
- <ToolbarDropdownItem
213
- elemBefore={<HeadingThreeIcon label="Heading Three" />}
214
- elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⌥3" />}
215
- onClick={onClick('Heading three', onSetTextStyle('heading3'))}
216
- isSelected={textStyle === 'heading3'}
217
- textStyle="heading3"
218
- >
219
- Heading 3
220
- </ToolbarDropdownItem>
221
- <ToolbarDropdownItem
222
- elemBefore={<HeadingFourIcon label="Heading Four" />}
223
- elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⌥4" />}
224
- onClick={onClick('Heading four', onSetTextStyle('heading4'))}
225
- isSelected={textStyle === 'heading4'}
226
- textStyle="heading4"
227
- >
228
- Heading 4
229
- </ToolbarDropdownItem>
230
- <ToolbarDropdownItem
231
- elemBefore={<HeadingFiveIcon label="Heading Five" />}
232
- elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⌥5" />}
233
- onClick={onClick('Heading five', onSetTextStyle('heading5'))}
234
- isSelected={textStyle === 'heading5'}
235
- textStyle="heading5"
236
- >
237
- Heading 5
238
- </ToolbarDropdownItem>
239
- <ToolbarDropdownItem
240
- elemBefore={<HeadingSixIcon label="Heading Six" />}
241
- elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⌥6" />}
242
- onClick={onClick('Heading six', onSetTextStyle('heading6'))}
243
- isSelected={textStyle === 'heading6'}
244
- textStyle="heading6"
245
- >
246
- Heading 6
247
- </ToolbarDropdownItem>
248
- <ToolbarDropdownItem
249
- elemBefore={<QuoteIcon label="Quote" />}
250
- elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⌥9" />}
251
- onClick={onClick('Quote', onSetTextStyle('quote'))}
252
- isSelected={textStyle === 'quote'}
253
- textStyle="normal"
254
- >
255
- Quote
256
- </ToolbarDropdownItem>
271
+ <ToolbarDropdownItemSection>
272
+ <ToolbarDropdownItem
273
+ elemBefore={<TextIcon label="Normal text" />}
274
+ elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⌥0" />}
275
+ onClick={onClick('Normal text', onSetTextStyle('normal'))}
276
+ isSelected={textStyle === 'normal'}
277
+ textStyle="normal"
278
+ ariaKeyshortcuts="⌘⌥0"
279
+ >
280
+ Normal text
281
+ </ToolbarDropdownItem>
282
+ <ToolbarDropdownItem
283
+ elemBefore={<HeadingOneIcon label="Heading One" />}
284
+ elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⌥1" />}
285
+ onClick={onClick('Heading one', onSetTextStyle('heading1'))}
286
+ isSelected={textStyle === 'heading1'}
287
+ textStyle="heading1"
288
+ ariaKeyshortcuts="⌘⌥1"
289
+ >
290
+ Heading 1
291
+ </ToolbarDropdownItem>
292
+ <ToolbarDropdownItem
293
+ elemBefore={<HeadingTwoIcon label="Heading Two" />}
294
+ elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⌥2" />}
295
+ onClick={onClick('Heading two', onSetTextStyle('heading2'))}
296
+ isSelected={textStyle === 'heading2'}
297
+ textStyle="heading2"
298
+ ariaKeyshortcuts="⌘⌥2"
299
+ >
300
+ Heading 2
301
+ </ToolbarDropdownItem>
302
+ <ToolbarDropdownItem
303
+ elemBefore={<HeadingThreeIcon label="Heading Three" />}
304
+ elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⌥3" />}
305
+ onClick={onClick('Heading three', onSetTextStyle('heading3'))}
306
+ isSelected={textStyle === 'heading3'}
307
+ textStyle="heading3"
308
+ ariaKeyshortcuts="⌘⌥3"
309
+ >
310
+ Heading 3
311
+ </ToolbarDropdownItem>
312
+ <ToolbarDropdownItem
313
+ elemBefore={<HeadingFourIcon label="Heading Four" />}
314
+ elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⌥4" />}
315
+ onClick={onClick('Heading four', onSetTextStyle('heading4'))}
316
+ isSelected={textStyle === 'heading4'}
317
+ textStyle="heading4"
318
+ ariaKeyshortcuts="⌘⌥4"
319
+ >
320
+ Heading 4
321
+ </ToolbarDropdownItem>
322
+ <ToolbarDropdownItem
323
+ elemBefore={<HeadingFiveIcon label="Heading Five" />}
324
+ elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⌥5" />}
325
+ onClick={onClick('Heading five', onSetTextStyle('heading5'))}
326
+ isSelected={textStyle === 'heading5'}
327
+ textStyle="heading5"
328
+ ariaKeyshortcuts="⌘⌥5"
329
+ >
330
+ Heading 5
331
+ </ToolbarDropdownItem>
332
+ <ToolbarDropdownItem
333
+ elemBefore={<HeadingSixIcon label="Heading Six" />}
334
+ elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⌥6" />}
335
+ onClick={onClick('Heading six', onSetTextStyle('heading6'))}
336
+ isSelected={textStyle === 'heading6'}
337
+ textStyle="heading6"
338
+ ariaKeyshortcuts="⌘⌥6"
339
+ >
340
+ Heading 6
341
+ </ToolbarDropdownItem>
342
+ <ToolbarDropdownItem
343
+ elemBefore={<QuoteIcon label="Quote" />}
344
+ elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⌥9" />}
345
+ onClick={onClick('Quote', onSetTextStyle('quote'))}
346
+ isSelected={textStyle === 'quote'}
347
+ textStyle="normal"
348
+ ariaKeyshortcuts="⌘⌥9"
349
+ >
350
+ Quote
351
+ </ToolbarDropdownItem>
352
+ </ToolbarDropdownItemSection>
257
353
  </ToolbarDropdownMenu>
258
354
  </ToolbarTooltip>
259
355
  </ToolbarButtonGroup>
@@ -270,27 +366,43 @@ export const ExampleManuallyComposedToolbar = () => {
270
366
  groupLocation="start"
271
367
  isSelected={formatting.bold || formatting.italic}
272
368
  isDisabled={formatting.italic ? isItalicDisabled : isBoldDisabled}
369
+ ariaKeyshortcuts={formatting.italic && !formatting.bold ? '⌘I' : '⌘B'}
273
370
  />
274
371
  </ToolbarTooltip>
275
372
  <ToolbarDropdownMenu icon={MoreItemsIcon} label="More formatting" groupLocation="end">
276
- <ToolbarDropdownItem
277
- elemBefore={<BoldIcon label="Bold" />}
278
- elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘B" />}
279
- onClick={onClick('Bold', onToggleFormatting('bold'))}
280
- isSelected={formatting.bold}
281
- isDisabled={isBoldDisabled}
282
- >
283
- Bold
284
- </ToolbarDropdownItem>
285
- <ToolbarDropdownItem
286
- elemBefore={<ItalicIcon label="Italic" />}
287
- elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘I" />}
288
- onClick={onClick('Italic', onToggleFormatting('italic'))}
289
- isSelected={formatting.italic}
290
- isDisabled={isItalicDisabled}
291
- >
292
- Italic
293
- </ToolbarDropdownItem>
373
+ <ToolbarDropdownItemSection>
374
+ <ToolbarDropdownItem
375
+ elemBefore={<BoldIcon label="Bold" />}
376
+ elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘B" />}
377
+ onClick={onClick('Bold', onToggleFormatting('bold'))}
378
+ isSelected={formatting.bold}
379
+ isDisabled={isBoldDisabled}
380
+ ariaKeyshortcuts="⌘B"
381
+ >
382
+ Bold
383
+ </ToolbarDropdownItem>
384
+ <ToolbarDropdownItem
385
+ elemBefore={<ItalicIcon label="Italic" />}
386
+ elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘I" />}
387
+ onClick={onClick('Italic', onToggleFormatting('italic'))}
388
+ isSelected={formatting.italic}
389
+ isDisabled={isItalicDisabled}
390
+ ariaKeyshortcuts="⌘I"
391
+ >
392
+ Italic
393
+ </ToolbarDropdownItem>
394
+ </ToolbarDropdownItemSection>
395
+ <ToolbarDropdownDivider />
396
+ <ToolbarDropdownItemSection>
397
+ <ToolbarDropdownItem
398
+ elemBefore={<ClearFormattingIcon label="Clear formatting" />}
399
+ elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘\" />}
400
+ onClick={onClick('Clear formatting')}
401
+ ariaKeyshortcuts="⌘\"
402
+ >
403
+ Clear formatting
404
+ </ToolbarDropdownItem>
405
+ </ToolbarDropdownItemSection>
294
406
  </ToolbarDropdownMenu>
295
407
  </ToolbarButtonGroup>
296
408
 
@@ -312,18 +424,22 @@ export const ExampleManuallyComposedToolbar = () => {
312
424
  label="Text color"
313
425
  isDisabled={isTextColorDisabled}
314
426
  >
315
- <ToolbarDropdownItem
316
- elemBefore={<TextIcon label="Text color" />}
317
- onClick={onClick('Text color')}
318
- >
319
- Text color
320
- </ToolbarDropdownItem>
427
+ <ToolbarDropdownItemSection>
428
+ <ToolbarDropdownItem
429
+ elemBefore={<TextIcon label="Text color" />}
430
+ onClick={onClick('Text color')}
431
+ >
432
+ Text color
433
+ </ToolbarDropdownItem>
434
+ </ToolbarDropdownItemSection>
321
435
  </ToolbarDropdownMenu>
322
436
  </ToolbarTooltip>
323
437
  </ToolbarButtonGroup>
324
438
 
325
439
  <ToolbarButtonGroup>
326
- <ToolbarTooltip content={listOrAlignment === 'numbered' ? 'Numbered list' : 'Bulleted list'}>
440
+ <ToolbarTooltip
441
+ content={listOrAlignment === 'numbered' ? 'Numbered list' : 'Bulleted list'}
442
+ >
327
443
  <ToolbarButton
328
444
  icon={listOrAlignment === 'numbered' ? ListNumberedIcon : ListBulletedIcon}
329
445
  label={listOrAlignment === 'numbered' ? 'Numbered list' : 'Bulleted list'}
@@ -333,7 +449,9 @@ export const ExampleManuallyComposedToolbar = () => {
333
449
  )}
334
450
  groupLocation="start"
335
451
  isSelected={listOrAlignment !== 'none'}
336
- isDisabled={listOrAlignment === 'numbered' ? isNumberedListDisabled : isBulletedListDisabled}
452
+ isDisabled={
453
+ listOrAlignment === 'numbered' ? isNumberedListDisabled : isBulletedListDisabled
454
+ }
337
455
  />
338
456
  </ToolbarTooltip>
339
457
  <ToolbarDropdownMenu
@@ -341,24 +459,28 @@ export const ExampleManuallyComposedToolbar = () => {
341
459
  label="Lists, indentation and alignment"
342
460
  groupLocation="end"
343
461
  >
344
- <ToolbarDropdownItem
345
- elemBefore={<ListBulletedIcon label="Bulleted list" />}
346
- elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⇧8" />}
347
- onClick={onClick('Bulleted list', onToggleListOrAlignment('bulleted'))}
348
- isSelected={listOrAlignment === 'bulleted'}
349
- isDisabled={isBulletedListDisabled}
350
- >
351
- Bulleted list
352
- </ToolbarDropdownItem>
353
- <ToolbarDropdownItem
354
- elemBefore={<ListNumberedIcon label="Numbered list" />}
355
- elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⇧7" />}
356
- onClick={onClick('Numbered list', onToggleListOrAlignment('numbered'))}
357
- isSelected={listOrAlignment === 'numbered'}
358
- isDisabled={isNumberedListDisabled}
359
- >
360
- Numbered list
361
- </ToolbarDropdownItem>
462
+ <ToolbarDropdownItemSection>
463
+ <ToolbarDropdownItem
464
+ elemBefore={<ListBulletedIcon label="Bulleted list" />}
465
+ elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⇧8" />}
466
+ onClick={onClick('Bulleted list', onToggleListOrAlignment('bulleted'))}
467
+ isSelected={listOrAlignment === 'bulleted'}
468
+ isDisabled={isBulletedListDisabled}
469
+ ariaKeyshortcuts="⌘⇧8"
470
+ >
471
+ Bulleted list
472
+ </ToolbarDropdownItem>
473
+ <ToolbarDropdownItem
474
+ elemBefore={<ListNumberedIcon label="Numbered list" />}
475
+ elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⇧7" />}
476
+ onClick={onClick('Numbered list', onToggleListOrAlignment('numbered'))}
477
+ isSelected={listOrAlignment === 'numbered'}
478
+ isDisabled={isNumberedListDisabled}
479
+ ariaKeyshortcuts="⌘⇧7"
480
+ >
481
+ Numbered list
482
+ </ToolbarDropdownItem>
483
+ </ToolbarDropdownItemSection>
362
484
  </ToolbarDropdownMenu>
363
485
  </ToolbarButtonGroup>
364
486
  </ToolbarSection>
@@ -368,7 +490,12 @@ export const ExampleManuallyComposedToolbar = () => {
368
490
  <ToolbarSection>
369
491
  <ToolbarButtonGroup>
370
492
  <ToolbarTooltip content="Link">
371
- <ToolbarButton icon={LinkIcon} label="Link" onClick={onClick('Link')} isDisabled={isLinkDisabled} />
493
+ <ToolbarButton
494
+ icon={LinkIcon}
495
+ label="Link"
496
+ onClick={onClick('Link')}
497
+ isDisabled={isLinkDisabled}
498
+ />
372
499
  </ToolbarTooltip>
373
500
  </ToolbarButtonGroup>
374
501
  </ToolbarSection>
@@ -378,7 +505,12 @@ export const ExampleManuallyComposedToolbar = () => {
378
505
  <ToolbarSection>
379
506
  <ToolbarButtonGroup>
380
507
  <ToolbarTooltip content="Comment">
381
- <ToolbarButton icon={CommentIcon} label="Comment" onClick={onClick('Comment')} isDisabled={isCommentDisabled} />
508
+ <ToolbarButton
509
+ icon={CommentIcon}
510
+ label="Comment"
511
+ onClick={onClick('Comment')}
512
+ isDisabled={isCommentDisabled}
513
+ />
382
514
  </ToolbarTooltip>
383
515
  </ToolbarButtonGroup>
384
516
  </ToolbarSection>
@@ -388,14 +520,20 @@ export const ExampleManuallyComposedToolbar = () => {
388
520
  <ToolbarSection>
389
521
  <ToolbarButtonGroup>
390
522
  <ToolbarTooltip content="Apps and extensions">
391
- <ToolbarDropdownMenu icon={AppsIcon} label="Apps and extensions" isDisabled={isAppsAndExtensionsDisabled}>
392
- <ToolbarDropdownItem
393
- elemBefore={<AddIcon label="Create Jira work item" />}
394
- onClick={onClick('Create Jira work item')}
395
- isDisabled={isCreateJiraWorkItemDisabled}
396
- >
397
- Create Jira work item
398
- </ToolbarDropdownItem>
523
+ <ToolbarDropdownMenu
524
+ icon={AppsIcon}
525
+ label="Apps and extensions"
526
+ isDisabled={isAppsAndExtensionsDisabled}
527
+ >
528
+ <ToolbarDropdownItemSection>
529
+ <ToolbarDropdownItem
530
+ elemBefore={<AddIcon label="Create Jira work item" />}
531
+ onClick={onClick('Create Jira work item')}
532
+ isDisabled={isCreateJiraWorkItemDisabled}
533
+ >
534
+ Create Jira work item
535
+ </ToolbarDropdownItem>
536
+ </ToolbarDropdownItemSection>
399
537
  </ToolbarDropdownMenu>
400
538
  </ToolbarTooltip>
401
539
  </ToolbarButtonGroup>
@@ -405,7 +543,9 @@ export const ExampleManuallyComposedToolbar = () => {
405
543
 
406
544
  <ToolbarSection>
407
545
  <ToolbarButtonGroup>
408
- <ToolbarTooltip content={pinning === 'pinned' ? 'Unpin the toolbar' : 'Pin the toolbar at the top'}>
546
+ <ToolbarTooltip
547
+ content={pinning === 'pinned' ? 'Unpin the toolbar' : 'Pin the toolbar at the top'}
548
+ >
409
549
  <ToolbarButton
410
550
  icon={pinning === 'pinned' ? PinnedIcon : PinIcon}
411
551
  label={pinning === 'pinned' ? 'Unpin toolbar' : 'Pin toolbar'}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "registry": "https://registry.npmjs.org/"
5
5
  },
6
- "version": "0.0.1",
6
+ "version": "0.0.3",
7
7
  "description": "Common UI for Toolbars across the platform",
8
8
  "atlassian": {
9
9
  "team": "Editor"
@@ -24,16 +24,16 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@atlaskit/badge": "^18.1.0",
27
- "@atlaskit/button": "^23.2.0",
27
+ "@atlaskit/button": "^23.3.0",
28
28
  "@atlaskit/css": "^0.12.0",
29
- "@atlaskit/dropdown-menu": "^16.2.0",
30
- "@atlaskit/icon": "^27.5.0",
29
+ "@atlaskit/dropdown-menu": "^16.3.0",
30
+ "@atlaskit/icon": "^27.7.0",
31
31
  "@atlaskit/icon-lab": "^5.2.0",
32
- "@atlaskit/logo": "^19.5.0",
32
+ "@atlaskit/logo": "^19.6.0",
33
33
  "@atlaskit/popup": "^4.3.0",
34
34
  "@atlaskit/primitives": "^14.10.0",
35
35
  "@atlaskit/tokens": "^5.6.0",
36
- "@atlaskit/tooltip": "^20.3.0",
36
+ "@atlaskit/tooltip": "^20.4.0",
37
37
  "@babel/runtime": "^7.0.0",
38
38
  "@compiled/react": "^0.18.3"
39
39
  },
@@ -89,6 +89,7 @@ type ToolbarButtonProps = Partial<TriggerProps> & {
89
89
  icon: IconComponent;
90
90
  groupLocation?: ToolbarButtonGroupLocation;
91
91
  isDisabled?: boolean;
92
+ ariaKeyshortcuts?: string;
92
93
  };
93
94
 
94
95
  export const ToolbarButton = forwardRef(
@@ -108,10 +109,15 @@ export const ToolbarButton = forwardRef(
108
109
  testId,
109
110
  groupLocation,
110
111
  isDisabled,
112
+ ariaKeyshortcuts,
111
113
  }: ToolbarButtonProps,
112
114
  ref: Ref<HTMLButtonElement>,
113
115
  ) => {
114
- const iconColor = isDisabled ? ICON_COLOR.disabled : isSelected ? ICON_COLOR.selected : ICON_COLOR.default;
116
+ const iconColor = isDisabled
117
+ ? ICON_COLOR.disabled
118
+ : isSelected
119
+ ? ICON_COLOR.selected
120
+ : ICON_COLOR.default;
115
121
  return (
116
122
  <Pressable
117
123
  ref={ref}
@@ -122,9 +128,11 @@ export const ToolbarButton = forwardRef(
122
128
  groupLocation === 'middle' && styles.groupMiddle,
123
129
  groupLocation === 'end' && styles.groupEnd,
124
130
  )}
131
+ aria-pressed={isSelected}
125
132
  aria-expanded={ariaExpanded}
126
133
  aria-haspopup={ariaHasPopup}
127
134
  aria-controls={ariaControls}
135
+ aria-keyshortcuts={ariaKeyshortcuts}
128
136
  data-ds--level={dataDsLevel}
129
137
  onClick={onClick}
130
138
  onBlur={onBlur}
@@ -132,11 +140,7 @@ export const ToolbarButton = forwardRef(
132
140
  testId={testId}
133
141
  isDisabled={isDisabled}
134
142
  >
135
- <IconComponent
136
- label={label}
137
- size="medium"
138
- color={iconColor}
139
- />
143
+ <IconComponent label={label} size="medium" color={iconColor} />
140
144
  {children}
141
145
  </Pressable>
142
146
  );
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+
3
+ import { cssMap } from '@atlaskit/css';
4
+ import { Box } from '@atlaskit/primitives/compiled';
5
+ import { token } from '@atlaskit/tokens';
6
+
7
+ const styles = cssMap({
8
+ divider: {
9
+ borderBottomColor: token('color.border'),
10
+ borderBottomStyle: 'solid',
11
+ borderBottomWidth: token('border.width'),
12
+ },
13
+ });
14
+
15
+ export const ToolbarDropdownDivider = () => {
16
+ return <Box xcss={styles.divider} />;
17
+ };
@@ -1,7 +1,8 @@
1
- import React, { type ReactNode } from 'react';
1
+ import React, { type ReactNode, forwardRef, type Ref } from 'react';
2
2
 
3
3
  import { cssMap, cx } from '@atlaskit/css';
4
4
  import { DropdownItem } from '@atlaskit/dropdown-menu';
5
+ import type { CustomItemComponentProps } from '@atlaskit/menu/types';
5
6
  import { Box, Pressable } from '@atlaskit/primitives/compiled';
6
7
  import { token } from '@atlaskit/tokens';
7
8
 
@@ -72,14 +73,62 @@ const styles = cssMap({
72
73
  },
73
74
  });
74
75
 
76
+ export type CustomDropdownMenuItemButtonProps = CustomItemComponentProps & {
77
+ 'aria-haspopup'?: boolean;
78
+ 'aria-disabled'?: boolean;
79
+ 'aria-pressed'?: boolean;
80
+ 'aria-keyshortcuts'?: string;
81
+ };
82
+
83
+ const CustomDropdownMenuItemButton = forwardRef<
84
+ HTMLButtonElement,
85
+ CustomDropdownMenuItemButtonProps
86
+ >(
87
+ (
88
+ {
89
+ children,
90
+ 'data-testid': testId,
91
+ 'aria-haspopup': ariaHasPopup,
92
+ 'aria-disabled': ariaDisabled,
93
+ 'aria-pressed': ariaPressed,
94
+ 'aria-keyshortcuts': ariaKeyshortcuts,
95
+ onClick,
96
+ tabIndex,
97
+ },
98
+ ref,
99
+ ) => (
100
+ <Pressable
101
+ testId={testId}
102
+ xcss={cx(
103
+ styles.toolbarDropdownItem,
104
+ ariaDisabled ? styles.disabled : ariaPressed ? styles.selected : styles.enabled,
105
+ )}
106
+ onClick={onClick}
107
+ tabIndex={tabIndex}
108
+ aria-haspopup={ariaHasPopup}
109
+ aria-expanded={ariaHasPopup ? (ariaPressed ? true : false) : undefined}
110
+ aria-pressed={ariaPressed}
111
+ aria-disabled={ariaDisabled}
112
+ aria-keyshortcuts={ariaKeyshortcuts}
113
+ ref={ref}
114
+ >
115
+ {children}
116
+ </Pressable>
117
+ ),
118
+ );
119
+
75
120
  type ToolbarDropdownItemProps = {
76
- onClick: () => void;
121
+ onClick?: (e: React.MouseEvent | React.KeyboardEvent) => void;
77
122
  elemBefore?: ReactNode;
78
123
  elemAfter?: ReactNode;
79
124
  isSelected?: boolean;
80
125
  children?: React.ReactNode;
81
126
  textStyle?: TextStyle;
82
127
  isDisabled?: boolean;
128
+ hasNestedDropdownMenu?: boolean;
129
+ triggerRef?: Ref<HTMLButtonElement>;
130
+ testId?: string;
131
+ ariaKeyshortcuts?: string;
83
132
  };
84
133
 
85
134
  export const ToolbarDropdownItem = ({
@@ -90,42 +139,24 @@ export const ToolbarDropdownItem = ({
90
139
  children,
91
140
  textStyle = 'normal',
92
141
  isDisabled,
93
- }: ToolbarDropdownItemProps) => {
94
- return (
95
- <DropdownItem
96
- onClick={onClick}
97
- elemBefore={elemBefore}
98
- elemAfter={elemAfter}
99
- isSelected={isSelected}
100
- component={({
101
- children,
102
- 'data-testid': testId,
103
- draggable,
104
- onClick,
105
- onDragStart,
106
- onMouseDown,
107
- ref,
108
- tabIndex,
109
- }) => (
110
- <Pressable
111
- testId={testId}
112
- xcss={cx(
113
- styles.toolbarDropdownItem,
114
- isDisabled ? styles.disabled : isSelected ? styles.selected : styles.enabled,
115
- )}
116
- isDisabled={isDisabled}
117
- draggable={draggable}
118
- onClick={onClick}
119
- onDragStart={onDragStart}
120
- onMouseDown={onMouseDown}
121
- tabIndex={tabIndex}
122
- ref={ref}
123
- >
124
- {children}
125
- </Pressable>
126
- )}
127
- >
128
- <Box xcss={styles[textStyle]}>{children}</Box>
129
- </DropdownItem>
130
- );
131
- };
142
+ hasNestedDropdownMenu,
143
+ triggerRef,
144
+ testId,
145
+ ariaKeyshortcuts,
146
+ }: ToolbarDropdownItemProps) => (
147
+ <DropdownItem
148
+ onClick={onClick}
149
+ elemBefore={elemBefore}
150
+ elemAfter={elemAfter}
151
+ isSelected={isSelected}
152
+ isDisabled={isDisabled}
153
+ aria-haspopup={hasNestedDropdownMenu}
154
+ aria-pressed={isSelected}
155
+ aria-keyshortcuts={ariaKeyshortcuts}
156
+ ref={triggerRef}
157
+ component={CustomDropdownMenuItemButton}
158
+ testId={testId}
159
+ >
160
+ <Box xcss={styles[textStyle]}>{children}</Box>
161
+ </DropdownItem>
162
+ );
@@ -0,0 +1,19 @@
1
+ import React, { type ReactNode } from 'react';
2
+
3
+ import { cssMap } from '@atlaskit/css';
4
+ import { Box } from '@atlaskit/primitives/compiled';
5
+
6
+ const styles = cssMap({
7
+ container: {
8
+ display: 'flex',
9
+ flexDirection: 'column',
10
+ },
11
+ });
12
+
13
+ type ToolbarDropdownItemSectionProps = {
14
+ children?: ReactNode;
15
+ };
16
+
17
+ export const ToolbarDropdownItemSection = ({ children }: ToolbarDropdownItemSectionProps) => {
18
+ return <Box xcss={styles.container}>{children}</Box>;
19
+ };
@@ -0,0 +1,43 @@
1
+ import React, { type ReactNode } from 'react';
2
+
3
+ import DropdownMenu from '@atlaskit/dropdown-menu';
4
+
5
+ import { ToolbarDropdownItem } from './ToolbarDropdownItem';
6
+
7
+ type ToolbarNestedDropdownMenuProps = {
8
+ elemBefore: ReactNode;
9
+ elemAfter: ReactNode;
10
+ text?: string;
11
+ children?: ReactNode;
12
+ isDisabled?: boolean;
13
+ };
14
+
15
+ export const ToolbarNestedDropdownMenu = ({
16
+ elemBefore,
17
+ text,
18
+ elemAfter,
19
+ children,
20
+ isDisabled,
21
+ }: ToolbarNestedDropdownMenuProps) => {
22
+ return (
23
+ <DropdownMenu<HTMLButtonElement>
24
+ placement="right-start"
25
+ trigger={(triggerProps) => (
26
+ <ToolbarDropdownItem
27
+ elemBefore={elemBefore}
28
+ elemAfter={elemAfter}
29
+ isSelected={triggerProps.isSelected}
30
+ onClick={triggerProps.onClick}
31
+ testId={triggerProps.testId}
32
+ triggerRef={triggerProps.triggerRef}
33
+ hasNestedDropdownMenu={true}
34
+ isDisabled={isDisabled}
35
+ >
36
+ {text}
37
+ </ToolbarDropdownItem>
38
+ )}
39
+ >
40
+ {children}
41
+ </DropdownMenu>
42
+ );
43
+ };
@@ -3,14 +3,10 @@ import React from 'react';
3
3
  import Tooltip from '@atlaskit/tooltip';
4
4
 
5
5
  type ToolbarTooltipProps = {
6
- content: string;
7
- children: React.ReactNode;
6
+ content: string;
7
+ children: React.ReactNode;
8
8
  };
9
9
 
10
10
  export const ToolbarTooltip = ({ content, children }: ToolbarTooltipProps) => {
11
- return (
12
- <Tooltip content={content}>
13
- {children}
14
- </Tooltip>
15
- );
16
- };
11
+ return <Tooltip content={content}>{children}</Tooltip>;
12
+ };
@@ -0,0 +1,2 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ export { default as AICasualIcon } from '@atlaskit/icon/core/emoji-casual';
@@ -0,0 +1,2 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ export { default as AIChangeToneIcon } from '@atlaskit/icon-lab/core/ai-generative-chapters';
@@ -0,0 +1,2 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ export { default as AIHeartIcon } from '@atlaskit/icon/core/heart';
@@ -0,0 +1,2 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ export { default as AILenghtenIcon } from '@atlaskit/icon-lab/core/text-lengthen';
@@ -0,0 +1,2 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ export { default as AIBriefcaseIcon } from '@atlaskit/icon/core/briefcase';
@@ -0,0 +1,2 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ export { default as AIShortenIcon } from '@atlaskit/icon/core/text-shorten';
@@ -0,0 +1,2 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ export { default as AISpellcheckIcon } from '@atlaskit/icon/core/text-spellcheck';
@@ -0,0 +1,2 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ export { default as AITranslateIcon } from '@atlaskit/icon/core/translate';
@@ -0,0 +1,2 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ export { default as ClearFormattingIcon } from '@atlaskit/icon/core/table-cell-clear';
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+
3
+ import Icon from '@atlaskit/icon/core/chevron-right';
4
+
5
+ import { type IconComponent } from '../../types';
6
+
7
+ export const NestedDropdownRightIcon: IconComponent = ({
8
+ label,
9
+ testId,
10
+ color,
11
+ shouldRecommendSmallIcon,
12
+ spacing,
13
+ }) => (
14
+ <Icon
15
+ label={label}
16
+ testId={testId}
17
+ color={color}
18
+ shouldRecommendSmallIcon={shouldRecommendSmallIcon}
19
+ spacing={spacing}
20
+ size="small"
21
+ />
22
+ );
package/tsconfig.app.json CHANGED
@@ -49,6 +49,9 @@
49
49
  {
50
50
  "path": "../../design-system/logo/tsconfig.app.json"
51
51
  },
52
+ {
53
+ "path": "../../design-system/menu/tsconfig.app.json"
54
+ },
52
55
  {
53
56
  "path": "../../design-system/popup/tsconfig.app.json"
54
57
  },