@procore/core-react 12.28.0 → 12.29.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 (347) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +3 -49
  3. package/dist/AnchorNavigation/AnchorNavigation.styles.js +3 -3
  4. package/dist/Avatar/Avatar.styles.js +5 -5
  5. package/dist/AvatarStack/AvatarStack.styles.d.ts +76 -76
  6. package/dist/AvatarStack/AvatarStack.styles.js +7 -7
  7. package/dist/Badge/Badge.styles.js +2 -2
  8. package/dist/BadgePill/BadgePill.styles.js +4 -4
  9. package/dist/Banner/Banner.styles.js +10 -10
  10. package/dist/Box/Box.styles.js +1 -1
  11. package/dist/Breadcrumbs/Breadcrumbs.styles.js +4 -4
  12. package/dist/Button/Button.styles.js +5 -5
  13. package/dist/Calendar/Calendar.styles.js +8 -8
  14. package/dist/Card/Card.styles.js +1 -1
  15. package/dist/Checkbox/Checkbox.styles.js +6 -6
  16. package/dist/Checkbox/CheckboxTooltip.js +1 -1
  17. package/dist/ContactItem/ContactItem.styles.js +5 -5
  18. package/dist/Content/Content.styles.js +2 -2
  19. package/dist/DateInput/DateInput.styles.js +6 -6
  20. package/dist/DetailPage/DetailPage.styles.js +7 -7
  21. package/dist/Dropdown/Dropdown.styles.js +3 -3
  22. package/dist/DropdownFlyout/DropdownFlyout.styles.js +4 -4
  23. package/dist/Dropzone/Dropzone.js +1 -1
  24. package/dist/Dropzone/Dropzone.styles.js +9 -9
  25. package/dist/EmptyState/EmptyState.styles.js +6 -6
  26. package/dist/Field/Field.styles.js +3 -3
  27. package/dist/FileList/FileList.styles.js +4 -4
  28. package/dist/FileSelect/FileExplorer/FileExplorer.styles.js +9 -9
  29. package/dist/FileSelect/FileExplorer/FileExplorerSidebar.styles.js +3 -3
  30. package/dist/FileSelect/FileSelect.styles.js +2 -2
  31. package/dist/FileSelect/FileSelectDropzone/FileSelectDropzone.styles.js +3 -3
  32. package/dist/FileSelect/FileTokenList/FileTokenList.styles.js +2 -2
  33. package/dist/FileSelect/GridSource/GridSource.styles.js +6 -6
  34. package/dist/FileSelect/LocalSource/LocalSource.styles.js +4 -4
  35. package/dist/FileSelect/SourceItem/SourceItem.styles.js +3 -3
  36. package/dist/FileSelect/ThumbnailList/ThumbnailList.styles.d.ts +1 -1
  37. package/dist/FileSelect/ThumbnailList/ThumbnailList.styles.js +6 -6
  38. package/dist/FileSelect/TreeSource/TreeSource.styles.js +1 -1
  39. package/dist/FileToken/FileToken.styles.js +4 -4
  40. package/dist/FilterToken/FilterToken.styles.js +5 -5
  41. package/dist/FlexList/FlexList.styles.js +1 -1
  42. package/dist/Form/Form.js +29 -10
  43. package/dist/Form/Form.js.map +1 -1
  44. package/dist/Form/Form.styles.js +14 -14
  45. package/dist/Form/StyledFormikForm.styles.d.ts +2 -2
  46. package/dist/Form/StyledFormikForm.styles.js +2 -2
  47. package/dist/GhostPlaceholder/GhostPlaceholder.styles.js +2 -2
  48. package/dist/Grid/Grid.styles.js +2 -2
  49. package/dist/GroupSelect/GroupSelect.styles.js +1 -1
  50. package/dist/Input/Input.styles.js +1 -1
  51. package/dist/Link/Link.styles.js +1 -1
  52. package/dist/ListPage/ListPage.styles.js +8 -8
  53. package/dist/Loader/Loader.styles.js +2 -2
  54. package/dist/MenuImperative/MenuImperative.styles.js +10 -10
  55. package/dist/Modal/Modal.styles.js +13 -13
  56. package/dist/Modal/storyHelpers.js +4 -1
  57. package/dist/Modal/storyHelpers.js.map +1 -1
  58. package/dist/MultiSelect/MultiSelect.styles.js +6 -6
  59. package/dist/NextMenu/NextMenu.styles.js +3 -3
  60. package/dist/Notation/Notation.js +1 -1
  61. package/dist/NumberInput/NumberInput.styles.js +7 -7
  62. package/dist/Overlay/OverlayArrow.styles.js +1 -1
  63. package/dist/OverlayTrigger/a11yPresets.d.ts +6 -6
  64. package/dist/PageLayout/PageLayout.styles.js +16 -16
  65. package/dist/PageTemplate/PageFooterTemplate/PageFooterTemplate.styles.js +1 -1
  66. package/dist/PageTemplate/PageHeaderTemplate/PageHeaderTemplate.styles.js +3 -3
  67. package/dist/PageTemplate/PagePaneTemplate/PagePaneTemplate.styles.js +2 -2
  68. package/dist/PageTemplate/PageTemplate/PageTemplate.styles.js +3 -3
  69. package/dist/Pagination/Pagination.styles.js +5 -5
  70. package/dist/Panel/Panel.styles.js +11 -11
  71. package/dist/Pill/Pill.styles.js +3 -3
  72. package/dist/PillSelect/PillSelect.styles.js +4 -4
  73. package/dist/Popover/Popover.styles.js +2 -2
  74. package/dist/Portal/Portal.styles.js +1 -1
  75. package/dist/ProgressBar/ProgressBar.styles.js +2 -2
  76. package/dist/RadioButton/RadioButton.styles.js +3 -3
  77. package/dist/Required/Required.styles.js +3 -3
  78. package/dist/Search/Search.styles.js +5 -5
  79. package/dist/Section/Section.styles.js +7 -7
  80. package/dist/SegmentedController/SegmentedController.styles.js +4 -4
  81. package/dist/Select/Select.styles.js +7 -7
  82. package/dist/Semantic/Semantic.styles.d.ts +76 -76
  83. package/dist/Semantic/Semantic.styles.js +9 -9
  84. package/dist/Slider/Slider.styles.js +5 -5
  85. package/dist/Spinner/Spinner.styles.js +7 -7
  86. package/dist/SplitViewCard/SplitViewCard.js +1 -2
  87. package/dist/SplitViewCard/SplitViewCard.js.map +1 -1
  88. package/dist/SplitViewCard/SplitViewCard.styles.js +8 -8
  89. package/dist/SuperSelect/SuperSelect.components.js +1 -5
  90. package/dist/SuperSelect/SuperSelect.components.js.map +1 -1
  91. package/dist/SuperSelect/SuperSelect.presets.styles.js +1 -1
  92. package/dist/SuperSelect/SuperSelect.styles.js +38 -38
  93. package/dist/SuperSelect/SuperSelect.types.d.ts +0 -1
  94. package/dist/SuperSelect/SuperSelect.types.js.map +1 -1
  95. package/dist/SuperSelect/useSuperSelect.js +15 -3
  96. package/dist/SuperSelect/useSuperSelect.js.map +1 -1
  97. package/dist/Switch/Switch.styles.js +4 -4
  98. package/dist/Table/Table.styles.js +28 -28
  99. package/dist/TableShelf/TableShelf.styles.js +5 -5
  100. package/dist/Tabs/Tabs.styles.js +15 -15
  101. package/dist/Tearsheet/Tearsheet.styles.js +5 -5
  102. package/dist/TextArea/TextArea.styles.js +1 -1
  103. package/dist/TextEditor/TextEditor.d.ts +17 -41
  104. package/dist/TextEditor/TextEditor.js +141 -155
  105. package/dist/TextEditor/TextEditor.js.map +1 -1
  106. package/dist/TextEditor/TextEditor.styles.d.ts +2 -5
  107. package/dist/TextEditor/TextEditor.styles.js +4 -24
  108. package/dist/TextEditor/TextEditor.styles.js.map +1 -1
  109. package/dist/TextEditor/TextEditor.types.d.ts +55 -109
  110. package/dist/TextEditor/TextEditor.types.js.map +1 -1
  111. package/dist/TextEditor/index.d.ts +2 -4
  112. package/dist/TextEditor/index.js +1 -3
  113. package/dist/TextEditor/index.js.map +1 -1
  114. package/dist/TextEditorOutput/TextEditorOutput.d.ts +7 -3
  115. package/dist/TextEditorOutput/TextEditorOutput.js +29 -13
  116. package/dist/TextEditorOutput/TextEditorOutput.js.map +1 -1
  117. package/dist/TextEditorOutput/TextEditorOutput.styles.js +2 -2
  118. package/dist/TextEditorOutput/TextEditorOutput.styles.js.map +1 -1
  119. package/dist/TextEditorOutput/TextEditorOutput.types.d.ts +10 -3
  120. package/dist/TextEditorOutput/TextEditorOutput.types.js.map +1 -1
  121. package/dist/Thumbnail/Thumbnail.hooks.d.ts +64 -64
  122. package/dist/Thumbnail/Thumbnail.styles.js +17 -17
  123. package/dist/ThumbnailGrid/ThumbnailGrid.styles.d.ts +1 -1
  124. package/dist/ThumbnailGrid/ThumbnailGrid.styles.js +7 -7
  125. package/dist/TieredSelect/TieredSelect.styles.js +9 -9
  126. package/dist/Tile/Tile.styles.js +8 -8
  127. package/dist/Title/Title.styles.js +7 -7
  128. package/dist/Toast/Toast.styles.js +3 -3
  129. package/dist/ToggleButton/ToggleButton.styles.js +1 -1
  130. package/dist/Token/Token.styles.js +3 -3
  131. package/dist/ToolHeader/ToolHeader.styles.js +6 -6
  132. package/dist/ToolLandingPage/ToolLandingPage.styles.js +3 -3
  133. package/dist/Tooltip/Tooltip.styles.js +2 -2
  134. package/dist/Tree/Tree.styles.js +9 -9
  135. package/dist/Typeahead/Typeahead.styles.js +3 -3
  136. package/dist/Typography/Typography.styles.js +1 -1
  137. package/dist/Typography/Typography.table.story.js +2 -2
  138. package/dist/_hooks/I18n.d.ts +14 -0
  139. package/dist/_locales/de-DE.json +2 -1
  140. package/dist/_locales/en-AU.json +2 -1
  141. package/dist/_locales/en-CA.json +2 -1
  142. package/dist/_locales/en-GB.json +2 -1
  143. package/dist/_locales/es-ES.json +3 -2
  144. package/dist/_locales/es.json +4 -3
  145. package/dist/_locales/fr-CA.json +2 -1
  146. package/dist/_locales/fr-FR.json +2 -1
  147. package/dist/_locales/is-IS.json +2 -1
  148. package/dist/_locales/it-IT.json +2 -1
  149. package/dist/_locales/ja-JP.json +2 -1
  150. package/dist/_locales/pl-PL.json +2 -1
  151. package/dist/_locales/pt-BR.json +2 -1
  152. package/dist/_locales/pt-PT.json +380 -0
  153. package/dist/_locales/th-TH.json +2 -1
  154. package/dist/_locales/zh-SG.json +2 -1
  155. package/dist/_locales/zh-TW.json +219 -218
  156. package/dist/_storyHelpers_/components/Deprecation.styles.js +1 -1
  157. package/dist/_storyHelpers_/components/StoryGrid.js +3 -3
  158. package/dist/_typedoc/AnchorNavigation/AnchorNavigation.types.json +3 -3
  159. package/dist/_typedoc/Avatar/Avatar.types.json +20 -20
  160. package/dist/_typedoc/AvatarStack/AvatarStack.types.json +24 -24
  161. package/dist/_typedoc/Badge/Badge.types.json +6 -6
  162. package/dist/_typedoc/Banner/Banner.types.json +13 -13
  163. package/dist/_typedoc/Box/Box.types.json +72 -72
  164. package/dist/_typedoc/Breadcrumbs/Breadcrumbs.types.json +10 -10
  165. package/dist/_typedoc/Button/Button.types.json +15 -15
  166. package/dist/_typedoc/Calendar/Calendar.types.json +80 -80
  167. package/dist/_typedoc/Card/Card.types.json +6 -6
  168. package/dist/_typedoc/Checkbox/Checkbox.types.json +8 -8
  169. package/dist/_typedoc/ContactItem/ContactItem.types.json +9 -9
  170. package/dist/_typedoc/DateInput/DateInput.types.json +35 -35
  171. package/dist/_typedoc/DateSelect/DateSelect.types.json +13 -13
  172. package/dist/_typedoc/DetailPage/DetailPage.types.json +5 -5
  173. package/dist/_typedoc/Dropdown/Dropdown.types.json +39 -39
  174. package/dist/_typedoc/DropdownFlyout/DropdownFlyout.types.json +30 -30
  175. package/dist/_typedoc/Dropzone/Dropzone.types.json +44 -44
  176. package/dist/_typedoc/EmptyState/EmptyState.types.json +16 -16
  177. package/dist/_typedoc/FileList/FileList.types.json +9 -9
  178. package/dist/_typedoc/FileSelect/FileSelect.types.json +27 -27
  179. package/dist/_typedoc/FileSelect/GridSource/GridSource.types.json +20 -20
  180. package/dist/_typedoc/FileSelect/LocalSource/LocalSource.types.json +14 -14
  181. package/dist/_typedoc/FileSelect/TreeSource/TreeSource.types.json +9 -9
  182. package/dist/_typedoc/Flex/Flex.types.json +27 -27
  183. package/dist/_typedoc/FlexList/FlexList.types.json +30 -30
  184. package/dist/_typedoc/Form/Form.types.json +847 -1131
  185. package/dist/_typedoc/GhostPlaceholder/GhostPlaceholder.types.json +12 -12
  186. package/dist/_typedoc/Grid/Grid.types.json +8 -8
  187. package/dist/_typedoc/GroupSelect/GroupSelect.types.json +52 -52
  188. package/dist/_typedoc/Input/Input.types.json +2 -2
  189. package/dist/_typedoc/Link/Link.types.json +1 -1
  190. package/dist/_typedoc/ListPage/ListPage.types.json +13 -13
  191. package/dist/_typedoc/Menu/Menu.types.json +62 -62
  192. package/dist/_typedoc/MenuImperative/MenuImperative.types.json +74 -74
  193. package/dist/_typedoc/Modal/Modal.types.json +46 -46
  194. package/dist/_typedoc/MultiSelect/MultiSelect.types.json +31 -31
  195. package/dist/_typedoc/NextTile/NextTile.types.json +32 -32
  196. package/dist/_typedoc/Notation/Notation.types.json +4 -4
  197. package/dist/_typedoc/NumberInput/NumberInput.types.json +54 -54
  198. package/dist/_typedoc/OverlayTrigger/OverlayTrigger.types.json +32 -32
  199. package/dist/_typedoc/PageLayout/PageLayout.types.json +26 -26
  200. package/dist/_typedoc/Pagination/Pagination.types.json +7 -7
  201. package/dist/_typedoc/Panel/Panel.types.json +30 -30
  202. package/dist/_typedoc/Pill/Pill.types.json +2 -2
  203. package/dist/_typedoc/PillSelect/PillSelect.types.json +49 -49
  204. package/dist/_typedoc/Popover/Popover.types.json +15 -15
  205. package/dist/_typedoc/ProgressBar/ProgressBar.types.json +7 -7
  206. package/dist/_typedoc/RadioButton/RadioButton.types.json +6 -6
  207. package/dist/_typedoc/Required/Required.types.json +5 -5
  208. package/dist/_typedoc/Search/Search.types.json +18 -18
  209. package/dist/_typedoc/Section/Section.types.json +15 -15
  210. package/dist/_typedoc/SegmentedController/SegmentedController.types.json +21 -21
  211. package/dist/_typedoc/Select/Select.types.json +62 -62
  212. package/dist/_typedoc/SettingsPage/SettingsPage.types.json +10 -10
  213. package/dist/_typedoc/Slider/Slider.types.json +6 -6
  214. package/dist/_typedoc/Spinner/Spinner.types.json +9 -9
  215. package/dist/_typedoc/SplitViewCard/SplitViewCard.types.json +14 -14
  216. package/dist/_typedoc/Table/Table.types.json +101 -101
  217. package/dist/_typedoc/Tabs/Tabs.types.json +20 -20
  218. package/dist/_typedoc/Tearsheet/Tearsheet.types.json +17 -17
  219. package/dist/_typedoc/TextArea/TextArea.types.json +3 -3
  220. package/dist/_typedoc/TextEditor/TextEditor.types.json +44 -160
  221. package/dist/_typedoc/TextEditorOutput/TextEditorOutput.types.json +15 -5
  222. package/dist/_typedoc/Thumbnail/Thumbnail.types.json +19 -19
  223. package/dist/_typedoc/TieredDropdown/TieredDropdown.types.json +42 -42
  224. package/dist/_typedoc/TieredSelect/TieredSelect.types.json +28 -28
  225. package/dist/_typedoc/Tile/Tile.types.json +8 -8
  226. package/dist/_typedoc/Title/Title.types.json +3 -3
  227. package/dist/_typedoc/Toast/Toast.types.json +4 -4
  228. package/dist/_typedoc/ToggleButton/ToggleButton.types.json +4 -4
  229. package/dist/_typedoc/Token/Token.types.json +7 -7
  230. package/dist/_typedoc/ToolHeader/ToolHeader.types.json +10 -10
  231. package/dist/_typedoc/ToolLandingPage/ToolLandingPage.types.json +7 -7
  232. package/dist/_typedoc/Tooltip/Tooltip.types.json +13 -13
  233. package/dist/_typedoc/Tree/Tree.types.json +88 -88
  234. package/dist/_typedoc/Typeahead/Typeahead.types.json +2 -2
  235. package/dist/_typedoc/Typography/Typography.types.json +9 -9
  236. package/dist/_typedoc/_utils/types.json +3 -3
  237. package/dist/_typedoc/deprecations.json +1 -1
  238. package/dist/_utils/TinyMCE.d.ts +21 -0
  239. package/dist/_utils/TinyMCE.js +86 -0
  240. package/dist/_utils/TinyMCE.js.map +1 -0
  241. package/dist/_utils/props.d.ts +4 -0
  242. package/dist/_utils/props.js +5 -0
  243. package/dist/_utils/props.js.map +1 -0
  244. package/dist/_utils/propsTypedoc.d.ts +0 -1
  245. package/dist/_utils/propsTypedoc.js +0 -1
  246. package/dist/_utils/propsTypedoc.js.map +1 -1
  247. package/dist/index.d.ts +7 -12
  248. package/dist/index.js +9 -17
  249. package/dist/index.js.map +1 -1
  250. package/package.json +5 -13
  251. package/dist/TextEditor/EditorError.d.ts +0 -2
  252. package/dist/TextEditor/EditorError.js +0 -9
  253. package/dist/TextEditor/EditorError.js.map +0 -1
  254. package/dist/TextEditor/StickyToolbar/StickyToolbar.types.d.ts +0 -5
  255. package/dist/TextEditor/StickyToolbar/StickyToolbar.types.js +0 -2
  256. package/dist/TextEditor/StickyToolbar/StickyToolbar.types.js.map +0 -1
  257. package/dist/TextEditor/StickyToolbar/StickyToolbar.utils.d.ts +0 -3
  258. package/dist/TextEditor/StickyToolbar/StickyToolbar.utils.js +0 -153
  259. package/dist/TextEditor/StickyToolbar/StickyToolbar.utils.js.map +0 -1
  260. package/dist/TextEditor/StickyToolbar/index.d.ts +0 -4
  261. package/dist/TextEditor/StickyToolbar/index.js +0 -3
  262. package/dist/TextEditor/StickyToolbar/index.js.map +0 -1
  263. package/dist/TextEditor/StickyToolbar/useStickyToolbar.d.ts +0 -2
  264. package/dist/TextEditor/StickyToolbar/useStickyToolbar.js +0 -49
  265. package/dist/TextEditor/StickyToolbar/useStickyToolbar.js.map +0 -1
  266. package/dist/TextEditor/StickyToolbar/useStickyToolbar.types.d.ts +0 -12
  267. package/dist/TextEditor/StickyToolbar/useStickyToolbar.types.js +0 -2
  268. package/dist/TextEditor/StickyToolbar/useStickyToolbar.types.js.map +0 -1
  269. package/dist/TextEditor/TextEditorProvider.d.ts +0 -4
  270. package/dist/TextEditor/TextEditorProvider.js +0 -17
  271. package/dist/TextEditor/TextEditorProvider.js.map +0 -1
  272. package/dist/TextEditor/TextEditorProvider.types.d.ts +0 -14
  273. package/dist/TextEditor/TextEditorProvider.types.js +0 -2
  274. package/dist/TextEditor/TextEditorProvider.types.js.map +0 -1
  275. package/dist/TextEditor/license_key.d.ts +0 -2
  276. package/dist/TextEditor/license_key.js +0 -3
  277. package/dist/TextEditor/license_key.js.map +0 -1
  278. package/dist/TextEditor/plugins/CutPlugin/CutCommand.d.ts +0 -5
  279. package/dist/TextEditor/plugins/CutPlugin/CutCommand.js +0 -99
  280. package/dist/TextEditor/plugins/CutPlugin/CutCommand.js.map +0 -1
  281. package/dist/TextEditor/plugins/CutPlugin/CutPlugin.d.ts +0 -5
  282. package/dist/TextEditor/plugins/CutPlugin/CutPlugin.js +0 -56
  283. package/dist/TextEditor/plugins/CutPlugin/CutPlugin.js.map +0 -1
  284. package/dist/TextEditor/plugins/CutPlugin/index.d.ts +0 -1
  285. package/dist/TextEditor/plugins/CutPlugin/index.js +0 -2
  286. package/dist/TextEditor/plugins/CutPlugin/index.js.map +0 -1
  287. package/dist/TextEditor/plugins/IndentPaddingToMarginPlugin/IndentPaddingToMarginPlugin.d.ts +0 -5
  288. package/dist/TextEditor/plugins/IndentPaddingToMarginPlugin/IndentPaddingToMarginPlugin.js +0 -40
  289. package/dist/TextEditor/plugins/IndentPaddingToMarginPlugin/IndentPaddingToMarginPlugin.js.map +0 -1
  290. package/dist/TextEditor/plugins/IndentPaddingToMarginPlugin/index.d.ts +0 -1
  291. package/dist/TextEditor/plugins/IndentPaddingToMarginPlugin/index.js +0 -2
  292. package/dist/TextEditor/plugins/IndentPaddingToMarginPlugin/index.js.map +0 -1
  293. package/dist/TextEditor/plugins/PasteAsTextPlugin/PasteAsTextCommand.d.ts +0 -5
  294. package/dist/TextEditor/plugins/PasteAsTextPlugin/PasteAsTextCommand.js +0 -86
  295. package/dist/TextEditor/plugins/PasteAsTextPlugin/PasteAsTextCommand.js.map +0 -1
  296. package/dist/TextEditor/plugins/PasteAsTextPlugin/PasteAsTextPlugin.d.ts +0 -5
  297. package/dist/TextEditor/plugins/PasteAsTextPlugin/PasteAsTextPlugin.js +0 -56
  298. package/dist/TextEditor/plugins/PasteAsTextPlugin/PasteAsTextPlugin.js.map +0 -1
  299. package/dist/TextEditor/plugins/PasteAsTextPlugin/index.d.ts +0 -1
  300. package/dist/TextEditor/plugins/PasteAsTextPlugin/index.js +0 -2
  301. package/dist/TextEditor/plugins/PasteAsTextPlugin/index.js.map +0 -1
  302. package/dist/TextEditor/plugins/PastePlugin/PasteCommand.d.ts +0 -5
  303. package/dist/TextEditor/plugins/PastePlugin/PasteCommand.js +0 -149
  304. package/dist/TextEditor/plugins/PastePlugin/PasteCommand.js.map +0 -1
  305. package/dist/TextEditor/plugins/PastePlugin/PastePlugin.d.ts +0 -5
  306. package/dist/TextEditor/plugins/PastePlugin/PastePlugin.js +0 -56
  307. package/dist/TextEditor/plugins/PastePlugin/PastePlugin.js.map +0 -1
  308. package/dist/TextEditor/plugins/PastePlugin/index.d.ts +0 -1
  309. package/dist/TextEditor/plugins/PastePlugin/index.js +0 -2
  310. package/dist/TextEditor/plugins/PastePlugin/index.js.map +0 -1
  311. package/dist/TextEditor/plugins/TabSpacesPlugin/TabSpacesPlugin.d.ts +0 -6
  312. package/dist/TextEditor/plugins/TabSpacesPlugin/TabSpacesPlugin.js +0 -87
  313. package/dist/TextEditor/plugins/TabSpacesPlugin/TabSpacesPlugin.js.map +0 -1
  314. package/dist/TextEditor/plugins/TabSpacesPlugin/index.d.ts +0 -1
  315. package/dist/TextEditor/plugins/TabSpacesPlugin/index.js +0 -2
  316. package/dist/TextEditor/plugins/TabSpacesPlugin/index.js.map +0 -1
  317. package/dist/TextEditor/textEditorTheming/icons.d.ts +0 -23
  318. package/dist/TextEditor/textEditorTheming/icons.js +0 -24
  319. package/dist/TextEditor/textEditorTheming/icons.js.map +0 -1
  320. package/dist/TextEditor/textEditorTheming/index.d.ts +0 -1
  321. package/dist/TextEditor/textEditorTheming/index.js +0 -2
  322. package/dist/TextEditor/textEditorTheming/index.js.map +0 -1
  323. package/dist/TextEditor/textEditorTheming/textEditorTheming.styles.d.ts +0 -2
  324. package/dist/TextEditor/textEditorTheming/textEditorTheming.styles.js +0 -10
  325. package/dist/TextEditor/textEditorTheming/textEditorTheming.styles.js.map +0 -1
  326. package/dist/TextEditor/useCKEditorCss.d.ts +0 -3
  327. package/dist/TextEditor/useCKEditorCss.js +0 -36
  328. package/dist/TextEditor/useCKEditorCss.js.map +0 -1
  329. package/dist/TextEditor/useTabAsNavigation.d.ts +0 -11
  330. package/dist/TextEditor/useTabAsNavigation.js +0 -29
  331. package/dist/TextEditor/useTabAsNavigation.js.map +0 -1
  332. package/dist/TextEditor/utils/config.d.ts +0 -3
  333. package/dist/TextEditor/utils/config.js +0 -179
  334. package/dist/TextEditor/utils/config.js.map +0 -1
  335. package/dist/TextEditor/utils/index.d.ts +0 -2
  336. package/dist/TextEditor/utils/index.js +0 -3
  337. package/dist/TextEditor/utils/index.js.map +0 -1
  338. package/dist/TextEditor/utils/locale.d.ts +0 -3
  339. package/dist/TextEditor/utils/locale.js +0 -102
  340. package/dist/TextEditor/utils/locale.js.map +0 -1
  341. package/dist/TextEditor/utils/plugins.d.ts +0 -7
  342. package/dist/TextEditor/utils/plugins.js +0 -184
  343. package/dist/TextEditor/utils/plugins.js.map +0 -1
  344. package/dist/TextEditorOutput/TextEditorOutput.utils.d.ts +0 -2
  345. package/dist/TextEditorOutput/TextEditorOutput.utils.js +0 -59
  346. package/dist/TextEditorOutput/TextEditorOutput.utils.js.map +0 -1
  347. package/dist/_typedoc/TextEditor/TextEditorProvider.types.json +0 -28
