@dnncommunity/dnn-elements 0.14.1 → 0.15.0-beta.3

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 (422) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +24 -24
  3. package/dist/.storybook/utilities.js +16 -0
  4. package/dist/.storybook/utilities.js.map +1 -0
  5. package/dist/cjs/{css-shim-3bfdba4f.js → css-shim-aaf4fec9.js} +3 -3
  6. package/dist/cjs/css-shim-aaf4fec9.js.map +1 -0
  7. package/dist/cjs/{debounce-1de79bc7.js → debounce-901e1f0c.js} +18 -18
  8. package/dist/cjs/{debounce-1de79bc7.js.map → debounce-901e1f0c.js.map} +1 -1
  9. package/dist/cjs/dnn-button.cjs.entry.js +80 -76
  10. package/dist/cjs/dnn-button.cjs.entry.js.map +1 -1
  11. package/dist/cjs/{dnn-button_16.cjs.entry.js → dnn-button_17.cjs.entry.js} +2024 -1710
  12. package/dist/cjs/dnn-button_17.cjs.entry.js.map +1 -0
  13. package/dist/cjs/dnn-checkbox.cjs.entry.js +47 -47
  14. package/dist/cjs/dnn-checkbox.cjs.entry.js.map +1 -1
  15. package/dist/cjs/dnn-chevron.cjs.entry.js +22 -22
  16. package/dist/cjs/dnn-chevron.cjs.entry.js.map +1 -1
  17. package/dist/cjs/dnn-collapsible.cjs.entry.js +57 -54
  18. package/dist/cjs/dnn-collapsible.cjs.entry.js.map +1 -1
  19. package/dist/cjs/dnn-color-picker.cjs.entry.js +494 -494
  20. package/dist/cjs/dnn-color-picker.cjs.entry.js.map +1 -1
  21. package/dist/cjs/dnn-dropzone.cjs.entry.js +141 -141
  22. package/dist/cjs/dnn-dropzone.cjs.entry.js.map +1 -1
  23. package/dist/cjs/dnn-image-cropper.cjs.entry.js +394 -394
  24. package/dist/cjs/dnn-image-cropper.cjs.entry.js.map +1 -1
  25. package/dist/cjs/dnn-modal.cjs.entry.js +53 -50
  26. package/dist/cjs/dnn-modal.cjs.entry.js.map +1 -1
  27. package/dist/cjs/dnn-permissions-grid.cjs.entry.js +320 -0
  28. package/dist/cjs/dnn-permissions-grid.cjs.entry.js.map +1 -0
  29. package/dist/cjs/dnn-searchbox.cjs.entry.js +54 -54
  30. package/dist/cjs/dnn-searchbox.cjs.entry.js.map +1 -1
  31. package/dist/cjs/dnn-sort-icon.cjs.entry.js +32 -32
  32. package/dist/cjs/dnn-sort-icon.cjs.entry.js.map +1 -1
  33. package/dist/cjs/dnn-tab.cjs.entry.js +19 -19
  34. package/dist/cjs/dnn-tab.cjs.entry.js.map +1 -1
  35. package/dist/cjs/dnn-tabs.cjs.entry.js +40 -40
  36. package/dist/cjs/dnn-tabs.cjs.entry.js.map +1 -1
  37. package/dist/cjs/dnn-toggle.cjs.entry.js +26 -26
  38. package/dist/cjs/dnn-toggle.cjs.entry.js.map +1 -1
  39. package/dist/cjs/dnn-treeview-item.cjs.entry.js +56 -56
  40. package/dist/cjs/dnn-treeview-item.cjs.entry.js.map +1 -1
  41. package/dist/cjs/dnn-vertical-overflow-menu.cjs.entry.js +113 -111
  42. package/dist/cjs/dnn-vertical-overflow-menu.cjs.entry.js.map +1 -1
  43. package/dist/cjs/dnn-vertical-splitview.cjs.entry.js +121 -121
  44. package/dist/cjs/dnn-vertical-splitview.cjs.entry.js.map +1 -1
  45. package/dist/cjs/dnn.cjs.js +8 -4
  46. package/dist/cjs/dnn.cjs.js.map +1 -1
  47. package/dist/cjs/{dom-8ac1ad03.js → dom-14886762.js} +2 -2
  48. package/dist/cjs/{dom-8ac1ad03.js.map → dom-14886762.js.map} +1 -1
  49. package/dist/cjs/{index-7505bd72.js → index-514ef6dd.js} +32 -2
  50. package/dist/cjs/index-514ef6dd.js.map +1 -0
  51. package/dist/cjs/{index-aff4d89a.js → index-d53702a3.js} +30 -4
  52. package/dist/cjs/index-d53702a3.js.map +1 -0
  53. package/dist/cjs/index.cjs.js +41 -41
  54. package/dist/cjs/loader.cjs.js +4 -4
  55. package/dist/cjs/loader.cjs.js.map +1 -1
  56. package/dist/cjs/{mouseUtilities-75be531a.js → mouseUtilities-ecd5ecf7.js} +19 -19
  57. package/dist/cjs/{mouseUtilities-75be531a.js.map → mouseUtilities-ecd5ecf7.js.map} +1 -1
  58. package/dist/cjs/{shadow-css-41d9783d.js → shadow-css-c44ea13a.js} +2 -2
  59. package/dist/cjs/{shadow-css-41d9783d.js.map → shadow-css-c44ea13a.js.map} +1 -1
  60. package/dist/collection/collection-manifest.json +3 -2
  61. package/dist/collection/components/dnn-button/dnn-button.js +275 -271
  62. package/dist/collection/components/dnn-button/dnn-button.js.map +1 -1
  63. package/dist/collection/components/dnn-button/dnn-button.stories.js +72 -0
  64. package/dist/collection/components/dnn-button/dnn-button.stories.js.map +1 -0
  65. package/dist/collection/components/dnn-checkbox/dnn-checkbox.css +6 -0
  66. package/dist/collection/components/dnn-checkbox/dnn-checkbox.js +151 -139
  67. package/dist/collection/components/dnn-checkbox/dnn-checkbox.js.map +1 -1
  68. package/dist/collection/components/dnn-checkbox/dnn-checkbox.stories.js +39 -0
  69. package/dist/collection/components/dnn-checkbox/dnn-checkbox.stories.js.map +1 -0
  70. package/dist/collection/components/dnn-chevron/dnn-chevron.js +106 -106
  71. package/dist/collection/components/dnn-chevron/dnn-chevron.js.map +1 -1
  72. package/dist/collection/components/dnn-chevron/dnn-chevron.stories.js +38 -0
  73. package/dist/collection/components/dnn-chevron/dnn-chevron.stories.js.map +1 -0
  74. package/dist/collection/components/dnn-collapsible/dnn-collapsible.js +145 -142
  75. package/dist/collection/components/dnn-collapsible/dnn-collapsible.js.map +1 -1
  76. package/dist/collection/components/dnn-collapsible/dnn-collapsible.stories.js +39 -0
  77. package/dist/collection/components/dnn-collapsible/dnn-collapsible.stories.js.map +1 -0
  78. package/dist/collection/components/dnn-color-picker/dnn-color-picker.js +433 -433
  79. package/dist/collection/components/dnn-color-picker/dnn-color-picker.js.map +1 -1
  80. package/dist/collection/components/dnn-color-picker/dnn-color-picker.stories.js +33 -0
  81. package/dist/collection/components/dnn-color-picker/dnn-color-picker.stories.js.map +1 -0
  82. package/dist/collection/components/dnn-dropzone/dnn-dropzone.js +265 -265
  83. package/dist/collection/components/dnn-dropzone/dnn-dropzone.js.map +1 -1
  84. package/dist/collection/components/dnn-dropzone/dnn-dropzone.stories.js +48 -0
  85. package/dist/collection/components/dnn-dropzone/dnn-dropzone.stories.js.map +1 -0
  86. package/dist/collection/components/dnn-image-cropper/CornerType.js +8 -8
  87. package/dist/collection/components/dnn-image-cropper/CornerType.js.map +1 -1
  88. package/dist/collection/components/dnn-image-cropper/dnn-image-cropper.js +522 -522
  89. package/dist/collection/components/dnn-image-cropper/dnn-image-cropper.js.map +1 -1
  90. package/dist/collection/components/dnn-image-cropper/dnn-image-cropper.stories.js +60 -0
  91. package/dist/collection/components/dnn-image-cropper/dnn-image-cropper.stories.js.map +1 -0
  92. package/dist/collection/components/dnn-modal/dnn-modal.js +190 -172
  93. package/dist/collection/components/dnn-modal/dnn-modal.js.map +1 -1
  94. package/dist/collection/components/dnn-modal/dnn-modal.stories.js +47 -0
  95. package/dist/collection/components/dnn-modal/dnn-modal.stories.js.map +1 -0
  96. package/dist/collection/components/dnn-permissions-grid/dnn-permissions-grid.css +83 -0
  97. package/dist/collection/components/dnn-permissions-grid/dnn-permissions-grid.js +531 -0
  98. package/dist/collection/components/dnn-permissions-grid/dnn-permissions-grid.js.map +1 -0
  99. package/dist/collection/components/dnn-permissions-grid/dnn-permissions-grid.stories.js +273 -0
  100. package/dist/collection/components/dnn-permissions-grid/dnn-permissions-grid.stories.js.map +1 -0
  101. package/dist/collection/components/dnn-permissions-grid/localization-interface.js +3 -0
  102. package/dist/collection/components/dnn-permissions-grid/localization-interface.js.map +1 -0
  103. package/dist/collection/components/dnn-permissions-grid/permissions-interface.js +3 -0
  104. package/dist/collection/components/dnn-permissions-grid/permissions-interface.js.map +1 -0
  105. package/dist/collection/components/dnn-permissions-grid/role-group-interface.js +2 -0
  106. package/dist/collection/components/dnn-permissions-grid/role-group-interface.js.map +1 -0
  107. package/dist/collection/components/dnn-permissions-grid/role-interface.js +2 -0
  108. package/dist/collection/components/dnn-permissions-grid/role-interface.js.map +1 -0
  109. package/dist/collection/components/dnn-permissions-grid/searched-user-interface.js +2 -0
  110. package/dist/collection/components/dnn-permissions-grid/searched-user-interface.js.map +1 -0
  111. package/dist/collection/components/dnn-searchbox/dnn-searchbox.js +136 -136
  112. package/dist/collection/components/dnn-searchbox/dnn-searchbox.js.map +1 -1
  113. package/dist/collection/components/dnn-searchbox/dnn-searchbox.stories.js +26 -0
  114. package/dist/collection/components/dnn-searchbox/dnn-searchbox.stories.js.map +1 -0
  115. package/dist/collection/components/dnn-sort-icon/dnn-sort-icon.css +6 -3
  116. package/dist/collection/components/dnn-sort-icon/dnn-sort-icon.js +80 -80
  117. package/dist/collection/components/dnn-sort-icon/dnn-sort-icon.js.map +1 -1
  118. package/dist/collection/components/dnn-sort-icon/dnn-sort-icon.stories.js +58 -0
  119. package/dist/collection/components/dnn-sort-icon/dnn-sort-icon.stories.js.map +1 -0
  120. package/dist/collection/components/dnn-tab/dnn-tab.js +83 -83
  121. package/dist/collection/components/dnn-tab/dnn-tab.js.map +1 -1
  122. package/dist/collection/components/dnn-tab/dnn-tab.stories.js +25 -0
  123. package/dist/collection/components/dnn-tab/dnn-tab.stories.js.map +1 -0
  124. package/dist/collection/components/dnn-tabs/dnn-tabs.js +54 -54
  125. package/dist/collection/components/dnn-tabs/dnn-tabs.js.map +1 -1
  126. package/dist/collection/components/dnn-tabs/dnn-tabs.stories.js +48 -0
  127. package/dist/collection/components/dnn-tabs/dnn-tabs.stories.js.map +1 -0
  128. package/dist/collection/components/dnn-toggle/dnn-toggle.css +1 -1
  129. package/dist/collection/components/dnn-toggle/dnn-toggle.js +93 -93
  130. package/dist/collection/components/dnn-toggle/dnn-toggle.js.map +1 -1
  131. package/dist/collection/components/dnn-toggle/dnn-toggle.stories.js +53 -0
  132. package/dist/collection/components/dnn-toggle/dnn-toggle.stories.js.map +1 -0
  133. package/dist/collection/components/dnn-toggle/toggle-interface.js +1 -1
  134. package/dist/collection/components/dnn-toggle/toggle-interface.js.map +1 -1
  135. package/dist/collection/components/dnn-treeview-item/dnn-treeview-item.js +130 -126
  136. package/dist/collection/components/dnn-treeview-item/dnn-treeview-item.js.map +1 -1
  137. package/dist/collection/components/dnn-treeview-item/dnn-treeview-item.stories.js +36 -0
  138. package/dist/collection/components/dnn-treeview-item/dnn-treeview-item.stories.js.map +1 -0
  139. package/dist/collection/components/dnn-vertical-overflow-menu/dnn-vertical-overflow-menu.css +6 -7
  140. package/dist/collection/components/dnn-vertical-overflow-menu/dnn-vertical-overflow-menu.js +133 -131
  141. package/dist/collection/components/dnn-vertical-overflow-menu/dnn-vertical-overflow-menu.js.map +1 -1
  142. package/dist/collection/components/dnn-vertical-overflow-menu/dnn-vertical-overflow-menu.stories.js +60 -0
  143. package/dist/collection/components/dnn-vertical-overflow-menu/dnn-vertical-overflow-menu.stories.js.map +1 -0
  144. package/dist/collection/components/dnn-vertical-splitview/dnn-vertical-splitview.css +4 -2
  145. package/dist/collection/components/dnn-vertical-splitview/dnn-vertical-splitview.js +233 -233
  146. package/dist/collection/components/dnn-vertical-splitview/dnn-vertical-splitview.js.map +1 -1
  147. package/dist/collection/components/dnn-vertical-splitview/dnn-vertical-splitview.stories.js +75 -0
  148. package/dist/collection/components/dnn-vertical-splitview/dnn-vertical-splitview.stories.js.map +1 -0
  149. package/dist/collection/index.js +2 -2
  150. package/dist/collection/index.js.map +1 -1
  151. package/dist/collection/utilities/colorInfo.js +190 -190
  152. package/dist/collection/utilities/colorInfo.js.map +1 -1
  153. package/dist/collection/utilities/debounce.js +18 -18
  154. package/dist/collection/utilities/debounce.js.map +1 -1
  155. package/dist/collection/utilities/dnnServicesFramework.js +41 -41
  156. package/dist/collection/utilities/dnnServicesFramework.js.map +1 -1
  157. package/dist/collection/utilities/mouseUtilities.js +19 -19
  158. package/dist/collection/utilities/mouseUtilities.js.map +1 -1
  159. package/dist/{esm/css-shim-20dbffa5.js → dnn/css-shim-091f949f.js} +3 -3
  160. package/dist/dnn/css-shim-091f949f.js.map +1 -0
  161. package/dist/dnn/{css-shim-856c55de.system.js → css-shim-c5bffe6b.system.js} +2 -2
  162. package/dist/dnn/css-shim-c5bffe6b.system.js.map +1 -0
  163. package/dist/{esm/debounce-06f55268.js → dnn/debounce-6be67abd.js} +18 -18
  164. package/dist/dnn/{debounce-06f55268.js.map → debounce-6be67abd.js.map} +1 -1
  165. package/dist/dnn/{debounce-eef81bf7.system.js → debounce-db438a09.system.js} +1 -1
  166. package/dist/dnn/{debounce-eef81bf7.system.js.map → debounce-db438a09.system.js.map} +0 -0
  167. package/dist/dnn/dnn-button.entry.js +80 -76
  168. package/dist/dnn/dnn-button.entry.js.map +1 -1
  169. package/dist/dnn/dnn-button.system.entry.js +1 -1
  170. package/dist/dnn/dnn-button.system.entry.js.map +1 -1
  171. package/dist/dnn/dnn-checkbox.entry.js +47 -47
  172. package/dist/dnn/dnn-checkbox.entry.js.map +1 -1
  173. package/dist/dnn/dnn-checkbox.system.entry.js +1 -1
  174. package/dist/dnn/dnn-checkbox.system.entry.js.map +1 -1
  175. package/dist/dnn/dnn-chevron.entry.js +22 -22
  176. package/dist/dnn/dnn-chevron.entry.js.map +1 -1
  177. package/dist/dnn/dnn-chevron.system.entry.js +1 -1
  178. package/dist/dnn/dnn-chevron.system.entry.js.map +1 -1
  179. package/dist/dnn/dnn-collapsible.entry.js +57 -54
  180. package/dist/dnn/dnn-collapsible.entry.js.map +1 -1
  181. package/dist/dnn/dnn-collapsible.system.entry.js +1 -1
  182. package/dist/dnn/dnn-collapsible.system.entry.js.map +1 -1
  183. package/dist/dnn/dnn-color-picker.entry.js +494 -494
  184. package/dist/dnn/dnn-color-picker.entry.js.map +1 -1
  185. package/dist/dnn/dnn-color-picker.system.entry.js +2 -2
  186. package/dist/dnn/dnn-color-picker.system.entry.js.map +1 -1
  187. package/dist/dnn/dnn-dropzone.entry.js +141 -141
  188. package/dist/dnn/dnn-dropzone.entry.js.map +1 -1
  189. package/dist/dnn/dnn-dropzone.system.entry.js +1 -1
  190. package/dist/dnn/dnn-dropzone.system.entry.js.map +1 -1
  191. package/dist/dnn/dnn-image-cropper.entry.js +394 -394
  192. package/dist/dnn/dnn-image-cropper.entry.js.map +1 -1
  193. package/dist/dnn/dnn-image-cropper.system.entry.js +1 -1
  194. package/dist/dnn/dnn-image-cropper.system.entry.js.map +1 -1
  195. package/dist/dnn/dnn-modal.entry.js +53 -50
  196. package/dist/dnn/dnn-modal.entry.js.map +1 -1
  197. package/dist/dnn/dnn-modal.system.entry.js +1 -1
  198. package/dist/dnn/dnn-modal.system.entry.js.map +1 -1
  199. package/dist/dnn/dnn-permissions-grid.entry.js +316 -0
  200. package/dist/dnn/dnn-permissions-grid.entry.js.map +1 -0
  201. package/dist/dnn/dnn-permissions-grid.system.entry.js +2 -0
  202. package/dist/dnn/dnn-permissions-grid.system.entry.js.map +1 -0
  203. package/dist/dnn/dnn-searchbox.entry.js +54 -54
  204. package/dist/dnn/dnn-searchbox.entry.js.map +1 -1
  205. package/dist/dnn/dnn-searchbox.system.entry.js +1 -1
  206. package/dist/dnn/dnn-searchbox.system.entry.js.map +1 -1
  207. package/dist/dnn/dnn-sort-icon.entry.js +32 -32
  208. package/dist/dnn/dnn-sort-icon.entry.js.map +1 -1
  209. package/dist/dnn/dnn-sort-icon.system.entry.js +1 -1
  210. package/dist/dnn/dnn-sort-icon.system.entry.js.map +1 -1
  211. package/dist/dnn/dnn-tab.entry.js +19 -19
  212. package/dist/dnn/dnn-tab.entry.js.map +1 -1
  213. package/dist/dnn/dnn-tab.system.entry.js +1 -1
  214. package/dist/dnn/dnn-tabs.entry.js +40 -40
  215. package/dist/dnn/dnn-tabs.entry.js.map +1 -1
  216. package/dist/dnn/dnn-tabs.system.entry.js +1 -1
  217. package/dist/dnn/dnn-tabs.system.entry.js.map +1 -1
  218. package/dist/dnn/dnn-toggle.entry.js +26 -26
  219. package/dist/dnn/dnn-toggle.entry.js.map +1 -1
  220. package/dist/dnn/dnn-toggle.system.entry.js +1 -1
  221. package/dist/dnn/dnn-toggle.system.entry.js.map +1 -1
  222. package/dist/dnn/dnn-treeview-item.entry.js +56 -56
  223. package/dist/dnn/dnn-treeview-item.entry.js.map +1 -1
  224. package/dist/dnn/dnn-treeview-item.system.entry.js +1 -1
  225. package/dist/dnn/dnn-treeview-item.system.entry.js.map +1 -1
  226. package/dist/dnn/dnn-vertical-overflow-menu.entry.js +113 -111
  227. package/dist/dnn/dnn-vertical-overflow-menu.entry.js.map +1 -1
  228. package/dist/dnn/dnn-vertical-overflow-menu.system.entry.js +1 -1
  229. package/dist/dnn/dnn-vertical-overflow-menu.system.entry.js.map +1 -1
  230. package/dist/dnn/dnn-vertical-splitview.entry.js +121 -121
  231. package/dist/dnn/dnn-vertical-splitview.entry.js.map +1 -1
  232. package/dist/dnn/dnn-vertical-splitview.system.entry.js +1 -1
  233. package/dist/dnn/dnn-vertical-splitview.system.entry.js.map +1 -1
  234. package/dist/dnn/dnn.esm.js +8 -4
  235. package/dist/dnn/dnn.esm.js.map +1 -1
  236. package/dist/dnn/dnn.system.js +1 -1
  237. package/dist/dnn/dnn.system.js.map +1 -1
  238. package/dist/dnn/{dom-938307ec.system.js → dom-99eb7b76.system.js} +1 -1
  239. package/dist/dnn/{dom-938307ec.system.js.map → dom-99eb7b76.system.js.map} +1 -1
  240. package/dist/dnn/{dom-c5ed0ba5.js → dom-a385e381.js} +2 -2
  241. package/dist/{esm/dom-c5ed0ba5.js.map → dnn/dom-a385e381.js.map} +1 -1
  242. package/dist/dnn/{index-b5a28c1d.js → index-20e42ad7.js} +30 -4
  243. package/dist/dnn/index-20e42ad7.js.map +1 -0
  244. package/dist/dnn/index-c3cc3b5b.system.js +2 -0
  245. package/dist/dnn/index-c3cc3b5b.system.js.map +1 -0
  246. package/dist/dnn/index.esm.js +41 -41
  247. package/dist/dnn/index.system.js +1 -1
  248. package/dist/dnn/{mouseUtilities-e7e4e78f.system.js → mouseUtilities-233ad7e3.system.js} +1 -1
  249. package/dist/dnn/{mouseUtilities-e7e4e78f.system.js.map → mouseUtilities-233ad7e3.system.js.map} +0 -0
  250. package/dist/{esm/mouseUtilities-817973b4.js → dnn/mouseUtilities-b261ca4f.js} +19 -19
  251. package/dist/dnn/{mouseUtilities-817973b4.js.map → mouseUtilities-b261ca4f.js.map} +1 -1
  252. package/dist/dnn/{p-646cfb1b.system.js → p-1e26a4e1.system.js} +1 -1
  253. package/dist/dnn/{p-646cfb1b.system.js.map → p-1e26a4e1.system.js.map} +0 -0
  254. package/dist/dnn/p-31dc68a7.system.entry.js +11 -0
  255. package/dist/dnn/p-31dc68a7.system.entry.js.map +1 -0
  256. package/dist/dnn/p-5bcf3629.system.js +2 -0
  257. package/dist/dnn/p-5bcf3629.system.js.map +1 -0
  258. package/dist/dnn/{p-fb637662.system.js → p-78561bb1.system.js} +2 -2
  259. package/dist/dnn/{p-fb637662.system.js.map → p-78561bb1.system.js.map} +0 -0
  260. package/dist/dnn/p-7ffdbed1.js +2 -0
  261. package/dist/dnn/p-7ffdbed1.js.map +1 -0
  262. package/dist/dnn/{p-0e94f5ee.js → p-9b8731a9.js} +1 -1
  263. package/dist/dnn/{p-0e94f5ee.js.map → p-9b8731a9.js.map} +0 -0
  264. package/dist/dnn/p-b8064287.system.js +2 -0
  265. package/dist/dnn/p-b8064287.system.js.map +1 -0
  266. package/dist/dnn/p-c222c8b7.entry.js +11 -0
  267. package/dist/dnn/p-c222c8b7.entry.js.map +1 -0
  268. package/dist/dnn/shadow-css-27708fdd.system.js +14 -0
  269. package/dist/dnn/shadow-css-27708fdd.system.js.map +1 -0
  270. package/dist/dnn/{shadow-css-8c625855.js → shadow-css-ef431969.js} +2 -2
  271. package/dist/{esm/shadow-css-8c625855.js.map → dnn/shadow-css-ef431969.js.map} +1 -1
  272. package/dist/{dnn/css-shim-20dbffa5.js → esm/css-shim-091f949f.js} +3 -3
  273. package/dist/esm/css-shim-091f949f.js.map +1 -0
  274. package/dist/{dnn/debounce-06f55268.js → esm/debounce-6be67abd.js} +18 -18
  275. package/dist/esm/{debounce-06f55268.js.map → debounce-6be67abd.js.map} +1 -1
  276. package/dist/esm/dnn-button.entry.js +80 -76
  277. package/dist/esm/dnn-button.entry.js.map +1 -1
  278. package/dist/esm/{dnn-button_16.entry.js → dnn-button_17.entry.js} +2024 -1711
  279. package/dist/esm/dnn-button_17.entry.js.map +1 -0
  280. package/dist/esm/dnn-checkbox.entry.js +47 -47
  281. package/dist/esm/dnn-checkbox.entry.js.map +1 -1
  282. package/dist/esm/dnn-chevron.entry.js +22 -22
  283. package/dist/esm/dnn-chevron.entry.js.map +1 -1
  284. package/dist/esm/dnn-collapsible.entry.js +57 -54
  285. package/dist/esm/dnn-collapsible.entry.js.map +1 -1
  286. package/dist/esm/dnn-color-picker.entry.js +494 -494
  287. package/dist/esm/dnn-color-picker.entry.js.map +1 -1
  288. package/dist/esm/dnn-dropzone.entry.js +141 -141
  289. package/dist/esm/dnn-dropzone.entry.js.map +1 -1
  290. package/dist/esm/dnn-image-cropper.entry.js +394 -394
  291. package/dist/esm/dnn-image-cropper.entry.js.map +1 -1
  292. package/dist/esm/dnn-modal.entry.js +53 -50
  293. package/dist/esm/dnn-modal.entry.js.map +1 -1
  294. package/dist/esm/dnn-permissions-grid.entry.js +316 -0
  295. package/dist/esm/dnn-permissions-grid.entry.js.map +1 -0
  296. package/dist/esm/dnn-searchbox.entry.js +54 -54
  297. package/dist/esm/dnn-searchbox.entry.js.map +1 -1
  298. package/dist/esm/dnn-sort-icon.entry.js +32 -32
  299. package/dist/esm/dnn-sort-icon.entry.js.map +1 -1
  300. package/dist/esm/dnn-tab.entry.js +19 -19
  301. package/dist/esm/dnn-tab.entry.js.map +1 -1
  302. package/dist/esm/dnn-tabs.entry.js +40 -40
  303. package/dist/esm/dnn-tabs.entry.js.map +1 -1
  304. package/dist/esm/dnn-toggle.entry.js +26 -26
  305. package/dist/esm/dnn-toggle.entry.js.map +1 -1
  306. package/dist/esm/dnn-treeview-item.entry.js +56 -56
  307. package/dist/esm/dnn-treeview-item.entry.js.map +1 -1
  308. package/dist/esm/dnn-vertical-overflow-menu.entry.js +113 -111
  309. package/dist/esm/dnn-vertical-overflow-menu.entry.js.map +1 -1
  310. package/dist/esm/dnn-vertical-splitview.entry.js +121 -121
  311. package/dist/esm/dnn-vertical-splitview.entry.js.map +1 -1
  312. package/dist/esm/dnn.js +8 -4
  313. package/dist/esm/dnn.js.map +1 -1
  314. package/dist/esm/{dom-c5ed0ba5.js → dom-a385e381.js} +2 -2
  315. package/dist/{dnn/dom-c5ed0ba5.js.map → esm/dom-a385e381.js.map} +1 -1
  316. package/dist/esm/{index-b5a28c1d.js → index-20e42ad7.js} +30 -4
  317. package/dist/esm/index-20e42ad7.js.map +1 -0
  318. package/dist/esm/{index-cdbad319.js → index-59e0950f.js} +32 -2
  319. package/dist/esm/index-59e0950f.js.map +1 -0
  320. package/dist/esm/index.js +41 -41
  321. package/dist/esm/loader.js +4 -4
  322. package/dist/esm/loader.js.map +1 -1
  323. package/dist/{dnn/mouseUtilities-817973b4.js → esm/mouseUtilities-b261ca4f.js} +19 -19
  324. package/dist/esm/{mouseUtilities-817973b4.js.map → mouseUtilities-b261ca4f.js.map} +1 -1
  325. package/dist/esm/polyfills/core-js.js +0 -0
  326. package/dist/esm/polyfills/css-shim.js +1 -1
  327. package/dist/esm/polyfills/dom.js +0 -0
  328. package/dist/esm/polyfills/es5-html-element.js +0 -0
  329. package/dist/esm/polyfills/index.js +0 -0
  330. package/dist/esm/polyfills/system.js +0 -0
  331. package/dist/esm/{shadow-css-8c625855.js → shadow-css-ef431969.js} +2 -2
  332. package/dist/{dnn/shadow-css-8c625855.js.map → esm/shadow-css-ef431969.js.map} +1 -1
  333. package/dist/esm-es5/{debounce-06f55268.js → debounce-6be67abd.js} +1 -1
  334. package/dist/esm-es5/{debounce-06f55268.js.map → debounce-6be67abd.js.map} +0 -0
  335. package/dist/esm-es5/dnn-button_17.entry.js +11 -0
  336. package/dist/esm-es5/dnn-button_17.entry.js.map +1 -0
  337. package/dist/esm-es5/dnn.js +1 -1
  338. package/dist/esm-es5/dnn.js.map +1 -1
  339. package/dist/esm-es5/index-59e0950f.js +2 -0
  340. package/dist/esm-es5/index-59e0950f.js.map +1 -0
  341. package/dist/esm-es5/index.js +1 -1
  342. package/dist/esm-es5/loader.js +1 -1
  343. package/dist/esm-es5/loader.js.map +1 -1
  344. package/dist/types/components/dnn-button/dnn-button.d.ts +56 -55
  345. package/dist/types/components/dnn-button/dnn-button.stories.d.ts +4 -0
  346. package/dist/types/components/dnn-checkbox/dnn-checkbox.d.ts +20 -16
  347. package/dist/types/components/dnn-checkbox/dnn-checkbox.stories.d.ts +4 -0
  348. package/dist/types/components/dnn-chevron/dnn-chevron.d.ts +13 -13
  349. package/dist/types/components/dnn-chevron/dnn-chevron.stories.d.ts +4 -0
  350. package/dist/types/components/dnn-collapsible/dnn-collapsible.d.ts +19 -18
  351. package/dist/types/components/dnn-collapsible/dnn-collapsible.stories.d.ts +4 -0
  352. package/dist/types/components/dnn-color-picker/dnn-color-picker.d.ts +46 -46
  353. package/dist/types/components/dnn-color-picker/dnn-color-picker.stories.d.ts +4 -0
  354. package/dist/types/components/dnn-dropzone/dnn-dropzone.d.ts +45 -45
  355. package/dist/types/components/dnn-dropzone/dnn-dropzone.stories.d.ts +4 -0
  356. package/dist/types/components/dnn-image-cropper/CornerType.d.ts +6 -6
  357. package/dist/types/components/dnn-image-cropper/dnn-image-cropper.d.ts +61 -61
  358. package/dist/types/components/dnn-image-cropper/dnn-image-cropper.stories.d.ts +4 -0
  359. package/dist/types/components/dnn-modal/dnn-modal.d.ts +38 -35
  360. package/dist/types/components/dnn-modal/dnn-modal.stories.d.ts +4 -0
  361. package/dist/types/components/dnn-permissions-grid/dnn-permissions-grid.d.ts +47 -0
  362. package/dist/types/components/dnn-permissions-grid/dnn-permissions-grid.stories.d.ts +4 -0
  363. package/dist/types/components/dnn-permissions-grid/localization-interface.d.ts +11 -0
  364. package/dist/types/components/dnn-permissions-grid/permissions-interface.d.ts +26 -0
  365. package/dist/types/components/dnn-permissions-grid/role-group-interface.d.ts +6 -0
  366. package/dist/types/components/dnn-permissions-grid/role-interface.d.ts +6 -0
  367. package/dist/types/components/dnn-permissions-grid/searched-user-interface.d.ts +4 -0
  368. package/dist/types/components/dnn-searchbox/dnn-searchbox.d.ts +22 -22
  369. package/dist/types/components/dnn-searchbox/dnn-searchbox.stories.d.ts +4 -0
  370. package/dist/types/components/dnn-sort-icon/dnn-sort-icon.d.ts +9 -9
  371. package/dist/types/components/dnn-sort-icon/dnn-sort-icon.stories.d.ts +4 -0
  372. package/dist/types/components/dnn-tab/dnn-tab.d.ts +11 -11
  373. package/dist/types/components/dnn-tab/dnn-tab.stories.d.ts +4 -0
  374. package/dist/types/components/dnn-tabs/dnn-tabs.d.ts +11 -11
  375. package/dist/types/components/dnn-tabs/dnn-tabs.stories.d.ts +4 -0
  376. package/dist/types/components/dnn-toggle/dnn-toggle.d.ts +13 -13
  377. package/dist/types/components/dnn-toggle/dnn-toggle.stories.d.ts +4 -0
  378. package/dist/types/components/dnn-toggle/toggle-interface.d.ts +3 -3
  379. package/dist/types/components/dnn-treeview-item/dnn-treeview-item.d.ts +28 -24
  380. package/dist/types/components/dnn-treeview-item/dnn-treeview-item.stories.d.ts +4 -0
  381. package/dist/types/components/dnn-vertical-overflow-menu/dnn-vertical-overflow-menu.d.ts +16 -16
  382. package/dist/types/components/dnn-vertical-overflow-menu/dnn-vertical-overflow-menu.stories.d.ts +4 -0
  383. package/dist/types/components/dnn-vertical-splitview/dnn-vertical-splitview.d.ts +28 -28
  384. package/dist/types/components/dnn-vertical-splitview/dnn-vertical-splitview.stories.d.ts +4 -0
  385. package/dist/types/components.d.ts +108 -34
  386. package/dist/types/global.d.ts +1 -0
  387. package/dist/types/home/runner/work/dnn-elements/dnn-elements/.stencil/.storybook/utilities.d.ts +1 -0
  388. package/dist/types/index.d.ts +3 -3
  389. package/dist/types/utilities/colorInfo.d.ts +52 -52
  390. package/dist/types/utilities/debounce.d.ts +5 -5
  391. package/dist/types/utilities/dnnServicesFramework.d.ts +19 -19
  392. package/dist/types/utilities/mouseUtilities.d.ts +4 -4
  393. package/package.json +63 -48
  394. package/dist/cjs/css-shim-3bfdba4f.js.map +0 -1
  395. package/dist/cjs/dnn-button_16.cjs.entry.js.map +0 -1
  396. package/dist/cjs/index-7505bd72.js.map +0 -1
  397. package/dist/cjs/index-aff4d89a.js.map +0 -1
  398. package/dist/dnn/css-shim-20dbffa5.js.map +0 -1
  399. package/dist/dnn/css-shim-856c55de.system.js.map +0 -1
  400. package/dist/dnn/index-a3a55419.system.js +0 -2
  401. package/dist/dnn/index-a3a55419.system.js.map +0 -1
  402. package/dist/dnn/index-b5a28c1d.js.map +0 -1
  403. package/dist/dnn/p-058ba146.system.js +0 -2
  404. package/dist/dnn/p-058ba146.system.js.map +0 -1
  405. package/dist/dnn/p-45ce2139.js +0 -2
  406. package/dist/dnn/p-45ce2139.js.map +0 -1
  407. package/dist/dnn/p-755d047d.system.entry.js +0 -11
  408. package/dist/dnn/p-755d047d.system.entry.js.map +0 -1
  409. package/dist/dnn/p-8ec1f3a8.entry.js +0 -11
  410. package/dist/dnn/p-8ec1f3a8.entry.js.map +0 -1
  411. package/dist/dnn/p-f91193e2.system.js +0 -2
  412. package/dist/dnn/p-f91193e2.system.js.map +0 -1
  413. package/dist/dnn/shadow-css-d573707f.system.js +0 -14
  414. package/dist/dnn/shadow-css-d573707f.system.js.map +0 -1
  415. package/dist/esm/css-shim-20dbffa5.js.map +0 -1
  416. package/dist/esm/dnn-button_16.entry.js.map +0 -1
  417. package/dist/esm/index-b5a28c1d.js.map +0 -1
  418. package/dist/esm/index-cdbad319.js.map +0 -1
  419. package/dist/esm-es5/dnn-button_16.entry.js +0 -11
  420. package/dist/esm-es5/dnn-button_16.entry.js.map +0 -1
  421. package/dist/esm-es5/index-cdbad319.js +0 -2
  422. package/dist/esm-es5/index-cdbad319.js.map +0 -1
