@wordpress/components 19.2.1-next.33ec3857e2.0 → 19.2.1

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 (368) hide show
  1. package/CHANGELOG.md +6 -29
  2. package/build/angle-picker-control/index.js +0 -2
  3. package/build/angle-picker-control/index.js.map +1 -1
  4. package/build/button/index.native.js +3 -13
  5. package/build/button/index.native.js.map +1 -1
  6. package/build/checkbox-control/index.js +1 -1
  7. package/build/checkbox-control/index.js.map +1 -1
  8. package/build/clipboard-button/index.js +2 -1
  9. package/build/clipboard-button/index.js.map +1 -1
  10. package/build/color-palette/index.js +1 -13
  11. package/build/color-palette/index.js.map +1 -1
  12. package/build/color-picker/color-display.js +2 -4
  13. package/build/color-picker/color-display.js.map +1 -1
  14. package/build/color-picker/hex-input.js +1 -3
  15. package/build/color-picker/hex-input.js.map +1 -1
  16. package/build/color-picker/input-with-slider.js +1 -3
  17. package/build/color-picker/input-with-slider.js.map +1 -1
  18. package/build/custom-gradient-picker/index.js +0 -1
  19. package/build/custom-gradient-picker/index.js.map +1 -1
  20. package/build/date-time/date.js +86 -63
  21. package/build/date-time/date.js.map +1 -1
  22. package/build/divider/component.js +7 -8
  23. package/build/divider/component.js.map +1 -1
  24. package/build/divider/styles.js +13 -38
  25. package/build/divider/styles.js.map +1 -1
  26. package/build/drop-zone/index.js +6 -14
  27. package/build/drop-zone/index.js.map +1 -1
  28. package/build/drop-zone/provider.js +0 -1
  29. package/build/drop-zone/provider.js.map +1 -1
  30. package/build/flyout/styles.js +2 -2
  31. package/build/flyout/styles.js.map +1 -1
  32. package/build/focusable-iframe/index.js +0 -1
  33. package/build/focusable-iframe/index.js.map +1 -1
  34. package/build/higher-order/with-focus-outside/index.js +0 -2
  35. package/build/higher-order/with-focus-outside/index.js.map +1 -1
  36. package/build/index.js +0 -8
  37. package/build/index.js.map +1 -1
  38. package/build/input-control/styles/input-control-styles.js +32 -44
  39. package/build/input-control/styles/input-control-styles.js.map +1 -1
  40. package/build/mobile/bottom-sheet/link-suggestion-item-cell.native.js +3 -10
  41. package/build/mobile/bottom-sheet/link-suggestion-item-cell.native.js.map +1 -1
  42. package/build/mobile/color-settings/index.native.js +2 -4
  43. package/build/mobile/color-settings/index.native.js.map +1 -1
  44. package/build/mobile/color-settings/palette.screen.native.js +6 -7
  45. package/build/mobile/color-settings/palette.screen.native.js.map +1 -1
  46. package/build/mobile/global-styles-context/utils.native.js +1 -1
  47. package/build/mobile/global-styles-context/utils.native.js.map +1 -1
  48. package/build/mobile/gridicons/index.native.js +1 -3
  49. package/build/mobile/gridicons/index.native.js.map +1 -1
  50. package/build/mobile/link-picker/index.native.js +4 -45
  51. package/build/mobile/link-picker/index.native.js.map +1 -1
  52. package/build/mobile/link-settings/index.native.js +0 -10
  53. package/build/mobile/link-settings/index.native.js.map +1 -1
  54. package/build/modal/aria-helper.js +0 -2
  55. package/build/modal/aria-helper.js.map +1 -1
  56. package/build/modal/index.js +8 -17
  57. package/build/modal/index.js.map +1 -1
  58. package/build/palette-edit/index.js +31 -27
  59. package/build/palette-edit/index.js.map +1 -1
  60. package/build/select-control/styles/select-control-styles.js +9 -33
  61. package/build/select-control/styles/select-control-styles.js.map +1 -1
  62. package/build/style-provider/index.js +0 -2
  63. package/build/style-provider/index.js.map +1 -1
  64. package/build/toggle-group-control/toggle-group-control/component.js +2 -7
  65. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  66. package/build/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js +14 -25
  67. package/build/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js.map +1 -1
  68. package/build/tools-panel/styles.js +10 -12
  69. package/build/tools-panel/styles.js.map +1 -1
  70. package/build/tools-panel/tools-panel/component.js +8 -6
  71. package/build/tools-panel/tools-panel/component.js.map +1 -1
  72. package/build/tools-panel/tools-panel-item/hook.js +8 -6
  73. package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
  74. package/build/unit-control/styles/unit-control-styles.js +41 -23
  75. package/build/unit-control/styles/unit-control-styles.js.map +1 -1
  76. package/build/z-stack/component.js.map +1 -1
  77. package/build/z-stack/styles.js +8 -10
  78. package/build/z-stack/styles.js.map +1 -1
  79. package/build-module/angle-picker-control/index.js +0 -2
  80. package/build-module/angle-picker-control/index.js.map +1 -1
  81. package/build-module/button/index.native.js +3 -13
  82. package/build-module/button/index.native.js.map +1 -1
  83. package/build-module/checkbox-control/index.js +1 -1
  84. package/build-module/checkbox-control/index.js.map +1 -1
  85. package/build-module/clipboard-button/index.js +2 -1
  86. package/build-module/clipboard-button/index.js.map +1 -1
  87. package/build-module/color-palette/index.js +2 -14
  88. package/build-module/color-palette/index.js.map +1 -1
  89. package/build-module/color-picker/color-display.js +2 -3
  90. package/build-module/color-picker/color-display.js.map +1 -1
  91. package/build-module/color-picker/hex-input.js +1 -2
  92. package/build-module/color-picker/hex-input.js.map +1 -1
  93. package/build-module/color-picker/input-with-slider.js +1 -2
  94. package/build-module/color-picker/input-with-slider.js.map +1 -1
  95. package/build-module/custom-gradient-picker/index.js +0 -1
  96. package/build-module/custom-gradient-picker/index.js.map +1 -1
  97. package/build-module/date-time/date.js +87 -63
  98. package/build-module/date-time/date.js.map +1 -1
  99. package/build-module/divider/component.js +7 -8
  100. package/build-module/divider/component.js.map +1 -1
  101. package/build-module/divider/styles.js +13 -37
  102. package/build-module/divider/styles.js.map +1 -1
  103. package/build-module/drop-zone/index.js +6 -14
  104. package/build-module/drop-zone/index.js.map +1 -1
  105. package/build-module/drop-zone/provider.js +0 -1
  106. package/build-module/drop-zone/provider.js.map +1 -1
  107. package/build-module/flyout/styles.js +2 -2
  108. package/build-module/flyout/styles.js.map +1 -1
  109. package/build-module/focusable-iframe/index.js +0 -1
  110. package/build-module/focusable-iframe/index.js.map +1 -1
  111. package/build-module/higher-order/with-focus-outside/index.js +0 -1
  112. package/build-module/higher-order/with-focus-outside/index.js.map +1 -1
  113. package/build-module/index.js +0 -1
  114. package/build-module/index.js.map +1 -1
  115. package/build-module/input-control/styles/input-control-styles.js +32 -44
  116. package/build-module/input-control/styles/input-control-styles.js.map +1 -1
  117. package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js +4 -10
  118. package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js.map +1 -1
  119. package/build-module/mobile/color-settings/index.native.js +2 -4
  120. package/build-module/mobile/color-settings/index.native.js.map +1 -1
  121. package/build-module/mobile/color-settings/palette.screen.native.js +6 -7
  122. package/build-module/mobile/color-settings/palette.screen.native.js.map +1 -1
  123. package/build-module/mobile/global-styles-context/utils.native.js +1 -1
  124. package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
  125. package/build-module/mobile/gridicons/index.native.js +0 -1
  126. package/build-module/mobile/gridicons/index.native.js.map +1 -1
  127. package/build-module/mobile/link-picker/index.native.js +8 -50
  128. package/build-module/mobile/link-picker/index.native.js.map +1 -1
  129. package/build-module/mobile/link-settings/index.native.js +0 -10
  130. package/build-module/mobile/link-settings/index.native.js.map +1 -1
  131. package/build-module/modal/aria-helper.js +0 -2
  132. package/build-module/modal/aria-helper.js.map +1 -1
  133. package/build-module/modal/index.js +8 -15
  134. package/build-module/modal/index.js.map +1 -1
  135. package/build-module/palette-edit/index.js +30 -27
  136. package/build-module/palette-edit/index.js.map +1 -1
  137. package/build-module/select-control/styles/select-control-styles.js +9 -33
  138. package/build-module/select-control/styles/select-control-styles.js.map +1 -1
  139. package/build-module/style-provider/index.js +0 -1
  140. package/build-module/style-provider/index.js.map +1 -1
  141. package/build-module/toggle-group-control/toggle-group-control/component.js +3 -8
  142. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  143. package/build-module/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js +14 -25
  144. package/build-module/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js.map +1 -1
  145. package/build-module/tools-panel/styles.js +11 -12
  146. package/build-module/tools-panel/styles.js.map +1 -1
  147. package/build-module/tools-panel/tools-panel/component.js +8 -5
  148. package/build-module/tools-panel/tools-panel/component.js.map +1 -1
  149. package/build-module/tools-panel/tools-panel-item/hook.js +8 -6
  150. package/build-module/tools-panel/tools-panel-item/hook.js.map +1 -1
  151. package/build-module/unit-control/styles/unit-control-styles.js +41 -23
  152. package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
  153. package/build-module/z-stack/component.js.map +1 -1
  154. package/build-module/z-stack/styles.js +8 -13
  155. package/build-module/z-stack/styles.js.map +1 -1
  156. package/build-style/style-rtl.css +11 -23
  157. package/build-style/style.css +11 -23
  158. package/build-types/base-field/hook.d.ts +16 -16
  159. package/build-types/card/card/hook.d.ts +16 -16
  160. package/build-types/card/card-body/hook.d.ts +16 -16
  161. package/build-types/card/card-divider/hook.d.ts +18 -18
  162. package/build-types/card/card-footer/hook.d.ts +17 -17
  163. package/build-types/card/card-header/hook.d.ts +16 -16
  164. package/build-types/card/card-media/hook.d.ts +16 -16
  165. package/build-types/divider/component.d.ts +7 -8
  166. package/build-types/divider/component.d.ts.map +1 -1
  167. package/build-types/divider/styles.d.ts +2 -2
  168. package/build-types/divider/styles.d.ts.map +1 -1
  169. package/build-types/divider/types.d.ts +5 -5
  170. package/build-types/divider/types.d.ts.map +1 -1
  171. package/build-types/elevation/hook.d.ts +15 -15
  172. package/build-types/flex/flex/hook.d.ts +16 -16
  173. package/build-types/flex/flex-block/hook.d.ts +16 -16
  174. package/build-types/flex/flex-item/hook.d.ts +16 -16
  175. package/build-types/flyout/flyout/hook.d.ts +17 -17
  176. package/build-types/flyout/styles.d.ts +9 -7
  177. package/build-types/flyout/styles.d.ts.map +1 -1
  178. package/build-types/grid/hook.d.ts +16 -16
  179. package/build-types/h-stack/hook.d.ts +16 -16
  180. package/build-types/heading/hook.d.ts +16 -16
  181. package/build-types/input-control/index.d.ts +1 -1
  182. package/build-types/input-control/index.d.ts.map +1 -1
  183. package/build-types/input-control/input-field.d.ts +1 -1
  184. package/build-types/input-control/input-field.d.ts.map +1 -1
  185. package/build-types/input-control/styles/input-control-styles.d.ts +2 -1
  186. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  187. package/build-types/input-control/types.d.ts +1 -2
  188. package/build-types/input-control/types.d.ts.map +1 -1
  189. package/build-types/item-group/item/hook.d.ts +16 -16
  190. package/build-types/item-group/item-group/hook.d.ts +16 -16
  191. package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
  192. package/build-types/scrollable/hook.d.ts +16 -16
  193. package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
  194. package/build-types/select-control/types.d.ts +1 -1
  195. package/build-types/select-control/types.d.ts.map +1 -1
  196. package/build-types/spacer/hook.d.ts +16 -16
  197. package/build-types/surface/hook.d.ts +16 -16
  198. package/build-types/text/hook.d.ts +16 -16
  199. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  200. package/build-types/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.d.ts.map +1 -1
  201. package/build-types/tools-panel/styles.d.ts.map +1 -1
  202. package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
  203. package/build-types/tools-panel/tools-panel/hook.d.ts +16 -16
  204. package/build-types/tools-panel/tools-panel-header/hook.d.ts +16 -16
  205. package/build-types/tools-panel/tools-panel-item/hook.d.ts +16 -16
  206. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  207. package/build-types/truncate/hook.d.ts +16 -16
  208. package/build-types/ui/control-group/hook.d.ts +18 -18
  209. package/build-types/ui/control-label/hook.d.ts +16 -16
  210. package/build-types/ui/form-group/form-group.d.ts +4 -4
  211. package/build-types/ui/form-group/use-form-group.d.ts +55 -55
  212. package/build-types/unit-control/index.d.ts +1 -1
  213. package/build-types/unit-control/index.d.ts.map +1 -1
  214. package/build-types/unit-control/styles/unit-control-styles.d.ts +0 -1
  215. package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
  216. package/build-types/unit-control/types.d.ts +2 -2
  217. package/build-types/unit-control/types.d.ts.map +1 -1
  218. package/build-types/v-stack/hook.d.ts +16 -16
  219. package/build-types/z-stack/component.d.ts +1 -1
  220. package/build-types/z-stack/styles.d.ts.map +1 -1
  221. package/package.json +23 -21
  222. package/src/alignment-matrix-control/stories/index.js +1 -1
  223. package/src/angle-picker-control/index.js +0 -2
  224. package/src/base-control/stories/index.js +1 -1
  225. package/src/button/index.native.js +1 -15
  226. package/src/button/stories/index.js +1 -1
  227. package/src/button/style.scss +0 -14
  228. package/src/card/card/README.md +3 -3
  229. package/src/card/stories/index.js +1 -1
  230. package/src/card/test/__snapshots__/index.js.snap +6 -6
  231. package/src/checkbox-control/index.js +1 -1
  232. package/src/checkbox-control/stories/index.js +1 -1
  233. package/src/clipboard-button/index.js +2 -1
  234. package/src/color-indicator/stories/index.js +1 -1
  235. package/src/color-indicator/style.scss +8 -5
  236. package/src/color-palette/index.js +5 -13
  237. package/src/color-palette/stories/index.js +1 -1
  238. package/src/color-palette/test/__snapshots__/index.js.snap +0 -1
  239. package/src/color-picker/color-display.tsx +2 -3
  240. package/src/color-picker/hex-input.tsx +1 -2
  241. package/src/color-picker/input-with-slider.tsx +1 -2
  242. package/src/color-picker/stories/index.js +1 -1
  243. package/src/combobox-control/README.md +2 -2
  244. package/src/custom-gradient-picker/index.js +0 -1
  245. package/src/custom-gradient-picker/style.scss +4 -0
  246. package/src/date-time/README.md +0 -7
  247. package/src/date-time/date.js +84 -67
  248. package/src/date-time/stories/index.js +1 -1
  249. package/src/date-time/stories/time.js +1 -1
  250. package/src/date-time/test/date.js +29 -3
  251. package/src/dimension-control/README.md +1 -1
  252. package/src/divider/README.md +5 -33
  253. package/src/divider/component.tsx +7 -8
  254. package/src/divider/stories/index.js +17 -43
  255. package/src/divider/styles.ts +16 -53
  256. package/src/divider/test/__snapshots__/index.js.snap +11 -11
  257. package/src/divider/test/index.js +4 -4
  258. package/src/divider/types.ts +5 -5
  259. package/src/drop-zone/index.js +6 -14
  260. package/src/drop-zone/provider.js +0 -1
  261. package/src/dropdown-menu/stories/index.js +1 -1
  262. package/src/duotone-picker/README.md +1 -1
  263. package/src/elevation/stories/index.js +1 -1
  264. package/src/external-link/stories/index.js +1 -1
  265. package/src/flyout/styles.ts +2 -4
  266. package/src/focusable-iframe/index.js +0 -1
  267. package/src/font-size-picker/stories/index.js +1 -1
  268. package/src/form-token-field/stories/index.js +1 -1
  269. package/src/gradient-picker/stories/index.js +1 -1
  270. package/src/grid/stories/index.js +1 -1
  271. package/src/guide/stories/index.js +1 -1
  272. package/src/higher-order/with-focus-outside/index.js +0 -2
  273. package/src/icon/stories/index.js +1 -1
  274. package/src/index.js +0 -1
  275. package/src/input-control/stories/index.js +1 -2
  276. package/src/input-control/styles/input-control-styles.tsx +6 -16
  277. package/src/input-control/types.ts +1 -3
  278. package/src/item-group/stories/index.js +2 -84
  279. package/src/menu-item/README.md +2 -2
  280. package/src/mobile/bottom-sheet/link-suggestion-item-cell.native.js +2 -6
  281. package/src/mobile/color-settings/index.native.js +0 -2
  282. package/src/mobile/color-settings/palette.screen.native.js +5 -8
  283. package/src/mobile/color-settings/style.native.scss +1 -1
  284. package/src/mobile/global-styles-context/utils.native.js +1 -1
  285. package/src/mobile/gridicons/index.native.js +3 -3
  286. package/src/mobile/inserter-button/style.native.scss +0 -1
  287. package/src/mobile/link-picker/index.native.js +7 -41
  288. package/src/mobile/link-settings/index.native.js +0 -11
  289. package/src/modal/README.md +0 -10
  290. package/src/modal/aria-helper.js +0 -2
  291. package/src/modal/index.js +55 -72
  292. package/src/modal/stories/index.js +1 -6
  293. package/src/modal/style.scss +0 -9
  294. package/src/modal/test/index.js +0 -11
  295. package/src/navigation/README.md +9 -0
  296. package/src/notice/stories/index.js +1 -1
  297. package/src/number-control/stories/index.js +1 -1
  298. package/src/palette-edit/index.js +106 -73
  299. package/src/panel/stories/index.js +1 -1
  300. package/src/placeholder/stories/index.js +1 -1
  301. package/src/popover/stories/index.js +1 -1
  302. package/src/query-controls/README.md +6 -138
  303. package/src/radio-group/README.md +1 -4
  304. package/src/range-control/stories/index.js +1 -1
  305. package/src/resizable-box/stories/index.js +1 -1
  306. package/src/scrollable/stories/index.js +1 -1
  307. package/src/search-control/stories/index.js +1 -1
  308. package/src/select-control/stories/index.js +1 -2
  309. package/src/select-control/styles/select-control-styles.ts +2 -25
  310. package/src/select-control/types.ts +1 -1
  311. package/src/slot-fill/stories/index.js +1 -1
  312. package/src/snackbar/stories/index.js +1 -1
  313. package/src/spacer/stories/index.js +1 -1
  314. package/src/style-provider/index.js +0 -2
  315. package/src/surface/stories/index.js +1 -1
  316. package/src/tab-panel/stories/index.js +1 -1
  317. package/src/text-control/stories/index.js +1 -1
  318. package/src/text-highlight/stories/index.js +1 -1
  319. package/src/textarea-control/stories/index.js +1 -1
  320. package/src/tip/stories/index.js +1 -1
  321. package/src/toggle-control/stories/index.js +1 -1
  322. package/src/toggle-group-control/stories/index.js +1 -1
  323. package/src/toggle-group-control/toggle-group-control/component.tsx +2 -7
  324. package/src/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.tsx +9 -24
  325. package/src/toolbar-button/stories/index.js +1 -1
  326. package/src/tools-panel/stories/index.js +0 -54
  327. package/src/tools-panel/styles.ts +1 -41
  328. package/src/tools-panel/test/index.js +137 -19
  329. package/src/tools-panel/tools-panel/README.md +3 -11
  330. package/src/tools-panel/tools-panel/component.tsx +5 -2
  331. package/src/tools-panel/tools-panel-item/hook.ts +14 -6
  332. package/src/tooltip/stories/index.js +1 -1
  333. package/src/tree-select/stories/index.js +1 -1
  334. package/src/truncate/stories/index.js +1 -1
  335. package/src/unit-control/stories/index.js +1 -19
  336. package/src/unit-control/styles/unit-control-styles.ts +46 -33
  337. package/src/unit-control/types.ts +2 -5
  338. package/src/z-stack/README.md +1 -1
  339. package/src/z-stack/component.tsx +1 -1
  340. package/src/z-stack/stories/index.js +1 -1
  341. package/src/z-stack/styles.ts +2 -7
  342. package/tsconfig.json +2 -6
  343. package/tsconfig.tsbuildinfo +1 -1
  344. package/build/confirm-dialog/component.js +0 -103
  345. package/build/confirm-dialog/component.js.map +0 -1
  346. package/build/confirm-dialog/index.js +0 -16
  347. package/build/confirm-dialog/index.js.map +0 -1
  348. package/build/confirm-dialog/types.js +0 -6
  349. package/build/confirm-dialog/types.js.map +0 -1
  350. package/build/date-time/utils.js +0 -32
  351. package/build/date-time/utils.js.map +0 -1
  352. package/build-module/confirm-dialog/component.js +0 -84
  353. package/build-module/confirm-dialog/component.js.map +0 -1
  354. package/build-module/confirm-dialog/index.js +0 -6
  355. package/build-module/confirm-dialog/index.js.map +0 -1
  356. package/build-module/confirm-dialog/types.js +0 -2
  357. package/build-module/confirm-dialog/types.js.map +0 -1
  358. package/build-module/date-time/utils.js +0 -20
  359. package/build-module/date-time/utils.js.map +0 -1
  360. package/src/confirm-dialog/README.md +0 -128
  361. package/src/confirm-dialog/component.tsx +0 -114
  362. package/src/confirm-dialog/index.tsx +0 -6
  363. package/src/confirm-dialog/stories/index.js +0 -120
  364. package/src/confirm-dialog/test/index.js +0 -302
  365. package/src/confirm-dialog/types.ts +0 -26
  366. package/src/date-time/test/utils.js +0 -32
  367. package/src/date-time/utils.js +0 -18
  368. package/src/mobile/link-settings/test/edit.native.js +0 -432
