@wordpress/block-library 9.24.0 → 9.25.0

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 (202) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/button/edit.js +29 -17
  3. package/build/button/edit.js.map +1 -1
  4. package/build/columns/edit.js +18 -22
  5. package/build/columns/edit.js.map +1 -1
  6. package/build/comment-author-name/edit.js +41 -12
  7. package/build/comment-author-name/edit.js.map +1 -1
  8. package/build/comment-date/edit.js +41 -12
  9. package/build/comment-date/edit.js.map +1 -1
  10. package/build/comment-edit-link/edit.js +27 -7
  11. package/build/comment-edit-link/edit.js.map +1 -1
  12. package/build/comments/edit/comments-inspector-controls.js +1 -3
  13. package/build/comments/edit/comments-inspector-controls.js.map +1 -1
  14. package/build/comments-pagination/edit.js +23 -9
  15. package/build/comments-pagination/edit.js.map +1 -1
  16. package/build/comments-title/edit.js +41 -12
  17. package/build/comments-title/edit.js.map +1 -1
  18. package/build/details/edit.js +27 -3
  19. package/build/details/edit.js.map +1 -1
  20. package/build/embed/edit.js +2 -4
  21. package/build/embed/edit.js.map +1 -1
  22. package/build/embed/embed-controls.js +41 -22
  23. package/build/embed/embed-controls.js.map +1 -1
  24. package/build/file/inspector.js +73 -30
  25. package/build/file/inspector.js.map +1 -1
  26. package/build/form/edit.js +67 -37
  27. package/build/form/edit.js.map +1 -1
  28. package/build/form-input/edit.js +47 -18
  29. package/build/form-input/edit.js.map +1 -1
  30. package/build/latest-posts/edit.js +154 -82
  31. package/build/latest-posts/edit.js.map +1 -1
  32. package/build/list/ordered-list-settings.js +131 -52
  33. package/build/list/ordered-list-settings.js.map +1 -1
  34. package/build/navigation/edit/index.js +93 -51
  35. package/build/navigation/edit/index.js.map +1 -1
  36. package/build/navigation/edit/overlay-menu-preview.js +43 -27
  37. package/build/navigation/edit/overlay-menu-preview.js.map +1 -1
  38. package/build/navigation-link/index.js +3 -0
  39. package/build/navigation-link/index.js.map +1 -1
  40. package/build/navigation-link/transforms.js +2 -0
  41. package/build/navigation-link/transforms.js.map +1 -1
  42. package/build/navigation-link/update-attributes.js +1 -0
  43. package/build/navigation-link/update-attributes.js.map +1 -1
  44. package/build/navigation-submenu/index.js +3 -0
  45. package/build/navigation-submenu/index.js.map +1 -1
  46. package/build/post-comments-count/index.js +3 -1
  47. package/build/post-comments-count/index.js.map +1 -1
  48. package/build/post-comments-count/transforms.js +26 -0
  49. package/build/post-comments-count/transforms.js.map +1 -0
  50. package/build/post-comments-link/index.js +3 -1
  51. package/build/post-comments-link/index.js.map +1 -1
  52. package/build/post-comments-link/transforms.js +26 -0
  53. package/build/post-comments-link/transforms.js.map +1 -0
  54. package/build/post-title/edit.js +56 -18
  55. package/build/post-title/edit.js.map +1 -1
  56. package/build/query/edit/enhanced-pagination-modal.js +1 -1
  57. package/build/query/edit/enhanced-pagination-modal.js.map +1 -1
  58. package/build/query/edit/inspector-controls/enhanced-pagination-control.js +3 -6
  59. package/build/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
  60. package/build/rss/edit.js +120 -46
  61. package/build/rss/edit.js.map +1 -1
  62. package/build/separator/edit.js +52 -20
  63. package/build/separator/edit.js.map +1 -1
  64. package/build/shortcode/index.js +2 -1
  65. package/build/shortcode/index.js.map +1 -1
  66. package/build/social-link/variations.js +53 -48
  67. package/build/social-link/variations.js.map +1 -1
  68. package/build/social-links/edit.js +35 -45
  69. package/build/social-links/edit.js.map +1 -1
  70. package/build/video/tracks-editor.js +40 -12
  71. package/build/video/tracks-editor.js.map +1 -1
  72. package/build-module/button/edit.js +30 -18
  73. package/build-module/button/edit.js.map +1 -1
  74. package/build-module/columns/edit.js +18 -22
  75. package/build-module/columns/edit.js.map +1 -1
  76. package/build-module/comment-author-name/edit.js +42 -13
  77. package/build-module/comment-author-name/edit.js.map +1 -1
  78. package/build-module/comment-date/edit.js +42 -13
  79. package/build-module/comment-date/edit.js.map +1 -1
  80. package/build-module/comment-edit-link/edit.js +28 -8
  81. package/build-module/comment-edit-link/edit.js.map +1 -1
  82. package/build-module/comments/edit/comments-inspector-controls.js +1 -3
  83. package/build-module/comments/edit/comments-inspector-controls.js.map +1 -1
  84. package/build-module/comments-pagination/edit.js +24 -10
  85. package/build-module/comments-pagination/edit.js.map +1 -1
  86. package/build-module/comments-title/edit.js +42 -13
  87. package/build-module/comments-title/edit.js.map +1 -1
  88. package/build-module/details/edit.js +29 -5
  89. package/build-module/details/edit.js.map +1 -1
  90. package/build-module/embed/edit.js +2 -4
  91. package/build-module/embed/edit.js.map +1 -1
  92. package/build-module/embed/embed-controls.js +42 -23
  93. package/build-module/embed/embed-controls.js.map +1 -1
  94. package/build-module/file/inspector.js +74 -31
  95. package/build-module/file/inspector.js.map +1 -1
  96. package/build-module/form/edit.js +68 -38
  97. package/build-module/form/edit.js.map +1 -1
  98. package/build-module/form-input/edit.js +48 -19
  99. package/build-module/form-input/edit.js.map +1 -1
  100. package/build-module/latest-posts/edit.js +155 -83
  101. package/build-module/latest-posts/edit.js.map +1 -1
  102. package/build-module/list/ordered-list-settings.js +132 -53
  103. package/build-module/list/ordered-list-settings.js.map +1 -1
  104. package/build-module/navigation/edit/index.js +94 -52
  105. package/build-module/navigation/edit/index.js.map +1 -1
  106. package/build-module/navigation/edit/overlay-menu-preview.js +44 -28
  107. package/build-module/navigation/edit/overlay-menu-preview.js.map +1 -1
  108. package/build-module/navigation-link/index.js +3 -0
  109. package/build-module/navigation-link/index.js.map +1 -1
  110. package/build-module/navigation-link/transforms.js +2 -0
  111. package/build-module/navigation-link/transforms.js.map +1 -1
  112. package/build-module/navigation-link/update-attributes.js +1 -0
  113. package/build-module/navigation-link/update-attributes.js.map +1 -1
  114. package/build-module/navigation-submenu/index.js +3 -0
  115. package/build-module/navigation-submenu/index.js.map +1 -1
  116. package/build-module/post-comments-count/index.js +3 -1
  117. package/build-module/post-comments-count/index.js.map +1 -1
  118. package/build-module/post-comments-count/transforms.js +19 -0
  119. package/build-module/post-comments-count/transforms.js.map +1 -0
  120. package/build-module/post-comments-link/index.js +3 -1
  121. package/build-module/post-comments-link/index.js.map +1 -1
  122. package/build-module/post-comments-link/transforms.js +19 -0
  123. package/build-module/post-comments-link/transforms.js.map +1 -0
  124. package/build-module/post-title/edit.js +57 -19
  125. package/build-module/post-title/edit.js.map +1 -1
  126. package/build-module/query/edit/enhanced-pagination-modal.js +1 -1
  127. package/build-module/query/edit/enhanced-pagination-modal.js.map +1 -1
  128. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js +3 -6
  129. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
  130. package/build-module/rss/edit.js +121 -47
  131. package/build-module/rss/edit.js.map +1 -1
  132. package/build-module/separator/edit.js +54 -22
  133. package/build-module/separator/edit.js.map +1 -1
  134. package/build-module/shortcode/index.js +2 -1
  135. package/build-module/shortcode/index.js.map +1 -1
  136. package/build-module/social-link/variations.js +53 -48
  137. package/build-module/social-link/variations.js.map +1 -1
  138. package/build-module/social-links/edit.js +37 -47
  139. package/build-module/social-links/edit.js.map +1 -1
  140. package/build-module/video/tracks-editor.js +41 -13
  141. package/build-module/video/tracks-editor.js.map +1 -1
  142. package/build-style/editor-rtl.css +9 -4
  143. package/build-style/editor.css +9 -4
  144. package/build-style/gallery/style-rtl.css +1 -0
  145. package/build-style/gallery/style.css +1 -0
  146. package/build-style/navigation/editor-rtl.css +8 -3
  147. package/build-style/navigation/editor.css +8 -3
  148. package/build-style/pullquote/editor-rtl.css +1 -1
  149. package/build-style/pullquote/editor.css +1 -1
  150. package/build-style/pullquote/style-rtl.css +2 -3
  151. package/build-style/pullquote/style.css +2 -3
  152. package/build-style/pullquote/theme-rtl.css +2 -2
  153. package/build-style/pullquote/theme.css +2 -2
  154. package/build-style/style-rtl.css +3 -3
  155. package/build-style/style.css +3 -3
  156. package/build-style/theme-rtl.css +2 -2
  157. package/build-style/theme.css +2 -2
  158. package/package.json +35 -35
  159. package/src/button/edit.js +44 -29
  160. package/src/columns/edit.js +20 -31
  161. package/src/comment-author-name/edit.js +54 -13
  162. package/src/comment-date/edit.js +50 -15
  163. package/src/comment-edit-link/edit.js +39 -11
  164. package/src/comments/edit/comments-inspector-controls.js +0 -2
  165. package/src/comments-pagination/edit.js +29 -9
  166. package/src/comments-title/edit.js +53 -15
  167. package/src/details/edit.js +36 -4
  168. package/src/embed/edit.js +3 -5
  169. package/src/embed/embed-controls.js +55 -33
  170. package/src/file/inspector.js +99 -45
  171. package/src/form/edit.js +91 -46
  172. package/src/form-input/edit.js +56 -18
  173. package/src/gallery/style.scss +1 -0
  174. package/src/latest-posts/edit.js +206 -98
  175. package/src/list/ordered-list-settings.js +172 -62
  176. package/src/navigation/edit/index.js +127 -64
  177. package/src/navigation/edit/overlay-menu-preview.js +43 -26
  178. package/src/navigation/editor.scss +8 -4
  179. package/src/navigation-link/block.json +3 -0
  180. package/src/navigation-link/index.php +4 -0
  181. package/src/navigation-link/transforms.js +2 -1
  182. package/src/navigation-link/update-attributes.js +1 -0
  183. package/src/navigation-submenu/block.json +3 -0
  184. package/src/navigation-submenu/index.php +4 -0
  185. package/src/post-comments-count/index.js +2 -0
  186. package/src/post-comments-count/transforms.js +20 -0
  187. package/src/post-comments-link/index.js +2 -0
  188. package/src/post-comments-link/transforms.js +20 -0
  189. package/src/post-title/edit.js +76 -24
  190. package/src/pullquote/editor.scss +1 -1
  191. package/src/pullquote/style.scss +2 -3
  192. package/src/pullquote/theme.scss +2 -2
  193. package/src/query/edit/enhanced-pagination-modal.js +1 -5
  194. package/src/query/edit/inspector-controls/enhanced-pagination-control.js +3 -13
  195. package/src/rss/edit.js +141 -55
  196. package/src/separator/edit.js +66 -21
  197. package/src/shortcode/block.json +2 -1
  198. package/src/site-title/index.php +1 -1
  199. package/src/social-link/index.php +49 -49
  200. package/src/social-link/variations.js +53 -48
  201. package/src/social-links/edit.js +39 -60
  202. package/src/video/tracks-editor.js +57 -16
