@atlaskit/editor-toolbar 0.0.1 → 0.0.2

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,14 @@
1
1
  # @atlaskit/editor-toolbar
2
2
 
3
+ ## 0.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#189216](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/189216)
8
+ [`b4ba899b6cf55`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b4ba899b6cf55) -
9
+ [ux] ED-28546 add nested flyouts to ui primitive library
10
+ - Updated dependencies
11
+
3
12
  ## 0.0.1
4
13
 
5
14
  ### 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,80 @@ 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
+ >
279
+ Normal text
280
+ </ToolbarDropdownItem>
281
+ <ToolbarDropdownItem
282
+ elemBefore={<HeadingOneIcon label="Heading One" />}
283
+ elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⌥1" />}
284
+ onClick={onClick('Heading one', onSetTextStyle('heading1'))}
285
+ isSelected={textStyle === 'heading1'}
286
+ textStyle="heading1"
287
+ >
288
+ Heading 1
289
+ </ToolbarDropdownItem>
290
+ <ToolbarDropdownItem
291
+ elemBefore={<HeadingTwoIcon label="Heading Two" />}
292
+ elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⌥2" />}
293
+ onClick={onClick('Heading two', onSetTextStyle('heading2'))}
294
+ isSelected={textStyle === 'heading2'}
295
+ textStyle="heading2"
296
+ >
297
+ Heading 2
298
+ </ToolbarDropdownItem>
299
+ <ToolbarDropdownItem
300
+ elemBefore={<HeadingThreeIcon label="Heading Three" />}
301
+ elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⌥3" />}
302
+ onClick={onClick('Heading three', onSetTextStyle('heading3'))}
303
+ isSelected={textStyle === 'heading3'}
304
+ textStyle="heading3"
305
+ >
306
+ Heading 3
307
+ </ToolbarDropdownItem>
308
+ <ToolbarDropdownItem
309
+ elemBefore={<HeadingFourIcon label="Heading Four" />}
310
+ elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⌥4" />}
311
+ onClick={onClick('Heading four', onSetTextStyle('heading4'))}
312
+ isSelected={textStyle === 'heading4'}
313
+ textStyle="heading4"
314
+ >
315
+ Heading 4
316
+ </ToolbarDropdownItem>
317
+ <ToolbarDropdownItem
318
+ elemBefore={<HeadingFiveIcon label="Heading Five" />}
319
+ elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⌥5" />}
320
+ onClick={onClick('Heading five', onSetTextStyle('heading5'))}
321
+ isSelected={textStyle === 'heading5'}
322
+ textStyle="heading5"
323
+ >
324
+ Heading 5
325
+ </ToolbarDropdownItem>
326
+ <ToolbarDropdownItem
327
+ elemBefore={<HeadingSixIcon label="Heading Six" />}
328
+ elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⌥6" />}
329
+ onClick={onClick('Heading six', onSetTextStyle('heading6'))}
330
+ isSelected={textStyle === 'heading6'}
331
+ textStyle="heading6"
332
+ >
333
+ Heading 6
334
+ </ToolbarDropdownItem>
335
+ <ToolbarDropdownItem
336
+ elemBefore={<QuoteIcon label="Quote" />}
337
+ elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⌥9" />}
338
+ onClick={onClick('Quote', onSetTextStyle('quote'))}
339
+ isSelected={textStyle === 'quote'}
340
+ textStyle="normal"
341
+ >
342
+ Quote
343
+ </ToolbarDropdownItem>
344
+ </ToolbarDropdownItemSection>
257
345
  </ToolbarDropdownMenu>
258
346
  </ToolbarTooltip>
259
347
  </ToolbarButtonGroup>
