@wordpress/components 28.9.0 → 28.10.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 (689) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/build/alignment-matrix-control/icon.js.map +1 -1
  3. package/build/alignment-matrix-control/types.js.map +1 -1
  4. package/build/alignment-matrix-control/utils.js.map +1 -1
  5. package/build/angle-picker-control/angle-circle.js.map +1 -1
  6. package/build/autocomplete/autocompleter-ui.js +3 -3
  7. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  8. package/build/autocomplete/get-default-use-items.js.map +1 -1
  9. package/build/autocomplete/index.js +1 -0
  10. package/build/autocomplete/index.js.map +1 -1
  11. package/build/base-control/hooks.js.map +1 -1
  12. package/build/base-control/index.js.map +1 -1
  13. package/build/border-box-control/border-box-control/hook.js.map +1 -1
  14. package/build/border-box-control/styles.js.map +1 -1
  15. package/build/border-box-control/utils.js.map +1 -1
  16. package/build/border-control/border-control/hook.js.map +1 -1
  17. package/build/border-control/styles.js.map +1 -1
  18. package/build/box-control/axial-input-controls.js.map +1 -1
  19. package/build/box-control/icon.js.map +1 -1
  20. package/build/box-control/index.js.map +1 -1
  21. package/build/box-control/input-controls.js.map +1 -1
  22. package/build/button/index.native.js +1 -1
  23. package/build/button/index.native.js.map +1 -1
  24. package/build/card/card/component.js +1 -1
  25. package/build/card/card/component.js.map +1 -1
  26. package/build/card/styles.js.map +1 -1
  27. package/build/color-palette/index.js.map +1 -1
  28. package/build/color-palette/index.native.js +2 -1
  29. package/build/color-palette/index.native.js.map +1 -1
  30. package/build/color-picker/styles.js.map +1 -1
  31. package/build/combobox-control/index.js +1 -1
  32. package/build/combobox-control/index.js.map +1 -1
  33. package/build/composite/legacy/index.js.map +1 -1
  34. package/build/context/context-connect.js +1 -0
  35. package/build/context/context-connect.js.map +1 -1
  36. package/build/context/context-system-provider.js +1 -1
  37. package/build/context/context-system-provider.js.map +1 -1
  38. package/build/context/get-styled-class-name-from-key.js.map +1 -1
  39. package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  40. package/build/custom-gradient-picker/index.js.map +1 -1
  41. package/build/custom-gradient-picker/serializer.js.map +1 -1
  42. package/build/custom-gradient-picker/utils.js.map +1 -1
  43. package/build/custom-select-control-v2/styles.js.map +1 -1
  44. package/build/dashicon/index.js.map +1 -1
  45. package/build/date-time/date/styles.js.map +1 -1
  46. package/build/date-time/time/timezone.js.map +1 -1
  47. package/build/draggable/index.js.map +1 -1
  48. package/build/drop-zone/index.js +1 -2
  49. package/build/drop-zone/index.js.map +1 -1
  50. package/build/dropdown-menu-v2/styles.js.map +1 -1
  51. package/build/duotone-picker/color-list-picker/index.js.map +1 -1
  52. package/build/duotone-picker/utils.js.map +1 -1
  53. package/build/elevation/hook.js.map +1 -1
  54. package/build/external-link/index.js +20 -23
  55. package/build/external-link/index.js.map +1 -1
  56. package/build/focal-point-picker/index.js.map +1 -1
  57. package/build/focal-point-picker/index.native.js.map +1 -1
  58. package/build/focal-point-picker/styles/focal-point-style.js.map +1 -1
  59. package/build/font-size-picker/index.js.map +1 -1
  60. package/build/form-token-field/index.js +2 -1
  61. package/build/form-token-field/index.js.map +1 -1
  62. package/build/form-token-field/suggestions-list.js.map +1 -1
  63. package/build/form-token-field/token-input.js.map +1 -1
  64. package/build/form-token-field/token.js +1 -1
  65. package/build/form-token-field/token.js.map +1 -1
  66. package/build/gradient-picker/index.js.map +1 -1
  67. package/build/grid/hook.js.map +1 -1
  68. package/build/guide/page-control.js +1 -1
  69. package/build/guide/page-control.js.map +1 -1
  70. package/build/h-stack/hook.js.map +1 -1
  71. package/build/heading/hook.js.map +1 -1
  72. package/build/input-control/index.js.map +1 -1
  73. package/build/input-control/input-base.js.map +1 -1
  74. package/build/input-control/styles/input-control-styles.js.map +1 -1
  75. package/build/item-group/styles.js.map +1 -1
  76. package/build/menu-group/index.js.map +1 -1
  77. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
  78. package/build/mobile/bottom-sheet/cell.native.js +4 -4
  79. package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
  80. package/build/mobile/bottom-sheet/index.native.js.map +1 -1
  81. package/build/mobile/bottom-sheet/range-cell.native.js +1 -1
  82. package/build/mobile/bottom-sheet/range-cell.native.js.map +1 -1
  83. package/build/mobile/bottom-sheet/range-text-input.native.js.map +1 -1
  84. package/build/mobile/bottom-sheet/stepper-cell/index.native.js +1 -1
  85. package/build/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
  86. package/build/mobile/bottom-sheet/switch-cell.native.js +4 -4
  87. package/build/mobile/bottom-sheet/switch-cell.native.js.map +1 -1
  88. package/build/mobile/cycle-select-control/index.native.js.map +1 -1
  89. package/build/mobile/gradient/index.native.js.map +1 -1
  90. package/build/mobile/image/index.native.js.map +1 -1
  91. package/build/mobile/link-picker/index.native.js +1 -1
  92. package/build/mobile/link-picker/index.native.js.map +1 -1
  93. package/build/mobile/link-picker/link-picker-results.native.js.map +1 -1
  94. package/build/mobile/picker/index.android.js.map +1 -1
  95. package/build/mobile/segmented-control/index.native.js.map +1 -1
  96. package/build/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
  97. package/build/mobile/utils/use-unit-converter-to-mobile.native.js.map +1 -1
  98. package/build/modal/aria-helper.js +2 -1
  99. package/build/modal/aria-helper.js.map +1 -1
  100. package/build/modal/index.js +2 -1
  101. package/build/modal/index.js.map +1 -1
  102. package/build/modal/use-modal-exit-animation.js.map +1 -1
  103. package/build/navigation/group/index.js.map +1 -1
  104. package/build/navigation/item/base.js.map +1 -1
  105. package/build/navigation/menu/index.js.map +1 -1
  106. package/build/navigation/menu/menu-title-search.js +2 -2
  107. package/build/navigation/menu/menu-title-search.js.map +1 -1
  108. package/build/navigation/menu/menu-title.js.map +1 -1
  109. package/build/navigation/styles/navigation-styles.js.map +1 -1
  110. package/build/navigator/navigator/component.js.map +1 -1
  111. package/build/navigator/navigator-button/hook.js.map +1 -1
  112. package/build/number-control/styles/number-control-styles.js.map +1 -1
  113. package/build/palette-edit/index.js +25 -2
  114. package/build/palette-edit/index.js.map +1 -1
  115. package/build/popover/index.js +1 -1
  116. package/build/popover/index.js.map +1 -1
  117. package/build/popover/overlay-middlewares.js.map +1 -1
  118. package/build/popover/utils.js.map +1 -1
  119. package/build/progress-bar/index.js.map +1 -1
  120. package/build/progress-bar/styles.js.map +1 -1
  121. package/build/query-controls/index.js.map +1 -1
  122. package/build/query-controls/index.native.js.map +1 -1
  123. package/build/radio-control/index.js.map +1 -1
  124. package/build/radio-control/index.native.js.map +1 -1
  125. package/build/range-control/index.js.map +1 -1
  126. package/build/range-control/index.native.js.map +1 -1
  127. package/build/range-control/rail.js.map +1 -1
  128. package/build/range-control/styles/range-control-styles.js +32 -32
  129. package/build/range-control/styles/range-control-styles.js.map +1 -1
  130. package/build/range-control/tooltip.js +1 -1
  131. package/build/range-control/tooltip.js.map +1 -1
  132. package/build/range-control/utils.js.map +1 -1
  133. package/build/resizable-box/resize-tooltip/label.js.map +1 -1
  134. package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
  135. package/build/responsive-wrapper/index.js.map +1 -1
  136. package/build/sandbox/index.js.map +1 -1
  137. package/build/sandbox/index.native.js.map +1 -1
  138. package/build/search-control/index.js +6 -0
  139. package/build/search-control/index.js.map +1 -1
  140. package/build/search-control/index.native.js.map +1 -1
  141. package/build/search-control/types.js.map +1 -1
  142. package/build/select-control/index.js.map +1 -1
  143. package/build/select-control/index.native.js.map +1 -1
  144. package/build/slot-fill/index.js.map +1 -1
  145. package/build/spinner/styles.js.map +1 -1
  146. package/build/style-provider/index.js +1 -0
  147. package/build/style-provider/index.js.map +1 -1
  148. package/build/surface/hook.js.map +1 -1
  149. package/build/surface/styles.js.map +1 -1
  150. package/build/tab-panel/index.js.map +1 -1
  151. package/build/tabs/index.js.map +1 -1
  152. package/build/tabs/styles.js +30 -12
  153. package/build/tabs/styles.js.map +1 -1
  154. package/build/tabs/tab.js +7 -2
  155. package/build/tabs/tab.js.map +1 -1
  156. package/build/tabs/tablist.js +47 -48
  157. package/build/tabs/tablist.js.map +1 -1
  158. package/build/tabs/tabpanel.js.map +1 -1
  159. package/build/text/get-line-height.js.map +1 -1
  160. package/build/text/styles/text-mixins.native.js.map +1 -1
  161. package/build/text/utils.js.map +1 -1
  162. package/build/text-control/index.native.js.map +1 -1
  163. package/build/text-highlight/index.js.map +1 -1
  164. package/build/textarea-control/index.js.map +1 -1
  165. package/build/theme/color-algorithms.js.map +1 -1
  166. package/build/theme/styles.js.map +1 -1
  167. package/build/toggle-control/index.js.map +1 -1
  168. package/build/toggle-control/index.native.js.map +1 -1
  169. package/build/toggle-group-control/toggle-group-control/as-radio-group.js +9 -1
  170. package/build/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
  171. package/build/toggle-group-control/toggle-group-control/component.js +2 -60
  172. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  173. package/build/toggle-group-control/toggle-group-control-option-base/component.js +10 -10
  174. package/build/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
  175. package/build/toggle-group-control/types.js.map +1 -1
  176. package/build/toolbar/toolbar/index.js.map +1 -1
  177. package/build/tools-panel/styles.js.map +1 -1
  178. package/build/tooltip/index.js +5 -1
  179. package/build/tooltip/index.js.map +1 -1
  180. package/build/unit-control/index.js.map +1 -1
  181. package/build/unit-control/utils.js.map +1 -1
  182. package/build/utils/breakpoint.js.map +1 -1
  183. package/build/utils/colors-values.js.map +1 -1
  184. package/build/utils/config-values.js.map +1 -1
  185. package/build/utils/font-size.js.map +1 -1
  186. package/build/utils/hooks/use-animated-offset-rect.js +80 -0
  187. package/build/utils/hooks/use-animated-offset-rect.js.map +1 -0
  188. package/build/utils/hooks/use-cx.js.map +1 -1
  189. package/build/utils/math.js +2 -2
  190. package/build/utils/math.js.map +1 -1
  191. package/build/utils/space.js.map +1 -1
  192. package/build/utils/unit-values.js.map +1 -1
  193. package/build/utils/use-responsive-value.js.map +1 -1
  194. package/build-module/alignment-matrix-control/cell.js +1 -2
  195. package/build-module/alignment-matrix-control/cell.js.map +1 -1
  196. package/build-module/alignment-matrix-control/icon.js.map +1 -1
  197. package/build-module/alignment-matrix-control/types.js.map +1 -1
  198. package/build-module/alignment-matrix-control/utils.js.map +1 -1
  199. package/build-module/angle-picker-control/angle-circle.js.map +1 -1
  200. package/build-module/angle-picker-control/index.js +1 -2
  201. package/build-module/angle-picker-control/index.js.map +1 -1
  202. package/build-module/autocomplete/autocompleter-ui.js +4 -6
  203. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  204. package/build-module/autocomplete/autocompleter-ui.native.js +1 -2
  205. package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
  206. package/build-module/autocomplete/get-default-use-items.js.map +1 -1
  207. package/build-module/autocomplete/index.js +2 -3
  208. package/build-module/autocomplete/index.js.map +1 -1
  209. package/build-module/base-control/hooks.js.map +1 -1
  210. package/build-module/base-control/index.js +1 -2
  211. package/build-module/base-control/index.js.map +1 -1
  212. package/build-module/base-control/index.native.js +1 -2
  213. package/build-module/base-control/index.native.js.map +1 -1
  214. package/build-module/border-box-control/border-box-control/component.js +1 -2
  215. package/build-module/border-box-control/border-box-control/component.js.map +1 -1
  216. package/build-module/border-box-control/border-box-control/hook.js.map +1 -1
  217. package/build-module/border-box-control/border-box-control-split-controls/component.js +1 -2
  218. package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  219. package/build-module/border-box-control/styles.js.map +1 -1
  220. package/build-module/border-box-control/utils.js.map +1 -1
  221. package/build-module/border-control/border-control/component.js +1 -2
  222. package/build-module/border-control/border-control/component.js.map +1 -1
  223. package/build-module/border-control/border-control/hook.js.map +1 -1
  224. package/build-module/border-control/border-control-dropdown/component.js +1 -3
  225. package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
  226. package/build-module/border-control/styles.js.map +1 -1
  227. package/build-module/box-control/all-input-control.js +1 -3
  228. package/build-module/box-control/all-input-control.js.map +1 -1
  229. package/build-module/box-control/axial-input-controls.js +1 -3
  230. package/build-module/box-control/axial-input-controls.js.map +1 -1
  231. package/build-module/box-control/icon.js +1 -2
  232. package/build-module/box-control/icon.js.map +1 -1
  233. package/build-module/box-control/index.js +1 -2
  234. package/build-module/box-control/index.js.map +1 -1
  235. package/build-module/box-control/input-controls.js +1 -3
  236. package/build-module/box-control/input-controls.js.map +1 -1
  237. package/build-module/button/index.js +1 -3
  238. package/build-module/button/index.js.map +1 -1
  239. package/build-module/button/index.native.js +2 -3
  240. package/build-module/button/index.native.js.map +1 -1
  241. package/build-module/card/card/component.js +2 -3
  242. package/build-module/card/card/component.js.map +1 -1
  243. package/build-module/card/styles.js.map +1 -1
  244. package/build-module/checkbox-control/index.js +1 -2
  245. package/build-module/checkbox-control/index.js.map +1 -1
  246. package/build-module/circular-option-picker/circular-option-picker-option.js +1 -2
  247. package/build-module/circular-option-picker/circular-option-picker-option.js.map +1 -1
  248. package/build-module/circular-option-picker/circular-option-picker.js +1 -2
  249. package/build-module/circular-option-picker/circular-option-picker.js.map +1 -1
  250. package/build-module/color-indicator/index.native.js +1 -2
  251. package/build-module/color-indicator/index.native.js.map +1 -1
  252. package/build-module/color-palette/index.js +1 -2
  253. package/build-module/color-palette/index.js.map +1 -1
  254. package/build-module/color-palette/index.native.js +3 -4
  255. package/build-module/color-palette/index.native.js.map +1 -1
  256. package/build-module/color-picker/component.js +1 -2
  257. package/build-module/color-picker/component.js.map +1 -1
  258. package/build-module/color-picker/hsl-input.js +1 -3
  259. package/build-module/color-picker/hsl-input.js.map +1 -1
  260. package/build-module/color-picker/hsv-color-picker.native.js +1 -2
  261. package/build-module/color-picker/hsv-color-picker.native.js.map +1 -1
  262. package/build-module/color-picker/hue-picker.native.js +1 -2
  263. package/build-module/color-picker/hue-picker.native.js.map +1 -1
  264. package/build-module/color-picker/index.native.js +1 -3
  265. package/build-module/color-picker/index.native.js.map +1 -1
  266. package/build-module/color-picker/input-with-slider.js +1 -2
  267. package/build-module/color-picker/input-with-slider.js.map +1 -1
  268. package/build-module/color-picker/rgb-input.js +1 -3
  269. package/build-module/color-picker/rgb-input.js.map +1 -1
  270. package/build-module/color-picker/saturation-picker.native.js +1 -2
  271. package/build-module/color-picker/saturation-picker.native.js.map +1 -1
  272. package/build-module/color-picker/styles.js.map +1 -1
  273. package/build-module/combobox-control/index.js +2 -3
  274. package/build-module/combobox-control/index.js.map +1 -1
  275. package/build-module/composite/legacy/index.js.map +1 -1
  276. package/build-module/confirm-dialog/component.js +1 -3
  277. package/build-module/confirm-dialog/component.js.map +1 -1
  278. package/build-module/context/context-connect.js +1 -0
  279. package/build-module/context/context-connect.js.map +1 -1
  280. package/build-module/context/context-system-provider.js +1 -1
  281. package/build-module/context/context-system-provider.js.map +1 -1
  282. package/build-module/context/get-styled-class-name-from-key.js.map +1 -1
  283. package/build-module/custom-gradient-picker/gradient-bar/control-points.js +1 -3
  284. package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  285. package/build-module/custom-gradient-picker/gradient-bar/index.js +1 -2
  286. package/build-module/custom-gradient-picker/gradient-bar/index.js.map +1 -1
  287. package/build-module/custom-gradient-picker/index.js +1 -2
  288. package/build-module/custom-gradient-picker/index.js.map +1 -1
  289. package/build-module/custom-gradient-picker/index.native.js +1 -3
  290. package/build-module/custom-gradient-picker/index.native.js.map +1 -1
  291. package/build-module/custom-gradient-picker/serializer.js.map +1 -1
  292. package/build-module/custom-gradient-picker/utils.js.map +1 -1
  293. package/build-module/custom-select-control/index.js +1 -3
  294. package/build-module/custom-select-control/index.js.map +1 -1
  295. package/build-module/custom-select-control-v2/custom-select.js +1 -2
  296. package/build-module/custom-select-control-v2/custom-select.js.map +1 -1
  297. package/build-module/custom-select-control-v2/item.js +1 -2
  298. package/build-module/custom-select-control-v2/item.js.map +1 -1
  299. package/build-module/custom-select-control-v2/styles.js.map +1 -1
  300. package/build-module/dashicon/index.js.map +1 -1
  301. package/build-module/date-time/date/index.js +1 -2
  302. package/build-module/date-time/date/index.js.map +1 -1
  303. package/build-module/date-time/date/styles.js.map +1 -1
  304. package/build-module/date-time/date-time/index.js +1 -3
  305. package/build-module/date-time/date-time/index.js.map +1 -1
  306. package/build-module/date-time/time/index.js +1 -2
  307. package/build-module/date-time/time/index.js.map +1 -1
  308. package/build-module/date-time/time/time-input/index.js +1 -2
  309. package/build-module/date-time/time/time-input/index.js.map +1 -1
  310. package/build-module/date-time/time/timezone.js.map +1 -1
  311. package/build-module/dimension-control/index.js +1 -3
  312. package/build-module/dimension-control/index.js.map +1 -1
  313. package/build-module/draggable/index.js +1 -3
  314. package/build-module/draggable/index.js.map +1 -1
  315. package/build-module/drop-zone/index.js +2 -4
  316. package/build-module/drop-zone/index.js.map +1 -1
  317. package/build-module/dropdown/index.js +1 -2
  318. package/build-module/dropdown/index.js.map +1 -1
  319. package/build-module/dropdown/index.native.js +1 -2
  320. package/build-module/dropdown/index.native.js.map +1 -1
  321. package/build-module/dropdown-menu/index.js +1 -2
  322. package/build-module/dropdown-menu/index.js.map +1 -1
  323. package/build-module/dropdown-menu/index.native.js +1 -2
  324. package/build-module/dropdown-menu/index.native.js.map +1 -1
  325. package/build-module/dropdown-menu-v2/checkbox-item.js +1 -2
  326. package/build-module/dropdown-menu-v2/checkbox-item.js.map +1 -1
  327. package/build-module/dropdown-menu-v2/index.js +1 -3
  328. package/build-module/dropdown-menu-v2/index.js.map +1 -1
  329. package/build-module/dropdown-menu-v2/item.js +1 -2
  330. package/build-module/dropdown-menu-v2/item.js.map +1 -1
  331. package/build-module/dropdown-menu-v2/radio-item.js +1 -2
  332. package/build-module/dropdown-menu-v2/radio-item.js.map +1 -1
  333. package/build-module/dropdown-menu-v2/styles.js.map +1 -1
  334. package/build-module/duotone-picker/color-list-picker/index.js +1 -3
  335. package/build-module/duotone-picker/color-list-picker/index.js.map +1 -1
  336. package/build-module/duotone-picker/duotone-picker.js +1 -2
  337. package/build-module/duotone-picker/duotone-picker.js.map +1 -1
  338. package/build-module/duotone-picker/utils.js.map +1 -1
  339. package/build-module/elevation/hook.js.map +1 -1
  340. package/build-module/external-link/index.js +21 -25
  341. package/build-module/external-link/index.js.map +1 -1
  342. package/build-module/external-link/index.native.js +1 -2
  343. package/build-module/external-link/index.native.js.map +1 -1
  344. package/build-module/focal-point-picker/controls.js +1 -2
  345. package/build-module/focal-point-picker/controls.js.map +1 -1
  346. package/build-module/focal-point-picker/focal-point.native.js +1 -2
  347. package/build-module/focal-point-picker/focal-point.native.js.map +1 -1
  348. package/build-module/focal-point-picker/grid.js +1 -2
  349. package/build-module/focal-point-picker/grid.js.map +1 -1
  350. package/build-module/focal-point-picker/index.js +1 -2
  351. package/build-module/focal-point-picker/index.js.map +1 -1
  352. package/build-module/focal-point-picker/index.native.js +1 -2
  353. package/build-module/focal-point-picker/index.native.js.map +1 -1
  354. package/build-module/focal-point-picker/styles/focal-point-style.js.map +1 -1
  355. package/build-module/focal-point-picker/tooltip/index.native.js +1 -2
  356. package/build-module/focal-point-picker/tooltip/index.native.js.map +1 -1
  357. package/build-module/font-size-picker/index.js +1 -2
  358. package/build-module/font-size-picker/index.js.map +1 -1
  359. package/build-module/font-size-picker/index.native.js +1 -3
  360. package/build-module/font-size-picker/index.native.js.map +1 -1
  361. package/build-module/form-file-upload/index.js +1 -2
  362. package/build-module/form-file-upload/index.js.map +1 -1
  363. package/build-module/form-toggle/index.js +1 -2
  364. package/build-module/form-toggle/index.js.map +1 -1
  365. package/build-module/form-token-field/index.js +3 -3
  366. package/build-module/form-token-field/index.js.map +1 -1
  367. package/build-module/form-token-field/suggestions-list.js +1 -2
  368. package/build-module/form-token-field/suggestions-list.js.map +1 -1
  369. package/build-module/form-token-field/token-input.js.map +1 -1
  370. package/build-module/form-token-field/token.js +2 -3
  371. package/build-module/form-token-field/token.js.map +1 -1
  372. package/build-module/gradient-picker/index.js +1 -2
  373. package/build-module/gradient-picker/index.js.map +1 -1
  374. package/build-module/grid/hook.js.map +1 -1
  375. package/build-module/guide/index.js +1 -2
  376. package/build-module/guide/index.js.map +1 -1
  377. package/build-module/guide/page-control.js +1 -1
  378. package/build-module/guide/page-control.js.map +1 -1
  379. package/build-module/h-stack/hook.js.map +1 -1
  380. package/build-module/heading/hook.js.map +1 -1
  381. package/build-module/higher-order/with-fallback-styles/index.js +3 -4
  382. package/build-module/higher-order/with-fallback-styles/index.js.map +1 -1
  383. package/build-module/input-control/index.js.map +1 -1
  384. package/build-module/input-control/input-base.js +1 -2
  385. package/build-module/input-control/input-base.js.map +1 -1
  386. package/build-module/input-control/styles/input-control-styles.js.map +1 -1
  387. package/build-module/item-group/styles.js.map +1 -1
  388. package/build-module/keyboard-shortcuts/index.js +1 -3
  389. package/build-module/keyboard-shortcuts/index.js.map +1 -1
  390. package/build-module/menu-group/index.js +1 -2
  391. package/build-module/menu-group/index.js.map +1 -1
  392. package/build-module/menu-item/index.js +1 -2
  393. package/build-module/menu-item/index.js.map +1 -1
  394. package/build-module/menu-items-choice/index.js +1 -2
  395. package/build-module/menu-items-choice/index.js.map +1 -1
  396. package/build-module/mobile/badge/index.native.js +1 -3
  397. package/build-module/mobile/badge/index.native.js.map +1 -1
  398. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +1 -2
  399. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
  400. package/build-module/mobile/bottom-sheet/cell.native.js +5 -6
  401. package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
  402. package/build-module/mobile/bottom-sheet/color-cell.native.js +1 -2
  403. package/build-module/mobile/bottom-sheet/color-cell.native.js.map +1 -1
  404. package/build-module/mobile/bottom-sheet/index.native.js +1 -3
  405. package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
  406. package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js +1 -2
  407. package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js.map +1 -1
  408. package/build-module/mobile/bottom-sheet/nav-bar/back-button.native.js +1 -2
  409. package/build-module/mobile/bottom-sheet/nav-bar/back-button.native.js.map +1 -1
  410. package/build-module/mobile/bottom-sheet/range-cell.native.js +2 -3
  411. package/build-module/mobile/bottom-sheet/range-cell.native.js.map +1 -1
  412. package/build-module/mobile/bottom-sheet/range-text-input.native.js +1 -2
  413. package/build-module/mobile/bottom-sheet/range-text-input.native.js.map +1 -1
  414. package/build-module/mobile/bottom-sheet/stepper-cell/index.native.js +2 -3
  415. package/build-module/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
  416. package/build-module/mobile/bottom-sheet/stepper-cell/stepper.android.js +1 -2
  417. package/build-module/mobile/bottom-sheet/stepper-cell/stepper.android.js.map +1 -1
  418. package/build-module/mobile/bottom-sheet/stepper-cell/stepper.ios.js +1 -2
  419. package/build-module/mobile/bottom-sheet/stepper-cell/stepper.ios.js.map +1 -1
  420. package/build-module/mobile/bottom-sheet/sub-sheet/index.native.js +1 -3
  421. package/build-module/mobile/bottom-sheet/sub-sheet/index.native.js.map +1 -1
  422. package/build-module/mobile/bottom-sheet/switch-cell.native.js +4 -4
  423. package/build-module/mobile/bottom-sheet/switch-cell.native.js.map +1 -1
  424. package/build-module/mobile/bottom-sheet-select-control/index.native.js +1 -3
  425. package/build-module/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
  426. package/build-module/mobile/bottom-sheet-text-control/index.native.js +1 -3
  427. package/build-module/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
  428. package/build-module/mobile/color-settings/gradient-picker-screen.native.js +1 -2
  429. package/build-module/mobile/color-settings/gradient-picker-screen.native.js.map +1 -1
  430. package/build-module/mobile/color-settings/index.native.js +1 -2
  431. package/build-module/mobile/color-settings/index.native.js.map +1 -1
  432. package/build-module/mobile/color-settings/palette.screen.native.js +1 -3
  433. package/build-module/mobile/color-settings/palette.screen.native.js.map +1 -1
  434. package/build-module/mobile/cycle-select-control/index.native.js.map +1 -1
  435. package/build-module/mobile/focal-point-settings-panel/index.native.js +1 -2
  436. package/build-module/mobile/focal-point-settings-panel/index.native.js.map +1 -1
  437. package/build-module/mobile/gradient/index.native.js +1 -2
  438. package/build-module/mobile/gradient/index.native.js.map +1 -1
  439. package/build-module/mobile/html-text-input/index.native.js +1 -2
  440. package/build-module/mobile/html-text-input/index.native.js.map +1 -1
  441. package/build-module/mobile/image/icon-retry.native.js +1 -2
  442. package/build-module/mobile/image/icon-retry.native.js.map +1 -1
  443. package/build-module/mobile/image/image-editing-button.native.js +1 -2
  444. package/build-module/mobile/image/image-editing-button.native.js.map +1 -1
  445. package/build-module/mobile/image/index.native.js +1 -3
  446. package/build-module/mobile/image/index.native.js.map +1 -1
  447. package/build-module/mobile/keyboard-avoiding-view/index.ios.js +1 -2
  448. package/build-module/mobile/keyboard-avoiding-view/index.ios.js.map +1 -1
  449. package/build-module/mobile/link-picker/index.native.js +2 -3
  450. package/build-module/mobile/link-picker/index.native.js.map +1 -1
  451. package/build-module/mobile/link-picker/link-picker-results.native.js.map +1 -1
  452. package/build-module/mobile/link-settings/index.native.js +1 -3
  453. package/build-module/mobile/link-settings/index.native.js.map +1 -1
  454. package/build-module/mobile/link-settings/link-settings-navigation.native.js +1 -2
  455. package/build-module/mobile/link-settings/link-settings-navigation.native.js.map +1 -1
  456. package/build-module/mobile/picker/index.android.js +1 -2
  457. package/build-module/mobile/picker/index.android.js.map +1 -1
  458. package/build-module/mobile/segmented-control/index.native.js +1 -2
  459. package/build-module/mobile/segmented-control/index.native.js.map +1 -1
  460. package/build-module/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
  461. package/build-module/mobile/utils/use-unit-converter-to-mobile.native.js.map +1 -1
  462. package/build-module/modal/aria-helper.js +2 -1
  463. package/build-module/modal/aria-helper.js.map +1 -1
  464. package/build-module/modal/index.js +3 -4
  465. package/build-module/modal/index.js.map +1 -1
  466. package/build-module/modal/use-modal-exit-animation.js.map +1 -1
  467. package/build-module/navigation/back-button/index.js +1 -2
  468. package/build-module/navigation/back-button/index.js.map +1 -1
  469. package/build-module/navigation/group/index.js +1 -2
  470. package/build-module/navigation/group/index.js.map +1 -1
  471. package/build-module/navigation/item/base-content.js +1 -3
  472. package/build-module/navigation/item/base-content.js.map +1 -1
  473. package/build-module/navigation/item/base.js.map +1 -1
  474. package/build-module/navigation/item/index.js +1 -2
  475. package/build-module/navigation/item/index.js.map +1 -1
  476. package/build-module/navigation/menu/index.js +1 -2
  477. package/build-module/navigation/menu/index.js.map +1 -1
  478. package/build-module/navigation/menu/menu-title-search.js +2 -2
  479. package/build-module/navigation/menu/menu-title-search.js.map +1 -1
  480. package/build-module/navigation/menu/menu-title.js +1 -2
  481. package/build-module/navigation/menu/menu-title.js.map +1 -1
  482. package/build-module/navigation/menu/search-no-results-found.js +1 -2
  483. package/build-module/navigation/menu/search-no-results-found.js.map +1 -1
  484. package/build-module/navigation/styles/navigation-styles.js.map +1 -1
  485. package/build-module/navigator/navigator/component.js.map +1 -1
  486. package/build-module/navigator/navigator-button/hook.js.map +1 -1
  487. package/build-module/notice/index.js +1 -2
  488. package/build-module/notice/index.js.map +1 -1
  489. package/build-module/notice/index.native.js +1 -3
  490. package/build-module/notice/index.native.js.map +1 -1
  491. package/build-module/number-control/index.js +1 -3
  492. package/build-module/number-control/index.js.map +1 -1
  493. package/build-module/number-control/styles/number-control-styles.js.map +1 -1
  494. package/build-module/palette-edit/index.js +25 -5
  495. package/build-module/palette-edit/index.js.map +1 -1
  496. package/build-module/panel/actions.native.js +1 -2
  497. package/build-module/panel/actions.native.js.map +1 -1
  498. package/build-module/panel/body.js +1 -2
  499. package/build-module/panel/body.js.map +1 -1
  500. package/build-module/panel/body.native.js +1 -2
  501. package/build-module/panel/body.native.js.map +1 -1
  502. package/build-module/panel/header.js +1 -2
  503. package/build-module/panel/header.js.map +1 -1
  504. package/build-module/panel/index.js +1 -2
  505. package/build-module/panel/index.js.map +1 -1
  506. package/build-module/placeholder/index.js +1 -2
  507. package/build-module/placeholder/index.js.map +1 -1
  508. package/build-module/popover/index.js +2 -4
  509. package/build-module/popover/index.js.map +1 -1
  510. package/build-module/popover/overlay-middlewares.js.map +1 -1
  511. package/build-module/popover/utils.js.map +1 -1
  512. package/build-module/progress-bar/index.js +1 -2
  513. package/build-module/progress-bar/index.js.map +1 -1
  514. package/build-module/progress-bar/styles.js.map +1 -1
  515. package/build-module/query-controls/index.js.map +1 -1
  516. package/build-module/query-controls/index.native.js +1 -3
  517. package/build-module/query-controls/index.native.js.map +1 -1
  518. package/build-module/radio-control/index.js +1 -2
  519. package/build-module/radio-control/index.js.map +1 -1
  520. package/build-module/radio-control/index.native.js +1 -2
  521. package/build-module/radio-control/index.native.js.map +1 -1
  522. package/build-module/range-control/index.js +1 -2
  523. package/build-module/range-control/index.js.map +1 -1
  524. package/build-module/range-control/index.native.js.map +1 -1
  525. package/build-module/range-control/mark.js +1 -3
  526. package/build-module/range-control/mark.js.map +1 -1
  527. package/build-module/range-control/rail.js +1 -3
  528. package/build-module/range-control/rail.js.map +1 -1
  529. package/build-module/range-control/styles/range-control-styles.js +32 -32
  530. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  531. package/build-module/range-control/tooltip.js +1 -1
  532. package/build-module/range-control/tooltip.js.map +1 -1
  533. package/build-module/range-control/utils.js.map +1 -1
  534. package/build-module/resizable-box/index.js +1 -2
  535. package/build-module/resizable-box/index.js.map +1 -1
  536. package/build-module/resizable-box/resize-tooltip/index.js +1 -2
  537. package/build-module/resizable-box/resize-tooltip/index.js.map +1 -1
  538. package/build-module/resizable-box/resize-tooltip/label.js.map +1 -1
  539. package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
  540. package/build-module/responsive-wrapper/index.js.map +1 -1
  541. package/build-module/sandbox/index.js +1 -2
  542. package/build-module/sandbox/index.js.map +1 -1
  543. package/build-module/sandbox/index.native.js +1 -2
  544. package/build-module/sandbox/index.native.js.map +1 -1
  545. package/build-module/search-control/index.js +6 -0
  546. package/build-module/search-control/index.js.map +1 -1
  547. package/build-module/search-control/index.native.js +1 -2
  548. package/build-module/search-control/index.native.js.map +1 -1
  549. package/build-module/search-control/types.js.map +1 -1
  550. package/build-module/select-control/index.js.map +1 -1
  551. package/build-module/select-control/index.native.js.map +1 -1
  552. package/build-module/slot-fill/index.js +1 -3
  553. package/build-module/slot-fill/index.js.map +1 -1
  554. package/build-module/slot-fill/slot.js +1 -2
  555. package/build-module/slot-fill/slot.js.map +1 -1
  556. package/build-module/snackbar/index.js +1 -2
  557. package/build-module/snackbar/index.js.map +1 -1
  558. package/build-module/snackbar/list.js +1 -2
  559. package/build-module/snackbar/list.js.map +1 -1
  560. package/build-module/spinner/index.js +1 -2
  561. package/build-module/spinner/index.js.map +1 -1
  562. package/build-module/spinner/styles.js.map +1 -1
  563. package/build-module/style-provider/index.js +1 -0
  564. package/build-module/style-provider/index.js.map +1 -1
  565. package/build-module/surface/hook.js.map +1 -1
  566. package/build-module/surface/styles.js.map +1 -1
  567. package/build-module/tab-panel/index.js +1 -2
  568. package/build-module/tab-panel/index.js.map +1 -1
  569. package/build-module/tabs/index.js.map +1 -1
  570. package/build-module/tabs/styles.js +28 -6
  571. package/build-module/tabs/styles.js.map +1 -1
  572. package/build-module/tabs/tab.js +9 -4
  573. package/build-module/tabs/tab.js.map +1 -1
  574. package/build-module/tabs/tablist.js +47 -48
  575. package/build-module/tabs/tablist.js.map +1 -1
  576. package/build-module/tabs/tabpanel.js.map +1 -1
  577. package/build-module/text/get-line-height.js.map +1 -1
  578. package/build-module/text/styles/text-mixins.native.js.map +1 -1
  579. package/build-module/text/utils.js.map +1 -1
  580. package/build-module/text-control/index.native.js.map +1 -1
  581. package/build-module/text-highlight/index.js +1 -2
  582. package/build-module/text-highlight/index.js.map +1 -1
  583. package/build-module/textarea-control/index.js.map +1 -1
  584. package/build-module/theme/color-algorithms.js.map +1 -1
  585. package/build-module/theme/styles.js.map +1 -1
  586. package/build-module/tip/index.js +1 -2
  587. package/build-module/tip/index.js.map +1 -1
  588. package/build-module/toggle-control/index.js +1 -2
  589. package/build-module/toggle-control/index.js.map +1 -1
  590. package/build-module/toggle-control/index.native.js.map +1 -1
  591. package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js +10 -2
  592. package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
  593. package/build-module/toggle-group-control/toggle-group-control/component.js +4 -65
  594. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  595. package/build-module/toggle-group-control/toggle-group-control-option-base/component.js +11 -12
  596. package/build-module/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
  597. package/build-module/toggle-group-control/types.js.map +1 -1
  598. package/build-module/toolbar/toolbar/index.js.map +1 -1
  599. package/build-module/toolbar/toolbar-button/toolbar-button-container.native.js +2 -2
  600. package/build-module/toolbar/toolbar-button/toolbar-button-container.native.js.map +1 -1
  601. package/build-module/toolbar/toolbar-group/index.js +1 -2
  602. package/build-module/toolbar/toolbar-group/index.js.map +1 -1
  603. package/build-module/tools-panel/styles.js.map +1 -1
  604. package/build-module/tools-panel/tools-panel/component.js +1 -2
  605. package/build-module/tools-panel/tools-panel/component.js.map +1 -1
  606. package/build-module/tools-panel/tools-panel-header/component.js +1 -3
  607. package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
  608. package/build-module/tooltip/index.js +6 -3
  609. package/build-module/tooltip/index.js.map +1 -1
  610. package/build-module/tooltip/index.native.js +1 -3
  611. package/build-module/tooltip/index.native.js.map +1 -1
  612. package/build-module/tree-grid/cell.js +1 -2
  613. package/build-module/tree-grid/cell.js.map +1 -1
  614. package/build-module/unit-control/index.js.map +1 -1
  615. package/build-module/unit-control/index.native.js +1 -3
  616. package/build-module/unit-control/index.native.js.map +1 -1
  617. package/build-module/unit-control/utils.js.map +1 -1
  618. package/build-module/utils/breakpoint.js.map +1 -1
  619. package/build-module/utils/colors-values.js.map +1 -1
  620. package/build-module/utils/config-values.js.map +1 -1
  621. package/build-module/utils/font-size.js.map +1 -1
  622. package/build-module/utils/hooks/use-animated-offset-rect.js +74 -0
  623. package/build-module/utils/hooks/use-animated-offset-rect.js.map +1 -0
  624. package/build-module/utils/hooks/use-cx.js.map +1 -1
  625. package/build-module/utils/math.js +2 -2
  626. package/build-module/utils/math.js.map +1 -1
  627. package/build-module/utils/space.js.map +1 -1
  628. package/build-module/utils/unit-values.js.map +1 -1
  629. package/build-module/utils/use-responsive-value.js.map +1 -1
  630. package/build-style/style-rtl.css +8 -5
  631. package/build-style/style.css +8 -5
  632. package/build-types/alignment-matrix-control/types.d.ts +2 -0
  633. package/build-types/alignment-matrix-control/types.d.ts.map +1 -1
  634. package/build-types/drop-zone/index.d.ts.map +1 -1
  635. package/build-types/modal/aria-helper.d.ts.map +1 -1
  636. package/build-types/palette-edit/index.d.ts +3 -0
  637. package/build-types/palette-edit/index.d.ts.map +1 -1
  638. package/build-types/range-control/styles/range-control-styles.d.ts +1 -1
  639. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  640. package/build-types/search-control/index.d.ts.map +1 -1
  641. package/build-types/search-control/stories/index.story.d.ts +0 -8
  642. package/build-types/search-control/stories/index.story.d.ts.map +1 -1
  643. package/build-types/search-control/types.d.ts +3 -0
  644. package/build-types/search-control/types.d.ts.map +1 -1
  645. package/build-types/tabs/styles.d.ts +7 -0
  646. package/build-types/tabs/styles.d.ts.map +1 -1
  647. package/build-types/tabs/tab.d.ts.map +1 -1
  648. package/build-types/tabs/tablist.d.ts.map +1 -1
  649. package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts.map +1 -1
  650. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  651. package/build-types/toggle-group-control/types.d.ts +1 -0
  652. package/build-types/toggle-group-control/types.d.ts.map +1 -1
  653. package/build-types/tooltip/index.d.ts.map +1 -1
  654. package/build-types/utils/hooks/use-animated-offset-rect.d.ts +62 -0
  655. package/build-types/utils/hooks/use-animated-offset-rect.d.ts.map +1 -0
  656. package/package.json +20 -20
  657. package/schemas/docs-manifest.json +38 -0
  658. package/src/alignment-matrix-control/README.md +46 -36
  659. package/src/alignment-matrix-control/docs-manifest.json +12 -0
  660. package/src/alignment-matrix-control/types.ts +2 -0
  661. package/src/angle-picker-control/README.md +36 -23
  662. package/src/angle-picker-control/docs-manifest.json +5 -0
  663. package/src/button/style.scss +5 -1
  664. package/src/composite/test/index.tsx +629 -38
  665. package/src/drop-zone/index.tsx +1 -2
  666. package/src/drop-zone/style.scss +1 -1
  667. package/src/modal/aria-helper.ts +1 -0
  668. package/src/palette-edit/index.tsx +30 -5
  669. package/src/palette-edit/test/index.tsx +50 -1
  670. package/src/range-control/styles/range-control-styles.ts +19 -10
  671. package/src/range-control/tooltip.tsx +1 -1
  672. package/src/search-control/README.md +2 -0
  673. package/src/search-control/index.tsx +7 -0
  674. package/src/search-control/stories/index.story.tsx +0 -15
  675. package/src/search-control/test/index.tsx +4 -1
  676. package/src/search-control/types.ts +3 -0
  677. package/src/tabs/styles.ts +116 -47
  678. package/src/tabs/tab.tsx +8 -2
  679. package/src/tabs/tablist.tsx +48 -49
  680. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +6 -6
  681. package/src/toggle-group-control/test/index.tsx +39 -0
  682. package/src/toggle-group-control/toggle-group-control/as-radio-group.tsx +11 -1
  683. package/src/toggle-group-control/toggle-group-control/component.tsx +3 -98
  684. package/src/toggle-group-control/toggle-group-control-option-base/component.tsx +15 -15
  685. package/src/toggle-group-control/types.ts +1 -0
  686. package/src/tooltip/index.tsx +8 -1
  687. package/src/tooltip/test/index.tsx +78 -0
  688. package/src/utils/hooks/use-animated-offset-rect.ts +107 -0
  689. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["_fontFamily","require","_emotionCss","_interopRequireDefault","_colorsValues","fontWeightNormal","fontWeightMedium","fontWeightSemibold","title","titleLarge","titleMedium","titleSmall","subtitle","subtitleLarge","subtitleSmall","body","bodyLarge","bodySmall","button","caption","label","sectionHeading","COLORS","gray","variant","variantName","css","text","props","fontFamily","exports"],"sources":["@wordpress/components/src/text/styles/text-mixins.native.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { fontFamily } from './font-family';\nimport css from './emotion-css';\nimport { COLORS } from '../../utils/colors-values';\n\nconst fontWeightNormal = `font-weight: 400;`;\nconst fontWeightMedium = `font-weight: 500;`;\nconst fontWeightSemibold = `font-weight: 600;`;\n\nconst title = `\n ${ fontWeightNormal }\n`;\n\nconst titleLarge = `\n\tfont-size: 32px;\n\tline-height: 40px;\n`;\n\nconst titleMedium = `\n\tfont-size: 24px;\n\tline-height: 32px;\n`;\n\nconst titleSmall = `\n\tfont-size: 20px;\n\tline-height: 28px;\n`;\n\nconst subtitle = `\n\t${ fontWeightSemibold }\n\tfont-size: 14px;\n\tline-height: 20px;\n`;\n\nconst subtitleLarge = `\n\tfont-size: 16px;\n\tline-height: 24px;\n`;\n\nconst subtitleSmall = `\n\tfont-size: 14px;\n\tline-height: 20px;\n`;\n\nconst body = `\n\t${ fontWeightNormal }\n`;\n\nconst bodyLarge = `\n\tfont-size: 16px;\n\tline-height: 24px;\n`;\n\nconst bodySmall = `\n\tfont-size: 14px;\n\tline-height: 20px;\n`;\n\nconst button = `\n ${ fontWeightSemibold }\n font-size: 14px;\n line-height: 20px;\n`;\n\nconst caption = `\n\t${ fontWeightNormal }\n\tfont-size: 12px;\n\tline-height: 16px;\n`;\n\nconst label = `\n\t${ fontWeightSemibold }\n\tfont-size: 12px;\n\tline-height: 16px;\n`;\n\nconst sectionHeading = `\n\t${ fontWeightMedium }\n\tfont-size: 11px;\n\tline-height: 1.4;\n\ttext-transform: uppercase;\n\tcolor: ${ COLORS.gray[ 700 ] }\n`;\n\n/**\n * @typedef {'title.large'|'title.medium'|'title.small'|'subtitle'|'subtitle.small'|'body'|'body.large'|'body.small'|'button'|'caption'|'label'|'sectionheading'} TextVariant\n */\n\n/**\n * @param {TextVariant} variantName\n */\nconst variant = ( variantName = 'body' ) => {\n\tswitch ( variantName ) {\n\t\tcase 'title.large':\n\t\t\treturn css`\n\t\t\t\t${ title }\n\t\t\t\t${ titleLarge }\n\t\t\t`;\n\t\tcase 'title.medium':\n\t\t\treturn css`\n\t\t\t\t${ title }\n\t\t\t\t${ titleMedium }\n\t\t\t`;\n\t\tcase 'title.small':\n\t\t\treturn css`\n\t\t\t\t${ title }\n\t\t\t\t${ titleSmall }\n\t\t\t`;\n\n\t\tcase 'subtitle':\n\t\t\treturn css`\n\t\t\t\t${ subtitle }\n\t\t\t\t${ subtitleLarge }\n\t\t\t`;\n\t\tcase 'subtitle.small':\n\t\t\treturn css`\n\t\t\t\t${ subtitle }\n\t\t\t\t${ subtitleSmall }\n\t\t\t`;\n\n\t\tcase 'body':\n\t\t\treturn css`\n\t\t\t\t${ body }\n\t\t\t`;\n\t\tcase 'body.large':\n\t\t\treturn css`\n\t\t\t\t${ body }\n\t\t\t\t${ bodyLarge }\n\t\t\t`;\n\t\tcase 'body.small':\n\t\t\treturn css`\n\t\t\t\t${ body }\n\t\t\t\t${ bodySmall }\n\t\t\t`;\n\n\t\tcase 'button':\n\t\t\treturn button;\n\n\t\tcase 'caption':\n\t\t\treturn caption;\n\n\t\tcase 'label':\n\t\t\treturn label;\n\n\t\tcase 'sectionheading':\n\t\t\treturn sectionHeading;\n\t}\n};\n\n/**\n * @typedef {Object} TextProps\n * @property {TextVariant} variant one of TextVariant to be used\n */\n\n/**\n * @param {TextProps} props\n */\nexport const text = ( props ) => css`\n\t${ fontFamily }\n\t${ variant( props.variant ) }\n`;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AALA;AACA;AACA;;AAKA,MAAMI,gBAAgB,GAAI,mBAAkB;AAC5C,MAAMC,gBAAgB,GAAI,mBAAkB;AAC5C,MAAMC,kBAAkB,GAAI,mBAAkB;AAE9C,MAAMC,KAAK,GAAI;AACf,IAAKH,gBAAkB;AACvB,CAAC;AAED,MAAMI,UAAU,GAAI;AACpB;AACA;AAC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,IAAI;IACF,KAAK,gBAAgB;MACpB,OAAO,IAAAa,mBAAG,CAAC;AACd,MAAOd,QAAU;AACjB,MAAOE,aAAe;AACtB,IAAI;IAEF,KAAK,MAAM;MACV,OAAO,IAAAY,mBAAG,CAAC;AACd,MAAOX,IAAM;AACb,IAAI;IACF,KAAK,YAAY;MAChB,OAAO,IAAAW,mBAAG,CAAC;AACd,MAAOX,IAAM;AACb,MAAOC,SAAW;AAClB,IAAI;IACF,KAAK,YAAY;MAChB,OAAO,IAAAU,mBAAG,CAAC;AACd,MAAOX,IAAM;AACb,MAAOE,SAAW;AAClB,IAAI;IAEF,KAAK,QAAQ;MACZ,OAAOC,MAAM;IAEd,KAAK,SAAS;MACb,OAAOC,OAAO;IAEf,KAAK,OAAO;MACX,OAAOC,KAAK;IAEb,KAAK,gBAAgB;MACpB,OAAOC,cAAc;EACvB;AACD,CAAC;;AAED;AACA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAMM,IAAI,GAAKC,KAAK,IAAM,IAAAF,mBAAG,CAAC;AACrC,GAAIG,sBAAY;AAChB,GAAIL,OAAO,CAAEI,KAAK,CAACJ,OAAQ,CAAG;AAC9B,CAAC;AAACM,OAAA,CAAAH,IAAA,GAAAA,IAAA","ignoreList":[]}