@@ -1,3 +1,8 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __ } from '@wordpress/i18n';
5
+
1
6
  /**
2
7
  * Internal dependencies
3
8
  */
@@ -57,292 +62,292 @@ const variations = [
57
62
  isDefault: true,
58
63
  name: 'wordpress',
59
64
  attributes: { service: 'wordpress' },
60
- title: 'WordPress',
65
+ title: __( 'WordPress' ),
61
66
  icon: WordPressIcon,
62
67
  },
63
68
 
64
69
  {
65
70
  name: 'fivehundredpx',
66
71
  attributes: { service: 'fivehundredpx' },
67
- title: '500px',
72
+ title: __( '500px' ),
68
73
  icon: FivehundredpxIcon,
69
74
  },
70
75
  {
71
76
  name: 'amazon',
72
77
  attributes: { service: 'amazon' },
73
- title: 'Amazon',
78
+ title: __( 'Amazon' ),
74
79
  icon: AmazonIcon,
75
80
  },
76
81
  {
77
82
  name: 'bandcamp',
78
83
  attributes: { service: 'bandcamp' },
79
- title: 'Bandcamp',
84
+ title: __( 'Bandcamp' ),
80
85
  icon: BandcampIcon,
81
86
  },
82
87
  {
83
88
  name: 'behance',
84
89
  attributes: { service: 'behance' },
85
- title: 'Behance',
90
+ title: __( 'Behance' ),
86
91
  icon: BehanceIcon,
87
92
  },