@@ -1,523 +1,523 @@
1
- import { Component, Host, h, State, Prop, Event } from '@stencil/core';
2
- import { CornerType } from './CornerType';
3
- import { getMovementFromEvent } from "../../utilities/mouseUtilities";
4
- /**
5
- * Allows cropping an image in-browser with the option to enforce a specific final size.
6
- * All computation happens in the browser and the final image is emmited
7
- * in an event that has a data-url of the image.
8
- */
9
- export class DnnImageCropper {
10
- constructor() {
11
- /** Sets the desired final image width. */
12
- this.width = 600;
13
- /** Sets the desired final image height. */
14
- this.height = 600;
15
- /** Can be used to customize controls text.
16
- * Some values support tokens, see default values for examples.
17
- */
18
- this.resx = {
19
- capture: "Capture",
20
- dragAndDropFile: "Drag and drop an image",
21
- or: "or",
22
- takePicture: "Take a picture",
23
- uploadFile: "Upload an image",
24
- imageTooSmall: "The image you are attempting to upload does not meet the minimum size requirement of {width} pixels by {height} pixels. Please upload a larger image.",
25
- modalCloseText: "Close",
26
- };
27
- /** Sets the output quality of the corpped image (number between 0 and 1). */
28
- this.quality = 0.8;
29
- /** When set to true, prevents cropping an image smaller than the required size, which would blow pixel and make the final picture look blurry. */
30
- this.preventUndersized = false;
31
- this.handleCropMouseDown = (event) => {
32
- event.stopPropagation();
33
- event.preventDefault();
34
- const element = event.target;
35
- const className = element.classList[0];
36
- document.addEventListener("mouseup", this.handleImageCropFinished, false);
37
- document.addEventListener("touchend", this.handleImageCropFinished, false);
38
- switch (className) {
39
- case "crop":
40
- document.addEventListener("mousemove", this.handleCropDrag, false);
41
- document.addEventListener("touchmove", this.handleCropDrag, false);
42
- document.addEventListener("mouseup", () => document.removeEventListener("mousemove", this.handleCropDrag));
43
- document.addEventListener("touchend", () => document.removeEventListener("touchmove", this.handleCropDrag));
44
- break;
45
- case "nw":
46
- document.addEventListener("mousemove", this.handleNwMouseMove, false);
47
- document.addEventListener("touchmove", this.handleNwMouseMove, false);
48
- document.addEventListener("mouseup", () => document.removeEventListener("mousemove", this.handleNwMouseMove));
49
- document.addEventListener("touchend", () => document.removeEventListener("touchmove", this.handleNwMouseMove));
50
- break;
51
- case "ne":
52
- document.addEventListener("mousemove", this.handleNeMouseMove, false);
53
- document.addEventListener("touchmove", this.handleNeMouseMove, false);
54
- document.addEventListener("mouseup", () => document.removeEventListener("mousemove", this.handleNeMouseMove));
55
- document.addEventListener("touchend", () => document.removeEventListener("touchmove", this.handleNeMouseMove));
56
- break;
57
- case "se":
58
- document.addEventListener("mousemove", this.handleSeMouseMove, false);
59
- document.addEventListener("touchmove", this.handleSeMouseMove, false);
60
- document.addEventListener("mouseup", () => document.removeEventListener("mousemove", this.handleSeMouseMove));
61
- document.addEventListener("touchend", () => document.removeEventListener("touchmove", this.handleSeMouseMove));
62
- break;
63
- case "sw":
64
- document.addEventListener("mousemove", this.handleSwMouseMove, false);
65
- document.addEventListener("touchmove", this.handleSwMouseMove, false);
66
- document.addEventListener("mouseup", () => document.removeEventListener("mousemove", this.handleSwMouseMove));
67
- document.addEventListener("touchend", () => document.removeEventListener("touchmove", this.handleSwMouseMove));
68
- break;
69
- default:
70
- break;
71
- }
72
- };
73
- this.handleImageCropFinished = (_ev) => {
74
- this.emitImage();
75
- document.removeEventListener("mouseup", this.handleImageCropFinished);
76
- this.previousTouch = undefined;
77
- };
78
- this.handleNwMouseMove = (event) => {
79
- this.handleCornerDrag(event, CornerType.nw);
80
- };
81
- this.handleNeMouseMove = (event) => {
82
- this.handleCornerDrag(event, CornerType.ne);
83
- };
84
- this.handleSeMouseMove = (event) => {
85
- this.handleCornerDrag(event, CornerType.se);
86
- };
87
- this.handleSwMouseMove = (event) => {
88
- this.handleCornerDrag(event, CornerType.sw);
89
- };
90
- this.handleCornerDrag = (event, corner) => {
91
- if (!this.isMouseStillInTarget(event)) {
92
- return;
93
- }
94
- let { left, top } = this.getCornerLeftTop(corner);
95
- let newWidth = 0;
96
- let newHeight = 0;
97
- let orientation = "horizontal";
98
- const wantedRatio = this.width / this.height;
99
- const cropRect = this.crop.getBoundingClientRect();
100
- const imageRect = this.image.getBoundingClientRect();
101
- let { movementX, movementY } = getMovementFromEvent(event, this.previousTouch);
102
- if (Math.abs(movementX) < Math.abs(movementY)) {
103
- orientation = "vertical";
104
- }
105
- if (orientation == "horizontal") {
106
- switch (corner) {
107
- case CornerType.nw:
108
- case CornerType.sw:
109
- newWidth = cropRect.width - movementX;
110
- newHeight = newWidth / wantedRatio;
111
- break;
112
- case CornerType.ne:
113
- case CornerType.se:
114
- newWidth = cropRect.width + movementX;
115
- newHeight = newWidth / wantedRatio;
116
- break;
117
- default:
118
- break;
119
- }
120
- }
121
- else {
122
- switch (corner) {
123
- case CornerType.nw:
124
- case CornerType.ne:
125
- newHeight = cropRect.height - movementY;
126
- newWidth = newHeight * wantedRatio;
127
- break;
128
- case CornerType.se:
129
- case CornerType.sw:
130
- newHeight = cropRect.height + movementY;
131
- newWidth = newHeight * wantedRatio;
132
- break;
133
- default:
134
- break;
135
- }
136
- }
137
- switch (corner) {
138
- case CornerType.ne:
139
- case CornerType.nw:
140
- const topOffset = cropRect.height - newHeight;
141
- top = this.crop.offsetTop + topOffset;
142
- default:
143
- break;
144
- }
145
- switch (corner) {
146
- case CornerType.nw:
147
- case CornerType.sw:
148
- const leftOffset = cropRect.width - newWidth;
149
- left = this.crop.offsetLeft + leftOffset;
150
- if (left < 0)
151
- left = 0;
152
- if (left > imageRect.width)
153
- left = imageRect.width;
154
- if (top < 0)
155
- top = 0;
156
- if (top > imageRect.height)
157
- top = imageRect.height;
158
- if (left + newWidth > imageRect.width)
159
- newWidth = imageRect.width - left;
160
- if (top + newHeight > imageRect.height)
161
- newHeight = imageRect.height - top;
162
- break;
163
- case CornerType.ne:
164
- case CornerType.se:
165
- if (top < 0)
166
- top = 0;
167
- if (top > imageRect.height)
168
- top = imageRect.height;
169
- if (left + newWidth > imageRect.width)
170
- newWidth = imageRect.width - left;
171
- if (top + newHeight > imageRect.height)
172
- newHeight = imageRect.height - top;
173
- break;
174
- default:
175
- break;
176
- }
177
- if (newWidth / newHeight != wantedRatio) {
178
- return;
179
- }
180
- if (this.preventUndersized) {
181
- const zoomRatio = this.image.width / this.image.naturalWidth;
182
- if (newWidth / zoomRatio < this.width || newHeight / zoomRatio < this.height) {
183
- return;
184
- }
185
- }
186
- switch (corner) {
187
- case CornerType.ne:
188
- this.crop.style.top = `${top}px`;
189
- this.crop.style.width = `${newWidth}px`;
190
- this.crop.style.height = `${newHeight}px`;
191
- break;
192
- case CornerType.nw:
193
- this.crop.style.left = `${left}px`;
194
- this.crop.style.top = `${top}px`;
195
- this.crop.style.width = `${newWidth}px`;
196
- this.crop.style.height = `${newHeight}px`;
197
- break;
198
- case CornerType.se:
199
- this.crop.style.width = `${newWidth}px`;
200
- this.crop.style.height = `${newHeight}px`;
201
- break;
202
- case CornerType.sw:
203
- this.crop.style.left = `${left}px`;
204
- this.crop.style.width = `${newWidth}px`;
205
- this.crop.style.height = `${newHeight}px`;
206
- break;
207
- default:
208
- break;
209
- }
210
- };
211
- this.handleCropDrag = (ev) => {
212
- if (!this.isMouseStillInTarget(ev)) {
213
- return;
214
- }
215
- let { movementX, movementY } = getMovementFromEvent(ev, this.previousTouch);
216
- let newLeft = this.crop.offsetLeft + movementX;
217
- let newTop = this.crop.offsetTop + movementY;
218
- var imageRect = this.image.getBoundingClientRect();
219
- var cropRect = this.crop.getBoundingClientRect();
220
- if (newLeft < 0) {
221
- newLeft = 0;
222
- }
223
- if (newTop < 0) {
224
- newTop = 0;
225
- }
226
- if (newLeft + cropRect.width > imageRect.width) {
227
- newLeft = this.crop.offsetLeft;
228
- }
229
- if (newTop + cropRect.height > imageRect.height) {
230
- newTop = this.crop.offsetTop;
231
- }
232
- this.crop.style.left = newLeft + "px";
233
- this.crop.style.top = newTop + "px";
234
- };
235
- }
236
- componentDidLoad() {
237
- requestAnimationFrame(() => {
238
- this.setView("noPictureView");
239
- });
240
- }
241
- setView(newView) {
242
- const views = this.host.shadowRoot.querySelectorAll(".view");
243
- views.forEach(v => v.classList.remove("visible"));
244
- switch (newView) {
245
- case "noPictureView":
246
- this.noPictureView.classList.add("visible");
247
- break;
248
- case "hasPictureView":
249
- this.hasPictureView.classList.add("visible");
250
- break;
251
- default:
252
- break;
253
- }
254
- this.view = newView;
255
- }
256
- initCrop() {
257
- var wantedRatio = this.width / this.height;
258
- var imageRect = this.image.getBoundingClientRect();
259
- var imageRatio = imageRect.width / imageRect.height;
260
- if (wantedRatio > imageRatio) {
261
- var wantedHeight = imageRect.width / wantedRatio;
262
- var diff = imageRect.height - wantedHeight;
263
- this.crop.style.top = Math.round(diff / 2).toString() + "px";
264
- this.crop.style.height = Math.round(wantedHeight).toString() + "px";
265
- }
266
- else {
267
- var wantedWidth = imageRect.height * wantedRatio;
268
- var diff = imageRect.width - wantedWidth;
269
- this.crop.style.left = Math.round(diff / 2).toString() + "px";
270
- this.crop.style.width = Math.round(wantedWidth).toString() + "px";
271
- }
272
- }
273
- setImage() {
274
- this.image.addEventListener('load', () => {
275
- this.initCrop();
276
- this.emitImage();
277
- });
278
- this.image.src = this.canvas.toDataURL();
279
- }
280
- handleNewFile(file) {
281
- if (file.type.split('/')[0] != "image") {
282
- return;
283
- }
284
- var reader = new FileReader();
285
- reader.onload = readerLoadEvent => {
286
- var img = new Image();
287
- img.onload = () => {
288
- this.canvas.width = img.width;
289
- this.canvas.height = img.height;
290
- if (this.preventUndersized && (img.width < this.width || img.height < this.height)) {
291
- this.imageTooSmallModal.show();
292
- return;
293
- }
294
- var ctx = this.canvas.getContext("2d");
295
- ctx.drawImage(img, 0, 0);
296
- this.setView("hasPictureView");
297
- this.setImage();
298
- };
299
- img.src = readerLoadEvent.target.result.toString();
300
- };
301
- reader.readAsDataURL(file);
302
- }
303
- emitImage() {
304
- var x = this.crop.offsetLeft / this.image.width * this.image.naturalWidth;
305
- var y = this.crop.offsetTop / this.image.height * this.image.naturalHeight;
306
- var cropRect = this.crop.getBoundingClientRect();
307
- var width = cropRect.width / this.image.width * this.image.naturalWidth;
308
- var height = cropRect.height / this.image.height * this.image.naturalHeight;
309
- if (x < 0)
310
- x = 0;
311
- if (x > this.image.naturalWidth)
312
- x = this.image.naturalWidth;
313
- if (y < 0)
314
- y = 0;
315
- if (y > this.image.naturalWidth)
316
- y = this.image.naturalWidth;
317
- if (width > this.image.naturalWidth)
318
- width = this.image.naturalWidth;
319
- if (height > this.image.naturalHeight)
320
- height = this.image.naturalHeight;
321
- var dataUrl = this.generateCroppedImage(x, y, width, height, this.width, this.height);
322
- this.imageCropChanged.emit(dataUrl);
323
- }
324
- generateCroppedImage(x, y, width, height, desiredWidth, desiredHeight) {
325
- this.canvas.width = desiredWidth;
326
- this.canvas.height = desiredHeight;
327
- const context = this.canvas.getContext("2d");
328
- context.clearRect(0, 0, desiredWidth, desiredHeight);
329
- context.drawImage(this.image, x, y, width, height, 0, 0, desiredWidth, desiredHeight);
330
- return this.canvas.toDataURL("image/jpeg", this.quality);
331
- }
332
- getCornerLeftTop(corner) {
333
- let left = 0;
334
- let top = 0;
335
- switch (corner) {
336
- case CornerType.se:
337
- left = this.crop.offsetLeft;
338
- top = this.crop.offsetTop;
339
- break;
340
- case CornerType.sw:
341
- top = this.crop.offsetTop;
342
- break;
343
- default:
344
- break;
345
- }
346
- return { top, left };
347
- }
348
- isMouseStillInTarget(event) {
349
- var inside = false;
350
- let mouseX;
351
- let mouseY;
352
- const imageRect = this.image.getBoundingClientRect();
353
- if (event instanceof MouseEvent) {
354
- mouseX = event.clientX;
355
- mouseY = event.clientY;
356
- }
357
- if (typeof TouchEvent !== "undefined") {
358
- if (event instanceof TouchEvent) {
359
- var touch = event.touches[0];
360
- mouseX = touch.clientX;
361
- mouseY = touch.clientY;
362
- }
363
- }
364
- if (mouseX >= imageRect.x &&
365
- mouseY >= imageRect.y &&
366
- mouseX <= imageRect.left + imageRect.width &&
367
- mouseY <= imageRect.top + imageRect.height) {
368
- inside = true;
369
- }
370
- var corners = this.crop.querySelectorAll("div");
371
- corners.forEach(corner => {
372
- var cornerRect = corner.getBoundingClientRect();
373
- if (mouseX >= cornerRect.x &&
374
- mouseY >= cornerRect.y &&
375
- mouseX <= cornerRect.left + cornerRect.width &&
376
- mouseY <= cornerRect.top + cornerRect.height) {
377
- inside = true;
378
- }
379
- });
380
- return inside;
381
- }
382
- render() {
383
- return (h(Host, { ref: el => this.host = el },
384
- h("canvas", { ref: el => this.canvas = el }),
385
- h("div", { class: "view", ref: el => this.hasPictureView = el },
386
- h("div", { class: "cropper" },
387
- h("img", { ref: el => this.image = el }),
388
- h("div", { class: "backdrop" }),
389
- h("div", { class: "crop", ref: e => this.crop = e, onMouseDown: this.handleCropMouseDown, onTouchStart: this.handleCropMouseDown },
390
- h("div", { class: "nw" }),
391
- h("div", { class: "ne" }),
392
- h("div", { class: "se" }),
393
- h("div", { class: "sw" })))),
394
- h("div", { class: "view", ref: el => this.noPictureView = el },
395
- h("dnn-dropzone", { allowCameraMode: true, onFilesSelected: e => this.handleNewFile(e.detail[0]), resx: {
396
- capture: this.resx.capture,
397
- dragAndDropFile: this.resx.dragAndDropFile,
398
- or: this.resx.or,
399
- takePicture: this.resx.takePicture,
400
- uploadFile: this.resx.uploadFile,
401
- } })),
402
- h("dnn-modal", { ref: el => this.imageTooSmallModal = el, "close-text": this.resx.modalCloseText },
403
- h("p", null, this.resx.imageTooSmall.replace("{width}", this.width.toString()).replace("{height}", this.height.toString())))));
404
- }
405
- static get is() { return "dnn-image-cropper"; }
406
- static get encapsulation() { return "shadow"; }
407
- static get originalStyleUrls() { return {
408
- "$": ["dnn-image-cropper.scss"]
409
- }; }
410
- static get styleUrls() { return {
411
- "$": ["dnn-image-cropper.css"]
412
- }; }
413
- static get properties() { return {
414
- "width": {
415
- "type": "number",
416
- "mutable": false,
417
- "complexType": {
418
- "original": "number",
419
- "resolved": "number",
420
- "references": {}
421
- },
422
- "required": false,
423
- "optional": false,
424
- "docs": {
425
- "tags": [],
426
- "text": "Sets the desired final image width."
427
- },
428
- "attribute": "width",
429
- "reflect": false,
430
- "defaultValue": "600"
431
- },
432
- "height": {
433
- "type": "number",
434
- "mutable": false,
435
- "complexType": {
436
- "original": "number",
437
- "resolved": "number",
438
- "references": {}
439
- },
440
- "required": false,
441
- "optional": false,
442
- "docs": {
443
- "tags": [],
444
- "text": "Sets the desired final image height."
445
- },
446
- "attribute": "height",
447
- "reflect": false,
448
- "defaultValue": "600"
449
- },
450
- "resx": {
451
- "type": "unknown",
452
- "mutable": false,
453
- "complexType": {
454
- "original": "{\r\n capture: string;\r\n dragAndDropFile: string;\r\n or: string;\r\n takePicture: string;\r\n uploadFile: string;\r\n imageTooSmall: string;\r\n modalCloseText: string;\r\n }",
455
- "resolved": "{ capture: string; dragAndDropFile: string; or: string; takePicture: string; uploadFile: string; imageTooSmall: string; modalCloseText: string; }",
456
- "references": {}
457
- },
458
- "required": false,
459
- "optional": false,
460
- "docs": {
461
- "tags": [],
462
- "text": "Can be used to customize controls text.\r\nSome values support tokens, see default values for examples."
463
- },
464
- "defaultValue": "{\r\n capture: \"Capture\",\r\n dragAndDropFile: \"Drag and drop an image\",\r\n or: \"or\",\r\n takePicture: \"Take a picture\",\r\n uploadFile: \"Upload an image\",\r\n imageTooSmall: \"The image you are attempting to upload does not meet the minimum size requirement of {width} pixels by {height} pixels. Please upload a larger image.\",\r\n modalCloseText: \"Close\",\r\n }"
465
- },
466
- "quality": {
467
- "type": "number",
468
- "mutable": false,
469
- "complexType": {
470
- "original": "number",
471
- "resolved": "number",
472
- "references": {}
473
- },
474
- "required": false,
475
- "optional": false,
476
- "docs": {
477
- "tags": [],
478
- "text": "Sets the output quality of the corpped image (number between 0 and 1)."
479
- },
480
- "attribute": "quality",
481
- "reflect": false,
482
- "defaultValue": "0.8"
483
- },
484
- "preventUndersized": {
485
- "type": "boolean",
486
- "mutable": false,
487
- "complexType": {
488
- "original": "boolean",
489
- "resolved": "boolean",
490
- "references": {}
491
- },
492
- "required": false,
493
- "optional": false,
494
- "docs": {
495
- "tags": [],
496
- "text": "When set to true, prevents cropping an image smaller than the required size, which would blow pixel and make the final picture look blurry."
497
- },
498
- "attribute": "prevent-undersized",
499
- "reflect": false,
500
- "defaultValue": "false"
501
- }
502
- }; }
503
- static get states() { return {
504
- "view": {}
505
- }; }
506
- static get events() { return [{
507
- "method": "imageCropChanged",
508
- "name": "imageCropChanged",
509
- "bubbles": true,
510
- "cancelable": true,
511
- "composed": true,
512
- "docs": {
513
- "tags": [],
514
- "text": "When the image crop changes, emits the dataurl for the new cropped image."
515
- },
516
- "complexType": {
517
- "original": "string",
518
- "resolved": "string",
519
- "references": {}
520
- }
521
- }]; }
522
- }
1
+ import { Component, Host, h, State, Prop, Event } from '@stencil/core';
2
+ import { CornerType } from './CornerType';
3
+ import { getMovementFromEvent } from "../../utilities/mouseUtilities";
4
+ /**
5
+ * Allows cropping an image in-browser with the option to enforce a specific final size.
6
+ * All computation happens in the browser and the final image is emmited
7
+ * in an event that has a data-url of the image.
8
+ */
9
+ export class DnnImageCropper {
10
+ constructor() {
11
+ /** Sets the desired final image width. */
12
+ this.width = 600;
13
+ /** Sets the desired final image height. */
14
+ this.height = 600;
15
+ /** Can be used to customize controls text.
16
+ * Some values support tokens, see default values for examples.
17
+ */
18
+ this.resx = {
19
+ capture: "Capture",
20
+ dragAndDropFile: "Drag and drop an image",
21
+ or: "or",
22
+ takePicture: "Take a picture",
23
+ uploadFile: "Upload an image",
24
+ imageTooSmall: "The image you are attempting to upload does not meet the minimum size requirement of {width} pixels by {height} pixels. Please upload a larger image.",
25
+ modalCloseText: "Close",
26
+ };
27
+ /** Sets the output quality of the corpped image (number between 0 and 1). */
28
+ this.quality = 0.8;
29
+ /** When set to true, prevents cropping an image smaller than the required size, which would blow pixel and make the final picture look blurry. */
30
+ this.preventUndersized = false;
31
+ this.handleCropMouseDown = (event) => {
32
+ event.stopPropagation();
33
+ event.preventDefault();
34
+ const element = event.target;
35
+ const className = element.classList[0];
36
+ document.addEventListener("mouseup", this.handleImageCropFinished, false);
37
+ document.addEventListener("touchend", this.handleImageCropFinished, false);
38
+ switch (className) {
39
+ case "crop":
40
+ document.addEventListener("mousemove", this.handleCropDrag, false);
41
+ document.addEventListener("touchmove", this.handleCropDrag, false);
42
+ document.addEventListener("mouseup", () => document.removeEventListener("mousemove", this.handleCropDrag));
43
+ document.addEventListener("touchend", () => document.removeEventListener("touchmove", this.handleCropDrag));
44
+ break;
45
+ case "nw":
46
+ document.addEventListener("mousemove", this.handleNwMouseMove, false);
47
+ document.addEventListener("touchmove", this.handleNwMouseMove, false);
48
+ document.addEventListener("mouseup", () => document.removeEventListener("mousemove", this.handleNwMouseMove));
49
+ document.addEventListener("touchend", () => document.removeEventListener("touchmove", this.handleNwMouseMove));
50
+ break;
51
+ case "ne":
52
+ document.addEventListener("mousemove", this.handleNeMouseMove, false);
53
+ document.addEventListener("touchmove", this.handleNeMouseMove, false);
54
+ document.addEventListener("mouseup", () => document.removeEventListener("mousemove", this.handleNeMouseMove));
55
+ document.addEventListener("touchend", () => document.removeEventListener("touchmove", this.handleNeMouseMove));
56
+ break;
57
+ case "se":
58
+ document.addEventListener("mousemove", this.handleSeMouseMove, false);
59
+ document.addEventListener("touchmove", this.handleSeMouseMove, false);
60
+ document.addEventListener("mouseup", () => document.removeEventListener("mousemove", this.handleSeMouseMove));
61
+ document.addEventListener("touchend", () => document.removeEventListener("touchmove", this.handleSeMouseMove));
62
+ break;
63
+ case "sw":
64
+ document.addEventListener("mousemove", this.handleSwMouseMove, false);
65
+ document.addEventListener("touchmove", this.handleSwMouseMove, false);
66
+ document.addEventListener("mouseup", () => document.removeEventListener("mousemove", this.handleSwMouseMove));
67
+ document.addEventListener("touchend", () => document.removeEventListener("touchmove", this.handleSwMouseMove));
68
+ break;
69
+ default:
70
+ break;
71
+ }
72
+ };
73
+ this.handleImageCropFinished = (_ev) => {
74
+ this.emitImage();
75
+ document.removeEventListener("mouseup", this.handleImageCropFinished);
76
+ this.previousTouch = undefined;
77
+ };
78
+ this.handleNwMouseMove = (event) => {
79
+ this.handleCornerDrag(event, CornerType.nw);
80
+ };
81
+ this.handleNeMouseMove = (event) => {
82
+ this.handleCornerDrag(event, CornerType.ne);
83
+ };
84
+ this.handleSeMouseMove = (event) => {
85
+ this.handleCornerDrag(event, CornerType.se);
86
+ };
87
+ this.handleSwMouseMove = (event) => {
88
+ this.handleCornerDrag(event, CornerType.sw);
89
+ };
90
+ this.handleCornerDrag = (event, corner) => {
91
+ if (!this.isMouseStillInTarget(event)) {
92
+ return;
93
+ }
94
+ let { left, top } = this.getCornerLeftTop(corner);
95
+ let newWidth = 0;
96
+ let newHeight = 0;
97
+ let orientation = "horizontal";
98
+ const wantedRatio = this.width / this.height;
99
+ const cropRect = this.crop.getBoundingClientRect();
100
+ const imageRect = this.image.getBoundingClientRect();
101
+ let { movementX, movementY } = getMovementFromEvent(event, this.previousTouch);
102
+ if (Math.abs(movementX) < Math.abs(movementY)) {
103
+ orientation = "vertical";
104
+ }
105
+ if (orientation == "horizontal") {
106
+ switch (corner) {
107
+ case CornerType.nw:
108
+ case CornerType.sw:
109
+ newWidth = cropRect.width - movementX;
110
+ newHeight = newWidth / wantedRatio;
111
+ break;
112
+ case CornerType.ne:
113
+ case CornerType.se:
114
+ newWidth = cropRect.width + movementX;
115
+ newHeight = newWidth / wantedRatio;
116
+ break;
117
+ default:
118
+ break;
119
+ }
120
+ }
121
+ else {
122
+ switch (corner) {
123
+ case CornerType.nw:
124
+ case CornerType.ne:
125
+ newHeight = cropRect.height - movementY;
126
+ newWidth = newHeight * wantedRatio;
127
+ break;
128
+ case CornerType.se:
129
+ case CornerType.sw:
130
+ newHeight = cropRect.height + movementY;
131
+ newWidth = newHeight * wantedRatio;
132
+ break;
133
+ default:
134
+ break;
135
+ }
136
+ }
137
+ switch (corner) {
138
+ case CornerType.ne:
139
+ case CornerType.nw:
140
+ const topOffset = cropRect.height - newHeight;
141
+ top = this.crop.offsetTop + topOffset;
142
+ default:
143
+ break;
144
+ }
145
+ switch (corner) {
146
+ case CornerType.nw:
147
+ case CornerType.sw:
148
+ const leftOffset = cropRect.width - newWidth;
149
+ left = this.crop.offsetLeft + leftOffset;
150
+ if (left < 0)
151
+ left = 0;
152
+ if (left > imageRect.width)
153
+ left = imageRect.width;
154
+ if (top < 0)
155
+ top = 0;
156
+ if (top > imageRect.height)
157
+ top = imageRect.height;
158
+ if (left + newWidth > imageRect.width)
159
+ newWidth = imageRect.width - left;
160
+ if (top + newHeight > imageRect.height)
161
+ newHeight = imageRect.height - top;
162
+ break;
163
+ case CornerType.ne:
164
+ case CornerType.se:
165
+ if (top < 0)
166
+ top = 0;
167
+ if (top > imageRect.height)
168
+ top = imageRect.height;
169
+ if (left + newWidth > imageRect.width)
170
+ newWidth = imageRect.width - left;
171
+ if (top + newHeight > imageRect.height)
172
+ newHeight = imageRect.height - top;
173
+ break;
174
+ default:
175
+ break;
176
+ }
177
+ if (newWidth / newHeight != wantedRatio) {
178
+ return;
179
+ }
180
+ if (this.preventUndersized) {
181
+ const zoomRatio = this.image.width / this.image.naturalWidth;
182
+ if (newWidth / zoomRatio < this.width || newHeight / zoomRatio < this.height) {
183
+ return;
184
+ }
185
+ }
186
+ switch (corner) {
187
+ case CornerType.ne:
188
+ this.crop.style.top = `${top}px`;
189
+ this.crop.style.width = `${newWidth}px`;
190
+ this.crop.style.height = `${newHeight}px`;
191
+ break;
192
+ case CornerType.nw:
193
+ this.crop.style.left = `${left}px`;
194
+ this.crop.style.top = `${top}px`;
195
+ this.crop.style.width = `${newWidth}px`;
196
+ this.crop.style.height = `${newHeight}px`;
197
+ break;
198
+ case CornerType.se:
199
+ this.crop.style.width = `${newWidth}px`;
200
+ this.crop.style.height = `${newHeight}px`;
201
+ break;
202
+ case CornerType.sw:
203
+ this.crop.style.left = `${left}px`;
204
+ this.crop.style.width = `${newWidth}px`;
205
+ this.crop.style.height = `${newHeight}px`;
206
+ break;
207
+ default:
208
+ break;
209
+ }
210
+ };
211
+ this.handleCropDrag = (ev) => {
212
+ if (!this.isMouseStillInTarget(ev)) {
213
+ return;
214
+ }
215
+ let { movementX, movementY } = getMovementFromEvent(ev, this.previousTouch);
216
+ let newLeft = this.crop.offsetLeft + movementX;
217
+ let newTop = this.crop.offsetTop + movementY;
218
+ var imageRect = this.image.getBoundingClientRect();
219
+ var cropRect = this.crop.getBoundingClientRect();
220
+ if (newLeft < 0) {
221
+ newLeft = 0;
222
+ }
223
+ if (newTop < 0) {
224
+ newTop = 0;
225
+ }
226
+ if (newLeft + cropRect.width > imageRect.width) {
227
+ newLeft = this.crop.offsetLeft;
228
+ }
229
+ if (newTop + cropRect.height > imageRect.height) {
230
+ newTop = this.crop.offsetTop;
231
+ }
232
+ this.crop.style.left = newLeft + "px";
233
+ this.crop.style.top = newTop + "px";
234
+ };
235
+ }
236
+ componentDidLoad() {
237
+ requestAnimationFrame(() => {
238
+ this.setView("noPictureView");
239
+ });
240
+ }
241
+ setView(newView) {
242
+ const views = this.host.shadowRoot.querySelectorAll(".view");
243
+ views.forEach(v => v.classList.remove("visible"));
244
+ switch (newView) {
245
+ case "noPictureView":
246
+ this.noPictureView.classList.add("visible");
247
+ break;
248
+ case "hasPictureView":
249
+ this.hasPictureView.classList.add("visible");
250
+ break;
251
+ default:
252
+ break;
253
+ }
254
+ this.view = newView;
255
+ }
256
+ initCrop() {
257
+ var wantedRatio = this.width / this.height;
258
+ var imageRect = this.image.getBoundingClientRect();
259
+ var imageRatio = imageRect.width / imageRect.height;
260
+ if (wantedRatio > imageRatio) {
261
+ var wantedHeight = imageRect.width / wantedRatio;
262
+ var diff = imageRect.height - wantedHeight;
263
+ this.crop.style.top = Math.round(diff / 2).toString() + "px";
264
+ this.crop.style.height = Math.round(wantedHeight).toString() + "px";
265
+ }
266
+ else {
267
+ var wantedWidth = imageRect.height * wantedRatio;
268
+ var diff = imageRect.width - wantedWidth;
269
+ this.crop.style.left = Math.round(diff / 2).toString() + "px";
270
+ this.crop.style.width = Math.round(wantedWidth).toString() + "px";
271
+ }
272
+ }
273
+ setImage() {
274
+ this.image.addEventListener('load', () => {
275
+ this.initCrop();
276
+ this.emitImage();
277
+ });
278
+ this.image.src = this.canvas.toDataURL();
279
+ }
280
+ handleNewFile(file) {
281
+ if (file.type.split('/')[0] != "image") {
282
+ return;
283
+ }
284
+ var reader = new FileReader();
285
+ reader.onload = readerLoadEvent => {
286
+ var img = new Image();
287
+ img.onload = () => {
288
+ this.canvas.width = img.width;
289
+ this.canvas.height = img.height;
290
+ if (this.preventUndersized && (img.width < this.width || img.height < this.height)) {
291
+ this.imageTooSmallModal.show();
292
+ return;
293
+ }
294
+ var ctx = this.canvas.getContext("2d");
295
+ ctx.drawImage(img, 0, 0);
296
+ this.setView("hasPictureView");
297
+ this.setImage();
298
+ };
299
+ img.src = readerLoadEvent.target.result.toString();
300
+ };
301
+ reader.readAsDataURL(file);
302
+ }
303
+ emitImage() {
304
+ var x = this.crop.offsetLeft / this.image.width * this.image.naturalWidth;
305
+ var y = this.crop.offsetTop / this.image.height * this.image.naturalHeight;
306
+ var cropRect = this.crop.getBoundingClientRect();
307
+ var width = cropRect.width / this.image.width * this.image.naturalWidth;
308
+ var height = cropRect.height / this.image.height * this.image.naturalHeight;
309
+ if (x < 0)
310
+ x = 0;
311
+ if (x > this.image.naturalWidth)
312
+ x = this.image.naturalWidth;
313
+ if (y < 0)
314
+ y = 0;
315
+ if (y > this.image.naturalWidth)
316
+ y = this.image.naturalWidth;
317
+ if (width > this.image.naturalWidth)
318
+ width = this.image.naturalWidth;
319
+ if (height > this.image.naturalHeight)
320
+ height = this.image.naturalHeight;
321
+ var dataUrl = this.generateCroppedImage(x, y, width, height, this.width, this.height);
322
+ this.imageCropChanged.emit(dataUrl);
323
+ }
324
+ generateCroppedImage(x, y, width, height, desiredWidth, desiredHeight) {
325
+ this.canvas.width = desiredWidth;
326
+ this.canvas.height = desiredHeight;
327
+ const context = this.canvas.getContext("2d");
328
+ context.clearRect(0, 0, desiredWidth, desiredHeight);
329
+ context.drawImage(this.image, x, y, width, height, 0, 0, desiredWidth, desiredHeight);
330
+ return this.canvas.toDataURL("image/jpeg", this.quality);
331
+ }
332
+ getCornerLeftTop(corner) {
333
+ let left = 0;
334
+ let top = 0;
335
+ switch (corner) {
336
+ case CornerType.se:
337
+ left = this.crop.offsetLeft;
338
+ top = this.crop.offsetTop;
339
+ break;
340
+ case CornerType.sw:
341
+ top = this.crop.offsetTop;
342
+ break;
343
+ default:
344
+ break;
345
+ }
346
+ return { top, left };
347
+ }
348
+ isMouseStillInTarget(event) {
349
+ var inside = false;
350
+ let mouseX;
351
+ let mouseY;
352
+ const imageRect = this.image.getBoundingClientRect();
353
+ if (event instanceof MouseEvent) {
354
+ mouseX = event.clientX;
355
+ mouseY = event.clientY;
356
+ }
357
+ if (typeof TouchEvent !== "undefined") {
358
+ if (event instanceof TouchEvent) {
359
+ var touch = event.touches[0];
360
+ mouseX = touch.clientX;
361
+ mouseY = touch.clientY;
362
+ }
363
+ }
364
+ if (mouseX >= imageRect.x &&
365
+ mouseY >= imageRect.y &&
366
+ mouseX <= imageRect.left + imageRect.width &&
367
+ mouseY <= imageRect.top + imageRect.height) {
368
+ inside = true;
369
+ }
370
+ var corners = this.crop.querySelectorAll("div");
371
+ corners.forEach(corner => {
372
+ var cornerRect = corner.getBoundingClientRect();
373
+ if (mouseX >= cornerRect.x &&
374
+ mouseY >= cornerRect.y &&
375
+ mouseX <= cornerRect.left + cornerRect.width &&
376
+ mouseY <= cornerRect.top + cornerRect.height) {
377
+ inside = true;
378
+ }
379
+ });
380
+ return inside;
381
+ }
382
+ render() {
383
+ return (h(Host, { ref: el => this.host = el },
384
+ h("canvas", { ref: el => this.canvas = el }),
385
+ h("div", { class: "view", ref: el => this.hasPictureView = el },
386
+ h("div", { class: "cropper" },
387
+ h("img", { ref: el => this.image = el }),
388
+ h("div", { class: "backdrop" }),
389
+ h("div", { class: "crop", ref: e => this.crop = e, onMouseDown: this.handleCropMouseDown, onTouchStart: this.handleCropMouseDown },
390
+ h("div", { class: "nw" }),
391
+ h("div", { class: "ne" }),
392
+ h("div", { class: "se" }),
393
+ h("div", { class: "sw" })))),
394
+ h("div", { class: "view", ref: el => this.noPictureView = el },
395
+ h("dnn-dropzone", { allowCameraMode: true, onFilesSelected: e => this.handleNewFile(e.detail[0]), resx: {
396
+ capture: this.resx.capture,
397
+ dragAndDropFile: this.resx.dragAndDropFile,
398
+ or: this.resx.or,
399
+ takePicture: this.resx.takePicture,
400
+ uploadFile: this.resx.uploadFile,
401
+ } })),
402
+ h("dnn-modal", { ref: el => this.imageTooSmallModal = el, "close-text": this.resx.modalCloseText },
403
+ h("p", null, this.resx.imageTooSmall.replace("{width}", this.width.toString()).replace("{height}", this.height.toString())))));
404
+ }
405
+ static get is() { return "dnn-image-cropper"; }
406
+ static get encapsulation() { return "shadow"; }
407
+ static get originalStyleUrls() { return {
408
+ "$": ["dnn-image-cropper.scss"]
409
+ }; }
410
+ static get styleUrls() { return {
411
+ "$": ["dnn-image-cropper.css"]
412
+ }; }
413
+ static get properties() { return {
414
+ "width": {
415
+ "type": "number",
416
+ "mutable": false,
417
+ "complexType": {
418
+ "original": "number",
419
+ "resolved": "number",
420
+ "references": {}
421
+ },
422
+ "required": false,
423
+ "optional": false,
424
+ "docs": {
425
+ "tags": [],
426
+ "text": "Sets the desired final image width."
427
+ },
428
+ "attribute": "width",
429
+ "reflect": false,
430
+ "defaultValue": "600"
431
+ },
432
+ "height": {
433
+ "type": "number",
434
+ "mutable": false,
435
+ "complexType": {
436
+ "original": "number",
437
+ "resolved": "number",
438
+ "references": {}
439
+ },
440
+ "required": false,
441
+ "optional": false,
442
+ "docs": {
443
+ "tags": [],
444
+ "text": "Sets the desired final image height."
445
+ },
446
+ "attribute": "height",
447
+ "reflect": false,
448
+ "defaultValue": "600"
449
+ },
450
+ "resx": {
451
+ "type": "unknown",
452
+ "mutable": false,
453
+ "complexType": {
454
+ "original": "{\n capture: string;\n dragAndDropFile: string;\n or: string;\n takePicture: string;\n uploadFile: string;\n imageTooSmall: string;\n modalCloseText: string;\n }",
455
+ "resolved": "{ capture: string; dragAndDropFile: string; or: string; takePicture: string; uploadFile: string; imageTooSmall: string; modalCloseText: string; }",
456
+ "references": {}
457
+ },
458
+ "required": false,
459
+ "optional": false,
460
+ "docs": {
461
+ "tags": [],
462
+ "text": "Can be used to customize controls text.\nSome values support tokens, see default values for examples."
463
+ },
464
+ "defaultValue": "{\n capture: \"Capture\",\n dragAndDropFile: \"Drag and drop an image\",\n or: \"or\",\n takePicture: \"Take a picture\",\n uploadFile: \"Upload an image\",\n imageTooSmall: \"The image you are attempting to upload does not meet the minimum size requirement of {width} pixels by {height} pixels. Please upload a larger image.\",\n modalCloseText: \"Close\",\n }"
465
+ },
466
+ "quality": {
467
+ "type": "number",
468
+ "mutable": false,
469
+ "complexType": {
470
+ "original": "number",
471
+ "resolved": "number",
472
+ "references": {}
473
+ },
474
+ "required": false,
475
+ "optional": false,
476
+ "docs": {
477
+ "tags": [],
478
+ "text": "Sets the output quality of the corpped image (number between 0 and 1)."
479
+ },
480
+ "attribute": "quality",
481
+ "reflect": false,
482
+ "defaultValue": "0.8"
483
+ },
484
+ "preventUndersized": {
485
+ "type": "boolean",
486
+ "mutable": false,
487
+ "complexType": {
488
+ "original": "boolean",
489
+ "resolved": "boolean",
490
+ "references": {}
491
+ },
492
+ "required": false,
493
+ "optional": false,
494
+ "docs": {
495
+ "tags": [],
496
+ "text": "When set to true, prevents cropping an image smaller than the required size, which would blow pixel and make the final picture look blurry."
497
+ },
498
+ "attribute": "prevent-undersized",
499
+ "reflect": false,
500
+ "defaultValue": "false"
501
+ }
502
+ }; }
503
+ static get states() { return {
504
+ "view": {}
505
+ }; }
506
+ static get events() { return [{
507
+ "method": "imageCropChanged",
508
+ "name": "imageCropChanged",
509
+ "bubbles": true,
510
+ "cancelable": true,
511
+ "composed": true,
512
+ "docs": {
513
+ "tags": [],
514
+ "text": "When the image crop changes, emits the dataurl for the new cropped image."
515
+ },
516
+ "complexType": {
517
+ "original": "string",
518
+ "resolved": "string",
519
+ "references": {}
520
+ }
521
+ }]; }
522
+ }
523
523
  //# sourceMappingURL=dnn-image-cropper.js.map