1
+ {"version":3,"names":["_fontFamily","require","_emotionCss","_interopRequireDefault","_colorsValues","fontWeightNormal","fontWeightMedium","fontWeightSemibold","title","titleLarge","titleMedium","titleSmall","subtitle","subtitleLarge","subtitleSmall","body","bodyLarge","bodySmall","button","caption","label","sectionHeading","COLORS","gray","variant","variantName","css","text","props","fontFamily","exports"],"sources":["@wordpress/components/src/text/styles/text-mixins.native.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { fontFamily } from './font-family';\nimport css from './emotion-css';\nimport { COLORS } from '../../utils/colors-values';\n\nconst fontWeightNormal = `font-weight: 400;`;\nconst fontWeightMedium = `font-weight: 500;`;\nconst fontWeightSemibold = `font-weight: 600;`;\n\nconst title = `\n ${ fontWeightNormal }\n`;\n\nconst titleLarge = `\n\tfont-size: 32px;\n\tline-height: 40px;\n`;\n\nconst titleMedium = `\n\tfont-size: 24px;\n\tline-height: 32px;\n`;\n\nconst titleSmall = `\n\tfont-size: 20px;\n\tline-height: 28px;\n`;\n\nconst subtitle = `\n\t${ fontWeightSemibold }\n\tfont-size: 14px;\n\tline-height: 20px;\n`;\n\nconst subtitleLarge = `\n\tfont-size: 16px;\n\tline-height: 24px;\n`;\n\nconst subtitleSmall = `\n\tfont-size: 14px;\n\tline-height: 20px;\n`;\n\nconst body = `\n\t${ fontWeightNormal }\n`;\n\nconst bodyLarge = `\n\tfont-size: 16px;\n\tline-height: 24px;\n`;\n\nconst bodySmall = `\n\tfont-size: 14px;\n\tline-height: 20px;\n`;\n\nconst button = `\n ${ fontWeightSemibold }\n font-size: 14px;\n line-height: 20px;\n`;\n\nconst caption = `\n\t${ fontWeightNormal }\n\tfont-size: 12px;\n\tline-height: 16px;\n`;\n\nconst label = `\n\t${ fontWeightSemibold }\n\tfont-size: 12px;\n\tline-height: 16px;\n`;\n\nconst sectionHeading = `\n\t${ fontWeightMedium }\n\tfont-size: 11px;\n\tline-height: 1.4;\n\ttext-transform: uppercase;\n\tcolor: ${ COLORS.gray[ 700 ] }\n`;\n\n/**\n * @typedef {'title.large'|'title.medium'|'title.small'|'subtitle'|'subtitle.small'|'body'|'body.large'|'body.small'|'button'|'caption'|'label'|'sectionheading'} TextVariant\n */\n\n/**\n * @param {TextVariant} variantName\n */\nconst variant = ( variantName = 'body' ) => {\n\tswitch ( variantName ) {\n\t\tcase 'title.large':\n\t\t\treturn css`\n\t\t\t\t${ title }\n\t\t\t\t${ titleLarge }\n\t\t\t`;\n\t\tcase 'title.medium':\n\t\t\treturn css`\n\t\t\t\t${ title }\n\t\t\t\t${ titleMedium }\n\t\t\t`;\n\t\tcase 'title.small':\n\t\t\treturn css`\n\t\t\t\t${ title }\n\t\t\t\t${ titleSmall }\n\t\t\t`;\n\n\t\tcase 'subtitle':\n\t\t\treturn css`\n\t\t\t\t${ subtitle }\n\t\t\t\t${ subtitleLarge }\n\t\t\t`;\n\t\tcase 'subtitle.small':\n\t\t\treturn css`\n\t\t\t\t${ subtitle }\n\t\t\t\t${ subtitleSmall }\n\t\t\t`;\n\n\t\tcase 'body':\n\t\t\treturn css`\n\t\t\t\t${ body }\n\t\t\t`;\n\t\tcase 'body.large':\n\t\t\treturn css`\n\t\t\t\t${ body }\n\t\t\t\t${ bodyLarge }\n\t\t\t`;\n\t\tcase 'body.small':\n\t\t\treturn css`\n\t\t\t\t${ body }\n\t\t\t\t${ bodySmall }\n\t\t\t`;\n\n\t\tcase 'button':\n\t\t\treturn button;\n\n\t\tcase 'caption':\n\t\t\treturn caption;\n\n\t\tcase 'label':\n\t\t\treturn label;\n\n\t\tcase 'sectionheading':\n\t\t\treturn sectionHeading;\n\t}\n};\n\n/**\n * @typedef {Object} TextProps\n * @property {TextVariant} variant one of TextVariant to be used\n */\n\n/**\n * @param {TextProps} props\n */\nexport const text = ( props ) => css`\n\t${ fontFamily }\n\t${ variant( props.variant ) }\n`;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AALA;AACA;AACA;;AAKA,MAAMI,gBAAgB,GAAG,mBAAmB;AAC5C,MAAMC,gBAAgB,GAAG,mBAAmB;AAC5C,MAAMC,kBAAkB,GAAG,mBAAmB;AAE9C,MAAMC,KAAK,GAAG;AACd,IAAKH,gBAAgB;AACrB,CAAC;AAED,MAAMI,UAAU,GAAG;AACnB;AACA;AACA,CAAC;AAED,MAAMC,WAAW,GAAG;AACpB;AACA;AACA,CAAC;AAED,MAAMC,UAAU,GAAG;AACnB;AACA;AACA,CAAC;AAED,MAAMC,QAAQ,GAAG;AACjB,GAAIL,kBAAkB;AACtB;AACA;AACA,CAAC;AAED,MAAMM,aAAa,GAAG;AACtB;AACA;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AOX,IAAI;AACX,MAAOC,SAAS;AAChB,IAAI;IACF,KAAK,YAAY;MAChB,OAAO,IAAAU,mBAAG;AACb,MAAOX,IAAI;AACX,MAAOE,SAAS;AAChB,IAAI;IAEF,KAAK,QAAQ;MACZ,OAAOC,MAAM;IAEd,KAAK,SAAS;MACb,OAAOC,OAAO;IAEf,KAAK,OAAO;MACX,OAAOC,KAAK;IAEb,KAAK,gBAAgB;MACpB,OAAOC,cAAc;EACvB;AACD,CAAC;;AAED;AACA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAMM,IAAI,GAAKC,KAAK,IAAM,IAAAF,mBAAG;AACpC,GAAIG,sBAAU;AACd,GAAIL,OAAO,CAAEI,KAAK,CAACJ,OAAQ,CAAC;AAC5B,CAAC;AAACM,OAAA,CAAAH,IAAA,GAAAA,IAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_memize","_interopRequireDefault","require","_highlightWordsCore","_element","lowercaseProps","object","mapped","key","toLowerCase","memoizedLowercaseProps","memoize","createHighlighterText","activeClassName","activeIndex","activeStyle","autoEscape","caseSensitive","children","findChunks","highlightClassName","highlightStyle","highlightTag","sanitize","searchWords","unhighlightClassName","unhighlightStyle","textToHighlight","chunks","findAll","HighlightTag","highlightIndex","highlightClassNames","highlightStyles","textContent","map","chunk","index","text","substr","start","end","highlight","highlightClass","isActive","Object","assign","props","className","style","createElement"],"sources":["@wordpress/components/src/text/utils.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport memoize from 'memize';\nimport type { FindAllArgs } from 'highlight-words-core';\nimport { findAll } from 'highlight-words-core';\n\n/**\n * WordPress dependencies\n */\nimport { createElement } from '@wordpress/element';\n\n/**\n * Source:\n * https://github.com/bvaughn/react-highlight-words/blob/HEAD/src/Highlighter.js\n */\n\n/**\n * @typedef Options\n * @property {string} [activeClassName=''] Classname for active highlighted areas.\n * @property {number} [activeIndex=-1] The index of the active highlighted area.\n * @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [activeStyle] Styles to apply to the active highlighted area.\n * @property {boolean} [autoEscape] Whether to automatically escape text.\n * @property {boolean} [caseSensitive=false] Whether to highlight in a case-sensitive manner.\n * @property {string} children Children to highlight.\n * @property {import('highlight-words-core').FindAllArgs['findChunks']} [findChunks] Custom `findChunks` function to pass to `highlight-words-core`.\n * @property {string | Record<string, unknown>} [highlightClassName=''] Classname to apply to highlighted text or a Record of classnames to apply to given text (which should be the key).\n * @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [highlightStyle={}] Styles to apply to highlighted text.\n * @property {keyof JSX.IntrinsicElements} [highlightTag='mark'] Tag to use for the highlighted text.\n * @property {import('highlight-words-core').FindAllArgs['sanitize']} [sanitize] Custom `santize` function to pass to `highlight-words-core`.\n * @property {string[]} [searchWords=[]] Words to search for and highlight.\n * @property {string} [unhighlightClassName=''] Classname to apply to unhighlighted text.\n * @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [unhighlightStyle] Style to apply to unhighlighted text.\n */\n\ninterface Options {\n\tactiveClassName?: string;\n\tactiveIndex?: number;\n\tactiveStyle?: React.AllHTMLAttributes< HTMLDivElement >[ 'style' ];\n\tautoEscape?: boolean;\n\tcaseSensitive?: boolean;\n\tchildren: string;\n\tfindChunks?: FindAllArgs[ 'findChunks' ];\n\thighlightClassName?: string | Record< string, unknown >;\n\thighlightStyle?: React.AllHTMLAttributes< HTMLDivElement >[ 'style' ];\n\thighlightTag?: keyof JSX.IntrinsicElements;\n\tsanitize?: FindAllArgs[ 'sanitize' ];\n\tsearchWords?: string[];\n\tunhighlightClassName?: string;\n\tunhighlightStyle?: React.AllHTMLAttributes< HTMLDivElement >[ 'style' ];\n}\n\n/**\n * Maps props to lowercase names.\n *\n * @param object Props to map.\n * @return The mapped props.\n */\nconst lowercaseProps = < T extends Record< string, unknown > >( object: T ) => {\n\tconst mapped: Record< string, unknown > = {};\n\tfor ( const key in object ) {\n\t\tmapped[ key.toLowerCase() ] = object[ key ];\n\t}\n\treturn mapped as { [ K in keyof T as Lowercase< string & K > ]: T[ K ] };\n};\n\nconst memoizedLowercaseProps = memoize( lowercaseProps );\n\n/**\n * @param options\n * @param options.activeClassName\n * @param options.activeIndex\n * @param options.activeStyle\n * @param options.autoEscape\n * @param options.caseSensitive\n * @param options.children\n * @param options.findChunks\n * @param options.highlightClassName\n * @param options.highlightStyle\n * @param options.highlightTag\n * @param options.sanitize\n * @param options.searchWords\n * @param options.unhighlightClassName\n * @param options.unhighlightStyle\n */\nexport function createHighlighterText( {\n\tactiveClassName = '',\n\tactiveIndex = -1,\n\tactiveStyle,\n\tautoEscape,\n\tcaseSensitive = false,\n\tchildren,\n\tfindChunks,\n\thighlightClassName = '',\n\thighlightStyle = {},\n\thighlightTag = 'mark',\n\tsanitize,\n\tsearchWords = [],\n\tunhighlightClassName = '',\n\tunhighlightStyle,\n}: Options ) {\n\tif ( ! children ) {\n\t\treturn null;\n\t}\n\tif ( typeof children !== 'string' ) {\n\t\treturn children;\n\t}\n\n\tconst textToHighlight = children;\n\n\tconst chunks = findAll( {\n\t\tautoEscape,\n\t\tcaseSensitive,\n\t\tfindChunks,\n\t\tsanitize,\n\t\tsearchWords,\n\t\ttextToHighlight,\n\t} );\n\tconst HighlightTag = highlightTag;\n\tlet highlightIndex = -1;\n\tlet highlightClassNames = '';\n\tlet highlightStyles;\n\n\tconst textContent = chunks.map( ( chunk, index ) => {\n\t\tconst text = textToHighlight.substr(\n\t\t\tchunk.start,\n\t\t\tchunk.end - chunk.start\n\t\t);\n\n\t\tif ( chunk.highlight ) {\n\t\t\thighlightIndex++;\n\n\t\t\tlet highlightClass;\n\t\t\tif ( typeof highlightClassName === 'object' ) {\n\t\t\t\tif ( ! caseSensitive ) {\n\t\t\t\t\thighlightClassName =\n\t\t\t\t\t\tmemoizedLowercaseProps( highlightClassName );\n\t\t\t\t\thighlightClass = highlightClassName[ text.toLowerCase() ];\n\t\t\t\t} else {\n\t\t\t\t\thighlightClass = highlightClassName[ text ];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thighlightClass = highlightClassName;\n\t\t\t}\n\n\t\t\tconst isActive = highlightIndex === +activeIndex;\n\n\t\t\thighlightClassNames = `${ highlightClass } ${\n\t\t\t\tisActive ? activeClassName : ''\n\t\t\t}`;\n\t\t\thighlightStyles =\n\t\t\t\tisActive === true && activeStyle !== null\n\t\t\t\t\t? Object.assign( {}, highlightStyle, activeStyle )\n\t\t\t\t\t: highlightStyle;\n\n\t\t\tconst props: Record< string, unknown > = {\n\t\t\t\tchildren: text,\n\t\t\t\tclassName: highlightClassNames,\n\t\t\t\tkey: index,\n\t\t\t\tstyle: highlightStyles,\n\t\t\t};\n\n\t\t\t// Don't attach arbitrary props to DOM elements; this triggers React DEV warnings (https://fb.me/react-unknown-prop)\n\t\t\t// Only pass through the highlightIndex attribute for custom components.\n\t\t\tif ( typeof HighlightTag !== 'string' ) {\n\t\t\t\tprops.highlightIndex = highlightIndex;\n\t\t\t}\n\n\t\t\treturn createElement( HighlightTag, props );\n\t\t}\n\t\treturn createElement( 'span', {\n\t\t\tchildren: text,\n\t\t\tclassName: unhighlightClassName,\n\t\t\tkey: index,\n\t\t\tstyle: unhighlightStyle,\n\t\t} );\n\t} );\n\n\treturn textContent;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,mBAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAF,OAAA;AAVA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmBA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,cAAc,GAA4CC,MAAS,IAAM;EAC9E,MAAMC,MAAiC,GAAG,CAAC,CAAC;EAC5C,KAAM,MAAMC,GAAG,IAAIF,MAAM,EAAG;IAC3BC,MAAM,CAAEC,GAAG,CAACC,WAAW,CAA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_memize","_interopRequireDefault","require","_highlightWordsCore","_element","lowercaseProps","object","mapped","key","toLowerCase","memoizedLowercaseProps","memoize","createHighlighterText","activeClassName","activeIndex","activeStyle","autoEscape","caseSensitive","children","findChunks","highlightClassName","highlightStyle","highlightTag","sanitize","searchWords","unhighlightClassName","unhighlightStyle","textToHighlight","chunks","findAll","HighlightTag","highlightIndex","highlightClassNames","highlightStyles","textContent","map","chunk","index","text","substr","start","end","highlight","highlightClass","isActive","Object","assign","props","className","style","createElement"],"sources":["@wordpress/components/src/text/utils.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport memoize from 'memize';\nimport type { FindAllArgs } from 'highlight-words-core';\nimport { findAll } from 'highlight-words-core';\n\n/**\n * WordPress dependencies\n */\nimport { createElement } from '@wordpress/element';\n\n/**\n * Source:\n * https://github.com/bvaughn/react-highlight-words/blob/HEAD/src/Highlighter.js\n */\n\n/**\n * @typedef Options\n * @property {string} [activeClassName=''] Classname for active highlighted areas.\n * @property {number} [activeIndex=-1] The index of the active highlighted area.\n * @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [activeStyle] Styles to apply to the active highlighted area.\n * @property {boolean} [autoEscape] Whether to automatically escape text.\n * @property {boolean} [caseSensitive=false] Whether to highlight in a case-sensitive manner.\n * @property {string} children Children to highlight.\n * @property {import('highlight-words-core').FindAllArgs['findChunks']} [findChunks] Custom `findChunks` function to pass to `highlight-words-core`.\n * @property {string | Record<string, unknown>} [highlightClassName=''] Classname to apply to highlighted text or a Record of classnames to apply to given text (which should be the key).\n * @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [highlightStyle={}] Styles to apply to highlighted text.\n * @property {keyof JSX.IntrinsicElements} [highlightTag='mark'] Tag to use for the highlighted text.\n * @property {import('highlight-words-core').FindAllArgs['sanitize']} [sanitize] Custom `santize` function to pass to `highlight-words-core`.\n * @property {string[]} [searchWords=[]] Words to search for and highlight.\n * @property {string} [unhighlightClassName=''] Classname to apply to unhighlighted text.\n * @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [unhighlightStyle] Style to apply to unhighlighted text.\n */\n\ninterface Options {\n\tactiveClassName?: string;\n\tactiveIndex?: number;\n\tactiveStyle?: React.AllHTMLAttributes< HTMLDivElement >[ 'style' ];\n\tautoEscape?: boolean;\n\tcaseSensitive?: boolean;\n\tchildren: string;\n\tfindChunks?: FindAllArgs[ 'findChunks' ];\n\thighlightClassName?: string | Record< string, unknown >;\n\thighlightStyle?: React.AllHTMLAttributes< HTMLDivElement >[ 'style' ];\n\thighlightTag?: keyof JSX.IntrinsicElements;\n\tsanitize?: FindAllArgs[ 'sanitize' ];\n\tsearchWords?: string[];\n\tunhighlightClassName?: string;\n\tunhighlightStyle?: React.AllHTMLAttributes< HTMLDivElement >[ 'style' ];\n}\n\n/**\n * Maps props to lowercase names.\n *\n * @param object Props to map.\n * @return The mapped props.\n */\nconst lowercaseProps = < T extends Record< string, unknown > >( object: T ) => {\n\tconst mapped: Record< string, unknown > = {};\n\tfor ( const key in object ) {\n\t\tmapped[ key.toLowerCase() ] = object[ key ];\n\t}\n\treturn mapped as { [ K in keyof T as Lowercase< string & K > ]: T[ K ] };\n};\n\nconst memoizedLowercaseProps = memoize( lowercaseProps );\n\n/**\n * @param options\n * @param options.activeClassName\n * @param options.activeIndex\n * @param options.activeStyle\n * @param options.autoEscape\n * @param options.caseSensitive\n * @param options.children\n * @param options.findChunks\n * @param options.highlightClassName\n * @param options.highlightStyle\n * @param options.highlightTag\n * @param options.sanitize\n * @param options.searchWords\n * @param options.unhighlightClassName\n * @param options.unhighlightStyle\n */\nexport function createHighlighterText( {\n\tactiveClassName = '',\n\tactiveIndex = -1,\n\tactiveStyle,\n\tautoEscape,\n\tcaseSensitive = false,\n\tchildren,\n\tfindChunks,\n\thighlightClassName = '',\n\thighlightStyle = {},\n\thighlightTag = 'mark',\n\tsanitize,\n\tsearchWords = [],\n\tunhighlightClassName = '',\n\tunhighlightStyle,\n}: Options ) {\n\tif ( ! children ) {\n\t\treturn null;\n\t}\n\tif ( typeof children !== 'string' ) {\n\t\treturn children;\n\t}\n\n\tconst textToHighlight = children;\n\n\tconst chunks = findAll( {\n\t\tautoEscape,\n\t\tcaseSensitive,\n\t\tfindChunks,\n\t\tsanitize,\n\t\tsearchWords,\n\t\ttextToHighlight,\n\t} );\n\tconst HighlightTag = highlightTag;\n\tlet highlightIndex = -1;\n\tlet highlightClassNames = '';\n\tlet highlightStyles;\n\n\tconst textContent = chunks.map( ( chunk, index ) => {\n\t\tconst text = textToHighlight.substr(\n\t\t\tchunk.start,\n\t\t\tchunk.end - chunk.start\n\t\t);\n\n\t\tif ( chunk.highlight ) {\n\t\t\thighlightIndex++;\n\n\t\t\tlet highlightClass;\n\t\t\tif ( typeof highlightClassName === 'object' ) {\n\t\t\t\tif ( ! caseSensitive ) {\n\t\t\t\t\thighlightClassName =\n\t\t\t\t\t\tmemoizedLowercaseProps( highlightClassName );\n\t\t\t\t\thighlightClass = highlightClassName[ text.toLowerCase() ];\n\t\t\t\t} else {\n\t\t\t\t\thighlightClass = highlightClassName[ text ];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thighlightClass = highlightClassName;\n\t\t\t}\n\n\t\t\tconst isActive = highlightIndex === +activeIndex;\n\n\t\t\thighlightClassNames = `${ highlightClass } ${\n\t\t\t\tisActive ? activeClassName : ''\n\t\t\t}`;\n\t\t\thighlightStyles =\n\t\t\t\tisActive === true && activeStyle !== null\n\t\t\t\t\t? Object.assign( {}, highlightStyle, activeStyle )\n\t\t\t\t\t: highlightStyle;\n\n\t\t\tconst props: Record< string, unknown > = {\n\t\t\t\tchildren: text,\n\t\t\t\tclassName: highlightClassNames,\n\t\t\t\tkey: index,\n\t\t\t\tstyle: highlightStyles,\n\t\t\t};\n\n\t\t\t// Don't attach arbitrary props to DOM elements; this triggers React DEV warnings (https://fb.me/react-unknown-prop)\n\t\t\t// Only pass through the highlightIndex attribute for custom components.\n\t\t\tif ( typeof HighlightTag !== 'string' ) {\n\t\t\t\tprops.highlightIndex = highlightIndex;\n\t\t\t}\n\n\t\t\treturn createElement( HighlightTag, props );\n\t\t}\n\t\treturn createElement( 'span', {\n\t\t\tchildren: text,\n\t\t\tclassName: unhighlightClassName,\n\t\t\tkey: index,\n\t\t\tstyle: unhighlightStyle,\n\t\t} );\n\t} );\n\n\treturn textContent;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,mBAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAF,OAAA;AAVA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmBA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,cAAc,GAA4CC,MAAS,IAAM;EAC9E,MAAMC,MAAiC,GAAG,CAAC,CAAC;EAC5C,KAAM,MAAMC,GAAG,IAAIF,MAAM,EAAG;IAC3BC,MAAM,CAAEC,GAAG,CAACC,WAAW,CAAC,CAAC,CAAE,GAAGH,MAAM,CAAEE,GAAG,CAAE;EAC5C;EACA,OAAOD,MAAM;AACd,CAAC;AAED,MAAMG,sBAAsB,GAAG,IAAAC,eAAO,EAAEN,cAAe,CAAC;;AAExD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASO,qBAAqBA,CAAE;EACtCC,eAAe,GAAG,EAAE;EACpBC,WAAW,GAAG,CAAC,CAAC;EAChBC,WAAW;EACXC,UAAU;EACVC,aAAa,GAAG,KAAK;EACrBC,QAAQ;EACRC,UAAU;EACVC,kBAAkB,GAAG,EAAE;EACvBC,cAAc,GAAG,CAAC,CAAC;EACnBC,YAAY,GAAG,MAAM;EACrBC,QAAQ;EACRC,WAAW,GAAG,EAAE;EAChBC,oBAAoB,GAAG,EAAE;EACzBC;AACQ,CAAC,E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7B,WAAW,KAAK,IAAI,GACtC8B,MAAM,CAACC,MAAM,CAAE,CAAC,CAAC,EAAEzB,cAAc,EAAEN,WAAY,CAAC,GAChDM,cAAc;MAElB,MAAM0B,KAAgC,GAAG;QACxC7B,QAAQ,EAAEoB,IAAI;QACdU,SAAS,EAAEhB,mBAAmB;QAC9BxB,GAAG,EAAE6B,KAAK;QACVY,KAAK,EAAEhB;MACR,CAAC;;MAED;MACA;MACA,IAAK,OAAOH,YAAY,KAAK,QAAQ,EAAG;QACvCiB,KAAK,CAAChB,cAAc,GAAGA,cAAc;MACtC;MAEA,OAAO,IAAAmB,sBAAa,EAAEpB,YAAY,EAAEiB,KAAM,CAAC;IAC5C;IACA,OAAO,IAAAG,sBAAa,EAAE,MAAM,EAAE;MAC7BhC,QAAQ,EAAEoB,IAAI;MACdU,SAAS,EAAEvB,oBAAoB;MAC/BjB,GAAG,EAAE6B,KAAK;MACVY,KAAK,EAAEvB;IACR,CAAE,CAAC;EACJ,CAAE,CAAC;EAEH,OAAOQ,WAAW;AACnB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_cell","_interopRequireDefault","_jsxRuntime","TextControl","label","hideLabelFromVision","value","help","className","instanceId","onChange","type","placeholder","props","id","jsx","default","onChangeValue","undefined","valuePlaceholder","_default","exports","memo"],"sources":["@wordpress/components/src/text-control/index.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { memo } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport Cell from '../mobile/bottom-sheet/cell';\n\nfunction TextControl( {\n\tlabel,\n\thideLabelFromVision,\n\tvalue,\n\thelp,\n\tclassName,\n\tinstanceId,\n\tonChange,\n\ttype = 'text',\n\tplaceholder,\n\t...props\n} ) {\n\tconst id = `inspector-text-control-${ instanceId }`;\n\n\treturn (\n\t\t<Cell\n\t\t\tlabel={ label }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\tid={ id }\n\t\t\thelp={ help }\n\t\t\tclassName={ className }\n\t\t\ttype={ type }\n\t\t\tvalue={ value }\n\t\t\tonChangeValue={ onChange }\n\t\t\taria-describedby={ !! help ? id + '__help' : undefined }\n\t\t\tvaluePlaceholder={ placeholder }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nexport default memo( TextControl );\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA+C,IAAAG,WAAA,GAAAH,OAAA;AAP/C;AACA;AACA;;AAEA;AACA;AACA;;AAGA,SAASI,WAAWA,CAAE;EACrBC,KAAK;EACLC,mBAAmB;EACnBC,KAAK;EACLC,IAAI;EACJC,SAAS;EACTC,UAAU;EACVC,QAAQ;EACRC,IAAI,GAAG,MAAM;EACbC,WAAW;EACX,GAAGC;AACJ,CAAC,EAAG;EACH,MAAMC,EAAE,GAAI,0BAA0BL,UAAY,EAAC;EAEnD,oBACC,IAAAP,WAAA,CAAAa,GAAA,EAACf,KAAA,CAAAgB,OAAI;IACJZ,KAAK,EAAGA,KAAO;IACfC,mBAAmB,EAAGA,mBAAqB;IAC3CS,EAAE,EAAGA,EAAI;IACTP,IAAI,EAAGA,IAAM;IACbC,SAAS,EAAGA,SAAW;IACvBG,IAAI,EAAGA,IAAM;IACbL,KAAK,EAAGA,KAAO;IACfW,aAAa,EAAGP,QAAU;IAC1B,oBAAmB,CAAC,CAAEH,IAAI,GAAGO,EAAE,GAAG,QAAQ,GAAGI,SAAW;IACxDC,gBAAgB,EAAGP,WAAa;IAAA,GAC3BC;EAAK,CACV,CAAC;AAEJ;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAL,OAAA,GAEc,IAAAM,aAAI,EAAEnB,WAAY,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_cell","_interopRequireDefault","_jsxRuntime","TextControl","label","hideLabelFromVision","value","help","className","instanceId","onChange","type","placeholder","props","id","jsx","default","onChangeValue","undefined","valuePlaceholder","_default","exports","memo"],"sources":["@wordpress/components/src/text-control/index.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { memo } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport Cell from '../mobile/bottom-sheet/cell';\n\nfunction TextControl( {\n\tlabel,\n\thideLabelFromVision,\n\tvalue,\n\thelp,\n\tclassName,\n\tinstanceId,\n\tonChange,\n\ttype = 'text',\n\tplaceholder,\n\t...props\n} ) {\n\tconst id = `inspector-text-control-${ instanceId }`;\n\n\treturn (\n\t\t<Cell\n\t\t\tlabel={ label }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\tid={ id }\n\t\t\thelp={ help }\n\t\t\tclassName={ className }\n\t\t\ttype={ type }\n\t\t\tvalue={ value }\n\t\t\tonChangeValue={ onChange }\n\t\t\taria-describedby={ !! help ? id + '__help' : undefined }\n\t\t\tvaluePlaceholder={ placeholder }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nexport default memo( TextControl );\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA+C,IAAAG,WAAA,GAAAH,OAAA;AAP/C;AACA;AACA;;AAEA;AACA;AACA;;AAGA,SAASI,WAAWA,CAAE;EACrBC,KAAK;EACLC,mBAAmB;EACnBC,KAAK;EACLC,IAAI;EACJC,SAAS;EACTC,UAAU;EACVC,QAAQ;EACRC,IAAI,GAAG,MAAM;EACbC,WAAW;EACX,GAAGC;AACJ,CAAC,EAAG;EACH,MAAMC,EAAE,GAAG,0BAA2BL,UAAU,EAAG;EAEnD,oBACC,IAAAP,WAAA,CAAAa,GAAA,EAACf,KAAA,CAAAgB,OAAI;IACJZ,KAAK,EAAGA,KAAO;IACfC,mBAAmB,EAAGA,mBAAqB;IAC3CS,EAAE,EAAGA,EAAI;IACTP,IAAI,EAAGA,IAAM;IACbC,SAAS,EAAGA,SAAW;IACvBG,IAAI,EAAGA,IAAM;IACbL,KAAK,EAAGA,KAAO;IACfW,aAAa,EAAGP,QAAU;IAC1B,oBAAmB,CAAC,CAAEH,IAAI,GAAGO,EAAE,GAAG,QAAQ,GAAGI,SAAW;IACxDC,gBAAgB,EAAGP,WAAa;IAAA,GAC3BC;EAAK,CACV,CAAC;AAEJ;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAL,OAAA,GAEc,IAAAM,aAAI,EAAEnB,WAAY,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_strings","_jsxRuntime","TextHighlight","props","text","highlight","trimmedHighlightText","trim","jsx","Fragment","children","regex","RegExp","escapeRegExp","createInterpolateElement","replace","mark","exports","_default","default"],"sources":["@wordpress/components/src/text-highlight/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { escapeRegExp } from '../utils/strings';\nimport type { TextHighlightProps } from './types';\n\n/**\n * Highlights occurrences of a given string within another string of text. Wraps\n * each match with a `<mark>` tag which provides browser default styling.\n *\n * ```jsx\n * import { TextHighlight } from '@wordpress/components';\n *\n * const MyTextHighlight = () => (\n * <TextHighlight\n * text=\"Why do we like Gutenberg? Because Gutenberg is the best!\"\n * highlight=\"Gutenberg\"\n * />\n * );\n * ```\n */\nexport const TextHighlight = ( props: TextHighlightProps ) => {\n\tconst { text = '', highlight = '' } = props;\n\tconst trimmedHighlightText = highlight.trim();\n\n\tif ( ! trimmedHighlightText ) {\n\t\treturn <>{ text }</>;\n\t}\n\n\tconst regex = new RegExp(\n\t\t`(${ escapeRegExp( trimmedHighlightText ) })`,\n\t\t'gi'\n\t);\n\n\treturn createInterpolateElement( text.replace( regex, '<mark>$&</mark>' ), {\n\t\tmark: <mark />,\n\t} );\n};\n\nexport default TextHighlight;\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAAgD,IAAAE,WAAA,GAAAF,OAAA;AARhD;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,aAAa,GAAKC,KAAyB,IAAM;EAC7D,MAAM;IAAEC,IAAI,GAAG,EAAE;IAAEC,SAAS,GAAG;EAAG,CAAC,GAAGF,KAAK;EAC3C,MAAMG,oBAAoB,GAAGD,SAAS,CAACE,IAAI,CAAC,CAAC;EAE7C,IAAK,CAAED,oBAAoB,EAAG;IAC7B,oBAAO,IAAAL,WAAA,CAAAO,GAAA,EAAAP,WAAA,CAAAQ,QAAA;MAAAC,QAAA,EAAIN;IAAI,CAAI,CAAC;EACrB;EAEA,MAAMO,KAAK,GAAG,IAAIC,MAAM,CACtB,IAAI,IAAAC,qBAAY,EAAEP,oBAAqB,CAAG,GAAE,EAC7C,IACD,CAAC;EAED,OAAO,IAAAQ,iCAAwB,EAAEV,IAAI,CAACW,OAAO,CAAEJ,KAAK,EAAE,iBAAkB,CAAC,EAAE;IAC1EK,IAAI,eAAE,IAAAf,WAAA,CAAAO,GAAA,YAAO;EACd,CAAE,CAAC;AACJ,CAAC;AAACS,OAAA,CAAAf,aAAA,GAAAA,aAAA;AAAA,IAAAgB,QAAA,GAAAD,OAAA,CAAAE,OAAA,GAEajB,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_strings","_jsxRuntime","TextHighlight","props","text","highlight","trimmedHighlightText","trim","jsx","Fragment","children","regex","RegExp","escapeRegExp","createInterpolateElement","replace","mark","exports","_default","default"],"sources":["@wordpress/components/src/text-highlight/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { escapeRegExp } from '../utils/strings';\nimport type { TextHighlightProps } from './types';\n\n/**\n * Highlights occurrences of a given string within another string of text. Wraps\n * each match with a `<mark>` tag which provides browser default styling.\n *\n * ```jsx\n * import { TextHighlight } from '@wordpress/components';\n *\n * const MyTextHighlight = () => (\n * <TextHighlight\n * text=\"Why do we like Gutenberg? Because Gutenberg is the best!\"\n * highlight=\"Gutenberg\"\n * />\n * );\n * ```\n */\nexport const TextHighlight = ( props: TextHighlightProps ) => {\n\tconst { text = '', highlight = '' } = props;\n\tconst trimmedHighlightText = highlight.trim();\n\n\tif ( ! trimmedHighlightText ) {\n\t\treturn <>{ text }</>;\n\t}\n\n\tconst regex = new RegExp(\n\t\t`(${ escapeRegExp( trimmedHighlightText ) })`,\n\t\t'gi'\n\t);\n\n\treturn createInterpolateElement( text.replace( regex, '<mark>$&</mark>' ), {\n\t\tmark: <mark />,\n\t} );\n};\n\nexport default TextHighlight;\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAAgD,IAAAE,WAAA,GAAAF,OAAA;AARhD;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,aAAa,GAAKC,KAAyB,IAAM;EAC7D,MAAM;IAAEC,IAAI,GAAG,EAAE;IAAEC,SAAS,GAAG;EAAG,CAAC,GAAGF,KAAK;EAC3C,MAAMG,oBAAoB,GAAGD,SAAS,CAACE,IAAI,CAAC,CAAC;EAE7C,IAAK,CAAED,oBAAoB,EAAG;IAC7B,oBAAO,IAAAL,WAAA,CAAAO,GAAA,EAAAP,WAAA,CAAAQ,QAAA;MAAAC,QAAA,EAAIN;IAAI,CAAI,CAAC;EACrB;EAEA,MAAMO,KAAK,GAAG,IAAIC,MAAM,CACvB,IAAK,IAAAC,qBAAY,EAAEP,oBAAqB,CAAC,GAAI,EAC7C,IACD,CAAC;EAED,OAAO,IAAAQ,iCAAwB,EAAEV,IAAI,CAACW,OAAO,CAAEJ,KAAK,EAAE,iBAAkB,CAAC,EAAE;IAC1EK,IAAI,eAAE,IAAAf,WAAA,CAAAO,GAAA,YAAO;EACd,CAAE,CAAC;AACJ,CAAC;AAACS,OAAA,CAAAf,aAAA,GAAAA,aAAA;AAAA,IAAAgB,QAAA,GAAAD,OAAA,CAAAE,OAAA,GAEajB,aAAa","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_compose","require","_element","_baseControl","_interopRequireDefault","_textareaControlStyles","_jsxRuntime","UnforwardedTextareaControl","props","ref","__nextHasNoMarginBottom","label","hideLabelFromVision","value","help","onChange","rows","className","additionalProps","instanceId","useInstanceId","TextareaControl","id","onChangeValue","event","target","jsx","default","__associatedWPComponentName","children","StyledTextarea","undefined","exports","forwardRef","_default"],"sources":["@wordpress/components/src/textarea-control/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\nimport { StyledTextarea } from './styles/textarea-control-styles';\nimport type { TextareaControlProps } from './types';\nimport type { WordPressComponentProps } from '../context';\n\nfunction UnforwardedTextareaControl(\n\tprops: WordPressComponentProps< TextareaControlProps, 'textarea', false >,\n\tref: React.ForwardedRef< HTMLTextAreaElement >\n) {\n\tconst {\n\t\t__nextHasNoMarginBottom,\n\t\tlabel,\n\t\thideLabelFromVision,\n\t\tvalue,\n\t\thelp,\n\t\tonChange,\n\t\trows = 4,\n\t\tclassName,\n\t\t...additionalProps\n\t} = props;\n\tconst instanceId = useInstanceId( TextareaControl );\n\tconst id = `inspector-textarea-control-${ instanceId }`;\n\tconst onChangeValue = ( event: React.ChangeEvent< HTMLTextAreaElement > ) =>\n\t\tonChange( event.target.value );\n\n\treturn (\n\t\t<BaseControl\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t__associatedWPComponentName=\"TextareaControl\"\n\t\t\tlabel={ label }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\tid={ id }\n\t\t\thelp={ help }\n\t\t\tclassName={ className }\n\t\t>\n\t\t\t<StyledTextarea\n\t\t\t\tclassName=\"components-textarea-control__input\"\n\t\t\t\tid={ id }\n\t\t\t\trows={ rows }\n\t\t\t\tonChange={ onChangeValue }\n\t\t\t\taria-describedby={ !! help ? id + '__help' : undefined }\n\t\t\t\tvalue={ value }\n\t\t\t\tref={ ref }\n\t\t\t\t{ ...additionalProps }\n\t\t\t/>\n\t\t</BaseControl>\n\t);\n}\n\n/**\n * TextareaControls are TextControls that allow for multiple lines of text, and\n * wrap overflow text onto a new line. They are a fixed height and scroll\n * vertically when the cursor reaches the bottom of the field.\n *\n * ```jsx\n * import { TextareaControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyTextareaControl = () => {\n * const [ text, setText ] = useState( '' );\n *\n * return (\n * <TextareaControl\n * __nextHasNoMarginBottom\n * label=\"Text\"\n * help=\"Enter some text\"\n * value={ text }\n * onChange={ ( value ) => setText( value ) }\n * />\n * );\n * };\n * ```\n */\nexport const TextareaControl = forwardRef( UnforwardedTextareaControl );\n\nexport default TextareaControl;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,YAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,sBAAA,GAAAJ,OAAA;AAAkE,IAAAK,WAAA,GAAAL,OAAA;AAVlE;AACA;AACA;;AAIA;AACA;AACA;;AAMA,SAASM,0BAA0BA,CAClCC,KAAyE,EACzEC,GAA8C,EAC7C;EACD,MAAM;IACLC,uBAAuB;IACvBC,KAAK;IACLC,mBAAmB;IACnBC,KAAK;IACLC,IAAI;IACJC,QAAQ;IACRC,IAAI,GAAG,CAAC;IACRC,SAAS;IACT,GAAGC;EACJ,CAAC,GAAGV,KAAK;EACT,MAAMW,UAAU,GAAG,IAAAC,sBAAa,EAAEC,eAAgB,CAAC;EACnD,MAAMC,EAAE,GAAI,8BAA8BH,UAAY,EAAC;EACvD,MAAMI,aAAa,GAAKC,KAA+C,IACtET,QAAQ,CAAES,KAAK,CAACC,MAAM,CAACZ,KAAM,CAAC;EAE/B,oBACC,IAAAP,WAAA,CAAAoB,GAAA,EAACvB,YAAA,CAAAwB,OAAW;IACXjB,uBAAuB,EAAGA,uBAAyB;IACnDkB,2BAA2B,EAAC,iBAAiB;IAC7CjB,KAAK,EAAGA,KAAO;IACfC,mBAAmB,EAAGA,mBAAqB;IAC3CU,EAAE,EAAGA,EAAI;IACTR,IAAI,EAAGA,IAAM;IACbG,SAAS,EAAGA,SAAW;IAAAY,QAAA,eAEvB,IAAAvB,WAAA,CAAAoB,GAAA,EAACrB,sBAAA,CAAAyB,cAAc;MACdb,SAAS,EAAC,oCAAoC;MAC9CK,EAAE,EAAGA,EAAI;MACTN,IAAI,EAAGA,IAAM;MACbD,QAAQ,EAAGQ,aAAe;MAC1B,oBAAmB,CAAC,CAAET,IAAI,GAAGQ,EAAE,GAAG,QAAQ,GAAGS,SAAW;MACxDlB,KAAK,EAAGA,KAAO;MACfJ,GAAG,EAAGA,GAAK;MAAA,GACNS;IAAe,CACpB;EAAC,CACU,CAAC;AAEhB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,eAAe,GAAAW,OAAA,CAAAX,eAAA,GAAG,IAAAY,mBAAU,EAAE1B,0BAA2B,CAAC;AAAC,IAAA2B,QAAA,GAAAF,OAAA,CAAAL,OAAA,GAEzDN,eAAe","ignoreList":[]}
1
+ {"version":3,"names":["_compose","require","_element","_baseControl","_interopRequireDefault","_textareaControlStyles","_jsxRuntime","UnforwardedTextareaControl","props","ref","__nextHasNoMarginBottom","label","hideLabelFromVision","value","help","onChange","rows","className","additionalProps","instanceId","useInstanceId","TextareaControl","id","onChangeValue","event","target","jsx","default","__associatedWPComponentName","children","StyledTextarea","undefined","exports","forwardRef","_default"],"sources":["@wordpress/components/src/textarea-control/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\nimport { StyledTextarea } from './styles/textarea-control-styles';\nimport type { TextareaControlProps } from './types';\nimport type { WordPressComponentProps } from '../context';\n\nfunction UnforwardedTextareaControl(\n\tprops: WordPressComponentProps< TextareaControlProps, 'textarea', false >,\n\tref: React.ForwardedRef< HTMLTextAreaElement >\n) {\n\tconst {\n\t\t__nextHasNoMarginBottom,\n\t\tlabel,\n\t\thideLabelFromVision,\n\t\tvalue,\n\t\thelp,\n\t\tonChange,\n\t\trows = 4,\n\t\tclassName,\n\t\t...additionalProps\n\t} = props;\n\tconst instanceId = useInstanceId( TextareaControl );\n\tconst id = `inspector-textarea-control-${ instanceId }`;\n\tconst onChangeValue = ( event: React.ChangeEvent< HTMLTextAreaElement > ) =>\n\t\tonChange( event.target.value );\n\n\treturn (\n\t\t<BaseControl\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t__associatedWPComponentName=\"TextareaControl\"\n\t\t\tlabel={ label }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\tid={ id }\n\t\t\thelp={ help }\n\t\t\tclassName={ className }\n\t\t>\n\t\t\t<StyledTextarea\n\t\t\t\tclassName=\"components-textarea-control__input\"\n\t\t\t\tid={ id }\n\t\t\t\trows={ rows }\n\t\t\t\tonChange={ onChangeValue }\n\t\t\t\taria-describedby={ !! help ? id + '__help' : undefined }\n\t\t\t\tvalue={ value }\n\t\t\t\tref={ ref }\n\t\t\t\t{ ...additionalProps }\n\t\t\t/>\n\t\t</BaseControl>\n\t);\n}\n\n/**\n * TextareaControls are TextControls that allow for multiple lines of text, and\n * wrap overflow text onto a new line. They are a fixed height and scroll\n * vertically when the cursor reaches the bottom of the field.\n *\n * ```jsx\n * import { TextareaControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyTextareaControl = () => {\n * const [ text, setText ] = useState( '' );\n *\n * return (\n * <TextareaControl\n * __nextHasNoMarginBottom\n * label=\"Text\"\n * help=\"Enter some text\"\n * value={ text }\n * onChange={ ( value ) => setText( value ) }\n * />\n * );\n * };\n * ```\n */\nexport const TextareaControl = forwardRef( UnforwardedTextareaControl );\n\nexport default TextareaControl;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,YAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,sBAAA,GAAAJ,OAAA;AAAkE,IAAAK,WAAA,GAAAL,OAAA;AAVlE;AACA;AACA;;AAIA;AACA;AACA;;AAMA,SAASM,0BAA0BA,CAClCC,KAAyE,EACzEC,GAA8C,EAC7C;EACD,MAAM;IACLC,uBAAuB;IACvBC,KAAK;IACLC,mBAAmB;IACnBC,KAAK;IACLC,IAAI;IACJC,QAAQ;IACRC,IAAI,GAAG,CAAC;IACRC,SAAS;IACT,GAAGC;EACJ,CAAC,GAAGV,KAAK;EACT,MAAMW,UAAU,GAAG,IAAAC,sBAAa,EAAEC,eAAgB,CAAC;EACnD,MAAMC,EAAE,GAAG,8BAA+BH,UAAU,EAAG;EACvD,MAAMI,aAAa,GAAKC,KAA+C,IACtET,QAAQ,CAAES,KAAK,CAACC,MAAM,CAACZ,KAAM,CAAC;EAE/B,oBACC,IAAAP,WAAA,CAAAoB,GAAA,EAACvB,YAAA,CAAAwB,OAAW;IACXjB,uBAAuB,EAAGA,uBAAyB;IACnDkB,2BAA2B,EAAC,iBAAiB;IAC7CjB,KAAK,EAAGA,KAAO;IACfC,mBAAmB,EAAGA,mBAAqB;IAC3CU,EAAE,EAAGA,EAAI;IACTR,IAAI,EAAGA,IAAM;IACbG,SAAS,EAAGA,SAAW;IAAAY,QAAA,eAEvB,IAAAvB,WAAA,CAAAoB,GAAA,EAACrB,sBAAA,CAAAyB,cAAc;MACdb,SAAS,EAAC,oCAAoC;MAC9CK,EAAE,EAAGA,EAAI;MACTN,IAAI,EAAGA,IAAM;MACbD,QAAQ,EAAGQ,aAAe;MAC1B,oBAAmB,CAAC,CAAET,IAAI,GAAGQ,EAAE,GAAG,QAAQ,GAAGS,SAAW;MACxDlB,KAAK,EAAGA,KAAO;MACfJ,GAAG,EAAGA,GAAK;MAAA,GACNS;IAAe,CACpB;EAAC,CACU,CAAC;AAEhB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,eAAe,GAAAW,OAAA,CAAAX,eAAA,GAAG,IAAAY,mBAAU,EAAE1B,0BAA2B,CAAC;AAAC,IAAA2B,QAAA,GAAAF,OAAA,CAAAL,OAAA,GAEzDN,eAAe","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_colord","require","_a11y","_interopRequireDefault","_names","_warning","_utils","extend","namesPlugin","a11yPlugin","generateThemeVariables","inputs","validateInputs","generatedColors","generateAccentDependentColors","accent","generateBackgroundDependentColors","background","warnContrastIssues","checkContrasts","colors","key","value","Object","entries","colord","isValid","globalThis","SCRIPT_DEBUG","warning","outputs","COLORS","white","foreground","gray","isReadable","undefined","grays","contrast","issues","error","values","accentDarker10","darken","toHex","accentDarker20","accentInverted","getForegroundForColor","foregroundInverted","generateShades","color","isDark","SHADES","limit","direction","range","Math","abs","toHsl","l","result","forEach","parseInt"],"sources":["@wordpress/components/src/theme/color-algorithms.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { colord, extend } from 'colord';\nimport a11yPlugin from 'colord/plugins/a11y';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport type { ThemeInputValues, ThemeOutputValues } from './types';\nimport { COLORS } from '../utils';\n\nextend( [ namesPlugin, a11yPlugin ] );\n\nexport function generateThemeVariables(\n\tinputs: ThemeInputValues\n): ThemeOutputValues {\n\tvalidateInputs( inputs );\n\n\tconst generatedColors = {\n\t\t...generateAccentDependentColors( inputs.accent ),\n\t\t...generateBackgroundDependentColors( inputs.background ),\n\t};\n\n\twarnContrastIssues( checkContrasts( inputs, generatedColors ) );\n\n\treturn { colors: generatedColors };\n}\n\nfunction validateInputs( inputs: ThemeInputValues ) {\n\tfor ( const [ key, value ] of Object.entries( inputs ) ) {\n\t\tif ( typeof value !== 'undefined' && ! colord( value ).isValid() ) {\n\t\t\twarning(\n\t\t\t\t`wp.components.Theme: \"${ value }\" is not a valid color value for the '${ key }' prop.`\n\t\t\t);\n\t\t}\n\t}\n}\n\nexport function checkContrasts(\n\tinputs: ThemeInputValues,\n\toutputs: ThemeOutputValues[ 'colors' ]\n) {\n\tconst background = inputs.background || COLORS.white;\n\tconst accent = inputs.accent || '#3858e9';\n\tconst foreground = outputs.foreground || COLORS.gray[ 900 ];\n\tconst gray = outputs.gray || COLORS.gray;\n\n\treturn {\n\t\taccent: colord( background ).isReadable( accent )\n\t\t\t? undefined\n\t\t\t: `The background color (\"${ background }\") does not have sufficient contrast against the accent color (\"${ accent }\").`,\n\t\tforeground: colord( background ).isReadable( foreground )\n\t\t\t? undefined\n\t\t\t: `The background color provided (\"${ background }\") does not have sufficient contrast against the standard foreground colors.`,\n\t\tgrays:\n\t\t\tcolord( background ).contrast( gray[ 600 ] ) >= 3 &&\n\t\t\tcolord( background ).contrast( gray[ 700 ] ) >= 4.5\n\t\t\t\t? undefined\n\t\t\t\t: `The background color provided (\"${ background }\") cannot generate a set of grayscale foreground colors with sufficient contrast. Try adjusting the color to be lighter or darker.`,\n\t};\n}\n\nfunction warnContrastIssues( issues: ReturnType< typeof checkContrasts > ) {\n\tfor ( const error of Object.values( issues ) ) {\n\t\tif ( error ) {\n\t\t\twarning( 'wp.components.Theme: ' + error );\n\t\t}\n\t}\n}\n\nfunction generateAccentDependentColors( accent?: string ) {\n\tif ( ! accent ) {\n\t\treturn {};\n\t}\n\n\treturn {\n\t\taccent,\n\t\taccentDarker10: colord( accent ).darken( 0.1 ).toHex(),\n\t\taccentDarker20: colord( accent ).darken( 0.2 ).toHex(),\n\t\taccentInverted: getForegroundForColor( accent ),\n\t};\n}\n\nfunction generateBackgroundDependentColors( background?: string ) {\n\tif ( ! background ) {\n\t\treturn {};\n\t}\n\n\tconst foreground = getForegroundForColor( background );\n\n\treturn {\n\t\tbackground,\n\t\tforeground,\n\t\tforegroundInverted: getForegroundForColor( foreground ),\n\t\tgray: generateShades( background, foreground ),\n\t};\n}\n\nfunction getForegroundForColor( color: string ) {\n\treturn colord( color ).isDark() ? COLORS.white : COLORS.gray[ 900 ];\n}\n\nexport function generateShades( background: string, foreground: string ) {\n\t// How much darkness you need to add to #fff to get the COLORS.gray[n] color\n\tconst SHADES = {\n\t\t100: 0.06,\n\t\t200: 0.121,\n\t\t300: 0.132,\n\t\t400: 0.2,\n\t\t600: 0.42,\n\t\t700: 0.543,\n\t\t800: 0.821,\n\t};\n\n\t// Darkness of COLORS.gray[ 900 ], relative to #fff\n\tconst limit = 0.884;\n\n\tconst direction = colord( background ).isDark() ? 'lighten' : 'darken';\n\n\t// Lightness delta between the background and foreground colors\n\tconst range =\n\t\tMath.abs(\n\t\t\tcolord( background ).toHsl().l - colord( foreground ).toHsl().l\n\t\t) / 100;\n\n\tconst result: Record< number, string > = {};\n\n\tObject.entries( SHADES ).forEach( ( [ key, value ] ) => {\n\t\tresult[ parseInt( key ) ] = colord( background )\n\t\t\t[ direction ]( ( value / limit ) * range )\n\t\t\t.toHex();\n\t} );\n\n\treturn result as NonNullable< ThemeOutputValues[ 'colors' ][ 'gray' ] >;\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAD,sBAAA,CAAAF,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AK,CAAE,KAAM;IACvDsC,MAAM,CAAEE,QAAQ,CAAEzC,GAAI,CAAC,CAAE,GAAG,IAAAI,cAAM,EAAER,UAAW,CAAC,CAC7CqC,SAAS,CAAE,CAAIhC,KAAK,GAAG+B,KAAK,GAAKE,KAAM,CAAC,CACzCX,KAAK,CAAC,CAAC;EACV,CAAE,CAAC;EAEH,OAAOgB,MAAM;AACd","ignoreList":[]}
1
+ {"version":3,"names":["_colord","require","_a11y","_interopRequireDefault","_names","_warning","_utils","extend","namesPlugin","a11yPlugin","generateThemeVariables","inputs","validateInputs","generatedColors","generateAccentDependentColors","accent","generateBackgroundDependentColors","background","warnContrastIssues","checkContrasts","colors","key","value","Object","entries","colord","isValid","globalThis","SCRIPT_DEBUG","warning","outputs","COLORS","white","foreground","gray","isReadable","undefined","grays","contrast","issues","error","values","accentDarker10","darken","toHex","accentDarker20","accentInverted","getForegroundForColor","foregroundInverted","generateShades","color","isDark","SHADES","limit","direction","range","Math","abs","toHsl","l","result","forEach","parseInt"],"sources":["@wordpress/components/src/theme/color-algorithms.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { colord, extend } from 'colord';\nimport a11yPlugin from 'colord/plugins/a11y';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport type { ThemeInputValues, ThemeOutputValues } from './types';\nimport { COLORS } from '../utils';\n\nextend( [ namesPlugin, a11yPlugin ] );\n\nexport function generateThemeVariables(\n\tinputs: ThemeInputValues\n): ThemeOutputValues {\n\tvalidateInputs( inputs );\n\n\tconst generatedColors = {\n\t\t...generateAccentDependentColors( inputs.accent ),\n\t\t...generateBackgroundDependentColors( inputs.background ),\n\t};\n\n\twarnContrastIssues( checkContrasts( inputs, generatedColors ) );\n\n\treturn { colors: generatedColors };\n}\n\nfunction validateInputs( inputs: ThemeInputValues ) {\n\tfor ( const [ key, value ] of Object.entries( inputs ) ) {\n\t\tif ( typeof value !== 'undefined' && ! colord( value ).isValid() ) {\n\t\t\twarning(\n\t\t\t\t`wp.components.Theme: \"${ value }\" is not a valid color value for the '${ key }' prop.`\n\t\t\t);\n\t\t}\n\t}\n}\n\nexport function checkContrasts(\n\tinputs: ThemeInputValues,\n\toutputs: ThemeOutputValues[ 'colors' ]\n) {\n\tconst background = inputs.background || COLORS.white;\n\tconst accent = inputs.accent || '#3858e9';\n\tconst foreground = outputs.foreground || COLORS.gray[ 900 ];\n\tconst gray = outputs.gray || COLORS.gray;\n\n\treturn {\n\t\taccent: colord( background ).isReadable( accent )\n\t\t\t? undefined\n\t\t\t: `The background color (\"${ background }\") does not have sufficient contrast against the accent color (\"${ accent }\").`,\n\t\tforeground: colord( background ).isReadable( foreground )\n\t\t\t? undefined\n\t\t\t: `The background color provided (\"${ background }\") does not have sufficient contrast against the standard foreground colors.`,\n\t\tgrays:\n\t\t\tcolord( background ).contrast( gray[ 600 ] ) >= 3 &&\n\t\t\tcolord( background ).contrast( gray[ 700 ] ) >= 4.5\n\t\t\t\t? undefined\n\t\t\t\t: `The background color provided (\"${ background }\") cannot generate a set of grayscale foreground colors with sufficient contrast. Try adjusting the color to be lighter or darker.`,\n\t};\n}\n\nfunction warnContrastIssues( issues: ReturnType< typeof checkContrasts > ) {\n\tfor ( const error of Object.values( issues ) ) {\n\t\tif ( error ) {\n\t\t\twarning( 'wp.components.Theme: ' + error );\n\t\t}\n\t}\n}\n\nfunction generateAccentDependentColors( accent?: string ) {\n\tif ( ! accent ) {\n\t\treturn {};\n\t}\n\n\treturn {\n\t\taccent,\n\t\taccentDarker10: colord( accent ).darken( 0.1 ).toHex(),\n\t\taccentDarker20: colord( accent ).darken( 0.2 ).toHex(),\n\t\taccentInverted: getForegroundForColor( accent ),\n\t};\n}\n\nfunction generateBackgroundDependentColors( background?: string ) {\n\tif ( ! background ) {\n\t\treturn {};\n\t}\n\n\tconst foreground = getForegroundForColor( background );\n\n\treturn {\n\t\tbackground,\n\t\tforeground,\n\t\tforegroundInverted: getForegroundForColor( foreground ),\n\t\tgray: generateShades( background, foreground ),\n\t};\n}\n\nfunction getForegroundForColor( color: string ) {\n\treturn colord( color ).isDark() ? COLORS.white : COLORS.gray[ 900 ];\n}\n\nexport function generateShades( background: string, foreground: string ) {\n\t// How much darkness you need to add to #fff to get the COLORS.gray[n] color\n\tconst SHADES = {\n\t\t100: 0.06,\n\t\t200: 0.121,\n\t\t300: 0.132,\n\t\t400: 0.2,\n\t\t600: 0.42,\n\t\t700: 0.543,\n\t\t800: 0.821,\n\t};\n\n\t// Darkness of COLORS.gray[ 900 ], relative to #fff\n\tconst limit = 0.884;\n\n\tconst direction = colord( background ).isDark() ? 'lighten' : 'darken';\n\n\t// Lightness delta between the background and foreground colors\n\tconst range =\n\t\tMath.abs(\n\t\t\tcolord( background ).toHsl().l - colord( foreground ).toHsl().l\n\t\t) / 100;\n\n\tconst result: Record< number, string > = {};\n\n\tObject.entries( SHADES ).forEach( ( [ key, value ] ) => {\n\t\tresult[ parseInt( key ) ] = colord( background )\n\t\t\t[ direction ]( ( value / limit ) * range )\n\t\t\t.toHex();\n\t} );\n\n\treturn result as NonNullable< ThemeOutputValues[ 'colors' ][ 'gray' ] >;\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAD,sBAAA,CAAAF,OAAA;AAKA,IAAAI,QAAA,GAAAF,sBAAA,CAAAF,OAAA;AAMA,IAAAK,MAAA,GAAAL,OAAA;AAhBA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;;AAIA,IAAAM,cAAM,EAAE,CAAEC,cAAW,EAAEC,aAAU,CAAG,CAAC;AAE9B,SAASC,sBAAsBA,CACrCC,MAAwB,EACJ;EACpBC,cAAc,CAAED,MAAO,CAAC;EAExB,MAAME,eAAe,GAAG;IACvB,GAAGC,6BAA6B,CAAEH,MAAM,CAACI,M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O,IAAAzB,cAAM,EAAEyB,KAAM,CAAC,CAACC,MAAM,CAAC,CAAC,GAAGpB,aAAM,CAACC,KAAK,GAAGD,aAAM,CAACG,IAAI,CAAE,GAAG,CAAE;AACpE;AAEO,SAASe,cAAcA,CAAEhC,UAAkB,EAAEgB,UAAkB,EAAG;EACxE;EACA,MAAMmB,MAAM,GAAG;IACd,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,KAAK;IACV,GAAG,EAAE;EACN,CAAC;;EAED;EACA,MAAMC,KAAK,GAAG,KAAK;EAEnB,MAAMC,SAAS,GAAG,IAAA7B,cAAM,EAAER,UAAW,CAAC,CAACkC,MAAM,CAAC,CAAC,GAAG,SAAS,GAAG,QAAQ;;EAEtE;EACA,MAAMI,KAAK,GACVC,IAAI,CAACC,GAAG,CACP,IAAAhC,cAAM,EAAER,UAAW,CAAC,CAACyC,KAAK,CAAC,CAAC,CAACC,CAAC,GAAG,IAAAlC,cAAM,EAAEQ,UAAW,CAAC,CAACyB,KAAK,CAAC,CAAC,CAACC,CAC/D,CAAC,GAAG,GAAG;EAER,MAAMC,MAAgC,GAAG,CAAC,CAAC;EAE3CrC,MAAM,CAACC,OAAO,CAAE4B,MAAO,CAAC,CAACS,OAAO,CAAE,CAAE,CAAExC,GAAG,EAAEC,KAAK,CAAE,KAAM;IACvDsC,MAAM,CAAEE,QAAQ,CAAEzC,GAAI,CAAC,CAAE,GAAG,IAAAI,cAAM,EAAER,UAAW,CAAC,CAC7CqC,SAAS,CAAE,CAAIhC,KAAK,GAAG+B,KAAK,GAAKE,KAAM,CAAC,CACzCX,KAAK,CAAC,CAAC;EACV,CAAE,CAAC;EAEH,OAAOgB,MAAM;AACd","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_EMOTION_STRINGIFIED_CSS_ERROR__","colorVariables","colors","shades","Object","entries","gray","map","k","v","join","css","accent","accentDarker10","accentDarker20","accentInverted","background","foreground","foregroundInverted","process","env","NODE_ENV","exports","Wrapper","_base","default","target","label","name","styles","toString"],"sources":["@wordpress/components/src/theme/styles.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport styled from '@emotion/styled';\nimport { css } from '@emotion/react';\n\n/**\n * Internal dependencies\n */\nimport type { ThemeOutputValues } from './types';\n\nexport const colorVariables = ( { colors }: ThemeOutputValues ) => {\n\tconst shades = Object.entries( colors.gray || {} )\n\t\t.map( ( [ k, v ] ) => `--wp-components-color-gray-${ k }: ${ v };` )\n\t\t.join( '' );\n\n\treturn [\n\t\tcss`\n\t\t\t--wp-components-color-accent: ${ colors.accent };\n\t\t\t--wp-components-color-accent-darker-10: ${ colors.accentDarker10 };\n\t\t\t--wp-components-color-accent-darker-20: ${ colors.accentDarker20 };\n\t\t\t--wp-components-color-accent-inverted: ${ colors.accentInverted };\n\n\t\t\t--wp-components-color-background: ${ colors.background };\n\t\t\t--wp-components-color-foreground: ${ colors.foreground };\n\t\t\t--wp-components-color-foreground-inverted: ${ colors.foregroundInverted };\n\n\t\t\t${ shades }\n\t\t`,\n\t];\n};\n\nexport const Wrapper = styled.div`\n\tcolor: var( --wp-components-color-foreground, currentColor );\n`;\n"],"mappings":";;;;;;;;AAIA,IAAAA,MAAA,GAAAC,OAAA;AAAqC,SAAAC,iCAAA,gPAJrC;AACA;AACA;AAIA;AACA;AACA;;AAGO,MAAMC,cAAc,GAAGA,CAAE;EAAEC;AAA0B,CAAC,KAAM;EAClE,MAAMC,MAAM,GAAGC,MAAM,CAACC,OAAO,CAAEH,MAAM,CAACI,IAAI,IAAI,CAAC,CAAE,CAAC,CAChDC,GAAG,CAAE,CAAE,CAAEC,CAAC,EAAEC,CAAC,CAAE,KAAO,8BAA8BD,CAAG,KAAKC,CAAG,GAAG,CAAC,CACnEC,IAAI,CAAE,EAAG,CAAC;EAEZ,OAAO,kBACNC,UAAG,mCAC+BT,MAAM,CAACU,MAAM,8CACHV,MAAM,CAACW,cAAc,8CACrBX,MAAM,CAACY,cAAc,6CACtBZ,MAAM,CAACa,cAAc,wCAE1Bb,MAAM,CAACc,UAAU,wCACjBd,MAAM,CAACe,UAAU,iDACRf,MAAM,CAACgB,kBAAkB,OAEpEf,MAAM,SAAAgB,OAAA,CAAAC,GAAA,CAAAC,QAAA,oDAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,gvDAEV;AACF,CAAC;AAACC,OAAA,CAAArB,cAAA,GAAAA,cAAA;AAEK,MAAMsB,OAAO,GAAAD,OAAA,CAAAC,OAAA,oBAAAC,KAAA,CAAAC,OAAA,SAAAN,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAK,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,GAAAR,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAO,IAAA;EAAAC,MAAA;AAAA;EAAAD,IAAA;EAAAC,MAAA;EAAAtB,GAAA;EAAAuB,QAAA,EAAA9B;AAAA,EAEnB","ignoreList":[]}
1
+ {"version":3,"names":["_react","require","_EMOTION_STRINGIFIED_CSS_ERROR__","colorVariables","colors","shades","Object","entries","gray","map","k","v","join","css","accent","accentDarker10","accentDarker20","accentInverted","background","foreground","foregroundInverted","process","env","NODE_ENV","exports","Wrapper","_base","default","target","label","name","styles","toString"],"sources":["@wordpress/components/src/theme/styles.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport styled from '@emotion/styled';\nimport { css } from '@emotion/react';\n\n/**\n * Internal dependencies\n */\nimport type { ThemeOutputValues } from './types';\n\nexport const colorVariables = ( { colors }: ThemeOutputValues ) => {\n\tconst shades = Object.entries( colors.gray || {} )\n\t\t.map( ( [ k, v ] ) => `--wp-components-color-gray-${ k }: ${ v };` )\n\t\t.join( '' );\n\n\treturn [\n\t\tcss`\n\t\t\t--wp-components-color-accent: ${ colors.accent };\n\t\t\t--wp-components-color-accent-darker-10: ${ colors.accentDarker10 };\n\t\t\t--wp-components-color-accent-darker-20: ${ colors.accentDarker20 };\n\t\t\t--wp-components-color-accent-inverted: ${ colors.accentInverted };\n\n\t\t\t--wp-components-color-background: ${ colors.background };\n\t\t\t--wp-components-color-foreground: ${ colors.foreground };\n\t\t\t--wp-components-color-foreground-inverted: ${ colors.foregroundInverted };\n\n\t\t\t${ shades }\n\t\t`,\n\t];\n};\n\nexport const Wrapper = styled.div`\n\tcolor: var( --wp-components-color-foreground, currentColor );\n`;\n"],"mappings":";;;;;;;;AAIA,IAAAA,MAAA,GAAAC,OAAA;AAAqC,SAAAC,iCAAA,gPAJrC;AACA;AACA;AAIA;AACA;AACA;;AAGO,MAAMC,cAAc,GAAGA,CAAE;EAAEC;AAA0B,CAAC,KAAM;EAClE,MAAMC,MAAM,GAAGC,MAAM,CAACC,OAAO,CAAEH,MAAM,CAACI,IAAI,IAAI,CAAC,CAAE,CAAC,CAChDC,GAAG,CAAE,CAAE,CAAEC,CAAC,EAAEC,CAAC,CAAE,KAAM,8BAA+BD,CAAC,KAAOC,CAAC,GAAK,CAAC,CACnEC,IAAI,CAAE,EAAG,CAAC;EAEZ,OAAO,kBACNC,UAAG,mCAC+BT,MAAM,CAACU,MAAM,8CACHV,MAAM,CAACW,cAAc,8CACrBX,MAAM,CAACY,cAAc,6CACtBZ,MAAM,CAACa,cAAc,wCAE1Bb,MAAM,CAACc,UAAU,wCACjBd,MAAM,CAACe,UAAU,iDACRf,MAAM,CAACgB,kBAAkB,OAEpEf,MAAM,SAAAgB,OAAA,CAAAC,GAAA,CAAAC,QAAA,oDAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,gvDAEV;AACF,CAAC;AAACC,OAAA,CAAArB,cAAA,GAAAA,cAAA;AAEK,MAAMsB,OAAO,GAAAD,OAAA,CAAAC,OAAA,oBAAAC,KAAA,CAAAC,OAAA,SAAAN,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAK,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,GAAAR,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAO,IAAA;EAAAC,MAAA;AAAA;EAAAD,IAAA;EAAAC,MAAA;EAAAtB,GAAA;EAAAuB,QAAA,EAAA9B;AAAA,EAEnB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_clsx","_interopRequireDefault","_element","_compose","_deprecated","_flex","_formToggle","_baseControl","_hStack","_utils","_space","_jsxRuntime","UnforwardedToggleControl","__nextHasNoMarginBottom","label","checked","help","className","onChange","disabled","ref","onChangeToggle","event","target","instanceId","useInstanceId","ToggleControl","id","cx","useCx","classes","css","marginBottom","space","process","env","NODE_ENV","deprecated","since","version","hint","describedBy","helpLabel","undefined","jsx","default","children","jsxs","HStack","justify","spacing","FlexBlock","as","htmlFor","clsx","exports","forwardRef","_default"],"sources":["@wordpress/components/src/toggle-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ChangeEvent, ForwardedRef } from 'react';\nimport { css } from '@emotion/react';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { FlexBlock } from '../flex';\nimport FormToggle from '../form-toggle';\nimport BaseControl from '../base-control';\nimport type { WordPressComponentProps } from '../context/wordpress-component';\nimport type { ToggleControlProps } from './types';\nimport { HStack } from '../h-stack';\nimport { useCx } from '../utils';\nimport { space } from '../utils/space';\n\nfunction UnforwardedToggleControl(\n\t{\n\t\t__nextHasNoMarginBottom,\n\t\tlabel,\n\t\tchecked,\n\t\thelp,\n\t\tclassName,\n\t\tonChange,\n\t\tdisabled,\n\t}: WordPressComponentProps< ToggleControlProps, 'input', false >,\n\tref: ForwardedRef< HTMLInputElement >\n) {\n\tfunction onChangeToggle( event: ChangeEvent< HTMLInputElement > ) {\n\t\tonChange( event.target.checked );\n\t}\n\tconst instanceId = useInstanceId( ToggleControl );\n\tconst id = `inspector-toggle-control-${ instanceId }`;\n\n\tconst cx = useCx();\n\tconst classes = cx(\n\t\t'components-toggle-control',\n\t\tclassName,\n\t\t! __nextHasNoMarginBottom && css( { marginBottom: space( 3 ) } )\n\t);\n\n\tif ( ! __nextHasNoMarginBottom ) {\n\t\tdeprecated( 'Bottom margin styles for wp.components.ToggleControl', {\n\t\t\tsince: '6.7',\n\t\t\tversion: '7.0',\n\t\t\thint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version.',\n\t\t} );\n\t}\n\n\tlet describedBy, helpLabel;\n\tif ( help ) {\n\t\tif ( typeof help === 'function' ) {\n\t\t\t// `help` as a function works only for controlled components where\n\t\t\t// `checked` is passed down from parent component. Uncontrolled\n\t\t\t// component can show only a static help label.\n\t\t\tif ( checked !== undefined ) {\n\t\t\t\thelpLabel = help( checked );\n\t\t\t}\n\t\t} else {\n\t\t\thelpLabel = help;\n\t\t}\n\t\tif ( helpLabel ) {\n\t\t\tdescribedBy = id + '__help';\n\t\t}\n\t}\n\n\treturn (\n\t\t<BaseControl\n\t\t\tid={ id }\n\t\t\thelp={\n\t\t\t\thelpLabel && (\n\t\t\t\t\t<span className=\"components-toggle-control__help\">\n\t\t\t\t\t\t{ helpLabel }\n\t\t\t\t\t</span>\n\t\t\t\t)\n\t\t\t}\n\t\t\tclassName={ classes }\n\t\t\t__nextHasNoMarginBottom\n\t\t>\n\t\t\t<HStack justify=\"flex-start\" spacing={ 2 }>\n\t\t\t\t<FormToggle\n\t\t\t\t\tid={ id }\n\t\t\t\t\tchecked={ checked }\n\t\t\t\t\tonChange={ onChangeToggle }\n\t\t\t\t\taria-describedby={ describedBy }\n\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\tref={ ref }\n\t\t\t\t/>\n\t\t\t\t<FlexBlock\n\t\t\t\t\tas=\"label\"\n\t\t\t\t\thtmlFor={ id }\n\t\t\t\t\tclassName={ clsx( 'components-toggle-control__label', {\n\t\t\t\t\t\t'is-disabled': disabled,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t{ label }\n\t\t\t\t</FlexBlock>\n\t\t\t</HStack>\n\t\t</BaseControl>\n\t);\n}\n\n/**\n * ToggleControl is used to generate a toggle user interface.\n *\n * ```jsx\n * import { ToggleControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyToggleControl = () => {\n * const [ value, setValue ] = useState( false );\n *\n * return (\n * <ToggleControl\n * __nextHasNoMarginBottom\n * label=\"Fixed Background\"\n * checked={ value }\n * onChange={ () => setValue( ( state ) => ! state ) }\n * />\n * );\n * };\n * ```\n */\nexport const ToggleControl = forwardRef( UnforwardedToggleControl );\n\nexport default ToggleControl;\n"],"mappings":";;;;;;;AAIA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAH,sBAAA,CAAAF,OAAA;AAKA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,YAAA,GAAAN,sBAAA,CAAAF,OAAA;AAGA,IAAAS,OAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AAAuC,IAAAY,WAAA,GAAAZ,OAAA;AAxBvC;AACA;AACA;;AAKA;AACA;AACA;;AAKA;AACA;AACA;;AAUA,SAASa,wBAAwBA,CAChC;EACCC,uBAAuB;EACvBC,KAAK;EACLC,OAAO;EACPC,IAAI;EACJC,SAAS;EACTC,QAAQ;EACRC;AAC8D,CAAC,EAChEC,GAAqC,EACpC;EACD,SAASC,cAAcA,CAAEC,KAAsC,EAAG;IACjEJ,QAAQ,CAAEI,KAAK,CAACC,MAAM,CAACR,OAAQ,CAAC;EACjC;EACA,MAAMS,UAAU,GAAG,I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AA,CAAAwC,MAAM;MAACC,OAAO,EAAC,YAAY;MAACC,OAAO,EAAG,CAAG;MAAAJ,QAAA,gBACzC,IAAAnC,WAAA,CAAAiC,GAAA,EAACtC,WAAA,CAAAuC,OAAU;QACVlB,EAAE,EAAGA,EAAI;QACTZ,OAAO,EAAGA,OAAS;QACnBG,QAAQ,EAAGG,cAAgB;QAC3B,oBAAmBoB,WAAa;QAChCtB,QAAQ,EAAGA,QAAU;QACrBC,GAAG,EAAGA;MAAK,CACX,CAAC,eACF,IAAAT,WAAA,CAAAiC,GAAA,EAACvC,KAAA,CAAA8C,SAAS;QACTC,EAAE,EAAC,OAAO;QACVC,OAAO,EAAG1B,EAAI;QACdV,SAAS,EAAG,IAAAqC,aAAI,EAAE,kCAAkC,EAAE;UACrD,aAAa,EAAEnC;QAChB,CAAE,CAAG;QAAA2B,QAAA,EAEHhC;MAAK,CACG,CAAC;IAAA,CACL;EAAC,CACG,CAAC;AAEhB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMY,aAAa,GAAA6B,OAAA,CAAA7B,aAAA,GAAG,IAAA8B,mBAAU,EAAE5C,wBAAyB,CAAC;AAAC,IAAA6C,QAAA,GAAAF,OAAA,CAAAV,OAAA,GAErDnB,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["_react","require","_clsx","_interopRequireDefault","_element","_compose","_deprecated","_flex","_formToggle","_baseControl","_hStack","_utils","_space","_jsxRuntime","UnforwardedToggleControl","__nextHasNoMarginBottom","label","checked","help","className","onChange","disabled","ref","onChangeToggle","event","target","instanceId","useInstanceId","ToggleControl","id","cx","useCx","classes","css","marginBottom","space","process","env","NODE_ENV","deprecated","since","version","hint","describedBy","helpLabel","undefined","jsx","default","children","jsxs","HStack","justify","spacing","FlexBlock","as","htmlFor","clsx","exports","forwardRef","_default"],"sources":["@wordpress/components/src/toggle-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ChangeEvent, ForwardedRef } from 'react';\nimport { css } from '@emotion/react';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { FlexBlock } from '../flex';\nimport FormToggle from '../form-toggle';\nimport BaseControl from '../base-control';\nimport type { WordPressComponentProps } from '../context/wordpress-component';\nimport type { ToggleControlProps } from './types';\nimport { HStack } from '../h-stack';\nimport { useCx } from '../utils';\nimport { space } from '../utils/space';\n\nfunction UnforwardedToggleControl(\n\t{\n\t\t__nextHasNoMarginBottom,\n\t\tlabel,\n\t\tchecked,\n\t\thelp,\n\t\tclassName,\n\t\tonChange,\n\t\tdisabled,\n\t}: WordPressComponentProps< ToggleControlProps, 'input', false >,\n\tref: ForwardedRef< HTMLInputElement >\n) {\n\tfunction onChangeToggle( event: ChangeEvent< HTMLInputElement > ) {\n\t\tonChange( event.target.checked );\n\t}\n\tconst instanceId = useInstanceId( ToggleControl );\n\tconst id = `inspector-toggle-control-${ instanceId }`;\n\n\tconst cx = useCx();\n\tconst classes = cx(\n\t\t'components-toggle-control',\n\t\tclassName,\n\t\t! __nextHasNoMarginBottom && css( { marginBottom: space( 3 ) } )\n\t);\n\n\tif ( ! __nextHasNoMarginBottom ) {\n\t\tdeprecated( 'Bottom margin styles for wp.components.ToggleControl', {\n\t\t\tsince: '6.7',\n\t\t\tversion: '7.0',\n\t\t\thint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version.',\n\t\t} );\n\t}\n\n\tlet describedBy, helpLabel;\n\tif ( help ) {\n\t\tif ( typeof help === 'function' ) {\n\t\t\t// `help` as a function works only for controlled components where\n\t\t\t// `checked` is passed down from parent component. Uncontrolled\n\t\t\t// component can show only a static help label.\n\t\t\tif ( checked !== undefined ) {\n\t\t\t\thelpLabel = help( checked );\n\t\t\t}\n\t\t} else {\n\t\t\thelpLabel = help;\n\t\t}\n\t\tif ( helpLabel ) {\n\t\t\tdescribedBy = id + '__help';\n\t\t}\n\t}\n\n\treturn (\n\t\t<BaseControl\n\t\t\tid={ id }\n\t\t\thelp={\n\t\t\t\thelpLabel && (\n\t\t\t\t\t<span className=\"components-toggle-control__help\">\n\t\t\t\t\t\t{ helpLabel }\n\t\t\t\t\t</span>\n\t\t\t\t)\n\t\t\t}\n\t\t\tclassName={ classes }\n\t\t\t__nextHasNoMarginBottom\n\t\t>\n\t\t\t<HStack justify=\"flex-start\" spacing={ 2 }>\n\t\t\t\t<FormToggle\n\t\t\t\t\tid={ id }\n\t\t\t\t\tchecked={ checked }\n\t\t\t\t\tonChange={ onChangeToggle }\n\t\t\t\t\taria-describedby={ describedBy }\n\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\tref={ ref }\n\t\t\t\t/>\n\t\t\t\t<FlexBlock\n\t\t\t\t\tas=\"label\"\n\t\t\t\t\thtmlFor={ id }\n\t\t\t\t\tclassName={ clsx( 'components-toggle-control__label', {\n\t\t\t\t\t\t'is-disabled': disabled,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t{ label }\n\t\t\t\t</FlexBlock>\n\t\t\t</HStack>\n\t\t</BaseControl>\n\t);\n}\n\n/**\n * ToggleControl is used to generate a toggle user interface.\n *\n * ```jsx\n * import { ToggleControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyToggleControl = () => {\n * const [ value, setValue ] = useState( false );\n *\n * return (\n * <ToggleControl\n * __nextHasNoMarginBottom\n * label=\"Fixed Background\"\n * checked={ value }\n * onChange={ () => setValue( ( state ) => ! state ) }\n * />\n * );\n * };\n * ```\n */\nexport const ToggleControl = forwardRef( UnforwardedToggleControl );\n\nexport default ToggleControl;\n"],"mappings":";;;;;;;AAIA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAA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HhC;MAAK,CACG,CAAC;IAAA,CACL;EAAC,CACG,CAAC;AAEhB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMY,aAAa,GAAA6B,OAAA,CAAA7B,aAAA,GAAG,IAAA8B,mBAAU,EAAE5C,wBAAyB,CAAC;AAAC,IAAA6C,QAAA,GAAAF,OAAA,CAAAV,OAAA,GAErDnB,aAAa","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_switchCell","_interopRequireDefault","_jsxRuntime","ToggleControl","memo","label","checked","help","instanceId","className","onChange","props","id","helpLabel","jsx","default","value","onValueChange","_default","exports"],"sources":["@wordpress/components/src/toggle-control/index.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { memo } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport SwitchCell from '../mobile/bottom-sheet/switch-cell';\n\nconst ToggleControl = memo(\n\t( { label, checked, help, instanceId, className, onChange, ...props } ) => {\n\t\tconst id = `inspector-toggle-control-${ instanceId }`;\n\n\t\tconst helpLabel =\n\t\t\thelp && typeof help === 'function' ? help( checked ) : help;\n\n\t\treturn (\n\t\t\t<SwitchCell\n\t\t\t\tlabel={ label }\n\t\t\t\tid={ id }\n\t\t\t\thelp={ helpLabel }\n\t\t\t\tclassName={ className }\n\t\t\t\tvalue={ checked }\n\t\t\t\tonValueChange={ onChange }\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t);\n\t}\n);\n\nexport default ToggleControl;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAIA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA4D,IAAAG,WAAA,GAAAH,OAAA;AAP5D;AACA;AACA;;AAEA;AACA;AACA;;AAGA,MAAMI,aAAa,GAAG,IAAAC,aAAI,EACzB,CAAE;EAAEC,KAAK;EAAEC,OAAO;EAAEC,IAAI;EAAEC,UAAU;EAAEC,SAAS;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,KAAM;EAC1E,MAAMC,EAAE,GAAI,4BAA4BJ,UAAY,EAAC;EAErD,MAAMK,SAAS,GACdN,IAAI,IAAI,OAAOA,IAAI,KAAK,UAAU,GAAGA,IAAI,CAAED,OAAQ,CAAC,GAAGC,IAAI;EAE5D,oBACC,IAAAL,WAAA,CAAAY,GAAA,EAACd,WAAA,CAAAe,OAAU;IACVV,KAAK,EAAGA,KAAO;IACfO,EAAE,EAAGA,EAAI;IACTL,IAAI,EAAGM,SAAW;IAClBJ,SAAS,EAAGA,SAAW;IACvBO,KAAK,EAAGV,OAAS;IACjBW,aAAa,EAAGP,QAAU;IAAA,GACrBC;EAAK,CACV,CAAC;AAEJ,CACD,CAAC;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAJ,OAAA,GAEaZ,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_switchCell","_interopRequireDefault","_jsxRuntime","ToggleControl","memo","label","checked","help","instanceId","className","onChange","props","id","helpLabel","jsx","default","value","onValueChange","_default","exports"],"sources":["@wordpress/components/src/toggle-control/index.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { memo } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport SwitchCell from '../mobile/bottom-sheet/switch-cell';\n\nconst ToggleControl = memo(\n\t( { label, checked, help, instanceId, className, onChange, ...props } ) => {\n\t\tconst id = `inspector-toggle-control-${ instanceId }`;\n\n\t\tconst helpLabel =\n\t\t\thelp && typeof help === 'function' ? help( checked ) : help;\n\n\t\treturn (\n\t\t\t<SwitchCell\n\t\t\t\tlabel={ label }\n\t\t\t\tid={ id }\n\t\t\t\thelp={ helpLabel }\n\t\t\t\tclassName={ className }\n\t\t\t\tvalue={ checked }\n\t\t\t\tonValueChange={ onChange }\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t);\n\t}\n);\n\nexport default ToggleControl;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAIA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA4D,IAAAG,WAAA,GAAAH,OAAA;AAP5D;AACA;AACA;;AAEA;AACA;AACA;;AAGA,MAAMI,aAAa,GAAG,IAAAC,aAAI,EACzB,CAAE;EAAEC,KAAK;EAAEC,OAAO;EAAEC,IAAI;EAAEC,UAAU;EAAEC,SAAS;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,KAAM;EAC1E,MAAMC,EAAE,GAAG,4BAA6BJ,UAAU,EAAG;EAErD,MAAMK,SAAS,GACdN,IAAI,IAAI,OAAOA,IAAI,KAAK,UAAU,GAAGA,IAAI,CAAED,OAAQ,CAAC,GAAGC,IAAI;EAE5D,oBACC,IAAAL,WAAA,CAAAY,GAAA,EAACd,WAAA,CAAAe,OAAU;IACVV,KAAK,EAAGA,KAAO;IACfO,EAAE,EAAGA,EAAI;IACTL,IAAI,EAAGM,SAAW;IAClBJ,SAAS,EAAGA,SAAW;IACvBO,KAAK,EAAGV,OAAS;IACjBW,aAAa,EAAGP,QAAU;IAAA,GACrBC;EAAK,CACV,CAAC;AAEJ,CACD,CAAC;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAJ,OAAA,GAEaZ,aAAa","ignoreList":[]}
@@ -64,7 +64,15 @@ function UnforwardedToggleGroupControlAsRadioGroup({
64
64
  });
65
65
  const selectedValue = (0, _react.useStoreState)(radio, 'value');
66
66
  const setValue = radio.setValue;
67
+
68
+ // Ensures that the active id is also reset after the value is "reset" by the consumer.
69
+ (0, _element.useEffect)(() => {
70
+ if (selectedValue === '') {
71
+ radio.setActiveId(undefined);
72
+ }
73
+ }, [radio, selectedValue]);
67
74
  const groupContextValue = (0, _element.useMemo)(() => ({
75
+ activeItemIsNotFirstItem: () => radio.getState().activeId !== radio.first(),
68
76
  baseId,
69
77
  isBlock: !isAdaptiveWidth,
70
78
  size,
@@ -73,7 +81,7 @@ function UnforwardedToggleGroupControlAsRadioGroup({
73
81
  // @ts-expect-error - This is wrong and we should fix it.
74
82
  setValue,
75
83
  setSelectedElement
76
- }), [baseId, isAdaptiveWidth, selectedValue, setSelectedElement, setValue, size]);
84
+ }), [baseId, isAdaptiveWidth, radio, selectedValue, setSelectedElement, setValue, size]);
77
85
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.default.Provider, {
78
86
  value: groupContextValue,
79
87
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Ariakit.RadioGroup, {
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","Ariakit","_compose","_element","_i18n","_view","_context","_interopRequireDefault","_utils","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","UnforwardedToggleGroupControlAsRadioGroup","children","isAdaptiveWidth","label","onChange","onChangeProp","size","value","valueProp","id","idProp","setSelectedElement","otherProps","forwardedRef","generatedId","useInstanceId","ToggleGroupControlAsRadioGroup","baseId","defaultValue","useComputeControlledOrUncontrolledValue","wrappedOnChangeProp","v","undefined","radio","useRadioStore","setValue","rtl","isRTL","selectedValue","useStoreState","groupContextValue","useMemo","isBlock","jsx","Provider","RadioGroup","store","render","View","ref","exports","forwardRef"],"sources":["@wordpress/components/src/toggle-group-control/toggle-group-control/as-radio-group.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\nimport * as Ariakit from '@ariakit/react';\nimport { useStoreState } from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { forwardRef, useMemo } from '@wordpress/element';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { View } from '../../view';\nimport type { WordPressComponentProps } from '../../context';\nimport ToggleGroupControlContext from '../context';\nimport { useComputeControlledOrUncontrolledValue } from './utils';\nimport type {\n\tToggleGroupControlMainControlProps,\n\tToggleGroupControlContextProps,\n} from '../types';\n\nfunction UnforwardedToggleGroupControlAsRadioGroup(\n\t{\n\t\tchildren,\n\t\tisAdaptiveWidth,\n\t\tlabel,\n\t\tonChange: onChangeProp,\n\t\tsize,\n\t\tvalue: valueProp,\n\t\tid: idProp,\n\t\tsetSelectedElement,\n\t\t...otherProps\n\t}: WordPressComponentProps<\n\t\tToggleGroupControlMainControlProps,\n\t\t'div',\n\t\tfalse\n\t>,\n\tforwardedRef: ForwardedRef< HTMLDivElement >\n) {\n\tconst generatedId = useInstanceId(\n\t\tToggleGroupControlAsRadioGroup,\n\t\t'toggle-group-control-as-radio-group'\n\t);\n\tconst baseId = idProp || generatedId;\n\n\t// Use a heuristic to understand if the component is being used in controlled\n\t// or uncontrolled mode, and consequently:\n\t// - when controlled, convert `undefined` values to `''` (ie. \"no value\")\n\t// - use the `value` prop as the `defaultValue` when uncontrolled\n\tconst { value, defaultValue } =\n\t\tuseComputeControlledOrUncontrolledValue( valueProp );\n\n\t// `useRadioStore`'s `setValue` prop can be called with `null`, while\n\t// the component's `onChange` prop only expects `undefined`\n\tconst wrappedOnChangeProp = onChangeProp\n\t\t? ( v: string | number | null ) => {\n\t\t\t\tonChangeProp( v ?? undefined );\n\t\t }\n\t\t: undefined;\n\n\tconst radio = Ariakit.useRadioStore( {\n\t\tdefaultValue,\n\t\tvalue,\n\t\tsetValue: wrappedOnChangeProp,\n\t\trtl: isRTL(),\n\t} );\n\n\tconst selectedValue = useStoreState( radio, 'value' );\n\tconst setValue = radio.setValue;\n\n\tconst groupContextValue = useMemo(\n\t\t(): ToggleGroupControlContextProps => ( {\n\t\t\tbaseId,\n\t\t\tisBlock: ! isAdaptiveWidth,\n\t\t\tsize,\n\t\t\t// @ts-expect-error - This is wrong and we should fix it.\n\t\t\tvalue: selectedValue,\n\t\t\t// @ts-expect-error - This is wrong and we should fix it.\n\t\t\tsetValue,\n\t\t\tsetSelectedElement,\n\t\t} ),\n\t\t[\n\t\t\tbaseId,\n\t\t\tisAdaptiveWidth,\n\t\t\tselectedValue,\n\t\t\tsetSelectedElement,\n\t\t\tsetValue,\n\t\t\tsize,\n\t\t]\n\t);\n\n\treturn (\n\t\t<ToggleGroupControlContext.Provider value={ groupContextValue }>\n\t\t\t<Ariakit.RadioGroup\n\t\t\t\tstore={ radio }\n\t\t\t\taria-label={ label }\n\t\t\t\trender={ <View /> }\n\t\t\t\t{ ...otherProps }\n\t\t\t\tid={ baseId }\n\t\t\t\tref={ forwardedRef }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</Ariakit.RadioGroup>\n\t\t</ToggleGroupControlContext.Provider>\n\t);\n}\n\nexport const ToggleGroupControlAsRadioGroup = forwardRef(\n\tUnforwardedToggleGroupControlAsRadioGroup\n);\n"],"mappings":";;;;;;;AAIA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA0C,IAAAC,OAAA,GAAAH,MAAA;AAM1C,IAAAI,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,KAAA,GAAAL,OAAA;AAEA,IAAAM,QAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAAkE,IAAAS,WAAA,GAAAT,OAAA;AAAA,SAAAU,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAZ,wBAAAY,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,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]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","Ariakit","_compose","_element","_i18n","_view","_context","_interopRequireDefault","_utils","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","UnforwardedToggleGroupControlAsRadioGroup","children","isAdaptiveWidth","label","onChange","onChangeProp","size","value","valueProp","id","idProp","setSelectedElement","otherProps","forwardedRef","generatedId","useInstanceId","ToggleGroupControlAsRadioGroup","baseId","defaultValue","useComputeControlledOrUncontrolledValue","wrappedOnChangeProp","v","undefined","radio","useRadioStore","setValue","rtl","isRTL","selectedValue","useStoreState","useEffect","setActiveId","groupContextValue","useMemo","activeItemIsNotFirstItem","getState","activeId","first","isBlock","jsx","Provider","RadioGroup","store","render","View","ref","exports","forwardRef"],"sources":["@wordpress/components/src/toggle-group-control/toggle-group-control/as-radio-group.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\nimport * as Ariakit from '@ariakit/react';\nimport { useStoreState } from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { forwardRef, useEffect, useMemo } from '@wordpress/element';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { View } from '../../view';\nimport type { WordPressComponentProps } from '../../context';\nimport ToggleGroupControlContext from '../context';\nimport { useComputeControlledOrUncontrolledValue } from './utils';\nimport type {\n\tToggleGroupControlMainControlProps,\n\tToggleGroupControlContextProps,\n} from '../types';\n\nfunction UnforwardedToggleGroupControlAsRadioGroup(\n\t{\n\t\tchildren,\n\t\tisAdaptiveWidth,\n\t\tlabel,\n\t\tonChange: onChangeProp,\n\t\tsize,\n\t\tvalue: valueProp,\n\t\tid: idProp,\n\t\tsetSelectedElement,\n\t\t...otherProps\n\t}: WordPressComponentProps<\n\t\tToggleGroupControlMainControlProps,\n\t\t'div',\n\t\tfalse\n\t>,\n\tforwardedRef: ForwardedRef< HTMLDivElement >\n) {\n\tconst generatedId = useInstanceId(\n\t\tToggleGroupControlAsRadioGroup,\n\t\t'toggle-group-control-as-radio-group'\n\t);\n\tconst baseId = idProp || generatedId;\n\n\t// Use a heuristic to understand if the component is being used in controlled\n\t// or uncontrolled mode, and consequently:\n\t// - when controlled, convert `undefined` values to `''` (ie. \"no value\")\n\t// - use the `value` prop as the `defaultValue` when uncontrolled\n\tconst { value, defaultValue } =\n\t\tuseComputeControlledOrUncontrolledValue( valueProp );\n\n\t// `useRadioStore`'s `setValue` prop can be called with `null`, while\n\t// the component's `onChange` prop only expects `undefined`\n\tconst wrappedOnChangeProp = onChangeProp\n\t\t? ( v: string | number | null ) => {\n\t\t\t\tonChangeProp( v ?? undefined );\n\t\t }\n\t\t: undefined;\n\n\tconst radio = Ariakit.useRadioStore( {\n\t\tdefaultValue,\n\t\tvalue,\n\t\tsetValue: wrappedOnChangeProp,\n\t\trtl: isRTL(),\n\t} );\n\n\tconst selectedValue = useStoreState( radio, 'value' );\n\tconst setValue = radio.setValue;\n\n\t// Ensures that the active id is also reset after the value is \"reset\" by the consumer.\n\tuseEffect( () => {\n\t\tif ( selectedValue === '' ) {\n\t\t\tradio.setActiveId( undefined );\n\t\t}\n\t}, [ radio, selectedValue ] );\n\n\tconst groupContextValue = useMemo(\n\t\t(): ToggleGroupControlContextProps => ( {\n\t\t\tactiveItemIsNotFirstItem: () =>\n\t\t\t\tradio.getState().activeId !== radio.first(),\n\t\t\tbaseId,\n\t\t\tisBlock: ! isAdaptiveWidth,\n\t\t\tsize,\n\t\t\t// @ts-expect-error - This is wrong and we should fix it.\n\t\t\tvalue: selectedValue,\n\t\t\t// @ts-expect-error - This is wrong and we should fix it.\n\t\t\tsetValue,\n\t\t\tsetSelectedElement,\n\t\t} ),\n\t\t[\n\t\t\tbaseId,\n\t\t\tisAdaptiveWidth,\n\t\t\tradio,\n\t\t\tselectedValue,\n\t\t\tsetSelectedElement,\n\t\t\tsetValue,\n\t\t\tsize,\n\t\t]\n\t);\n\n\treturn (\n\t\t<ToggleGroupControlContext.Provider value={ groupContextValue }>\n\t\t\t<Ariakit.RadioGroup\n\t\t\t\tstore={ radio }\n\t\t\t\taria-label={ label }\n\t\t\t\trender={ <View /> }\n\t\t\t\t{ ...otherProps }\n\t\t\t\tid={ baseId }\n\t\t\t\tref={ forwardedRef }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</Ariakit.RadioGroup>\n\t\t</ToggleGroupControlContext.Provider>\n\t);\n}\n\nexport const ToggleGroupControlAsRadioGroup = forwardRef(\n\tUnforwardedToggleGroupControlAsRadioGroup\n);\n"],"mappings":";;;;;;;AAIA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA0C,IAAAC,OAAA,GAAAH,MAAA;AAM1C,IAAAI,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,KAAA,GAAAL,OAAA;AAEA,IAAAM,QAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAAkE,IAAAS,WAAA,GAAAT,OAAA;AAAA,SAAAU,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAZ,wBAAAY,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GA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,CAAG;MAAA,GACdhC,UAAU;MACfH,EAAE,EAAGQ,MAAQ;MACb4B,GAAG,EAAGhC,YAAc;MAAAZ,QAAA,EAElBA;IAAQ,CACS;EAAC,CACc,CAAC;AAEvC;AAEO,MAAMe,8BAA8B,GAAA8B,OAAA,CAAA9B,8BAAA,GAAG,IAAA+B,mBAAU,EACvD/C,yCACD,CAAC","ignoreList":[]}
@@ -14,8 +14,8 @@ var styles = _styles;
14
14
  var _asRadioGroup = require("./as-radio-group");
15
15
  var _asButtonGroup = require("./as-button-group");
16
16
  var _elementRect = require("../../utils/element-rect");
17
- var _useOnValueUpdate = require("../../utils/hooks/use-on-value-update");
18
17
  var _compose = require("@wordpress/compose");
18
+ var _useAnimatedOffsetRect = require("../../utils/hooks/use-animated-offset-rect");
19
19
  var _jsxRuntime = require("react/jsx-runtime");
20
20
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
21
21
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -31,64 +31,6 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
31
31
  * Internal dependencies
32
32
  */
33
33
 
34
- /**
35
- * A utility used to animate something in a container component based on the "offset
36
- * rect" (position relative to the container and size) of a subelement. For example,
37
- * this is useful to render an indicator for the selected option of a component, and
38
- * to animate it when the selected option changes.
39
- *
40
- * Takes in a container element and the up-to-date "offset rect" of the target
41
- * subelement, obtained with `useTrackElementOffsetRect`. Then it does the following:
42
- *
43
- * - Adds CSS variables with rect information to the container, so that the indicator
44
- * can be rendered and animated with them. These are kept up-to-date, enabling CSS
45
- * transitions on change.
46
- * - Sets an attribute (`data-subelement-animated` by default) when the tracked
47
- * element changes, so that the target (e.g. the indicator) can be animated to its
48
- * new size and position.
49
- * - Removes the attribute when the animation is done.
50
- *
51
- * The need for the attribute is due to the fact that the rect might update in
52
- * situations other than when the tracked element changes, e.g. the tracked element
53
- * might be resized. In such cases, there is no need to animate the indicator, and
54
- * the change in size or position of the indicator needs to be reflected immediately.
55
- */function useAnimatedOffsetRect(
56
- /**
57
- * The container element.
58
- */
59
- container,
60
- /**
61
- * The rect of the tracked element.
62
- */
63
- rect, {
64
- prefix = 'subelement',
65
- dataAttribute = `${prefix}-animated`,
66
- transitionEndFilter = () => true
67
- } = {}) {
68
- const setProperties = (0, _compose.useEvent)(() => {
69
- Object.keys(rect).forEach(property => property !== 'element' && container?.style.setProperty(`--${prefix}-${property}`, String(rect[property])));
70
- });
71
- (0, _element.useLayoutEffect)(() => {
72
- setProperties();
73
- }, [rect, setProperties]);
74
- (0, _useOnValueUpdate.useOnValueUpdate)(rect.element, ({
75
- previousValue
76
- }) => {
77
- // Only enable the animation when moving from one element to another.
78
- if (rect.element && previousValue) {
79
- container?.setAttribute(`data-${dataAttribute}`, '');
80
- }
81
- });
82
- (0, _element.useLayoutEffect)(() => {
83
- function onTransitionEnd(event) {
84
- if (transitionEndFilter(event)) {
85
- container?.removeAttribute(`data-${dataAttribute}`);
86
- }
87
- }
88
- container?.addEventListener('transitionend', onTransitionEnd);
89
- return () => container?.removeEventListener('transitionend', onTransitionEnd);
90
- }, [dataAttribute, container, transitionEndFilter]);
91
- }
92
34
  function UnconnectedToggleGroupControl(props, forwardedRef) {
93
35
  const {
94
36
  __nextHasNoMarginBottom = false,
@@ -111,7 +53,7 @@ function UnconnectedToggleGroupControl(props, forwardedRef) {
111
53
  const [controlElement, setControlElement] = (0, _element.useState)();
112
54
  const refs = (0, _compose.useMergeRefs)([setControlElement, forwardedRef]);
113
55
  const selectedRect = (0, _elementRect.useTrackElementOffsetRect)(value ? selectedElement : undefined);
114
- useAnimatedOffsetRect(controlElement, selectedRect, {
56
+ (0, _useAnimatedOffsetRect.useAnimatedOffsetRect)(controlElement, selectedRect, {
115
57
  prefix: 'selected',
116
58
  dataAttribute: 'indicator-animated',
117
59
  transitionEndFilter: event => event.pseudoElement === '::before'
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_context","_hooks","_baseControl","_interopRequireDefault","_styles","_interopRequireWildcard","styles","_asRadioGroup","_asButtonGroup","_elementRect","_useOnValueUpdate","_compose","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","useAnimatedOffsetRect","container","rect","prefix","dataAttribute","transitionEndFilter","setProperties","useEvent","keys","forEach","property","style","setProperty","String","useLayoutEffect","useOnValueUpdate","element","previousValue","setAttribute","onTransitionEnd","event","removeAttribute","addEventListener","removeEventListener","UnconnectedToggleGroupControl","props","forwardedRef","__nextHasNoMarginBottom","__next40pxDefaultSize","className","isAdaptiveWidth","isBlock","isDeselectable","label","hideLabelFromVision","help","onChange","size","value","children","otherProps","useContextSystem","normalizedSize","selectedElement","setSelectedElement","useState","controlElement","setControlElement","refs","useMergeRefs","selectedRect","useTrackElementOffsetRect","undefined","pseudoElement","cx","useCx","classes","useMemo","toggleGroupControl","block","MainControl","ToggleGroupControlAsButtonGroup","ToggleGroupControlAsRadioGroup","jsxs","__associatedWPComponentName","jsx","VisualLabelWrapper","VisualLabel","ref","ToggleGroupControl","exports","contextConnect","_default"],"sources":["@wordpress/components/src/toggle-group-control/toggle-group-control/component.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useMemo, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../../context';\nimport { contextConnect, useContextSystem } from '../../context';\nimport { useCx } from '../../utils/hooks';\nimport BaseControl from '../../base-control';\nimport type { ToggleGroupControlProps } from '../types';\nimport { VisualLabelWrapper } from './styles';\nimport * as styles from './styles';\nimport { ToggleGroupControlAsRadioGroup } from './as-radio-group';\nimport { ToggleGroupControlAsButtonGroup } from './as-button-group';\nimport type { ElementOffsetRect } from '../../utils/element-rect';\nimport { useTrackElementOffsetRect } from '../../utils/element-rect';\nimport { useOnValueUpdate } from '../../utils/hooks/use-on-value-update';\nimport { useEvent, useMergeRefs } from '@wordpress/compose';\n\n/**\n * A utility used to animate something in a container component based on the \"offset\n * rect\" (position relative to the container and size) of a subelement. For example,\n * this is useful to render an indicator for the selected option of a component, and\n * to animate it when the selected option changes.\n *\n * Takes in a container element and the up-to-date \"offset rect\" of the target\n * subelement, obtained with `useTrackElementOffsetRect`. Then it does the following:\n *\n * - Adds CSS variables with rect information to the container, so that the indicator\n * can be rendered and animated with them. These are kept up-to-date, enabling CSS\n * transitions on change.\n * - Sets an attribute (`data-subelement-animated` by default) when the tracked\n * element changes, so that the target (e.g. the indicator) can be animated to its\n * new size and position.\n * - Removes the attribute when the animation is done.\n *\n * The need for the attribute is due to the fact that the rect might update in\n * situations other than when the tracked element changes, e.g. the tracked element\n * might be resized. In such cases, there is no need to animate the indicator, and\n * the change in size or position of the indicator needs to be reflected immediately.\n */\nfunction useAnimatedOffsetRect(\n\t/**\n\t * The container element.\n\t */\n\tcontainer: HTMLElement | undefined,\n\t/**\n\t * The rect of the tracked element.\n\t */\n\trect: ElementOffsetRect,\n\t{\n\t\tprefix = 'subelement',\n\t\tdataAttribute = `${ prefix }-animated`,\n\t\ttransitionEndFilter = () => true,\n\t}: {\n\t\t/**\n\t\t * The prefix used for the CSS variables, e.g. if `prefix` is `selected`, the\n\t\t * CSS variables will be `--selected-top`, `--selected-left`, etc.\n\t\t * @default 'subelement'\n\t\t */\n\t\tprefix?: string;\n\t\t/**\n\t\t * The name of the data attribute used to indicate that the animation is in\n\t\t * progress. The `data-` prefix is added automatically.\n\t\t *\n\t\t * For example, if `dataAttribute` is `indicator-animated`, the attribute will\n\t\t * be `data-indicator-animated`.\n\t\t * @default `${ prefix }-animated`\n\t\t */\n\t\tdataAttribute?: string;\n\t\t/**\n\t\t * A function that is called with the transition event and returns a boolean\n\t\t * indicating whether the animation should be stopped. The default is a function\n\t\t * that always returns `true`.\n\t\t *\n\t\t * For example, if the animated element is the `::before` pseudo-element, the\n\t\t * function can be written as `( event ) => event.pseudoElement === '::before'`.\n\t\t * @default () => true\n\t\t */\n\t\ttransitionEndFilter?: ( event: TransitionEvent ) => boolean;\n\t} = {}\n) {\n\tconst setProperties = useEvent( () => {\n\t\t( Object.keys( rect ) as Array< keyof typeof rect > ).forEach(\n\t\t\t( property ) =>\n\t\t\t\tproperty !== 'element' &&\n\t\t\t\tcontainer?.style.setProperty(\n\t\t\t\t\t`--${ prefix }-${ property }`,\n\t\t\t\t\tString( rect[ property ] )\n\t\t\t\t)\n\t\t);\n\t} );\n\tuseLayoutEffect( () => {\n\t\tsetProperties();\n\t}, [ rect, setProperties ] );\n\tuseOnValueUpdate( rect.element, ( { previousValue } ) => {\n\t\t// Only enable the animation when moving from one element to another.\n\t\tif ( rect.element && previousValue ) {\n\t\t\tcontainer?.setAttribute( `data-${ dataAttribute }`, '' );\n\t\t}\n\t} );\n\tuseLayoutEffect( () => {\n\t\tfunction onTransitionEnd( event: TransitionEvent ) {\n\t\t\tif ( transitionEndFilter( event ) ) {\n\t\t\t\tcontainer?.removeAttribute( `data-${ dataAttribute }` );\n\t\t\t}\n\t\t}\n\t\tcontainer?.addEventListener( 'transitionend', onTransitionEnd );\n\t\treturn () =>\n\t\t\tcontainer?.removeEventListener( 'transitionend', onTransitionEnd );\n\t}, [ dataAttribute, container, transitionEndFilter ] );\n}\n\nfunction UnconnectedToggleGroupControl(\n\tprops: WordPressComponentProps< ToggleGroupControlProps, 'div', false >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\t__nextHasNoMarginBottom = false,\n\t\t__next40pxDefaultSize = false,\n\t\tclassName,\n\t\tisAdaptiveWidth = false,\n\t\tisBlock = false,\n\t\tisDeselectable = false,\n\t\tlabel,\n\t\thideLabelFromVision = false,\n\t\thelp,\n\t\tonChange,\n\t\tsize = 'default',\n\t\tvalue,\n\t\tchildren,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToggleGroupControl' );\n\n\tconst normalizedSize =\n\t\t__next40pxDefaultSize && size === 'default' ? '__unstable-large' : size;\n\n\tconst [ selectedElement, setSelectedElement ] = useState< HTMLElement >();\n\tconst [ controlElement, setControlElement ] = useState< HTMLElement >();\n\tconst refs = useMergeRefs( [ setControlElement, forwardedRef ] );\n\tconst selectedRect = useTrackElementOffsetRect(\n\t\tvalue ? selectedElement : undefined\n\t);\n\tuseAnimatedOffsetRect( controlElement, selectedRect, {\n\t\tprefix: 'selected',\n\t\tdataAttribute: 'indicator-animated',\n\t\ttransitionEndFilter: ( event ) => event.pseudoElement === '::before',\n\t} );\n\n\tconst cx = useCx();\n\n\tconst classes = useMemo(\n\t\t() =>\n\t\t\tcx(\n\t\t\t\tstyles.toggleGroupControl( {\n\t\t\t\t\tisBlock,\n\t\t\t\t\tisDeselectable,\n\t\t\t\t\tsize: normalizedSize,\n\t\t\t\t} ),\n\t\t\t\tisBlock && styles.block,\n\t\t\t\tclassName\n\t\t\t),\n\t\t[ className, cx, isBlock, isDeselectable, normalizedSize ]\n\t);\n\n\tconst MainControl = isDeselectable\n\t\t? ToggleGroupControlAsButtonGroup\n\t\t: ToggleGroupControlAsRadioGroup;\n\n\treturn (\n\t\t<BaseControl\n\t\t\thelp={ help }\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t__associatedWPComponentName=\"ToggleGroupControl\"\n\t\t>\n\t\t\t{ ! hideLabelFromVision && (\n\t\t\t\t<VisualLabelWrapper>\n\t\t\t\t\t<BaseControl.VisualLabel>{ label }</BaseControl.VisualLabel>\n\t\t\t\t</VisualLabelWrapper>\n\t\t\t) }\n\t\t\t<MainControl\n\t\t\t\t{ ...otherProps }\n\t\t\t\tsetSelectedElement={ setSelectedElement }\n\t\t\t\tclassName={ classes }\n\t\t\t\tisAdaptiveWidth={ isAdaptiveWidth }\n\t\t\t\tlabel={ label }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tref={ refs }\n\t\t\t\tsize={ normalizedSize }\n\t\t\t\tvalue={ value }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</MainControl>\n\t\t</BaseControl>\n\t);\n}\n\n/**\n * `ToggleGroupControl` is a form component that lets users choose options\n * represented in horizontal segments. To render options for this control use\n * `ToggleGroupControlOption` component.\n *\n * This component is intended for selecting a single persistent value from a set of options,\n * similar to a how a radio button group would work. If you simply want a toggle to switch between views,\n * use a `TabPanel` instead.\n *\n * Only use this control when you know for sure the labels of items inside won't\n * wrap. For items with longer labels, you can consider a `SelectControl` or a\n * `CustomSelectControl` component instead.\n *\n * ```jsx\n * import {\n * __experimentalToggleGroupControl as ToggleGroupControl,\n * __experimentalToggleGroupControlOption as ToggleGroupControlOption,\n * } from '@wordpress/components';\n *\n * function Example() {\n * return (\n * <ToggleGroupControl\n * label=\"my label\"\n * value=\"vertical\"\n * isBlock\n * __nextHasNoMarginBottom\n * >\n * <ToggleGroupControlOption value=\"horizontal\" label=\"Horizontal\" />\n * <ToggleGroupControlOption value=\"vertical\" label=\"Vertical\" />\n * </ToggleGroupControl>\n * );\n * }\n * ```\n */\nexport const ToggleGroupControl = contextConnect(\n\tUnconnectedToggleGroupControl,\n\t'ToggleGroupControl'\n);\n\nexport default ToggleGroupControl;\n"],"mappings":";;;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AAMA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAC,sBAAA,CAAAJ,OAAA;A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K,EAAGA,KAAO;MAAAC,QAAA,EAEbA;IAAQ,CACE,CAAC;EAAA,CACF,CAAC;AAEhB;;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;AACA;AACA;AACA;AACO,MAAM8B,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,IAAAE,uBAAc,EAC/C/C,6BAA6B,EAC7B,oBACD,CAAC;AAAC,IAAAgD,QAAA,GAAAF,OAAA,CAAApF,OAAA,GAEamF,kBAAkB","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_context","_hooks","_baseControl","_interopRequireDefault","_styles","_interopRequireWildcard","styles","_asRadioGroup","_asButtonGroup","_elementRect","_compose","_useAnimatedOffsetRect","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","UnconnectedToggleGroupControl","props","forwardedRef","__nextHasNoMarginBottom","__next40pxDefaultSize","className","isAdaptiveWidth","isBlock","isDeselectable","label","hideLabelFromVision","help","onChange","size","value","children","otherProps","useContextSystem","normalizedSize","selectedElement","setSelectedElement","useState","controlElement","setControlElement","refs","useMergeRefs","selectedRect","useTrackElementOffsetRect","undefined","useAnimatedOffsetRect","prefix","dataAttribute","transitionEndFilter","event","pseudoElement","cx","useCx","classes","useMemo","toggleGroupControl","block","MainControl","ToggleGroupControlAsButtonGroup","ToggleGroupControlAsRadioGroup","jsxs","__associatedWPComponentName","jsx","VisualLabelWrapper","VisualLabel","ref","ToggleGroupControl","exports","contextConnect","_default"],"sources":["@wordpress/components/src/toggle-group-control/toggle-group-control/component.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../../context';\nimport { contextConnect, useContextSystem } from '../../context';\nimport { useCx } from '../../utils/hooks';\nimport BaseControl from '../../base-control';\nimport type { ToggleGroupControlProps } from '../types';\nimport { VisualLabelWrapper } from './styles';\nimport * as styles from './styles';\nimport { ToggleGroupControlAsRadioGroup } from './as-radio-group';\nimport { ToggleGroupControlAsButtonGroup } from './as-button-group';\nimport { useTrackElementOffsetRect } from '../../utils/element-rect';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { useAnimatedOffsetRect } from '../../utils/hooks/use-animated-offset-rect';\n\nfunction UnconnectedToggleGroupControl(\n\tprops: WordPressComponentProps< ToggleGroupControlProps, 'div', false >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\t__nextHasNoMarginBottom = false,\n\t\t__next40pxDefaultSize = false,\n\t\tclassName,\n\t\tisAdaptiveWidth = false,\n\t\tisBlock = false,\n\t\tisDeselectable = false,\n\t\tlabel,\n\t\thideLabelFromVision = false,\n\t\thelp,\n\t\tonChange,\n\t\tsize = 'default',\n\t\tvalue,\n\t\tchildren,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToggleGroupControl' );\n\n\tconst normalizedSize =\n\t\t__next40pxDefaultSize && size === 'default' ? '__unstable-large' : size;\n\n\tconst [ selectedElement, setSelectedElement ] = useState< HTMLElement >();\n\tconst [ controlElement, setControlElement ] = useState< HTMLElement >();\n\tconst refs = useMergeRefs( [ setControlElement, forwardedRef ] );\n\tconst selectedRect = useTrackElementOffsetRect(\n\t\tvalue ? selectedElement : undefined\n\t);\n\tuseAnimatedOffsetRect( controlElement, selectedRect, {\n\t\tprefix: 'selected',\n\t\tdataAttribute: 'indicator-animated',\n\t\ttransitionEndFilter: ( event ) => event.pseudoElement === '::before',\n\t} );\n\n\tconst cx = useCx();\n\n\tconst classes = useMemo(\n\t\t() =>\n\t\t\tcx(\n\t\t\t\tstyles.toggleGroupControl( {\n\t\t\t\t\tisBlock,\n\t\t\t\t\tisDeselectable,\n\t\t\t\t\tsize: normalizedSize,\n\t\t\t\t} ),\n\t\t\t\tisBlock && styles.block,\n\t\t\t\tclassName\n\t\t\t),\n\t\t[ className, cx, isBlock, isDeselectable, normalizedSize ]\n\t);\n\n\tconst MainControl = isDeselectable\n\t\t? ToggleGroupControlAsButtonGroup\n\t\t: ToggleGroupControlAsRadioGroup;\n\n\treturn (\n\t\t<BaseControl\n\t\t\thelp={ help }\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t__associatedWPComponentName=\"ToggleGroupControl\"\n\t\t>\n\t\t\t{ ! hideLabelFromVision && (\n\t\t\t\t<VisualLabelWrapper>\n\t\t\t\t\t<BaseControl.VisualLabel>{ label }</BaseControl.VisualLabel>\n\t\t\t\t</VisualLabelWrapper>\n\t\t\t) }\n\t\t\t<MainControl\n\t\t\t\t{ ...otherProps }\n\t\t\t\tsetSelectedElement={ setSelectedElement }\n\t\t\t\tclassName={ classes }\n\t\t\t\tisAdaptiveWidth={ isAdaptiveWidth }\n\t\t\t\tlabel={ label }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tref={ refs }\n\t\t\t\tsize={ normalizedSize }\n\t\t\t\tvalue={ value }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</MainControl>\n\t\t</BaseControl>\n\t);\n}\n\n/**\n * `ToggleGroupControl` is a form component that lets users choose options\n * represented in horizontal segments. To render options for this control use\n * `ToggleGroupControlOption` component.\n *\n * This component is intended for selecting a single persistent value from a set of options,\n * similar to a how a radio button group would work. If you simply want a toggle to switch between views,\n * use a `TabPanel` instead.\n *\n * Only use this control when you know for sure the labels of items inside won't\n * wrap. For items with longer labels, you can consider a `SelectControl` or a\n * `CustomSelectControl` component instead.\n *\n * ```jsx\n * import {\n * __experimentalToggleGroupControl as ToggleGroupControl,\n * __experimentalToggleGroupControlOption as ToggleGroupControlOption,\n * } from '@wordpress/components';\n *\n * function Example() {\n * return (\n * <ToggleGroupControl\n * label=\"my label\"\n * value=\"vertical\"\n * isBlock\n * __nextHasNoMarginBottom\n * >\n * <ToggleGroupControlOption value=\"horizontal\" label=\"Horizontal\" />\n * <ToggleGroupControlOption value=\"vertical\" label=\"Vertical\" />\n * </ToggleGroupControl>\n * );\n * }\n * ```\n */\nexport const ToggleGroupControl = contextConnect(\n\tUnconnectedToggleGroupControl,\n\t'ToggleGroupControl'\n);\n\nexport default ToggleGroupControl;\n"],"mappings":";;;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AAMA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAEA,IAAAK,OAAA,GAAAC,uBAAA,CAAAN,OAAA;AAA8C,IAAAO,MAAA,GAAAF,OAAA;AAE9C,IAAAG,aAAA,GAAAR,OAAA;AACA,IAAAS,cAAA,GAAAT,OAAA;AACA,IAAAU,YAAA,GAAAV,OAAA;AACA,IAAAW,QAAA,GAAAX,OAAA;AACA,IAAAY,sBAAA,GAAAZ,OAAA;AAAmF,IAAAa,WAAA,GAAAb,OAAA;AAAA,SAAAc,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAT,wBAAAS,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAA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B,eACD,IAAA9B,WAAA,CAAAmE,GAAA,EAACL,WAAW;MAAA,GACNzB,UAAU;MACfI,kBAAkB,EAAGA,kBAAoB;MACzCf,SAAS,EAAGgC,OAAS;MACrB/B,eAAe,EAAGA,eAAiB;MACnCG,KAAK,EAAGA,KAAO;MACfG,QAAQ,EAAGA,QAAU;MACrBqC,GAAG,EAAGzB,IAAM;MACZX,IAAI,EAAGK,cAAgB;MACvBJ,KAAK,EAAGA,KAAO;MAAAC,QAAA,EAEbA;IAAQ,CACE,CAAC;EAAA,CACF,CAAC;AAEhB;;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;AACA;AACA;AACA;AACO,MAAMmC,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,IAAAE,uBAAc,EAC/CpD,6BAA6B,EAC7B,oBACD,CAAC;AAAC,IAAAqD,QAAA,GAAAF,OAAA,CAAAjE,OAAA,GAEagE,kBAAkB","ignoreList":[]}
@@ -66,7 +66,6 @@ function ToggleGroupControlOptionBase(props, forwardedRef) {
66
66
  value,
67
67
  children,
68
68
  showTooltip = false,
69
- onFocus: onFocusProp,
70
69
  disabled,
71
70
  ...otherButtonProps
72
71
  } = buttonProps;
@@ -107,7 +106,6 @@ function ToggleGroupControlOptionBase(props, forwardedRef) {
107
106
  children: isDeselectable ? /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
108
107
  ...commonProps,
109
108
  disabled: disabled,
110
- onFocus: onFocusProp,
111
109
  "aria-pressed": isPressed,
112
110
  type: "button",
113
111
  onClick: buttonOnClick,
@@ -116,16 +114,18 @@ function ToggleGroupControlOptionBase(props, forwardedRef) {
116
114
  })
117
115
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(Ariakit.Radio, {
118
116
  disabled: disabled,
119
- render: /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
120
- type: "button",
121
- ...commonProps,
122
- onFocus: event => {
123
- onFocusProp?.(event);
124
- if (event.defaultPrevented) {
125
- return;
126
- }
117
+ onFocusVisible: () => {
118
+ const selectedValueIsEmpty = toggleGroupControlContext.value === null || toggleGroupControlContext.value === '';
119
+
120
+ // Conditions ensure that the first visible focus to a radio group
121
+ // without a selected option will not automatically select the option.
122
+ if (!selectedValueIsEmpty || toggleGroupControlContext.activeItemIsNotFirstItem?.()) {
127
123
  toggleGroupControlContext.setValue(value);
128
124
  }
125
+ },
126
+ render: /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
127
+ type: "button",
128
+ ...commonProps
129
129
  }),
130
130
  value: value,
131
131
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ButtonContentView, {
@@ -1 +1 @@
1
- {"version":3,"names":["Ariakit","_interopRequireWildcard","require","_compose","_element","_context","_context2","styles","_hooks","_tooltip","_interopRequireDefault","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ButtonContentView","LabelView","WithToolTip","showTooltip","text","children","jsx","placement","Fragment","ToggleGroupControlOptionBase","props","forwardedRef","toggleGroupControlContext","useToggleGroupControlContext","id","useInstanceId","baseId","buttonProps","useContextSystem","isBlock","isDeselectable","size","className","isIcon","value","onFocus","onFocusProp","disabled","otherButtonProps","isPressed","cx","useCx","labelViewClasses","useMemo","labelBlock","itemClasses","buttonView","buttonOnClick","setValue","undefined","commonProps","ref","labelRef","useRef","useLayoutEffect","current","setSelectedElement","type","onClick","Radio","render","event","defaultPrevented","ConnectedToggleGroupControlOptionBase","contextConnect","_default","exports"],"sources":["@wordpress/components/src/toggle-group-control/toggle-group-control-option-base/component.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\nimport * as Ariakit from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useLayoutEffect, useMemo, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../../context';\nimport { contextConnect, useContextSystem } from '../../context';\nimport type {\n\tToggleGroupControlOptionBaseProps,\n\tWithToolTipProps,\n} from '../types';\nimport { useToggleGroupControlContext } from '../context';\nimport * as styles from './styles';\nimport { useCx } from '../../utils/hooks';\nimport Tooltip from '../../tooltip';\n\nconst { ButtonContentView, LabelView } = styles;\n\nconst WithToolTip = ( { showTooltip, text, children }: WithToolTipProps ) => {\n\tif ( showTooltip && text ) {\n\t\treturn (\n\t\t\t<Tooltip text={ text } placement=\"top\">\n\t\t\t\t{ children }\n\t\t\t</Tooltip>\n\t\t);\n\t}\n\treturn <>{ children }</>;\n};\n\nfunction ToggleGroupControlOptionBase(\n\tprops: Omit<\n\t\tWordPressComponentProps<\n\t\t\tToggleGroupControlOptionBaseProps,\n\t\t\t'button',\n\t\t\tfalse\n\t\t>,\n\t\t// the element's id is generated internally\n\t\t| 'id'\n\t\t// due to how the component works, only the `disabled` prop should be used\n\t\t| 'aria-disabled'\n\t>,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst toggleGroupControlContext = useToggleGroupControlContext();\n\n\tconst id = useInstanceId(\n\t\tToggleGroupControlOptionBase,\n\t\ttoggleGroupControlContext.baseId || 'toggle-group-control-option-base'\n\t);\n\n\tconst buttonProps = useContextSystem(\n\t\t{ ...props, id },\n\t\t'ToggleGroupControlOptionBase'\n\t);\n\n\tconst {\n\t\tisBlock = false,\n\t\tisDeselectable = false,\n\t\tsize = 'default',\n\t} = toggleGroupControlContext;\n\n\tconst {\n\t\tclassName,\n\t\tisIcon = false,\n\t\tvalue,\n\t\tchildren,\n\t\tshowTooltip = false,\n\t\tonFocus: onFocusProp,\n\t\tdisabled,\n\t\t...otherButtonProps\n\t} = buttonProps;\n\n\tconst isPressed = toggleGroupControlContext.value === value;\n\tconst cx = useCx();\n\tconst labelViewClasses = useMemo(\n\t\t() => cx( isBlock && styles.labelBlock ),\n\t\t[ cx, isBlock ]\n\t);\n\tconst itemClasses = useMemo(\n\t\t() =>\n\t\t\tcx(\n\t\t\t\tstyles.buttonView( {\n\t\t\t\t\tisDeselectable,\n\t\t\t\t\tisIcon,\n\t\t\t\t\tisPressed,\n\t\t\t\t\tsize,\n\t\t\t\t} ),\n\t\t\t\tclassName\n\t\t\t),\n\t\t[ cx, isDeselectable, isIcon, isPressed, size, className ]\n\t);\n\n\tconst buttonOnClick = () => {\n\t\tif ( isDeselectable && isPressed ) {\n\t\t\ttoggleGroupControlContext.setValue( undefined );\n\t\t} else {\n\t\t\ttoggleGroupControlContext.setValue( value );\n\t\t}\n\t};\n\n\tconst commonProps = {\n\t\t...otherButtonProps,\n\t\tclassName: itemClasses,\n\t\t'data-value': value,\n\t\tref: forwardedRef,\n\t};\n\n\tconst labelRef = useRef< HTMLDivElement | null >( null );\n\tuseLayoutEffect( () => {\n\t\tif ( isPressed && labelRef.current ) {\n\t\t\ttoggleGroupControlContext.setSelectedElement( labelRef.current );\n\t\t}\n\t}, [ isPressed, toggleGroupControlContext ] );\n\n\treturn (\n\t\t<LabelView ref={ labelRef } className={ labelViewClasses }>\n\t\t\t<WithToolTip\n\t\t\t\tshowTooltip={ showTooltip }\n\t\t\t\ttext={ otherButtonProps[ 'aria-label' ] }\n\t\t\t>\n\t\t\t\t{ isDeselectable ? (\n\t\t\t\t\t<button\n\t\t\t\t\t\t{ ...commonProps }\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tonFocus={ onFocusProp }\n\t\t\t\t\t\taria-pressed={ isPressed }\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tonClick={ buttonOnClick }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ButtonContentView>{ children }</ButtonContentView>\n\t\t\t\t\t</button>\n\t\t\t\t) : (\n\t\t\t\t\t<Ariakit.Radio\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t{ ...commonProps }\n\t\t\t\t\t\t\t\tonFocus={ ( event ) => {\n\t\t\t\t\t\t\t\t\tonFocusProp?.( event );\n\t\t\t\t\t\t\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\ttoggleGroupControlContext.setValue( value );\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\tvalue={ value }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ButtonContentView>{ children }</ButtonContentView>\n\t\t\t\t\t</Ariakit.Radio>\n\t\t\t\t) }\n\t\t\t</WithToolTip>\n\t\t</LabelView>\n\t);\n}\n\n/**\n * `ToggleGroupControlOptionBase` is a form component and is meant to be used as an internal,\n * generic component for any children of `ToggleGroupControl`.\n *\n * @example\n * ```jsx\n * import {\n * __experimentalToggleGroupControl as ToggleGroupControl,\n * __experimentalToggleGroupControlOptionBase as ToggleGroupControlOptionBase,\n * } from '@wordpress/components';\n *\n * function Example() {\n * return (\n * <ToggleGroupControl label=\"my label\" value=\"vertical\" isBlock>\n * <ToggleGroupControlOption value=\"horizontal\" label=\"Horizontal\" />\n * <ToggleGroupControlOption value=\"vertical\" label=\"Vertical\" />\n * </ToggleGroupControl>\n * );\n * }\n * ```\n */\nconst ConnectedToggleGroupControlOptionBase = contextConnect(\n\tToggleGroupControlOptionBase,\n\t'ToggleGroupControlOptionBase'\n);\n\nexport default ConnectedToggleGroupControlOptionBase;\n"],"mappings":";;;;;;;AAIA,IAAAA,OAAA,GAAAC,uBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAMA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,SAAA,GAAAJ,O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akit","_interopRequireWildcard","require","_compose","_element","_context","_context2","styles","_hooks","_tooltip","_interopRequireDefault","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ButtonContentView","LabelView","WithToolTip","showTooltip","text","children","jsx","placement","Fragment","ToggleGroupControlOptionBase","props","forwardedRef","toggleGroupControlContext","useToggleGroupControlContext","id","useInstanceId","baseId","buttonProps","useContextSystem","isBlock","isDeselectable","size","className","isIcon","value","disabled","otherButtonProps","isPressed","cx","useCx","labelViewClasses","useMemo","labelBlock","itemClasses","buttonView","buttonOnClick","setValue","undefined","commonProps","ref","labelRef","useRef","useLayoutEffect","current","setSelectedElement","type","onClick","Radio","onFocusVisible","selectedValueIsEmpty","activeItemIsNotFirstItem","render","ConnectedToggleGroupControlOptionBase","contextConnect","_default","exports"],"sources":["@wordpress/components/src/toggle-group-control/toggle-group-control-option-base/component.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\nimport * as Ariakit from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useLayoutEffect, useMemo, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../../context';\nimport { contextConnect, useContextSystem } from '../../context';\nimport type {\n\tToggleGroupControlOptionBaseProps,\n\tWithToolTipProps,\n} from '../types';\nimport { useToggleGroupControlContext } from '../context';\nimport * as styles from './styles';\nimport { useCx } from '../../utils/hooks';\nimport Tooltip from '../../tooltip';\n\nconst { ButtonContentView, LabelView } = styles;\n\nconst WithToolTip = ( { showTooltip, text, children }: WithToolTipProps ) => {\n\tif ( showTooltip && text ) {\n\t\treturn (\n\t\t\t<Tooltip text={ text } placement=\"top\">\n\t\t\t\t{ children }\n\t\t\t</Tooltip>\n\t\t);\n\t}\n\treturn <>{ children }</>;\n};\n\nfunction ToggleGroupControlOptionBase(\n\tprops: Omit<\n\t\tWordPressComponentProps<\n\t\t\tToggleGroupControlOptionBaseProps,\n\t\t\t'button',\n\t\t\tfalse\n\t\t>,\n\t\t// the element's id is generated internally\n\t\t| 'id'\n\t\t// due to how the component works, only the `disabled` prop should be used\n\t\t| 'aria-disabled'\n\t>,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst toggleGroupControlContext = useToggleGroupControlContext();\n\n\tconst id = useInstanceId(\n\t\tToggleGroupControlOptionBase,\n\t\ttoggleGroupControlContext.baseId || 'toggle-group-control-option-base'\n\t);\n\n\tconst buttonProps = useContextSystem(\n\t\t{ ...props, id },\n\t\t'ToggleGroupControlOptionBase'\n\t);\n\n\tconst {\n\t\tisBlock = false,\n\t\tisDeselectable = false,\n\t\tsize = 'default',\n\t} = toggleGroupControlContext;\n\n\tconst {\n\t\tclassName,\n\t\tisIcon = false,\n\t\tvalue,\n\t\tchildren,\n\t\tshowTooltip = false,\n\t\tdisabled,\n\t\t...otherButtonProps\n\t} = buttonProps;\n\n\tconst isPressed = toggleGroupControlContext.value === value;\n\tconst cx = useCx();\n\tconst labelViewClasses = useMemo(\n\t\t() => cx( isBlock && styles.labelBlock ),\n\t\t[ cx, isBlock ]\n\t);\n\tconst itemClasses = useMemo(\n\t\t() =>\n\t\t\tcx(\n\t\t\t\tstyles.buttonView( {\n\t\t\t\t\tisDeselectable,\n\t\t\t\t\tisIcon,\n\t\t\t\t\tisPressed,\n\t\t\t\t\tsize,\n\t\t\t\t} ),\n\t\t\t\tclassName\n\t\t\t),\n\t\t[ cx, isDeselectable, isIcon, isPressed, size, className ]\n\t);\n\n\tconst buttonOnClick = () => {\n\t\tif ( isDeselectable && isPressed ) {\n\t\t\ttoggleGroupControlContext.setValue( undefined );\n\t\t} else {\n\t\t\ttoggleGroupControlContext.setValue( value );\n\t\t}\n\t};\n\n\tconst commonProps = {\n\t\t...otherButtonProps,\n\t\tclassName: itemClasses,\n\t\t'data-value': value,\n\t\tref: forwardedRef,\n\t};\n\n\tconst labelRef = useRef< HTMLDivElement | null >( null );\n\tuseLayoutEffect( () => {\n\t\tif ( isPressed && labelRef.current ) {\n\t\t\ttoggleGroupControlContext.setSelectedElement( labelRef.current );\n\t\t}\n\t}, [ isPressed, toggleGroupControlContext ] );\n\n\treturn (\n\t\t<LabelView ref={ labelRef } className={ labelViewClasses }>\n\t\t\t<WithToolTip\n\t\t\t\tshowTooltip={ showTooltip }\n\t\t\t\ttext={ otherButtonProps[ 'aria-label' ] }\n\t\t\t>\n\t\t\t\t{ isDeselectable ? (\n\t\t\t\t\t<button\n\t\t\t\t\t\t{ ...commonProps }\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\taria-pressed={ isPressed }\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tonClick={ buttonOnClick }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ButtonContentView>{ children }</ButtonContentView>\n\t\t\t\t\t</button>\n\t\t\t\t) : (\n\t\t\t\t\t<Ariakit.Radio\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tonFocusVisible={ () => {\n\t\t\t\t\t\t\tconst selectedValueIsEmpty =\n\t\t\t\t\t\t\t\ttoggleGroupControlContext.value === null ||\n\t\t\t\t\t\t\t\ttoggleGroupControlContext.value === '';\n\n\t\t\t\t\t\t\t// Conditions ensure that the first visible focus to a radio group\n\t\t\t\t\t\t\t// without a selected option will not automatically select the option.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t! selectedValueIsEmpty ||\n\t\t\t\t\t\t\t\ttoggleGroupControlContext.activeItemIsNotFirstItem?.()\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\ttoggleGroupControlContext.setValue( value );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\trender={ <button type=\"button\" { ...commonProps } /> }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ButtonContentView>{ children }</ButtonContentView>\n\t\t\t\t\t</Ariakit.Radio>\n\t\t\t\t) }\n\t\t\t</WithToolTip>\n\t\t</LabelView>\n\t);\n}\n\n/**\n * `ToggleGroupControlOptionBase` is a form component and is meant to be used as an internal,\n * generic component for any children of `ToggleGroupControl`.\n *\n * @example\n * ```jsx\n * import {\n * __experimentalToggleGroupControl as ToggleGroupControl,\n * __experimentalToggleGroupControlOptionBase as ToggleGroupControlOptionBase,\n * } from '@wordpress/components';\n *\n * function Example() {\n * return (\n * <ToggleGroupControl label=\"my label\" value=\"vertical\" isBlock>\n * <ToggleGroupControlOption value=\"horizontal\" label=\"Horizontal\" />\n * <ToggleGroupControlOption value=\"vertical\" label=\"Vertical\" />\n * </ToggleGroupControl>\n * );\n * }\n * ```\n */\nconst ConnectedToggleGroupControlOptionBase = contextConnect(\n\tToggleGroupControlOptionBase,\n\t'ToggleGroupControlOptionBase'\n);\n\nexport default ConnectedToggleGroupControlOptionBase;\n"],"mappings":";;;;;;;AAIA,IAAAA,OAAA,GAAAC,uBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAMA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAN,uBAAA,CAAAC,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAC,sBAAA,CAAAR,OAAA;AAAoC,IAAAS,WAAA,GAAAT,OAAA;AAAA,SAAAU,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAZ,wBAAAY,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CA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