88
93
  {
89
94
  name: 'bluesky',
90
95
  attributes: { service: 'bluesky' },
91
- title: 'Bluesky',
96
+ title: __( 'Bluesky' ),
92
97
  icon: BlueskyIcon,
93
98
  },
94
99
  {
95
100
  name: 'chain',
96
101
  attributes: { service: 'chain' },
97
- title: 'Link',
102
+ title: __( 'Link' ),
98
103
  icon: ChainIcon,
99
104
  },
100
105
  {
101
106
  name: 'codepen',
102
107
  attributes: { service: 'codepen' },
103
- title: 'CodePen',
108
+ title: __( 'CodePen' ),
104
109
  icon: CodepenIcon,
105
110
  },
106
111
  {
107
112
  name: 'deviantart',
108
113
  attributes: { service: 'deviantart' },
109
- title: 'DeviantArt',
114
+ title: __( 'DeviantArt' ),
110
115
  icon: DeviantArtIcon,
111
116
  },
112
117
  {
113
118
  name: 'discord',
114
119
  attributes: { service: 'discord' },
115
- title: 'Discord',
120
+ title: __( 'Discord' ),
116
121
  icon: DiscordIcon,
117
122
  },
118
123
  {
119
124
  name: 'dribbble',
120
125
  attributes: { service: 'dribbble' },
121
- title: 'Dribbble',
126
+ title: __( 'Dribbble' ),
122
127
  icon: DribbbleIcon,
123
128
  },