@@ -17,17 +17,17 @@ var borderRadius = /*#__PURE__*/css(["border-radius:", "px ", "px 0 0;"], spacin
17
17
  */
18
18
  var StyledTabBase = /*#__PURE__*/styled.div.withConfig({
19
19
  displayName: "StyledTabBase",
20
- componentId: "core-12_28_0__sc-17s58xs-0"
20
+ componentId: "core-12_29_0__sc-17s58xs-0"
21
21
  })(["align-items:center;box-sizing:border-box;cursor:pointer;display:inline-flex;flex:0 0 auto;justify-content:center;position:relative;white-space:nowrap;text-decoration:none;background-color:transparent;border:none;font-family:inherit;padding:0;"]);
22
22
  var StyledTabInnerBase = /*#__PURE__*/styled.div.withConfig({
23
23
  displayName: "StyledTabInnerBase",
24
- componentId: "core-12_28_0__sc-17s58xs-1"
24
+ componentId: "core-12_29_0__sc-17s58xs-1"
25
25
  })(["align-self:baseline;box-sizing:border-box;&,> a{display:flex;text-decoration:none;width:100%;}"]);
26
26
 
27
27
  // This so that it can be visible/hidden via CSS down below
28
28
  var StyledDropdownTabBase = /*#__PURE__*/styled(StyledTabBase).withConfig({
29
29
  displayName: "StyledDropdownTabBase",
30
- componentId: "core-12_28_0__sc-17s58xs-2"
30
+ componentId: "core-12_29_0__sc-17s58xs-2"
31
31
  })(["", ""], hiddenTab);
32
32
 
33
33
  //// END BASE LAYOUT COMPONENTS FOR TABS ////
@@ -50,11 +50,11 @@ function getTabStyle() {
50
50
  }
51
51
  var StyledTab = /*#__PURE__*/styled(StyledTabBase).withConfig({
52
52
  displayName: "StyledTab",
53
- componentId: "core-12_28_0__sc-17s58xs-3"
53
+ componentId: "core-12_29_0__sc-17s58xs-3"
54
54
  })(["", ""], getTabStyle);
55
55
  var StyledTabInner = /*#__PURE__*/styled(StyledTabInnerBase).withConfig({
56
56
  displayName: "StyledTabInner",
57
- componentId: "core-12_28_0__sc-17s58xs-4"
57
+ componentId: "core-12_29_0__sc-17s58xs-4"
58
58
  })(["", " padding:0 ", "px;font-weight:", ";&,> a{", ";color:", ";height:23px;}", ""], getTypographyIntent('body'), spacing.xs, function (_ref3) {
59
59
  var $selected = _ref3.$selected;
60
60
  return $selected ? 600 : 400;
@@ -67,15 +67,15 @@ var StyledTabInner = /*#__PURE__*/styled(StyledTabInnerBase).withConfig({
67
67
  });
68
68
  var StyledDropdownTab = /*#__PURE__*/styled(StyledDropdownTabBase).withConfig({
69
69
  displayName: "StyledDropdownTab",
70
- componentId: "core-12_28_0__sc-17s58xs-5"
70
+ componentId: "core-12_29_0__sc-17s58xs-5"
71
71
  })(["", ""], getTabStyle);
72
72
  var StyledDropdownTabInner = /*#__PURE__*/styled(StyledTabInner).withConfig({
73
73
  displayName: "StyledDropdownTabInner",
74
- componentId: "core-12_28_0__sc-17s58xs-6"
74
+ componentId: "core-12_29_0__sc-17s58xs-6"
75
75
  })(["align-items:center;cursor:pointer;display:inline-flex;"]);
76
76
  var StyledLink = /*#__PURE__*/styled.span.withConfig({
77
77
  displayName: "StyledLink",
78
- componentId: "core-12_28_0__sc-17s58xs-7"
78
+ componentId: "core-12_29_0__sc-17s58xs-7"
79
79
  })(["align-items:center;display:flex;height:23px;", ";box-sizing:border-box;"], borderRadius);
80
80
 
81
81
  //// END TRADITIONAL DESIGN SYSTEM TAB STYLES ////
@@ -92,34 +92,34 @@ function getHelixHeaderTabStyles() {
92
92
  }
93
93
  var StyledGlobalNavigationTab = /*#__PURE__*/styled(StyledTabBase).withConfig({
94
94
  displayName: "StyledGlobalNavigationTab",
95
- componentId: "core-12_28_0__sc-17s58xs-8"
95
+ componentId: "core-12_29_0__sc-17s58xs-8"
96
96
  })(["", ""], getHelixHeaderTabStyles);
97
97
  var StyledGlobalNavigationDropdownTab = /*#__PURE__*/styled(StyledDropdownTabBase).withConfig({
98
98
  displayName: "StyledGlobalNavigationDropdownTab",
99
- componentId: "core-12_28_0__sc-17s58xs-9"
99
+ componentId: "core-12_29_0__sc-17s58xs-9"
100
100
  })(["", ""], getHelixHeaderTabStyles);
101
101
  var StyledGlobalNavigationDropdownTabInner = /*#__PURE__*/styled(StyledTabInnerBase).withConfig({
102
102
  displayName: "StyledGlobalNavigationDropdownTabInner",
103
- componentId: "core-12_28_0__sc-17s58xs-10"
103
+ componentId: "core-12_29_0__sc-17s58xs-10"
104
104
  })(["align-items:center;cursor:pointer;display:inline-flex;"]);
105
105
  var StyledGlobalNavigationLink = /*#__PURE__*/styled.span.withConfig({
106
106
  displayName: "StyledGlobalNavigationLink",
107
- componentId: "core-12_28_0__sc-17s58xs-11"
107
+ componentId: "core-12_29_0__sc-17s58xs-11"
108
108
  })(["padding-left:6px;padding-right:6px;"]);
109
109
 
110
110
  //// END HELIX GLOBAL NAVIGATION TAB STYLES ////
111
111
 
112
112
  export var StyledOverlay = /*#__PURE__*/styled(Card).withConfig({
113
113
  displayName: "StyledOverlay",
114
- componentId: "core-12_28_0__sc-17s58xs-12"
114
+ componentId: "core-12_29_0__sc-17s58xs-12"
115
115
  })(["max-height:40vh;", "{padding:0;display:flex;justify-content:center;a{margin:unset;padding:unset;}}", "{padding:0;display:flex;}", "{padding:2px 16px 4px 16px;}", ",", "{color:", ";border-radius:0;display:flex;width:100%;background:inherit;font-weight:inherit;font-size:inherit;padding:0;}[data-selected='true']{", ",", "{border-bottom-color:transparent;color:", ";}}"], StyledItem, StyledLink, StyledTabInnerBase, StyledLink, StyledTabBase, colors.gray15, StyledLink, StyledTabBase, colors.blue50);
116
116
  export var StyledTabList = /*#__PURE__*/styled.div.withConfig({
117
117
  displayName: "StyledTabList",
118
- componentId: "core-12_28_0__sc-17s58xs-13"
118
+ componentId: "core-12_29_0__sc-17s58xs-13"
119
119
  })(["display:flex;width:100%;"]);
120
120
  export var StyledTabs = /*#__PURE__*/styled.nav.withConfig({
121
121
  displayName: "StyledTabs",
122
- componentId: "core-12_28_0__sc-17s58xs-14"
122
+ componentId: "core-12_29_0__sc-17s58xs-14"
123
123
  })(["background-color:", ";display:flex;overflow:hidden;width:100%;", "{&:nth-child(1n + ", "){&:not(", "){", "}}}", ""], function (_ref6) {
124
124
  var $dark = _ref6.$dark;
125
125
  return $dark && colors.gray15;
@@ -48,7 +48,7 @@ var getSlideOutAnimation = function getSlideOutAnimation($placement) {
48
48
  };
49
49
  export var StyledTearsheetContent = /*#__PURE__*/styled.div.withConfig({
50
50
  displayName: "StyledTearsheetContent",
51
- componentId: "core-12_28_0__sc-ljrxoq-0"
51
+ componentId: "core-12_29_0__sc-ljrxoq-0"
52
52
  })(["display:flex;z-index:2;width:100%;", " ", " ", " ", ""], function (_ref) {
53
53
  var $open = _ref.$open,
54
54
  $placement = _ref.$placement;
@@ -68,7 +68,7 @@ export var StyledTearsheetContent = /*#__PURE__*/styled.div.withConfig({
68
68
  export var minScrimSize = spacing.xxl * 3;
69
69
  export var StyledTearsheetBody = /*#__PURE__*/styled.div.withConfig({
70
70
  displayName: "StyledTearsheetBody",
71
- componentId: "core-12_28_0__sc-ljrxoq-1"
71
+ componentId: "core-12_29_0__sc-ljrxoq-1"
72
72
  })(["display:flex;overflow-y:auto;flex-direction:column;background-color:", ";&:focus-visible{", "}", " ", "}"], colors.white, getFocusInset(), function (_ref5) {
73
73
  var $block = _ref5.$block,
74
74
  $placement = _ref5.$placement,
@@ -89,7 +89,7 @@ var zoomIn = /*#__PURE__*/keyframes(["from{transform:scale(0);}to{transform:scal
89
89
  var zoomOut = /*#__PURE__*/keyframes(["from{transform:scale(1);}to{transform:scale(0);}"]);
90
90
  export var StyledScrimContainer = /*#__PURE__*/styled.div.withConfig({
91
91
  displayName: "StyledScrimContainer",
92
- componentId: "core-12_28_0__sc-ljrxoq-2"
92
+ componentId: "core-12_29_0__sc-ljrxoq-2"
93
93
  })(["", ""], function (_ref7) {
94
94
  var $placement = _ref7.$placement;
95
95
  var minSizeProp = ['top', 'bottom'].includes($placement) ? 'min-height' : 'min-width';
@@ -97,7 +97,7 @@ export var StyledScrimContainer = /*#__PURE__*/styled.div.withConfig({
97
97
  });
98
98
  export var StyledButtonContainer = /*#__PURE__*/styled.div.withConfig({
99
99
  displayName: "StyledButtonContainer",
100
- componentId: "core-12_28_0__sc-ljrxoq-3"
100
+ componentId: "core-12_29_0__sc-ljrxoq-3"
101
101
  })(["", ""], function (_ref8) {
102
102
  var $placement = _ref8.$placement;
103
103
  switch ($placement) {
@@ -112,7 +112,7 @@ export var StyledButtonContainer = /*#__PURE__*/styled.div.withConfig({
112
112
  });
113
113
  export var StyledButtonCard = /*#__PURE__*/styled(Card).withConfig({
114
114
  displayName: "StyledButtonCard",
115
- componentId: "core-12_28_0__sc-ljrxoq-4"
115
+ componentId: "core-12_29_0__sc-ljrxoq-4"
116
116
  })(["display:inline-flex;margin:", "px;", " ", " ", ""], spacing.xl, function (_ref9) {
117
117
  var $open = _ref9.$open;
118
118
  return $open ? css(["transform:scale(1);"]) : css(["transform:scale(0);"]);
@@ -3,7 +3,7 @@ import { getInputStyles } from '../Input/Input.styles';
3
3
  import { spacing } from '../_styles/spacing';
4
4
  export var StyledTextArea = /*#__PURE__*/styled.textarea.withConfig({
5
5
  displayName: "StyledTextArea",
6
- componentId: "core-12_28_0__sc-u5mow1-0"
6
+ componentId: "core-12_29_0__sc-u5mow1-0"
7
7
  })(["", ";height:auto;min-height:64px;padding:", "px ", "px;resize:", ";"], getInputStyles, spacing.sm, spacing.md, function (_ref) {
8
8
  var _ref$$resize = _ref.$resize,
9
9
  $resize = _ref$$resize === void 0 ? 'both' : _ref$$resize;
@@ -1,44 +1,20 @@
1
1
  import React from 'react';
2
- import type { TextEditorProps } from './TextEditor.types';
2
+ import type { TextEditorProps, TextEditorProviderProps } from './TextEditor.types';
3
+ export declare function TextEditorProvider({ children, features, }: TextEditorProviderProps): React.JSX.Element;
3
4
  /**
4
- * To ensure your Jest tests work with the new CKEditor implementation, wrap your Jest configuration with `coreReactJestConfig`:
5
- *
6
- * @example
7
- *
8
- * // Using Jest config file
9
- *
10
- * const { coreReactJestConfig } = require('@procore/core-react/jestConfig')
11
- *
12
- * module.exports = coreReactJestConfig({
13
- * // Your existing Jest config
14
- * })
15
- *
16
- * @example
17
- *
18
- * // Using Hammer
19
- *
20
- * import { coreReactJestConfig } from '@procore/core-react/jestConfig'
21
- *
22
- * export default {
23
- * testJest: (defaultConfig) =>
24
- * coreReactJestConfig({
25
- * ...defaultConfig,
26
- * // Your existing Jest config
27
- * }),
28
- * }
29
- *
30
- * @example
31
- *
32
- * // Using Core Scripts
33
- *
34
- * const { coreReactJestConfig } = require('@procore/core-react/jestConfig')
35
- *
36
- * module.exports = () => ({
37
- * jestOverride: (defaultConfig) =>
38
- * coreReactJestConfig({
39
- * ...defaultConfig,
40
- * // Your existing Jest config
41
- * }),
42
- * })
5
+
6
+ We use text editors to allow users to enter multiple lines of formatted text.
7
+
8
+ If users need to add unformatted text, see Text Area.
9
+
10
+ @since 10.19.0
11
+
12
+ @see [Storybook](https://stories.core.procore.com/?path=/story/core-react_demos-texteditor--demo)
13
+
14
+ @see [Design Guidelines](https://design.procore.com/text-editor)
15
+
43
16
  */
44
- export declare function TextEditor({ disabled, error, value, initialValue, onChange, onInit, onBlur, config: externalConfig, plugins: stringPlugins, locale: propLocale, onDirty, tinyMCE: _tinyMCE, init: _init, onKeyDown: _onKeyDown, onEditorChange: _onEditorChange, onFocusOut: _onFocusOut, ...restProps }: TextEditorProps): React.JSX.Element | null;
17
+ export declare function TextEditor({ error, init: initOverrides, locale, onChange, onInit: _onInit, plugins, ...props }: TextEditorProps): React.JSX.Element;
18
+ export declare namespace TextEditor {
19
+ var displayName: string;
20
+ }
@@ -1,5 +1,5 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["disabled", "error", "value", "initialValue", "onChange", "onInit", "onBlur", "config", "plugins", "locale", "onDirty", "tinyMCE", "init", "onKeyDown", "onEditorChange", "onFocusOut"];
2
+ var _excluded = ["error", "init", "locale", "onChange", "onInit", "plugins"];
3
3
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
4
4
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
5
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -8,180 +8,166 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
8
8
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
9
  function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
10
10
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
12
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
13
11
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
14
12
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
15
13
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
16
14
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
17
- import { CKEditor } from '@ckeditor/ckeditor5-react';
18
- import { ClassicEditor } from 'ckeditor5';
19
- import React from 'react';
15
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
16
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
17
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
18
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
19
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
20
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
21
+ import { Editor } from '@tinymce/tinymce-react';
22
+ import React, { useState } from 'react';
20
23
  import { useOverridableFocusScope } from '../_hooks/FocusScopeOverride';
21
24
  import { useI18nContext } from '../_hooks/I18n';
22
25
  import { useZIndexContext } from '../_hooks/ZIndex';
23
- import { useStickyToolbar } from './StickyToolbar';
24
- import { GlobalEditorStyles, StyledTextEditor } from './TextEditor.styles';
25
- import { TextEditorContext } from './TextEditorProvider';
26
- import { TextEditorTheme } from './textEditorTheming';
27
- import { useCKEditorCss } from './useCKEditorCss';
28
- import { useTabAsNavigation } from './useTabAsNavigation';
29
- import { addButtonDataAttributes, addPluginsFromStringArray, getDefaultConfig } from './utils';
26
+ import { defaultPlugins, generateExternalPlugins, generateLanguageUrl, getValidLookupLocale, tinyMCEConfig, tinyMCESource, tinyMCETabMarkup, tinyMCEVersion } from '../_utils/TinyMCE';
27
+ import { GlobalStyle } from './TextEditor.styles';
28
+ var errorRed = '#E61920';
29
+ function noop() {}
30
+ var TextEditorContext = /*#__PURE__*/React.createContext({
31
+ features: {
32
+ tabAsNavigation: undefined,
33
+ stickyToolbar: undefined
34
+ }
35
+ });
36
+ export function TextEditorProvider(_ref) {
37
+ var children = _ref.children,
38
+ features = _ref.features;
39
+ return /*#__PURE__*/React.createElement(TextEditorContext.Provider, {
40
+ value: {
41
+ features: features
42
+ }
43
+ }, children);
44
+ }
45
+ function setupDefaultShortcuts(editor) {
46
+ editor.shortcuts.add('meta+shift+s', 'Strikethrough', 'Strikethrough');
47
+ }
30
48
 
31
49
  /**
32
- * To ensure your Jest tests work with the new CKEditor implementation, wrap your Jest configuration with `coreReactJestConfig`:
33
- *
34
- * @example
35
- *
36
- * // Using Jest config file
37
- *
38
- * const { coreReactJestConfig } = require('@procore/core-react/jestConfig')
39
- *
40
- * module.exports = coreReactJestConfig({
41
- * // Your existing Jest config
42
- * })
43
- *
44
- * @example
45
- *
46
- * // Using Hammer
47
- *
48
- * import { coreReactJestConfig } from '@procore/core-react/jestConfig'
49
- *
50
- * export default {
51
- * testJest: (defaultConfig) =>
52
- * coreReactJestConfig({
53
- * ...defaultConfig,
54
- * // Your existing Jest config
55
- * }),
56
- * }
57
- *
58
- * @example
59
- *
60
- * // Using Core Scripts
61
- *
62
- * const { coreReactJestConfig } = require('@procore/core-react/jestConfig')
63
- *
64
- * module.exports = () => ({
65
- * jestOverride: (defaultConfig) =>
66
- * coreReactJestConfig({
67
- * ...defaultConfig,
68
- * // Your existing Jest config
69
- * }),
70
- * })
50
+ * editor.addShortcut does not notify on Tab key presses
71
51
  */
72
- export function TextEditor(_ref) {
73
- var disabled = _ref.disabled,
74
- error = _ref.error,
75
- value = _ref.value,
76
- initialValue = _ref.initialValue,
77
- onChange = _ref.onChange,
78
- onInit = _ref.onInit,
79
- onBlur = _ref.onBlur,
80
- externalConfig = _ref.config,
81
- stringPlugins = _ref.plugins,
82
- propLocale = _ref.locale,
83
- onDirty = _ref.onDirty,
84
- _tinyMCE = _ref.tinyMCE,
85
- _init = _ref.init,
86
- _onKeyDown = _ref.onKeyDown,
87
- _onEditorChange = _ref.onEditorChange,
88
- _onFocusOut = _ref.onFocusOut,
89
- restProps = _objectWithoutProperties(_ref, _excluded);
90
- var _useCKEditorCss = useCKEditorCss(),
91
- cssLoading = _useCKEditorCss.isLoading;
92
- var editorRef = React.useRef(null);
93
- var editorInstanceRef = React.useRef(null);
94
- var initialValueRef = React.useRef(value || initialValue || '');
95
- var _React$useState = React.useState(false),
96
- _React$useState2 = _slicedToArray(_React$useState, 2),
97
- isDirtyState = _React$useState2[0],
98
- setIsDirtyState = _React$useState2[1];
99
- var _useI18nContext = useI18nContext(),
100
- contextLocale = _useI18nContext.locale;
101
- var locale = propLocale || contextLocale;
52
+ function setupShortcuts(editor) {
53
+ setupDefaultShortcuts(editor);
54
+ editor.on('keydown', function checkTabPress(event) {
55
+ if (event.altKey && event.key === 'Tab') {
56
+ editor.execCommand('mceInsertContent', false, tinyMCETabMarkup);
57
+ event.preventDefault();
58
+ event.stopPropagation();
59
+ return false;
60
+ }
61
+ });
62
+ }
63
+
64
+ /**
65
+ * The following plugins open a TinyMCE modal.
66
+ * When used with React Aria contained FocusScope,
67
+ * focus does not move into the TinyMCE modal.
68
+ * This patch gets critical functionality back at
69
+ * the cost of possibly failing accessbility.
70
+ */
71
+ function useFocusScopePatch(plugins) {
72
+ var focusScope = useOverridableFocusScope();
102
73
  React.useEffect(function () {
103
- if (value !== undefined) {
104
- initialValueRef.current = value;
74
+ if ([].concat(_toConsumableArray(defaultPlugins), _toConsumableArray(plugins)).some(
75
+ // Add plugins that open a tinymce modal here
76
+ function (plugin) {
77
+ return plugin === 'link' || plugin === 'table' || plugin === 'image';
78
+ })) {
79
+ focusScope.setProps({
80
+ contain: false
81
+ });
105
82
  }
106
- }, [value]);
83
+ }, [focusScope, plugins]);
84
+ }
85
+
86
+ /**
87
+
88
+ We use text editors to allow users to enter multiple lines of formatted text.
89
+
90
+ If users need to add unformatted text, see Text Area.
91
+
92
+ @since 10.19.0
93
+
94
+ @see [Storybook](https://stories.core.procore.com/?path=/story/core-react_demos-texteditor--demo)
95
+
96
+ @see [Design Guidelines](https://design.procore.com/text-editor)
97
+
98
+ */
99
+ export function TextEditor(_ref2) {
100
+ var _props$initialValue, _props$value;
101
+ var error = _ref2.error,
102
+ initOverrides = _ref2.init,
103
+ locale = _ref2.locale,
104
+ _ref2$onChange = _ref2.onChange,
105
+ onChange = _ref2$onChange === void 0 ? noop : _ref2$onChange,
106
+ _onInit = _ref2.onInit,
107
+ _ref2$plugins = _ref2.plugins,
108
+ plugins = _ref2$plugins === void 0 ? defaultPlugins : _ref2$plugins,
109
+ props = _objectWithoutProperties(_ref2, _excluded);
110
+ var _useI18nContext = useI18nContext(),
111
+ contextLocale = _useI18nContext.locale;
107
112
  var _useZIndexContext = useZIndexContext(),
108
113
  zIndex = _useZIndexContext.value;
109
114
  var _React$useContext = React.useContext(TextEditorContext),
110
115
  features = _React$useContext.features;
111
- var enableStickyToolbar = !!(features !== null && features !== void 0 && features.stickyToolbar);
112
- var enableTabAsNavigation = !!(features !== null && features !== void 0 && features.tabAsNavigation);
113
- var mergedConfig = React.useMemo(function () {
114
- var defaultConfig = getDefaultConfig(locale);
115
-
116
- // Handle string plugins for backward compatibility
117
- var configWithPlugins = stringPlugins !== null && stringPlugins !== void 0 && stringPlugins.length ? addPluginsFromStringArray(defaultConfig, stringPlugins) : defaultConfig;
118
-
119
- // Apply any external CKEditor config overrides provided by the consumer
120
- var externalResult = typeof externalConfig === 'function' ? externalConfig(configWithPlugins) : undefined;
121
- // Merge default config (with plugins) and consumer overrides
122
- var finalConfig = _objectSpread(_objectSpread({}, configWithPlugins), externalResult !== null && externalResult !== void 0 ? externalResult : {});
123
- return finalConfig;
124
- }, [externalConfig, locale, stringPlugins]);
125
- var focusScope = useOverridableFocusScope();
126
- React.useEffect(function () {
127
- focusScope.setProps({
128
- contain: false
129
- });
130
- }, [focusScope]);
131
- var handleChange = function handleChange(_event, editor) {
132
- var data = editor.getData();
133
- var isDirty = data !== initialValueRef.current;
134
-
135
- // Call onDirty only on first content modification
136
- if (isDirty && !isDirtyState) {
137
- setIsDirtyState(true);
138
- onDirty === null || onDirty === void 0 ? void 0 : onDirty();
139
- }
140
- onChange === null || onChange === void 0 ? void 0 : onChange(data, isDirty);
116
+ var stickyToolbar = features !== null && features !== void 0 && features.stickyToolbar ? {
117
+ toolbar_sticky: true
118
+ } : {};
119
+ var tabControls = features !== null && features !== void 0 && features.tabAsNavigation ? {
120
+ external_plugins: generateExternalPlugins(plugins, defaultPlugins.filter(function (p) {
121
+ return p !== 'nonbreaking';
122
+ })),
123
+ nonbreaking_force_tab: false,
124
+ setup: setupShortcuts
125
+ } : {
126
+ setup: setupDefaultShortcuts
141
127
  };
142
- var handleReady = function handleReady(editor) {
143
- addButtonDataAttributes(editor);
144
- editorInstanceRef.current = editor;
145
- if (initialValue) {
146
- editor.setData(initialValue);
128
+ var onEditorChange = function onEditorChange(_, editor) {
129
+ onChange(editor.getContent(), editor.isDirty());
130
+ };
131
+ var ref = React.useRef();
132
+ var updateError = function updateError() {
133
+ if (ref.current) {
134
+ if (error) {
135
+ ref.current.style.borderColor = errorRed;
136
+ } else {
137
+ ref.current.style.borderColor = '';
138
+ }
147
139
  }
148
- onInit === null || onInit === void 0 ? void 0 : onInit(editor);
149
140
  };
150
- var handleBlur = function handleBlur(event, editor) {
151
- onBlur === null || onBlur === void 0 ? void 0 : onBlur(event, editor);
141
+ React.useEffect(function () {
142
+ updateError();
143
+ }, [error]);
144
+ useFocusScopePatch(plugins);
145
+ var onInit = function onInit(event, editor) {
146
+ ref.current = editor.editorContainer;
147
+ updateError();
148
+ _onInit && _onInit(event, editor);
152
149
  };
153
- var _useStickyToolbar = useStickyToolbar({
154
- config: mergedConfig,
155
- enabled: enableStickyToolbar,
156
- editor: editorInstanceRef.current,
157
- editorRef: editorRef,
158
- cssLoading: cssLoading
159
- }),
160
- stickyConfig = _useStickyToolbar.config;
161
- var _useTabAsNavigation = useTabAsNavigation({
162
- config: stickyConfig,
163
- enabled: enableTabAsNavigation,
164
- editor: editorInstanceRef.current
165
- }),
166
- config = _useTabAsNavigation.config;
167
- var editorKey = "".concat(locale, "-").concat(enableTabAsNavigation);
168
- if (cssLoading) {
169
- return null;
170
- }
171
- return /*#__PURE__*/React.createElement(StyledTextEditor, {
172
- ref: editorRef,
173
- key: editorKey,
174
- error: error
175
- }, /*#__PURE__*/React.createElement(GlobalEditorStyles, {
176
- zIndex: zIndex + 1
177
- }), /*#__PURE__*/React.createElement(TextEditorTheme, null), /*#__PURE__*/React.createElement(CKEditor, _extends({}, restProps, {
178
- editor: ClassicEditor,
179
- config: config,
180
- disabled: disabled,
181
- data: value,
182
- onChange: handleChange,
183
- onReady: handleReady,
184
- onBlur: handleBlur
150
+ var _useState = useState((_props$initialValue = props.initialValue) !== null && _props$initialValue !== void 0 ? _props$initialValue : props.value),
151
+ _useState2 = _slicedToArray(_useState, 1),
152
+ derivedInitial = _useState2[0];
153
+
154
+ // zIndex + 1 because on first render zIndex of Portal(Modal) is higher
155
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(GlobalStyle, {
156
+ $zIndex: zIndex + 1
157
+ }), /*#__PURE__*/React.createElement(Editor, _extends({
158
+ init: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, tinyMCEConfig), {}, {
159
+ external_plugins: generateExternalPlugins(plugins),
160
+ language_url: generateLanguageUrl(locale || contextLocale),
161
+ language: getValidLookupLocale(locale || contextLocale),
162
+ content_style: "p { margin: 0; }"
163
+ }, stickyToolbar), tabControls), initOverrides),
164
+ tinymceScriptSrc: "".concat(tinyMCESource, "/").concat(tinyMCEVersion, "/tinymce.min.js"),
165
+ onInit: onInit,
166
+ onEditorChange: onEditorChange
167
+ }, props, {
168
+ value: (_props$value = props.value) !== null && _props$value !== void 0 ? _props$value : props.initialValue,
169
+ initialValue: derivedInitial
185
170
  })));
186
171
  }
172
+ TextEditor.displayName = 'TextEditor';
187
173
  //# sourceMappingURL=TextEditor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextEditor.js","names":["CKEditor","ClassicEditor","React","useOverridableFocusScope","useI18nContext","useZIndexContext","useStickyToolbar","GlobalEditorStyles","StyledTextEditor","TextEditorContext","TextEditorTheme","useCKEditorCss","useTabAsNavigation","addButtonDataAttributes","addPluginsFromStringArray","getDefaultConfig","TextEditor","_ref","disabled","error","value","initialValue","onChange","onInit","onBlur","externalConfig","config","stringPlugins","plugins","propLocale","locale","onDirty","_tinyMCE","tinyMCE","_init","init","_onKeyDown","onKeyDown","_onEditorChange","onEditorChange","_onFocusOut","onFocusOut","restProps","_objectWithoutProperties","_excluded","_useCKEditorCss","cssLoading","isLoading","editorRef","useRef","editorInstanceRef","initialValueRef","_React$useState","useState","_React$useState2","_slicedToArray","isDirtyState","setIsDirtyState","_useI18nContext","contextLocale","useEffect","undefined","current","_useZIndexContext","zIndex","_React$useContext","useContext","features","enableStickyToolbar","stickyToolbar","enableTabAsNavigation","tabAsNavigation","mergedConfig","useMemo","defaultConfig","configWithPlugins","length","externalResult","finalConfig","_objectSpread","focusScope","setProps","contain","handleChange","_event","editor","data","getData","isDirty","handleReady","setData","handleBlur","event","_useStickyToolbar","enabled","stickyConfig","_useTabAsNavigation","editorKey","concat","createElement","ref","key","_extends","onReady"],"sources":["../../src/TextEditor/TextEditor.tsx"],"sourcesContent":["import { CKEditor } from '@ckeditor/ckeditor5-react'\nimport type { EditorConfig } from 'ckeditor5'\nimport { ClassicEditor, type EventInfo } from 'ckeditor5'\nimport React from 'react'\n\nimport { useOverridableFocusScope } from '../_hooks/FocusScopeOverride'\nimport { useI18nContext } from '../_hooks/I18n'\nimport { useZIndexContext } from '../_hooks/ZIndex'\nimport { useStickyToolbar } from './StickyToolbar'\nimport { GlobalEditorStyles, StyledTextEditor } from './TextEditor.styles'\nimport type { TextEditorProps } from './TextEditor.types'\nimport { TextEditorContext } from './TextEditorProvider'\nimport { TextEditorTheme } from './textEditorTheming'\nimport { useCKEditorCss } from './useCKEditorCss'\nimport { useTabAsNavigation } from './useTabAsNavigation'\nimport {\n addButtonDataAttributes,\n addPluginsFromStringArray,\n getDefaultConfig,\n} from './utils'\n\n/**\n * To ensure your Jest tests work with the new CKEditor implementation, wrap your Jest configuration with `coreReactJestConfig`:\n *\n * @example\n *\n * // Using Jest config file\n *\n * const { coreReactJestConfig } = require('@procore/core-react/jestConfig')\n *\n * module.exports = coreReactJestConfig({\n * // Your existing Jest config\n * })\n *\n * @example\n *\n * // Using Hammer\n *\n * import { coreReactJestConfig } from '@procore/core-react/jestConfig'\n *\n * export default {\n * testJest: (defaultConfig) =>\n * coreReactJestConfig({\n * ...defaultConfig,\n * // Your existing Jest config\n * }),\n * }\n *\n * @example\n *\n * // Using Core Scripts\n *\n * const { coreReactJestConfig } = require('@procore/core-react/jestConfig')\n *\n * module.exports = () => ({\n * jestOverride: (defaultConfig) =>\n * coreReactJestConfig({\n * ...defaultConfig,\n * // Your existing Jest config\n * }),\n * })\n */\nexport function TextEditor({\n disabled,\n error,\n value,\n initialValue,\n onChange,\n onInit,\n onBlur,\n config: externalConfig,\n plugins: stringPlugins,\n locale: propLocale,\n onDirty,\n // Deprecated TinyMCE props - no-op for backward compatibility\n tinyMCE: _tinyMCE,\n init: _init,\n onKeyDown: _onKeyDown,\n onEditorChange: _onEditorChange,\n onFocusOut: _onFocusOut,\n ...restProps\n}: TextEditorProps) {\n const { isLoading: cssLoading } = useCKEditorCss()\n\n const editorRef = React.useRef<HTMLDivElement>(null)\n const editorInstanceRef = React.useRef<ClassicEditor | null>(null)\n const initialValueRef = React.useRef<string>(value || initialValue || '')\n const [isDirtyState, setIsDirtyState] = React.useState(false)\n const { locale: contextLocale } = useI18nContext()\n const locale = propLocale || contextLocale\n\n React.useEffect(() => {\n if (value !== undefined) {\n initialValueRef.current = value\n }\n }, [value])\n\n const { value: zIndex } = useZIndexContext()\n\n const { features } = React.useContext(TextEditorContext)\n const enableStickyToolbar = !!features?.stickyToolbar\n const enableTabAsNavigation = !!features?.tabAsNavigation\n\n const mergedConfig = React.useMemo(() => {\n const defaultConfig = getDefaultConfig(locale)\n\n // Handle string plugins for backward compatibility\n const configWithPlugins = stringPlugins?.length\n ? addPluginsFromStringArray(defaultConfig, stringPlugins)\n : defaultConfig\n\n // Apply any external CKEditor config overrides provided by the consumer\n const externalResult =\n typeof externalConfig === 'function'\n ? externalConfig(configWithPlugins)\n : undefined\n // Merge default config (with plugins) and consumer overrides\n let finalConfig: EditorConfig = {\n ...configWithPlugins,\n ...(externalResult ?? {}),\n }\n\n return finalConfig\n }, [externalConfig, locale, stringPlugins])\n\n const focusScope = useOverridableFocusScope()\n React.useEffect(() => {\n focusScope.setProps({ contain: false })\n }, [focusScope])\n\n const handleChange = (\n _event: EventInfo<string, unknown>,\n editor: ClassicEditor\n ) => {\n const data = editor.getData()\n const isDirty = data !== initialValueRef.current\n\n // Call onDirty only on first content modification\n if (isDirty && !isDirtyState) {\n setIsDirtyState(true)\n onDirty?.()\n }\n\n onChange?.(data, isDirty)\n }\n\n const handleReady = (editor: ClassicEditor) => {\n addButtonDataAttributes(editor)\n editorInstanceRef.current = editor\n\n if (initialValue) {\n editor.setData(initialValue)\n }\n\n onInit?.(editor)\n }\n\n const handleBlur = (\n event: EventInfo<string, unknown>,\n editor: ClassicEditor\n ) => {\n onBlur?.(event, editor)\n }\n\n const { config: stickyConfig } = useStickyToolbar({\n config: mergedConfig,\n enabled: enableStickyToolbar,\n editor: editorInstanceRef.current,\n editorRef,\n cssLoading,\n })\n\n const { config } = useTabAsNavigation({\n config: stickyConfig,\n enabled: enableTabAsNavigation,\n editor: editorInstanceRef.current,\n })\n\n const editorKey = `${locale}-${enableTabAsNavigation}`\n\n if (cssLoading) {\n return null\n }\n\n return (\n <StyledTextEditor ref={editorRef} key={editorKey} error={error}>\n <GlobalEditorStyles zIndex={zIndex + 1} />\n <TextEditorTheme />\n <CKEditor\n {...restProps}\n editor={ClassicEditor}\n config={config}\n disabled={disabled}\n data={value}\n onChange={handleChange}\n onReady={handleReady}\n onBlur={handleBlur}\n />\n </StyledTextEditor>\n )\n}\n"],"mappings":";;;;;;;;;;;;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,gBAAgB;IAAC4F,GAAG,EAAEpD,SAAU;IAACqD,GAAG,EAAEJ,SAAU;IAAC9E,KAAK,EAAEA;EAAM,gBAC7DjB,KAAA,CAAAiG,aAAA,CAAC5F,kBAAkB;IAACyD,MAAM,EAAEA,MAAM,GAAG;EAAE,CAAE,CAAC,eAC1C9D,KAAA,CAAAiG,aAAA,CAACzF,eAAe,MAAE,CAAC,eACnBR,KAAA,CAAAiG,aAAA,CAACnG,QAAQ,EAAAsG,QAAA,KACH5D,SAAS;IACb2C,MAAM,EAAEpF,aAAc;IACtByB,MAAM,EAAEA,MAAO;IACfR,QAAQ,EAAEA,QAAS;IACnBoE,IAAI,EAAElE,KAAM;IACZE,QAAQ,EAAE6D,YAAa;IACvBoB,OAAO,EAAEd,WAAY;IACrBjE,MAAM,EAAEmE;EAAW,EACpB,CACe,CAAC;AAEvB"}
1
+ {"version":3,"file":"TextEditor.js","names":["Editor","React","useState","useOverridableFocusScope","useI18nContext","useZIndexContext","defaultPlugins","generateExternalPlugins","generateLanguageUrl","getValidLookupLocale","tinyMCEConfig","tinyMCESource","tinyMCETabMarkup","tinyMCEVersion","GlobalStyle","errorRed","noop","TextEditorContext","createContext","features","tabAsNavigation","undefined","stickyToolbar","TextEditorProvider","_ref","children","createElement","Provider","value","setupDefaultShortcuts","editor","shortcuts","add","setupShortcuts","on","checkTabPress","event","altKey","key","execCommand","preventDefault","stopPropagation","useFocusScopePatch","plugins","focusScope","useEffect","concat","_toConsumableArray","some","plugin","setProps","contain","TextEditor","_ref2","_props$initialValue","_props$value","error","initOverrides","init","locale","_ref2$onChange","onChange","_onInit","onInit","_ref2$plugins","props","_objectWithoutProperties","_excluded","_useI18nContext","contextLocale","_useZIndexContext","zIndex","_React$useContext","useContext","toolbar_sticky","tabControls","external_plugins","filter","p","nonbreaking_force_tab","setup","onEditorChange","_","getContent","isDirty","ref","useRef","updateError","current","style","borderColor","editorContainer","_useState","initialValue","_useState2","_slicedToArray","derivedInitial","Fragment","$zIndex","_extends","_objectSpread","language_url","language","content_style","tinymceScriptSrc","displayName"],"sources":["../../src/TextEditor/TextEditor.tsx"],"sourcesContent":["import { Editor } from '@tinymce/tinymce-react'\nimport React, { useState } from 'react'\nimport { useOverridableFocusScope } from '../_hooks/FocusScopeOverride'\nimport { useI18nContext } from '../_hooks/I18n'\nimport { useZIndexContext } from '../_hooks/ZIndex'\nimport {\n defaultPlugins,\n generateExternalPlugins,\n generateLanguageUrl,\n getValidLookupLocale,\n tinyMCEConfig,\n tinyMCESource,\n tinyMCETabMarkup,\n tinyMCEVersion,\n} from '../_utils/TinyMCE'\nimport { GlobalStyle } from './TextEditor.styles'\nimport type {\n TextEditorProps,\n TextEditorProviderProps,\n} from './TextEditor.types'\n\nconst errorRed = '#E61920'\n\nfunction noop() {}\n\nconst TextEditorContext = React.createContext<\n Omit<TextEditorProviderProps, 'children'>\n>({\n features: {\n tabAsNavigation: undefined,\n stickyToolbar: undefined,\n },\n})\n\nexport function TextEditorProvider({\n children,\n features,\n}: TextEditorProviderProps) {\n return (\n <TextEditorContext.Provider value={{ features }}>\n {children}\n </TextEditorContext.Provider>\n )\n}\n\nfunction setupDefaultShortcuts(editor: any) {\n editor.shortcuts.add('meta+shift+s', 'Strikethrough', 'Strikethrough')\n}\n\n/**\n * editor.addShortcut does not notify on Tab key presses\n */\nfunction setupShortcuts(editor: any) {\n setupDefaultShortcuts(editor)\n editor.on('keydown', function checkTabPress(event: React.KeyboardEvent) {\n if (event.altKey && event.key === 'Tab') {\n editor.execCommand('mceInsertContent', false, tinyMCETabMarkup)\n event.preventDefault()\n event.stopPropagation()\n return false\n }\n })\n}\n\n/**\n * The following plugins open a TinyMCE modal.\n * When used with React Aria contained FocusScope,\n * focus does not move into the TinyMCE modal.\n * This patch gets critical functionality back at\n * the cost of possibly failing accessbility.\n */\nfunction useFocusScopePatch(plugins: string[]) {\n const focusScope = useOverridableFocusScope()\n React.useEffect(() => {\n if (\n [...defaultPlugins, ...plugins].some(\n // Add plugins that open a tinymce modal here\n (plugin) =>\n plugin === 'link' || plugin === 'table' || plugin === 'image'\n )\n ) {\n focusScope.setProps({ contain: false })\n }\n }, [focusScope, plugins])\n}\n\n/**\n\n We use text editors to allow users to enter multiple lines of formatted text.\n\n If users need to add unformatted text, see Text Area.\n\n @since 10.19.0\n\n @see [Storybook](https://stories.core.procore.com/?path=/story/core-react_demos-texteditor--demo)\n\n @see [Design Guidelines](https://design.procore.com/text-editor)\n\n */\nexport function TextEditor({\n error,\n init: initOverrides,\n locale,\n onChange = noop,\n onInit: _onInit,\n plugins = defaultPlugins,\n ...props\n}: TextEditorProps) {\n const { locale: contextLocale } = useI18nContext()\n const { value: zIndex } = useZIndexContext()\n\n const { features } = React.useContext(TextEditorContext)\n const stickyToolbar = features?.stickyToolbar ? { toolbar_sticky: true } : {}\n const tabControls = features?.tabAsNavigation\n ? {\n external_plugins: generateExternalPlugins(\n plugins,\n defaultPlugins.filter((p) => p !== 'nonbreaking')\n ),\n nonbreaking_force_tab: false,\n setup: setupShortcuts,\n }\n : {\n setup: setupDefaultShortcuts,\n }\n\n const onEditorChange: React.ComponentProps<\n typeof Editor\n >['onEditorChange'] = (_: any, editor: any) => {\n onChange(editor.getContent(), editor.isDirty())\n }\n\n const ref = React.useRef<HTMLElement>()\n\n const updateError = () => {\n if (ref.current) {\n if (error) {\n ref.current.style.borderColor = errorRed\n } else {\n ref.current.style.borderColor = ''\n }\n }\n }\n\n React.useEffect(() => {\n updateError()\n }, [error])\n\n useFocusScopePatch(plugins)\n\n const onInit: React.ComponentProps<typeof Editor>['onInit'] = (\n event,\n editor\n ) => {\n ref.current = editor.editorContainer\n updateError()\n _onInit && _onInit(event, editor)\n }\n\n const [derivedInitial] = useState(props.initialValue ?? props.value)\n\n // zIndex + 1 because on first render zIndex of Portal(Modal) is higher\n return (\n <>\n <GlobalStyle $zIndex={zIndex + 1} />\n <Editor\n init={{\n ...tinyMCEConfig,\n external_plugins: generateExternalPlugins(plugins),\n language_url: generateLanguageUrl(locale || contextLocale),\n language: getValidLookupLocale(locale || contextLocale),\n content_style: `p { margin: 0; }`,\n ...stickyToolbar,\n ...tabControls,\n ...initOverrides,\n }}\n tinymceScriptSrc={`${tinyMCESource}/${tinyMCEVersion}/tinymce.min.js`}\n onInit={onInit}\n onEditorChange={onEditorChange}\n {...props}\n value={props.value ?? props.initialValue}\n initialValue={derivedInitial}\n />\n </>\n )\n}\n\nTextEditor.displayName = 'TextEditor'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,SAASA,MAAM,QAAQ,wBAAwB;AAC/C,OAAOC,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,wBAAwB,QAAQ,8BAA8B;AACvE,SAASC,cAAc,QAAQ,gBAAgB;AAC/C,SAASC,gBAAgB,QAAQ,kBAAkB;AACnD,SACEC,cAAc,EACdC,uBAAuB,EACvBC,mBAAmB,EACnBC,oBAAoB,EACpBC,aAAa,EACbC,aAAa,EACbC,gBAAgB,EAChBC,cAAc,QACT,mBAAmB;AAC1B,SAASC,WAAW,QAAQ,qBAAqB;AAMjD,IAAMC,QAAQ,GAAG,SAAS;AAE1B,SAASC,IAAIA,CAAA,EAAG,CAAC;AAEjB,IAAMC,iBAAiB,gBAAGhB,KAAK,CAACiB,aAAa,CAE3C;EACAC,QAAQ,EAAE;IACRC,eAAe,EAAEC,SAAS;IAC1BC,aAAa,EAAED;EACjB;AACF,CAAC,CAAC;AAEF,OAAO,SAASE,kBAAkBA,CAAAC,IAAA,EAGN;EAAA,IAF1BC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRN,QAAQ,GAAAK,IAAA,CAARL,QAAQ;EAER,oBACElB,KAAA,CAAAyB,aAAA,CAACT,iBAAiB,CAACU,QAAQ;IAACC,KAAK,EAAE;MAAET,QAAQ,EAARA;IAAS;EAAE,GAC7CM,QACyB,CAAC;AAEjC;AAEA,SAASI,qBAAqBA,CAACC,MAAW,EAAE;EAC1CA,MAAM,CAACC,SAAS,CAACC,GAAG,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AA,aAAA,KACC1F,aAAa;MAChBkE,gBAAgB,EAAErE,uBAAuB,CAACoC,OAAO,CAAC;MAClD0D,YAAY,EAAE7F,mBAAmB,CAACmD,MAAM,IAAIU,aAAa,CAAC;MAC1DiC,QAAQ,EAAE7F,oBAAoB,CAACkD,MAAM,IAAIU,aAAa,CAAC;MACvDkC,aAAa;IAAoB,GAC9BjF,aAAa,GACbqD,WAAW,GACXlB,aAAa,CAChB;IACF+C,gBAAgB,KAAA1D,MAAA,CAAKnC,aAAa,OAAAmC,MAAA,CAAIjC,cAAc,oBAAkB;IACtEkD,MAAM,EAAEA,MAAO;IACfkB,cAAc,EAAEA;EAAe,GAC3BhB,KAAK;IACTrC,KAAK,GAAA2B,YAAA,GAAEU,KAAK,CAACrC,KAAK,cAAA2B,YAAA,cAAAA,YAAA,GAAIU,KAAK,CAAC4B,YAAa;IACzCA,YAAY,EAAEG;EAAe,EAC9B,CACD,CAAC;AAEP;AAEA5C,UAAU,CAACqD,WAAW,GAAG,YAAY"}
@@ -1,7 +1,4 @@
1
1
  /// <reference types="react" />
2
- export declare const GlobalEditorStyles: import("react").NamedExoticComponent<import("styled-components").ExecutionProps & {
3
- zIndex: number;
2
+ export declare const GlobalStyle: import("react").NamedExoticComponent<import("styled-components").ExecutionProps & {
3
+ $zIndex: number;
4
4
  }>;
5
- export declare const StyledTextEditor: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
6
- error?: boolean | undefined;
7
- }>> & string;