@@ -1,103 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _element = require("@wordpress/element");
11
-
12
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
-
14
- var _react = _interopRequireWildcard(require("react"));
15
-
16
- var _i18n = require("@wordpress/i18n");
17
-
18
- var _modal = _interopRequireDefault(require("../modal"));
19
-
20
- var _context = require("../ui/context");
21
-
22
- var _flex = require("../flex");
23
-
24
- var _button = _interopRequireDefault(require("../button"));
25
-
26
- var _text = require("../text");
27
-
28
- var _vStack = require("../v-stack");
29
-
30
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
31
-
32
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
33
-
34
- /**
35
- * External dependencies
36
- */
37
- // eslint-disable-next-line no-restricted-imports
38
-
39
- /**
40
- * WordPress dependencies
41
- */
42
-
43
- /**
44
- * Internal dependencies
45
- */
46
- function ConfirmDialog(props, forwardedRef) {
47
- const {
48
- isOpen: isOpenProp,
49
- onConfirm,
50
- onCancel,
51
- children,
52
- ...otherProps
53
- } = (0, _context.useContextSystem)(props, 'ConfirmDialog');
54
- const [isOpen, setIsOpen] = (0, _react.useState)();
55
- const [shouldSelfClose, setShouldSelfClose] = (0, _react.useState)();
56
- (0, _react.useEffect)(() => {
57
- // We only allow the dialog to close itself if `isOpenProp` is *not* set.
58
- // If `isOpenProp` is set, then it (probably) means it's controlled by a
59
- // parent component. In that case, `shouldSelfClose` might do more harm than
60
- // good, so we disable it.
61
- const isIsOpenSet = typeof isOpenProp !== 'undefined';
62
- setIsOpen(isIsOpenSet ? isOpenProp : true);
63
- setShouldSelfClose(!isIsOpenSet);
64
- }, [isOpenProp]);
65
- const handleEvent = (0, _element.useCallback)(callback => event => {
66
- callback === null || callback === void 0 ? void 0 : callback(event);
67
-
68
- if (shouldSelfClose) {
69
- setIsOpen(false);
70
- }
71
- }, [shouldSelfClose, setIsOpen]);
72
- const handleEnter = (0, _element.useCallback)(event => {
73
- if (event.key === 'Enter') {
74
- handleEvent(onConfirm)(event);
75
- }
76
- }, [handleEvent, onConfirm]);
77
- const cancelLabel = (0, _i18n.__)('Cancel');
78
- const confirmLabel = (0, _i18n.__)('OK');
79
- return (0, _element.createElement)(_element.Fragment, null, isOpen && (0, _element.createElement)(_modal.default, (0, _extends2.default)({
80
- onRequestClose: handleEvent(onCancel),
81
- onKeyDown: handleEnter,
82
- closeButtonLabel: cancelLabel,
83
- isDismissible: true,
84
- ref: forwardedRef,
85
- __experimentalHideHeader: true
86
- }, otherProps), (0, _element.createElement)(_vStack.VStack, {
87
- spacing: 8
88
- }, (0, _element.createElement)(_text.Text, null, children), (0, _element.createElement)(_flex.Flex, {
89
- direction: "row",
90
- justify: "flex-end"
91
- }, (0, _element.createElement)(_button.default, {
92
- variant: "tertiary",
93
- onClick: handleEvent(onCancel)
94
- }, cancelLabel), (0, _element.createElement)(_button.default, {
95
- variant: "primary",
96
- onClick: handleEvent(onConfirm)
97
- }, confirmLabel)))));
98
- }
99
-
100
- var _default = (0, _context.contextConnect)(ConfirmDialog, 'ConfirmDialog');
101
-
102
- exports.default = _default;
103
- //# sourceMappingURL=component.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/components/src/confirm-dialog/component.tsx"],"names":["ConfirmDialog","props","forwardedRef","isOpen","isOpenProp","onConfirm","onCancel","children","otherProps","setIsOpen","shouldSelfClose","setShouldSelfClose","isIsOpenSet","handleEvent","callback","event","handleEnter","key","cancelLabel","confirmLabel"],"mappings":";;;;;;;;;AAYA;;;;AARA;;AAOA;;AAMA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;;;;;AA3BA;AACA;AACA;AACA;;AAKA;AACA;AACA;;AAIA;AACA;AACA;AAaA,SAASA,aAAT,CACCC,KADD,EAECC,YAFD,EAGE;AACD,QAAM;AACLC,IAAAA,MAAM,EAAEC,UADH;AAELC,IAAAA,SAFK;AAGLC,IAAAA,QAHK;AAILC,IAAAA,QAJK;AAKL,OAAGC;AALE,MAMF,+BAAkBP,KAAlB,EAAyB,eAAzB,CANJ;AAQA,QAAM,CAAEE,MAAF,EAAUM,SAAV,IAAwB,sBAA9B;AACA,QAAM,CAAEC,eAAF,EAAmBC,kBAAnB,IAA0C,sBAAhD;AAEA,wBAAW,MAAM;AAChB;AACA;AACA;AACA;AACA,UAAMC,WAAW,GAAG,OAAOR,UAAP,KAAsB,WAA1C;AACAK,IAAAA,SAAS,CAAEG,WAAW,GAAGR,UAAH,GAAgB,IAA7B,CAAT;AACAO,IAAAA,kBAAkB,CAAE,CAAEC,WAAJ,CAAlB;AACA,GARD,EAQG,CAAER,UAAF,CARH;AAUA,QAAMS,WAAW,GAAG,0BACjBC,QAAF,IACCC,KADqD,IAEjD;AACJD,IAAAA,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAIC,KAAJ,CAAR;;AACA,QAAKL,eAAL,EAAuB;AACtBD,MAAAA,SAAS,CAAE,KAAF,CAAT;AACA;AACD,GARkB,EASnB,CAAEC,eAAF,EAAmBD,SAAnB,CATmB,CAApB;AAYA,QAAMO,WAAW,GAAG,0BACjBD,KAAF,IAA8C;AAC7C,QAAKA,KAAK,CAACE,GAAN,KAAc,OAAnB,EAA6B;AAC5BJ,MAAAA,WAAW,CAAER,SAAF,CAAX,CAA0BU,KAA1B;AACA;AACD,GALkB,EAMnB,CAAEF,WAAF,EAAeR,SAAf,CANmB,CAApB;AASA,QAAMa,WAAW,GAAG,cAAI,QAAJ,CAApB;AACA,QAAMC,YAAY,GAAG,cAAI,IAAJ,CAArB;AAEA,SACC,qDACGhB,MAAM,IACP,4BAAC,cAAD;AACC,IAAA,cAAc,EAAGU,WAAW,CAAEP,QAAF,CAD7B;AAEC,IAAA,SAAS,EAAGU,WAFb;AAGC,IAAA,gBAAgB,EAAGE,WAHpB;AAIC,IAAA,aAAa,EAAG,IAJjB;AAKC,IAAA,GAAG,EAAGhB,YALP;AAMC,IAAA,wBAAwB;AANzB,KAOMM,UAPN,GASC,4BAAC,cAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,4BAAC,UAAD,QAAQD,QAAR,CADD,EAEC,4BAAC,UAAD;AAAM,IAAA,SAAS,EAAC,KAAhB;AAAsB,IAAA,OAAO,EAAC;AAA9B,KACC,4BAAC,eAAD;AACC,IAAA,OAAO,EAAC,UADT;AAEC,IAAA,OAAO,EAAGM,WAAW,CAAEP,QAAF;AAFtB,KAIGY,WAJH,CADD,EAOC,4BAAC,eAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,OAAO,EAAGL,WAAW,CAAER,SAAF;AAFtB,KAIGc,YAJH,CAPD,CAFD,CATD,CAFF,CADD;AAiCA;;eAEc,6BAAgBnB,aAAhB,EAA+B,eAA/B,C","sourcesContent":["/**\n * External dependencies\n */\n// eslint-disable-next-line no-restricted-imports\nimport React, { useEffect, useState } from 'react';\n// eslint-disable-next-line no-restricted-imports\nimport type { Ref, KeyboardEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Modal from '../modal';\nimport type { OwnProps, DialogInputEvent } from './types';\nimport {\n\tuseContextSystem,\n\tcontextConnect,\n\tWordPressComponentProps,\n} from '../ui/context';\nimport { Flex } from '../flex';\nimport Button from '../button';\nimport { Text } from '../text';\nimport { VStack } from '../v-stack';\n\nfunction ConfirmDialog(\n\tprops: WordPressComponentProps< OwnProps, 'div', false >,\n\tforwardedRef: Ref< any >\n) {\n\tconst {\n\t\tisOpen: isOpenProp,\n\t\tonConfirm,\n\t\tonCancel,\n\t\tchildren,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ConfirmDialog' );\n\n\tconst [ isOpen, setIsOpen ] = useState< boolean >();\n\tconst [ shouldSelfClose, setShouldSelfClose ] = useState< boolean >();\n\n\tuseEffect( () => {\n\t\t// We only allow the dialog to close itself if `isOpenProp` is *not* set.\n\t\t// If `isOpenProp` is set, then it (probably) means it's controlled by a\n\t\t// parent component. In that case, `shouldSelfClose` might do more harm than\n\t\t// good, so we disable it.\n\t\tconst isIsOpenSet = typeof isOpenProp !== 'undefined';\n\t\tsetIsOpen( isIsOpenSet ? isOpenProp : true );\n\t\tsetShouldSelfClose( ! isIsOpenSet );\n\t}, [ isOpenProp ] );\n\n\tconst handleEvent = useCallback(\n\t\t( callback?: ( event: DialogInputEvent ) => void ) => (\n\t\t\tevent: DialogInputEvent\n\t\t) => {\n\t\t\tcallback?.( event );\n\t\t\tif ( shouldSelfClose ) {\n\t\t\t\tsetIsOpen( false );\n\t\t\t}\n\t\t},\n\t\t[ shouldSelfClose, setIsOpen ]\n\t);\n\n\tconst handleEnter = useCallback(\n\t\t( event: KeyboardEvent< HTMLDivElement > ) => {\n\t\t\tif ( event.key === 'Enter' ) {\n\t\t\t\thandleEvent( onConfirm )( event );\n\t\t\t}\n\t\t},\n\t\t[ handleEvent, onConfirm ]\n\t);\n\n\tconst cancelLabel = __( 'Cancel' );\n\tconst confirmLabel = __( 'OK' );\n\n\treturn (\n\t\t<>\n\t\t\t{ isOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\tonRequestClose={ handleEvent( onCancel ) }\n\t\t\t\t\tonKeyDown={ handleEnter }\n\t\t\t\t\tcloseButtonLabel={ cancelLabel }\n\t\t\t\t\tisDismissible={ true }\n\t\t\t\t\tref={ forwardedRef }\n\t\t\t\t\t__experimentalHideHeader\n\t\t\t\t\t{ ...otherProps }\n\t\t\t\t>\n\t\t\t\t\t<VStack spacing={ 8 }>\n\t\t\t\t\t\t<Text>{ children }</Text>\n\t\t\t\t\t\t<Flex direction=\"row\" justify=\"flex-end\">\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\tonClick={ handleEvent( onCancel ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ cancelLabel }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\tonClick={ handleEvent( onConfirm ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ confirmLabel }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</Flex>\n\t\t\t\t\t</VStack>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default contextConnect( ConfirmDialog, 'ConfirmDialog' );\n"]}
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- Object.defineProperty(exports, "ConfirmDialog", {
9
- enumerable: true,
10
- get: function () {
11
- return _component.default;
12
- }
13
- });
14
-
15
- var _component = _interopRequireDefault(require("./component"));
16
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/components/src/confirm-dialog/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAGA","sourcesContent":["/**\n * Internal dependencies\n */\nimport ConfirmDialog from './component';\n\nexport { ConfirmDialog };\n"]}
@@ -1,6 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
@@ -1,32 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.getMomentDate = void 0;
9
-
10
- var _moment = _interopRequireDefault(require("moment"));
11
-
12
- /**
13
- * External dependencies
14
- */
15
-
16
- /**
17
- * Create a Moment object from a date string. With no date supplied, default to a Moment
18
- * object representing now. If a null value is passed, return a null value.
19
- *
20
- * @param {?string} date Date representing the currently selected date or null to signify no selection.
21
- * @return {?moment.Moment} Moment object for selected date or null.
22
- */
23
- const getMomentDate = date => {
24
- if (null === date) {
25
- return null;
26
- }
27
-
28
- return date ? (0, _moment.default)(date) : (0, _moment.default)();
29
- };
30
-
31
- exports.getMomentDate = getMomentDate;
32
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/components/src/date-time/utils.js"],"names":["getMomentDate","date"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,aAAa,GAAKC,IAAF,IAAY;AACxC,MAAK,SAASA,IAAd,EAAqB;AACpB,WAAO,IAAP;AACA;;AACD,SAAOA,IAAI,GAAG,qBAAQA,IAAR,CAAH,GAAoB,sBAA/B;AACA,CALM","sourcesContent":["/**\n * External dependencies\n */\nimport moment from 'moment';\n\n/**\n * Create a Moment object from a date string. With no date supplied, default to a Moment\n * object representing now. If a null value is passed, return a null value.\n *\n * @param {?string} date Date representing the currently selected date or null to signify no selection.\n * @return {?moment.Moment} Moment object for selected date or null.\n */\nexport const getMomentDate = ( date ) => {\n\tif ( null === date ) {\n\t\treturn null;\n\t}\n\treturn date ? moment( date ) : moment();\n};\n"]}
@@ -1,84 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { createElement, Fragment } from "@wordpress/element";
3
-
4
- /**
5
- * External dependencies
6
- */
7
- // eslint-disable-next-line no-restricted-imports
8
- import React, { useEffect, useState } from 'react'; // eslint-disable-next-line no-restricted-imports
9
-
10
- /**
11
- * WordPress dependencies
12
- */
13
- import { __ } from '@wordpress/i18n';
14
- import { useCallback } from '@wordpress/element';
15
- /**
16
- * Internal dependencies
17
- */
18
-
19
- import Modal from '../modal';
20
- import { useContextSystem, contextConnect } from '../ui/context';
21
- import { Flex } from '../flex';
22
- import Button from '../button';
23
- import { Text } from '../text';
24
- import { VStack } from '../v-stack';
25
-
26
- function ConfirmDialog(props, forwardedRef) {
27
- const {
28
- isOpen: isOpenProp,
29
- onConfirm,
30
- onCancel,
31
- children,
32
- ...otherProps
33
- } = useContextSystem(props, 'ConfirmDialog');
34
- const [isOpen, setIsOpen] = useState();
35
- const [shouldSelfClose, setShouldSelfClose] = useState();
36
- useEffect(() => {
37
- // We only allow the dialog to close itself if `isOpenProp` is *not* set.
38
- // If `isOpenProp` is set, then it (probably) means it's controlled by a
39
- // parent component. In that case, `shouldSelfClose` might do more harm than
40
- // good, so we disable it.
41
- const isIsOpenSet = typeof isOpenProp !== 'undefined';
42
- setIsOpen(isIsOpenSet ? isOpenProp : true);
43
- setShouldSelfClose(!isIsOpenSet);
44
- }, [isOpenProp]);
45
- const handleEvent = useCallback(callback => event => {
46
- callback === null || callback === void 0 ? void 0 : callback(event);
47
-
48
- if (shouldSelfClose) {
49
- setIsOpen(false);
50
- }
51
- }, [shouldSelfClose, setIsOpen]);
52
- const handleEnter = useCallback(event => {
53
- if (event.key === 'Enter') {
54
- handleEvent(onConfirm)(event);
55
- }
56
- }, [handleEvent, onConfirm]);
57
-
58
- const cancelLabel = __('Cancel');
59
-
60
- const confirmLabel = __('OK');
61
-
62
- return createElement(Fragment, null, isOpen && createElement(Modal, _extends({
63
- onRequestClose: handleEvent(onCancel),
64
- onKeyDown: handleEnter,
65
- closeButtonLabel: cancelLabel,
66
- isDismissible: true,
67
- ref: forwardedRef,
68
- __experimentalHideHeader: true
69
- }, otherProps), createElement(VStack, {
70
- spacing: 8
71
- }, createElement(Text, null, children), createElement(Flex, {
72
- direction: "row",
73
- justify: "flex-end"
74
- }, createElement(Button, {
75
- variant: "tertiary",
76
- onClick: handleEvent(onCancel)
77
- }, cancelLabel), createElement(Button, {
78
- variant: "primary",
79
- onClick: handleEvent(onConfirm)
80
- }, confirmLabel)))));
81
- }
82
-
83
- export default contextConnect(ConfirmDialog, 'ConfirmDialog');
84
- //# sourceMappingURL=component.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/components/src/confirm-dialog/component.tsx"],"names":["React","useEffect","useState","__","useCallback","Modal","useContextSystem","contextConnect","Flex","Button","Text","VStack","ConfirmDialog","props","forwardedRef","isOpen","isOpenProp","onConfirm","onCancel","children","otherProps","setIsOpen","shouldSelfClose","setShouldSelfClose","isIsOpenSet","handleEvent","callback","event","handleEnter","key","cancelLabel","confirmLabel"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,QAA3B,QAA2C,OAA3C,C,CACA;;AAGA;AACA;AACA;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,QAA4B,oBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,KAAP,MAAkB,UAAlB;AAEA,SACCC,gBADD,EAECC,cAFD,QAIO,eAJP;AAKA,SAASC,IAAT,QAAqB,SAArB;AACA,OAAOC,MAAP,MAAmB,WAAnB;AACA,SAASC,IAAT,QAAqB,SAArB;AACA,SAASC,MAAT,QAAuB,YAAvB;;AAEA,SAASC,aAAT,CACCC,KADD,EAECC,YAFD,EAGE;AACD,QAAM;AACLC,IAAAA,MAAM,EAAEC,UADH;AAELC,IAAAA,SAFK;AAGLC,IAAAA,QAHK;AAILC,IAAAA,QAJK;AAKL,OAAGC;AALE,MAMFd,gBAAgB,CAAEO,KAAF,EAAS,eAAT,CANpB;AAQA,QAAM,CAAEE,MAAF,EAAUM,SAAV,IAAwBnB,QAAQ,EAAtC;AACA,QAAM,CAAEoB,eAAF,EAAmBC,kBAAnB,IAA0CrB,QAAQ,EAAxD;AAEAD,EAAAA,SAAS,CAAE,MAAM;AAChB;AACA;AACA;AACA;AACA,UAAMuB,WAAW,GAAG,OAAOR,UAAP,KAAsB,WAA1C;AACAK,IAAAA,SAAS,CAAEG,WAAW,GAAGR,UAAH,GAAgB,IAA7B,CAAT;AACAO,IAAAA,kBAAkB,CAAE,CAAEC,WAAJ,CAAlB;AACA,GARQ,EAQN,CAAER,UAAF,CARM,CAAT;AAUA,QAAMS,WAAW,GAAGrB,WAAW,CAC5BsB,QAAF,IACCC,KADqD,IAEjD;AACJD,IAAAA,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAIC,KAAJ,CAAR;;AACA,QAAKL,eAAL,EAAuB;AACtBD,MAAAA,SAAS,CAAE,KAAF,CAAT;AACA;AACD,GAR6B,EAS9B,CAAEC,eAAF,EAAmBD,SAAnB,CAT8B,CAA/B;AAYA,QAAMO,WAAW,GAAGxB,WAAW,CAC5BuB,KAAF,IAA8C;AAC7C,QAAKA,KAAK,CAACE,GAAN,KAAc,OAAnB,EAA6B;AAC5BJ,MAAAA,WAAW,CAAER,SAAF,CAAX,CAA0BU,KAA1B;AACA;AACD,GAL6B,EAM9B,CAAEF,WAAF,EAAeR,SAAf,CAN8B,CAA/B;;AASA,QAAMa,WAAW,GAAG3B,EAAE,CAAE,QAAF,CAAtB;;AACA,QAAM4B,YAAY,GAAG5B,EAAE,CAAE,IAAF,CAAvB;;AAEA,SACC,8BACGY,MAAM,IACP,cAAC,KAAD;AACC,IAAA,cAAc,EAAGU,WAAW,CAAEP,QAAF,CAD7B;AAEC,IAAA,SAAS,EAAGU,WAFb;AAGC,IAAA,gBAAgB,EAAGE,WAHpB;AAIC,IAAA,aAAa,EAAG,IAJjB;AAKC,IAAA,GAAG,EAAGhB,YALP;AAMC,IAAA,wBAAwB;AANzB,KAOMM,UAPN,GASC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,cAAC,IAAD,QAAQD,QAAR,CADD,EAEC,cAAC,IAAD;AAAM,IAAA,SAAS,EAAC,KAAhB;AAAsB,IAAA,OAAO,EAAC;AAA9B,KACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,UADT;AAEC,IAAA,OAAO,EAAGM,WAAW,CAAEP,QAAF;AAFtB,KAIGY,WAJH,CADD,EAOC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,OAAO,EAAGL,WAAW,CAAER,SAAF;AAFtB,KAIGc,YAJH,CAPD,CAFD,CATD,CAFF,CADD;AAiCA;;AAED,eAAexB,cAAc,CAAEK,aAAF,EAAiB,eAAjB,CAA7B","sourcesContent":["/**\n * External dependencies\n */\n// eslint-disable-next-line no-restricted-imports\nimport React, { useEffect, useState } from 'react';\n// eslint-disable-next-line no-restricted-imports\nimport type { Ref, KeyboardEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Modal from '../modal';\nimport type { OwnProps, DialogInputEvent } from './types';\nimport {\n\tuseContextSystem,\n\tcontextConnect,\n\tWordPressComponentProps,\n} from '../ui/context';\nimport { Flex } from '../flex';\nimport Button from '../button';\nimport { Text } from '../text';\nimport { VStack } from '../v-stack';\n\nfunction ConfirmDialog(\n\tprops: WordPressComponentProps< OwnProps, 'div', false >,\n\tforwardedRef: Ref< any >\n) {\n\tconst {\n\t\tisOpen: isOpenProp,\n\t\tonConfirm,\n\t\tonCancel,\n\t\tchildren,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ConfirmDialog' );\n\n\tconst [ isOpen, setIsOpen ] = useState< boolean >();\n\tconst [ shouldSelfClose, setShouldSelfClose ] = useState< boolean >();\n\n\tuseEffect( () => {\n\t\t// We only allow the dialog to close itself if `isOpenProp` is *not* set.\n\t\t// If `isOpenProp` is set, then it (probably) means it's controlled by a\n\t\t// parent component. In that case, `shouldSelfClose` might do more harm than\n\t\t// good, so we disable it.\n\t\tconst isIsOpenSet = typeof isOpenProp !== 'undefined';\n\t\tsetIsOpen( isIsOpenSet ? isOpenProp : true );\n\t\tsetShouldSelfClose( ! isIsOpenSet );\n\t}, [ isOpenProp ] );\n\n\tconst handleEvent = useCallback(\n\t\t( callback?: ( event: DialogInputEvent ) => void ) => (\n\t\t\tevent: DialogInputEvent\n\t\t) => {\n\t\t\tcallback?.( event );\n\t\t\tif ( shouldSelfClose ) {\n\t\t\t\tsetIsOpen( false );\n\t\t\t}\n\t\t},\n\t\t[ shouldSelfClose, setIsOpen ]\n\t);\n\n\tconst handleEnter = useCallback(\n\t\t( event: KeyboardEvent< HTMLDivElement > ) => {\n\t\t\tif ( event.key === 'Enter' ) {\n\t\t\t\thandleEvent( onConfirm )( event );\n\t\t\t}\n\t\t},\n\t\t[ handleEvent, onConfirm ]\n\t);\n\n\tconst cancelLabel = __( 'Cancel' );\n\tconst confirmLabel = __( 'OK' );\n\n\treturn (\n\t\t<>\n\t\t\t{ isOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\tonRequestClose={ handleEvent( onCancel ) }\n\t\t\t\t\tonKeyDown={ handleEnter }\n\t\t\t\t\tcloseButtonLabel={ cancelLabel }\n\t\t\t\t\tisDismissible={ true }\n\t\t\t\t\tref={ forwardedRef }\n\t\t\t\t\t__experimentalHideHeader\n\t\t\t\t\t{ ...otherProps }\n\t\t\t\t>\n\t\t\t\t\t<VStack spacing={ 8 }>\n\t\t\t\t\t\t<Text>{ children }</Text>\n\t\t\t\t\t\t<Flex direction=\"row\" justify=\"flex-end\">\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\tonClick={ handleEvent( onCancel ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ cancelLabel }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\tonClick={ handleEvent( onConfirm ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ confirmLabel }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</Flex>\n\t\t\t\t\t</VStack>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default contextConnect( ConfirmDialog, 'ConfirmDialog' );\n"]}
@@ -1,6 +0,0 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import ConfirmDialog from './component';
5
- export { ConfirmDialog };
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/components/src/confirm-dialog/index.tsx"],"names":["ConfirmDialog"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,aAAP,MAA0B,aAA1B;AAEA,SAASA,aAAT","sourcesContent":["/**\n * Internal dependencies\n */\nimport ConfirmDialog from './component';\n\nexport { ConfirmDialog };\n"]}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
@@ -1,20 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import moment from 'moment';
5
- /**
6
- * Create a Moment object from a date string. With no date supplied, default to a Moment
7
- * object representing now. If a null value is passed, return a null value.
8
- *
9
- * @param {?string} date Date representing the currently selected date or null to signify no selection.
10
- * @return {?moment.Moment} Moment object for selected date or null.
11
- */
12
-
13
- export const getMomentDate = date => {
14
- if (null === date) {
15
- return null;
16
- }
17
-
18
- return date ? moment(date) : moment();
19
- };
20
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/components/src/date-time/utils.js"],"names":["moment","getMomentDate","date"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,MAAP,MAAmB,QAAnB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,aAAa,GAAKC,IAAF,IAAY;AACxC,MAAK,SAASA,IAAd,EAAqB;AACpB,WAAO,IAAP;AACA;;AACD,SAAOA,IAAI,GAAGF,MAAM,CAAEE,IAAF,CAAT,GAAoBF,MAAM,EAArC;AACA,CALM","sourcesContent":["/**\n * External dependencies\n */\nimport moment from 'moment';\n\n/**\n * Create a Moment object from a date string. With no date supplied, default to a Moment\n * object representing now. If a null value is passed, return a null value.\n *\n * @param {?string} date Date representing the currently selected date or null to signify no selection.\n * @return {?moment.Moment} Moment object for selected date or null.\n */\nexport const getMomentDate = ( date ) => {\n\tif ( null === date ) {\n\t\treturn null;\n\t}\n\treturn date ? moment( date ) : moment();\n};\n"]}
@@ -1,128 +0,0 @@
1
- # `ConfirmDialog`
2
-
3
- <div class="callout callout-alert">
4
- This feature is still experimental. "Experimental" means this is an early implementation subject to drastic and breaking changes.
5
- </div>
6
-
7
- `ConfirmDialog` is built of top of [`Modal`](/packages/components/src/modal/README.md] and displays a confirmation dialog, with _confirm_ and _cancel_ buttons.
8
-
9
- The dialog is confirmed by clicking the _confirm_ button or by pressing the `Enter` key. It is cancelled (closed) by clicking the _cancel_ button, by pressing the `ESC` key, or by clicking outside the dialog focus (i.e, the overlay).
10
-
11
- ## Usage
12
-
13
- `ConfirmDialog` has two main implicit modes: controlled and uncontrolled.
14
-
15
- ### Uncontrolled mode
16
-
17
- Allows the component to be used standalone, just by declaring it as part of another React's component render method:
18
- * It will be automatically open (displayed) upon mounting;
19
- * It will be automatically closed when when clicking the _cancel_ button, by pressing the `ESC` key, or by clicking outside the dialog focus (i.e, the overlay);
20
- * `onCancel` is not mandatory but can be passed. Even if passed, the dialog will still be able to close itself.
21
-
22
- Activating this mode is as simple as omitting the `isOpen` prop. The only mandatory prop, in this case, is the `onConfirm` callback. The message is passed as the `children`. You can pass any JSX you'd like, which allows to further format the message or include sub-component if you'd like:
23
-
24
- ```jsx
25
- import {
26
- __experimentalConfirmDialog as ConfirmDialog
27
- } from '@wordpress/components';
28
-
29
- function Example() {
30
- return (
31
- <ConfirmDialog onConfirm={ () => console.debug(' Confirmed! ') }>
32
- Are you sure? <strong>This action cannot be undone!</strong>
33
- </ConfirmDialog>
34
- );
35
- }
36
- ```
37
-
38
- ### Controlled mode
39
-
40
- Let the parent component control when the dialog is open/closed. It's activated when a boolean value is passed to `isOpen`:
41
- * It will not be automatically closed. You need to let it know when to open/close by updating the value of the `isOpen` prop;
42
- * Both `onConfirm` and the `onCancel` callbacks are mandatory props in this mode;
43
- * You'll want to update the state that controls `isOpen` by updating it from the `onCancel` and `onConfirm` callbacks.
44
-
45
-
46
- ```jsx
47
- import {
48
- __experimentalConfirmDialog as ConfirmDialog
49
- } from '@wordpress/components';
50
-
51
- function Example() {
52
- const [ isOpen, setIsOpen ] = useState( true );
53
-
54
- const handleConfirm = () => {
55
- console.debug( 'Confirmed!' );
56
- setIsOpen( false );
57
- }
58
-
59
- const handleCancel = () => {
60
- console.debug( 'Cancelled!' );
61
- setIsOpen( false );
62
- }
63
-
64
- return (
65
- <ConfirmDialog
66
- isOpen={ isOpen }
67
- onConfirm={ handleConfirm }
68
- onCancel={ handleCancel }
69
- >
70
- Are you sure? <strong>This action cannot be undone!</strong>
71
- </ConfirmDialog>
72
- );
73
- }
74
- ```
75
-
76
- ### Unsupported: Multiple instances
77
-
78
- Multiple `ConfirmDialog's is an edge case that's currently not officially supported by this component. At the moment, new instances will end up closing the last instance due to the way the `Modal` is implemented.
79
-
80
- ## Custom Types
81
-
82
- ```ts
83
- type DialogInputEvent =
84
- | KeyboardEvent< HTMLDivElement >
85
- | MouseEvent< HTMLButtonElement >
86
- ```
87
-
88
- ## Props
89
-
90
- ### `title`: `string`
91
-
92
- - Required: No
93
-
94
- An optional `title` for the dialog. Setting a title will render it in a title bar at the top of the dialog, making it a bit taller. The bar will also include an `x` close button at the top-right corner.
95
-
96
- ### `children`: `React.ReactNode`
97
-
98
- - Required: Yes
99
-
100
- The actual message for the dialog. It's passed as children and any valid `ReactNode` is accepted:
101
-
102
- ```jsx
103
- <ConfirmDialog>
104
- Are you sure? <strong>This action cannot be undone!</strong>
105
- </ConfirmDialog>
106
- ```
107
-
108
- ### `isOpen`: `boolean`
109
-
110
- - Required: No
111
-
112
- Defines if the dialog is open (displayed) or closed (not rendered/displayed). It also implicitly toggles the controlled mode if set or the uncontrolled mode if it's not set.
113
-
114
- ### `onConfirm`: `( event: DialogInputEvent ) => void`
115
-
116
- - Required: Yes
117
-
118
- The callback that's called when the user confirms. A confirmation can happen when the `OK` button is clicked or when `Enter` is pressed.
119
-
120
- ### `onCancel`: `( event: DialogInputEvent ) => void`
121
-
122
- - Required: Only if `isOpen` is not set
123
-
124
- The callback that's called when the user cancels. A cancellation can happen when the `Cancel` button is clicked, when the `ESC` key is pressed, or when a click outside of the dialog focus is detected (i.e. in the overlay).
125
-
126
- It's not required if `isOpen` is not set (uncontrolled mode), as the component will take care of closing itself, but you can still pass a callback if something must be done upon cancelling (the component will still close itself in this case).
127
-
128
- If `isOpen` is set (controlled mode), then it's required, and you need to set the state that defines `isOpen` to `false` as part of this callback if you want the dialog to close when the user cancels.
@@ -1,114 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- // eslint-disable-next-line no-restricted-imports
5
- import React, { useEffect, useState } from 'react';
6
- // eslint-disable-next-line no-restricted-imports
7
- import type { Ref, KeyboardEvent } from 'react';
8
-
9
- /**
10
- * WordPress dependencies
11
- */
12
- import { __ } from '@wordpress/i18n';
13
- import { useCallback } from '@wordpress/element';
14
-
15
- /**
16
- * Internal dependencies
17
- */
18
- import Modal from '../modal';
19
- import type { OwnProps, DialogInputEvent } from './types';
20
- import {
21
- useContextSystem,
22
- contextConnect,
23
- WordPressComponentProps,
24
- } from '../ui/context';
25
- import { Flex } from '../flex';
26
- import Button from '../button';
27
- import { Text } from '../text';
28
- import { VStack } from '../v-stack';
29
-
30
- function ConfirmDialog(
31
- props: WordPressComponentProps< OwnProps, 'div', false >,
32
- forwardedRef: Ref< any >
33
- ) {
34
- const {
35
- isOpen: isOpenProp,
36
- onConfirm,
37
- onCancel,
38
- children,
39
- ...otherProps
40
- } = useContextSystem( props, 'ConfirmDialog' );
41
-
42
- const [ isOpen, setIsOpen ] = useState< boolean >();
43
- const [ shouldSelfClose, setShouldSelfClose ] = useState< boolean >();
44
-
45
- useEffect( () => {
46
- // We only allow the dialog to close itself if `isOpenProp` is *not* set.
47
- // If `isOpenProp` is set, then it (probably) means it's controlled by a
48
- // parent component. In that case, `shouldSelfClose` might do more harm than
49
- // good, so we disable it.
50
- const isIsOpenSet = typeof isOpenProp !== 'undefined';
51
- setIsOpen( isIsOpenSet ? isOpenProp : true );
52
- setShouldSelfClose( ! isIsOpenSet );
53
- }, [ isOpenProp ] );
54
-
55
- const handleEvent = useCallback(
56
- ( callback?: ( event: DialogInputEvent ) => void ) => (
57
- event: DialogInputEvent
58
- ) => {
59
- callback?.( event );
60
- if ( shouldSelfClose ) {
61
- setIsOpen( false );
62
- }
63
- },
64
- [ shouldSelfClose, setIsOpen ]
65
- );
66
-
67
- const handleEnter = useCallback(
68
- ( event: KeyboardEvent< HTMLDivElement > ) => {
69
- if ( event.key === 'Enter' ) {
70
- handleEvent( onConfirm )( event );
71
- }
72
- },
73
- [ handleEvent, onConfirm ]
74
- );
75
-
76
- const cancelLabel = __( 'Cancel' );
77
- const confirmLabel = __( 'OK' );
78
-
79
- return (
80
- <>
81
- { isOpen && (
82
- <Modal
83
- onRequestClose={ handleEvent( onCancel ) }
84
- onKeyDown={ handleEnter }
85
- closeButtonLabel={ cancelLabel }
86
- isDismissible={ true }
87
- ref={ forwardedRef }
88
- __experimentalHideHeader
89
- { ...otherProps }
90
- >
91
- <VStack spacing={ 8 }>
92
- <Text>{ children }</Text>
93
- <Flex direction="row" justify="flex-end">
94
- <Button
95
- variant="tertiary"
96
- onClick={ handleEvent( onCancel ) }
97
- >
98
- { cancelLabel }
99
- </Button>
100
- <Button
101
- variant="primary"
102
- onClick={ handleEvent( onConfirm ) }
103
- >
104
- { confirmLabel }
105
- </Button>
106
- </Flex>
107
- </VStack>
108
- </Modal>
109
- ) }
110
- </>
111
- );
112
- }
113
-
114
- export default contextConnect( ConfirmDialog, 'ConfirmDialog' );
@@ -1,6 +0,0 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import ConfirmDialog from './component';
5
-
6
- export { ConfirmDialog };