@wordpress/components 20.0.2-next.957ca95e4c.0 → 21.0.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 (851) hide show
  1. package/CHANGELOG.md +56 -1
  2. package/CONTRIBUTING.md +3 -54
  3. package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js +9 -9
  4. package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
  5. package/build/angle-picker-control/index.js +10 -0
  6. package/build/angle-picker-control/index.js.map +1 -1
  7. package/build/border-box-control/border-box-control/component.js +5 -1
  8. package/build/border-box-control/border-box-control/component.js.map +1 -1
  9. package/build/border-box-control/border-box-control-split-controls/component.js +5 -1
  10. package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  11. package/build/border-control/border-control-dropdown/component.js +2 -1
  12. package/build/border-control/border-control-dropdown/component.js.map +1 -1
  13. package/build/card/styles.js +17 -17
  14. package/build/card/styles.js.map +1 -1
  15. package/build/checkbox-control/index.js +3 -3
  16. package/build/checkbox-control/index.js.map +1 -1
  17. package/build/color-palette/index.js +1 -1
  18. package/build/color-palette/index.js.map +1 -1
  19. package/build/color-picker/input-with-slider.js +2 -1
  20. package/build/color-picker/input-with-slider.js.map +1 -1
  21. package/build/combobox-control/index.js +1 -1
  22. package/build/combobox-control/index.js.map +1 -1
  23. package/build/custom-gradient-picker/index.js +1 -1
  24. package/build/custom-gradient-picker/index.js.map +1 -1
  25. package/build/date-time/date/index.js +1 -1
  26. package/build/date-time/date/index.js.map +1 -1
  27. package/build/date-time/time/timezone.js +1 -1
  28. package/build/date-time/time/timezone.js.map +1 -1
  29. package/build/disabled/index.js +14 -6
  30. package/build/disabled/index.js.map +1 -1
  31. package/build/disabled/styles/disabled-styles.js +8 -18
  32. package/build/disabled/styles/disabled-styles.js.map +1 -1
  33. package/build/drop-zone/index.js +44 -9
  34. package/build/drop-zone/index.js.map +1 -1
  35. package/build/drop-zone/provider.js.map +1 -1
  36. package/build/drop-zone/types.js +6 -0
  37. package/build/drop-zone/types.js.map +1 -0
  38. package/build/flex/flex/hook.js +6 -30
  39. package/build/flex/flex/hook.js.map +1 -1
  40. package/build/focal-point-picker/controls.js +10 -5
  41. package/build/focal-point-picker/controls.js.map +1 -1
  42. package/build/focal-point-picker/focal-point.js.map +1 -1
  43. package/build/focal-point-picker/grid.js.map +1 -1
  44. package/build/focal-point-picker/index.js +83 -16
  45. package/build/focal-point-picker/index.js.map +1 -1
  46. package/build/focal-point-picker/media.js +4 -0
  47. package/build/focal-point-picker/media.js.map +1 -1
  48. package/build/focal-point-picker/styles/focal-point-picker-style.js +70 -41
  49. package/build/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
  50. package/build/focal-point-picker/styles/focal-point-style.js +12 -12
  51. package/build/focal-point-picker/styles/focal-point-style.js.map +1 -1
  52. package/build/focal-point-picker/types.js +6 -0
  53. package/build/focal-point-picker/types.js.map +1 -0
  54. package/build/focal-point-picker/utils.js +6 -6
  55. package/build/focal-point-picker/utils.js.map +1 -1
  56. package/build/font-size-picker/index.js +11 -0
  57. package/build/font-size-picker/index.js.map +1 -1
  58. package/build/font-size-picker/utils.js +1 -1
  59. package/build/font-size-picker/utils.js.map +1 -1
  60. package/build/form-file-upload/index.js +22 -2
  61. package/build/form-file-upload/index.js.map +1 -1
  62. package/build/form-file-upload/types.js +6 -0
  63. package/build/form-file-upload/types.js.map +1 -0
  64. package/build/form-toggle/index.js +1 -3
  65. package/build/form-toggle/index.js.map +1 -1
  66. package/build/form-token-field/index.js +4 -6
  67. package/build/form-token-field/index.js.map +1 -1
  68. package/build/form-token-field/suggestions-list.js +1 -3
  69. package/build/form-token-field/suggestions-list.js.map +1 -1
  70. package/build/gradient-picker/index.js +25 -26
  71. package/build/gradient-picker/index.js.map +1 -1
  72. package/build/icon/index.js +1 -2
  73. package/build/icon/index.js.map +1 -1
  74. package/build/input-control/input-base.js +3 -2
  75. package/build/input-control/input-base.js.map +1 -1
  76. package/build/input-control/label.js +2 -2
  77. package/build/input-control/label.js.map +1 -1
  78. package/build/input-control/styles/input-control-styles.js +41 -128
  79. package/build/input-control/styles/input-control-styles.js.map +1 -1
  80. package/build/modal/aria-helper.js +3 -10
  81. package/build/modal/aria-helper.js.map +1 -1
  82. package/build/navigable-container/container.js +5 -1
  83. package/build/navigable-container/container.js.map +1 -1
  84. package/build/navigable-container/menu.js +10 -12
  85. package/build/navigable-container/menu.js.map +1 -1
  86. package/build/navigable-container/tabbable.js +2 -4
  87. package/build/navigable-container/tabbable.js.map +1 -1
  88. package/build/navigator/navigator-button/hook.js +1 -1
  89. package/build/navigator/navigator-button/hook.js.map +1 -1
  90. package/build/navigator/navigator-screen/component.js +2 -2
  91. package/build/navigator/navigator-screen/component.js.map +1 -1
  92. package/build/number-control/index.js +29 -25
  93. package/build/number-control/index.js.map +1 -1
  94. package/build/number-control/types.js +6 -0
  95. package/build/number-control/types.js.map +1 -0
  96. package/build/placeholder/index.js +1 -3
  97. package/build/placeholder/index.js.map +1 -1
  98. package/build/popover/index.js +155 -154
  99. package/build/popover/index.js.map +1 -1
  100. package/build/popover/types.js +6 -0
  101. package/build/popover/types.js.map +1 -0
  102. package/build/popover/utils.js +119 -24
  103. package/build/popover/utils.js.map +1 -1
  104. package/build/radio-control/index.js +7 -4
  105. package/build/radio-control/index.js.map +1 -1
  106. package/build/range-control/index.js +4 -1
  107. package/build/range-control/index.js.map +1 -1
  108. package/build/range-control/styles/range-control-styles.js +33 -33
  109. package/build/range-control/styles/range-control-styles.js.map +1 -1
  110. package/build/sandbox/index.js +2 -2
  111. package/build/sandbox/index.js.map +1 -1
  112. package/build/search-control/index.js +38 -10
  113. package/build/search-control/index.js.map +1 -1
  114. package/build/search-control/types.js +6 -0
  115. package/build/search-control/types.js.map +1 -0
  116. package/build/select-control/index.native.js +2 -1
  117. package/build/select-control/index.native.js.map +1 -1
  118. package/build/tab-panel/index.js +48 -9
  119. package/build/tab-panel/index.js.map +1 -1
  120. package/build/tab-panel/types.js +6 -0
  121. package/build/tab-panel/types.js.map +1 -0
  122. package/build/text-control/index.js +2 -0
  123. package/build/text-control/index.js.map +1 -1
  124. package/build/textarea-control/index.js +3 -3
  125. package/build/textarea-control/index.js.map +1 -1
  126. package/build/toggle-control/index.js +44 -4
  127. package/build/toggle-control/index.js.map +1 -1
  128. package/build/toggle-control/types.js +6 -0
  129. package/build/toggle-control/types.js.map +1 -0
  130. package/build/toggle-group-control/toggle-group-control/component.js +2 -2
  131. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  132. package/build/toggle-group-control/toggle-group-control-option-icon/component.js +1 -1
  133. package/build/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
  134. package/build/tooltip/index.js +1 -1
  135. package/build/tooltip/index.js.map +1 -1
  136. package/build/ui/context/context-connect.js +31 -22
  137. package/build/ui/context/context-connect.js.map +1 -1
  138. package/build/ui/context/context-system-provider.js +4 -3
  139. package/build/ui/context/context-system-provider.js.map +1 -1
  140. package/build/unit-control/index.js +1 -1
  141. package/build/unit-control/index.js.map +1 -1
  142. package/build/unit-control/styles/unit-control-styles.js +9 -9
  143. package/build/unit-control/styles/unit-control-styles.js.map +1 -1
  144. package/build/utils/colors-values.js +2 -30
  145. package/build/utils/colors-values.js.map +1 -1
  146. package/build/utils/math.js +4 -4
  147. package/build/utils/math.js.map +1 -1
  148. package/build/utils/values.js +62 -6
  149. package/build/utils/values.js.map +1 -1
  150. package/build/view/component.js +6 -7
  151. package/build/view/component.js.map +1 -1
  152. package/build/view/types.js +6 -0
  153. package/build/view/types.js.map +1 -0
  154. package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js +9 -9
  155. package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
  156. package/build-module/angle-picker-control/index.js +9 -0
  157. package/build-module/angle-picker-control/index.js.map +1 -1
  158. package/build-module/border-box-control/border-box-control/component.js +5 -1
  159. package/build-module/border-box-control/border-box-control/component.js.map +1 -1
  160. package/build-module/border-box-control/border-box-control-split-controls/component.js +5 -1
  161. package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  162. package/build-module/border-control/border-control-dropdown/component.js +2 -1
  163. package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
  164. package/build-module/card/styles.js +17 -17
  165. package/build-module/card/styles.js.map +1 -1
  166. package/build-module/checkbox-control/index.js +3 -3
  167. package/build-module/checkbox-control/index.js.map +1 -1
  168. package/build-module/color-palette/index.js +1 -1
  169. package/build-module/color-palette/index.js.map +1 -1
  170. package/build-module/color-picker/input-with-slider.js +2 -1
  171. package/build-module/color-picker/input-with-slider.js.map +1 -1
  172. package/build-module/combobox-control/index.js +1 -1
  173. package/build-module/combobox-control/index.js.map +1 -1
  174. package/build-module/custom-gradient-picker/index.js +1 -1
  175. package/build-module/custom-gradient-picker/index.js.map +1 -1
  176. package/build-module/date-time/date/index.js +2 -3
  177. package/build-module/date-time/date/index.js.map +1 -1
  178. package/build-module/date-time/time/timezone.js +1 -1
  179. package/build-module/date-time/time/timezone.js.map +1 -1
  180. package/build-module/disabled/index.js +16 -8
  181. package/build-module/disabled/index.js.map +1 -1
  182. package/build-module/disabled/styles/disabled-styles.js +6 -12
  183. package/build-module/disabled/styles/disabled-styles.js.map +1 -1
  184. package/build-module/drop-zone/index.js +40 -9
  185. package/build-module/drop-zone/index.js.map +1 -1
  186. package/build-module/drop-zone/provider.js.map +1 -1
  187. package/build-module/drop-zone/types.js +2 -0
  188. package/build-module/drop-zone/types.js.map +1 -0
  189. package/build-module/flex/flex/hook.js +7 -29
  190. package/build-module/flex/flex/hook.js.map +1 -1
  191. package/build-module/focal-point-picker/controls.js +11 -6
  192. package/build-module/focal-point-picker/controls.js.map +1 -1
  193. package/build-module/focal-point-picker/focal-point.js.map +1 -1
  194. package/build-module/focal-point-picker/grid.js.map +1 -1
  195. package/build-module/focal-point-picker/index.js +81 -16
  196. package/build-module/focal-point-picker/index.js.map +1 -1
  197. package/build-module/focal-point-picker/media.js +4 -0
  198. package/build-module/focal-point-picker/media.js.map +1 -1
  199. package/build-module/focal-point-picker/styles/focal-point-picker-style.js +68 -40
  200. package/build-module/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
  201. package/build-module/focal-point-picker/styles/focal-point-style.js +12 -12
  202. package/build-module/focal-point-picker/styles/focal-point-style.js.map +1 -1
  203. package/build-module/focal-point-picker/types.js +2 -0
  204. package/build-module/focal-point-picker/types.js.map +1 -0
  205. package/build-module/focal-point-picker/utils.js +6 -6
  206. package/build-module/focal-point-picker/utils.js.map +1 -1
  207. package/build-module/font-size-picker/index.js +10 -0
  208. package/build-module/font-size-picker/index.js.map +1 -1
  209. package/build-module/font-size-picker/utils.js +1 -1
  210. package/build-module/font-size-picker/utils.js.map +1 -1
  211. package/build-module/form-file-upload/index.js +21 -4
  212. package/build-module/form-file-upload/index.js.map +1 -1
  213. package/build-module/form-file-upload/types.js +2 -0
  214. package/build-module/form-file-upload/types.js.map +1 -0
  215. package/build-module/form-toggle/index.js +1 -3
  216. package/build-module/form-toggle/index.js.map +1 -1
  217. package/build-module/form-token-field/index.js +4 -5
  218. package/build-module/form-token-field/index.js.map +1 -1
  219. package/build-module/form-token-field/suggestions-list.js +1 -2
  220. package/build-module/form-token-field/suggestions-list.js.map +1 -1
  221. package/build-module/gradient-picker/index.js +25 -26
  222. package/build-module/gradient-picker/index.js.map +1 -1
  223. package/build-module/icon/index.js +1 -2
  224. package/build-module/icon/index.js.map +1 -1
  225. package/build-module/input-control/input-base.js +4 -3
  226. package/build-module/input-control/input-base.js.map +1 -1
  227. package/build-module/input-control/label.js +3 -3
  228. package/build-module/input-control/label.js.map +1 -1
  229. package/build-module/input-control/styles/input-control-styles.js +41 -127
  230. package/build-module/input-control/styles/input-control-styles.js.map +1 -1
  231. package/build-module/modal/aria-helper.js +3 -8
  232. package/build-module/modal/aria-helper.js.map +1 -1
  233. package/build-module/navigable-container/container.js +5 -1
  234. package/build-module/navigable-container/container.js.map +1 -1
  235. package/build-module/navigable-container/menu.js +10 -11
  236. package/build-module/navigable-container/menu.js.map +1 -1
  237. package/build-module/navigable-container/tabbable.js +2 -3
  238. package/build-module/navigable-container/tabbable.js.map +1 -1
  239. package/build-module/navigator/navigator-button/hook.js +1 -1
  240. package/build-module/navigator/navigator-button/hook.js.map +1 -1
  241. package/build-module/navigator/navigator-screen/component.js +2 -2
  242. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  243. package/build-module/number-control/index.js +31 -23
  244. package/build-module/number-control/index.js.map +1 -1
  245. package/build-module/number-control/types.js +2 -0
  246. package/build-module/number-control/types.js.map +1 -0
  247. package/build-module/placeholder/index.js +1 -3
  248. package/build-module/placeholder/index.js.map +1 -1
  249. package/build-module/popover/index.js +157 -156
  250. package/build-module/popover/index.js.map +1 -1
  251. package/build-module/popover/types.js +2 -0
  252. package/build-module/popover/types.js.map +1 -0
  253. package/build-module/popover/utils.js +112 -23
  254. package/build-module/popover/utils.js.map +1 -1
  255. package/build-module/radio-control/index.js +7 -5
  256. package/build-module/radio-control/index.js.map +1 -1
  257. package/build-module/range-control/index.js +4 -1
  258. package/build-module/range-control/index.js.map +1 -1
  259. package/build-module/range-control/styles/range-control-styles.js +33 -33
  260. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  261. package/build-module/sandbox/index.js +2 -2
  262. package/build-module/sandbox/index.js.map +1 -1
  263. package/build-module/search-control/index.js +34 -7
  264. package/build-module/search-control/index.js.map +1 -1
  265. package/build-module/search-control/types.js +2 -0
  266. package/build-module/search-control/types.js.map +1 -0
  267. package/build-module/select-control/index.native.js +1 -1
  268. package/build-module/select-control/index.native.js.map +1 -1
  269. package/build-module/tab-panel/index.js +46 -10
  270. package/build-module/tab-panel/index.js.map +1 -1
  271. package/build-module/tab-panel/types.js +2 -0
  272. package/build-module/tab-panel/types.js.map +1 -0
  273. package/build-module/text-control/index.js +2 -0
  274. package/build-module/text-control/index.js.map +1 -1
  275. package/build-module/textarea-control/index.js +3 -3
  276. package/build-module/textarea-control/index.js.map +1 -1
  277. package/build-module/toggle-control/index.js +38 -4
  278. package/build-module/toggle-control/index.js.map +1 -1
  279. package/build-module/toggle-control/types.js +2 -0
  280. package/build-module/toggle-control/types.js.map +1 -0
  281. package/build-module/toggle-group-control/toggle-group-control/component.js +2 -2
  282. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  283. package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js +1 -1
  284. package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
  285. package/build-module/tooltip/index.js +1 -1
  286. package/build-module/tooltip/index.js.map +1 -1
  287. package/build-module/ui/context/context-connect.js +30 -23
  288. package/build-module/ui/context/context-connect.js.map +1 -1
  289. package/build-module/ui/context/context-system-provider.js +5 -4
  290. package/build-module/ui/context/context-system-provider.js.map +1 -1
  291. package/build-module/unit-control/index.js +1 -1
  292. package/build-module/unit-control/index.js.map +1 -1
  293. package/build-module/unit-control/styles/unit-control-styles.js +9 -9
  294. package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
  295. package/build-module/utils/colors-values.js +2 -30
  296. package/build-module/utils/colors-values.js.map +1 -1
  297. package/build-module/utils/math.js +4 -4
  298. package/build-module/utils/math.js.map +1 -1
  299. package/build-module/utils/values.js +48 -6
  300. package/build-module/utils/values.js.map +1 -1
  301. package/build-module/view/component.js +5 -8
  302. package/build-module/view/component.js.map +1 -1
  303. package/build-module/view/types.js +2 -0
  304. package/build-module/view/types.js.map +1 -0
  305. package/build-style/style-rtl.css +2 -28
  306. package/build-style/style.css +2 -28
  307. package/build-types/base-field/hook.d.ts +54 -55
  308. package/build-types/base-field/hook.d.ts.map +1 -1
  309. package/build-types/border-box-control/border-box-control/component.d.ts +10 -2
  310. package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
  311. package/build-types/border-box-control/border-box-control/hook.d.ts +56 -57
  312. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  313. package/build-types/border-box-control/border-box-control-linked-button/component.d.ts +2 -1
  314. package/build-types/border-box-control/border-box-control-linked-button/component.d.ts.map +1 -1
  315. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +55 -56
  316. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts.map +1 -1
  317. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts +9 -2
  318. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
  319. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +56 -57
  320. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts.map +1 -1
  321. package/build-types/border-box-control/border-box-control-visualizer/component.d.ts +2 -1
  322. package/build-types/border-box-control/border-box-control-visualizer/component.d.ts.map +1 -1
  323. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +55 -56
  324. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts.map +1 -1
  325. package/build-types/border-box-control/types.d.ts +5 -4
  326. package/build-types/border-box-control/types.d.ts.map +1 -1
  327. package/build-types/border-control/border-control/component.d.ts +14 -2
  328. package/build-types/border-control/border-control/component.d.ts.map +1 -1
  329. package/build-types/border-control/border-control/hook.d.ts +56 -57
  330. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  331. package/build-types/border-control/border-control-dropdown/component.d.ts +10 -2
  332. package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
  333. package/build-types/border-control/border-control-dropdown/hook.d.ts +56 -57
  334. package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
  335. package/build-types/border-control/border-control-style-picker/component.d.ts +6 -2
  336. package/build-types/border-control/border-control-style-picker/component.d.ts.map +1 -1
  337. package/build-types/border-control/border-control-style-picker/hook.d.ts +55 -56
  338. package/build-types/border-control/border-control-style-picker/hook.d.ts.map +1 -1
  339. package/build-types/border-control/stories/index.d.ts +74 -6
  340. package/build-types/border-control/stories/index.d.ts.map +1 -1
  341. package/build-types/border-control/types.d.ts +6 -8
  342. package/build-types/border-control/types.d.ts.map +1 -1
  343. package/build-types/button-group/index.d.ts +1 -3
  344. package/build-types/button-group/index.d.ts.map +1 -1
  345. package/build-types/card/card/component.d.ts +9 -2
  346. package/build-types/card/card/component.d.ts.map +1 -1
  347. package/build-types/card/card/hook.d.ts +55 -56
  348. package/build-types/card/card/hook.d.ts.map +1 -1
  349. package/build-types/card/card-body/component.d.ts +9 -2
  350. package/build-types/card/card-body/component.d.ts.map +1 -1
  351. package/build-types/card/card-body/hook.d.ts +55 -56
  352. package/build-types/card/card-body/hook.d.ts.map +1 -1
  353. package/build-types/card/card-divider/component.d.ts +7 -2
  354. package/build-types/card/card-divider/component.d.ts.map +1 -1
  355. package/build-types/card/card-divider/hook.d.ts +55 -55
  356. package/build-types/card/card-footer/component.d.ts +11 -2
  357. package/build-types/card/card-footer/component.d.ts.map +1 -1
  358. package/build-types/card/card-footer/hook.d.ts +55 -56
  359. package/build-types/card/card-footer/hook.d.ts.map +1 -1
  360. package/build-types/card/card-header/component.d.ts +1 -1
  361. package/build-types/card/card-header/component.d.ts.map +1 -1
  362. package/build-types/card/card-header/hook.d.ts +55 -56
  363. package/build-types/card/card-header/hook.d.ts.map +1 -1
  364. package/build-types/card/card-media/component.d.ts +2 -1
  365. package/build-types/card/card-media/component.d.ts.map +1 -1
  366. package/build-types/card/card-media/hook.d.ts +55 -56
  367. package/build-types/card/card-media/hook.d.ts.map +1 -1
  368. package/build-types/checkbox-control/index.d.ts +1 -1
  369. package/build-types/checkbox-control/index.d.ts.map +1 -1
  370. package/build-types/checkbox-control/stories/index.d.ts.map +1 -1
  371. package/build-types/checkbox-control/types.d.ts +1 -1
  372. package/build-types/checkbox-control/types.d.ts.map +1 -1
  373. package/build-types/color-indicator/index.d.ts +1 -3
  374. package/build-types/color-indicator/index.d.ts.map +1 -1
  375. package/build-types/color-palette/styles.d.ts +1 -3
  376. package/build-types/color-palette/styles.d.ts.map +1 -1
  377. package/build-types/color-picker/component.d.ts +2 -1
  378. package/build-types/color-picker/component.d.ts.map +1 -1
  379. package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
  380. package/build-types/color-picker/styles.d.ts +12 -25
  381. package/build-types/color-picker/styles.d.ts.map +1 -1
  382. package/build-types/confirm-dialog/component.d.ts +4 -8
  383. package/build-types/confirm-dialog/component.d.ts.map +1 -1
  384. package/build-types/date-time/date/styles.d.ts +4 -8
  385. package/build-types/date-time/date/styles.d.ts.map +1 -1
  386. package/build-types/date-time/date-time/styles.d.ts +4 -6
  387. package/build-types/date-time/date-time/styles.d.ts.map +1 -1
  388. package/build-types/date-time/time/styles.d.ts +21 -43
  389. package/build-types/date-time/time/styles.d.ts.map +1 -1
  390. package/build-types/disabled/index.d.ts +1 -1
  391. package/build-types/disabled/index.d.ts.map +1 -1
  392. package/build-types/disabled/styles/disabled-styles.d.ts +1 -5
  393. package/build-types/disabled/styles/disabled-styles.d.ts.map +1 -1
  394. package/build-types/divider/component.d.ts +7 -2
  395. package/build-types/divider/component.d.ts.map +1 -1
  396. package/build-types/drop-zone/index.d.ts +29 -0
  397. package/build-types/drop-zone/index.d.ts.map +1 -0
  398. package/build-types/drop-zone/provider.d.ts +5 -0
  399. package/build-types/drop-zone/provider.d.ts.map +1 -0
  400. package/build-types/drop-zone/stories/index.d.ts +12 -0
  401. package/build-types/drop-zone/stories/index.d.ts.map +1 -0
  402. package/build-types/drop-zone/types.d.ts +29 -0
  403. package/build-types/drop-zone/types.d.ts.map +1 -0
  404. package/build-types/dropdown/dropdown-content-wrapper.d.ts +2 -1
  405. package/build-types/dropdown/dropdown-content-wrapper.d.ts.map +1 -1
  406. package/build-types/elevation/component.d.ts +2 -1
  407. package/build-types/elevation/component.d.ts.map +1 -1
  408. package/build-types/elevation/hook.d.ts +54 -55
  409. package/build-types/elevation/hook.d.ts.map +1 -1
  410. package/build-types/external-link/index.d.ts +1 -1
  411. package/build-types/external-link/index.d.ts.map +1 -1
  412. package/build-types/external-link/styles/external-link-styles.d.ts +1 -1
  413. package/build-types/flex/flex/component.d.ts +2 -1
  414. package/build-types/flex/flex/component.d.ts.map +1 -1
  415. package/build-types/flex/flex/hook.d.ts +55 -56
  416. package/build-types/flex/flex/hook.d.ts.map +1 -1
  417. package/build-types/flex/flex-block/component.d.ts +2 -1
  418. package/build-types/flex/flex-block/component.d.ts.map +1 -1
  419. package/build-types/flex/flex-block/hook.d.ts +55 -56
  420. package/build-types/flex/flex-block/hook.d.ts.map +1 -1
  421. package/build-types/flex/flex-item/component.d.ts +2 -1
  422. package/build-types/flex/flex-item/component.d.ts.map +1 -1
  423. package/build-types/flex/flex-item/hook.d.ts +55 -56
  424. package/build-types/flex/flex-item/hook.d.ts.map +1 -1
  425. package/build-types/focal-point-picker/controls.d.ts +4 -0
  426. package/build-types/focal-point-picker/controls.d.ts.map +1 -0
  427. package/build-types/focal-point-picker/focal-point.d.ts +5 -0
  428. package/build-types/focal-point-picker/focal-point.d.ts.map +1 -0
  429. package/build-types/focal-point-picker/grid.d.ts +5 -0
  430. package/build-types/focal-point-picker/grid.d.ts.map +1 -0
  431. package/build-types/focal-point-picker/index.d.ts +51 -0
  432. package/build-types/focal-point-picker/index.d.ts.map +1 -0
  433. package/build-types/focal-point-picker/media.d.ts +4 -0
  434. package/build-types/focal-point-picker/media.d.ts.map +1 -0
  435. package/build-types/focal-point-picker/stories/index.d.ts +15 -0
  436. package/build-types/focal-point-picker/stories/index.d.ts.map +1 -0
  437. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +56 -0
  438. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts.map +1 -0
  439. package/build-types/focal-point-picker/styles/focal-point-style.d.ts +19 -0
  440. package/build-types/focal-point-picker/styles/focal-point-style.d.ts.map +1 -0
  441. package/build-types/focal-point-picker/types.d.ts +79 -0
  442. package/build-types/focal-point-picker/types.d.ts.map +1 -0
  443. package/build-types/focal-point-picker/utils.d.ts +26 -0
  444. package/build-types/focal-point-picker/utils.d.ts.map +1 -0
  445. package/build-types/form-file-upload/index.d.ts +22 -0
  446. package/build-types/form-file-upload/index.d.ts.map +1 -0
  447. package/build-types/form-file-upload/stories/index.d.ts +23 -0
  448. package/build-types/form-file-upload/stories/index.d.ts.map +1 -0
  449. package/build-types/form-file-upload/test/index.d.ts +2 -0
  450. package/build-types/form-file-upload/test/index.d.ts.map +1 -0
  451. package/build-types/form-file-upload/types.d.ts +63 -0
  452. package/build-types/form-file-upload/types.d.ts.map +1 -0
  453. package/build-types/form-toggle/index.d.ts +1 -1
  454. package/build-types/form-toggle/index.d.ts.map +1 -1
  455. package/build-types/form-token-field/index.d.ts.map +1 -1
  456. package/build-types/form-token-field/styles.d.ts +1 -3
  457. package/build-types/form-token-field/styles.d.ts.map +1 -1
  458. package/build-types/form-token-field/suggestions-list.d.ts.map +1 -1
  459. package/build-types/form-token-field/token-input.d.ts +1 -3
  460. package/build-types/form-token-field/token-input.d.ts.map +1 -1
  461. package/build-types/grid/component.d.ts +2 -1
  462. package/build-types/grid/component.d.ts.map +1 -1
  463. package/build-types/grid/hook.d.ts +55 -56
  464. package/build-types/grid/hook.d.ts.map +1 -1
  465. package/build-types/h-stack/component.d.ts +5 -2
  466. package/build-types/h-stack/component.d.ts.map +1 -1
  467. package/build-types/h-stack/hook.d.ts +55 -56
  468. package/build-types/h-stack/hook.d.ts.map +1 -1
  469. package/build-types/heading/component.d.ts +4 -2
  470. package/build-types/heading/component.d.ts.map +1 -1
  471. package/build-types/heading/hook.d.ts +54 -55
  472. package/build-types/heading/hook.d.ts.map +1 -1
  473. package/build-types/input-control/index.d.ts +1 -1
  474. package/build-types/input-control/index.d.ts.map +1 -1
  475. package/build-types/input-control/input-base.d.ts.map +1 -1
  476. package/build-types/input-control/input-field.d.ts +1 -3
  477. package/build-types/input-control/input-field.d.ts.map +1 -1
  478. package/build-types/input-control/input-prefix-wrapper.d.ts +2 -1
  479. package/build-types/input-control/input-prefix-wrapper.d.ts.map +1 -1
  480. package/build-types/input-control/input-suffix-wrapper.d.ts +2 -1
  481. package/build-types/input-control/input-suffix-wrapper.d.ts.map +1 -1
  482. package/build-types/input-control/label.d.ts.map +1 -1
  483. package/build-types/input-control/stories/index.d.ts +5 -5
  484. package/build-types/input-control/stories/index.d.ts.map +1 -1
  485. package/build-types/input-control/styles/input-control-styles.d.ts +2 -6
  486. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  487. package/build-types/input-control/types.d.ts +3 -0
  488. package/build-types/input-control/types.d.ts.map +1 -1
  489. package/build-types/item-group/item/component.d.ts +2 -1
  490. package/build-types/item-group/item/component.d.ts.map +1 -1
  491. package/build-types/item-group/item/hook.d.ts +54 -55
  492. package/build-types/item-group/item/hook.d.ts.map +1 -1
  493. package/build-types/item-group/item-group/component.d.ts +2 -1
  494. package/build-types/item-group/item-group/component.d.ts.map +1 -1
  495. package/build-types/item-group/item-group/hook.d.ts +54 -55
  496. package/build-types/item-group/item-group/hook.d.ts.map +1 -1
  497. package/build-types/modal/aria-helper.d.ts.map +1 -1
  498. package/build-types/navigable-container/menu.d.ts.map +1 -1
  499. package/build-types/navigable-container/tabbable.d.ts.map +1 -1
  500. package/build-types/navigator/navigator-back-button/component.d.ts +4 -2
  501. package/build-types/navigator/navigator-back-button/component.d.ts.map +1 -1
  502. package/build-types/navigator/navigator-back-button/hook.d.ts +59 -60
  503. package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
  504. package/build-types/navigator/navigator-button/component.d.ts +7 -2
  505. package/build-types/navigator/navigator-button/component.d.ts.map +1 -1
  506. package/build-types/navigator/navigator-button/hook.d.ts +59 -60
  507. package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
  508. package/build-types/navigator/navigator-provider/component.d.ts +2 -1
  509. package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
  510. package/build-types/navigator/navigator-screen/component.d.ts +1 -1
  511. package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
  512. package/build-types/number-control/index.d.ts +10 -28
  513. package/build-types/number-control/index.d.ts.map +1 -1
  514. package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
  515. package/build-types/number-control/types.d.ts +72 -0
  516. package/build-types/number-control/types.d.ts.map +1 -0
  517. package/build-types/placeholder/index.d.ts +1 -1
  518. package/build-types/placeholder/index.d.ts.map +1 -1
  519. package/build-types/popover/index.d.ts +28 -24
  520. package/build-types/popover/index.d.ts.map +1 -1
  521. package/build-types/popover/stories/index.d.ts +12 -0
  522. package/build-types/popover/stories/index.d.ts.map +1 -0
  523. package/build-types/popover/types.d.ts +161 -0
  524. package/build-types/popover/types.d.ts.map +1 -0
  525. package/build-types/popover/utils.d.ts +42 -24
  526. package/build-types/popover/utils.d.ts.map +1 -1
  527. package/build-types/radio-control/index.d.ts +1 -1
  528. package/build-types/radio-control/index.d.ts.map +1 -1
  529. package/build-types/range-control/index.d.ts +2 -4
  530. package/build-types/range-control/index.d.ts.map +1 -1
  531. package/build-types/range-control/input-range.d.ts +2 -4
  532. package/build-types/range-control/input-range.d.ts.map +1 -1
  533. package/build-types/range-control/styles/range-control-styles.d.ts +5 -10
  534. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  535. package/build-types/resizable-box/index.d.ts +1 -1
  536. package/build-types/resizable-box/resize-tooltip/index.d.ts +1 -1
  537. package/build-types/resizable-box/resize-tooltip/label.d.ts +1 -1
  538. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts +1 -3
  539. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts.map +1 -1
  540. package/build-types/scrollable/component.d.ts +2 -1
  541. package/build-types/scrollable/component.d.ts.map +1 -1
  542. package/build-types/scrollable/hook.d.ts +55 -56
  543. package/build-types/scrollable/hook.d.ts.map +1 -1
  544. package/build-types/search-control/index.d.ts +29 -0
  545. package/build-types/search-control/index.d.ts.map +1 -0
  546. package/build-types/search-control/stories/index.d.ts +47 -0
  547. package/build-types/search-control/stories/index.d.ts.map +1 -0
  548. package/build-types/search-control/types.d.ts +39 -0
  549. package/build-types/search-control/types.d.ts.map +1 -0
  550. package/build-types/select-control/index.d.ts +1 -3
  551. package/build-types/select-control/index.d.ts.map +1 -1
  552. package/build-types/select-control/stories/index.d.ts +2 -6
  553. package/build-types/select-control/stories/index.d.ts.map +1 -1
  554. package/build-types/select-control/styles/select-control-styles.d.ts +1 -3
  555. package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
  556. package/build-types/spacer/component.d.ts +2 -1
  557. package/build-types/spacer/component.d.ts.map +1 -1
  558. package/build-types/spacer/hook.d.ts +55 -56
  559. package/build-types/spacer/hook.d.ts.map +1 -1
  560. package/build-types/spinner/index.d.ts +1 -3
  561. package/build-types/spinner/index.d.ts.map +1 -1
  562. package/build-types/surface/component.d.ts +2 -1
  563. package/build-types/surface/component.d.ts.map +1 -1
  564. package/build-types/surface/hook.d.ts +55 -56
  565. package/build-types/surface/hook.d.ts.map +1 -1
  566. package/build-types/tab-panel/index.d.ts +42 -0
  567. package/build-types/tab-panel/index.d.ts.map +1 -0
  568. package/build-types/tab-panel/stories/index.d.ts +12 -0
  569. package/build-types/tab-panel/stories/index.d.ts.map +1 -0
  570. package/build-types/tab-panel/test/index.d.ts +2 -0
  571. package/build-types/tab-panel/test/index.d.ts.map +1 -0
  572. package/build-types/tab-panel/types.d.ts +64 -0
  573. package/build-types/tab-panel/types.d.ts.map +1 -0
  574. package/build-types/text/component.d.ts +1 -1
  575. package/build-types/text/component.d.ts.map +1 -1
  576. package/build-types/text/hook.d.ts +55 -56
  577. package/build-types/text/hook.d.ts.map +1 -1
  578. package/build-types/text-control/index.d.ts +2 -4
  579. package/build-types/text-control/index.d.ts.map +1 -1
  580. package/build-types/text-control/types.d.ts +1 -1
  581. package/build-types/text-control/types.d.ts.map +1 -1
  582. package/build-types/textarea-control/index.d.ts +1 -1
  583. package/build-types/textarea-control/index.d.ts.map +1 -1
  584. package/build-types/textarea-control/types.d.ts +1 -1
  585. package/build-types/textarea-control/types.d.ts.map +1 -1
  586. package/build-types/toggle-control/index.d.ts +26 -0
  587. package/build-types/toggle-control/index.d.ts.map +1 -0
  588. package/build-types/toggle-control/stories/index.d.ts +13 -0
  589. package/build-types/toggle-control/stories/index.d.ts.map +1 -0
  590. package/build-types/toggle-control/test/index.d.ts +2 -0
  591. package/build-types/toggle-control/test/index.d.ts.map +1 -0
  592. package/build-types/toggle-control/types.d.ts +20 -0
  593. package/build-types/toggle-control/types.d.ts.map +1 -0
  594. package/build-types/toggle-group-control/stories/index.d.ts +4 -2
  595. package/build-types/toggle-group-control/stories/index.d.ts.map +1 -1
  596. package/build-types/toggle-group-control/toggle-group-control/component.d.ts +12 -2
  597. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  598. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts +2 -4
  599. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts.map +1 -1
  600. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts +2 -1
  601. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
  602. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +3 -5
  603. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts.map +1 -1
  604. package/build-types/toggle-group-control/types.d.ts +2 -2
  605. package/build-types/toggle-group-control/types.d.ts.map +1 -1
  606. package/build-types/tools-panel/tools-panel/component.d.ts +2 -1
  607. package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
  608. package/build-types/tools-panel/tools-panel/hook.d.ts +55 -56
  609. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  610. package/build-types/tools-panel/tools-panel-header/component.d.ts +2 -1
  611. package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
  612. package/build-types/tools-panel/tools-panel-header/hook.d.ts +55 -56
  613. package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
  614. package/build-types/tools-panel/tools-panel-item/component.d.ts +6 -2
  615. package/build-types/tools-panel/tools-panel-item/component.d.ts.map +1 -1
  616. package/build-types/tools-panel/tools-panel-item/hook.d.ts +55 -56
  617. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  618. package/build-types/truncate/component.d.ts +2 -1
  619. package/build-types/truncate/component.d.ts.map +1 -1
  620. package/build-types/truncate/hook.d.ts +55 -56
  621. package/build-types/truncate/hook.d.ts.map +1 -1
  622. package/build-types/ui/context/context-connect.d.ts +10 -9
  623. package/build-types/ui/context/context-connect.d.ts.map +1 -1
  624. package/build-types/ui/context/context-system-provider.d.ts.map +1 -1
  625. package/build-types/ui/context/test/context-connect.d.ts +2 -0
  626. package/build-types/ui/context/test/context-connect.d.ts.map +1 -0
  627. package/build-types/ui/context/test/wordpress-component.d.ts +2 -0
  628. package/build-types/ui/context/test/wordpress-component.d.ts.map +1 -0
  629. package/build-types/ui/context/wordpress-component.d.ts +8 -9
  630. package/build-types/ui/context/wordpress-component.d.ts.map +1 -1
  631. package/build-types/ui/control-group/component.d.ts +4 -1
  632. package/build-types/ui/control-group/component.d.ts.map +1 -1
  633. package/build-types/ui/control-group/hook.d.ts +55 -56
  634. package/build-types/ui/control-group/hook.d.ts.map +1 -1
  635. package/build-types/ui/control-label/component.d.ts +4 -1
  636. package/build-types/ui/control-label/component.d.ts.map +1 -1
  637. package/build-types/ui/control-label/hook.d.ts +55 -56
  638. package/build-types/ui/control-label/hook.d.ts.map +1 -1
  639. package/build-types/ui/form-group/form-group.d.ts +4 -8
  640. package/build-types/ui/form-group/form-group.d.ts.map +1 -1
  641. package/build-types/ui/form-group/use-form-group.d.ts +112 -114
  642. package/build-types/ui/form-group/use-form-group.d.ts.map +1 -1
  643. package/build-types/ui/shortcut/component.d.ts +2 -1
  644. package/build-types/ui/shortcut/component.d.ts.map +1 -1
  645. package/build-types/ui/spinner/component.d.ts +1 -1
  646. package/build-types/ui/tooltip/component.d.ts +11 -1
  647. package/build-types/ui/tooltip/component.d.ts.map +1 -1
  648. package/build-types/ui/tooltip/content.d.ts +7 -1
  649. package/build-types/ui/tooltip/styles.d.ts +1 -3
  650. package/build-types/ui/tooltip/styles.d.ts.map +1 -1
  651. package/build-types/unit-control/index.d.ts +2 -12
  652. package/build-types/unit-control/index.d.ts.map +1 -1
  653. package/build-types/unit-control/stories/index.d.ts.map +1 -1
  654. package/build-types/unit-control/styles/unit-control-styles.d.ts +5 -10
  655. package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
  656. package/build-types/unit-control/types.d.ts +3 -35
  657. package/build-types/unit-control/types.d.ts.map +1 -1
  658. package/build-types/utils/colors-values.d.ts +0 -18
  659. package/build-types/utils/colors-values.d.ts.map +1 -1
  660. package/build-types/utils/math.d.ts +6 -6
  661. package/build-types/utils/math.d.ts.map +1 -1
  662. package/build-types/utils/values.d.ts +10 -8
  663. package/build-types/utils/values.d.ts.map +1 -1
  664. package/build-types/v-stack/component.d.ts +8 -2
  665. package/build-types/v-stack/component.d.ts.map +1 -1
  666. package/build-types/v-stack/hook.d.ts +55 -56
  667. package/build-types/v-stack/hook.d.ts.map +1 -1
  668. package/build-types/v-stack/stories/index.d.ts +8 -1
  669. package/build-types/v-stack/stories/index.d.ts.map +1 -1
  670. package/build-types/view/component.d.ts +8 -6
  671. package/build-types/view/component.d.ts.map +1 -1
  672. package/build-types/view/stories/index.d.ts +12 -0
  673. package/build-types/view/stories/index.d.ts.map +1 -0
  674. package/build-types/view/types.d.ts +8 -0
  675. package/build-types/view/types.d.ts.map +1 -0
  676. package/build-types/visually-hidden/component.d.ts +2 -1
  677. package/build-types/visually-hidden/component.d.ts.map +1 -1
  678. package/build-types/z-stack/component.d.ts +2 -1
  679. package/build-types/z-stack/component.d.ts.map +1 -1
  680. package/package.json +17 -17
  681. package/src/alignment-matrix-control/styles/alignment-matrix-control-styles.js +1 -1
  682. package/src/angle-picker-control/README.md +9 -1
  683. package/src/angle-picker-control/index.js +12 -0
  684. package/src/angle-picker-control/stories/index.js +3 -3
  685. package/src/base-field/test/__snapshots__/index.js.snap +3 -5
  686. package/src/border-box-control/border-box-control/component.tsx +9 -2
  687. package/src/border-box-control/border-box-control-split-controls/component.tsx +8 -2
  688. package/src/border-box-control/types.ts +5 -4
  689. package/src/border-control/border-control-dropdown/component.tsx +3 -8
  690. package/src/border-control/types.ts +7 -9
  691. package/src/card/styles.ts +1 -1
  692. package/src/card/test/__snapshots__/index.tsx.snap +39 -51
  693. package/src/checkbox-control/index.tsx +3 -6
  694. package/src/checkbox-control/stories/index.tsx +6 -2
  695. package/src/checkbox-control/types.ts +4 -1
  696. package/src/color-palette/index.js +1 -1
  697. package/src/color-palette/test/__snapshots__/index.js.snap +67 -91
  698. package/src/color-picker/input-with-slider.tsx +1 -0
  699. package/src/combobox-control/index.js +1 -1
  700. package/src/combobox-control/test/index.js +311 -0
  701. package/src/custom-gradient-picker/index.js +1 -1
  702. package/src/date-time/date/index.tsx +2 -2
  703. package/src/date-time/time/timezone.tsx +1 -1
  704. package/src/dimension-control/test/__snapshots__/index.test.js.snap +1122 -164
  705. package/src/dimension-control/test/index.test.js +29 -38
  706. package/src/disabled/index.tsx +27 -9
  707. package/src/disabled/styles/disabled-styles.tsx +2 -2
  708. package/src/disabled/test/index.tsx +38 -0
  709. package/src/drop-zone/README.md +3 -3
  710. package/src/drop-zone/{index.js → index.tsx} +48 -13
  711. package/src/drop-zone/{provider.js → provider.ts} +5 -1
  712. package/src/drop-zone/stories/index.tsx +30 -0
  713. package/src/drop-zone/types.ts +29 -0
  714. package/src/dropdown/README.md +6 -4
  715. package/src/dropdown/stories/index.js +1 -1
  716. package/src/flex/flex/hook.ts +5 -54
  717. package/src/flex/test/__snapshots__/index.tsx.snap +7 -15
  718. package/src/focal-point-picker/README.md +2 -2
  719. package/src/focal-point-picker/{controls.js → controls.tsx} +38 -10
  720. package/src/focal-point-picker/{focal-point.js → focal-point.tsx} +7 -1
  721. package/src/focal-point-picker/{grid.js → grid.tsx} +6 -1
  722. package/src/focal-point-picker/{index.js → index.tsx} +99 -15
  723. package/src/focal-point-picker/{media.js → media.tsx} +10 -4
  724. package/src/focal-point-picker/stories/index.tsx +93 -0
  725. package/src/focal-point-picker/styles/{focal-point-picker-style.js → focal-point-picker-style.ts} +31 -5
  726. package/src/focal-point-picker/styles/{focal-point-style.js → focal-point-style.ts} +2 -1
  727. package/src/focal-point-picker/test/index.js +27 -7
  728. package/src/focal-point-picker/types.ts +93 -0
  729. package/src/focal-point-picker/{utils.js → utils.ts} +9 -9
  730. package/src/font-size-picker/README.md +9 -0
  731. package/src/font-size-picker/index.js +9 -0
  732. package/src/font-size-picker/stories/index.js +3 -5
  733. package/src/font-size-picker/test/index.js +15 -2
  734. package/src/font-size-picker/test/utils.js +1 -2
  735. package/src/font-size-picker/utils.js +1 -1
  736. package/src/form-file-upload/README.md +6 -1
  737. package/src/form-file-upload/{index.js → index.tsx} +22 -4
  738. package/src/form-file-upload/stories/index.tsx +74 -0
  739. package/src/form-file-upload/test/{index.js → index.tsx} +7 -3
  740. package/src/form-file-upload/types.ts +63 -0
  741. package/src/form-toggle/index.tsx +1 -6
  742. package/src/form-token-field/index.tsx +4 -5
  743. package/src/form-token-field/suggestions-list.tsx +1 -2
  744. package/src/gradient-picker/index.js +41 -47
  745. package/src/gradient-picker/stories/index.js +10 -0
  746. package/src/h-stack/test/__snapshots__/index.tsx.snap +3 -12
  747. package/src/higher-order/with-filters/test/__snapshots__/index.js.snap +87 -0
  748. package/src/higher-order/with-filters/test/index.js +20 -74
  749. package/src/icon/index.tsx +1 -1
  750. package/src/icon/stories/index.js +18 -0
  751. package/src/icon/test/index.js +32 -83
  752. package/src/input-control/input-base.tsx +9 -11
  753. package/src/input-control/label.tsx +9 -4
  754. package/src/input-control/styles/input-control-styles.tsx +0 -43
  755. package/src/input-control/types.ts +3 -0
  756. package/src/isolated-event-container/test/index.js +53 -11
  757. package/src/item-group/test/__snapshots__/index.js.snap +16 -16
  758. package/src/keyboard-shortcuts/test/index.js +16 -31
  759. package/src/menu-item/test/__snapshots__/index.js.snap +60 -62
  760. package/src/menu-item/test/index.js +30 -22
  761. package/src/modal/aria-helper.js +3 -8
  762. package/src/navigable-container/README.md +2 -0
  763. package/src/navigable-container/container.js +8 -1
  764. package/src/navigable-container/menu.js +14 -11
  765. package/src/navigable-container/stories/navigable-menu.js +49 -0
  766. package/src/navigable-container/stories/tabbable-container.js +40 -0
  767. package/src/navigable-container/tabbable.js +2 -3
  768. package/src/navigable-container/test/navigable-menu.js +277 -0
  769. package/src/navigable-container/test/tababble-container.js +175 -0
  770. package/src/navigator/navigator-button/hook.ts +1 -1
  771. package/src/navigator/navigator-screen/component.tsx +6 -1
  772. package/src/number-control/index.tsx +209 -0
  773. package/src/number-control/stories/index.js +6 -18
  774. package/src/number-control/types.ts +75 -0
  775. package/src/panel/test/__snapshots__/header.js.snap +9 -0
  776. package/src/panel/test/__snapshots__/index.js.snap +17 -0
  777. package/src/panel/test/__snapshots__/row.js.snap +17 -0
  778. package/src/panel/test/header.js +30 -23
  779. package/src/panel/test/index.js +33 -25
  780. package/src/panel/test/row.js +18 -11
  781. package/src/placeholder/index.tsx +4 -5
  782. package/src/placeholder/style.scss +4 -0
  783. package/src/popover/README.md +83 -48
  784. package/src/popover/{index.js → index.tsx} +246 -176
  785. package/src/popover/stories/{index.js → index.tsx} +51 -54
  786. package/src/popover/types.ts +173 -0
  787. package/src/popover/utils.ts +230 -0
  788. package/src/radio-control/index.tsx +28 -29
  789. package/src/radio-control/style.scss +0 -17
  790. package/src/range-control/index.tsx +4 -1
  791. package/src/range-control/styles/range-control-styles.ts +8 -8
  792. package/src/sandbox/index.js +2 -2
  793. package/src/search-control/README.md +5 -3
  794. package/src/search-control/{index.js → index.tsx} +35 -7
  795. package/src/search-control/stories/index.tsx +66 -0
  796. package/src/search-control/types.ts +43 -0
  797. package/src/select-control/index.native.js +1 -1
  798. package/src/slot-fill/test/index.js +69 -12
  799. package/src/style.scss +0 -1
  800. package/src/surface/test/__snapshots__/index.tsx.snap +10 -10
  801. package/src/tab-panel/README.md +1 -2
  802. package/src/tab-panel/{index.js → index.tsx} +58 -13
  803. package/src/tab-panel/stories/index.tsx +37 -0
  804. package/src/tab-panel/test/index.tsx +120 -0
  805. package/src/tab-panel/types.ts +65 -0
  806. package/src/text-control/index.tsx +2 -0
  807. package/src/text-control/types.ts +5 -1
  808. package/src/textarea-control/index.tsx +3 -6
  809. package/src/textarea-control/types.ts +1 -1
  810. package/src/toggle-control/index.tsx +97 -0
  811. package/src/toggle-control/stories/index.tsx +58 -0
  812. package/src/toggle-control/test/index.tsx +53 -0
  813. package/src/toggle-control/types.ts +28 -0
  814. package/src/toggle-group-control/stories/index.tsx +10 -3
  815. package/src/toggle-group-control/toggle-group-control/component.tsx +3 -3
  816. package/src/toggle-group-control/toggle-group-control-option-icon/README.md +1 -1
  817. package/src/toggle-group-control/toggle-group-control-option-icon/component.tsx +1 -1
  818. package/src/toggle-group-control/types.ts +2 -2
  819. package/src/tooltip/index.js +1 -1
  820. package/src/ui/context/context-connect.ts +58 -31
  821. package/src/ui/context/context-system-provider.js +5 -4
  822. package/src/ui/context/test/context-connect.tsx +55 -0
  823. package/src/ui/context/test/wordpress-component.tsx +36 -0
  824. package/src/ui/context/wordpress-component.ts +18 -12
  825. package/src/ui/control-group/test/__snapshots__/index.js.snap +1 -4
  826. package/src/unit-control/index.tsx +1 -1
  827. package/src/unit-control/stories/index.tsx +7 -16
  828. package/src/unit-control/styles/unit-control-styles.ts +2 -2
  829. package/src/unit-control/test/__snapshots__/index.tsx.snap +4 -6
  830. package/src/unit-control/types.ts +3 -44
  831. package/src/utils/colors-values.js +2 -24
  832. package/src/utils/math.js +4 -4
  833. package/src/utils/values.js +48 -6
  834. package/src/v-stack/test/__snapshots__/index.tsx.snap +3 -12
  835. package/src/view/{component.js → component.tsx} +13 -4
  836. package/src/view/stories/index.tsx +32 -0
  837. package/src/view/types.ts +6 -0
  838. package/tsconfig.json +0 -6
  839. package/tsconfig.tsbuildinfo +1 -1
  840. package/src/focal-point-picker/stories/index.js +0 -76
  841. package/src/navigable-container/test/menu.js +0 -310
  842. package/src/navigable-container/test/tabbable.js +0 -158
  843. package/src/number-control/index.js +0 -192
  844. package/src/popover/utils.js +0 -107
  845. package/src/search-control/stories/index.js +0 -39
  846. package/src/tab-panel/stories/index.js +0 -39
  847. package/src/tab-panel/test/index.js +0 -179
  848. package/src/toggle-control/index.js +0 -55
  849. package/src/toggle-control/stories/index.js +0 -64
  850. package/src/toggle-control/style.scss +0 -14
  851. package/src/toggle-control/test/index.js +0 -52
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/color-palette/index.js"],"names":["namesPlugin","a11yPlugin","SinglePalette","className","clearColor","colors","onChange","value","actions","colorOptions","map","index","color","name","colordColor","isSelected","fill","contrast","backgroundColor","MultiplePalettes","colorPalette","length","CustomColorPickerDropdown","isRenderedInSidebar","popoverProps","receivedPopoverProps","props","__unstableShift","placement","offset","extractColorNameFromCurrentValue","currentValue","showMultiplePalettes","currentValueIsCssVariable","test","normalizedCurrentValue","toHex","colorPalettes","paletteColors","colorName","colorValue","normalizedColorValue","showTransparentBackground","alpha","ColorPalette","clearable","disableCustomColors","enableAlpha","__experimentalHasMultipleOrigins","__experimentalIsRenderedInSidebar","undefined","Component","renderCustomColorPicker","valueWithoutLeadingHash","startsWith","substring","buttonLabelName","customColorAccessibleLabel","isOpen","onToggle","background","Truncate"],"mappings":";;;;;;;;;;;AAYA;;;;AARA;;AACA;;AACA;;AAKA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAxBA;;AACA;AACA;AACA;;AAKA;AACA;AACA;;AAIA;AACA;AACA;AAUA,oBAAQ,CAAEA,cAAF,EAAeC,aAAf,CAAR;;AAEA,SAASC,aAAT,OAOI;AAAA,MAPoB;AACvBC,IAAAA,SADuB;AAEvBC,IAAAA,UAFuB;AAGvBC,IAAAA,MAHuB;AAIvBC,IAAAA,QAJuB;AAKvBC,IAAAA,KALuB;AAMvBC,IAAAA;AANuB,GAOpB;AACH,QAAMC,YAAY,GAAG,sBAAS,MAAM;AACnC,WAAOJ,MAAM,CAACK,GAAP,CAAY,QAAmBC,KAAnB,KAA8B;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,EAAGC,KALT;AAMC,IAAA,OAAO,EACN,CAAC,CAAEsC,SAAH,IACC,4BAAC,6BAAD,CAAsB,YAAtB;AACC,MAAA,OAAO,EAAGzC;AADX,OAGG,cAAI,OAAJ,CAHH;AARH,IA7CD,CADD;AAgEA","sourcesContent":["// @ts-nocheck\n/**\n * External dependencies\n */\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\nimport a11yPlugin from 'colord/plugins/a11y';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useCallback, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Dropdown from '../dropdown';\nimport { ColorPicker } from '../color-picker';\nimport CircularOptionPicker from '../circular-option-picker';\nimport { VStack } from '../v-stack';\nimport { Flex, FlexItem } from '../flex';\nimport { Truncate } from '../truncate';\nimport { ColorHeading } from './styles';\nimport DropdownContentWrapper from '../dropdown/dropdown-content-wrapper';\n\nextend( [ namesPlugin, a11yPlugin ] );\n\nfunction SinglePalette( {\n\tclassName,\n\tclearColor,\n\tcolors,\n\tonChange,\n\tvalue,\n\tactions,\n} ) {\n\tconst colorOptions = useMemo( () => {\n\t\treturn colors.map( ( { color, name }, index ) => {\n\t\t\tconst colordColor = colord( color );\n\t\t\tconst isSelected = value === color;\n\n\t\t\treturn (\n\t\t\t\t<CircularOptionPicker.Option\n\t\t\t\t\tkey={ `${ color }-${ index }` }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tselectedIconProps={\n\t\t\t\t\t\tisSelected\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tfill:\n\t\t\t\t\t\t\t\t\t\tcolordColor.contrast() >\n\t\t\t\t\t\t\t\t\t\tcolordColor.contrast( '#000' )\n\t\t\t\t\t\t\t\t\t\t\t? '#fff'\n\t\t\t\t\t\t\t\t\t\t\t: '#000',\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t: {}\n\t\t\t\t\t}\n\t\t\t\t\ttooltipText={\n\t\t\t\t\t\tname ||\n\t\t\t\t\t\t// translators: %s: color hex code e.g: \"#f00\".\n\t\t\t\t\t\tsprintf( __( 'Color code: %s' ), color )\n\t\t\t\t\t}\n\t\t\t\t\tstyle={ { backgroundColor: color, color } }\n\t\t\t\t\tonClick={\n\t\t\t\t\t\tisSelected ? clearColor : () => onChange( color )\n\t\t\t\t\t}\n\t\t\t\t\taria-label={\n\t\t\t\t\t\tname\n\t\t\t\t\t\t\t? // translators: %s: The name of the color e.g: \"vivid red\".\n\t\t\t\t\t\t\t sprintf( __( 'Color: %s' ), name )\n\t\t\t\t\t\t\t: // translators: %s: color hex code e.g: \"#f00\".\n\t\t\t\t\t\t\t sprintf( __( 'Color code: %s' ), color )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t);\n\t\t} );\n\t}, [ colors, value, onChange, clearColor ] );\n\treturn (\n\t\t<CircularOptionPicker\n\t\t\tclassName={ className }\n\t\t\toptions={ colorOptions }\n\t\t\tactions={ actions }\n\t\t/>\n\t);\n}\n\nfunction MultiplePalettes( {\n\tclassName,\n\tclearColor,\n\tcolors,\n\tonChange,\n\tvalue,\n\tactions,\n} ) {\n\treturn (\n\t\t<VStack spacing={ 3 } className={ className }>\n\t\t\t{ colors.map( ( { name, colors: colorPalette }, index ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<VStack spacing={ 2 } key={ index }>\n\t\t\t\t\t\t<ColorHeading>{ name }</ColorHeading>\n\t\t\t\t\t\t<SinglePalette\n\t\t\t\t\t\t\tclearColor={ clearColor }\n\t\t\t\t\t\t\tcolors={ colorPalette }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\tactions={\n\t\t\t\t\t\t\t\tcolors.length === index + 1 ? actions : null\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</VStack>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</VStack>\n\t);\n}\n\nexport function CustomColorPickerDropdown( {\n\tisRenderedInSidebar,\n\tpopoverProps: receivedPopoverProps,\n\t...props\n} ) {\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t__unstableShift: true,\n\t\t\t...( isRenderedInSidebar\n\t\t\t\t? {\n\t\t\t\t\t\t// When in the sidebar: open to the left (stacking),\n\t\t\t\t\t\t// leaving the same gap as the parent popover.\n\t\t\t\t\t\tplacement: 'left-start',\n\t\t\t\t\t\toffset: 34,\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\t// Default behavior: open below the anchor\n\t\t\t\t\t\tplacement: 'bottom',\n\t\t\t\t\t\toffset: 8,\n\t\t\t\t } ),\n\t\t\t...receivedPopoverProps,\n\t\t} ),\n\t\t[ isRenderedInSidebar, receivedPopoverProps ]\n\t);\n\n\treturn (\n\t\t<Dropdown\n\t\t\tcontentClassName=\"components-color-palette__custom-color-dropdown-content\"\n\t\t\tpopoverProps={ popoverProps }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nexport const extractColorNameFromCurrentValue = (\n\tcurrentValue,\n\tcolors = [],\n\tshowMultiplePalettes = false\n) => {\n\tif ( ! currentValue ) {\n\t\treturn '';\n\t}\n\n\tconst currentValueIsCssVariable = /^var\\(/.test( currentValue );\n\tconst normalizedCurrentValue = currentValueIsCssVariable\n\t\t? currentValue\n\t\t: colord( currentValue ).toHex();\n\n\t// Normalize format of `colors` to simplify the following loop\n\tconst colorPalettes = showMultiplePalettes ? colors : [ { colors } ];\n\tfor ( const { colors: paletteColors } of colorPalettes ) {\n\t\tfor ( const { name: colorName, color: colorValue } of paletteColors ) {\n\t\t\tconst normalizedColorValue = currentValueIsCssVariable\n\t\t\t\t? colorValue\n\t\t\t\t: colord( colorValue ).toHex();\n\n\t\t\tif ( normalizedCurrentValue === normalizedColorValue ) {\n\t\t\t\treturn colorName;\n\t\t\t}\n\t\t}\n\t}\n\n\t// translators: shown when the user has picked a custom color (i.e not in the palette of colors).\n\treturn __( 'Custom' );\n};\n\nexport const showTransparentBackground = ( currentValue ) => {\n\tif ( typeof currentValue === 'undefined' ) {\n\t\treturn true;\n\t}\n\treturn colord( currentValue ).alpha() === 0;\n};\n\nexport default function ColorPalette( {\n\tclearable = true,\n\tclassName,\n\tcolors,\n\tdisableCustomColors = false,\n\tenableAlpha,\n\tonChange,\n\tvalue,\n\t__experimentalHasMultipleOrigins = false,\n\t__experimentalIsRenderedInSidebar = false,\n} ) {\n\tconst clearColor = useCallback( () => onChange( undefined ), [ onChange ] );\n\tconst showMultiplePalettes =\n\t\t__experimentalHasMultipleOrigins && colors?.length;\n\tconst Component = showMultiplePalettes ? MultiplePalettes : SinglePalette;\n\n\tconst renderCustomColorPicker = () => (\n\t\t<DropdownContentWrapper paddingSize=\"none\">\n\t\t\t<ColorPicker\n\t\t\t\tcolor={ value }\n\t\t\t\tonChange={ ( color ) => onChange( color ) }\n\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t/>\n\t\t</DropdownContentWrapper>\n\t);\n\n\tconst colordColor = colord( value );\n\n\tconst valueWithoutLeadingHash = value?.startsWith( '#' )\n\t\t? value.substring( 1 )\n\t\t: value ?? '';\n\tconst buttonLabelName = useMemo(\n\t\t() =>\n\t\t\textractColorNameFromCurrentValue(\n\t\t\t\tvalue,\n\t\t\t\tcolors,\n\t\t\t\tshowMultiplePalettes\n\t\t\t),\n\t\t[ value, colors, showMultiplePalettes ]\n\t);\n\n\tconst customColorAccessibleLabel = !! valueWithoutLeadingHash\n\t\t? sprintf(\n\t\t\t\t// translators: %1$s: The name of the color e.g: \"vivid red\". %2$s: The color's hex code e.g: \"#f00\".\n\t\t\t\t__(\n\t\t\t\t\t'Custom color picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'\n\t\t\t\t),\n\t\t\t\tbuttonLabelName,\n\t\t\t\tvalueWithoutLeadingHash\n\t\t )\n\t\t: __( 'Custom color picker.' );\n\n\treturn (\n\t\t<VStack spacing={ 3 } className={ className }>\n\t\t\t{ ! disableCustomColors && (\n\t\t\t\t<CustomColorPickerDropdown\n\t\t\t\t\tisRenderedInSidebar={ __experimentalIsRenderedInSidebar }\n\t\t\t\t\trenderContent={ renderCustomColorPicker }\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<Flex\n\t\t\t\t\t\t\tas={ 'button' }\n\t\t\t\t\t\t\tjustify=\"space-between\"\n\t\t\t\t\t\t\talign=\"flex-start\"\n\t\t\t\t\t\t\tclassName=\"components-color-palette__custom-color\"\n\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\taria-label={ customColorAccessibleLabel }\n\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\tshowTransparentBackground( value )\n\t\t\t\t\t\t\t\t\t? { color: '#000' }\n\t\t\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\t\t\tbackground: value,\n\t\t\t\t\t\t\t\t\t\t\tcolor:\n\t\t\t\t\t\t\t\t\t\t\t\tcolordColor.contrast() >\n\t\t\t\t\t\t\t\t\t\t\t\tcolordColor.contrast( '#000' )\n\t\t\t\t\t\t\t\t\t\t\t\t\t? '#fff'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: '#000',\n\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<FlexItem\n\t\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\t\tas={ Truncate }\n\t\t\t\t\t\t\t\tclassName=\"components-color-palette__custom-color-name\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ buttonLabelName }\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t<FlexItem\n\t\t\t\t\t\t\t\tas=\"span\"\n\t\t\t\t\t\t\t\tclassName=\"components-color-palette__custom-color-value\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ valueWithoutLeadingHash }\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t</Flex>\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<Component\n\t\t\t\tclearable={ clearable }\n\t\t\t\tclearColor={ clearColor }\n\t\t\t\tcolors={ colors }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tvalue={ value }\n\t\t\t\tactions={\n\t\t\t\t\t!! clearable && (\n\t\t\t\t\t\t<CircularOptionPicker.ButtonAction\n\t\t\t\t\t\t\tonClick={ clearColor }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Clear' ) }\n\t\t\t\t\t\t</CircularOptionPicker.ButtonAction>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t/>\n\t\t</VStack>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/color-palette/index.js"],"names":["namesPlugin","a11yPlugin","SinglePalette","className","clearColor","colors","onChange","value","actions","colorOptions","map","index","color","name","colordColor","isSelected","fill","contrast","backgroundColor","MultiplePalettes","colorPalette","length","CustomColorPickerDropdown","isRenderedInSidebar","popoverProps","receivedPopoverProps","props","shift","placement","offset","extractColorNameFromCurrentValue","currentValue","showMultiplePalettes","currentValueIsCssVariable","test","normalizedCurrentValue","toHex","colorPalettes","paletteColors","colorName","colorValue","normalizedColorValue","showTransparentBackground","alpha","ColorPalette","clearable","disableCustomColors","enableAlpha","__experimentalHasMultipleOrigins","__experimentalIsRenderedInSidebar","undefined","Component","renderCustomColorPicker","valueWithoutLeadingHash","startsWith","substring","buttonLabelName","customColorAccessibleLabel","isOpen","onToggle","background","Truncate"],"mappings":";;;;;;;;;;;AAYA;;;;AARA;;AACA;;AACA;;AAKA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAxBA;;AACA;AACA;AACA;;AAKA;AACA;AACA;;AAIA;AACA;AACA;AAUA,oBAAQ,CAAEA,cAAF,E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AtBD,EA6BC,4BAAC,cAAD;AACC,QAAA,EAAE,EAAC,MADJ;AAEC,QAAA,SAAS,EAAC;AAFX,SAIGH,uBAJH,CA7BD,CADc;AAAA;AAHhB,IAFF,EA6CC,4BAAC,SAAD;AACC,IAAA,SAAS,EAAGR,SADb;AAEC,IAAA,UAAU,EAAGzC,UAFd;AAGC,IAAA,MAAM,EAAGC,MAHV;AAIC,IAAA,QAAQ,EAAGC,QAJZ;AAKC,IAAA,KAAK,EAAGC,KALT;AAMC,IAAA,OAAO,EACN,CAAC,CAAEsC,SAAH,IACC,4BAAC,6BAAD,CAAsB,YAAtB;AACC,MAAA,OAAO,EAAGzC;AADX,OAGG,cAAI,OAAJ,CAHH;AARH,IA7CD,CADD;AAgEA","sourcesContent":["// @ts-nocheck\n/**\n * External dependencies\n */\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\nimport a11yPlugin from 'colord/plugins/a11y';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useCallback, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Dropdown from '../dropdown';\nimport { ColorPicker } from '../color-picker';\nimport CircularOptionPicker from '../circular-option-picker';\nimport { VStack } from '../v-stack';\nimport { Flex, FlexItem } from '../flex';\nimport { Truncate } from '../truncate';\nimport { ColorHeading } from './styles';\nimport DropdownContentWrapper from '../dropdown/dropdown-content-wrapper';\n\nextend( [ namesPlugin, a11yPlugin ] );\n\nfunction SinglePalette( {\n\tclassName,\n\tclearColor,\n\tcolors,\n\tonChange,\n\tvalue,\n\tactions,\n} ) {\n\tconst colorOptions = useMemo( () => {\n\t\treturn colors.map( ( { color, name }, index ) => {\n\t\t\tconst colordColor = colord( color );\n\t\t\tconst isSelected = value === color;\n\n\t\t\treturn (\n\t\t\t\t<CircularOptionPicker.Option\n\t\t\t\t\tkey={ `${ color }-${ index }` }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tselectedIconProps={\n\t\t\t\t\t\tisSelected\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tfill:\n\t\t\t\t\t\t\t\t\t\tcolordColor.contrast() >\n\t\t\t\t\t\t\t\t\t\tcolordColor.contrast( '#000' )\n\t\t\t\t\t\t\t\t\t\t\t? '#fff'\n\t\t\t\t\t\t\t\t\t\t\t: '#000',\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t: {}\n\t\t\t\t\t}\n\t\t\t\t\ttooltipText={\n\t\t\t\t\t\tname ||\n\t\t\t\t\t\t// translators: %s: color hex code e.g: \"#f00\".\n\t\t\t\t\t\tsprintf( __( 'Color code: %s' ), color )\n\t\t\t\t\t}\n\t\t\t\t\tstyle={ { backgroundColor: color, color } }\n\t\t\t\t\tonClick={\n\t\t\t\t\t\tisSelected ? clearColor : () => onChange( color )\n\t\t\t\t\t}\n\t\t\t\t\taria-label={\n\t\t\t\t\t\tname\n\t\t\t\t\t\t\t? // translators: %s: The name of the color e.g: \"vivid red\".\n\t\t\t\t\t\t\t sprintf( __( 'Color: %s' ), name )\n\t\t\t\t\t\t\t: // translators: %s: color hex code e.g: \"#f00\".\n\t\t\t\t\t\t\t sprintf( __( 'Color code: %s' ), color )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t);\n\t\t} );\n\t}, [ colors, value, onChange, clearColor ] );\n\treturn (\n\t\t<CircularOptionPicker\n\t\t\tclassName={ className }\n\t\t\toptions={ colorOptions }\n\t\t\tactions={ actions }\n\t\t/>\n\t);\n}\n\nfunction MultiplePalettes( {\n\tclassName,\n\tclearColor,\n\tcolors,\n\tonChange,\n\tvalue,\n\tactions,\n} ) {\n\treturn (\n\t\t<VStack spacing={ 3 } className={ className }>\n\t\t\t{ colors.map( ( { name, colors: colorPalette }, index ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<VStack spacing={ 2 } key={ index }>\n\t\t\t\t\t\t<ColorHeading>{ name }</ColorHeading>\n\t\t\t\t\t\t<SinglePalette\n\t\t\t\t\t\t\tclearColor={ clearColor }\n\t\t\t\t\t\t\tcolors={ colorPalette }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\tactions={\n\t\t\t\t\t\t\t\tcolors.length === index + 1 ? actions : null\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</VStack>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</VStack>\n\t);\n}\n\nexport function CustomColorPickerDropdown( {\n\tisRenderedInSidebar,\n\tpopoverProps: receivedPopoverProps,\n\t...props\n} ) {\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\tshift: true,\n\t\t\t...( isRenderedInSidebar\n\t\t\t\t? {\n\t\t\t\t\t\t// When in the sidebar: open to the left (stacking),\n\t\t\t\t\t\t// leaving the same gap as the parent popover.\n\t\t\t\t\t\tplacement: 'left-start',\n\t\t\t\t\t\toffset: 34,\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\t// Default behavior: open below the anchor\n\t\t\t\t\t\tplacement: 'bottom',\n\t\t\t\t\t\toffset: 8,\n\t\t\t\t } ),\n\t\t\t...receivedPopoverProps,\n\t\t} ),\n\t\t[ isRenderedInSidebar, receivedPopoverProps ]\n\t);\n\n\treturn (\n\t\t<Dropdown\n\t\t\tcontentClassName=\"components-color-palette__custom-color-dropdown-content\"\n\t\t\tpopoverProps={ popoverProps }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nexport const extractColorNameFromCurrentValue = (\n\tcurrentValue,\n\tcolors = [],\n\tshowMultiplePalettes = false\n) => {\n\tif ( ! currentValue ) {\n\t\treturn '';\n\t}\n\n\tconst currentValueIsCssVariable = /^var\\(/.test( currentValue );\n\tconst normalizedCurrentValue = currentValueIsCssVariable\n\t\t? currentValue\n\t\t: colord( currentValue ).toHex();\n\n\t// Normalize format of `colors` to simplify the following loop\n\tconst colorPalettes = showMultiplePalettes ? colors : [ { colors } ];\n\tfor ( const { colors: paletteColors } of colorPalettes ) {\n\t\tfor ( const { name: colorName, color: colorValue } of paletteColors ) {\n\t\t\tconst normalizedColorValue = currentValueIsCssVariable\n\t\t\t\t? colorValue\n\t\t\t\t: colord( colorValue ).toHex();\n\n\t\t\tif ( normalizedCurrentValue === normalizedColorValue ) {\n\t\t\t\treturn colorName;\n\t\t\t}\n\t\t}\n\t}\n\n\t// translators: shown when the user has picked a custom color (i.e not in the palette of colors).\n\treturn __( 'Custom' );\n};\n\nexport const showTransparentBackground = ( currentValue ) => {\n\tif ( typeof currentValue === 'undefined' ) {\n\t\treturn true;\n\t}\n\treturn colord( currentValue ).alpha() === 0;\n};\n\nexport default function ColorPalette( {\n\tclearable = true,\n\tclassName,\n\tcolors,\n\tdisableCustomColors = false,\n\tenableAlpha,\n\tonChange,\n\tvalue,\n\t__experimentalHasMultipleOrigins = false,\n\t__experimentalIsRenderedInSidebar = false,\n} ) {\n\tconst clearColor = useCallback( () => onChange( undefined ), [ onChange ] );\n\tconst showMultiplePalettes =\n\t\t__experimentalHasMultipleOrigins && colors?.length;\n\tconst Component = showMultiplePalettes ? MultiplePalettes : SinglePalette;\n\n\tconst renderCustomColorPicker = () => (\n\t\t<DropdownContentWrapper paddingSize=\"none\">\n\t\t\t<ColorPicker\n\t\t\t\tcolor={ value }\n\t\t\t\tonChange={ ( color ) => onChange( color ) }\n\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t/>\n\t\t</DropdownContentWrapper>\n\t);\n\n\tconst colordColor = colord( value );\n\n\tconst valueWithoutLeadingHash = value?.startsWith( '#' )\n\t\t? value.substring( 1 )\n\t\t: value ?? '';\n\tconst buttonLabelName = useMemo(\n\t\t() =>\n\t\t\textractColorNameFromCurrentValue(\n\t\t\t\tvalue,\n\t\t\t\tcolors,\n\t\t\t\tshowMultiplePalettes\n\t\t\t),\n\t\t[ value, colors, showMultiplePalettes ]\n\t);\n\n\tconst customColorAccessibleLabel = !! valueWithoutLeadingHash\n\t\t? sprintf(\n\t\t\t\t// translators: %1$s: The name of the color e.g: \"vivid red\". %2$s: The color's hex code e.g: \"#f00\".\n\t\t\t\t__(\n\t\t\t\t\t'Custom color picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'\n\t\t\t\t),\n\t\t\t\tbuttonLabelName,\n\t\t\t\tvalueWithoutLeadingHash\n\t\t )\n\t\t: __( 'Custom color picker.' );\n\n\treturn (\n\t\t<VStack spacing={ 3 } className={ className }>\n\t\t\t{ ! disableCustomColors && (\n\t\t\t\t<CustomColorPickerDropdown\n\t\t\t\t\tisRenderedInSidebar={ __experimentalIsRenderedInSidebar }\n\t\t\t\t\trenderContent={ renderCustomColorPicker }\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<Flex\n\t\t\t\t\t\t\tas={ 'button' }\n\t\t\t\t\t\t\tjustify=\"space-between\"\n\t\t\t\t\t\t\talign=\"flex-start\"\n\t\t\t\t\t\t\tclassName=\"components-color-palette__custom-color\"\n\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\taria-label={ customColorAccessibleLabel }\n\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\tshowTransparentBackground( value )\n\t\t\t\t\t\t\t\t\t? { color: '#000' }\n\t\t\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\t\t\tbackground: value,\n\t\t\t\t\t\t\t\t\t\t\tcolor:\n\t\t\t\t\t\t\t\t\t\t\t\tcolordColor.contrast() >\n\t\t\t\t\t\t\t\t\t\t\t\tcolordColor.contrast( '#000' )\n\t\t\t\t\t\t\t\t\t\t\t\t\t? '#fff'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: '#000',\n\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<FlexItem\n\t\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\t\tas={ Truncate }\n\t\t\t\t\t\t\t\tclassName=\"components-color-palette__custom-color-name\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ buttonLabelName }\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t<FlexItem\n\t\t\t\t\t\t\t\tas=\"span\"\n\t\t\t\t\t\t\t\tclassName=\"components-color-palette__custom-color-value\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ valueWithoutLeadingHash }\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t</Flex>\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<Component\n\t\t\t\tclearable={ clearable }\n\t\t\t\tclearColor={ clearColor }\n\t\t\t\tcolors={ colors }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tvalue={ value }\n\t\t\t\tactions={\n\t\t\t\t\t!! clearable && (\n\t\t\t\t\t\t<CircularOptionPicker.ButtonAction\n\t\t\t\t\t\t\tonClick={ clearColor }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Clear' ) }\n\t\t\t\t\t\t</CircularOptionPicker.ButtonAction>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t/>\n\t\t</VStack>\n\t);\n}\n"]}
@@ -38,7 +38,8 @@ const InputWithSlider = _ref => {
38
38
  max: max,
39
39
  label: label,
40
40
  hideLabelFromVision: true,
41
- value: value,
41
+ value: value // @ts-expect-error TODO: Resolve discrepancy in NumberControl
42
+ ,
42
43
  onChange: onChange,
43
44
  prefix: (0, _element.createElement)(_spacer.Spacer, {
44
45
  as: _text.Text,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/color-picker/input-with-slider.tsx"],"names":["InputWithSlider","min","max","label","abbreviation","onChange","value","Text","COLORS","ui","theme"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AARA;AACA;AACA;AAiBO,MAAMA,eAAe,GAAG,QAOF;AAAA,MAPI;AAChCC,IAAAA,GADgC;AAEhCC,IAAAA,GAFgC;AAGhCC,IAAAA,KAHgC;AAIhCC,IAAAA,YAJgC;AAKhCC,IAAAA,QALgC;AAMhCC,IAAAA;AANgC,GAOJ;AAC5B,SACC,4BAAC,cAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,4BAAC,4BAAD;AACC,IAAA,GAAG,EAAGL,GADP;AAEC,IAAA,GAAG,EAAGC,GAFP;AAGC,IAAA,KAAK,EAAGC,KAHT;AAIC,IAAA,mBAAmB,MAJpB;AAKC,IAAA,KAAK,EAAGG,KALT;AAMC,IAAA,QAAQ,EAAGD,QANZ;AAOC,IAAA,MAAM,EACL,4BAAC,cAAD;AACC,MAAA,EAAE,EAAGE,UADN;AAEC,MAAA,WAAW,EAAG,kBAAO,CAAP,CAFf;AAGC,MAAA,KAAK,EAAGC,qBAAOC,EAAP,CAAUC,KAHnB;AAIC,MAAA,UAAU,EAAG;AAJd,OAMGN,YANH,CARF;AAiBC,IAAA,cAAc,MAjBf;AAkBC,IAAA,IAAI,EAAC;AAlBN,IADD,EAqBC,4BAAC,oBAAD;AACC,IAAA,KAAK,EAAGD,KADT;AAEC,IAAA,mBAAmB,MAFpB;AAGC,IAAA,GAAG,EAAGF,GAHP;AAIC,IAAA,GAAG,EAAGC,GAJP;AAKC,IAAA,KAAK,EAAGI,KALT,CAMC;AACA;AAPD;AAQC,IAAA,QAAQ,EAAGD,QARZ;AASC,IAAA,cAAc,EAAG;AATlB,IArBD,CADD;AAmCA,CA3CM","sourcesContent":["/**\n * Internal dependencies\n */\nimport { HStack } from '../h-stack';\nimport { Text } from '../text';\nimport { Spacer } from '../spacer';\nimport { space } from '../ui/utils/space';\nimport { RangeControl, NumberControlWrapper } from './styles';\nimport { COLORS } from '../utils/colors-values';\n\ninterface InputWithSliderProps {\n\tmin: number;\n\tmax: number;\n\tvalue: number;\n\tlabel: string;\n\tabbreviation: string;\n\tonChange: ( value: number ) => void;\n}\n\nexport const InputWithSlider = ( {\n\tmin,\n\tmax,\n\tlabel,\n\tabbreviation,\n\tonChange,\n\tvalue,\n}: InputWithSliderProps ) => {\n\treturn (\n\t\t<HStack spacing={ 4 }>\n\t\t\t<NumberControlWrapper\n\t\t\t\tmin={ min }\n\t\t\t\tmax={ max }\n\t\t\t\tlabel={ label }\n\t\t\t\thideLabelFromVision\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tprefix={\n\t\t\t\t\t<Spacer\n\t\t\t\t\t\tas={ Text }\n\t\t\t\t\t\tpaddingLeft={ space( 4 ) }\n\t\t\t\t\t\tcolor={ COLORS.ui.theme }\n\t\t\t\t\t\tlineHeight={ 1 }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ abbreviation }\n\t\t\t\t\t</Spacer>\n\t\t\t\t}\n\t\t\t\thideHTMLArrows\n\t\t\t\tsize=\"__unstable-large\"\n\t\t\t/>\n\t\t\t<RangeControl\n\t\t\t\tlabel={ label }\n\t\t\t\thideLabelFromVision\n\t\t\t\tmin={ min }\n\t\t\t\tmax={ max }\n\t\t\t\tvalue={ value }\n\t\t\t\t// @ts-expect-error\n\t\t\t\t// See: https://github.com/WordPress/gutenberg/pull/40535#issuecomment-1172418185\n\t\t\t\tonChange={ onChange }\n\t\t\t\twithInputField={ false }\n\t\t\t/>\n\t\t</HStack>\n\t);\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/color-picker/input-with-slider.tsx"],"names":["InputWithSlider","min","max","label","abbreviation","onChange","value","Text","COLORS","ui","theme"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AARA;AACA;AACA;AAiBO,MAAMA,eAAe,GAAG,QAOF;AAAA,MAPI;AAChCC,IAAAA,GADgC;AAEhCC,IAAAA,GAFgC;AAGhCC,IAAAA,KAHgC;AAIhCC,IAAAA,YAJgC;AAKhCC,IAAAA,QALgC;AAMhCC,IAAAA;AANgC,GAOJ;AAC5B,SACC,4BAAC,cAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,4BAAC,4BAAD;AACC,IAAA,GAAG,EAAGL,GADP;AAEC,IAAA,GAAG,EAAGC,GAFP;AAGC,IAAA,KAAK,EAAGC,KAHT;AAIC,IAAA,mBAAmB,MAJpB;AAKC,IAAA,KAAK,EAAGG,KALT,CAMC;AAND;AAOC,IAAA,QAAQ,EAAGD,QAPZ;AAQC,IAAA,MAAM,EACL,4BAAC,cAAD;AACC,MAAA,EAAE,EAAGE,UADN;AAEC,MAAA,WAAW,EAAG,kBAAO,CAAP,CAFf;AAGC,MAAA,KAAK,EAAGC,qBAAOC,EAAP,CAAUC,KAHnB;AAIC,MAAA,UAAU,EAAG;AAJd,OAMGN,YANH,CATF;AAkBC,IAAA,cAAc,MAlBf;AAmBC,IAAA,IAAI,EAAC;AAnBN,IADD,EAsBC,4BAAC,oBAAD;AACC,IAAA,KAAK,EAAGD,KADT;AAEC,IAAA,mBAAmB,MAFpB;AAGC,IAAA,GAAG,EAAGF,GAHP;AAIC,IAAA,GAAG,EAAGC,GAJP;AAKC,IAAA,KAAK,EAAGI,KALT,CAMC;AACA;AAPD;AAQC,IAAA,QAAQ,EAAGD,QARZ;AASC,IAAA,cAAc,EAAG;AATlB,IAtBD,CADD;AAoCA,CA5CM","sourcesContent":["/**\n * Internal dependencies\n */\nimport { HStack } from '../h-stack';\nimport { Text } from '../text';\nimport { Spacer } from '../spacer';\nimport { space } from '../ui/utils/space';\nimport { RangeControl, NumberControlWrapper } from './styles';\nimport { COLORS } from '../utils/colors-values';\n\ninterface InputWithSliderProps {\n\tmin: number;\n\tmax: number;\n\tvalue: number;\n\tlabel: string;\n\tabbreviation: string;\n\tonChange: ( value: number ) => void;\n}\n\nexport const InputWithSlider = ( {\n\tmin,\n\tmax,\n\tlabel,\n\tabbreviation,\n\tonChange,\n\tvalue,\n}: InputWithSliderProps ) => {\n\treturn (\n\t\t<HStack spacing={ 4 }>\n\t\t\t<NumberControlWrapper\n\t\t\t\tmin={ min }\n\t\t\t\tmax={ max }\n\t\t\t\tlabel={ label }\n\t\t\t\thideLabelFromVision\n\t\t\t\tvalue={ value }\n\t\t\t\t// @ts-expect-error TODO: Resolve discrepancy in NumberControl\n\t\t\t\tonChange={ onChange }\n\t\t\t\tprefix={\n\t\t\t\t\t<Spacer\n\t\t\t\t\t\tas={ Text }\n\t\t\t\t\t\tpaddingLeft={ space( 4 ) }\n\t\t\t\t\t\tcolor={ COLORS.ui.theme }\n\t\t\t\t\t\tlineHeight={ 1 }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ abbreviation }\n\t\t\t\t\t</Spacer>\n\t\t\t\t}\n\t\t\t\thideHTMLArrows\n\t\t\t\tsize=\"__unstable-large\"\n\t\t\t/>\n\t\t\t<RangeControl\n\t\t\t\tlabel={ label }\n\t\t\t\thideLabelFromVision\n\t\t\t\tmin={ min }\n\t\t\t\tmax={ max }\n\t\t\t\tvalue={ value }\n\t\t\t\t// @ts-expect-error\n\t\t\t\t// See: https://github.com/WordPress/gutenberg/pull/40535#issuecomment-1172418185\n\t\t\t\tonChange={ onChange }\n\t\t\t\twithInputField={ false }\n\t\t\t/>\n\t\t</HStack>\n\t);\n};\n"]}
@@ -111,7 +111,7 @@ function ComboboxControl(_ref) {
111
111
  }
112
112
  });
113
113
  return startsWithMatch.concat(containsMatch);
114
- }, [inputValue, options, value]);
114
+ }, [inputValue, options]);
115
115
 