@@ -273,24 +361,36 @@ export const ExampleManuallyComposedToolbar = () => {
273
361
  />
274
362
  </ToolbarTooltip>
275
363
  <ToolbarDropdownMenu icon={MoreItemsIcon} label="More formatting" groupLocation="end">
276
- <ToolbarDropdownItem
364
+ <ToolbarDropdownItemSection>
365
+ <ToolbarDropdownItem
277
366
  elemBefore={<BoldIcon label="Bold" />}
278
367
  elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘B" />}
279
368
  onClick={onClick('Bold', onToggleFormatting('bold'))}
280
369
  isSelected={formatting.bold}
281
370
  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>
371
+ >
372
+ Bold
373
+ </ToolbarDropdownItem>
374
+ <ToolbarDropdownItem
375
+ elemBefore={<ItalicIcon label="Italic" />}
376
+ elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘I" />}
377
+ onClick={onClick('Italic', onToggleFormatting('italic'))}
378
+ isSelected={formatting.italic}
379
+ isDisabled={isItalicDisabled}
380
+ >
381
+ Italic
382
+ </ToolbarDropdownItem>
383
+ </ToolbarDropdownItemSection>
384
+ <ToolbarDropdownDivider/>
385
+ <ToolbarDropdownItemSection>
386
+ <ToolbarDropdownItem
387
+ elemBefore={<ClearFormattingIcon label="Clear formatting" />}
388
+ elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘\" />}
389
+ onClick={onClick('Clear formatting')}
390
+ >
391
+ Clear formatting
392
+ </ToolbarDropdownItem>
393
+ </ToolbarDropdownItemSection>
294
394
  </ToolbarDropdownMenu>
295
395
  </ToolbarButtonGroup>
296
396
 
@@ -312,18 +412,22 @@ export const ExampleManuallyComposedToolbar = () => {
312
412
  label="Text color"
313
413
  isDisabled={isTextColorDisabled}
314
414
  >
315
- <ToolbarDropdownItem
316
- elemBefore={<TextIcon label="Text color" />}
317
- onClick={onClick('Text color')}
318
- >
319
- Text color
320
- </ToolbarDropdownItem>
415
+ <ToolbarDropdownItemSection>
416
+ <ToolbarDropdownItem
417
+ elemBefore={<TextIcon label="Text color" />}
418
+ onClick={onClick('Text color')}
419
+ >
420
+ Text color
421
+ </ToolbarDropdownItem>
422
+ </ToolbarDropdownItemSection>
321
423
  </ToolbarDropdownMenu>
322
424
  </ToolbarTooltip>
323
425
  </ToolbarButtonGroup>
324
426
 
325
427
  <ToolbarButtonGroup>
326
- <ToolbarTooltip content={listOrAlignment === 'numbered' ? 'Numbered list' : 'Bulleted list'}>
428
+ <ToolbarTooltip
429
+ content={listOrAlignment === 'numbered' ? 'Numbered list' : 'Bulleted list'}
430
+ >
327
431
  <ToolbarButton
328
432
  icon={listOrAlignment === 'numbered' ? ListNumberedIcon : ListBulletedIcon}
329
433
  label={listOrAlignment === 'numbered' ? 'Numbered list' : 'Bulleted list'}
@@ -333,7 +437,9 @@ export const ExampleManuallyComposedToolbar = () => {
333
437
  )}
334
438
  groupLocation="start"
335
439
  isSelected={listOrAlignment !== 'none'}
336
- isDisabled={listOrAlignment === 'numbered' ? isNumberedListDisabled : isBulletedListDisabled}
440
+ isDisabled={
441
+ listOrAlignment === 'numbered' ? isNumberedListDisabled : isBulletedListDisabled
442
+ }
337
443
  />
338
444
  </ToolbarTooltip>
339
445
  <ToolbarDropdownMenu
@@ -341,24 +447,26 @@ export const ExampleManuallyComposedToolbar = () => {
341
447
  label="Lists, indentation and alignment"
342
448
  groupLocation="end"
343
449
  >
344
- <ToolbarDropdownItem
450
+ <ToolbarDropdownItemSection>
451
+ <ToolbarDropdownItem
345
452
  elemBefore={<ListBulletedIcon label="Bulleted list" />}
346
453
  elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⇧8" />}
347
454
  onClick={onClick('Bulleted list', onToggleListOrAlignment('bulleted'))}
348
455
  isSelected={listOrAlignment === 'bulleted'}
349
456
  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>
457
+ >
458
+ Bulleted list
459
+ </ToolbarDropdownItem>
460
+ <ToolbarDropdownItem
461
+ elemBefore={<ListNumberedIcon label="Numbered list" />}
462
+ elemAfter={<ToolbarKeyboardShortcutHint shortcut="⌘⇧7" />}
463
+ onClick={onClick('Numbered list', onToggleListOrAlignment('numbered'))}
464
+ isSelected={listOrAlignment === 'numbered'}
465
+ isDisabled={isNumberedListDisabled}
466
+ >
467
+ Numbered list
468
+ </ToolbarDropdownItem>
469
+ </ToolbarDropdownItemSection>
362
470
  </ToolbarDropdownMenu>
363
471
  </ToolbarButtonGroup>
364
472
  </ToolbarSection>
@@ -368,7 +476,12 @@ export const ExampleManuallyComposedToolbar = () => {
368
476
  <ToolbarSection>
369
477
  <ToolbarButtonGroup>
370
478
  <ToolbarTooltip content="Link">
371
- <ToolbarButton icon={LinkIcon} label="Link" onClick={onClick('Link')} isDisabled={isLinkDisabled} />
479
+ <ToolbarButton
480
+ icon={LinkIcon}
481
+ label="Link"
482
+ onClick={onClick('Link')}
483
+ isDisabled={isLinkDisabled}
484
+ />
372
485
  </ToolbarTooltip>
373
486
  </ToolbarButtonGroup>
374
487
  </ToolbarSection>
@@ -378,7 +491,12 @@ export const ExampleManuallyComposedToolbar = () => {
378
491
  <ToolbarSection>
379
492
  <ToolbarButtonGroup>
380
493
  <ToolbarTooltip content="Comment">
381
- <ToolbarButton icon={CommentIcon} label="Comment" onClick={onClick('Comment')} isDisabled={isCommentDisabled} />
494
+ <ToolbarButton
495
+ icon={CommentIcon}
496
+ label="Comment"
497
+ onClick={onClick('Comment')}
498
+ isDisabled={isCommentDisabled}
499
+ />
382
500
  </ToolbarTooltip>
383
501
  </ToolbarButtonGroup>
384
502
  </ToolbarSection>
@@ -388,14 +506,20 @@ export const ExampleManuallyComposedToolbar = () => {
388
506
  <ToolbarSection>
389
507
  <ToolbarButtonGroup>
390
508
  <ToolbarTooltip content="Apps and extensions">
391
- <ToolbarDropdownMenu icon={AppsIcon} label="Apps and extensions" isDisabled={isAppsAndExtensionsDisabled}>
392
- <ToolbarDropdownItem
509
+ <ToolbarDropdownMenu
510
+ icon={AppsIcon}
511
+ label="Apps and extensions"
512
+ isDisabled={isAppsAndExtensionsDisabled}
513
+ >
514
+ <ToolbarDropdownItemSection>
515
+ <ToolbarDropdownItem
393
516
  elemBefore={<AddIcon label="Create Jira work item" />}
394
517
  onClick={onClick('Create Jira work item')}
395
518
  isDisabled={isCreateJiraWorkItemDisabled}
396
- >
397
- Create Jira work item
398
- </ToolbarDropdownItem>
519
+ >
520
+ Create Jira work item
521
+ </ToolbarDropdownItem>
522
+ </ToolbarDropdownItemSection>
399
523
  </ToolbarDropdownMenu>
400
524
  </ToolbarTooltip>
401
525
  </ToolbarButtonGroup>
@@ -405,7 +529,9 @@ export const ExampleManuallyComposedToolbar = () => {
405
529
 
406
530
  <ToolbarSection>
407
531
  <ToolbarButtonGroup>
408
- <ToolbarTooltip content={pinning === 'pinned' ? 'Unpin the toolbar' : 'Pin the toolbar at the top'}>
532
+ <ToolbarTooltip
533
+ content={pinning === 'pinned' ? 'Unpin the toolbar' : 'Pin the toolbar at the top'}
534
+ >
409
535
  <ToolbarButton
410
536
  icon={pinning === 'pinned' ? PinnedIcon : PinIcon}
411
537
  label={pinning === 'pinned' ? 'Unpin toolbar' : 'Pin toolbar'}
@@ -423,9 +549,9 @@ export const ExampleManuallyComposedToolbar = () => {
423
549
  Last action: ${lastAction || 'None'}
424
550
  Text style: ${textStyle}
425
551
  Formatting: ${Object.entries(formatting)
426
- .filter(([, value]) => value)
427
- .map(([key]) => key)
428
- .join(', ')}
552
+ .filter(([, value]) => value)
553
+ .map(([key]) => key)
554
+ .join(', ')}
429
555
  List/Align: ${listOrAlignment}
430
556
  Pinning: ${pinning}
431
557
  `}
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.2",
7
7
  "description": "Common UI for Toolbars across the platform",
8
8
  "atlassian": {
9
9
  "team": "Editor"
@@ -26,8 +26,8 @@
26
26
  "@atlaskit/badge": "^18.1.0",
27
27
  "@atlaskit/button": "^23.2.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
32
  "@atlaskit/logo": "^19.5.0",
33
33
  "@atlaskit/popup": "^4.3.0",
@@ -111,7 +111,11 @@ export const ToolbarButton = forwardRef(
111
111
  }: ToolbarButtonProps,
112
112
  ref: Ref<HTMLButtonElement>,
113
113
  ) => {
114
- const iconColor = isDisabled ? ICON_COLOR.disabled : isSelected ? ICON_COLOR.selected : ICON_COLOR.default;
114
+ const iconColor = isDisabled
115
+ ? ICON_COLOR.disabled
116
+ : isSelected
117
+ ? ICON_COLOR.selected
118
+ : ICON_COLOR.default;
115
119
  return (
116
120
  <Pressable
117
121
  ref={ref}
@@ -132,11 +136,7 @@ export const ToolbarButton = forwardRef(
132
136
  testId={testId}
133
137
  isDisabled={isDisabled}
134
138
  >
135
- <IconComponent
136
- label={label}
137
- size="medium"
138
- color={iconColor}
139
- />
139
+ <IconComponent label={label} size="medium" color={iconColor} />
140
140
  {children}
141
141
  </Pressable>
142
142
  );
@@ -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,48 @@ 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
+ };
81
+
82
+ const CustomDropdownMenuItemButton = forwardRef<HTMLButtonElement, CustomDropdownMenuItemButtonProps>(({
83
+ children,
84
+ 'data-testid': testId,
85
+ 'aria-haspopup': ariaHasPopup,
86
+ 'aria-disabled': ariaDisabled,
87
+ 'aria-pressed': ariaPressed,
88
+ onClick,
89
+ tabIndex,
90
+ }, ref) =>
91
+ <Pressable
92
+ testId={testId}
93
+ xcss={cx(styles.toolbarDropdownItem, ariaDisabled ? styles.disabled : ariaPressed ? styles.selected : styles.enabled)}
94
+ onClick={onClick}
95
+ tabIndex={tabIndex}
96
+ aria-haspopup={ariaHasPopup}
97
+ aria-expanded={ariaHasPopup ? ariaPressed ? true : false : undefined}
98
+ aria-pressed={ariaPressed}
99
+ aria-disabled={ariaDisabled}
100
+ ref={ref}
101
+ >
102
+ {children}
103
+ </Pressable>
104
+ )
105
+
106
+
75
107
  type ToolbarDropdownItemProps = {
76
- onClick: () => void;
108
+ onClick?: (e: React.MouseEvent | React.KeyboardEvent) => void;
77
109
  elemBefore?: ReactNode;
78
110
  elemAfter?: ReactNode;
79
111
  isSelected?: boolean;
80
112
  children?: React.ReactNode;
81
113
  textStyle?: TextStyle;
82
114
  isDisabled?: boolean;
115
+ hasNestedDropdownMenu?: boolean;
116
+ triggerRef?: Ref<HTMLButtonElement>
117
+ testId?: string;
83
118
  };
84
119
 
85
120
  export const ToolbarDropdownItem = ({
@@ -90,42 +125,21 @@ export const ToolbarDropdownItem = ({
90
125
  children,
91
126
  textStyle = 'normal',
92
127
  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
- };
128
+ hasNestedDropdownMenu,
129
+ triggerRef,
130
+ testId,
131
+ }: ToolbarDropdownItemProps) =>
132
+ <DropdownItem
133
+ onClick={onClick}
134
+ elemBefore={elemBefore}
135
+ elemAfter={elemAfter}
136
+ isSelected={isSelected}
137
+ isDisabled={isDisabled}
138
+ aria-haspopup={hasNestedDropdownMenu}
139
+ aria-pressed={isSelected}
140
+ ref={triggerRef}
141
+ component={CustomDropdownMenuItemButton}
142
+ testId={testId}
143
+ >
144
+ <Box xcss={styles[textStyle]}>{children}</Box>
145
+ </DropdownItem>
@@ -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
+ );