124
129
  {
125
130
  name: 'dropbox',
126
131
  attributes: { service: 'dropbox' },
127
- title: 'Dropbox',
132
+ title: __( 'Dropbox' ),
128
133
  icon: DropboxIcon,
129
134
  },
130
135
  {
131
136
  name: 'etsy',
132
137
  attributes: { service: 'etsy' },
133
- title: 'Etsy',
138
+ title: __( 'Etsy' ),
134
139
  icon: EtsyIcon,
135
140
  },
136
141
  {
137
142
  name: 'facebook',
138
143
  attributes: { service: 'facebook' },
139
- title: 'Facebook',
144
+ title: __( 'Facebook' ),
140
145
  icon: FacebookIcon,
141
146
  },
142
147
  {
143
148
  name: 'feed',
144
149
  attributes: { service: 'feed' },
145
- title: 'RSS Feed',
150
+ title: __( 'RSS Feed' ),
146
151
  icon: FeedIcon,
147
152
  },
148
153
  {
149
154
  name: 'flickr',
150
155
  attributes: { service: 'flickr' },
151
- title: 'Flickr',
156
+ title: __( 'Flickr' ),
152
157
  icon: FlickrIcon,
153
158
  },
154
159
  {
155
160
  name: 'foursquare',
156
161
  attributes: { service: 'foursquare' },
157
- title: 'Foursquare',
162
+ title: __( 'Foursquare' ),
158
163
  icon: FoursquareIcon,
159
164
  },
160
165
  {
161
166
  name: 'goodreads',
162
167
  attributes: { service: 'goodreads' },
163
- title: 'Goodreads',
168
+ title: __( 'Goodreads' ),
164
169
  icon: GoodreadsIcon,
165
170
  },
166
171
  {
167
172
  name: 'google',
168
173
  attributes: { service: 'google' },
169
- title: 'Google',
174
+ title: __( 'Google' ),
170
175
  icon: GoogleIcon,
171
176
  },
172
177
  {
173
178
  name: 'github',
174
179
  attributes: { service: 'github' },
175
- title: 'GitHub',
180
+ title: __( 'GitHub' ),
176
181
  icon: GitHubIcon,
177
182
  },
178
183
  {
179
184
  name: 'gravatar',
180
185
  attributes: { service: 'gravatar' },
181
- title: 'Gravatar',
186
+ title: __( 'Gravatar' ),
182
187
  icon: GravatarIcon,
183
188
  },
184
189
  {
185
190
  name: 'instagram',
186
191
  attributes: { service: 'instagram' },
187
- title: 'Instagram',
192
+ title: __( 'Instagram' ),
188
193
  icon: InstagramIcon,
189
194
  },
