@wordpress/widget-dashboard 0.1.1 → 0.3.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 (283) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +29 -16
  3. package/build/components/actions/actions.cjs +6 -23
  4. package/build/components/actions/actions.cjs.map +3 -3
  5. package/build/components/commands/commands.cjs +1 -60
  6. package/build/components/commands/commands.cjs.map +2 -2
  7. package/build/{utils/grid-model-change → components/widget-attribute-controls}/index.cjs +7 -9
  8. package/build/components/widget-attribute-controls/index.cjs.map +7 -0
  9. package/build/components/widget-attribute-controls/widget-attribute-controls.cjs +93 -0
  10. package/build/components/widget-attribute-controls/widget-attribute-controls.cjs.map +7 -0
  11. package/build/components/widget-chrome/widget-chrome.cjs +28 -69
  12. package/build/components/widget-chrome/widget-chrome.cjs.map +2 -2
  13. package/build/components/{layout-settings → widget-frame}/index.cjs +9 -7
  14. package/build/components/widget-frame/index.cjs.map +7 -0
  15. package/build/components/widget-frame/widget-frame.cjs +193 -0
  16. package/build/components/widget-frame/widget-frame.cjs.map +7 -0
  17. package/build/{utils/migrate-layout → components/widget-header}/index.cjs +7 -7
  18. package/build/components/widget-header/index.cjs.map +7 -0
  19. package/build/components/widget-header/widget-header-infotip.cjs +166 -0
  20. package/build/components/widget-header/widget-header-infotip.cjs.map +7 -0
  21. package/build/components/widget-header/widget-header.cjs +176 -0
  22. package/build/components/widget-header/widget-header.cjs.map +7 -0
  23. package/build/components/{widget-settings/utils/get-admin-menu-inset.cjs → widget-layout-controls/index.cjs} +8 -18
  24. package/build/components/widget-layout-controls/index.cjs.map +7 -0
  25. package/build/components/{widgets/widget-layout-toolbar.cjs → widget-layout-controls/widget-layout-controls.cjs} +9 -100
  26. package/build/components/widget-layout-controls/widget-layout-controls.cjs.map +7 -0
  27. package/build/components/widget-picker/widget-picker.cjs +5 -93
  28. package/build/components/widget-picker/widget-picker.cjs.map +3 -3
  29. package/build/components/widget-preview-chrome/index.cjs +31 -0
  30. package/build/components/widget-preview-chrome/index.cjs.map +7 -0
  31. package/build/components/{widget-settings/widget-settings-toolbar.cjs → widget-preview-chrome/widget-preview-chrome.cjs} +41 -23
  32. package/build/components/widget-preview-chrome/widget-preview-chrome.cjs.map +7 -0
  33. package/build/components/widget-settings/index.cjs +3 -3
  34. package/build/components/widget-settings/index.cjs.map +1 -1
  35. package/build/components/widget-settings/utils/index.cjs +0 -3
  36. package/build/components/widget-settings/utils/index.cjs.map +2 -2
  37. package/build/components/widget-settings/widget-settings-trigger.cjs +22 -28
  38. package/build/components/widget-settings/widget-settings-trigger.cjs.map +2 -2
  39. package/build/components/widget-settings/widget-settings.cjs +40 -57
  40. package/build/components/widget-settings/widget-settings.cjs.map +2 -2
  41. package/build/components/widget-toolbar/widget-toolbar.cjs +7 -4
  42. package/build/components/widget-toolbar/widget-toolbar.cjs.map +2 -2
  43. package/build/components/widgets/widget-resize-handle.cjs +4 -4
  44. package/build/components/widgets/widget-resize-handle.cjs.map +2 -2
  45. package/build/components/widgets/widgets.cjs +18 -11
  46. package/build/components/widgets/widgets.cjs.map +2 -2
  47. package/build/context/dashboard-context.cjs +31 -80
  48. package/build/context/dashboard-context.cjs.map +2 -2
  49. package/build/context/ui-context.cjs +2 -18
  50. package/build/context/ui-context.cjs.map +2 -2
  51. package/build/types.cjs.map +1 -1
  52. package/build/utils/index.cjs +2 -5
  53. package/build/utils/index.cjs.map +2 -2
  54. package/build/widget-dashboard.cjs +0 -4
  55. package/build/widget-dashboard.cjs.map +2 -2
  56. package/build-module/components/actions/actions.mjs +7 -24
  57. package/build-module/components/actions/actions.mjs.map +2 -2
  58. package/build-module/components/commands/commands.mjs +2 -67
  59. package/build-module/components/commands/commands.mjs.map +2 -2
  60. package/build-module/components/widget-attribute-controls/index.mjs +6 -0
  61. package/build-module/components/widget-attribute-controls/index.mjs.map +7 -0
  62. package/build-module/components/widget-attribute-controls/widget-attribute-controls.mjs +68 -0
  63. package/build-module/components/widget-attribute-controls/widget-attribute-controls.mjs.map +7 -0
  64. package/build-module/components/widget-chrome/widget-chrome.mjs +29 -76
  65. package/build-module/components/widget-chrome/widget-chrome.mjs.map +2 -2
  66. package/build-module/components/widget-frame/index.mjs +7 -0
  67. package/build-module/components/widget-frame/index.mjs.map +7 -0
  68. package/build-module/components/widget-frame/widget-frame.mjs +157 -0
  69. package/build-module/components/widget-frame/widget-frame.mjs.map +7 -0
  70. package/build-module/components/widget-header/index.mjs +6 -0
  71. package/build-module/components/widget-header/index.mjs.map +7 -0
  72. package/build-module/components/widget-header/widget-header-infotip.mjs +141 -0
  73. package/build-module/components/widget-header/widget-header-infotip.mjs.map +7 -0
  74. package/build-module/components/widget-header/widget-header.mjs +141 -0
  75. package/build-module/components/widget-header/widget-header.mjs.map +7 -0
  76. package/build-module/components/widget-layout-controls/index.mjs +6 -0
  77. package/build-module/components/widget-layout-controls/index.mjs.map +7 -0
  78. package/build-module/components/widget-layout-controls/widget-layout-controls.mjs +90 -0
  79. package/build-module/components/widget-layout-controls/widget-layout-controls.mjs.map +7 -0
  80. package/build-module/components/widget-picker/widget-picker.mjs +6 -94
  81. package/build-module/components/widget-picker/widget-picker.mjs.map +3 -3
  82. package/build-module/components/widget-preview-chrome/index.mjs +6 -0
  83. package/build-module/components/widget-preview-chrome/index.mjs.map +7 -0
  84. package/build-module/components/{widget-settings/widget-settings-toolbar.mjs → widget-preview-chrome/widget-preview-chrome.mjs} +37 -19
  85. package/build-module/components/widget-preview-chrome/widget-preview-chrome.mjs.map +7 -0
  86. package/build-module/components/widget-settings/index.mjs +2 -2
  87. package/build-module/components/widget-settings/index.mjs.map +1 -1
  88. package/build-module/components/widget-settings/utils/index.mjs +0 -2
  89. package/build-module/components/widget-settings/utils/index.mjs.map +2 -2
  90. package/build-module/components/widget-settings/widget-settings-trigger.mjs +23 -29
  91. package/build-module/components/widget-settings/widget-settings-trigger.mjs.map +2 -2
  92. package/build-module/components/widget-settings/widget-settings.mjs +40 -57
  93. package/build-module/components/widget-settings/widget-settings.mjs.map +2 -2
  94. package/build-module/components/widget-toolbar/widget-toolbar.mjs +7 -4
  95. package/build-module/components/widget-toolbar/widget-toolbar.mjs.map +2 -2
  96. package/build-module/components/widgets/widget-resize-handle.mjs +4 -4
  97. package/build-module/components/widgets/widget-resize-handle.mjs.map +2 -2
  98. package/build-module/components/widgets/widgets.mjs +18 -11
  99. package/build-module/components/widgets/widgets.mjs.map +2 -2
  100. package/build-module/context/dashboard-context.mjs +31 -80
  101. package/build-module/context/dashboard-context.mjs.map +2 -2
  102. package/build-module/context/ui-context.mjs +2 -18
  103. package/build-module/context/ui-context.mjs.map +2 -2
  104. package/build-module/types.mjs.map +1 -1
  105. package/build-module/utils/index.mjs +1 -3
  106. package/build-module/utils/index.mjs.map +2 -2
  107. package/build-module/widget-dashboard.mjs +0 -4
  108. package/build-module/widget-dashboard.mjs.map +2 -2
  109. package/build-types/components/actions/actions.d.ts.map +1 -1
  110. package/build-types/components/commands/commands.d.ts.map +1 -1
  111. package/build-types/components/commands/use-pending-when-edit-mode.d.ts +1 -1
  112. package/build-types/components/commands/use-pending-when-edit-mode.d.ts.map +1 -1
  113. package/build-types/components/no-widgets-state/no-widgets-state.d.ts +1 -1
  114. package/build-types/components/no-widgets-state/no-widgets-state.d.ts.map +1 -1
  115. package/build-types/components/widget-attribute-controls/index.d.ts +2 -0
  116. package/build-types/components/widget-attribute-controls/index.d.ts.map +1 -0
  117. package/build-types/components/widget-attribute-controls/widget-attribute-controls.d.ts +23 -0
  118. package/build-types/components/widget-attribute-controls/widget-attribute-controls.d.ts.map +1 -0
  119. package/build-types/components/widget-chrome/widget-chrome.d.ts +8 -8
  120. package/build-types/components/widget-chrome/widget-chrome.d.ts.map +1 -1
  121. package/build-types/components/widget-frame/index.d.ts +3 -0
  122. package/build-types/components/widget-frame/index.d.ts.map +1 -0
  123. package/build-types/components/widget-frame/widget-frame.d.ts +25 -0
  124. package/build-types/components/widget-frame/widget-frame.d.ts.map +1 -0
  125. package/build-types/components/widget-header/index.d.ts +3 -0
  126. package/build-types/components/widget-header/index.d.ts.map +1 -0
  127. package/build-types/components/widget-header/widget-header-infotip.d.ts +20 -0
  128. package/build-types/components/widget-header/widget-header-infotip.d.ts.map +1 -0
  129. package/build-types/components/widget-header/widget-header.d.ts +38 -0
  130. package/build-types/components/widget-header/widget-header.d.ts.map +1 -0
  131. package/build-types/components/widget-layout-controls/index.d.ts +3 -0
  132. package/build-types/components/widget-layout-controls/index.d.ts.map +1 -0
  133. package/build-types/components/widget-layout-controls/widget-layout-controls.d.ts +14 -0
  134. package/build-types/components/widget-layout-controls/widget-layout-controls.d.ts.map +1 -0
  135. package/build-types/components/widget-picker/widget-picker.d.ts +1 -1
  136. package/build-types/components/widget-picker/widget-picker.d.ts.map +1 -1
  137. package/build-types/components/widget-preview-chrome/index.d.ts +3 -0
  138. package/build-types/components/widget-preview-chrome/index.d.ts.map +1 -0
  139. package/build-types/components/widget-preview-chrome/widget-preview-chrome.d.ts +15 -0
  140. package/build-types/components/widget-preview-chrome/widget-preview-chrome.d.ts.map +1 -0
  141. package/build-types/components/widget-settings/index.d.ts +2 -2
  142. package/build-types/components/widget-settings/utils/index.d.ts +0 -1
  143. package/build-types/components/widget-settings/utils/index.d.ts.map +1 -1
  144. package/build-types/components/widget-settings/widget-settings-trigger.d.ts +7 -5
  145. package/build-types/components/widget-settings/widget-settings-trigger.d.ts.map +1 -1
  146. package/build-types/components/widget-settings/widget-settings.d.ts +5 -4
  147. package/build-types/components/widget-settings/widget-settings.d.ts.map +1 -1
  148. package/build-types/components/widget-toolbar/widget-toolbar.d.ts +10 -7
  149. package/build-types/components/widget-toolbar/widget-toolbar.d.ts.map +1 -1
  150. package/build-types/components/widgets/widgets.d.ts.map +1 -1
  151. package/build-types/context/dashboard-context.d.ts +23 -40
  152. package/build-types/context/dashboard-context.d.ts.map +1 -1
  153. package/build-types/context/ui-context.d.ts +0 -18
  154. package/build-types/context/ui-context.d.ts.map +1 -1
  155. package/build-types/context/widget-context.d.ts +1 -1
  156. package/build-types/context/widget-context.d.ts.map +1 -1
  157. package/build-types/types.d.ts +9 -15
  158. package/build-types/types.d.ts.map +1 -1
  159. package/build-types/utils/index.d.ts +0 -1
  160. package/build-types/utils/index.d.ts.map +1 -1
  161. package/build-types/widget-dashboard.d.ts +5 -5
  162. package/build-types/widget-dashboard.d.ts.map +1 -1
  163. package/package.json +20 -20
  164. package/src/components/actions/actions.module.css +7 -7
  165. package/src/components/actions/actions.tsx +5 -25
  166. package/src/components/commands/commands.tsx +3 -70
  167. package/src/components/widget-attribute-controls/index.ts +1 -0
  168. package/src/components/widget-attribute-controls/widget-attribute-controls.tsx +108 -0
  169. package/src/components/widget-chrome/widget-chrome.module.css +6 -71
  170. package/src/components/widget-chrome/widget-chrome.tsx +31 -136
  171. package/src/components/widget-frame/index.ts +2 -0
  172. package/src/components/widget-frame/widget-frame.module.css +17 -0
  173. package/src/components/widget-frame/widget-frame.tsx +138 -0
  174. package/src/components/widget-header/index.ts +2 -0
  175. package/src/components/widget-header/widget-header-infotip.tsx +82 -0
  176. package/src/components/widget-header/widget-header.module.css +59 -0
  177. package/src/components/widget-header/widget-header.tsx +104 -0
  178. package/src/components/widget-layout-controls/index.ts +2 -0
  179. package/src/components/{widgets/widget-layout-toolbar.tsx → widget-layout-controls/widget-layout-controls.tsx} +12 -13
  180. package/src/components/widget-picker/widget-picker.tsx +5 -10
  181. package/src/components/widget-preview-chrome/index.ts +2 -0
  182. package/src/components/widget-preview-chrome/widget-preview-chrome.module.css +22 -0
  183. package/src/components/widget-preview-chrome/widget-preview-chrome.tsx +65 -0
  184. package/src/components/widget-settings/index.ts +2 -2
  185. package/src/components/widget-settings/utils/index.ts +0 -1
  186. package/src/components/widget-settings/widget-settings-trigger.tsx +39 -44
  187. package/src/components/widget-settings/widget-settings.tsx +10 -28
  188. package/src/components/widget-toolbar/widget-toolbar.module.css +13 -10
  189. package/src/components/widget-toolbar/widget-toolbar.tsx +14 -8
  190. package/src/components/widgets/widget-resize-handle.module.css +21 -21
  191. package/src/components/widgets/widget-resize-handle.tsx +2 -2
  192. package/src/components/widgets/widgets.module.css +20 -11
  193. package/src/components/widgets/widgets.tsx +33 -10
  194. package/src/context/dashboard-context.tsx +70 -133
  195. package/src/context/ui-context.tsx +1 -39
  196. package/src/test/actions.test.tsx +7 -77
  197. package/src/test/commands.test.tsx +6 -45
  198. package/src/test/staging.test.tsx +82 -144
  199. package/src/test/widget-dashboard.test.tsx +24 -0
  200. package/src/types.ts +9 -16
  201. package/src/utils/index.ts +0 -1
  202. package/src/widget-dashboard.tsx +4 -8
  203. package/build/components/layout-settings/index.cjs.map +0 -7
  204. package/build/components/layout-settings/layout-model-edit-field/index.cjs +0 -186
  205. package/build/components/layout-settings/layout-model-edit-field/index.cjs.map +0 -7
  206. package/build/components/layout-settings/layout-model-edit-field/thumbnail-grid.cjs +0 -53
  207. package/build/components/layout-settings/layout-model-edit-field/thumbnail-grid.cjs.map +0 -7
  208. package/build/components/layout-settings/layout-model-edit-field/thumbnail-masonry.cjs +0 -53
  209. package/build/components/layout-settings/layout-model-edit-field/thumbnail-masonry.cjs.map +0 -7
  210. package/build/components/layout-settings/layout-settings.cjs +0 -207
  211. package/build/components/layout-settings/layout-settings.cjs.map +0 -7
  212. package/build/components/widget-settings/utils/get-admin-menu-inset.cjs.map +0 -7
  213. package/build/components/widget-settings/widget-settings-toolbar.cjs.map +0 -7
  214. package/build/components/widgets/widget-layout-toolbar.cjs.map +0 -7
  215. package/build/utils/grid-model-change/grid-model-change.cjs +0 -56
  216. package/build/utils/grid-model-change/grid-model-change.cjs.map +0 -7
  217. package/build/utils/grid-model-change/index.cjs.map +0 -7
  218. package/build/utils/migrate-layout/index.cjs.map +0 -7
  219. package/build/utils/migrate-layout/migrate-layout.cjs +0 -94
  220. package/build/utils/migrate-layout/migrate-layout.cjs.map +0 -7
  221. package/build-module/components/layout-settings/index.mjs +0 -6
  222. package/build-module/components/layout-settings/index.mjs.map +0 -7
  223. package/build-module/components/layout-settings/layout-model-edit-field/index.mjs +0 -151
  224. package/build-module/components/layout-settings/layout-model-edit-field/index.mjs.map +0 -7
  225. package/build-module/components/layout-settings/layout-model-edit-field/thumbnail-grid.mjs +0 -28
  226. package/build-module/components/layout-settings/layout-model-edit-field/thumbnail-grid.mjs.map +0 -7
  227. package/build-module/components/layout-settings/layout-model-edit-field/thumbnail-masonry.mjs +0 -28
  228. package/build-module/components/layout-settings/layout-model-edit-field/thumbnail-masonry.mjs.map +0 -7
  229. package/build-module/components/layout-settings/layout-settings.mjs +0 -187
  230. package/build-module/components/layout-settings/layout-settings.mjs.map +0 -7
  231. package/build-module/components/widget-settings/utils/get-admin-menu-inset.mjs +0 -16
  232. package/build-module/components/widget-settings/utils/get-admin-menu-inset.mjs.map +0 -7
  233. package/build-module/components/widget-settings/widget-settings-toolbar.mjs.map +0 -7
  234. package/build-module/components/widgets/widget-layout-toolbar.mjs +0 -181
  235. package/build-module/components/widgets/widget-layout-toolbar.mjs.map +0 -7
  236. package/build-module/utils/grid-model-change/grid-model-change.mjs +0 -30
  237. package/build-module/utils/grid-model-change/grid-model-change.mjs.map +0 -7
  238. package/build-module/utils/grid-model-change/index.mjs +0 -7
  239. package/build-module/utils/grid-model-change/index.mjs.map +0 -7
  240. package/build-module/utils/migrate-layout/index.mjs +0 -6
  241. package/build-module/utils/migrate-layout/index.mjs.map +0 -7
  242. package/build-module/utils/migrate-layout/migrate-layout.mjs +0 -69
  243. package/build-module/utils/migrate-layout/migrate-layout.mjs.map +0 -7
  244. package/build-types/components/layout-settings/index.d.ts +0 -2
  245. package/build-types/components/layout-settings/index.d.ts.map +0 -1
  246. package/build-types/components/layout-settings/layout-model-edit-field/index.d.ts +0 -17
  247. package/build-types/components/layout-settings/layout-model-edit-field/index.d.ts.map +0 -1
  248. package/build-types/components/layout-settings/layout-model-edit-field/thumbnail-grid.d.ts +0 -6
  249. package/build-types/components/layout-settings/layout-model-edit-field/thumbnail-grid.d.ts.map +0 -1
  250. package/build-types/components/layout-settings/layout-model-edit-field/thumbnail-masonry.d.ts +0 -6
  251. package/build-types/components/layout-settings/layout-model-edit-field/thumbnail-masonry.d.ts.map +0 -1
  252. package/build-types/components/layout-settings/layout-settings.d.ts +0 -14
  253. package/build-types/components/layout-settings/layout-settings.d.ts.map +0 -1
  254. package/build-types/components/widget-settings/utils/get-admin-menu-inset.d.ts +0 -17
  255. package/build-types/components/widget-settings/utils/get-admin-menu-inset.d.ts.map +0 -1
  256. package/build-types/components/widget-settings/widget-settings-toolbar.d.ts +0 -20
  257. package/build-types/components/widget-settings/widget-settings-toolbar.d.ts.map +0 -1
  258. package/build-types/components/widgets/widget-layout-toolbar.d.ts +0 -14
  259. package/build-types/components/widgets/widget-layout-toolbar.d.ts.map +0 -1
  260. package/build-types/utils/grid-model-change/grid-model-change.d.ts +0 -20
  261. package/build-types/utils/grid-model-change/grid-model-change.d.ts.map +0 -1
  262. package/build-types/utils/grid-model-change/index.d.ts +0 -2
  263. package/build-types/utils/grid-model-change/index.d.ts.map +0 -1
  264. package/build-types/utils/migrate-layout/index.d.ts +0 -2
  265. package/build-types/utils/migrate-layout/index.d.ts.map +0 -1
  266. package/build-types/utils/migrate-layout/migrate-layout.d.ts +0 -36
  267. package/build-types/utils/migrate-layout/migrate-layout.d.ts.map +0 -1
  268. package/src/components/layout-settings/index.ts +0 -1
  269. package/src/components/layout-settings/layout-model-edit-field/index.tsx +0 -98
  270. package/src/components/layout-settings/layout-model-edit-field/style.module.css +0 -34
  271. package/src/components/layout-settings/layout-model-edit-field/thumbnail-grid.tsx +0 -28
  272. package/src/components/layout-settings/layout-model-edit-field/thumbnail-masonry.tsx +0 -28
  273. package/src/components/layout-settings/layout-settings.tsx +0 -217
  274. package/src/components/widget-picker/widget-picker.module.css +0 -11
  275. package/src/components/widget-settings/utils/get-admin-menu-inset.ts +0 -30
  276. package/src/components/widget-settings/widget-settings-toolbar.module.css +0 -25
  277. package/src/components/widget-settings/widget-settings-toolbar.tsx +0 -45
  278. package/src/components/widgets/widget-layout-toolbar.module.css +0 -6
  279. package/src/utils/grid-model-change/grid-model-change.ts +0 -53
  280. package/src/utils/grid-model-change/index.ts +0 -1
  281. package/src/utils/migrate-layout/index.ts +0 -1
  282. package/src/utils/migrate-layout/migrate-layout.ts +0 -156
  283. package/src/utils/migrate-layout/test/migrate-layout.test.ts +0 -114
