@wordpress/block-library 9.7.1-next.5368f64a9.0 → 9.8.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 (132) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/categories/edit.js +38 -17
  3. package/build/categories/edit.js.map +1 -1
  4. package/build/categories/index.js +10 -3
  5. package/build/categories/index.js.map +1 -1
  6. package/build/categories/variations.js +43 -0
  7. package/build/categories/variations.js.map +1 -0
  8. package/build/embed/edit.js +1 -0
  9. package/build/embed/edit.js.map +1 -1
  10. package/build/embed/edit.native.js +1 -0
  11. package/build/embed/edit.native.js.map +1 -1
  12. package/build/embed/embed-preview.js +80 -100
  13. package/build/embed/embed-preview.js.map +1 -1
  14. package/build/embed/embed-preview.native.js +1 -0
  15. package/build/embed/embed-preview.native.js.map +1 -1
  16. package/build/form/view.js +1 -0
  17. package/build/form/view.js.map +1 -1
  18. package/build/form-input/deprecated.js +113 -1
  19. package/build/form-input/deprecated.js.map +1 -1
  20. package/build/form-input/edit.js +16 -12
  21. package/build/form-input/edit.js.map +1 -1
  22. package/build/form-input/save.js +9 -1
  23. package/build/form-input/save.js.map +1 -1
  24. package/build/image/image.js +5 -2
  25. package/build/image/image.js.map +1 -1
  26. package/build/index.js +1 -0
  27. package/build/index.js.map +1 -1
  28. package/build/navigation-submenu/index.js +13 -0
  29. package/build/navigation-submenu/index.js.map +1 -1
  30. package/build/post-template/edit.js +6 -1
  31. package/build/post-template/edit.js.map +1 -1
  32. package/build/post-title/index.js +1 -4
  33. package/build/post-title/index.js.map +1 -1
  34. package/build/query/edit/inspector-controls/format-controls.js +102 -0
  35. package/build/query/edit/inspector-controls/format-controls.js.map +1 -0
  36. package/build/query/edit/inspector-controls/index.js +45 -9
  37. package/build/query/edit/inspector-controls/index.js.map +1 -1
  38. package/build/query/edit/query-content.js +26 -10
  39. package/build/query/edit/query-content.js.map +1 -1
  40. package/build/query/index.js +3 -1
  41. package/build/query/index.js.map +1 -1
  42. package/build/query/utils.js +12 -1
  43. package/build/query/utils.js.map +1 -1
  44. package/build/site-title/index.js +1 -4
  45. package/build/site-title/index.js.map +1 -1
  46. package/build/social-link/edit.js +13 -11
  47. package/build/social-link/edit.js.map +1 -1
  48. package/build-module/categories/edit.js +40 -19
  49. package/build-module/categories/edit.js.map +1 -1
  50. package/build-module/categories/index.js +10 -3
  51. package/build-module/categories/index.js.map +1 -1
  52. package/build-module/categories/variations.js +36 -0
  53. package/build-module/categories/variations.js.map +1 -0
  54. package/build-module/embed/edit.js +1 -0
  55. package/build-module/embed/edit.js.map +1 -1
  56. package/build-module/embed/edit.native.js +1 -0
  57. package/build-module/embed/edit.native.js.map +1 -1
  58. package/build-module/embed/embed-preview.js +80 -100
  59. package/build-module/embed/embed-preview.js.map +1 -1
  60. package/build-module/embed/embed-preview.native.js +1 -0
  61. package/build-module/embed/embed-preview.native.js.map +1 -1
  62. package/build-module/form/view.js +1 -0
  63. package/build-module/form/view.js.map +1 -1
  64. package/build-module/form-input/deprecated.js +114 -2
  65. package/build-module/form-input/deprecated.js.map +1 -1
  66. package/build-module/form-input/edit.js +16 -12
  67. package/build-module/form-input/edit.js.map +1 -1
  68. package/build-module/form-input/save.js +9 -1
  69. package/build-module/form-input/save.js.map +1 -1
  70. package/build-module/image/image.js +5 -2
  71. package/build-module/image/image.js.map +1 -1
  72. package/build-module/index.js +1 -0
  73. package/build-module/index.js.map +1 -1
  74. package/build-module/navigation-submenu/index.js +13 -0
  75. package/build-module/navigation-submenu/index.js.map +1 -1
  76. package/build-module/post-template/edit.js +6 -1
  77. package/build-module/post-template/edit.js.map +1 -1
  78. package/build-module/post-title/index.js +1 -4
  79. package/build-module/post-title/index.js.map +1 -1
  80. package/build-module/query/edit/inspector-controls/format-controls.js +96 -0
  81. package/build-module/query/edit/inspector-controls/format-controls.js.map +1 -0
  82. package/build-module/query/edit/inspector-controls/index.js +45 -9
  83. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  84. package/build-module/query/edit/query-content.js +27 -11
  85. package/build-module/query/edit/query-content.js.map +1 -1
  86. package/build-module/query/index.js +3 -1
  87. package/build-module/query/index.js.map +1 -1
  88. package/build-module/query/utils.js +12 -1
  89. package/build-module/query/utils.js.map +1 -1
  90. package/build-module/site-title/index.js +1 -4
  91. package/build-module/site-title/index.js.map +1 -1
  92. package/build-module/social-link/edit.js +14 -12
  93. package/build-module/social-link/edit.js.map +1 -1
  94. package/build-style/editor-rtl.css +1 -1
  95. package/build-style/editor.css +1 -1
  96. package/build-style/form-input/style-rtl.css +7 -8
  97. package/build-style/form-input/style.css +7 -8
  98. package/build-style/gallery/editor-rtl.css +1 -1
  99. package/build-style/gallery/editor.css +1 -1
  100. package/build-style/post-title/style-rtl.css +4 -18
  101. package/build-style/post-title/style.css +4 -18
  102. package/build-style/site-title/style-rtl.css +4 -18
  103. package/build-style/site-title/style.css +4 -18
  104. package/build-style/style-rtl.css +15 -44
  105. package/build-style/style.css +15 -44
  106. package/package.json +35 -35
  107. package/src/categories/block.json +7 -2
  108. package/src/categories/edit.js +69 -30
  109. package/src/categories/index.js +2 -0
  110. package/src/categories/index.php +21 -9
  111. package/src/categories/variations.js +40 -0
  112. package/src/comments-pagination-next/index.php +1 -1
  113. package/src/comments-pagination-previous/index.php +2 -1
  114. package/src/embed/embed-preview.js +96 -112
  115. package/src/form-input/deprecated.js +114 -1
  116. package/src/form-input/edit.js +17 -11
  117. package/src/form-input/save.js +13 -3
  118. package/src/form-input/style.scss +9 -8
  119. package/src/image/image.js +2 -1
  120. package/src/navigation-submenu/block.json +13 -0
  121. package/src/post-template/edit.js +6 -0
  122. package/src/post-template/index.php +5 -0
  123. package/src/post-title/block.json +1 -4
  124. package/src/post-title/style.scss +4 -21
  125. package/src/query/block.json +3 -1
  126. package/src/query/edit/inspector-controls/format-controls.js +90 -0
  127. package/src/query/edit/inspector-controls/index.js +68 -9
  128. package/src/query/edit/query-content.js +38 -5
  129. package/src/query/utils.js +16 -1
  130. package/src/site-title/block.json +1 -4
  131. package/src/site-title/style.scss +4 -21
  132. package/src/social-link/edit.js +11 -7