190
195
  {
191
196
  name: 'lastfm',
192
197
  attributes: { service: 'lastfm' },
193
- title: 'Last.fm',
198
+ title: __( 'Last.fm' ),
194
199
  icon: LastfmIcon,
195
200
  },
196
201
  {
197
202
  name: 'linkedin',
198
203
  attributes: { service: 'linkedin' },
199
- title: 'LinkedIn',
204
+ title: __( 'LinkedIn' ),
200
205
  icon: LinkedInIcon,
201
206
  },
202
207
  {
203
208
  name: 'mail',
204
209
  attributes: { service: 'mail' },
205
- title: 'Mail',
210
+ title: __( 'Mail' ),
206
211
  keywords: [ 'email', 'e-mail' ],
207
212
  icon: MailIcon,
208
213
  },
209
214
  {
210
215
  name: 'mastodon',
211
216
  attributes: { service: 'mastodon' },
212
- title: 'Mastodon',
217
+ title: __( 'Mastodon' ),
213
218
  icon: MastodonIcon,
214
219
  },
215
220
  {
216
221
  name: 'meetup',
217
222
  attributes: { service: 'meetup' },
218
- title: 'Meetup',
223
+ title: __( 'Meetup' ),
219
224
  icon: MeetupIcon,
220
225
  },
221
226
  {
222
227
  name: 'medium',
223
228
  attributes: { service: 'medium' },
224
- title: 'Medium',
229
+ title: __( 'Medium' ),
225
230
  icon: MediumIcon,
226
231
  },
227
232
  {
228
233
  name: 'patreon',
229
234
  attributes: { service: 'patreon' },
230
- title: 'Patreon',
235
+ title: __( 'Patreon' ),
231
236
  icon: PatreonIcon,
232
237
  },
233
238
  {
234
239
  name: 'pinterest',
235
240
  attributes: { service: 'pinterest' },
236
- title: 'Pinterest',
241
+ title: __( 'Pinterest' ),
237
242
  icon: PinterestIcon,
238
243
  },
239
244
  {
240
245
  name: 'pocket',
241
246
  attributes: { service: 'pocket' },
242
- title: 'Pocket',
247
+ title: __( 'Pocket' ),
243
248
  icon: PocketIcon,
244
249
  },
245
250
  {
246
251
  name: 'reddit',
247
252
  attributes: { service: 'reddit' },
248
- title: 'Reddit',
253
+ title: __( 'Reddit' ),
249
254
  icon: RedditIcon,
250
255
  },
251
256
  {
252
257
  name: 'skype',
253
258
  attributes: { service: 'skype' },
254
- title: 'Skype',
259
+ title: __( 'Skype' ),
255
260
  icon: SkypeIcon,
256
261
  },
257
262
  {
258
263
  name: 'snapchat',
259
264
  attributes: { service: 'snapchat' },
260
- title: 'Snapchat',
265
+ title: __( 'Snapchat' ),
261
266
  icon: SnapchatIcon,
262
267
  },
263
268
  {
264
269
  name: 'soundcloud',
265
270
  attributes: { service: 'soundcloud' },
266
- title: 'SoundCloud',
271
+ title: __( 'SoundCloud' ),
267
272
  icon: SoundCloudIcon,
268
273
  },
269
274
  {
270
275
  name: 'spotify',
271
276
  attributes: { service: 'spotify' },
272
- title: 'Spotify',
277
+ title: __( 'Spotify' ),
273
278
  icon: SpotifyIcon,
274
279
  },
275
280
  {
276
281
  name: 'telegram',
277
282
  attributes: { service: 'telegram' },
278
- title: 'Telegram',
283
+ title: __( 'Telegram' ),
279
284
  icon: TelegramIcon,
280
285
  },
281
286
  {
282
287
  name: 'threads',
283
288
  attributes: { service: 'threads' },
284
- title: 'Threads',
289
+ title: __( 'Threads' ),
285
290
  icon: ThreadsIcon,
286
291
  },
287
292
  {
288
293
  name: 'tiktok',
289
294
  attributes: { service: 'tiktok' },
290
- title: 'TikTok',
295
+ title: __( 'TikTok' ),
291
296
  icon: TiktokIcon,
292
297
  },
293
298
  {
294
299
  name: 'tumblr',
295
300
  attributes: { service: 'tumblr' },
296
- title: 'Tumblr',
301
+ title: __( 'Tumblr' ),
297
302
  icon: TumblrIcon,
298
303
  },