@@ -0,0 +1,166 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/widget-dashboard/src/components/widget-header/widget-header-infotip.tsx
21
+ var widget_header_infotip_exports = {};
22
+ __export(widget_header_infotip_exports, {
23
+ WidgetInfotip: () => WidgetInfotip
24
+ });
25
+ module.exports = __toCommonJS(widget_header_infotip_exports);
26
+ var import_element = require("@wordpress/element");
27
+ var import_i18n = require("@wordpress/i18n");
28
+ var import_icons = require("@wordpress/icons");
29
+ var import_ui = require("@wordpress/ui");
30
+
31
+ // packages/style-runtime/src/index.ts
32
+ var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
33
+ function getRuntime() {
34
+ const globalScope = globalThis;
35
+ if (globalScope.__wpStyleRuntime) {
36
+ return globalScope.__wpStyleRuntime;
37
+ }
38
+ globalScope.__wpStyleRuntime = {
39
+ documents: /* @__PURE__ */ new Map(),
40
+ styles: /* @__PURE__ */ new Map(),
41
+ injectedStyles: /* @__PURE__ */ new WeakMap()
42
+ };
43
+ if (typeof document !== "undefined") {
44
+ registerDocument(document);
45
+ }
46
+ return globalScope.__wpStyleRuntime;
47
+ }
48
+ function documentContainsStyleHash(targetDocument, hash) {
49
+ if (!targetDocument.head) {
50
+ return false;
51
+ }
52
+ for (const style of targetDocument.head.querySelectorAll(
53
+ `style[${STYLE_HASH_ATTRIBUTE}]`
54
+ )) {
55
+ if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
56
+ return true;
57
+ }
58
+ }
59
+ return false;
60
+ }
61
+ function injectStyle(targetDocument, hash, css) {
62
+ if (!targetDocument.head) {
63
+ return;
64
+ }
65
+ const runtime = getRuntime();
66
+ let injectedStyles = runtime.injectedStyles.get(targetDocument);
67
+ if (!injectedStyles) {
68
+ injectedStyles = /* @__PURE__ */ new Set();
69
+ runtime.injectedStyles.set(targetDocument, injectedStyles);
70
+ }
71
+ if (injectedStyles.has(hash)) {
72
+ return;
73
+ }
74
+ if (documentContainsStyleHash(targetDocument, hash)) {
75
+ injectedStyles.add(hash);
76
+ return;
77
+ }
78
+ const style = targetDocument.createElement("style");
79
+ style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
80
+ style.appendChild(targetDocument.createTextNode(css));
81
+ targetDocument.head.appendChild(style);
82
+ injectedStyles.add(hash);
83
+ }
84
+ function registerDocument(targetDocument) {
85
+ const runtime = getRuntime();
86
+ runtime.documents.set(
87
+ targetDocument,
88
+ (runtime.documents.get(targetDocument) ?? 0) + 1
89
+ );
90
+ for (const [hash, css] of runtime.styles) {
91
+ injectStyle(targetDocument, hash, css);
92
+ }
93
+ return () => {
94
+ const count = runtime.documents.get(targetDocument);
95
+ if (count === void 0) {
96
+ return;
97
+ }
98
+ if (count <= 1) {
99
+ runtime.documents.delete(targetDocument);
100
+ return;
101
+ }
102
+ runtime.documents.set(targetDocument, count - 1);
103
+ };
104
+ }
105
+ function registerStyle(hash, css) {
106
+ const runtime = getRuntime();
107
+ runtime.styles.set(hash, css);
108
+ for (const targetDocument of runtime.documents.keys()) {
109
+ injectStyle(targetDocument, hash, css);
110
+ }
111
+ }
112
+
113
+ // packages/widget-dashboard/src/components/widget-header/widget-header.module.css
114
+ if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
115
+ registerStyle("9772c69e1f", "._2e38ceadc62158ab__widget-header{align-items:center;display:flex;gap:var(--wpds-dimension-gap-sm,8px)}._967cd798e5c37202__toolbar,.f41e4aad10324455__identity{align-items:center;display:flex;height:var(--wpds-dimension-size-lg,40px)}.f41e4aad10324455__identity{min-width:0}._53584a4927dfbcf1__icon{color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:inline-flex}._2445a9adf8f1e547__popover-popup{max-width:300px}.d6f136cf92858182__help{align-items:center;background:none;border:0;color:var(--wpds-color-foreground-content-neutral-weak,#707070);cursor:var(--wpds-cursor-control,pointer);display:inline-flex;padding:0}._9bdac6051677514a__link+._9bdac6051677514a__link{border-inline-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);padding-inline-start:var(--wpds-dimension-gap-sm,8px)}._967cd798e5c37202__toolbar{margin-inline-start:auto}.f32f2cd669c9b4b0__overlay{--wp-ui-card-padding:var(--wpds-dimension-padding-2xl,24px);inset-block-start:0;inset-inline:0;pointer-events:none;position:absolute;z-index:1}.f32f2cd669c9b4b0__overlay ._967cd798e5c37202__toolbar{pointer-events:auto}");
116
+ }
117
+ var widget_header_default = { "widget-header": "_2e38ceadc62158ab__widget-header", "identity": "f41e4aad10324455__identity", "toolbar": "_967cd798e5c37202__toolbar", "icon": "_53584a4927dfbcf1__icon", "popover-popup": "_2445a9adf8f1e547__popover-popup", "help": "d6f136cf92858182__help", "link": "_9bdac6051677514a__link", "overlay": "f32f2cd669c9b4b0__overlay" };
118
+
119
+ // packages/widget-dashboard/src/components/widget-header/widget-header-infotip.tsx
120
+ var import_jsx_runtime = require("react/jsx-runtime");
121
+ function WidgetInfotip({
122
+ content,
123
+ links
124
+ }) {
125
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ui.Popover.Root, { modal: "trap-focus", children: [
126
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
127
+ import_ui.Popover.Trigger,
128
+ {
129
+ "aria-label": (0, import_i18n.__)("More information"),
130
+ className: widget_header_default.help,
131
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Icon, { icon: import_icons.info, size: 20 })
132
+ }
133
+ ),
134
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
135
+ import_ui.Popover.Popup,
136
+ {
137
+ className: widget_header_default["popover-popup"],
138
+ positioner: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Popover.Positioner, { side: "top", align: "start" }),
139
+ children: [
140
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Popover.Arrow, {}),
141
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.VisuallyHidden, { render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Popover.Title, {}), children: (0, import_i18n.__)("More information") }),
142
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ui.Stack, { direction: "column", align: "start", gap: "sm", children: [
143
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Popover.Description, { children: (0, import_element.createInterpolateElement)(content, {
144
+ em: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("em", {}),
145
+ strong: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", {})
146
+ }) }),
147
+ links && links.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Stack, { direction: "row", align: "start", gap: "sm", children: links.map((link) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
148
+ import_ui.Link,
149
+ {
150
+ href: link.href,
151
+ className: widget_header_default.link,
152
+ children: link.label
153
+ },
154
+ link.href
155
+ )) })
156
+ ] })
157
+ ]
158
+ }
159
+ )
160
+ ] });
161
+ }
162
+ // Annotate the CommonJS export names for ESM import in node:
163
+ 0 && (module.exports = {
164
+ WidgetInfotip
165
+ });
166
+ //# sourceMappingURL=widget-header-infotip.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/widget-header/widget-header-infotip.tsx", "../../../../style-runtime/src/index.ts", "../../../src/components/widget-header/widget-header.module.css"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createInterpolateElement } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { info } from '@wordpress/icons';\n// eslint-disable-next-line @wordpress/use-recommended-components\nimport { Icon, Link, Popover, Stack, VisuallyHidden } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport styles from './widget-header.module.css';\n\nexport interface WidgetInfotipProps {\n\t/**\n\t * Help content to display; may carry `<em>`/`<strong>`.\n\t */\n\tcontent: string;\n\n\t/**\n\t * Links rendered after the content.\n\t */\n\tlinks?: {\n\t\tlabel: string;\n\t\thref: string;\n\t}[];\n}\n\n/**\n * Header infotip: a click-open popover holding the widget type's help note.\n *\n * @param {WidgetInfotipProps} props Component props.\n */\nexport function WidgetInfotip( {\n\tcontent,\n\tlinks,\n}: WidgetInfotipProps ): React.ReactNode {\n\treturn (\n\t\t<Popover.Root modal=\"trap-focus\">\n\t\t\t<Popover.Trigger\n\t\t\t\taria-label={ __( 'More information' ) }\n\t\t\t\tclassName={ styles.help }\n\t\t\t>\n\t\t\t\t<Icon icon={ info } size={ 20 } />\n\t\t\t</Popover.Trigger>\n\n\t\t\t<Popover.Popup\n\t\t\t\tclassName={ styles[ 'popover-popup' ] }\n\t\t\t\tpositioner={ <Popover.Positioner side=\"top\" align=\"start\" /> }\n\t\t\t>\n\t\t\t\t<Popover.Arrow />\n\t\t\t\t<VisuallyHidden render={ <Popover.Title /> }>\n\t\t\t\t\t{ __( 'More information' ) }\n\t\t\t\t</VisuallyHidden>\n\n\t\t\t\t<Stack direction=\"column\" align=\"start\" gap=\"sm\">\n\t\t\t\t\t<Popover.Description>\n\t\t\t\t\t\t{ createInterpolateElement( content, {\n\t\t\t\t\t\t\tem: <em />,\n\t\t\t\t\t\t\tstrong: <strong />,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t</Popover.Description>\n\n\t\t\t\t\t{ links && links.length > 0 && (\n\t\t\t\t\t\t<Stack direction=\"row\" align=\"start\" gap=\"sm\">\n\t\t\t\t\t\t\t{ links.map( ( link ) => (\n\t\t\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\t\t\tkey={ link.href }\n\t\t\t\t\t\t\t\t\thref={ link.href }\n\t\t\t\t\t\t\t\t\tclassName={ styles.link }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ link.label }\n\t\t\t\t\t\t\t\t</Link>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t) }\n\t\t\t\t</Stack>\n\t\t\t</Popover.Popup>\n\t\t</Popover.Root>\n\t);\n}\n", "type GlobalScopeWithStyleRuntime = typeof globalThis & {\n\t// This global is shared by separately bundled copies of this package.\n\t// Keep its shape backward compatible after release.\n\t__wpStyleRuntime?: {\n\t\tdocuments: Map< Document, number >;\n\t\tstyles: Map< string, string >;\n\t\tinjectedStyles: WeakMap< Document, Set< string > >;\n\t};\n};\n\nconst STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n\tconst globalScope = globalThis as GlobalScopeWithStyleRuntime;\n\n\tif ( globalScope.__wpStyleRuntime ) {\n\t\treturn globalScope.__wpStyleRuntime;\n\t}\n\n\tglobalScope.__wpStyleRuntime = {\n\t\tdocuments: new Map(),\n\t\tstyles: new Map(),\n\t\tinjectedStyles: new WeakMap(),\n\t};\n\n\tif ( typeof document !== 'undefined' ) {\n\t\tregisterDocument( document );\n\t}\n\n\treturn globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(\n\ttargetDocument: Document,\n\thash: string\n): boolean {\n\tif ( ! targetDocument.head ) {\n\t\treturn false;\n\t}\n\n\tfor ( const style of targetDocument.head.querySelectorAll(\n\t\t`style[${ STYLE_HASH_ATTRIBUTE }]`\n\t) ) {\n\t\tif ( style.getAttribute( STYLE_HASH_ATTRIBUTE ) === hash ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle( targetDocument: Document, hash: string, css: string ) {\n\tif ( ! targetDocument.head ) {\n\t\treturn;\n\t}\n\n\tconst runtime = getRuntime();\n\tlet injectedStyles = runtime.injectedStyles.get( targetDocument );\n\n\tif ( ! injectedStyles ) {\n\t\tinjectedStyles = new Set();\n\t\truntime.injectedStyles.set( targetDocument, injectedStyles );\n\t}\n\n\tif ( injectedStyles.has( hash ) ) {\n\t\treturn;\n\t}\n\n\t// Older generated CSS module output can still inject matching style tags\n\t// after this document's cache is created, so keep the DOM as the fallback\n\t// source of truth on cache misses.\n\tif ( documentContainsStyleHash( targetDocument, hash ) ) {\n\t\tinjectedStyles.add( hash );\n\t\treturn;\n\t}\n\n\tconst style = targetDocument.createElement( 'style' );\n\tstyle.setAttribute( STYLE_HASH_ATTRIBUTE, hash );\n\tstyle.appendChild( targetDocument.createTextNode( css ) );\n\ttargetDocument.head.appendChild( style );\n\tinjectedStyles.add( hash );\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument( targetDocument: Document ) {\n\tconst runtime = getRuntime();\n\n\truntime.documents.set(\n\t\ttargetDocument,\n\t\t( runtime.documents.get( targetDocument ) ?? 0 ) + 1\n\t);\n\n\tfor ( const [ hash, css ] of runtime.styles ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n\n\treturn () => {\n\t\tconst count = runtime.documents.get( targetDocument );\n\n\t\tif ( count === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( count <= 1 ) {\n\t\t\truntime.documents.delete( targetDocument );\n\t\t\treturn;\n\t\t}\n\n\t\truntime.documents.set( targetDocument, count - 1 );\n\t};\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle( hash: string, css: string ) {\n\tconst runtime = getRuntime();\n\n\truntime.styles.set( hash, css );\n\n\tfor ( const targetDocument of runtime.documents.keys() ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n}\n", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"9772c69e1f\", \"._2e38ceadc62158ab__widget-header{align-items:center;display:flex;gap:var(--wpds-dimension-gap-sm,8px)}._967cd798e5c37202__toolbar,.f41e4aad10324455__identity{align-items:center;display:flex;height:var(--wpds-dimension-size-lg,40px)}.f41e4aad10324455__identity{min-width:0}._53584a4927dfbcf1__icon{color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:inline-flex}._2445a9adf8f1e547__popover-popup{max-width:300px}.d6f136cf92858182__help{align-items:center;background:none;border:0;color:var(--wpds-color-foreground-content-neutral-weak,#707070);cursor:var(--wpds-cursor-control,pointer);display:inline-flex;padding:0}._9bdac6051677514a__link+._9bdac6051677514a__link{border-inline-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);padding-inline-start:var(--wpds-dimension-gap-sm,8px)}._967cd798e5c37202__toolbar{margin-inline-start:auto}.f32f2cd669c9b4b0__overlay{--wp-ui-card-padding:var(--wpds-dimension-padding-2xl,24px);inset-block-start:0;inset-inline:0;pointer-events:none;position:absolute;z-index:1}.f32f2cd669c9b4b0__overlay ._967cd798e5c37202__toolbar{pointer-events:auto}\");\n}\nexport default {\"widget-header\":\"_2e38ceadc62158ab__widget-header\",\"identity\":\"f41e4aad10324455__identity\",\"toolbar\":\"_967cd798e5c37202__toolbar\",\"icon\":\"_53584a4927dfbcf1__icon\",\"popover-popup\":\"_2445a9adf8f1e547__popover-popup\",\"help\":\"d6f136cf92858182__help\",\"link\":\"_9bdac6051677514a__link\",\"overlay\":\"f32f2cd669c9b4b0__overlay\"};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAyC;AACzC,kBAAmB;AACnB,mBAAqB;AAErB,gBAA2D;;;ACG3D,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACrB,QAAM,cAAc;AAEpB,MAAK,YAAY,kBAAmB;AACnC,WAAO,YAAY;AAAA,EACpB;AAEA,cAAY,mBAAmB;AAAA,IAC9B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC7B;AAEA,MAAK,OAAO,aAAa,aAAc;AACtC,qBAAkB,QAAS;AAAA,EAC5B;AAEA,SAAO,YAAY;AACpB;AAUA,SAAS,0BACR,gBACA,MACU;AACV,MAAK,CAAE,eAAe,MAAO;AAC5B,WAAO;AAAA,EACR;AAEA,aA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4CAAC,mBAAM,WAAU,OAAM,OAAM,SAAQ,KAAI,MACtC,gBAAM,IAAK,CAAE,SACd;AAAA,cAAC;AAAA;AAAA,gBAEA,MAAO,KAAK;AAAA,gBACZ,WAAY,sBAAO;AAAA,gBAEjB,eAAK;AAAA;AAAA,cAJD,KAAK;AAAA,YAKZ,CACC,GACH;AAAA,aAEF;AAAA;AAAA;AAAA,IACD;AAAA,KACD;AAEF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,176 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // packages/widget-dashboard/src/components/widget-header/widget-header.tsx
31
+ var widget_header_exports = {};
32
+ __export(widget_header_exports, {
33
+ WidgetHeader: () => WidgetHeader
34
+ });
35
+ module.exports = __toCommonJS(widget_header_exports);
36
+ var import_clsx = __toESM(require("clsx"));
37
+ var import_ui = require("@wordpress/ui");
38
+ var import_widget_header_infotip = require("./widget-header-infotip.cjs");
39
+
40
+ // packages/style-runtime/src/index.ts
41
+ var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
42
+ function getRuntime() {
43
+ const globalScope = globalThis;
44
+ if (globalScope.__wpStyleRuntime) {
45
+ return globalScope.__wpStyleRuntime;
46
+ }
47
+ globalScope.__wpStyleRuntime = {
48
+ documents: /* @__PURE__ */ new Map(),
49
+ styles: /* @__PURE__ */ new Map(),
50
+ injectedStyles: /* @__PURE__ */ new WeakMap()
51
+ };
52
+ if (typeof document !== "undefined") {
53
+ registerDocument(document);
54
+ }
55
+ return globalScope.__wpStyleRuntime;
56
+ }
57
+ function documentContainsStyleHash(targetDocument, hash) {
58
+ if (!targetDocument.head) {
59
+ return false;
60
+ }
61
+ for (const style of targetDocument.head.querySelectorAll(
62
+ `style[${STYLE_HASH_ATTRIBUTE}]`
63
+ )) {
64
+ if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
65
+ return true;
66
+ }
67
+ }
68
+ return false;
69
+ }
70
+ function injectStyle(targetDocument, hash, css) {
71
+ if (!targetDocument.head) {
72
+ return;
73
+ }
74
+ const runtime = getRuntime();
75
+ let injectedStyles = runtime.injectedStyles.get(targetDocument);
76
+ if (!injectedStyles) {
77
+ injectedStyles = /* @__PURE__ */ new Set();
78
+ runtime.injectedStyles.set(targetDocument, injectedStyles);
79
+ }
80
+ if (injectedStyles.has(hash)) {
81
+ return;
82
+ }
83
+ if (documentContainsStyleHash(targetDocument, hash)) {
84
+ injectedStyles.add(hash);
85
+ return;
86
+ }
87
+ const style = targetDocument.createElement("style");
88
+ style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
89
+ style.appendChild(targetDocument.createTextNode(css));
90
+ targetDocument.head.appendChild(style);
91
+ injectedStyles.add(hash);
92
+ }
93
+ function registerDocument(targetDocument) {
94
+ const runtime = getRuntime();
95
+ runtime.documents.set(
96
+ targetDocument,
97
+ (runtime.documents.get(targetDocument) ?? 0) + 1
98
+ );
99
+ for (const [hash, css] of runtime.styles) {
100
+ injectStyle(targetDocument, hash, css);
101
+ }
102
+ return () => {
103
+ const count = runtime.documents.get(targetDocument);
104
+ if (count === void 0) {
105
+ return;
106
+ }
107
+ if (count <= 1) {
108
+ runtime.documents.delete(targetDocument);
109
+ return;
110
+ }
111
+ runtime.documents.set(targetDocument, count - 1);
112
+ };
113
+ }
114
+ function registerStyle(hash, css) {
115
+ const runtime = getRuntime();
116
+ runtime.styles.set(hash, css);
117
+ for (const targetDocument of runtime.documents.keys()) {
118
+ injectStyle(targetDocument, hash, css);
119
+ }
120
+ }
121
+
122
+ // packages/widget-dashboard/src/components/widget-header/widget-header.module.css
123
+ if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
124
+ registerStyle("9772c69e1f", "._2e38ceadc62158ab__widget-header{align-items:center;display:flex;gap:var(--wpds-dimension-gap-sm,8px)}._967cd798e5c37202__toolbar,.f41e4aad10324455__identity{align-items:center;display:flex;height:var(--wpds-dimension-size-lg,40px)}.f41e4aad10324455__identity{min-width:0}._53584a4927dfbcf1__icon{color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:inline-flex}._2445a9adf8f1e547__popover-popup{max-width:300px}.d6f136cf92858182__help{align-items:center;background:none;border:0;color:var(--wpds-color-foreground-content-neutral-weak,#707070);cursor:var(--wpds-cursor-control,pointer);display:inline-flex;padding:0}._9bdac6051677514a__link+._9bdac6051677514a__link{border-inline-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);padding-inline-start:var(--wpds-dimension-gap-sm,8px)}._967cd798e5c37202__toolbar{margin-inline-start:auto}.f32f2cd669c9b4b0__overlay{--wp-ui-card-padding:var(--wpds-dimension-padding-2xl,24px);inset-block-start:0;inset-inline:0;pointer-events:none;position:absolute;z-index:1}.f32f2cd669c9b4b0__overlay ._967cd798e5c37202__toolbar{pointer-events:auto}");
125
+ }
126
+ var widget_header_default = { "widget-header": "_2e38ceadc62158ab__widget-header", "identity": "f41e4aad10324455__identity", "toolbar": "_967cd798e5c37202__toolbar", "icon": "_53584a4927dfbcf1__icon", "popover-popup": "_2445a9adf8f1e547__popover-popup", "help": "d6f136cf92858182__help", "link": "_9bdac6051677514a__link", "overlay": "f32f2cd669c9b4b0__overlay" };
127
+
128
+ // packages/widget-dashboard/src/components/widget-header/widget-header.tsx
129
+ var import_jsx_runtime = require("react/jsx-runtime");
130
+ function WidgetHeader({
131
+ widgetType,
132
+ titleId,
133
+ showIdentity = false,
134
+ overlay = false,
135
+ editMode = false,
136
+ children
137
+ }) {
138
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
139
+ import_ui.Card.Header,
140
+ {
141
+ className: (0, import_clsx.default)(
142
+ widget_header_default["widget-header"],
143
+ overlay && widget_header_default.overlay
144
+ ),
145
+ children: [
146
+ showIdentity && widgetType?.title && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
147
+ import_ui.Stack,
148
+ {
149
+ direction: "row",
150
+ align: "center",
151
+ gap: "sm",
152
+ className: widget_header_default.identity,
153
+ ...editMode ? { inert: "true" } : {},
154
+ children: [
155
+ widgetType.icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: widget_header_default.icon, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Icon, { icon: widgetType.icon }) }),
156
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Card.Title, { id: titleId, render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", {}), children: widgetType.title }),
157
+ widgetType.help && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
158
+ import_widget_header_infotip.WidgetInfotip,
159
+ {
160
+ content: widgetType.help.content,
161
+ links: widgetType.help.links
162
+ }
163
+ )
164
+ ]
165
+ }
166
+ ),
167
+ children && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: widget_header_default.toolbar, children })
168
+ ]
169
+ }
170
+ );
171
+ }
172
+ // Annotate the CommonJS export names for ESM import in node:
173
+ 0 && (module.exports = {
174
+ WidgetHeader
175
+ });
176
+ //# sourceMappingURL=widget-header.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/widget-header/widget-header.tsx", "../../../../style-runtime/src/index.ts", "../../../src/components/widget-header/widget-header.module.css"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport type { ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { Card, Icon, Stack } from '@wordpress/ui';\nimport type { WidgetType } from '@wordpress/widget-primitives';\n\n/**\n * Internal dependencies\n */\nimport { WidgetInfotip } from './widget-header-infotip';\nimport styles from './widget-header.module.css';\n\nexport interface WidgetHeaderProps {\n\t/**\n\t * Widget type, source of the icon, title, and help note shown as\n\t * identity.\n\t */\n\twidgetType?: WidgetType;\n\n\t/**\n\t * Id linking the title to the tile's labelled region.\n\t */\n\ttitleId?: string;\n\n\t/**\n\t * Render the icon + title cluster on the leading edge.\n\t */\n\tshowIdentity?: boolean;\n\n\t/**\n\t * Float over the tile instead of sitting in the card flow.\n\t */\n\toverlay?: boolean;\n\n\t/**\n\t * Inert the identity while customizing, so it does not capture interaction.\n\t */\n\teditMode?: boolean;\n\n\t/**\n\t * Toolbar placed on the trailing edge.\n\t */\n\tchildren?: ReactNode;\n}\n\n/**\n * Tile header row: identity (icon + title) and a toolbar on one line. Rendered\n * in the card flow, or as an `overlay` in the grid slot for full-bleed widgets\n * that have no in-card header.\n *\n * @param {WidgetHeaderProps} props Component props.\n */\nexport function WidgetHeader( {\n\twidgetType,\n\ttitleId,\n\tshowIdentity = false,\n\toverlay = false,\n\teditMode = false,\n\tchildren,\n}: WidgetHeaderProps ): React.ReactNode {\n\treturn (\n\t\t<Card.Header\n\t\t\tclassName={ clsx(\n\t\t\t\tstyles[ 'widget-header' ],\n\t\t\t\toverlay && styles.overlay\n\t\t\t) }\n\t\t>\n\t\t\t{ showIdentity && widgetType?.title && (\n\t\t\t\t<Stack\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\talign=\"center\"\n\t\t\t\t\tgap=\"sm\"\n\t\t\t\t\tclassName={ styles.identity }\n\t\t\t\t\t{ ...( editMode ? { inert: 'true' } : {} ) }\n\t\t\t\t>\n\t\t\t\t\t{ widgetType.icon && (\n\t\t\t\t\t\t<span className={ styles.icon } aria-hidden=\"true\">\n\t\t\t\t\t\t\t<Icon icon={ widgetType.icon } />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<Card.Title id={ titleId } render={ <h2 /> }>\n\t\t\t\t\t\t{ widgetType.title }\n\t\t\t\t\t</Card.Title>\n\n\t\t\t\t\t{ widgetType.help && (\n\t\t\t\t\t\t<WidgetInfotip\n\t\t\t\t\t\t\tcontent={ widgetType.help.content }\n\t\t\t\t\t\t\tlinks={ widgetType.help.links }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</Stack>\n\t\t\t) }\n\n\t\t\t{ children && <div className={ styles.toolbar }>{ children }</div> }\n\t\t</Card.Header>\n\t);\n}\n", "type GlobalScopeWithStyleRuntime = typeof globalThis & {\n\t// This global is shared by separately bundled copies of this package.\n\t// Keep its shape backward compatible after release.\n\t__wpStyleRuntime?: {\n\t\tdocuments: Map< Document, number >;\n\t\tstyles: Map< string, string >;\n\t\tinjectedStyles: WeakMap< Document, Set< string > >;\n\t};\n};\n\nconst STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n\tconst globalScope = globalThis as GlobalScopeWithStyleRuntime;\n\n\tif ( globalScope.__wpStyleRuntime ) {\n\t\treturn globalScope.__wpStyleRuntime;\n\t}\n\n\tglobalScope.__wpStyleRuntime = {\n\t\tdocuments: new Map(),\n\t\tstyles: new Map(),\n\t\tinjectedStyles: new WeakMap(),\n\t};\n\n\tif ( typeof document !== 'undefined' ) {\n\t\tregisterDocument( document );\n\t}\n\n\treturn globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(\n\ttargetDocument: Document,\n\thash: string\n): boolean {\n\tif ( ! targetDocument.head ) {\n\t\treturn false;\n\t}\n\n\tfor ( const style of targetDocument.head.querySelectorAll(\n\t\t`style[${ STYLE_HASH_ATTRIBUTE }]`\n\t) ) {\n\t\tif ( style.getAttribute( STYLE_HASH_ATTRIBUTE ) === hash ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle( targetDocument: Document, hash: string, css: string ) {\n\tif ( ! targetDocument.head ) {\n\t\treturn;\n\t}\n\n\tconst runtime = getRuntime();\n\tlet injectedStyles = runtime.injectedStyles.get( targetDocument );\n\n\tif ( ! injectedStyles ) {\n\t\tinjectedStyles = new Set();\n\t\truntime.injectedStyles.set( targetDocument, injectedStyles );\n\t}\n\n\tif ( injectedStyles.has( hash ) ) {\n\t\treturn;\n\t}\n\n\t// Older generated CSS module output can still inject matching style tags\n\t// after this document's cache is created, so keep the DOM as the fallback\n\t// source of truth on cache misses.\n\tif ( documentContainsStyleHash( targetDocument, hash ) ) {\n\t\tinjectedStyles.add( hash );\n\t\treturn;\n\t}\n\n\tconst style = targetDocument.createElement( 'style' );\n\tstyle.setAttribute( STYLE_HASH_ATTRIBUTE, hash );\n\tstyle.appendChild( targetDocument.createTextNode( css ) );\n\ttargetDocument.head.appendChild( style );\n\tinjectedStyles.add( hash );\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument( targetDocument: Document ) {\n\tconst runtime = getRuntime();\n\n\truntime.documents.set(\n\t\ttargetDocument,\n\t\t( runtime.documents.get( targetDocument ) ?? 0 ) + 1\n\t);\n\n\tfor ( const [ hash, css ] of runtime.styles ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n\n\treturn () => {\n\t\tconst count = runtime.documents.get( targetDocument );\n\n\t\tif ( count === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( count <= 1 ) {\n\t\t\truntime.documents.delete( targetDocument );\n\t\t\treturn;\n\t\t}\n\n\t\truntime.documents.set( targetDocument, count - 1 );\n\t};\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle( hash: string, css: string ) {\n\tconst runtime = getRuntime();\n\n\truntime.styles.set( hash, css );\n\n\tfor ( const targetDocument of runtime.documents.keys() ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n}\n", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"9772c69e1f\", \"._2e38ceadc62158ab__widget-header{align-items:center;display:flex;gap:var(--wpds-dimension-gap-sm,8px)}._967cd798e5c37202__toolbar,.f41e4aad10324455__identity{align-items:center;display:flex;height:var(--wpds-dimension-size-lg,40px)}.f41e4aad10324455__identity{min-width:0}._53584a4927dfbcf1__icon{color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:inline-flex}._2445a9adf8f1e547__popover-popup{max-width:300px}.d6f136cf92858182__help{align-items:center;background:none;border:0;color:var(--wpds-color-foreground-content-neutral-weak,#707070);cursor:var(--wpds-cursor-control,pointer);display:inline-flex;padding:0}._9bdac6051677514a__link+._9bdac6051677514a__link{border-inline-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);padding-inline-start:var(--wpds-dimension-gap-sm,8px)}._967cd798e5c37202__toolbar{margin-inline-start:auto}.f32f2cd669c9b4b0__overlay{--wp-ui-card-padding:var(--wpds-dimension-padding-2xl,24px);inset-block-start:0;inset-inline:0;pointer-events:none;position:absolute;z-index:1}.f32f2cd669c9b4b0__overlay ._967cd798e5c37202__toolbar{pointer-events:auto}\");\n}\nexport default {\"widget-header\":\"_2e38ceadc62158ab__widget-header\",\"identity\":\"f41e4aad10324455__identity\",\"toolbar\":\"_967cd798e5c37202__toolbar\",\"icon\":\"_53584a4927dfbcf1__icon\",\"popover-popup\":\"_2445a9adf8f1e547__popover-popup\",\"help\":\"d6f136cf92858182__help\",\"link\":\"_9bdac6051677514a__link\",\"overlay\":\"f32f2cd669c9b4b0__overlay\"};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAMjB,gBAAkC;AAMlC,mCAA8B;;;ACL9B,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACrB,QAAM,cAAc;AAEpB,MAAK,YAAY,kBAAmB;AACnC,WAAO,YAAY;AAAA,EACpB;AAEA,cAAY,mBAAmB;AAAA,IAC9B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC7B;AAEA,MAAK,OAAO,aAAa,aAAc;AACtC,qBAAkB,QAA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AA,gBAAC;AAAA;AAAA,kBACA,SAAU,WAAW,KAAK;AAAA,kBAC1B,OAAQ,WAAW,KAAK;AAAA;AAAA,cACzB;AAAA;AAAA;AAAA,QAEF;AAAA,QAGC,YAAY,4CAAC,SAAI,WAAY,sBAAO,SAAY,UAAU;AAAA;AAAA;AAAA,EAC7D;AAEF;",
6
+ "names": ["clsx"]
7
+ }
@@ -17,25 +17,15 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // packages/widget-dashboard/src/components/widget-settings/utils/get-admin-menu-inset.ts
21
- var get_admin_menu_inset_exports = {};
22
- __export(get_admin_menu_inset_exports, {
23
- getAdminMenuInset: () => getAdminMenuInset
20
+ // packages/widget-dashboard/src/components/widget-layout-controls/index.ts
21
+ var widget_layout_controls_exports = {};
22
+ __export(widget_layout_controls_exports, {
23
+ WidgetLayoutControls: () => import_widget_layout_controls.WidgetLayoutControls
24
24
  });
25
- module.exports = __toCommonJS(get_admin_menu_inset_exports);
26
- var ADMIN_MENU_ID = "adminmenuback";
27
- function getAdminMenuInset() {
28
- if (typeof document === "undefined") {
29
- return 0;
30
- }
31
- const adminMenu = document.getElementById(ADMIN_MENU_ID);
32
- if (!adminMenu) {
33
- return 0;
34
- }
35
- return Math.max(0, adminMenu.getBoundingClientRect().right);
36
- }
25
+ module.exports = __toCommonJS(widget_layout_controls_exports);
26
+ var import_widget_layout_controls = require("./widget-layout-controls.cjs");
37
27
  // Annotate the CommonJS export names for ESM import in node:
38
28
  0 && (module.exports = {
39
- getAdminMenuInset
29
+ WidgetLayoutControls
40
30
  });
41
- //# sourceMappingURL=get-admin-menu-inset.cjs.map
31
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/widget-layout-controls/index.ts"],
4
+ "sourcesContent": ["export { WidgetLayoutControls } from './widget-layout-controls';\nexport type { WidgetLayoutControlsProps } from './widget-layout-controls';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAAqC;",
6
+ "names": []
7
+ }
@@ -17,112 +17,21 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // packages/widget-dashboard/src/components/widgets/widget-layout-toolbar.tsx
21
- var widget_layout_toolbar_exports = {};
22
- __export(widget_layout_toolbar_exports, {
23
- WidgetLayoutToolbar: () => WidgetLayoutToolbar
20
+ // packages/widget-dashboard/src/components/widget-layout-controls/widget-layout-controls.tsx
21
+ var widget_layout_controls_exports = {};
22
+ __export(widget_layout_controls_exports, {
23
+ WidgetLayoutControls: () => WidgetLayoutControls
24
24
  });
25
- module.exports = __toCommonJS(widget_layout_toolbar_exports);
25
+ module.exports = __toCommonJS(widget_layout_controls_exports);
26
26
  var import_components = require("@wordpress/components");
27
27
  var import_i18n = require("@wordpress/i18n");
28
28
  var import_icons = require("@wordpress/icons");
29
29
  var import_ui = require("@wordpress/ui");
30
30
  var import_lock_unlock = require("../../lock-unlock.cjs");
31
31
  var import_dashboard_context = require("../../context/dashboard-context.cjs");
32
- var import_widget_toolbar = require("../widget-toolbar/index.cjs");
33
-
34
- // packages/style-runtime/src/index.ts
35
- var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
36
- function getRuntime() {
37
- const globalScope = globalThis;
38
- if (globalScope.__wpStyleRuntime) {
39
- return globalScope.__wpStyleRuntime;
40
- }
41
- globalScope.__wpStyleRuntime = {
42
- documents: /* @__PURE__ */ new Map(),
43
- styles: /* @__PURE__ */ new Map(),
44
- injectedStyles: /* @__PURE__ */ new WeakMap()
45
- };
46
- if (typeof document !== "undefined") {
47
- registerDocument(document);
48
- }
49
- return globalScope.__wpStyleRuntime;
50
- }
51
- function documentContainsStyleHash(targetDocument, hash) {
52
- if (!targetDocument.head) {
53
- return false;
54
- }
55
- for (const style of targetDocument.head.querySelectorAll(
56
- `style[${STYLE_HASH_ATTRIBUTE}]`
57
- )) {
58
- if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
59
- return true;
60
- }
61
- }
62
- return false;
63
- }
64
- function injectStyle(targetDocument, hash, css) {
65
- if (!targetDocument.head) {
66
- return;
67
- }
68
- const runtime = getRuntime();
69
- let injectedStyles = runtime.injectedStyles.get(targetDocument);
70
- if (!injectedStyles) {
71
- injectedStyles = /* @__PURE__ */ new Set();
72
- runtime.injectedStyles.set(targetDocument, injectedStyles);
73
- }
74
- if (injectedStyles.has(hash)) {
75
- return;
76
- }
77
- if (documentContainsStyleHash(targetDocument, hash)) {
78
- injectedStyles.add(hash);
79
- return;
80
- }
81
- const style = targetDocument.createElement("style");
82
- style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
83
- style.appendChild(targetDocument.createTextNode(css));
84
- targetDocument.head.appendChild(style);
85
- injectedStyles.add(hash);
86
- }
87
- function registerDocument(targetDocument) {
88
- const runtime = getRuntime();
89
- runtime.documents.set(
90
- targetDocument,
91
- (runtime.documents.get(targetDocument) ?? 0) + 1
92
- );
93
- for (const [hash, css] of runtime.styles) {
94
- injectStyle(targetDocument, hash, css);
95
- }
96
- return () => {
97
- const count = runtime.documents.get(targetDocument);
98
- if (count === void 0) {
99
- return;
100
- }
101
- if (count <= 1) {
102
- runtime.documents.delete(targetDocument);
103
- return;
104
- }
105
- runtime.documents.set(targetDocument, count - 1);
106
- };
107
- }
108
- function registerStyle(hash, css) {
109
- const runtime = getRuntime();
110
- runtime.styles.set(hash, css);
111
- for (const targetDocument of runtime.documents.keys()) {
112
- injectStyle(targetDocument, hash, css);
113
- }
114
- }
115
-
116
- // packages/widget-dashboard/src/components/widgets/widget-layout-toolbar.module.css
117
- if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
118
- registerStyle("2696f7462d", "._6f7360b4588de00a__widgetLayoutToolbar{background:var(--wpds-color-background-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);box-shadow:var(--wpds-elevation-xs,0 1px 1px 0 #00000008,0 1px 2px 0 #00000005,0 3px 3px 0 #00000005,0 4px 4px 0 #00000003)}");
119
- }
120
- var widget_layout_toolbar_default = { "widgetLayoutToolbar": "_6f7360b4588de00a__widgetLayoutToolbar" };
121
-
122
- // packages/widget-dashboard/src/components/widgets/widget-layout-toolbar.tsx
123
32
  var import_jsx_runtime = require("react/jsx-runtime");
124
33
  var { Menu } = (0, import_lock_unlock.unlock)(import_components.privateApis);
125
- function WidgetLayoutToolbar({
34
+ function WidgetLayoutControls({
126
35
  widget
127
36
  }) {
128
37
  const { layout, onLayoutChange } = (0, import_dashboard_context.useDashboardInternalContext)();
@@ -149,7 +58,7 @@ function WidgetLayoutToolbar({
149
58
  )
150
59
  );
151
60
  };
152
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_widget_toolbar.WidgetToolbar, { className: widget_layout_toolbar_default.widgetLayoutToolbar, children: [
61
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
153
62
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Menu, { children: [
154
63
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
155
64
  Menu.TriggerButton,
@@ -201,6 +110,6 @@ function WidgetLayoutToolbar({
201
110
  }
202
111
  // Annotate the CommonJS export names for ESM import in node:
203
112
  0 && (module.exports = {
204
- WidgetLayoutToolbar
113
+ WidgetLayoutControls
205
114
  });
206
- //# sourceMappingURL=widget-layout-toolbar.cjs.map
115
+ //# sourceMappingURL=widget-layout-controls.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/widget-layout-controls/widget-layout-controls.tsx"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { moreVertical, trash } from '@wordpress/icons';\n// eslint-disable-next-line @wordpress/use-recommended-components\nimport { IconButton } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { useDashboardInternalContext } from '../../context/dashboard-context';\nimport type { DashboardWidget, GridTilePlacement } from '../../types';\n\nconst { Menu } = unlock( componentsPrivateApis );\n\ntype NamedGridWidth = Exclude<\n\tNonNullable< GridTilePlacement[ 'width' ] >,\n\tnumber\n>;\n\nexport interface WidgetLayoutControlsProps {\n\t/**\n\t * The instance these controls manage within the layout.\n\t */\n\twidget: DashboardWidget< unknown >;\n}\n\n/**\n * Customize-mode controls: width menu and removal.\n *\n * @param {WidgetLayoutControlsProps} props Component props.\n */\nexport function WidgetLayoutControls( {\n\twidget,\n}: WidgetLayoutControlsProps ): React.ReactNode {\n\tconst { layout, onLayoutChange } = useDashboardInternalContext();\n\tconst width = widget.placement?.width;\n\n\tconst updateWidth = ( nextWidth: GridTilePlacement[ 'width' ] ) => {\n\t\tconst nextLayout = layout.map( ( currentWidget ) =>\n\t\t\tcurrentWidget.uuid === widget.uuid\n\t\t\t\t? {\n\t\t\t\t\t\t...currentWidget,\n\t\t\t\t\t\tplacement: {\n\t\t\t\t\t\t\t...currentWidget.placement,\n\t\t\t\t\t\t\twidth: nextWidth,\n\t\t\t\t\t\t},\n\t\t\t\t }\n\t\t\t\t: currentWidget\n\t\t);\n\t\tonLayoutChange( nextLayout );\n\t};\n\n\tconst onNamedWidthChange = ( nextWidth: NamedGridWidth ) => {\n\t\tupdateWidth( nextWidth );\n\t};\n\n\tconst onRemove = () => {\n\t\tonLayoutChange(\n\t\t\tlayout.filter(\n\t\t\t\t( currentWidget ) => currentWidget.uuid !== widget.uuid\n\t\t\t)\n\t\t);\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<Menu>\n\t\t\t\t<Menu.TriggerButton\n\t\t\t\t\trender={\n\t\t\t\t\t\t<IconButton\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\tlabel={ __( 'Widget options' ) }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\tvariant=\"minimal\"\n\t\t\t\t\t\t\ttone=\"neutral\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t/>\n\n\t\t\t\t<Menu.Popover>\n\t\t\t\t\t<Menu.Group>\n\t\t\t\t\t\t<Menu.GroupLabel>{ __( 'Width' ) }</Menu.GroupLabel>\n\t\t\t\t\t\t<Menu.Item\n\t\t\t\t\t\t\tdisabled={ width === 'fill' }\n\t\t\t\t\t\t\tonClick={ () => onNamedWidthChange( 'fill' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t{ __( 'Use available width' ) }\n\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t</Menu.Item>\n\t\t\t\t\t\t<Menu.Item\n\t\t\t\t\t\t\tdisabled={ width === 'full' }\n\t\t\t\t\t\t\tonClick={ () => onNamedWidthChange( 'full' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t{ __( 'Make full width' ) }\n\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t</Menu.Item>\n\t\t\t\t\t</Menu.Group>\n\t\t\t\t</Menu.Popover>\n\t\t\t</Menu>\n\n\t\t\t<IconButton\n\t\t\t\ticon={ trash }\n\t\t\t\tlabel={ __( 'Remove' ) }\n\t\t\t\tsize=\"compact\"\n\t\t\t\tvariant=\"minimal\"\n\t\t\t\ttone=\"neutral\"\n\t\t\t\tonClick={ onRemove }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAqD;AACrD,kBAAmB;AACnB,mBAAoC;AAEpC,gBAA2B;AAK3B,yBAAuB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