@@ -93,27 +93,13 @@
93
93
  word-break: break-word;
94
94
  box-sizing: border-box;
95
95
  }
96
- .wp-block-post-title[style*=font-weight] :where(a) {
97
- font-weight: inherit;
98
- }
99
- .wp-block-post-title[class*=-font-family] :where(a), .wp-block-post-title[style*=font-family] :where(a) {
96
+ .wp-block-post-title :where(a) {
97
+ display: inline-block;
100
98
  font-family: inherit;
101
- }
102
- .wp-block-post-title[class*=-font-size] :where(a), .wp-block-post-title[style*=font-size] :where(a) {
103
99
  font-size: inherit;
104
- }
105
- .wp-block-post-title[style*=line-height] :where(a) {
106
- line-height: inherit;
107
- }
108
- .wp-block-post-title[style*=font-style] :where(a) {
109
100
  font-style: inherit;
110
- }
111
- .wp-block-post-title[style*=letter-spacing] :where(a) {
101
+ font-weight: inherit;
112
102
  letter-spacing: inherit;
113
- }
114
- .wp-block-post-title[style*=text-decoration] :where(a) {
103
+ line-height: inherit;
115
104
  text-decoration: inherit;
116
- }
117
- .wp-block-post-title a {
118
- display: inline-block;
119
105
  }
@@ -93,27 +93,13 @@
93
93
  word-break: break-word;
94
94
  box-sizing: border-box;
95
95
  }