299
304
  {
300
305
  name: 'twitch',
301
306
  attributes: { service: 'twitch' },
302
- title: 'Twitch',
307
+ title: __( 'Twitch' ),
303
308
  icon: TwitchIcon,
304
309
  },
305
310
  {
306
311
  name: 'twitter',
307
312
  attributes: { service: 'twitter' },
308
- title: 'Twitter',
313
+ title: __( 'Twitter' ),
309
314
  icon: TwitterIcon,
310
315
  },
311
316
  {
312
317
  name: 'vimeo',
313
318
  attributes: { service: 'vimeo' },
314
- title: 'Vimeo',
319
+ title: __( 'Vimeo' ),
315
320
  icon: VimeoIcon,
316
321
  },
317
322
  {
318
323
  name: 'vk',
319
324
  attributes: { service: 'vk' },
320
- title: 'VK',
325
+ title: __( 'VK' ),
321
326
  icon: VkIcon,
322
327
  },
323
328
  {
324
329
  name: 'whatsapp',
325
330
  attributes: { service: 'whatsapp' },
326
- title: 'WhatsApp',
331
+ title: __( 'WhatsApp' ),
327
332
  icon: WhatsAppIcon,
328
333
  },
329
334
  {
330
335
  name: 'x',
331
336
  attributes: { service: 'x' },
332
337
  keywords: [ 'twitter' ],
333
- title: 'X',
338
+ title: __( 'X' ),
334
339
  icon: XIcon,
335
340
  },
336
341
  {
337
342
  name: 'yelp',
338
343
  attributes: { service: 'yelp' },
339
- title: 'Yelp',
344
+ title: __( 'Yelp' ),
340
345
  icon: YelpIcon,
341
346
  },
342
347
  {
343
348
  name: 'youtube',
344
349
  attributes: { service: 'youtube' },
345
- title: 'YouTube',
350
+ title: __( 'YouTube' ),
346
351
  icon: YouTubeIcon,
347
352
  },
348
353
  ];
@@ -8,7 +8,6 @@ import clsx from 'clsx';
8
8
  */
9
9
  import { useEffect } from '@wordpress/element';