116
116
  const onSuggestionSelected = newSelectedSuggestion => {
117
117
  setValue(newSelectedSuggestion.value);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/combobox-control/index.js"],"names":["noop","DetectOutside","Component","handleFocusOutside","event","props","onFocusOutside","render","children","ComboboxControl","__nextHasNoMarginBottom","__next36pxDefaultSize","value","valueProp","label","options","onChange","onChangeProp","onFilterValueChange","hideLabelFromVision","help","allowReset","className","messages","selected","__experimentalRenderItem","setValue","currentOption","find","option","currentLabel","instanceId","selectedSuggestion","setSelectedSuggestion","isExpanded","setIsExpanded","inputHasFocus","setInputHasFocus","inputValue","setInputValue","inputContainer","matchingSuggestions","startsWithMatch","containsMatch","match","forEach","index","indexOf","push","concat","onSuggestionSelected","newSelectedSuggestion","handleArrowNavigation","offset","nextIndex","length","onKeyDown","preventDefault","defaultPrevented","code","onBlur","onFocus","onInputChange","text","handleOnReset","current","focus","hasMatchingSuggestions","hasSelectedMatchingSuggestions","message","closeSmall","suggestion"],"mappings":";;;;;;;;;AASA;;AANA;;AAKA;;AAQA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA/BA;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;AAWA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,MAAMC,aAAa,GAAG,+BACrB,cAAcC,kBAAd,CAAwB;AACvBC,EAAAA,kBAAkB,CAAEC,KAAF,EAAU;AAC3B,SAAKC,KAAL,CAAWC,cAAX,CAA2BF,KAA3B;AACA;;AAEDG,EAAAA,MAAM,GAAG;AACR,WAAO,KAAKF,KAAL,CAAWG,QAAlB;AACA;;AAPsB,CADH,CAAtB;;AAYA,SAASC,eAAT,OAiBI;AAAA;;AAAA,MAjBsB;AACzB;AACAC,IAAAA,uBAAuB,GAAG,KAFD;AAGzBC,IAAAA,qBAHyB;AAIzBC,IAAAA,KAAK,EAAEC,SAJkB;AAKzBC,IAAAA,KALyB;AAMzBC,IAAAA,OANyB;AAOzBC,IAAAA,QAAQ,EAAEC,YAPe;AAQzBC,IAAAA,mBAAmB,GAAGlB,IARG;AASzBmB,IAAAA,mBATyB;AAUzBC,IAAAA,IAVyB;AAWzBC,IAAAA,UAAU,GAAG,IAXY;AAYzBC,IAAAA,SAZyB;AAazBC,IAAAA,QAAQ,GAAG;AACVC,MAAAA,QAAQ,EAAE,cAAI,gBAAJ;AADA,KAbc;AAgBzBC,IAAAA;AAhByB,GAiBtB;AACH,QAAM,CAAEb,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n/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tComponent,\n\tuseState,\n\tuseMemo,\n\tuseRef,\n\tuseEffect,\n} from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport { closeSmall } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { InputWrapperFlex } from './styles';\nimport TokenInput from '../form-token-field/token-input';\nimport SuggestionsList from '../form-token-field/suggestions-list';\nimport BaseControl from '../base-control';\nimport Button from '../button';\nimport { FlexBlock, FlexItem } from '../flex';\nimport withFocusOutside from '../higher-order/with-focus-outside';\nimport { useControlledValue } from '../utils/hooks';\nimport { normalizeTextString } from '../utils/strings';\n\nconst noop = () => {};\n\nconst DetectOutside = withFocusOutside(\n\tclass extends Component {\n\t\thandleFocusOutside( event ) {\n\t\t\tthis.props.onFocusOutside( event );\n\t\t}\n\n\t\trender() {\n\t\t\treturn this.props.children;\n\t\t}\n\t}\n);\n\nfunction ComboboxControl( {\n\t/** Start opting into the new margin-free styles that will become the default in a future version. */\n\t__nextHasNoMarginBottom = false,\n\t__next36pxDefaultSize,\n\tvalue: valueProp,\n\tlabel,\n\toptions,\n\tonChange: onChangeProp,\n\tonFilterValueChange = noop,\n\thideLabelFromVision,\n\thelp,\n\tallowReset = true,\n\tclassName,\n\tmessages = {\n\t\tselected: __( 'Item selected.' ),\n\t},\n\t__experimentalRenderItem,\n} ) {\n\tconst [ value, setValue ] = useControlledValue( {\n\t\tvalue: valueProp,\n\t\tonChange: onChangeProp,\n\t} );\n\n\tconst currentOption = options.find( ( option ) => option.value === value );\n\tconst currentLabel = currentOption?.label ?? '';\n\t// Use a custom prefix when generating the `instanceId` to avoid having\n\t// duplicate input IDs when rendering this component and `FormTokenField`\n\t// in the same page (see https://github.com/WordPress/gutenberg/issues/42112).\n\tconst instanceId = useInstanceId( ComboboxControl, 'combobox-control' );\n\tconst [ selectedSuggestion, setSelectedSuggestion ] = useState(\n\t\tcurrentOption || null\n\t);\n\tconst [ isExpanded, setIsExpanded ] = useState( false );\n\tconst [ inputHasFocus, setInputHasFocus ] = useState( false );\n\tconst [ inputValue, setInputValue ] = useState( '' );\n\tconst inputContainer = useRef();\n\n\tconst matchingSuggestions = useMemo( () => {\n\t\tconst startsWithMatch = [];\n\t\tconst containsMatch = [];\n\t\tconst match = normalizeTextString( inputValue );\n\t\toptions.forEach( ( option ) => {\n\t\t\tconst index = normalizeTextString( option.label ).indexOf( match );\n\t\t\tif ( index === 0 ) {\n\t\t\t\tstartsWithMatch.push( option );\n\t\t\t} else if ( index > 0 ) {\n\t\t\t\tcontainsMatch.push( option );\n\t\t\t}\n\t\t} );\n\n\t\treturn startsWithMatch.concat( containsMatch );\n\t}, [ inputValue, options, value ] );\n\n\tconst onSuggestionSelected = ( newSelectedSuggestion ) => {\n\t\tsetValue( newSelectedSuggestion.value );\n\t\tspeak( messages.selected, 'assertive' );\n\t\tsetSelectedSuggestion( newSelectedSuggestion );\n\t\tsetInputValue( '' );\n\t\tsetIsExpanded( false );\n\t};\n\n\tconst handleArrowNavigation = ( offset = 1 ) => {\n\t\tconst index = matchingSuggestions.indexOf( selectedSuggestion );\n\t\tlet nextIndex = index + offset;\n\t\tif ( nextIndex < 0 ) {\n\t\t\tnextIndex = matchingSuggestions.length - 1;\n\t\t} else if ( nextIndex >= matchingSuggestions.length ) {\n\t\t\tnextIndex = 0;\n\t\t}\n\t\tsetSelectedSuggestion( matchingSuggestions[ nextIndex ] );\n\t\tsetIsExpanded( true );\n\t};\n\n\tconst onKeyDown = ( event ) => {\n\t\tlet preventDefault = false;\n\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\tswitch ( event.code ) {\n\t\t\tcase 'Enter':\n\t\t\t\tif ( selectedSuggestion ) {\n\t\t\t\t\tonSuggestionSelected( selectedSuggestion );\n\t\t\t\t\tpreventDefault = true;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'ArrowUp':\n\t\t\t\thandleArrowNavigation( -1 );\n\t\t\t\tpreventDefault = true;\n\t\t\t\tbreak;\n\t\t\tcase 'ArrowDown':\n\t\t\t\thandleArrowNavigation( 1 );\n\t\t\t\tpreventDefault = true;\n\t\t\t\tbreak;\n\t\t\tcase 'Escape':\n\t\t\t\tsetIsExpanded( false );\n\t\t\t\tsetSelectedSuggestion( null );\n\t\t\t\tpreventDefault = true;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif ( preventDefault ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t};\n\n\tconst onBlur = () => {\n\t\tsetInputHasFocus( false );\n\t};\n\n\tconst onFocus = () => {\n\t\tsetInputHasFocus( true );\n\t\tsetIsExpanded( true );\n\t\tonFilterValueChange( '' );\n\t\tsetInputValue( '' );\n\t};\n\n\tconst onFocusOutside = () => {\n\t\tsetIsExpanded( false );\n\t};\n\n\tconst onInputChange = ( event ) => {\n\t\tconst text = event.value;\n\t\tsetInputValue( text );\n\t\tonFilterValueChange( text );\n\t\tif ( inputHasFocus ) {\n\t\t\tsetIsExpanded( true );\n\t\t}\n\t};\n\n\tconst handleOnReset = () => {\n\t\tsetValue( null );\n\t\tinputContainer.current.focus();\n\t};\n\n\t// Update current selections when the filter input changes.\n\tuseEffect( () => {\n\t\tconst hasMatchingSuggestions = matchingSuggestions.length > 0;\n\t\tconst hasSelectedMatchingSuggestions =\n\t\t\tmatchingSuggestions.indexOf( selectedSuggestion ) > 0;\n\n\t\tif ( hasMatchingSuggestions && ! hasSelectedMatchingSuggestions ) {\n\t\t\t// If the current selection isn't present in the list of suggestions, then automatically select the first item from the list of suggestions.\n\t\t\tsetSelectedSuggestion( matchingSuggestions[ 0 ] );\n\t\t}\n\t}, [ matchingSuggestions, selectedSuggestion ] );\n\n\t// Announcements.\n\tuseEffect( () => {\n\t\tconst hasMatchingSuggestions = matchingSuggestions.length > 0;\n\t\tif ( isExpanded ) {\n\t\t\tconst message = hasMatchingSuggestions\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %d: number of results. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d result found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\t'%d results found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\tmatchingSuggestions.length\n\t\t\t\t\t\t),\n\t\t\t\t\t\tmatchingSuggestions.length\n\t\t\t\t )\n\t\t\t\t: __( 'No results.' );\n\n\t\t\tspeak( message, 'polite' );\n\t\t}\n\t}, [ matchingSuggestions, isExpanded ] );\n\n\t// Disable reason: There is no appropriate role which describes the\n\t// input container intended accessible usability.\n\t// TODO: Refactor click detection to use blur to stop propagation.\n\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\treturn (\n\t\t<DetectOutside onFocusOutside={ onFocusOutside }>\n\t\t\t<BaseControl\n\t\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\tclassName,\n\t\t\t\t\t'components-combobox-control'\n\t\t\t\t) }\n\t\t\t\ttabIndex=\"-1\"\n\t\t\t\tlabel={ label }\n\t\t\t\tid={ `components-form-token-input-${ instanceId }` }\n\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t\thelp={ help }\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"components-combobox-control__suggestions-container\"\n\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\t>\n\t\t\t\t\t<InputWrapperFlex\n\t\t\t\t\t\t__next36pxDefaultSize={ __next36pxDefaultSize }\n\t\t\t\t\t>\n\t\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t\t<TokenInput\n\t\t\t\t\t\t\t\tclassName=\"components-combobox-control__input\"\n\t\t\t\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\t\t\t\tref={ inputContainer }\n\t\t\t\t\t\t\t\tvalue={ isExpanded ? inputValue : currentLabel }\n\t\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\t\tcurrentLabel\n\t\t\t\t\t\t\t\t\t\t? `${ currentLabel }, ${ label }`\n\t\t\t\t\t\t\t\t\t\t: null\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\tonBlur={ onBlur }\n\t\t\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t\t\tselectedSuggestionIndex={ matchingSuggestions.indexOf(\n\t\t\t\t\t\t\t\t\tselectedSuggestion\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonChange={ onInputChange }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t\t{ allowReset && (\n\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tclassName=\"components-combobox-control__reset\"\n\t\t\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\t\t\tdisabled={ ! value }\n\t\t\t\t\t\t\t\t\tonClick={ handleOnReset }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Reset' ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</InputWrapperFlex>\n\t\t\t\t\t{ isExpanded && (\n\t\t\t\t\t\t<SuggestionsList\n\t\t\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\t\t\tmatch={ { label: inputValue } }\n\t\t\t\t\t\t\tdisplayTransform={ ( suggestion ) =>\n\t\t\t\t\t\t\t\tsuggestion.label\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsuggestions={ matchingSuggestions }\n\t\t\t\t\t\t\tselectedIndex={ matchingSuggestions.indexOf(\n\t\t\t\t\t\t\t\tselectedSuggestion\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonHover={ setSelectedSuggestion }\n\t\t\t\t\t\t\tonSelect={ onSuggestionSelected }\n\t\t\t\t\t\t\tscrollIntoView\n\t\t\t\t\t\t\t__experimentalRenderItem={\n\t\t\t\t\t\t\t\t__experimentalRenderItem\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</BaseControl>\n\t\t</DetectOutside>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n}\n\nexport default ComboboxControl;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/combobox-control/index.js"],"names":["noop","DetectOutside","Component","handleFocusOutside","event","props","onFocusOutside","render","children","ComboboxControl","__nextHasNoMarginBottom","__next36pxDefaultSize","value","valueProp","label","options","onChange","onChangeProp","onFilterValueChange","hideLabelFromVision","help","allowReset","className","messages","selected","__experimentalRenderItem","setValue","currentOption","find","option","currentLabel","instanceId","selectedSuggestion","setSelectedSuggestion","isExpanded","setIsExpanded","inputHasFocus","setInputHasFocus","inputValue","setInputValue","inputContainer","matchingSuggestions","startsWithMatch","containsMatch","match","forEach","index","indexOf","push","concat","onSuggestionSelected","newSelectedSuggestion","handleArrowNavigation","offset","nextIndex","length","onKeyDown","preventDefault","defaultPrevented","code","onBlur","onFocus","onInputChange","text","handleOnReset","current","focus","hasMatchingSuggestions","hasSelectedMatchingSuggestions","message","closeSmall","suggestion"],"mappings":";;;;;;;;;AASA;;AANA;;AAKA;;AAQA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA/BA;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;AAWA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,MAAMC,aAAa,GAAG,+BACrB,cAAcC,kBAAd,CAAwB;AACvBC,EAAAA,kBAAkB,CAAEC,KAAF,EAAU;AAC3B,SAAKC,KAAL,CAAWC,cAAX,CAA2BF,KAA3B;AACA;;AAE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X;AAKC,IAAA,KAAK,EAAG,cAAI,OAAJ;AALT,IADD,CAxBF,CALD,EAwCG9B,UAAU,IACX,4BAAC,wBAAD;AACC,IAAA,UAAU,EAAGH,UADd;AAEC,IAAA,KAAK,EAAG;AAAEjB,MAAAA,KAAK,EAAEwB;AAAT,KAFT;AAGC,IAAA,gBAAgB,EAAKiC,UAAF,IAClBA,UAAU,CAACzD,KAJb;AAMC,IAAA,WAAW,EAAG2B,mBANf;AAOC,IAAA,aAAa,EAAGA,mBAAmB,CAACM,OAApB,CACff,kBADe,CAPjB;AAUC,IAAA,OAAO,EAAGC,qBAVX;AAWC,IAAA,QAAQ,EAAGiB,oBAXZ;AAYC,IAAA,cAAc,MAZf;AAaC,IAAA,wBAAwB,EACvBzB;AAdF,IAzCF,CAZD,CADD,CADD;AA6EA;AACA;;eAEchB,e","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tComponent,\n\tuseState,\n\tuseMemo,\n\tuseRef,\n\tuseEffect,\n} from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport { closeSmall } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { InputWrapperFlex } from './styles';\nimport TokenInput from '../form-token-field/token-input';\nimport SuggestionsList from '../form-token-field/suggestions-list';\nimport BaseControl from '../base-control';\nimport Button from '../button';\nimport { FlexBlock, FlexItem } from '../flex';\nimport withFocusOutside from '../higher-order/with-focus-outside';\nimport { useControlledValue } from '../utils/hooks';\nimport { normalizeTextString } from '../utils/strings';\n\nconst noop = () => {};\n\nconst DetectOutside = withFocusOutside(\n\tclass extends Component {\n\t\thandleFocusOutside( event ) {\n\t\t\tthis.props.onFocusOutside( event );\n\t\t}\n\n\t\trender() {\n\t\t\treturn this.props.children;\n\t\t}\n\t}\n);\n\nfunction ComboboxControl( {\n\t/** Start opting into the new margin-free styles that will become the default in a future version. */\n\t__nextHasNoMarginBottom = false,\n\t__next36pxDefaultSize,\n\tvalue: valueProp,\n\tlabel,\n\toptions,\n\tonChange: onChangeProp,\n\tonFilterValueChange = noop,\n\thideLabelFromVision,\n\thelp,\n\tallowReset = true,\n\tclassName,\n\tmessages = {\n\t\tselected: __( 'Item selected.' ),\n\t},\n\t__experimentalRenderItem,\n} ) {\n\tconst [ value, setValue ] = useControlledValue( {\n\t\tvalue: valueProp,\n\t\tonChange: onChangeProp,\n\t} );\n\n\tconst currentOption = options.find( ( option ) => option.value === value );\n\tconst currentLabel = currentOption?.label ?? '';\n\t// Use a custom prefix when generating the `instanceId` to avoid having\n\t// duplicate input IDs when rendering this component and `FormTokenField`\n\t// in the same page (see https://github.com/WordPress/gutenberg/issues/42112).\n\tconst instanceId = useInstanceId( ComboboxControl, 'combobox-control' );\n\tconst [ selectedSuggestion, setSelectedSuggestion ] = useState(\n\t\tcurrentOption || null\n\t);\n\tconst [ isExpanded, setIsExpanded ] = useState( false );\n\tconst [ inputHasFocus, setInputHasFocus ] = useState( false );\n\tconst [ inputValue, setInputValue ] = useState( '' );\n\tconst inputContainer = useRef();\n\n\tconst matchingSuggestions = useMemo( () => {\n\t\tconst startsWithMatch = [];\n\t\tconst containsMatch = [];\n\t\tconst match = normalizeTextString( inputValue );\n\t\toptions.forEach( ( option ) => {\n\t\t\tconst index = normalizeTextString( option.label ).indexOf( match );\n\t\t\tif ( index === 0 ) {\n\t\t\t\tstartsWithMatch.push( option );\n\t\t\t} else if ( index > 0 ) {\n\t\t\t\tcontainsMatch.push( option );\n\t\t\t}\n\t\t} );\n\n\t\treturn startsWithMatch.concat( containsMatch );\n\t}, [ inputValue, options ] );\n\n\tconst onSuggestionSelected = ( newSelectedSuggestion ) => {\n\t\tsetValue( newSelectedSuggestion.value );\n\t\tspeak( messages.selected, 'assertive' );\n\t\tsetSelectedSuggestion( newSelectedSuggestion );\n\t\tsetInputValue( '' );\n\t\tsetIsExpanded( false );\n\t};\n\n\tconst handleArrowNavigation = ( offset = 1 ) => {\n\t\tconst index = matchingSuggestions.indexOf( selectedSuggestion );\n\t\tlet nextIndex = index + offset;\n\t\tif ( nextIndex < 0 ) {\n\t\t\tnextIndex = matchingSuggestions.length - 1;\n\t\t} else if ( nextIndex >= matchingSuggestions.length ) {\n\t\t\tnextIndex = 0;\n\t\t}\n\t\tsetSelectedSuggestion( matchingSuggestions[ nextIndex ] );\n\t\tsetIsExpanded( true );\n\t};\n\n\tconst onKeyDown = ( event ) => {\n\t\tlet preventDefault = false;\n\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\tswitch ( event.code ) {\n\t\t\tcase 'Enter':\n\t\t\t\tif ( selectedSuggestion ) {\n\t\t\t\t\tonSuggestionSelected( selectedSuggestion );\n\t\t\t\t\tpreventDefault = true;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'ArrowUp':\n\t\t\t\thandleArrowNavigation( -1 );\n\t\t\t\tpreventDefault = true;\n\t\t\t\tbreak;\n\t\t\tcase 'ArrowDown':\n\t\t\t\thandleArrowNavigation( 1 );\n\t\t\t\tpreventDefault = true;\n\t\t\t\tbreak;\n\t\t\tcase 'Escape':\n\t\t\t\tsetIsExpanded( false );\n\t\t\t\tsetSelectedSuggestion( null );\n\t\t\t\tpreventDefault = true;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif ( preventDefault ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t};\n\n\tconst onBlur = () => {\n\t\tsetInputHasFocus( false );\n\t};\n\n\tconst onFocus = () => {\n\t\tsetInputHasFocus( true );\n\t\tsetIsExpanded( true );\n\t\tonFilterValueChange( '' );\n\t\tsetInputValue( '' );\n\t};\n\n\tconst onFocusOutside = () => {\n\t\tsetIsExpanded( false );\n\t};\n\n\tconst onInputChange = ( event ) => {\n\t\tconst text = event.value;\n\t\tsetInputValue( text );\n\t\tonFilterValueChange( text );\n\t\tif ( inputHasFocus ) {\n\t\t\tsetIsExpanded( true );\n\t\t}\n\t};\n\n\tconst handleOnReset = () => {\n\t\tsetValue( null );\n\t\tinputContainer.current.focus();\n\t};\n\n\t// Update current selections when the filter input changes.\n\tuseEffect( () => {\n\t\tconst hasMatchingSuggestions = matchingSuggestions.length > 0;\n\t\tconst hasSelectedMatchingSuggestions =\n\t\t\tmatchingSuggestions.indexOf( selectedSuggestion ) > 0;\n\n\t\tif ( hasMatchingSuggestions && ! hasSelectedMatchingSuggestions ) {\n\t\t\t// If the current selection isn't present in the list of suggestions, then automatically select the first item from the list of suggestions.\n\t\t\tsetSelectedSuggestion( matchingSuggestions[ 0 ] );\n\t\t}\n\t}, [ matchingSuggestions, selectedSuggestion ] );\n\n\t// Announcements.\n\tuseEffect( () => {\n\t\tconst hasMatchingSuggestions = matchingSuggestions.length > 0;\n\t\tif ( isExpanded ) {\n\t\t\tconst message = hasMatchingSuggestions\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %d: number of results. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d result found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\t'%d results found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\tmatchingSuggestions.length\n\t\t\t\t\t\t),\n\t\t\t\t\t\tmatchingSuggestions.length\n\t\t\t\t )\n\t\t\t\t: __( 'No results.' );\n\n\t\t\tspeak( message, 'polite' );\n\t\t}\n\t}, [ matchingSuggestions, isExpanded ] );\n\n\t// Disable reason: There is no appropriate role which describes the\n\t// input container intended accessible usability.\n\t// TODO: Refactor click detection to use blur to stop propagation.\n\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\treturn (\n\t\t<DetectOutside onFocusOutside={ onFocusOutside }>\n\t\t\t<BaseControl\n\t\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\tclassName,\n\t\t\t\t\t'components-combobox-control'\n\t\t\t\t) }\n\t\t\t\ttabIndex=\"-1\"\n\t\t\t\tlabel={ label }\n\t\t\t\tid={ `components-form-token-input-${ instanceId }` }\n\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t\thelp={ help }\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"components-combobox-control__suggestions-container\"\n\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\t>\n\t\t\t\t\t<InputWrapperFlex\n\t\t\t\t\t\t__next36pxDefaultSize={ __next36pxDefaultSize }\n\t\t\t\t\t>\n\t\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t\t<TokenInput\n\t\t\t\t\t\t\t\tclassName=\"components-combobox-control__input\"\n\t\t\t\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\t\t\t\tref={ inputContainer }\n\t\t\t\t\t\t\t\tvalue={ isExpanded ? inputValue : currentLabel }\n\t\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\t\tcurrentLabel\n\t\t\t\t\t\t\t\t\t\t? `${ currentLabel }, ${ label }`\n\t\t\t\t\t\t\t\t\t\t: null\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\tonBlur={ onBlur }\n\t\t\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t\t\tselectedSuggestionIndex={ matchingSuggestions.indexOf(\n\t\t\t\t\t\t\t\t\tselectedSuggestion\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonChange={ onInputChange }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t\t{ allowReset && (\n\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tclassName=\"components-combobox-control__reset\"\n\t\t\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\t\t\tdisabled={ ! value }\n\t\t\t\t\t\t\t\t\tonClick={ handleOnReset }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Reset' ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</InputWrapperFlex>\n\t\t\t\t\t{ isExpanded && (\n\t\t\t\t\t\t<SuggestionsList\n\t\t\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\t\t\tmatch={ { label: inputValue } }\n\t\t\t\t\t\t\tdisplayTransform={ ( suggestion ) =>\n\t\t\t\t\t\t\t\tsuggestion.label\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsuggestions={ matchingSuggestions }\n\t\t\t\t\t\t\tselectedIndex={ matchingSuggestions.indexOf(\n\t\t\t\t\t\t\t\tselectedSuggestion\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonHover={ setSelectedSuggestion }\n\t\t\t\t\t\t\tonSelect={ onSuggestionSelected }\n\t\t\t\t\t\t\tscrollIntoView\n\t\t\t\t\t\t\t__experimentalRenderItem={\n\t\t\t\t\t\t\t\t__experimentalRenderItem\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</BaseControl>\n\t\t</DetectOutside>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n}\n\nexport default ComboboxControl;\n"]}
@@ -152,7 +152,7 @@ function CustomGradientPicker(_ref3) {
152
152
  }
153
153
 
154
154
  return (0, _element.createElement)(_vStack.VStack, {
155
- spacing: 5,
155
+ spacing: 4,
156
156
  className: (0, _classnames.default)('components-custom-gradient-picker', {
157
157
  'is-next-has-no-margin': __nextHasNoMargin
158
158
  })
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/custom-gradient-picker/index.js"],"names":["GradientAnglePicker","gradientAST","hasGradient","onChange","angle","orientation","value","DEFAULT_LINEAR_GRADIENT_ANGLE","onAngleChange","newAngle","type","GradientTypePicker","onSetLinearGradient","HORIZONTAL_GRADIENT_ORIENTATION","onSetRadialGradient","restGradientAST","handleOnChange","next","GRADIENT_OPTIONS","CustomGradientPicker","__nextHasNoMargin","__experimentalIsRenderedInSidebar","background","DEFAULT_GRADIENT","controlPoints","colorStops","map","colorStop","color","position","parseInt","length","since","version","hint","newControlPoints"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AAMA;;AAhCA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAwBA,MAAMA,mBAAmB,GAAG,QAA8C;AAAA;;AAAA,MAA5C;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,WAAf;AAA4BC,IAAAA;AAA5B,GAA4C;AACzE,QAAMC,KAAK,4BACVH,WADU,aACVA,WADU,iDACVA,WAAW,CAAEI,WADH,2DACV,uBAA0BC,KADhB,yEACyBC,wCADpC;;AAEA,QAAMC,aAAa,GAAKC,QAAF,IAAgB;AACrCN,IAAAA,QAAQ,CACP,mCAAmB,EAClB,GAAGF,WADe;AAElBI,MAAAA,WAAW,EAAE;AACZK,QAAAA,IAAI,EAAE,SADM;AAEZJ,QAAAA,KAAK,EAAEG;AAFK;AAFK,KAAnB,CADO,CAAR;AASA,GAVD;;AAWA,SACC,4BAAC,2BAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,QAAQ,EAAGD,aAFZ;AAGC,IAAA,aAAa,EAAC,KAHf;AAIC,IAAA,KAAK,EAAGN,WAAW,GAAGE,KAAH,GAAW;AAJ/B,IADD;AAQA,CAtBD;;AAwBA,MAAMO,kBAAkB,GAAG,SAA8C;AAAA,MAA5C;AAAEV,IAAAA,WAAF;AAAeC,IAAAA,WAAf;AAA4BC,IAAAA;AAA5B,GAA4C;AACxE,QAAM;AAAEO,IAAAA;AAAF,MAAWT,WAAjB;;AACA,QAAMW,mBAAmB,GAAG,MAAM;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AW,EAAGC,WAFf;AAGC,IAAA,QAAQ,EAAGC;AAHZ,IAFF,CAXD,CAxBD,CADD;AAgDA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport AnglePickerControl from '../angle-picker-control';\nimport CustomGradientBar from './gradient-bar';\nimport { Flex } from '../flex';\nimport SelectControl from '../select-control';\nimport { VStack } from '../v-stack';\nimport {\n\tgetGradientAstWithDefault,\n\tgetLinearGradientRepresentation,\n\tgetGradientAstWithControlPoints,\n\tgetStopCssColor,\n} from './utils';\nimport { serializeGradient } from './serializer';\nimport {\n\tDEFAULT_LINEAR_GRADIENT_ANGLE,\n\tHORIZONTAL_GRADIENT_ORIENTATION,\n\tGRADIENT_OPTIONS,\n\tDEFAULT_GRADIENT,\n} from './constants';\nimport {\n\tAccessoryWrapper,\n\tSelectWrapper,\n} from './styles/custom-gradient-picker-styles';\n\nconst GradientAnglePicker = ( { gradientAST, hasGradient, onChange } ) => {\n\tconst angle =\n\t\tgradientAST?.orientation?.value ?? DEFAULT_LINEAR_GRADIENT_ANGLE;\n\tconst onAngleChange = ( newAngle ) => {\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...gradientAST,\n\t\t\t\torientation: {\n\t\t\t\t\ttype: 'angular',\n\t\t\t\t\tvalue: newAngle,\n\t\t\t\t},\n\t\t\t} )\n\t\t);\n\t};\n\treturn (\n\t\t<AnglePickerControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tonChange={ onAngleChange }\n\t\t\tlabelPosition=\"top\"\n\t\t\tvalue={ hasGradient ? angle : '' }\n\t\t/>\n\t);\n};\n\nconst GradientTypePicker = ( { gradientAST, hasGradient, onChange } ) => {\n\tconst { type } = gradientAST;\n\tconst onSetLinearGradient = () => {\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...gradientAST,\n\t\t\t\t...( gradientAST.orientation\n\t\t\t\t\t? {}\n\t\t\t\t\t: { orientation: HORIZONTAL_GRADIENT_ORIENTATION } ),\n\t\t\t\ttype: 'linear-gradient',\n\t\t\t} )\n\t\t);\n\t};\n\n\tconst onSetRadialGradient = () => {\n\t\tconst { orientation, ...restGradientAST } = gradientAST;\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...restGradientAST,\n\t\t\t\ttype: 'radial-gradient',\n\t\t\t} )\n\t\t);\n\t};\n\n\tconst handleOnChange = ( next ) => {\n\t\tif ( next === 'linear-gradient' ) {\n\t\t\tonSetLinearGradient();\n\t\t}\n\t\tif ( next === 'radial-gradient' ) {\n\t\t\tonSetRadialGradient();\n\t\t}\n\t};\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName=\"components-custom-gradient-picker__type-picker\"\n\t\t\tlabel={ __( 'Type' ) }\n\t\t\tlabelPosition=\"top\"\n\t\t\tonChange={ handleOnChange }\n\t\t\toptions={ GRADIENT_OPTIONS }\n\t\t\tsize=\"__unstable-large\"\n\t\t\tvalue={ hasGradient && type }\n\t\t/>\n\t);\n};\n\nexport default function CustomGradientPicker( {\n\t/** Start opting into the new margin-free styles that will become the default in a future version. */\n\t__nextHasNoMargin = false,\n\tvalue,\n\tonChange,\n\t__experimentalIsRenderedInSidebar,\n} ) {\n\tconst gradientAST = getGradientAstWithDefault( value );\n\t// On radial gradients the bar should display a linear gradient.\n\t// On radial gradients the bar represents a slice of the gradient from the center until the outside.\n\t// On liner gradients the bar represents the color stops from left to right independently of the angle.\n\tconst background = getLinearGradientRepresentation( gradientAST );\n\tconst hasGradient = gradientAST.value !== DEFAULT_GRADIENT;\n\t// Control points color option may be hex from presets, custom colors will be rgb.\n\t// The position should always be a percentage.\n\tconst controlPoints = gradientAST.colorStops.map( ( colorStop ) => ( {\n\t\tcolor: getStopCssColor( colorStop ),\n\t\tposition: parseInt( colorStop.length.value ),\n\t} ) );\n\n\tif ( ! __nextHasNoMargin ) {\n\t\tdeprecated(\n\t\t\t'Outer margin styles for wp.components.CustomGradientPicker',\n\t\t\t{\n\t\t\t\tsince: '6.1',\n\t\t\t\tversion: '6.4',\n\t\t\t\thint: 'Set the `__nextHasNoMargin` prop to true to start opting into the new styles, which will become the default in a future version',\n\t\t\t}\n\t\t);\n\t}\n\n\treturn (\n\t\t<VStack\n\t\t\tspacing={ 5 }\n\t\t\tclassName={ classnames( 'components-custom-gradient-picker', {\n\t\t\t\t'is-next-has-no-margin': __nextHasNoMargin,\n\t\t\t} ) }\n\t\t>\n\t\t\t<CustomGradientBar\n\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t}\n\t\t\t\tbackground={ background }\n\t\t\t\thasGradient={ hasGradient }\n\t\t\t\tvalue={ controlPoints }\n\t\t\t\tonChange={ ( newControlPoints ) => {\n\t\t\t\t\tonChange(\n\t\t\t\t\t\tserializeGradient(\n\t\t\t\t\t\t\tgetGradientAstWithControlPoints(\n\t\t\t\t\t\t\t\tgradientAST,\n\t\t\t\t\t\t\t\tnewControlPoints\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<Flex\n\t\t\t\tgap={ 3 }\n\t\t\t\tclassName=\"components-custom-gradient-picker__ui-line\"\n\t\t\t>\n\t\t\t\t<SelectWrapper>\n\t\t\t\t\t<GradientTypePicker\n\t\t\t\t\t\tgradientAST={ gradientAST }\n\t\t\t\t\t\thasGradient={ hasGradient }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t/>\n\t\t\t\t</SelectWrapper>\n\t\t\t\t<AccessoryWrapper>\n\t\t\t\t\t{ gradientAST.type === 'linear-gradient' && (\n\t\t\t\t\t\t<GradientAnglePicker\n\t\t\t\t\t\t\tgradientAST={ gradientAST }\n\t\t\t\t\t\t\thasGradient={ hasGradient }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</AccessoryWrapper>\n\t\t\t</Flex>\n\t\t</VStack>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/custom-gradient-picker/index.js"],"names":["GradientAnglePicker","gradientAST","hasGradient","onChange","angle","orientation","value","DEFAULT_LINEAR_GRADIENT_ANGLE","onAngleChange","newAngle","type","GradientTypePicker","onSetLinearGradient","HORIZONTAL_GRADIENT_ORIENTATION","onSetRadialGradient","restGradientAST","handleOnChange","next","GRADIENT_OPTIONS","CustomGradientPicker","__nextHasNoMargin","__experimentalIsRenderedInSidebar","background","DEFAULT_GRADIENT","controlPoints","colorStops","map","colorStop","color","position","parseInt","length","since","version","hint","newControlPoints"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AAMA;;AAhCA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAwBA,MAAMA,mBAAmB,GAAG,QAA8C;AAAA;;AAAA,MAA5C;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,WAAf;AAA4BC,IAAAA;AAA5B,GAA4C;AACzE,QAAMC,KAAK,4BACVH,WADU,aACVA,WADU,iDACVA,WAAW,CAAEI,WADH,2DACV,uBAA0BC,KADhB,yEACyBC,wCADpC;;AAEA,QAAMC,aAAa,GAAKC,QAAF,IAAgB;AACrCN,IAAAA,QAAQ,CACP,mCAAmB,EAClB,GAAGF,WADe;AAElBI,MAAAA,WAAW,EAAE;AACZK,QAAAA,IAAI,EAAE,SADM;AAEZJ,QAAAA,KAAK,EAAEG;AAFK;AAFK,KAAnB,CADO,CAAR;AASA,GAVD;;AAWA,SACC,4BAAC,2BAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,QAAQ,EAAGD,aAFZ;AAGC,IAAA,aAAa,EAAC,KAHf;AAIC,IAAA,KAAK,EAAGN,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CAAD,QACC,4BAAC,kBAAD;AACC,IAAA,WAAW,EAAGlC,WADf;AAEC,IAAA,WAAW,EAAGC,WAFf;AAGC,IAAA,QAAQ,EAAGC;AAHZ,IADD,CAJD,EAWC,4BAAC,4CAAD,QACGF,WAAW,CAACS,IAAZ,KAAqB,iBAArB,IACD,4BAAC,mBAAD;AACC,IAAA,WAAW,EAAGT,WADf;AAEC,IAAA,WAAW,EAAGC,WAFf;AAGC,IAAA,QAAQ,EAAGC;AAHZ,IAFF,CAXD,CAxBD,CADD;AAgDA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport AnglePickerControl from '../angle-picker-control';\nimport CustomGradientBar from './gradient-bar';\nimport { Flex } from '../flex';\nimport SelectControl from '../select-control';\nimport { VStack } from '../v-stack';\nimport {\n\tgetGradientAstWithDefault,\n\tgetLinearGradientRepresentation,\n\tgetGradientAstWithControlPoints,\n\tgetStopCssColor,\n} from './utils';\nimport { serializeGradient } from './serializer';\nimport {\n\tDEFAULT_LINEAR_GRADIENT_ANGLE,\n\tHORIZONTAL_GRADIENT_ORIENTATION,\n\tGRADIENT_OPTIONS,\n\tDEFAULT_GRADIENT,\n} from './constants';\nimport {\n\tAccessoryWrapper,\n\tSelectWrapper,\n} from './styles/custom-gradient-picker-styles';\n\nconst GradientAnglePicker = ( { gradientAST, hasGradient, onChange } ) => {\n\tconst angle =\n\t\tgradientAST?.orientation?.value ?? DEFAULT_LINEAR_GRADIENT_ANGLE;\n\tconst onAngleChange = ( newAngle ) => {\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...gradientAST,\n\t\t\t\torientation: {\n\t\t\t\t\ttype: 'angular',\n\t\t\t\t\tvalue: newAngle,\n\t\t\t\t},\n\t\t\t} )\n\t\t);\n\t};\n\treturn (\n\t\t<AnglePickerControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tonChange={ onAngleChange }\n\t\t\tlabelPosition=\"top\"\n\t\t\tvalue={ hasGradient ? angle : '' }\n\t\t/>\n\t);\n};\n\nconst GradientTypePicker = ( { gradientAST, hasGradient, onChange } ) => {\n\tconst { type } = gradientAST;\n\tconst onSetLinearGradient = () => {\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...gradientAST,\n\t\t\t\t...( gradientAST.orientation\n\t\t\t\t\t? {}\n\t\t\t\t\t: { orientation: HORIZONTAL_GRADIENT_ORIENTATION } ),\n\t\t\t\ttype: 'linear-gradient',\n\t\t\t} )\n\t\t);\n\t};\n\n\tconst onSetRadialGradient = () => {\n\t\tconst { orientation, ...restGradientAST } = gradientAST;\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...restGradientAST,\n\t\t\t\ttype: 'radial-gradient',\n\t\t\t} )\n\t\t);\n\t};\n\n\tconst handleOnChange = ( next ) => {\n\t\tif ( next === 'linear-gradient' ) {\n\t\t\tonSetLinearGradient();\n\t\t}\n\t\tif ( next === 'radial-gradient' ) {\n\t\t\tonSetRadialGradient();\n\t\t}\n\t};\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName=\"components-custom-gradient-picker__type-picker\"\n\t\t\tlabel={ __( 'Type' ) }\n\t\t\tlabelPosition=\"top\"\n\t\t\tonChange={ handleOnChange }\n\t\t\toptions={ GRADIENT_OPTIONS }\n\t\t\tsize=\"__unstable-large\"\n\t\t\tvalue={ hasGradient && type }\n\t\t/>\n\t);\n};\n\nexport default function CustomGradientPicker( {\n\t/** Start opting into the new margin-free styles that will become the default in a future version. */\n\t__nextHasNoMargin = false,\n\tvalue,\n\tonChange,\n\t__experimentalIsRenderedInSidebar,\n} ) {\n\tconst gradientAST = getGradientAstWithDefault( value );\n\t// On radial gradients the bar should display a linear gradient.\n\t// On radial gradients the bar represents a slice of the gradient from the center until the outside.\n\t// On liner gradients the bar represents the color stops from left to right independently of the angle.\n\tconst background = getLinearGradientRepresentation( gradientAST );\n\tconst hasGradient = gradientAST.value !== DEFAULT_GRADIENT;\n\t// Control points color option may be hex from presets, custom colors will be rgb.\n\t// The position should always be a percentage.\n\tconst controlPoints = gradientAST.colorStops.map( ( colorStop ) => ( {\n\t\tcolor: getStopCssColor( colorStop ),\n\t\tposition: parseInt( colorStop.length.value ),\n\t} ) );\n\n\tif ( ! __nextHasNoMargin ) {\n\t\tdeprecated(\n\t\t\t'Outer margin styles for wp.components.CustomGradientPicker',\n\t\t\t{\n\t\t\t\tsince: '6.1',\n\t\t\t\tversion: '6.4',\n\t\t\t\thint: 'Set the `__nextHasNoMargin` prop to true to start opting into the new styles, which will become the default in a future version',\n\t\t\t}\n\t\t);\n\t}\n\n\treturn (\n\t\t<VStack\n\t\t\tspacing={ 4 }\n\t\t\tclassName={ classnames( 'components-custom-gradient-picker', {\n\t\t\t\t'is-next-has-no-margin': __nextHasNoMargin,\n\t\t\t} ) }\n\t\t>\n\t\t\t<CustomGradientBar\n\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t}\n\t\t\t\tbackground={ background }\n\t\t\t\thasGradient={ hasGradient }\n\t\t\t\tvalue={ controlPoints }\n\t\t\t\tonChange={ ( newControlPoints ) => {\n\t\t\t\t\tonChange(\n\t\t\t\t\t\tserializeGradient(\n\t\t\t\t\t\t\tgetGradientAstWithControlPoints(\n\t\t\t\t\t\t\t\tgradientAST,\n\t\t\t\t\t\t\t\tnewControlPoints\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<Flex\n\t\t\t\tgap={ 3 }\n\t\t\t\tclassName=\"components-custom-gradient-picker__ui-line\"\n\t\t\t>\n\t\t\t\t<SelectWrapper>\n\t\t\t\t\t<GradientTypePicker\n\t\t\t\t\t\tgradientAST={ gradientAST }\n\t\t\t\t\t\thasGradient={ hasGradient }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t/>\n\t\t\t\t</SelectWrapper>\n\t\t\t\t<AccessoryWrapper>\n\t\t\t\t\t{ gradientAST.type === 'linear-gradient' && (\n\t\t\t\t\t\t<GradientAnglePicker\n\t\t\t\t\t\t\tgradientAST={ gradientAST }\n\t\t\t\t\t\t\thasGradient={ hasGradient }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</AccessoryWrapper>\n\t\t\t</Flex>\n\t\t</VStack>\n\t);\n}\n"]}
@@ -238,7 +238,7 @@ function Day(_ref2) {
238
238
  function getDayLabel(date, isSelected, numEvents) {
239
239
  const {
240
240
  formats
241
- } = (0, _date.__experimentalGetSettings)();
241
+ } = (0, _date.getSettings)();
242
242
  const localizedDate = (0, _date.dateI18n)(formats.date, date, -date.getTimezoneOffset());
243
243
 
244
244
  if (isSelected && numEvents > 0) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/date-time/date/index.tsx"],"names":["DatePicker","currentDate","onChange","events","isInvalidDate","onMonthPreviewed","startOfWeek","weekStartsOn","date","Date","calendar","viewing","setSelected","setViewing","isSelected","viewPreviousMonth","viewNextMonth","selected","focusable","setFocusable","isFocusWithinCalendar","setIsFocusWithinCalendar","prevCurrentDate","setPrevCurrentDate","arrowRight","arrowLeft","TIMEZONELESS_FORMAT","getTimezoneOffset","map","day","toString","week","index","filter","event","length","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","getMilliseconds","nextFocusable","key","preventDefault","Day","column","isFocusable","isFocusAllowed","isToday","isInvalid","numEvents","onClick","onKeyDown","ref","current","focus","getDayLabel","formats","localizedDate"],"mappings":";;;;;;;;;;AAyBA;;AAtBA;;AACA;;AAkBA;;AACA;;AACA;;AAOA;;AAQA;;AACA;;AACA;;AAzCA;AACA;AACA;;AAiBA;AACA;AACA;;AAsBA;AACA;AACA;AACA;AACA;AACA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,CAAC,CAJ/B;AAKC,kBAAaU,WAAW,CAAE7B,GAAF,EAAOf,UAAP,EAAmBsC,SAAnB,CALzB;AAMC,IAAA,MAAM,EAAGL,MANV;AAOC,IAAA,UAAU,EAAGjC,UAPd;AAQC,IAAA,OAAO,EAAGoC,OARX;AASC,IAAA,SAAS,EAAGE,SAAS,GAAG,CATzB;AAUC,IAAA,OAAO,EAAGC,OAVX;AAWC,IAAA,SAAS,EAAGC;AAXb,KAaG,oBAAU,GAAV,EAAezB,GAAf,EAAoB,CAACA,GAAG,CAACF,iBAAJ,EAArB,CAbH,CADD;AAiBA;;AAED,SAAS+B,WAAT,CAAsBlD,IAAtB,EAAkCM,UAAlC,EAAuDsC,SAAvD,EAA2E;AAC1E,QAAM;AAAEO,IAAAA;AAAF,MAAc,sCAApB;AACA,QAAMC,aAAa,GAAG,oBACrBD,OAAO,CAACnD,IADa,EAErBA,IAFqB,EAGrB,CAACA,IAAI,CAACmB,iBAAL,EAHoB,CAAtB;;AAKA,MAAKb,UAAU,IAAIsC,SAAS,GAAG,CAA/B,EAAmC;AAClC,WAAO,oBACN;AACA,kBACC,qCADD,EAEC,uCAFD,EAGCA,SAHD,CAFM,EAONQ,aAPM,EAQNR,SARM,CAAP;AAUA,GAXD,MAWO,IAAKtC,UAAL,EAAkB;AACxB,WAAO,oBACN;AACA,kBAAI,gBAAJ,CAFM,EAGN8C,aAHM,CAAP;AAKA,GANM,MAMA,IAAKR,SAAS,GAAG,CAAjB,EAAqB;AAC3B,WAAO,oBACN;AACA,kBACC,2BADD,EAEC,6BAFD,EAGCA,SAHD,CAFM,EAONQ,aAPM,EAQNR,SARM,CAAP;AAUA;;AACD,SAAOQ,aAAP;AACA;;eAEc5D,U","sourcesContent":["/**\n * External dependencies\n */\nimport { useLilius } from 'use-lilius';\nimport {\n\tformat,\n\tisSameDay,\n\tsubMonths,\n\taddMonths,\n\tstartOfDay,\n\tisEqual,\n\taddDays,\n\tsubWeeks,\n\taddWeeks,\n\tisSameMonth,\n\tstartOfWeek,\n\tendOfWeek,\n} from 'date-fns';\n\n/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf, isRTL } from '@wordpress/i18n';\nimport { arrowLeft, arrowRight } from '@wordpress/icons';\nimport { dateI18n, __experimentalGetSettings } from '@wordpress/date';\nimport { useState, useRef, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { DatePickerProps } from '../types';\nimport {\n\tWrapper,\n\tNavigator,\n\tNavigatorHeading,\n\tCalendar,\n\tDayOfWeek,\n\tDayButton,\n} from './styles';\nimport { inputToDate } from '../utils';\nimport Button from '../../button';\nimport { TIMEZONELESS_FORMAT } from '../constants';\n\n/**\n * DatePicker is a React component that renders a calendar for date selection.\n *\n * ```jsx\n * import { DatePicker } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyDatePicker = () => {\n * const [ date, setDate ] = useState( new Date() );\n *\n * return (\n * <DatePicker\n * currentDate={ date }\n * onChange={ ( newDate ) => setDate( newDate ) }\n * />\n * );\n * };\n * ```\n */\nexport function DatePicker( {\n\tcurrentDate,\n\tonChange,\n\tevents = [],\n\tisInvalidDate,\n\tonMonthPreviewed,\n\tstartOfWeek: weekStartsOn = 0,\n}: DatePickerProps ) {\n\tconst date = currentDate ? inputToDate( currentDate ) : new Date();\n\n\tconst {\n\t\tcalendar,\n\t\tviewing,\n\t\tsetSelected,\n\t\tsetViewing,\n\t\tisSelected,\n\t\tviewPreviousMonth,\n\t\tviewNextMonth,\n\t} = useLilius( {\n\t\tselected: [ startOfDay( date ) ],\n\t\tviewing: startOfDay( date ),\n\t\tweekStartsOn,\n\t} );\n\n\t// Used to implement a roving tab index. Tracks the day that receives focus\n\t// when the user tabs into the calendar.\n\tconst [ focusable, setFocusable ] = useState( startOfDay( date ) );\n\n\t// Allows us to only programmatically focus() a day when focus was already\n\t// within the calendar. This stops us stealing focus from e.g. a TimePicker\n\t// input.\n\tconst [ isFocusWithinCalendar, setIsFocusWithinCalendar ] =\n\t\tuseState( false );\n\n\t// Update internal state when currentDate prop changes.\n\tconst [ prevCurrentDate, setPrevCurrentDate ] = useState( currentDate );\n\tif ( currentDate !== prevCurrentDate ) {\n\t\tsetPrevCurrentDate( currentDate );\n\t\tsetSelected( [ startOfDay( date ) ] );\n\t\tsetViewing( startOfDay( date ) );\n\t\tsetFocusable( startOfDay( date ) );\n\t}\n\n\treturn (\n\t\t<Wrapper\n\t\t\tclassName=\"components-datetime__date\"\n\t\t\trole=\"application\"\n\t\t\taria-label={ __( 'Calendar' ) }\n\t\t>\n\t\t\t<Navigator>\n\t\t\t\t<Button\n\t\t\t\t\ticon={ isRTL() ? arrowRight : arrowLeft }\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\taria-label={ __( 'View previous month' ) }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tviewPreviousMonth();\n\t\t\t\t\t\tsetFocusable( subMonths( focusable, 1 ) );\n\t\t\t\t\t\tonMonthPreviewed?.(\n\t\t\t\t\t\t\tformat(\n\t\t\t\t\t\t\t\tsubMonths( viewing, 1 ),\n\t\t\t\t\t\t\t\tTIMEZONELESS_FORMAT\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t<NavigatorHeading level={ 3 }>\n\t\t\t\t\t<strong>\n\t\t\t\t\t\t{ dateI18n(\n\t\t\t\t\t\t\t'F',\n\t\t\t\t\t\t\tviewing,\n\t\t\t\t\t\t\t-viewing.getTimezoneOffset()\n\t\t\t\t\t\t) }\n\t\t\t\t\t</strong>{ ' ' }\n\t\t\t\t\t{ dateI18n( 'Y', viewing, -viewing.getTimezoneOffset() ) }\n\t\t\t\t</NavigatorHeading>\n\t\t\t\t<Button\n\t\t\t\t\ticon={ isRTL() ? arrowLeft : arrowRight }\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\taria-label={ __( 'View next month' ) }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tviewNextMonth();\n\t\t\t\t\t\tsetFocusable( addMonths( focusable, 1 ) );\n\t\t\t\t\t\tonMonthPreviewed?.(\n\t\t\t\t\t\t\tformat(\n\t\t\t\t\t\t\t\taddMonths( viewing, 1 ),\n\t\t\t\t\t\t\t\tTIMEZONELESS_FORMAT\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</Navigator>\n\t\t\t<Calendar\n\t\t\t\tonFocus={ () => setIsFocusWithinCalendar( true ) }\n\t\t\t\tonBlur={ () => setIsFocusWithinCalendar( false ) }\n\t\t\t>\n\t\t\t\t{ calendar[ 0 ][ 0 ].map( ( day ) => (\n\t\t\t\t\t<DayOfWeek key={ day.toString() }>\n\t\t\t\t\t\t{ dateI18n( 'D', day, -day.getTimezoneOffset() ) }\n\t\t\t\t\t</DayOfWeek>\n\t\t\t\t) ) }\n\t\t\t\t{ calendar[ 0 ].map( ( week ) =>\n\t\t\t\t\tweek.map( ( day, index ) => {\n\t\t\t\t\t\tif ( ! isSameMonth( day, viewing ) ) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Day\n\t\t\t\t\t\t\t\tkey={ day.toString() }\n\t\t\t\t\t\t\t\tday={ day }\n\t\t\t\t\t\t\t\tcolumn={ index + 1 }\n\t\t\t\t\t\t\t\tisSelected={ isSelected( day ) }\n\t\t\t\t\t\t\t\tisFocusable={ isEqual( day, focusable ) }\n\t\t\t\t\t\t\t\tisFocusAllowed={ isFocusWithinCalendar }\n\t\t\t\t\t\t\t\tisToday={ isSameDay( day, new Date() ) }\n\t\t\t\t\t\t\t\tisInvalid={\n\t\t\t\t\t\t\t\t\tisInvalidDate ? isInvalidDate( day ) : false\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tnumEvents={\n\t\t\t\t\t\t\t\t\tevents.filter( ( event ) =>\n\t\t\t\t\t\t\t\t\t\tisSameDay( event.date, day )\n\t\t\t\t\t\t\t\t\t).length\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tsetSelected( [ day ] );\n\t\t\t\t\t\t\t\t\tsetFocusable( day );\n\t\t\t\t\t\t\t\t\tonChange?.(\n\t\t\t\t\t\t\t\t\t\tformat(\n\t\t\t\t\t\t\t\t\t\t\t// Don't change the selected date's time fields.\n\t\t\t\t\t\t\t\t\t\t\tnew Date(\n\t\t\t\t\t\t\t\t\t\t\t\tday.getFullYear(),\n\t\t\t\t\t\t\t\t\t\t\t\tday.getMonth(),\n\t\t\t\t\t\t\t\t\t\t\t\tday.getDate(),\n\t\t\t\t\t\t\t\t\t\t\t\tdate.getHours(),\n\t\t\t\t\t\t\t\t\t\t\t\tdate.getMinutes(),\n\t\t\t\t\t\t\t\t\t\t\t\tdate.getSeconds(),\n\t\t\t\t\t\t\t\t\t\t\t\tdate.getMilliseconds()\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\tTIMEZONELESS_FORMAT\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\t\t\tlet nextFocusable;\n\t\t\t\t\t\t\t\t\tif ( event.key === 'ArrowLeft' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = addDays(\n\t\t\t\t\t\t\t\t\t\t\tday,\n\t\t\t\t\t\t\t\t\t\t\tisRTL() ? 1 : -1\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( event.key === 'ArrowRight' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = addDays(\n\t\t\t\t\t\t\t\t\t\t\tday,\n\t\t\t\t\t\t\t\t\t\t\tisRTL() ? -1 : 1\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( event.key === 'ArrowUp' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = subWeeks( day, 1 );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( event.key === 'ArrowDown' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = addWeeks( day, 1 );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( event.key === 'PageUp' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = subMonths( day, 1 );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( event.key === 'PageDown' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = addMonths( day, 1 );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( event.key === 'Home' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = startOfWeek( day );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( event.key === 'End' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = startOfDay(\n\t\t\t\t\t\t\t\t\t\t\tendOfWeek( day )\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( nextFocusable ) {\n\t\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\t\tsetFocusable( nextFocusable );\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t! isSameMonth(\n\t\t\t\t\t\t\t\t\t\t\t\tnextFocusable,\n\t\t\t\t\t\t\t\t\t\t\t\tviewing\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\tsetViewing( nextFocusable );\n\t\t\t\t\t\t\t\t\t\t\tonMonthPreviewed?.(\n\t\t\t\t\t\t\t\t\t\t\t\tformat(\n\t\t\t\t\t\t\t\t\t\t\t\t\tnextFocusable,\n\t\t\t\t\t\t\t\t\t\t\t\t\tTIMEZONELESS_FORMAT\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} )\n\t\t\t\t) }\n\t\t\t</Calendar>\n\t\t</Wrapper>\n\t);\n}\n\ntype DayProps = {\n\tday: Date;\n\tcolumn: number;\n\tisSelected: boolean;\n\tisFocusable: boolean;\n\tisFocusAllowed: boolean;\n\tisToday: boolean;\n\tnumEvents: number;\n\tisInvalid: boolean;\n\tonClick: () => void;\n\tonKeyDown: ( event: KeyboardEvent ) => void;\n};\n\nfunction Day( {\n\tday,\n\tcolumn,\n\tisSelected,\n\tisFocusable,\n\tisFocusAllowed,\n\tisToday,\n\tisInvalid,\n\tnumEvents,\n\tonClick,\n\tonKeyDown,\n}: DayProps ) {\n\tconst ref = useRef< HTMLButtonElement >();\n\n\t// Focus the day when it becomes focusable, e.g. because an arrow key is\n\t// pressed. Only do this if focus is allowed - this stops us stealing focus\n\t// from e.g. a TimePicker input.\n\tuseEffect( () => {\n\t\tif ( ref.current && isFocusable && isFocusAllowed ) {\n\t\t\tref.current.focus();\n\t\t}\n\t\t// isFocusAllowed is not a dep as there is no point calling focus() on\n\t\t// an already focused element.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ isFocusable ] );\n\n\treturn (\n\t\t<DayButton\n\t\t\tref={ ref }\n\t\t\tclassName=\"components-datetime__date__day\" // Unused, for backwards compatibility.\n\t\t\tdisabled={ isInvalid }\n\t\t\ttabIndex={ isFocusable ? 0 : -1 }\n\t\t\taria-label={ getDayLabel( day, isSelected, numEvents ) }\n\t\t\tcolumn={ column }\n\t\t\tisSelected={ isSelected }\n\t\t\tisToday={ isToday }\n\t\t\thasEvents={ numEvents > 0 }\n\t\t\tonClick={ onClick }\n\t\t\tonKeyDown={ onKeyDown }\n\t\t>\n\t\t\t{ dateI18n( 'j', day, -day.getTimezoneOffset() ) }\n\t\t</DayButton>\n\t);\n}\n\nfunction getDayLabel( date: Date, isSelected: boolean, numEvents: number ) {\n\tconst { formats } = __experimentalGetSettings();\n\tconst localizedDate = dateI18n(\n\t\tformats.date,\n\t\tdate,\n\t\t-date.getTimezoneOffset()\n\t);\n\tif ( isSelected && numEvents > 0 ) {\n\t\treturn sprintf(\n\t\t\t// translators: 1: The calendar date. 2: Number of events on the calendar date.\n\t\t\t_n(\n\t\t\t\t'%1$s. Selected. There is %2$d event',\n\t\t\t\t'%1$s. Selected. There are %2$d events',\n\t\t\t\tnumEvents\n\t\t\t),\n\t\t\tlocalizedDate,\n\t\t\tnumEvents\n\t\t);\n\t} else if ( isSelected ) {\n\t\treturn sprintf(\n\t\t\t// translators: %s: The calendar date.\n\t\t\t__( '%1$s. Selected' ),\n\t\t\tlocalizedDate\n\t\t);\n\t} else if ( numEvents > 0 ) {\n\t\treturn sprintf(\n\t\t\t// translators: 1: The calendar date. 2: Number of events on the calendar date.\n\t\t\t_n(\n\t\t\t\t'%1$s. There is %2$d event',\n\t\t\t\t'%1$s. There are %2$d events',\n\t\t\t\tnumEvents\n\t\t\t),\n\t\t\tlocalizedDate,\n\t\t\tnumEvents\n\t\t);\n\t}\n\treturn localizedDate;\n}\n\nexport default DatePicker;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/date-time/date/index.tsx"],"names":["DatePicker","currentDate","onChange","events","isInvalidDate","onMonthPreviewed","startOfWeek","weekStartsOn","date","Date","calendar","viewing","setSelected","setViewing","isSelected","viewPreviousMonth","viewNextMonth","selected","focusable","setFocusable","isFocusWithinCalendar","setIsFocusWithinCalendar","prevCurrentDate","setPrevCurrentDate","arrowRight","arrowLeft","TIMEZONELESS_FORMAT","getTimezoneOffset","map","day","toString","week","index","filter","event","length","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","getMilliseconds","nextFocusable","key","preventDefault","Day","column","isFocusable","isFocusAllowed","isToday","isInvalid","numEvents","onClick","onKeyDown","ref","current","focus","getDayLabel","formats","localizedDate"],"mappings":";;;;;;;;;;AAyBA;;AAtBA;;AACA;;AAkBA;;AACA;;AACA;;AAOA;;AAQA;;AACA;;AACA;;AAzCA;AACA;AACA;;AAiBA;AACA;AACA;;AAsBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,UAAT,OAOc;AAAA,MAPO;AAC3BC,IAAAA,WAD2B;AAE3BC,IAAAA,QAF2B;AAG3BC,IAAAA,MAAM,GAAG,EAHkB;AAI3BC,IAAAA,aAJ2B;AAK3BC,IAAAA,gBAL2B;AAM3BC,IAAAA,WAAW,EAAEC,YAAY,GAAG;AAND,GAOP;AACpB,QAAMC,IAAI,GAAGP,WAAW,GAAG,wBAAaA,WAAb,CAAH,GAAgC,IAAIQ,IAAJ,EAAxD;AAEA,QAAM;AACLC,IAAAA,QADK;AAELC,IAAAA,OAFK;AAGLC,IAAAA,WAHK;AAILC,IAAAA,UAJK;AAKLC,IAAAA,UALK;AAMLC,IAAAA,iBANK;AAOLC,IAAAA;AAPK,MAQF,0BAAW;AACdC,IAAAA,QAAQ,EAAE,CAAE,yBAAYT,IAAZ,CAAF,CADI;AAEdG,IAAAA,OAAO,EAAE,yBAAYH,IAAZ,CAFK;AAGdD,IAAAA;AAHc,GAAX,CARJ,CAHoB,CAiBpB;AACA;;AACA,QAAM,CAAEW,SAAF,EAAaC,YAAb,IAA8B,uBAAU,yBAAYX,IAAZ,CAAV,CAApC,CAnBoB,CAqBpB;AACA;AACA;;AACA,QAAM,CAAEY,qBAAF,EAAyBC,wBAAzB,IACL,uBAAU,KAAV,CADD,CAxBoB,CA2BpB;;AACA,QAAM,CAAEC,eAAF,EAAm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jB,EAAqB;AAC3B,WAAO,oBACN;AACA,kBACC,2BADD,EAEC,6BAFD,EAGCA,SAHD,CAFM,EAONQ,aAPM,EAQNR,SARM,CAAP;AAUA;;AACD,SAAOQ,aAAP;AACA;;eAEc5D,U","sourcesContent":["/**\n * External dependencies\n */\nimport { useLilius } from 'use-lilius';\nimport {\n\tformat,\n\tisSameDay,\n\tsubMonths,\n\taddMonths,\n\tstartOfDay,\n\tisEqual,\n\taddDays,\n\tsubWeeks,\n\taddWeeks,\n\tisSameMonth,\n\tstartOfWeek,\n\tendOfWeek,\n} from 'date-fns';\n\n/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf, isRTL } from '@wordpress/i18n';\nimport { arrowLeft, arrowRight } from '@wordpress/icons';\nimport { dateI18n, getSettings } from '@wordpress/date';\nimport { useState, useRef, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { DatePickerProps } from '../types';\nimport {\n\tWrapper,\n\tNavigator,\n\tNavigatorHeading,\n\tCalendar,\n\tDayOfWeek,\n\tDayButton,\n} from './styles';\nimport { inputToDate } from '../utils';\nimport Button from '../../button';\nimport { TIMEZONELESS_FORMAT } from '../constants';\n\n/**\n * DatePicker is a React component that renders a calendar for date selection.\n *\n * ```jsx\n * import { DatePicker } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyDatePicker = () => {\n * const [ date, setDate ] = useState( new Date() );\n *\n * return (\n * <DatePicker\n * currentDate={ date }\n * onChange={ ( newDate ) => setDate( newDate ) }\n * />\n * );\n * };\n * ```\n */\nexport function DatePicker( {\n\tcurrentDate,\n\tonChange,\n\tevents = [],\n\tisInvalidDate,\n\tonMonthPreviewed,\n\tstartOfWeek: weekStartsOn = 0,\n}: DatePickerProps ) {\n\tconst date = currentDate ? inputToDate( currentDate ) : new Date();\n\n\tconst {\n\t\tcalendar,\n\t\tviewing,\n\t\tsetSelected,\n\t\tsetViewing,\n\t\tisSelected,\n\t\tviewPreviousMonth,\n\t\tviewNextMonth,\n\t} = useLilius( {\n\t\tselected: [ startOfDay( date ) ],\n\t\tviewing: startOfDay( date ),\n\t\tweekStartsOn,\n\t} );\n\n\t// Used to implement a roving tab index. Tracks the day that receives focus\n\t// when the user tabs into the calendar.\n\tconst [ focusable, setFocusable ] = useState( startOfDay( date ) );\n\n\t// Allows us to only programmatically focus() a day when focus was already\n\t// within the calendar. This stops us stealing focus from e.g. a TimePicker\n\t// input.\n\tconst [ isFocusWithinCalendar, setIsFocusWithinCalendar ] =\n\t\tuseState( false );\n\n\t// Update internal state when currentDate prop changes.\n\tconst [ prevCurrentDate, setPrevCurrentDate ] = useState( currentDate );\n\tif ( currentDate !== prevCurrentDate ) {\n\t\tsetPrevCurrentDate( currentDate );\n\t\tsetSelected( [ startOfDay( date ) ] );\n\t\tsetViewing( startOfDay( date ) );\n\t\tsetFocusable( startOfDay( date ) );\n\t}\n\n\treturn (\n\t\t<Wrapper\n\t\t\tclassName=\"components-datetime__date\"\n\t\t\trole=\"application\"\n\t\t\taria-label={ __( 'Calendar' ) }\n\t\t>\n\t\t\t<Navigator>\n\t\t\t\t<Button\n\t\t\t\t\ticon={ isRTL() ? arrowRight : arrowLeft }\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\taria-label={ __( 'View previous month' ) }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tviewPreviousMonth();\n\t\t\t\t\t\tsetFocusable( subMonths( focusable, 1 ) );\n\t\t\t\t\t\tonMonthPreviewed?.(\n\t\t\t\t\t\t\tformat(\n\t\t\t\t\t\t\t\tsubMonths( viewing, 1 ),\n\t\t\t\t\t\t\t\tTIMEZONELESS_FORMAT\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t<NavigatorHeading level={ 3 }>\n\t\t\t\t\t<strong>\n\t\t\t\t\t\t{ dateI18n(\n\t\t\t\t\t\t\t'F',\n\t\t\t\t\t\t\tviewing,\n\t\t\t\t\t\t\t-viewing.getTimezoneOffset()\n\t\t\t\t\t\t) }\n\t\t\t\t\t</strong>{ ' ' }\n\t\t\t\t\t{ dateI18n( 'Y', viewing, -viewing.getTimezoneOffset() ) }\n\t\t\t\t</NavigatorHeading>\n\t\t\t\t<Button\n\t\t\t\t\ticon={ isRTL() ? arrowLeft : arrowRight }\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\taria-label={ __( 'View next month' ) }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tviewNextMonth();\n\t\t\t\t\t\tsetFocusable( addMonths( focusable, 1 ) );\n\t\t\t\t\t\tonMonthPreviewed?.(\n\t\t\t\t\t\t\tformat(\n\t\t\t\t\t\t\t\taddMonths( viewing, 1 ),\n\t\t\t\t\t\t\t\tTIMEZONELESS_FORMAT\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</Navigator>\n\t\t\t<Calendar\n\t\t\t\tonFocus={ () => setIsFocusWithinCalendar( true ) }\n\t\t\t\tonBlur={ () => setIsFocusWithinCalendar( false ) }\n\t\t\t>\n\t\t\t\t{ calendar[ 0 ][ 0 ].map( ( day ) => (\n\t\t\t\t\t<DayOfWeek key={ day.toString() }>\n\t\t\t\t\t\t{ dateI18n( 'D', day, -day.getTimezoneOffset() ) }\n\t\t\t\t\t</DayOfWeek>\n\t\t\t\t) ) }\n\t\t\t\t{ calendar[ 0 ].map( ( week ) =>\n\t\t\t\t\tweek.map( ( day, index ) => {\n\t\t\t\t\t\tif ( ! isSameMonth( day, viewing ) ) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Day\n\t\t\t\t\t\t\t\tkey={ day.toString() }\n\t\t\t\t\t\t\t\tday={ day }\n\t\t\t\t\t\t\t\tcolumn={ index + 1 }\n\t\t\t\t\t\t\t\tisSelected={ isSelected( day ) }\n\t\t\t\t\t\t\t\tisFocusable={ isEqual( day, focusable ) }\n\t\t\t\t\t\t\t\tisFocusAllowed={ isFocusWithinCalendar }\n\t\t\t\t\t\t\t\tisToday={ isSameDay( day, new Date() ) }\n\t\t\t\t\t\t\t\tisInvalid={\n\t\t\t\t\t\t\t\t\tisInvalidDate ? isInvalidDate( day ) : false\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tnumEvents={\n\t\t\t\t\t\t\t\t\tevents.filter( ( event ) =>\n\t\t\t\t\t\t\t\t\t\tisSameDay( event.date, day )\n\t\t\t\t\t\t\t\t\t).length\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tsetSelected( [ day ] );\n\t\t\t\t\t\t\t\t\tsetFocusable( day );\n\t\t\t\t\t\t\t\t\tonChange?.(\n\t\t\t\t\t\t\t\t\t\tformat(\n\t\t\t\t\t\t\t\t\t\t\t// Don't change the selected date's time fields.\n\t\t\t\t\t\t\t\t\t\t\tnew Date(\n\t\t\t\t\t\t\t\t\t\t\t\tday.getFullYear(),\n\t\t\t\t\t\t\t\t\t\t\t\tday.getMonth(),\n\t\t\t\t\t\t\t\t\t\t\t\tday.getDate(),\n\t\t\t\t\t\t\t\t\t\t\t\tdate.getHours(),\n\t\t\t\t\t\t\t\t\t\t\t\tdate.getMinutes(),\n\t\t\t\t\t\t\t\t\t\t\t\tdate.getSeconds(),\n\t\t\t\t\t\t\t\t\t\t\t\tdate.getMilliseconds()\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\tTIMEZONELESS_FORMAT\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\t\t\tlet nextFocusable;\n\t\t\t\t\t\t\t\t\tif ( event.key === 'ArrowLeft' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = addDays(\n\t\t\t\t\t\t\t\t\t\t\tday,\n\t\t\t\t\t\t\t\t\t\t\tisRTL() ? 1 : -1\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( event.key === 'ArrowRight' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = addDays(\n\t\t\t\t\t\t\t\t\t\t\tday,\n\t\t\t\t\t\t\t\t\t\t\tisRTL() ? -1 : 1\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( event.key === 'ArrowUp' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = subWeeks( day, 1 );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( event.key === 'ArrowDown' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = addWeeks( day, 1 );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( event.key === 'PageUp' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = subMonths( day, 1 );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( event.key === 'PageDown' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = addMonths( day, 1 );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( event.key === 'Home' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = startOfWeek( day );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( event.key === 'End' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = startOfDay(\n\t\t\t\t\t\t\t\t\t\t\tendOfWeek( day )\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( nextFocusable ) {\n\t\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\t\tsetFocusable( nextFocusable );\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t! isSameMonth(\n\t\t\t\t\t\t\t\t\t\t\t\tnextFocusable,\n\t\t\t\t\t\t\t\t\t\t\t\tviewing\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\tsetViewing( nextFocusable );\n\t\t\t\t\t\t\t\t\t\t\tonMonthPreviewed?.(\n\t\t\t\t\t\t\t\t\t\t\t\tformat(\n\t\t\t\t\t\t\t\t\t\t\t\t\tnextFocusable,\n\t\t\t\t\t\t\t\t\t\t\t\t\tTIMEZONELESS_FORMAT\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} )\n\t\t\t\t) }\n\t\t\t</Calendar>\n\t\t</Wrapper>\n\t);\n}\n\ntype DayProps = {\n\tday: Date;\n\tcolumn: number;\n\tisSelected: boolean;\n\tisFocusable: boolean;\n\tisFocusAllowed: boolean;\n\tisToday: boolean;\n\tnumEvents: number;\n\tisInvalid: boolean;\n\tonClick: () => void;\n\tonKeyDown: ( event: KeyboardEvent ) => void;\n};\n\nfunction Day( {\n\tday,\n\tcolumn,\n\tisSelected,\n\tisFocusable,\n\tisFocusAllowed,\n\tisToday,\n\tisInvalid,\n\tnumEvents,\n\tonClick,\n\tonKeyDown,\n}: DayProps ) {\n\tconst ref = useRef< HTMLButtonElement >();\n\n\t// Focus the day when it becomes focusable, e.g. because an arrow key is\n\t// pressed. Only do this if focus is allowed - this stops us stealing focus\n\t// from e.g. a TimePicker input.\n\tuseEffect( () => {\n\t\tif ( ref.current && isFocusable && isFocusAllowed ) {\n\t\t\tref.current.focus();\n\t\t}\n\t\t// isFocusAllowed is not a dep as there is no point calling focus() on\n\t\t// an already focused element.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ isFocusable ] );\n\n\treturn (\n\t\t<DayButton\n\t\t\tref={ ref }\n\t\t\tclassName=\"components-datetime__date__day\" // Unused, for backwards compatibility.\n\t\t\tdisabled={ isInvalid }\n\t\t\ttabIndex={ isFocusable ? 0 : -1 }\n\t\t\taria-label={ getDayLabel( day, isSelected, numEvents ) }\n\t\t\tcolumn={ column }\n\t\t\tisSelected={ isSelected }\n\t\t\tisToday={ isToday }\n\t\t\thasEvents={ numEvents > 0 }\n\t\t\tonClick={ onClick }\n\t\t\tonKeyDown={ onKeyDown }\n\t\t>\n\t\t\t{ dateI18n( 'j', day, -day.getTimezoneOffset() ) }\n\t\t</DayButton>\n\t);\n}\n\nfunction getDayLabel( date: Date, isSelected: boolean, numEvents: number ) {\n\tconst { formats } = getSettings();\n\tconst localizedDate = dateI18n(\n\t\tformats.date,\n\t\tdate,\n\t\t-date.getTimezoneOffset()\n\t);\n\tif ( isSelected && numEvents > 0 ) {\n\t\treturn sprintf(\n\t\t\t// translators: 1: The calendar date. 2: Number of events on the calendar date.\n\t\t\t_n(\n\t\t\t\t'%1$s. Selected. There is %2$d event',\n\t\t\t\t'%1$s. Selected. There are %2$d events',\n\t\t\t\tnumEvents\n\t\t\t),\n\t\t\tlocalizedDate,\n\t\t\tnumEvents\n\t\t);\n\t} else if ( isSelected ) {\n\t\treturn sprintf(\n\t\t\t// translators: %s: The calendar date.\n\t\t\t__( '%1$s. Selected' ),\n\t\t\tlocalizedDate\n\t\t);\n\t} else if ( numEvents > 0 ) {\n\t\treturn sprintf(\n\t\t\t// translators: 1: The calendar date. 2: Number of events on the calendar date.\n\t\t\t_n(\n\t\t\t\t'%1$s. There is %2$d event',\n\t\t\t\t'%1$s. There are %2$d events',\n\t\t\t\tnumEvents\n\t\t\t),\n\t\t\tlocalizedDate,\n\t\t\tnumEvents\n\t\t);\n\t}\n\treturn localizedDate;\n}\n\nexport default DatePicker;\n"]}
@@ -32,7 +32,7 @@ var _styles = require("./styles");
32
32
  const TimeZone = () => {
33
33
  const {
34
34
  timezone
35
- } = (0, _date.__experimentalGetSettings)(); // Convert timezone offset to hours.
35
+ } = (0, _date.getSettings)(); // Convert timezone offset to hours.
36
36
 
37
37
  const userTimezoneOffset = -1 * (new Date().getTimezoneOffset() / 60); // System timezone and user timezone match, nothing needed.
38
38
  // Compare as numbers because it comes over as string.
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/date-time/time/timezone.tsx"],"names":["TimeZone","timezone","userTimezoneOffset","Date","getTimezoneOffset","Number","offset","offsetSymbol","zoneAbbr","abbr","isNaN","timezoneDetail","string","replace"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA,MAAMA,QAAQ,GAAG,MAAM;AACtB,QAAM;AAAEC,IAAAA;AAAF,MAAe,sCAArB,CADsB,CAGtB;;AACA,QAAMC,kBAAkB,GAAG,CAAC,CAAD,IAAO,IAAIC,IAAJ,GAAWC,iBAAX,KAAiC,EAAxC,CAA3B,CAJsB,CAMtB;AACA;;AACA,MAAKC,MAAM,CAAEJ,QAAQ,CAACK,MAAX,CAAN,KAA8BJ,kBAAnC,EAAwD;AACvD,WAAO,IAAP;AACA;;AAED,QAAMK,YAAY,GAAGF,MAAM,CAAEJ,QAAQ,CAACK,MAAX,CAAN,IAA6B,CAA7B,GAAiC,GAAjC,GAAuC,EAA5D;AACA,QAAME,QAAQ,GACb,OAAOP,QAAQ,CAACQ,IAAhB,IAAwBC,KAAK,CAAEL,MAAM,CAAEJ,QAAQ,CAACQ,IAAX,CAAR,CAA7B,GACGR,QAAQ,CAACQ,IADZ,GAEI,MAAMF,YAAc,GAAGN,QAAQ,CAACK,MAAQ,EAH7C;AAKA,QAAMK,cAAc,GACnB,UAAUV,QAAQ,CAACW,MAAnB,GACG,cAAI,4BAAJ,CADH,GAEI,IAAIJ,QAAU,KAAKP,QAAQ,CAACW,MAAT,CAAgBC,OAAhB,CAAyB,GAAzB,EAA8B,GAA9B,CAAqC,EAH7D;AAKA,SACC,4BAAC,gBAAD;AAAS,IAAA,QAAQ,EAAC,YAAlB;AAA+B,IAAA,IAAI,EAAGF;AAAtC,KACC,4BAAC,gBAAD;AAAiB,IAAA,SAAS,EAAC;AAA3B,KACGH,QADH,CADD,CADD;AAOA,CA9BD;;eAgCeR,Q","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalGetSettings as getDateSettings } from '@wordpress/date';\n\n/**\n * Internal dependencies\n */\nimport Tooltip from '../../tooltip';\nimport { TimeZone as StyledComponent } from './styles';\n\n/**\n * Displays timezone information when user timezone is different from site\n * timezone.\n */\nconst TimeZone = () => {\n\tconst { timezone } = getDateSettings();\n\n\t// Convert timezone offset to hours.\n\tconst userTimezoneOffset = -1 * ( new Date().getTimezoneOffset() / 60 );\n\n\t// System timezone and user timezone match, nothing needed.\n\t// Compare as numbers because it comes over as string.\n\tif ( Number( timezone.offset ) === userTimezoneOffset ) {\n\t\treturn null;\n\t}\n\n\tconst offsetSymbol = Number( timezone.offset ) >= 0 ? '+' : '';\n\tconst zoneAbbr =\n\t\t'' !== timezone.abbr && isNaN( Number( timezone.abbr ) )\n\t\t\t? timezone.abbr\n\t\t\t: `UTC${ offsetSymbol }${ timezone.offset }`;\n\n\tconst timezoneDetail =\n\t\t'UTC' === timezone.string\n\t\t\t? __( 'Coordinated Universal Time' )\n\t\t\t: `(${ zoneAbbr }) ${ timezone.string.replace( '_', ' ' ) }`;\n\n\treturn (\n\t\t<Tooltip position=\"top center\" text={ timezoneDetail }>\n\t\t\t<StyledComponent className=\"components-datetime__timezone\">\n\t\t\t\t{ zoneAbbr }\n\t\t\t</StyledComponent>\n\t\t</Tooltip>\n\t);\n};\n\nexport default TimeZone;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/date-time/time/timezone.tsx"],"names":["TimeZone","timezone","userTimezoneOffset","Date","getTimezoneOffset","Number","offset","offsetSymbol","zoneAbbr","abbr","isNaN","timezoneDetail","string","replace"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA,MAAMA,QAAQ,GAAG,MAAM;AACtB,QAAM;AAAEC,IAAAA;AAAF,MAAe,wBAArB,CADsB,CAGtB;;AACA,QAAMC,kBAAkB,GAAG,CAAC,CAAD,IAAO,IAAIC,IAAJ,GAAWC,iBAAX,KAAiC,EAAxC,CAA3B,CAJsB,CAMtB;AACA;;AACA,MAAKC,MAAM,CAAEJ,QAAQ,CAACK,MAAX,CAAN,KAA8BJ,kBAAnC,EAAwD;AACvD,WAAO,IAAP;AACA;;AAED,QAAMK,YAAY,GAAGF,MAAM,CAAEJ,QAAQ,CAACK,MAAX,CAAN,IAA6B,CAA7B,GAAiC,GAAjC,GAAuC,EAA5D;AACA,QAAME,QAAQ,GACb,OAAOP,QAAQ,CAACQ,IAAhB,IAAwBC,KAAK,CAAEL,MAAM,CAAEJ,QAAQ,CAACQ,IAAX,CAAR,CAA7B,GACGR,QAAQ,CAACQ,IADZ,GAEI,MAAMF,YAAc,GAAGN,QAAQ,CAACK,MAAQ,EAH7C;AAKA,QAAMK,cAAc,GACnB,UAAUV,QAAQ,CAACW,MAAnB,GACG,cAAI,4BAAJ,CADH,GAEI,IAAIJ,QAAU,KAAKP,QAAQ,CAACW,MAAT,CAAgBC,OAAhB,CAAyB,GAAzB,EAA8B,GAA9B,CAAqC,EAH7D;AAKA,SACC,4BAAC,gBAAD;AAAS,IAAA,QAAQ,EAAC,YAAlB;AAA+B,IAAA,IAAI,EAAGF;AAAtC,KACC,4BAAC,gBAAD;AAAiB,IAAA,SAAS,EAAC;AAA3B,KACGH,QADH,CADD,CADD;AAOA,CA9BD;;eAgCeR,Q","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { getSettings as getDateSettings } from '@wordpress/date';\n\n/**\n * Internal dependencies\n */\nimport Tooltip from '../../tooltip';\nimport { TimeZone as StyledComponent } from './styles';\n\n/**\n * Displays timezone information when user timezone is different from site\n * timezone.\n */\nconst TimeZone = () => {\n\tconst { timezone } = getDateSettings();\n\n\t// Convert timezone offset to hours.\n\tconst userTimezoneOffset = -1 * ( new Date().getTimezoneOffset() / 60 );\n\n\t// System timezone and user timezone match, nothing needed.\n\t// Compare as numbers because it comes over as string.\n\tif ( Number( timezone.offset ) === userTimezoneOffset ) {\n\t\treturn null;\n\t}\n\n\tconst offsetSymbol = Number( timezone.offset ) >= 0 ? '+' : '';\n\tconst zoneAbbr =\n\t\t'' !== timezone.abbr && isNaN( Number( timezone.abbr ) )\n\t\t\t? timezone.abbr\n\t\t\t: `UTC${ offsetSymbol }${ timezone.offset }`;\n\n\tconst timezoneDetail =\n\t\t'UTC' === timezone.string\n\t\t\t? __( 'Coordinated Universal Time' )\n\t\t\t: `(${ zoneAbbr }) ${ timezone.string.replace( '_', ' ' ) }`;\n\n\treturn (\n\t\t<Tooltip position=\"top center\" text={ timezoneDetail }>\n\t\t\t<StyledComponent className=\"components-datetime__timezone\">\n\t\t\t\t{ zoneAbbr }\n\t\t\t</StyledComponent>\n\t\t</Tooltip>\n\t);\n};\n\nexport default TimeZone;\n"]}
@@ -11,12 +11,12 @@ var _element = require("@wordpress/element");
11
11
 
12
12
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
13
 
14
- var _classnames = _interopRequireDefault(require("classnames"));
15
-
16
14
  var _compose = require("@wordpress/compose");
17
15
 
18
16
  var _disabledStyles = require("./styles/disabled-styles");
19
17
 
18
+ var _utils = require("../utils");
19
+
20
20
  /**
21
21
  * External dependencies
22
22
  */
@@ -32,7 +32,14 @@ const Context = (0, _element.createContext)(false);
32
32
  const {
33
33
  Consumer,
34
34
  Provider
35
- } = Context;
35
+ } = Context; // Extracting this ContentWrapper component in order to make it more explicit
36
+ // the same 'ContentWrapper' component is needed so that React can reconcile
37
+ // the dom correctly when switching between disabled/non-disabled (instead
38
+ // of thrashing the previous DOM and therefore losing the form fields values).
39
+
40
+ const ContentWrapper = (0, _element.forwardRef)((props, ref) => (0, _element.createElement)("div", (0, _extends2.default)({}, props, {
41
+ ref: ref
42
+ })));
36
43
  /**
37
44
  * `Disabled` is a component which disables descendant tabbable elements and prevents pointer interaction.
38
45
  *
@@ -72,18 +79,19 @@ function Disabled(_ref) {
72
79
  ...props
73
80
  } = _ref;
74
81
  const ref = (0, _compose.useDisabled)();
82
+ const cx = (0, _utils.useCx)();
75
83
 
76
84
  if (!isDisabled) {
77
85
  return (0, _element.createElement)(Provider, {
78
86
  value: false
79
- }, children);
87
+ }, (0, _element.createElement)(ContentWrapper, null, children));
80
88
  }
81
89
 
82
90
  return (0, _element.createElement)(Provider, {
83
91
  value: true
84
- }, (0, _element.createElement)(_disabledStyles.StyledWrapper, (0, _extends2.default)({
92
+ }, (0, _element.createElement)(ContentWrapper, (0, _extends2.default)({
85
93
  ref: ref,
86
- className: (0, _classnames.default)(className, 'components-disabled')
94
+ className: cx(_disabledStyles.disabledStyles, className, 'components-disabled')
87
95
  }, props), children));
88
96
  }
89
97
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/disabled/index.tsx"],"names":["Context","Consumer","Provider","Disabled","className","children","isDisabled","props","ref"],"mappings":";;;;;;;;;AASA;;;;AANA;;AAKA;;AAMA;;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAKA,MAAMA,OAAO,GAAG,4BAA0B,KAA1B,CAAhB;AACA,MAAM;AAAEC,EAAAA,QAAF;AAAYC,EAAAA;AAAZ,IAAyBF,OAA/B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASG,QAAT,OAKoE;AAAA,MALjD;AAClBC,IAAAA,SADkB;AAElBC,IAAAA,QAFkB;AAGlBC,IAAAA,UAAU,GAAG,IAHK;AAIlB,OAAGC;AAJe,GAKiD;AACnE,QAAMC,GAAG,GAAG,2BAAZ;;AAEA,MAAK,CAAEF,UAAP,EAAoB;AACnB,WAAO,4BAAC,QAAD;AAAU,MAAA,KAAK,EAAG;AAAlB,OAA4BD,QAA5B,CAAP;AACA;;AAED,SACC,4BAAC,QAAD;AAAU,IAAA,KAAK,EAAG;AAAlB,KACC,4BAAC,6BAAD;AACC,IAAA,GAAG,EAAGG,GADP;AAEC,IAAA,SAAS,EAAG,yBAAYJ,SAAZ,EAAuB,qBAAvB;AAFb,KAGMG,KAHN,GAKGF,QALH,CADD,CADD;AAWA;;AAEDF,QAAQ,CAACH,OAAT,GAAmBA,OAAnB;AACAG,QAAQ,CAACF,QAAT,GAAoBA,QAApB;eAEeE,Q","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useDisabled } from '@wordpress/compose';\nimport { createContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { StyledWrapper } from './styles/disabled-styles';\nimport type { DisabledProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\n\nconst Context = createContext< boolean >( false );\nconst { Consumer, Provider } = Context;\n\n/**\n * `Disabled` is a component which disables descendant tabbable elements and prevents pointer interaction.\n *\n * ```jsx\n * import { Button, Disabled, TextControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyDisabled = () => {\n * \tconst [ isDisabled, setIsDisabled ] = useState( true );\n *\n * \tlet input = <TextControl label=\"Input\" onChange={ () => {} } />;\n * \tif ( isDisabled ) {\n * \t\tinput = <Disabled>{ input }</Disabled>;\n * \t}\n *\n * \tconst toggleDisabled = () => {\n * \t\tsetIsDisabled( ( state ) => ! state );\n * \t};\n *\n * \treturn (\n * \t\t<div>\n * \t\t\t{ input }\n * \t\t\t<Button variant=\"primary\" onClick={ toggleDisabled }>\n * \t\t\t\tToggle Disabled\n * \t\t\t</Button>\n * \t\t</div>\n * \t);\n * };\n * ```\n */\nfunction Disabled( {\n\tclassName,\n\tchildren,\n\tisDisabled = true,\n\t...props\n}: Omit< WordPressComponentProps< DisabledProps, 'div' >, 'ref' > ) {\n\tconst ref = useDisabled();\n\n\tif ( ! isDisabled ) {\n\t\treturn <Provider value={ false }>{ children }</Provider>;\n\t}\n\n\treturn (\n\t\t<Provider value={ true }>\n\t\t\t<StyledWrapper\n\t\t\t\tref={ ref }\n\t\t\t\tclassName={ classnames( className, 'components-disabled' ) }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</StyledWrapper>\n\t\t</Provider>\n\t);\n}\n\nDisabled.Context = Context;\nDisabled.Consumer = Consumer;\n\nexport default Disabled;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/disabled/index.tsx"],"names":["Context","Consumer","Provider","ContentWrapper","props","ref","Disabled","className","children","isDisabled","cx","disabledStyles"],"mappings":";;;;;;;;;AASA;;;;AADA;;AAMA;;AAGA;;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAMA,MAAMA,OAAO,GAAG,4BAA0B,KAA1B,CAAhB;AACA,MAAM;AAAEC,EAAAA,QAAF;AAAYC,EAAAA;AAAZ,IAAyBF,OAA/B,C,CAEA;AACA;AACA;AACA;;AACA,MAAMG,cAAc,GAAG,yBAGpB,CAAEC,KAAF,EAASC,GAAT,KAAkB,8DAAUD,KAAV;AAAkB,EAAA,GAAG,EAAGC;AAAxB,GAHE,CAAvB;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,QAAT,OAKqD;AAAA,MALlC;AAClBC,IAAAA,SADkB;AAElBC,IAAAA,QAFkB;AAGlBC,IAAAA,UAAU,GAAG,IAHK;AAIlB,OAAGL;AAJe,GAKkC;AACpD,QAAMC,GAAG,GAAG,2BAAZ;AACA,QAAMK,EAAE,GAAG,mBAAX;;AACA,MAAK,CAAED,UAAP,EAAoB;AACnB,WACC,4BAAC,QAAD;AAAU,MAAA,KAAK,EAAG;AAAlB,OACC,4BAAC,cAAD,QAAkBD,QAAlB,CADD,CADD;AAKA;;AAED,SACC,4BAAC,QAAD;AAAU,IAAA,KAAK,EAAG;AAAlB,KACC,4BAAC,cAAD;AACC,IAAA,GAAG,EAAGH,GADP;AAEC,IAAA,SAAS,EAAGK,EAAE,CACbC,8BADa,EAEbJ,SAFa,EAGb,qBAHa;AAFf,KAOMH,KAPN,GASGI,QATH,CADD,CADD;AAeA;;AAEDF,QAAQ,CAACN,OAAT,GAAmBA,OAAnB;AACAM,QAAQ,CAACL,QAAT,GAAoBA,QAApB;eAEeK,Q","sourcesContent":["/**\n * External dependencies\n */\nimport type { HTMLProps } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useDisabled } from '@wordpress/compose';\nimport { createContext, forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { disabledStyles } from './styles/disabled-styles';\nimport type { DisabledProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\nimport { useCx } from '../utils';\n\nconst Context = createContext< boolean >( false );\nconst { Consumer, Provider } = Context;\n\n// Extracting this ContentWrapper component in order to make it more explicit\n// the same 'ContentWrapper' component is needed so that React can reconcile\n// the dom correctly when switching between disabled/non-disabled (instead\n// of thrashing the previous DOM and therefore losing the form fields values).\nconst ContentWrapper = forwardRef<\n\tHTMLDivElement,\n\tHTMLProps< HTMLDivElement >\n>( ( props, ref ) => <div { ...props } ref={ ref } /> );\n\n/**\n * `Disabled` is a component which disables descendant tabbable elements and prevents pointer interaction.\n *\n * ```jsx\n * import { Button, Disabled, TextControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyDisabled = () => {\n * \tconst [ isDisabled, setIsDisabled ] = useState( true );\n *\n * \tlet input = <TextControl label=\"Input\" onChange={ () => {} } />;\n * \tif ( isDisabled ) {\n * \t\tinput = <Disabled>{ input }</Disabled>;\n * \t}\n *\n * \tconst toggleDisabled = () => {\n * \t\tsetIsDisabled( ( state ) => ! state );\n * \t};\n *\n * \treturn (\n * \t\t<div>\n * \t\t\t{ input }\n * \t\t\t<Button variant=\"primary\" onClick={ toggleDisabled }>\n * \t\t\t\tToggle Disabled\n * \t\t\t</Button>\n * \t\t</div>\n * \t);\n * };\n * ```\n */\nfunction Disabled( {\n\tclassName,\n\tchildren,\n\tisDisabled = true,\n\t...props\n}: WordPressComponentProps< DisabledProps, 'div' > ) {\n\tconst ref = useDisabled();\n\tconst cx = useCx();\n\tif ( ! isDisabled ) {\n\t\treturn (\n\t\t\t<Provider value={ false }>\n\t\t\t\t<ContentWrapper>{ children }</ContentWrapper>\n\t\t\t</Provider>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Provider value={ true }>\n\t\t\t<ContentWrapper\n\t\t\t\tref={ ref }\n\t\t\t\tclassName={ cx(\n\t\t\t\t\tdisabledStyles,\n\t\t\t\t\tclassName,\n\t\t\t\t\t'components-disabled'\n\t\t\t\t) }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</ContentWrapper>\n\t\t</Provider>\n\t);\n}\n\nDisabled.Context = Context;\nDisabled.Consumer = Consumer;\n\nexport default Disabled;\n"]}
@@ -1,32 +1,22 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
- exports.StyledWrapper = void 0;
6
+ exports.disabledStyles = void 0;
9
7
 
10
- var _base = _interopRequireDefault(require("@emotion/styled/base"));
8
+ var _react = require("@emotion/react");
11
9
 
12
10
  function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
13
11
 
14
- /**
15
- * External dependencies
16
- */
17
- const StyledWrapper = (0, _base.default)("div", process.env.NODE_ENV === "production" ? {
18
- target: "e13jgla80"
19
- } : {
20
- target: "e13jgla80",
21
- label: "StyledWrapper"
22
- })(process.env.NODE_ENV === "production" ? {
12
+ const disabledStyles = process.env.NODE_ENV === "production" ? {
23
13
  name: "u2jump",
24
14
  styles: "position:relative;pointer-events:none;&::after{content:'';position:absolute;top:0;right:0;bottom:0;left:0;}*{pointer-events:none;}"
25
15
  } : {
26
- name: "u2jump",
27
- styles: "position:relative;pointer-events:none;&::after{content:'';position:absolute;top:0;right:0;bottom:0;left:0;}*{pointer-events:none;}",
28
- map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZGlzYWJsZWQvc3R5bGVzL2Rpc2FibGVkLXN0eWxlcy50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS3VDIiwiZmlsZSI6IkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZGlzYWJsZWQvc3R5bGVzL2Rpc2FibGVkLXN0eWxlcy50c3giLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEV4dGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XG5cbmV4cG9ydCBjb25zdCBTdHlsZWRXcmFwcGVyID0gc3R5bGVkLmRpdmBcblx0cG9zaXRpb246IHJlbGF0aXZlO1xuXHRwb2ludGVyLWV2ZW50czogbm9uZTtcblxuXHQmOjphZnRlciB7XG5cdFx0Y29udGVudDogJyc7XG5cdFx0cG9zaXRpb246IGFic29sdXRlO1xuXHRcdHRvcDogMDtcblx0XHRyaWdodDogMDtcblx0XHRib3R0b206IDA7XG5cdFx0bGVmdDogMDtcblx0fVxuXG5cdC8vIEFsc28gbWFrZSBuZXN0ZWQgYmxvY2tzIHVuc2VsZWN0YWJsZS5cblx0KiB7XG5cdFx0cG9pbnRlci1ldmVudHM6IG5vbmU7XG5cdH1cbmA7XG4iXX0= */",
16
+ name: "iqemdn-disabledStyles",
17
+ styles: "position:relative;pointer-events:none;&::after{content:'';position:absolute;top:0;right:0;bottom:0;left:0;}*{pointer-events:none;};label:disabledStyles;",
18
+ map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZGlzYWJsZWQvc3R5bGVzL2Rpc2FibGVkLXN0eWxlcy50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS2lDIiwiZmlsZSI6IkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZGlzYWJsZWQvc3R5bGVzL2Rpc2FibGVkLXN0eWxlcy50c3giLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEV4dGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5cbmV4cG9ydCBjb25zdCBkaXNhYmxlZFN0eWxlcyA9IGNzc2Bcblx0cG9zaXRpb246IHJlbGF0aXZlO1xuXHRwb2ludGVyLWV2ZW50czogbm9uZTtcblxuXHQmOjphZnRlciB7XG5cdFx0Y29udGVudDogJyc7XG5cdFx0cG9zaXRpb246IGFic29sdXRlO1xuXHRcdHRvcDogMDtcblx0XHRyaWdodDogMDtcblx0XHRib3R0b206IDA7XG5cdFx0bGVmdDogMDtcblx0fVxuXG5cdC8vIEFsc28gbWFrZSBuZXN0ZWQgYmxvY2tzIHVuc2VsZWN0YWJsZS5cblx0KiB7XG5cdFx0cG9pbnRlci1ldmVudHM6IG5vbmU7XG5cdH1cbmA7XG4iXX0= */",
29
19
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
30
- });
31
- exports.StyledWrapper = StyledWrapper;
20
+ };
21
+ exports.disabledStyles = disabledStyles;
32
22
  //# sourceMappingURL=disabled-styles.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/disabled/styles/disabled-styles.tsx"],"names":["StyledWrapper"],"mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;AAGO,MAAMA,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAnB","sourcesContent":["/**\n * External dependencies\n */\nimport styled from '@emotion/styled';\n\nexport const StyledWrapper = styled.div`\n\tposition: relative;\n\tpointer-events: none;\n\n\t&::after {\n\t\tcontent: '';\n\t\tposition: absolute;\n\t\ttop: 0;\n\t\tright: 0;\n\t\tbottom: 0;\n\t\tleft: 0;\n\t}\n\n\t// Also make nested blocks unselectable.\n\t* {\n\t\tpointer-events: none;\n\t}\n`;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/disabled/styles/disabled-styles.tsx"],"names":["disabledStyles"],"mappings":";;;;;;;AAGA;;;;AAEO,MAAMA,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAApB","sourcesContent":["/**\n * External dependencies\n */\nimport { css } from '@emotion/react';\n\nexport const disabledStyles = css`\n\tposition: relative;\n\tpointer-events: none;\n\n\t&::after {\n\t\tcontent: '';\n\t\tposition: absolute;\n\t\ttop: 0;\n\t\tright: 0;\n\t\tbottom: 0;\n\t\tleft: 0;\n\t}\n\n\t// Also make nested blocks unselectable.\n\t* {\n\t\tpointer-events: none;\n\t}\n`;\n"]}