96
- .wp-block-post-title[style*=font-weight] :where(a) {
97
- font-weight: inherit;
98
- }
99
- .wp-block-post-title[class*=-font-family] :where(a), .wp-block-post-title[style*=font-family] :where(a) {
96
+ .wp-block-post-title :where(a) {
97
+ display: inline-block;
100
98
  font-family: inherit;
101
- }
102
- .wp-block-post-title[class*=-font-size] :where(a), .wp-block-post-title[style*=font-size] :where(a) {
103
99
  font-size: inherit;
104
- }
105
- .wp-block-post-title[style*=line-height] :where(a) {
106
- line-height: inherit;
107
- }
108
- .wp-block-post-title[style*=font-style] :where(a) {
109
100
  font-style: inherit;
110
- }
111
- .wp-block-post-title[style*=letter-spacing] :where(a) {
101
+ font-weight: inherit;
112
102
  letter-spacing: inherit;
113
- }
114
- .wp-block-post-title[style*=text-decoration] :where(a) {
103
+ line-height: inherit;
115
104
  text-decoration: inherit;
116
- }
117
- .wp-block-post-title a {
118
- display: inline-block;
119
105
  }
@@ -92,27 +92,13 @@
92
92
  .wp-block-site-title {
93
93
  box-sizing: border-box;
94
94
  }
95
- .wp-block-site-title[style*=font-weight] :where(a) {
96
- font-weight: inherit;
97
- }
98
- .wp-block-site-title[class*=-font-family] :where(a), .wp-block-site-title[style*=font-family] :where(a) {
95
+ .wp-block-site-title :where(a) {
96
+ color: inherit;
99
97
  font-family: inherit;
100
- }
101
- .wp-block-site-title[class*=-font-size] :where(a), .wp-block-site-title[style*=font-size] :where(a) {
102
98
  font-size: inherit;
103
- }
104
- .wp-block-site-title[style*=line-height] :where(a) {
105
- line-height: inherit;
106
- }
107
- .wp-block-site-title[style*=font-style] :where(a) {
108
99
  font-style: inherit;
109
- }
110
- .wp-block-site-title[style*=letter-spacing] :where(a) {
100
+ font-weight: inherit;
111
101
  letter-spacing: inherit;
112
- }
113
- .wp-block-site-title[style*=text-decoration] :where(a) {
102
+ line-height: inherit;
114
103
  text-decoration: inherit;
115
- }
116
- .wp-block-site-title :where(a) {
117
- color: inherit;
118
104
  }
@@ -92,27 +92,13 @@
92
92
  .wp-block-site-title {
93
93
  box-sizing: border-box;
94
94
  }
95
- .wp-block-site-title[style*=font-weight] :where(a) {
96
- font-weight: inherit;
97
- }
98
- .wp-block-site-title[class*=-font-family] :where(a), .wp-block-site-title[style*=font-family] :where(a) {
95
+ .wp-block-site-title :where(a) {
96
+ color: inherit;
99
97
  font-family: inherit;
100
- }
101
- .wp-block-site-title[class*=-font-size] :where(a), .wp-block-site-title[style*=font-size] :where(a) {
102
98
  font-size: inherit;
103
- }
104
- .wp-block-site-title[style*=line-height] :where(a) {
105
- line-height: inherit;
106
- }
107
- .wp-block-site-title[style*=font-style] :where(a) {
108
99
  font-style: inherit;
109
- }
110
- .wp-block-site-title[style*=letter-spacing] :where(a) {
100
+ font-weight: inherit;
111
101
  letter-spacing: inherit;
112
- }
113
- .wp-block-site-title[style*=text-decoration] :where(a) {
102
+ line-height: inherit;
114
103
  text-decoration: inherit;
115
- }
116
- .wp-block-site-title :where(a) {
117
- color: inherit;
118
104
  }
@@ -1134,13 +1134,6 @@ section.wp-block-cover-image > h2,
1134
1134
  flex-direction: column;
1135
1135
  gap: 0.25em;
1136
1136
  margin-bottom: 0.5em;
1137
- /*
1138
- Small tweak to left-align the checkbox.
1139
- Even though `:has` is not currently supported in Firefox, this is a small tweak
1140
- and does not affect the functionality of the block or the user's experience.
1141
- There will be a minor inconsistency between browsers. However, it's more important to provide
1142
- a better experience for 80+% of users, until Firefox catches up and supports `:has`.
1143
- */
1144
1137
  }
1145
1138
  .wp-block-form-input__label.is-label-inline {
1146
1139
  flex-direction: row;
@@ -1151,9 +1144,15 @@ section.wp-block-cover-image > h2,
1151
1144
  margin-bottom: 0.5em;
1152
1145
  }
1153
1146
  .wp-block-form-input__label:has(input[type=checkbox]) {
1147
+ flex-direction: row;
1154
1148
  width: -moz-fit-content;
1155
1149
  width: fit-content;
1156
- /* stylelint-disable-next-line declaration-property-value-allowed-list -- This should be refactored to not use the row-reverse value. */
1150
+ }
1151
+ .wp-block-form-input__label:has(input[type=checkbox]) .wp-block-form-input__label-content {
1152
+ margin: 0;
1153
+ }
1154
+ .wp-block-form-input__label:has(.wp-block-form-input__label-content + input[type=checkbox]) {
1155
+ /* stylelint-disable-next-line declaration-property-value-allowed-list -- This style is required for old markup. */
1157
1156
  flex-direction: row-reverse;
1158
1157
  }
1159
1158
 
@@ -3014,30 +3013,16 @@ p.has-text-align-left[style*="writing-mode:vertical-lr"] {
3014
3013
  word-break: break-word;
3015
3014
  box-sizing: border-box;
3016
3015
  }
3017
- .wp-block-post-title[style*=font-weight] :where(a) {
3018
- font-weight: inherit;
3019
- }
3020
- .wp-block-post-title[class*=-font-family] :where(a), .wp-block-post-title[style*=font-family] :where(a) {
3016
+ .wp-block-post-title :where(a) {
3017
+ display: inline-block;
3021
3018
  font-family: inherit;
3022
- }
3023
- .wp-block-post-title[class*=-font-size] :where(a), .wp-block-post-title[style*=font-size] :where(a) {
3024
3019
  font-size: inherit;
3025
- }
3026
- .wp-block-post-title[style*=line-height] :where(a) {
3027
- line-height: inherit;
3028
- }
3029
- .wp-block-post-title[style*=font-style] :where(a) {
3030
3020
  font-style: inherit;
3031
- }
3032
- .wp-block-post-title[style*=letter-spacing] :where(a) {
3021
+ font-weight: inherit;
3033
3022
  letter-spacing: inherit;
3034
- }
3035
- .wp-block-post-title[style*=text-decoration] :where(a) {
3023
+ line-height: inherit;
3036
3024
  text-decoration: inherit;
3037
3025
  }
3038
- .wp-block-post-title a {
3039
- display: inline-block;
3040
- }
3041
3026
 
3042
3027
  .wp-block-post-author-name {
3043
3028
  box-sizing: border-box;
@@ -3459,30 +3444,16 @@ ul.wp-block-rss.is-grid li {
3459
3444
  .wp-block-site-title {
3460
3445
  box-sizing: border-box;
3461
3446
  }
3462
- .wp-block-site-title[style*=font-weight] :where(a) {
3463
- font-weight: inherit;
3464
- }
3465
- .wp-block-site-title[class*=-font-family] :where(a), .wp-block-site-title[style*=font-family] :where(a) {
3447
+ .wp-block-site-title :where(a) {
3448
+ color: inherit;
3466
3449
  font-family: inherit;
3467
- }
3468
- .wp-block-site-title[class*=-font-size] :where(a), .wp-block-site-title[style*=font-size] :where(a) {
3469
3450
  font-size: inherit;
3470
- }
3471
- .wp-block-site-title[style*=line-height] :where(a) {
3472
- line-height: inherit;
3473
- }
3474
- .wp-block-site-title[style*=font-style] :where(a) {
3475
3451
  font-style: inherit;
3476
- }
3477
- .wp-block-site-title[style*=letter-spacing] :where(a) {
3452
+ font-weight: inherit;
3478
3453
  letter-spacing: inherit;
3479
- }
3480
- .wp-block-site-title[style*=text-decoration] :where(a) {
3454
+ line-height: inherit;
3481
3455
  text-decoration: inherit;
3482
3456
  }
3483
- .wp-block-site-title :where(a) {
3484
- color: inherit;
3485
- }
3486
3457
 
3487
3458
  .wp-block-social-links {
3488
3459
  box-sizing: border-box;
@@ -1142,13 +1142,6 @@ section.wp-block-cover-image > h2,
1142
1142
  flex-direction: column;
1143
1143
  gap: 0.25em;
1144
1144
  margin-bottom: 0.5em;
1145
- /*
1146
- Small tweak to left-align the checkbox.
1147
- Even though `:has` is not currently supported in Firefox, this is a small tweak
1148
- and does not affect the functionality of the block or the user's experience.
1149
- There will be a minor inconsistency between browsers. However, it's more important to provide
1150
- a better experience for 80+% of users, until Firefox catches up and supports `:has`.
1151
- */
1152
1145
  }
1153
1146
  .wp-block-form-input__label.is-label-inline {
1154
1147
  flex-direction: row;
@@ -1159,9 +1152,15 @@ section.wp-block-cover-image > h2,
1159
1152
  margin-bottom: 0.5em;
1160
1153
  }
1161
1154
  .wp-block-form-input__label:has(input[type=checkbox]) {
1155
+ flex-direction: row;
1162
1156
  width: -moz-fit-content;
1163
1157
  width: fit-content;
1164
- /* stylelint-disable-next-line declaration-property-value-allowed-list -- This should be refactored to not use the row-reverse value. */
1158
+ }
1159
+ .wp-block-form-input__label:has(input[type=checkbox]) .wp-block-form-input__label-content {
1160
+ margin: 0;
1161
+ }
1162
+ .wp-block-form-input__label:has(.wp-block-form-input__label-content + input[type=checkbox]) {
1163
+ /* stylelint-disable-next-line declaration-property-value-allowed-list -- This style is required for old markup. */
1165
1164
  flex-direction: row-reverse;
1166
1165
  }
1167
1166
 
@@ -3044,30 +3043,16 @@ p.has-text-align-left[style*="writing-mode:vertical-lr"] {
3044
3043
  word-break: break-word;
3045
3044
  box-sizing: border-box;
3046
3045
  }
3047
- .wp-block-post-title[style*=font-weight] :where(a) {
3048
- font-weight: inherit;
3049
- }
3050
- .wp-block-post-title[class*=-font-family] :where(a), .wp-block-post-title[style*=font-family] :where(a) {
3046
+ .wp-block-post-title :where(a) {
3047
+ display: inline-block;
3051
3048
  font-family: inherit;
3052
- }
3053
- .wp-block-post-title[class*=-font-size] :where(a), .wp-block-post-title[style*=font-size] :where(a) {
3054
3049
  font-size: inherit;
3055
- }
3056
- .wp-block-post-title[style*=line-height] :where(a) {
3057
- line-height: inherit;
3058
- }
3059
- .wp-block-post-title[style*=font-style] :where(a) {
3060
3050
  font-style: inherit;
3061
- }
3062
- .wp-block-post-title[style*=letter-spacing] :where(a) {
3051
+ font-weight: inherit;
3063
3052
  letter-spacing: inherit;
3064
- }
3065
- .wp-block-post-title[style*=text-decoration] :where(a) {
3053
+ line-height: inherit;
3066
3054
  text-decoration: inherit;
3067
3055
  }
3068
- .wp-block-post-title a {
3069
- display: inline-block;
3070
- }
3071
3056
 
3072
3057
  .wp-block-post-author-name {
3073
3058
  box-sizing: border-box;
@@ -3492,30 +3477,16 @@ ul.wp-block-rss.is-grid li {
3492
3477
  .wp-block-site-title {
3493
3478
  box-sizing: border-box;
3494
3479
  }
3495
- .wp-block-site-title[style*=font-weight] :where(a) {
3496
- font-weight: inherit;
3497
- }
3498
- .wp-block-site-title[class*=-font-family] :where(a), .wp-block-site-title[style*=font-family] :where(a) {
3480
+ .wp-block-site-title :where(a) {
3481
+ color: inherit;
3499
3482
  font-family: inherit;
3500
- }
3501
- .wp-block-site-title[class*=-font-size] :where(a), .wp-block-site-title[style*=font-size] :where(a) {
3502
3483
  font-size: inherit;
3503
- }
3504
- .wp-block-site-title[style*=line-height] :where(a) {
3505
- line-height: inherit;
3506
- }
3507
- .wp-block-site-title[style*=font-style] :where(a) {
3508
3484
  font-style: inherit;
3509
- }
3510
- .wp-block-site-title[style*=letter-spacing] :where(a) {
3485
+ font-weight: inherit;
3511
3486
  letter-spacing: inherit;
3512
- }
3513
- .wp-block-site-title[style*=text-decoration] :where(a) {
3487
+ line-height: inherit;
3514
3488
  text-decoration: inherit;
3515
3489
  }
3516
- .wp-block-site-title :where(a) {
3517
- color: inherit;
3518
- }
3519
3490
 
3520
3491
  .wp-block-social-links {
3521
3492
  box-sizing: border-box;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "9.7.1-next.5368f64a9.0",
3
+ "version": "9.8.0",
4
4
  "description": "Block library for the WordPress editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -39,39 +39,39 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@babel/runtime": "^7.16.0",
42
- "@wordpress/a11y": "^4.7.1-next.5368f64a9.0",
43
- "@wordpress/api-fetch": "^7.7.1-next.5368f64a9.0",
44
- "@wordpress/autop": "^4.7.1-next.5368f64a9.0",
45
- "@wordpress/blob": "^4.7.1-next.5368f64a9.0",
46
- "@wordpress/block-editor": "^14.2.1-next.5368f64a9.0",
47
- "@wordpress/blocks": "^13.7.1-next.5368f64a9.0",
48
- "@wordpress/components": "^28.8.1-next.5368f64a9.0",
49
- "@wordpress/compose": "^7.8.1-next.5368f64a9.0",
50
- "@wordpress/core-data": "^7.7.1-next.5368f64a9.0",
51
- "@wordpress/data": "^10.7.1-next.5368f64a9.0",
52
- "@wordpress/date": "^5.7.1-next.5368f64a9.0",
53
- "@wordpress/deprecated": "^4.7.1-next.5368f64a9.0",
54
- "@wordpress/dom": "^4.7.1-next.5368f64a9.0",
55
- "@wordpress/element": "^6.7.1-next.5368f64a9.0",
56
- "@wordpress/escape-html": "^3.7.1-next.5368f64a9.0",
57
- "@wordpress/hooks": "^4.7.1-next.5368f64a9.0",
58
- "@wordpress/html-entities": "^4.7.1-next.5368f64a9.0",
59
- "@wordpress/i18n": "^5.7.1-next.5368f64a9.0",
60
- "@wordpress/icons": "^10.7.1-next.5368f64a9.0",
61
- "@wordpress/interactivity": "^6.7.2-next.5368f64a9.0",
62
- "@wordpress/interactivity-router": "^2.7.1-next.5368f64a9.0",
63
- "@wordpress/keyboard-shortcuts": "^5.7.1-next.5368f64a9.0",
64
- "@wordpress/keycodes": "^4.7.1-next.5368f64a9.0",
65
- "@wordpress/notices": "^5.7.1-next.5368f64a9.0",
66
- "@wordpress/patterns": "^2.7.1-next.5368f64a9.0",
67
- "@wordpress/primitives": "^4.7.1-next.5368f64a9.0",
68
- "@wordpress/private-apis": "^1.7.1-next.5368f64a9.0",
69
- "@wordpress/reusable-blocks": "^5.7.1-next.5368f64a9.0",
70
- "@wordpress/rich-text": "^7.7.1-next.5368f64a9.0",
71
- "@wordpress/server-side-render": "^5.7.1-next.5368f64a9.0",
72
- "@wordpress/url": "^4.7.1-next.5368f64a9.0",
73
- "@wordpress/viewport": "^6.7.1-next.5368f64a9.0",
74
- "@wordpress/wordcount": "^4.7.1-next.5368f64a9.0",
42
+ "@wordpress/a11y": "^4.8.0",
43
+ "@wordpress/api-fetch": "^7.8.0",
44
+ "@wordpress/autop": "^4.8.0",
45
+ "@wordpress/blob": "^4.8.0",
46
+ "@wordpress/block-editor": "^14.3.0",
47
+ "@wordpress/blocks": "^13.8.0",
48
+ "@wordpress/components": "^28.8.0",
49
+ "@wordpress/compose": "^7.8.0",
50
+ "@wordpress/core-data": "^7.8.0",
51
+ "@wordpress/data": "^10.8.0",
52
+ "@wordpress/date": "^5.8.0",
53
+ "@wordpress/deprecated": "^4.8.0",
54
+ "@wordpress/dom": "^4.8.0",
55
+ "@wordpress/element": "^6.8.0",
56
+ "@wordpress/escape-html": "^3.8.0",
57
+ "@wordpress/hooks": "^4.8.0",
58
+ "@wordpress/html-entities": "^4.8.0",
59
+ "@wordpress/i18n": "^5.8.0",
60
+ "@wordpress/icons": "^10.8.0",
61
+ "@wordpress/interactivity": "^6.8.0",
62
+ "@wordpress/interactivity-router": "^2.8.0",
63
+ "@wordpress/keyboard-shortcuts": "^5.8.0",
64
+ "@wordpress/keycodes": "^4.8.0",
65
+ "@wordpress/notices": "^5.8.0",
66
+ "@wordpress/patterns": "^2.8.0",
67
+ "@wordpress/primitives": "^4.8.0",
68
+ "@wordpress/private-apis": "^1.8.0",
69
+ "@wordpress/reusable-blocks": "^5.8.0",
70
+ "@wordpress/rich-text": "^7.8.0",
71
+ "@wordpress/server-side-render": "^5.8.0",
72
+ "@wordpress/url": "^4.8.0",
73
+ "@wordpress/viewport": "^6.8.0",
74
+ "@wordpress/wordcount": "^4.8.0",
75
75
  "change-case": "^4.1.2",
76
76
  "clsx": "^2.1.1",
77
77
  "colord": "^2.7.0",
@@ -89,5 +89,5 @@
89
89
  "publishConfig": {
90
90
  "access": "public"
91
91
  },
92
- "gitHead": "24934a1f5251bbee15045d1fd953d9c5650317cd"
92
+ "gitHead": "cecf5e14d317aa67407f77a7e5c8b6a43016bd42"
93
93
  }
@@ -2,11 +2,16 @@
2
2
  "$schema": "https://schemas.wp.org/trunk/block.json",
3
3
  "apiVersion": 3,
4
4
  "name": "core/categories",
5
- "title": "Categories List",
5
+ "title": "Terms List",
6
6
  "category": "widgets",
7
- "description": "Display a list of all categories.",
7
+ "description": "Display a list of all terms of a given taxonomy.",
8
+ "keywords": [ "categories" ],
8
9
  "textdomain": "default",
9
10
  "attributes": {
11
+ "taxonomy": {
12
+ "type": "string",
13
+ "default": "category"
14
+ },
10
15
  "displayAsDropdown": {
11
16
  "type": "boolean",
12
17
  "default": false
@@ -9,6 +9,7 @@ import clsx from 'clsx';
9
9
  import {
10
10
  PanelBody,
11
11
  Placeholder,
12
+ SelectControl,
12
13
  Spinner,
13
14
  ToggleControl,
14
15
  VisuallyHidden,
@@ -20,7 +21,7 @@ import {
20
21
  RichText,
21
22
  } from '@wordpress/block-editor';
22
23
  import { decodeEntities } from '@wordpress/html-entities';
23
- import { __ } from '@wordpress/i18n';
24
+ import { __, sprintf } from '@wordpress/i18n';
24
25
  import { pin } from '@wordpress/icons';
25
26
  import { useEntityRecords } from '@wordpress/core-data';
26
27
 
@@ -33,19 +34,33 @@ export default function CategoriesEdit( {
33
34
  showEmpty,
34
35
  label,
35
36
  showLabel,
37
+ taxonomy: taxonomySlug,
36
38
  },
37
39
  setAttributes,
38
40
  className,
39
41
  } ) {
40
42
  const selectId = useInstanceId( CategoriesEdit, 'blocks-category-select' );
43
+
44
+ const { records: allTaxonomies, isResolvingTaxonomies } = useEntityRecords(
45
+ 'root',
46
+ 'taxonomy'
47
+ );
48
+
49
+ const taxonomies = allTaxonomies?.filter( ( t ) => t.visibility.public );
50
+
51
+ const taxonomy = taxonomies?.find( ( t ) => t.slug === taxonomySlug );
52
+
53
+ const isHierarchicalTaxonomy =
54
+ ! isResolvingTaxonomies && taxonomy?.hierarchical;
55
+
41
56
  const query = { per_page: -1, hide_empty: ! showEmpty, context: 'view' };
42
- if ( showOnlyTopLevel ) {
57
+ if ( isHierarchicalTaxonomy && showOnlyTopLevel ) {
43
58
  query.parent = 0;
44
59
  }
45
60
 
46
61
  const { records: categories, isResolving } = useEntityRecords(
47
62
  'taxonomy',
48
- 'category',
63
+ taxonomySlug,
49
64
  query
50
65
  );
51
66
 
@@ -66,7 +81,7 @@ export default function CategoriesEdit( {
66
81
  ! name ? __( '(Untitled)' ) : decodeEntities( name ).trim();
67
82
 
68
83
  const renderCategoryList = () => {
69
- const parentId = showHierarchy ? 0 : null;
84
+ const parentId = isHierarchicalTaxonomy && showHierarchy ? 0 : null;
70
85
  const categoriesList = getCategoriesList( parentId );
71
86
  return categoriesList.map( ( category ) =>
72
87
  renderCategoryListItem( category )
@@ -82,19 +97,21 @@ export default function CategoriesEdit( {
82
97
  { renderCategoryName( name ) }
83
98
  </a>
84
99
  { showPostCounts && ` (${ count })` }
85
- { showHierarchy && !! childCategories.length && (
86
- <ul className="children">
87
- { childCategories.map( ( childCategory ) =>
88
- renderCategoryListItem( childCategory )
89
- ) }
90
- </ul>
91
- ) }
100
+ { isHierarchicalTaxonomy &&
101
+ showHierarchy &&
102
+ !! childCategories.length && (
103
+ <ul className="children">
104
+ { childCategories.map( ( childCategory ) =>
105
+ renderCategoryListItem( childCategory )
106
+ ) }
107
+ </ul>
108
+ ) }
92
109
  </li>
93
110
  );
94
111
  };
95
112
 
96
113
  const renderCategoryDropdown = () => {
97
- const parentId = showHierarchy ? 0 : null;
114
+ const parentId = isHierarchicalTaxonomy && showHierarchy ? 0 : null;
98
115
  const categoriesList = getCategoriesList( parentId );
99
116
  return (
100
117
  <>
@@ -102,7 +119,7 @@ export default function CategoriesEdit( {
102
119
  <RichText
103
120
  className="wp-block-categories__label"
104
121
  aria-label={ __( 'Label text' ) }
105
- placeholder={ __( 'Categories' ) }
122
+ placeholder={ taxonomy.name }
106
123
  withoutInteractiveFormatting
107
124
  value={ label }
108
125
  onChange={ ( html ) =>
@@ -111,11 +128,17 @@ export default function CategoriesEdit( {
111
128
  />
112
129
  ) : (
113
130
  <VisuallyHidden as="label" htmlFor={ selectId }>
114
- { label ? label : __( 'Categories' ) }
131
+ { label ? label : taxonomy.name }
115
132
  </VisuallyHidden>
116
133
  ) }
117
134
  <select id={ selectId }>
118
- <option>{ __( 'Select Category' ) }</option>
135
+ <option>
136
+ { sprintf(
137
+ /* translators: %s: taxonomy's singular name */
138
+ __( 'Select %s' ),
139
+ taxonomy.labels.singular_name
140
+ ) }
141
+ </option>
119
142
  { categoriesList.map( ( category ) =>
120
143
  renderCategoryDropdownItem( category, 0 )
121
144
  ) }
@@ -133,7 +156,8 @@ export default function CategoriesEdit( {
133
156
  { renderCategoryName( name ) }
134
157
  { showPostCounts && ` (${ count })` }
135
158
  </option>,
136
- showHierarchy &&
159
+ isHierarchicalTaxonomy &&
160
+ showHierarchy &&
137
161
  !! childCategories.length &&
138
162
  childCategories.map( ( childCategory ) =>
139
163
  renderCategoryDropdownItem( childCategory, level + 1 )
@@ -161,6 +185,23 @@ export default function CategoriesEdit( {
161
185
  <TagName { ...blockProps }>
162
186
  <InspectorControls>
163
187
  <PanelBody title={ __( 'Settings' ) }>
188
+ { Array.isArray( taxonomies ) && (
189
+ <SelectControl
190
+ __nextHasNoMarginBottom
191
+ __next40pxDefaultSize
192
+ label={ __( 'Taxonomy' ) }
193
+ options={ taxonomies.map( ( t ) => ( {
194
+ label: t.name,
195
+ value: t.slug,
196
+ } ) ) }
197
+ value={ taxonomySlug }
198
+ onChange={ ( selectedTaxonomy ) =>
199
+ setAttributes( {
200
+ taxonomy: selectedTaxonomy,
201
+ } )
202
+ }
203
+ />
204
+ ) }
164
205
  <ToggleControl
165
206
  __nextHasNoMarginBottom
166
207
  label={ __( 'Display as dropdown' ) }
@@ -182,19 +223,21 @@ export default function CategoriesEdit( {
182
223
  checked={ showPostCounts }
183
224
  onChange={ toggleAttribute( 'showPostCounts' ) }
184
225
  />
226
+ { isHierarchicalTaxonomy && (
227
+ <ToggleControl
228
+ __nextHasNoMarginBottom
229
+ label={ __( 'Show only top level terms' ) }
230
+ checked={ showOnlyTopLevel }
231
+ onChange={ toggleAttribute( 'showOnlyTopLevel' ) }
232
+ />
233
+ ) }
185
234
  <ToggleControl
186
235
  __nextHasNoMarginBottom
187
- label={ __( 'Show only top level categories' ) }
188
- checked={ showOnlyTopLevel }
189
- onChange={ toggleAttribute( 'showOnlyTopLevel' ) }
190
- />
191
- <ToggleControl
192
- __nextHasNoMarginBottom
193
- label={ __( 'Show empty categories' ) }
236
+ label={ __( 'Show empty terms' ) }
194
237
  checked={ showEmpty }
195
238
  onChange={ toggleAttribute( 'showEmpty' ) }
196
239
  />
197
- { ! showOnlyTopLevel && (
240
+ { isHierarchicalTaxonomy && ! showOnlyTopLevel && (
198
241
  <ToggleControl
199
242
  __nextHasNoMarginBottom
200
243
  label={ __( 'Show hierarchy' ) }
@@ -205,16 +248,12 @@ export default function CategoriesEdit( {
205
248
  </PanelBody>
206
249
  </InspectorControls>
207
250
  { isResolving && (
208
- <Placeholder icon={ pin } label={ __( 'Categories' ) }>
251
+ <Placeholder icon={ pin } label={ __( 'Terms' ) }>
209
252
  <Spinner />
210
253
  </Placeholder>
211
254
  ) }
212
255
  { ! isResolving && categories?.length === 0 && (
213
- <p>
214
- { __(
215
- 'Your site does not have any posts, so there is nothing to display here at the moment.'
216
- ) }
217
- </p>
256
+ <p>{ taxonomy.labels.no_terms }</p>
218
257
  ) }
219
258
  { ! isResolving &&
220
259
  categories?.length > 0 &&
@@ -9,6 +9,7 @@ import { category as icon } from '@wordpress/icons';
9
9
  import initBlock from '../utils/init-block';
10
10
  import metadata from './block.json';
11
11
  import edit from './edit';
12
+ import variations from './variations';
12
13
 
13
14
  const { name } = metadata;
14
15
 
@@ -18,6 +19,7 @@ export const settings = {
18
19
  icon,
19
20
  example: {},
20
21
  edit,
22
+ variations,
21
23
  };
22
24
 
23
25
  export const init = () => initBlock( { name, metadata, settings } );