10
10
  import {
11
- BlockControls,
12
11
  useInnerBlocksProps,
13
12
  useBlockProps,
14
13
  InspectorControls,
@@ -20,15 +19,12 @@ import {
20
19
  store as blockEditorStore,
21
20
  } from '@wordpress/block-editor';
22
21
  import {
23
- MenuGroup,
24
- MenuItem,
25
22
  ToggleControl,
26
- ToolbarDropdownMenu,
23
+ SelectControl,
27
24
  __experimentalToolsPanel as ToolsPanel,
28
25
  __experimentalToolsPanelItem as ToolsPanelItem,
29
26
  } from '@wordpress/components';
30
27
  import { __ } from '@wordpress/i18n';
31
- import { check } from '@wordpress/icons';
32
28
  import { useSelect } from '@wordpress/data';
33
29
 
34
30
  /**
@@ -37,10 +33,10 @@ import { useSelect } from '@wordpress/data';
37
33
  import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
38
34
 
39
35
  const sizeOptions = [
40
- { name: __( 'Small' ), value: 'has-small-icon-size' },
41
- { name: __( 'Normal' ), value: 'has-normal-icon-size' },
42
- { name: __( 'Large' ), value: 'has-large-icon-size' },
43
- { name: __( 'Huge' ), value: 'has-huge-icon-size' },
36
+ { label: __( 'Small' ), value: 'has-small-icon-size' },
37
+ { label: __( 'Normal' ), value: 'has-normal-icon-size' },
38
+ { label: __( 'Large' ), value: 'has-large-icon-size' },
39
+ { label: __( 'Huge' ), value: 'has-huge-icon-size' },
44
40
  ];
45
41
 
46
42
  export function SocialLinksEdit( props ) {
@@ -123,10 +119,6 @@ export function SocialLinksEdit( props ) {
123
119
  : undefined,
124
120
  } );
125
121
 
126
- const POPOVER_PROPS = {
127
- position: 'bottom right',
128
- };
129
-
130
122
  const colorSettings = [
131
123
  {
132
124
  // Use custom attribute as fallback to prevent loss of named color selection when
@@ -167,43 +159,6 @@ export function SocialLinksEdit( props ) {
167
159
 
168
160
  return (
169
161
  <>
170
- <BlockControls group="other">
171
- <ToolbarDropdownMenu
172
- label={ __( 'Size' ) }
173
- text={ __( 'Size' ) }
174
- icon={ null }
175
- popoverProps={ POPOVER_PROPS }
176
- >
177
- { ( { onClose } ) => (
178
- <MenuGroup>
179
- { sizeOptions.map( ( entry ) => {
180
- return (
181
- <MenuItem
182
- icon={
183
- ( size === entry.value ||
184
- ( ! size &&
185
- entry.value ===
186
- 'has-normal-icon-size' ) ) &&
187
- check
188
- }
189
- isSelected={ size === entry.value }
190
- key={ entry.value }
191
- onClick={ () => {
192
- setAttributes( {
193
- size: entry.value,
194
- } );
195
- } }
196
- onClose={ onClose }
197
- role="menuitemradio"
198
- >
199
- { entry.name }
200
- </MenuItem>
201
- );
202
- } ) }
203
- </MenuGroup>
204
- ) }
205
- </ToolbarDropdownMenu>
206
- </BlockControls>
207
162
  <InspectorControls>
208
163
  <ToolsPanel
209
164
  label={ __( 'Settings' ) }
@@ -211,27 +166,32 @@ export function SocialLinksEdit( props ) {
211
166
  setAttributes( {
212
167
  openInNewTab: false,
213
168
  showLabels: false,
169
+ size: 'has-normal-icon-size',
214
170
  } );
215
171
  } }
216
172
  dropdownMenuProps={ dropdownMenuProps }
217
173
  >
218
174
  <ToolsPanelItem
219
175
  isShownByDefault
220
- label={ __( 'Open links in new tab' ) }
221
- hasValue={ () => !! openInNewTab }
176
+ hasValue={ () =>
177
+ !! size && size !== 'has-normal-icon-size'
178
+ }
179
+ label={ __( 'Icon size' ) }
222
180
  onDeselect={ () =>
223
- setAttributes( { openInNewTab: false } )
181
+ setAttributes( { size: 'has-normal-icon-size' } )
224
182
  }
225
183
  >
226
- <ToggleControl
184
+ <SelectControl
185
+ __next40pxDefaultSize
227
186
  __nextHasNoMarginBottom
228
- label={ __( 'Open links in new tab' ) }
229
- checked={ openInNewTab }
230
- onChange={ () =>
187
+ label={ __( 'Icon Size' ) }
188
+ onChange={ ( newSize ) => {
231
189
  setAttributes( {
232
- openInNewTab: ! openInNewTab,
233
- } )
234
- }
190
+ size: newSize,
191
+ } );
192
+ } }
193
+ value={ size ?? 'has-normal-icon-size' }
194
+ options={ sizeOptions }
235
195
  />
236
196
  </ToolsPanelItem>
237
197
  <ToolsPanelItem
@@ -251,6 +211,25 @@ export function SocialLinksEdit( props ) {
251
211
  }
252
212
  />
253
213
  </ToolsPanelItem>
214
+ <ToolsPanelItem
215
+ isShownByDefault
216
+ label={ __( 'Open links in new tab' ) }
217
+ hasValue={ () => !! openInNewTab }
218
+ onDeselect={ () =>
219
+ setAttributes( { openInNewTab: false } )
220
+ }
221
+ >
222
+ <ToggleControl
223
+ __nextHasNoMarginBottom
224
+ label={ __( 'Open links in new tab' ) }
225
+ checked={ openInNewTab }
226
+ onChange={ () =>
227
+ setAttributes( {
228
+ openInNewTab: ! openInNewTab,
229
+ } )
230
+ }
231
+ />
232
+ </ToolsPanelItem>
254
233
  </ToolsPanel>
255
234
  </InspectorControls>
256
235
  { colorGradientSettings.hasColorsOrGradients && (
@@ -13,9 +13,11 @@ import {
13
13
  Button,
14
14
  TextControl,
15
15
  SelectControl,
16
+ ToggleControl,
16
17
  __experimentalGrid as Grid,
17
18
  __experimentalHStack as HStack,
18
19
  __experimentalVStack as VStack,
20
+ privateApis as componentsPrivateApis,
19
21
  } from '@wordpress/components';
20
22
  import {
21
23
  MediaUpload,
@@ -27,6 +29,13 @@ import { useSelect } from '@wordpress/data';
27
29
  import { useState, useRef, useEffect } from '@wordpress/element';
28
30
  import { getFilename } from '@wordpress/url';
29
31
 
32
+ /**
33
+ * Internal dependencies
34
+ */
35
+ import { unlock } from '../lock-unlock';
36
+
37
+ const { Badge } = unlock( componentsPrivateApis );
38
+
30
39
  const ALLOWED_TYPES = [ 'text/vtt' ];
31
40
 
32
41
  const DEFAULT_KIND = 'subtitles';
@@ -43,22 +52,25 @@ function TrackList( { tracks, onEditPress } ) {
43
52
  const content = tracks.map( ( track, index ) => {
44
53
  return (
45
54
  <HStack
46
- key={ index }
55
+ key={ track.src }
47
56
  className="block-library-video-tracks-editor__track-list-track"
48
57
  >
49
58
  <span>{ track.label }</span>
50
- <Button
51
- __next40pxDefaultSize
52
- variant="tertiary"
53
- onClick={ () => onEditPress( index ) }
54
- aria-label={ sprintf(
55
- /* translators: %s: Label of the video text track e.g: "French subtitles". */
56
- _x( 'Edit %s', 'text tracks' ),
57
- track.label
58
- ) }
59
- >
60
- { __( 'Edit' ) }
61
- </Button>
59
+ <HStack justify="flex-end">
60
+ { track.default && <Badge>{ __( 'Default' ) }</Badge> }
61
+ <Button
62
+ __next40pxDefaultSize
63
+ variant="tertiary"
64
+ onClick={ () => onEditPress( index ) }
65
+ aria-label={ sprintf(
66
+ /* translators: %s: Label of the video text track e.g: "French subtitles". */
67
+ _x( 'Edit %s', 'text tracks' ),
68
+ track.label
69
+ ) }
70
+ >
71
+ { __( 'Edit' ) }
72
+ </Button>
73
+ </HStack>
62
74
  </HStack>
63
75
  );
64
76
  } );
@@ -73,8 +85,20 @@ function TrackList( { tracks, onEditPress } ) {
73
85
  );
74
86
  }
75
87
 
76
- function SingleTrackEditor( { track, onChange, onClose, onRemove } ) {
77
- const { src = '', label = '', srcLang = '', kind = DEFAULT_KIND } = track;
88
+ function SingleTrackEditor( {
89
+ track,
90
+ onChange,
91
+ onClose,
92
+ onRemove,
93
+ allowSettingDefault,
94
+ } ) {
95
+ const {
96
+ src = '',
97
+ label = '',
98
+ srcLang = '',
99
+ kind = DEFAULT_KIND,
100
+ default: isDefaultTrack = false,
101
+ } = track;
78
102
  const fileName = src.startsWith( 'blob:' ) ? '' : getFilename( src ) || '';
79
103
  return (
80
104
  <VStack
@@ -115,7 +139,7 @@ function SingleTrackEditor( { track, onChange, onClose, onRemove } ) {
115
139
  help={ __( 'Language tag (en, fr, etc.)' ) }
116
140
  />
117
141
  </Grid>
118
- <VStack spacing="8">
142
+ <VStack spacing="4">
119
143
  <SelectControl
120
144
  __next40pxDefaultSize
121
145
  __nextHasNoMarginBottom
@@ -130,6 +154,19 @@ function SingleTrackEditor( { track, onChange, onClose, onRemove } ) {
130
154
  } );
131
155
  } }
132
156
  />
157
+ <ToggleControl
158
+ __next40pxDefaultSize
159
+ __nextHasNoMarginBottom
160
+ label={ __( 'Set as default track' ) }
161
+ checked={ isDefaultTrack }
162
+ disabled={ ! allowSettingDefault }
163
+ onChange={ ( defaultTrack ) => {
164
+ onChange( {
165
+ ...track,
166
+ default: defaultTrack,
167
+ } );
168
+ } }
169
+ />
133
170
  <HStack className="block-library-video-tracks-editor__single-track-editor-buttons-container">
134
171
  <Button
135
172
  __next40pxDefaultSize
@@ -237,6 +274,10 @@ export default function TracksEditor( { tracks = [], onChange } ) {
237
274
  );
238
275
  setTrackBeingEdited( null );
239
276
  } }
277
+ allowSettingDefault={
278
+ ! tracks.some( ( track ) => track.default ) ||
279
+ tracks[ trackBeingEdited ].default
280
+ }
240
281
  />
241
282
  );
242
283
  }