@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,502 +1,502 @@
1
- import { r as registerInstance, e as createEvent, h, g as getElement } from './index-b5a28c1d.js';
2
- import { D as Debounce } from './debounce-06f55268.js';
1
+ import { r as registerInstance, e as createEvent, h, g as getElement } from './index-20e42ad7.js';
2
+ import { D as Debounce } from './debounce-6be67abd.js';
3
3
 
4
- /** Color utility class with hsl and rgb converters
5
- * based on math at https://en.wikipedia.org/wiki/HSL_and_HSV
6
- * @copyright Copyright (c) .NET Foundation. All rights reserved.
7
- * @license MIT
8
- */
9
- class ColorInfo {
10
- constructor() {
11
- this._hue = 0;
12
- this._saturation = 0;
13
- this._lightness = 0;
14
- }
15
- /** gets the color hue
16
- * @returns a number between 0 and 359, could contain decimals
17
- */
18
- get hue() { return this._hue; }
19
- set hue(value) {
20
- if (value < 0) {
21
- value = 0;
22
- }
23
- if (value > 359) {
24
- value = 359;
25
- }
26
- this._hue = value;
27
- }
28
- /** gets the color saturation
29
- * @returns a number between 0 and 1, could contain decimals
30
- */
31
- get saturation() { return this._saturation; }
32
- set saturation(value) {
33
- if (value < 0) {
34
- value = 0;
35
- }
36
- if (value > 1) {
37
- value = 1;
38
- }
39
- this._saturation = value;
40
- }
41
- /** gets the color lightness
42
- * @returns a number between 0 and 1, could contain decimals
43
- */
44
- get lightness() { return this._lightness; }
45
- set lightness(value) {
46
- if (value < 0) {
47
- value = 0;
48
- }
49
- if (value > 1) {
50
- value = 1;
51
- }
52
- this._lightness = value;
53
- }
54
- /** gets or sets the red component
55
- * @returns an integer between 0 and 255
56
- */
57
- get red() {
58
- return this.getRGB().red;
59
- }
60
- set red(value) {
61
- this.setHSL(value, this.green, this.blue);
62
- }
63
- /** gets or sets the green component
64
- * @returns an integer between 0 and 255
65
- */
66
- get green() {
67
- return this.getRGB().green;
68
- }
69
- set green(value) {
70
- this.setHSL(this.red, value, this.blue);
71
- }
72
- /** gets or sets the blue component
73
- * @returns an integer between 0 and 255
74
- */
75
- get blue() {
76
- return this.getRGB().blue;
77
- }
78
- set blue(value) {
79
- this.setHSL(this.red, this.green, value);
80
- }
81
- /** gets or sets the hex color value, expresses as 6 hexadecimal characters.
82
- * @returns hex representation of the color
83
- */
84
- get hex() {
85
- var r = this.getHex(this.red);
86
- var g = this.getHex(this.green);
87
- var b = this.getHex(this.blue);
88
- return r + g + b;
89
- }
90
- set hex(value) {
91
- this.red = parseInt(value.substr(0, 2));
92
- this.green = parseInt(value.substr(2, 2));
93
- this.blue = parseInt(value.substr(4, 2));
94
- }
95
- /** gets white or black color that is a good oposite to the current color
96
- * @returns - "000000" or "FFFFFF"
97
- */
98
- get contrastColor() {
99
- const brightness = (this.red * 299 + this.green * 587 + this.blue * 114) / 1000;
100
- if (brightness > 127) {
101
- return "000000";
102
- }
103
- return "FFFFFF";
104
- }
105
- getRGB() {
106
- const chroma = (1 - Math.abs((2 * this._lightness) - 1)) * this.saturation;
107
- // find the quandrant of the hue
108
- const quadrant = this._hue / 60;
109
- // calculate the offset from the quandrant center
110
- const offset = chroma * (1 - Math.abs(quadrant % 2 - 1));
111
- // Apply the chroma to the primary component and the offset to the 2nd most important component
112
- let r = 0, g = 0, b = 0;
113
- if (0 <= quadrant && quadrant <= 1) {
114
- r = chroma;
115
- g = offset; // red to yellow
116
- }
117
- else if (1 <= quadrant && quadrant <= 2) {
118
- g = chroma;
119
- r = offset; // yellow to green
120
- }
121
- else if (2 <= quadrant && quadrant <= 3) {
122
- g = chroma;
123
- b = offset; // green to cyan
124
- }
125
- else if (3 <= quadrant && quadrant <= 4) {
126
- b = chroma;
127
- g = offset; // cyan to blue
128
- }
129
- else if (4 <= quadrant && quadrant <= 5) {
130
- b = chroma;
131
- r = offset; // blue to magenta
132
- }
133
- else if (5 <= quadrant && quadrant <= 6) {
134
- r = chroma;
135
- b = offset; // magenta to red
136
- }
137
- // calculate the bias to add to all channels to match the lightness
138
- const bias = this._lightness - (chroma / 2);
139
- return {
140
- red: Math.round((r + bias) * 255),
141
- green: Math.round((g + bias) * 255),
142
- blue: Math.round((b + bias) * 255)
143
- };
144
- }
145
- setHSL(red, green, blue) {
146
- // GENERAL DATA
147
- // all math is based on values from 0 to 1
148
- const r = red / 255, g = green / 255, b = blue / 255;
149
- // we need to max, min and the difference between them to derive hsl
150
- const min = Math.min(r, g, b);
151
- const max = Math.max(r, g, b);
152
- const diff = max - min;
153
- let h = 0, s = 0, l = 0;
154
- // HUE
155
- if (diff === 0) { // neutral
156
- h = 0;
157
- }
158
- else if (max === r) { // red (magenta to yellow range)
159
- h = 60 * ((g - b) / diff);
160
- }
161
- else if (max === g) { // green (yellow to cyan range)
162
- h = 60 * (2 + ((b - r) / diff));
163
- }
164
- else if (max === b) { // blue (cyan to magenta range)
165
- h = 60 * (4 + ((r - g) / diff));
166
- }
167
- if (h < 0) {
168
- h = h + 360;
169
- } // ensures positive hues only
170
- if (h > 359) {
171
- h = 359;
172
- } // ensures we never return 360 for simplicity since it is the same as 0
173
- // LIGHTNESS
174
- l = (max + min) / 2;
175
- // SATURATION
176
- if (max === 0 || min === 1) { // pure black or white have no saturation
177
- s = 0;
178
- }
179
- else {
180
- s = (max - l) / (Math.min(l, 1 - l));
181
- }
182
- this._hue = h;
183
- this._saturation = s;
184
- this._lightness = l;
185
- }
186
- getHex(value) {
187
- var hex = value.toString(16);
188
- if (hex.length < 2) {
189
- hex = "0" + hex;
190
- }
191
- return hex;
192
- }
4
+ /** Color utility class with hsl and rgb converters
5
+ * based on math at https://en.wikipedia.org/wiki/HSL_and_HSV
6
+ * @copyright Copyright (c) .NET Foundation. All rights reserved.
7
+ * @license MIT
8
+ */
9
+ class ColorInfo {
10
+ constructor() {
11
+ this._hue = 0;
12
+ this._saturation = 0;
13
+ this._lightness = 0;
14
+ }
15
+ /** gets the color hue
16
+ * @returns a number between 0 and 359, could contain decimals
17
+ */
18
+ get hue() { return this._hue; }
19
+ set hue(value) {
20
+ if (value < 0) {
21
+ value = 0;
22
+ }
23
+ if (value > 359) {
24
+ value = 359;
25
+ }
26
+ this._hue = value;
27
+ }
28
+ /** gets the color saturation
29
+ * @returns a number between 0 and 1, could contain decimals
30
+ */
31
+ get saturation() { return this._saturation; }
32
+ set saturation(value) {
33
+ if (value < 0) {
34
+ value = 0;
35
+ }
36
+ if (value > 1) {
37
+ value = 1;
38
+ }
39
+ this._saturation = value;
40
+ }
41
+ /** gets the color lightness
42
+ * @returns a number between 0 and 1, could contain decimals
43
+ */
44
+ get lightness() { return this._lightness; }
45
+ set lightness(value) {
46
+ if (value < 0) {
47
+ value = 0;
48
+ }
49
+ if (value > 1) {
50
+ value = 1;
51
+ }
52
+ this._lightness = value;
53
+ }
54
+ /** gets or sets the red component
55
+ * @returns an integer between 0 and 255
56
+ */
57
+ get red() {
58
+ return this.getRGB().red;
59
+ }
60
+ set red(value) {
61
+ this.setHSL(value, this.green, this.blue);
62
+ }
63
+ /** gets or sets the green component
64
+ * @returns an integer between 0 and 255
65
+ */
66
+ get green() {
67
+ return this.getRGB().green;
68
+ }
69
+ set green(value) {
70
+ this.setHSL(this.red, value, this.blue);
71
+ }
72
+ /** gets or sets the blue component
73
+ * @returns an integer between 0 and 255
74
+ */
75
+ get blue() {
76
+ return this.getRGB().blue;
77
+ }
78
+ set blue(value) {
79
+ this.setHSL(this.red, this.green, value);
80
+ }
81
+ /** gets or sets the hex color value, expresses as 6 hexadecimal characters.
82
+ * @returns hex representation of the color
83
+ */
84
+ get hex() {
85
+ var r = this.getHex(this.red);
86
+ var g = this.getHex(this.green);
87
+ var b = this.getHex(this.blue);
88
+ return r + g + b;
89
+ }
90
+ set hex(value) {
91
+ this.red = parseInt(value.substr(0, 2));
92
+ this.green = parseInt(value.substr(2, 2));
93
+ this.blue = parseInt(value.substr(4, 2));
94
+ }
95
+ /** gets white or black color that is a good oposite to the current color
96
+ * @returns - "000000" or "FFFFFF"
97
+ */
98
+ get contrastColor() {
99
+ const brightness = (this.red * 299 + this.green * 587 + this.blue * 114) / 1000;
100
+ if (brightness > 127) {
101
+ return "000000";
102
+ }
103
+ return "FFFFFF";
104
+ }
105
+ getRGB() {
106
+ const chroma = (1 - Math.abs((2 * this._lightness) - 1)) * this.saturation;
107
+ // find the quandrant of the hue
108
+ const quadrant = this._hue / 60;
109
+ // calculate the offset from the quandrant center
110
+ const offset = chroma * (1 - Math.abs(quadrant % 2 - 1));
111
+ // Apply the chroma to the primary component and the offset to the 2nd most important component
112
+ let r = 0, g = 0, b = 0;
113
+ if (0 <= quadrant && quadrant <= 1) {
114
+ r = chroma;
115
+ g = offset; // red to yellow
116
+ }
117
+ else if (1 <= quadrant && quadrant <= 2) {
118
+ g = chroma;
119
+ r = offset; // yellow to green
120
+ }
121
+ else if (2 <= quadrant && quadrant <= 3) {
122
+ g = chroma;
123
+ b = offset; // green to cyan
124
+ }
125
+ else if (3 <= quadrant && quadrant <= 4) {
126
+ b = chroma;
127
+ g = offset; // cyan to blue
128
+ }
129
+ else if (4 <= quadrant && quadrant <= 5) {
130
+ b = chroma;
131
+ r = offset; // blue to magenta
132
+ }
133
+ else if (5 <= quadrant && quadrant <= 6) {
134
+ r = chroma;
135
+ b = offset; // magenta to red
136
+ }
137
+ // calculate the bias to add to all channels to match the lightness
138
+ const bias = this._lightness - (chroma / 2);
139
+ return {
140
+ red: Math.round((r + bias) * 255),
141
+ green: Math.round((g + bias) * 255),
142
+ blue: Math.round((b + bias) * 255)
143
+ };
144
+ }
145
+ setHSL(red, green, blue) {
146
+ // GENERAL DATA
147
+ // all math is based on values from 0 to 1
148
+ const r = red / 255, g = green / 255, b = blue / 255;
149
+ // we need to max, min and the difference between them to derive hsl
150
+ const min = Math.min(r, g, b);
151
+ const max = Math.max(r, g, b);
152
+ const diff = max - min;
153
+ let h = 0, s = 0, l = 0;
154
+ // HUE
155
+ if (diff === 0) { // neutral
156
+ h = 0;
157
+ }
158
+ else if (max === r) { // red (magenta to yellow range)
159
+ h = 60 * ((g - b) / diff);
160
+ }
161
+ else if (max === g) { // green (yellow to cyan range)
162
+ h = 60 * (2 + ((b - r) / diff));
163
+ }
164
+ else if (max === b) { // blue (cyan to magenta range)
165
+ h = 60 * (4 + ((r - g) / diff));
166
+ }
167
+ if (h < 0) {
168
+ h = h + 360;
169
+ } // ensures positive hues only
170
+ if (h > 359) {
171
+ h = 359;
172
+ } // ensures we never return 360 for simplicity since it is the same as 0
173
+ // LIGHTNESS
174
+ l = (max + min) / 2;
175
+ // SATURATION
176
+ if (max === 0 || min === 1) { // pure black or white have no saturation
177
+ s = 0;
178
+ }
179
+ else {
180
+ s = (max - l) / (Math.min(l, 1 - l));
181
+ }
182
+ this._hue = h;
183
+ this._saturation = s;
184
+ this._lightness = l;
185
+ }
186
+ getHex(value) {
187
+ var hex = value.toString(16);
188
+ if (hex.length < 2) {
189
+ hex = "0" + hex;
190
+ }
191
+ return hex;
192
+ }
193
193
  }
194
194
 
195
195
  const dnnColorPickerCss = ".dnn-color-picker{padding:15px;max-width:400px}.dnn-color-picker .dnn-color-sliders{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;min-width:200px}.dnn-color-picker .dnn-color-sliders .dnn-color-s-b{border:1px solid #ccc;padding-bottom:var(--color-box-height, 50%);position:relative;background-color:red}.dnn-color-picker .dnn-color-sliders .dnn-color-s-b:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;z-index:1;background:-webkit-gradient(linear, left top, right top, from(white), to(red));background:linear-gradient(to right, white, red);mix-blend-mode:saturation}.dnn-color-picker .dnn-color-sliders .dnn-color-s-b:after{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;z-index:2;background:-webkit-gradient(linear, left top, left bottom, from(white), to(black));background:linear-gradient(to bottom, white, black);mix-blend-mode:luminosity}.dnn-color-picker .dnn-color-sliders .dnn-color-s-b button{position:absolute;bottom:calc(50% - 4px);left:calc(50% - 4px);width:8px;height:8px;z-index:3;display:block;background:none;border:none;margin-left:-4px;margin-bottom:-4px;padding:7px;background-color:#fff;border-radius:50%}.dnn-color-picker .dnn-color-sliders .dnn-color-s-b button:before{content:\"\";position:absolute;top:-1px;left:-1px;border-radius:50%}.dnn-color-picker .dnn-color-sliders .dnn-color-s-b button:after{content:\"\";position:absolute;top:0px;left:0px;border-radius:50%;width:10px;height:10px;border:2px solid #ccc}.dnn-color-picker .dnn-color-sliders .dnn-color-bar{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin-top:15px}.dnn-color-picker .dnn-color-sliders .dnn-color-bar .dnn-color-result{-ms-flex-direction:column;flex-direction:column;width:50px;height:50px;border-radius:50%;background:red}.dnn-color-picker .dnn-color-sliders .dnn-color-bar .dnn-color-hue{-ms-flex:auto;flex:auto;margin-left:10px;height:16px;border:1px solid #ccc;position:relative;background:-webkit-gradient(linear, left top, right top, color-stop(0, #f00), color-stop(17%, #ff0), color-stop(33%, #0f0), color-stop(50%, #0ff), color-stop(67%, #00f), color-stop(84%, #f0f), to(#f00));background:linear-gradient(to right, #f00 0, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 84%, #f00 100%)}.dnn-color-picker .dnn-color-sliders .dnn-color-bar .dnn-color-hue button{width:10px;height:20px;position:absolute;top:-2px;left:calc(50% - 4px);border:0;padding:0;background-color:transparent;padding-left:-8px}.dnn-color-picker .dnn-color-sliders .dnn-color-bar .dnn-color-hue button:before{content:\"\";position:absolute;top:-2px;left:0px;border-radius:3px;width:100%;height:100%;border:1px solid #ccc;background-color:#fff}.dnn-color-picker .dnn-color-fields{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:justify;justify-content:space-between}.dnn-color-picker .dnn-color-fields .dnn-color-mode-switch{display:-ms-flexbox;display:flex;-ms-flex-align:end;align-items:flex-end;padding:0.5em}.dnn-color-picker .dnn-color-fields .dnn-color-mode-switch button{background-color:transparent;border:none}.dnn-color-picker .dnn-color-fields .dnn-color-mode-switch button svg{width:3em;height:3em;pointer-events:none;outline:none}.dnn-color-picker .dnn-color-fields .dnn-rgb-color-fields{display:-ms-flexbox;display:flex;-ms-flex-pack:space-evenly;justify-content:space-evenly}.dnn-color-picker .dnn-color-fields .dnn-rgb-color-fields .dnn-rgb-color-field{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex:auto;flex:auto;text-align:center;padding:0.5em}.dnn-color-picker .dnn-color-fields .dnn-rgb-color-fields .dnn-rgb-color-field label{padding-bottom:0.25em}.dnn-color-picker .dnn-color-fields .dnn-rgb-color-fields .dnn-rgb-color-field input{border-radius:var(--dnn-button-radius, 3px);border:1px solid #ccc;padding:0.5em;padding-left:1.3em;text-align:center}.dnn-color-picker .dnn-color-fields .dnn-rgb-color-fields .dnn-rgb-color-field input.red{border-color:red}.dnn-color-picker .dnn-color-fields .dnn-rgb-color-fields .dnn-rgb-color-field input.green{border-color:green}.dnn-color-picker .dnn-color-fields .dnn-rgb-color-fields .dnn-rgb-color-field input.blue{border-color:blue}.dnn-color-picker .dnn-color-fields .dnn-hsl-color-fields{display:-ms-flexbox;display:flex;-ms-flex-pack:space-evenly;justify-content:space-evenly}.dnn-color-picker .dnn-color-fields .dnn-hsl-color-fields .dnn-hsl-color-field{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex:auto;flex:auto;text-align:center;padding:0.5em}.dnn-color-picker .dnn-color-fields .dnn-hsl-color-fields .dnn-hsl-color-field label{padding-bottom:0.25em}.dnn-color-picker .dnn-color-fields .dnn-hsl-color-fields .dnn-hsl-color-field input{border-radius:var(--dnn-button-radius, 3px);border:1px solid #ccc;padding:0.5em;padding-left:1.3em;text-align:center}.dnn-color-picker .dnn-color-fields .dnn-hex-color-fields{display:-ms-flexbox;display:flex;-ms-flex-pack:space-evenly;justify-content:space-evenly}.dnn-color-picker .dnn-color-fields .dnn-hex-color-fields .dnn-hex-color-field{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex:auto;flex:auto;text-align:center;padding:0.5em}.dnn-color-picker .dnn-color-fields .dnn-hex-color-fields .dnn-hex-color-field label{padding-bottom:0.25em}.dnn-color-picker .dnn-color-fields .dnn-hex-color-fields .dnn-hex-color-field .hex-input{position:relative;border-radius:var(--dnn-button-radius, 3px);border:1px solid #ccc;padding:0.323em;text-align:center}.dnn-color-picker .dnn-color-fields .dnn-hex-color-fields .dnn-hex-color-field .hex-input input{border:0;padding:0;margin:0;width:100%;height:100%;text-align:center}.dnn-color-picker .dnn-color-fields .dnn-hex-color-fields .dnn-hex-color-field .hex-input button{position:absolute;height:100%;top:0;right:1em;background-color:transparent;border:0;padding:0;margin:0}.dnn-color-picker .dnn-color-fields .dnn-hex-color-fields .dnn-hex-color-field .hex-input button svg{min-width:1em}";
196
196
 
197
- /** Reusable DNN UI component to pick a color
198
- * @copyright Copyright (c) .NET Foundation. All rights reserved.
199
- * @license MIT
200
- */
201
- var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
202
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
203
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
204
- r = Reflect.decorate(decorators, target, key, desc);
205
- else
206
- for (var i = decorators.length - 1; i >= 0; i--)
207
- if (d = decorators[i])
208
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
209
- return c > 3 && r && Object.defineProperty(target, key, r), r;
210
- };
211
- let DnnColorPicker = class {
212
- constructor(hostRef) {
213
- registerInstance(this, hostRef);
214
- this.colorChanged = createEvent(this, "colorChanged", 7);
215
- /** Sets the initial color, must be a valid 8 character hexadecimal string without the # sign. */
216
- this.color = "FFFFFF";
217
- /** Sets the width-height ratio of the color picker saturation-lightness box.
218
- * @example 100% renders a perfect square
219
- */
220
- this.colorBoxHeight = "50%";
221
- this.rgbDisplay = "flex";
222
- this.hslDisplay = "none";
223
- this.hexDisplay = "none";
224
- this.handleSaturationLightnessMouseDown = (e) => {
225
- e.preventDefault();
226
- this.handleDragLightnessSaturation(e);
227
- window.addEventListener('mousemove', this.handleDragLightnessSaturation);
228
- window.addEventListener('mouseup', this.handleSaturationLightnessMouseUp);
229
- };
230
- this.handleDragLightnessSaturation = (e) => {
231
- const rect = this.saturationLightnessBox.getBoundingClientRect();
232
- let x = e.clientX - rect.left;
233
- if (x < 0) {
234
- x = 0;
235
- }
236
- if (x > rect.width) {
237
- x = rect.width;
238
- }
239
- x = x / rect.width;
240
- let y = e.clientY - rect.top;
241
- if (y < 0) {
242
- y = 0;
243
- }
244
- if (y > rect.height) {
245
- y = rect.height;
246
- }
247
- y = 1 - (y / rect.height);
248
- const newColor = new ColorInfo();
249
- newColor.hue = this.currentColor.hue;
250
- newColor.saturation = x;
251
- newColor.lightness = y;
252
- this.currentColor = newColor;
253
- };
254
- this.handleSaturationLightnessMouseUp = () => {
255
- window.removeEventListener('mousemove', this.handleDragLightnessSaturation);
256
- window.removeEventListener('mouseup', this.handleSaturationLightnessMouseUp);
257
- };
258
- this.handleHueMouseDown = (e) => {
259
- e.preventDefault();
260
- this.handleDragHue(e);
261
- window.addEventListener('mousemove', this.handleDragHue);
262
- window.addEventListener('mouseup', this.handleHueMouseUp);
263
- };
264
- this.handleHueMouseUp = () => {
265
- window.removeEventListener('mousemove', this.handleDragHue);
266
- window.removeEventListener('mouseup', this.handleHueMouseUp);
267
- };
268
- this.handleDragHue = (e) => {
269
- const rect = this.hueRange.getBoundingClientRect();
270
- let x = e.clientX - rect.left;
271
- if (x < 0) {
272
- x = 0;
273
- }
274
- if (x > rect.width) {
275
- x = rect.width;
276
- }
277
- x = x / rect.width * 360;
278
- const newColor = new ColorInfo();
279
- newColor.hue = x;
280
- newColor.saturation = this.currentColor.saturation;
281
- newColor.lightness = this.currentColor.lightness;
282
- this.currentColor = newColor;
283
- };
284
- this.handleComponentValueChange = (e, channel) => {
285
- let value = parseInt(e.target.value);
286
- if (isNaN(value)) {
287
- return;
288
- }
289
- const newColor = new ColorInfo();
290
- if (value < 0) {
291
- value = 0;
292
- }
293
- if (value > 255) {
294
- value = 255;
295
- }
296
- let r = this.currentColor.red;
297
- let g = this.currentColor.green;
298
- let b = this.currentColor.blue;
299
- switch (channel) {
300
- case 'red':
301
- r = value;
302
- break;
303
- case 'green':
304
- g = value;
305
- break;
306
- case 'blue':
307
- b = value;
308
- break;
309
- default:
310
- break;
311
- }
312
- newColor.green = g;
313
- newColor.red = r;
314
- newColor.blue = b;
315
- this.currentColor = newColor;
316
- };
317
- this.handleHSLChange = (e, component) => {
318
- let value = parseInt(e.target.value);
319
- if (isNaN(value)) {
320
- return;
321
- }
322
- const newColor = new ColorInfo();
323
- if (value != null) {
324
- let h = this.currentColor.hue;
325
- let s = this.currentColor.saturation;
326
- let l = this.currentColor.lightness;
327
- switch (component) {
328
- case "hue":
329
- if (value < 0) {
330
- value = 0;
331
- }
332
- if (value > 359) {
333
- value = 0;
334
- }
335
- h = value;
336
- break;
337
- case "saturation":
338
- if (value < 0) {
339
- value = 0;
340
- }
341
- if (value > 100) {
342
- value = 100;
343
- }
344
- s = value / 100;
345
- break;
346
- case "lightness":
347
- if (value < 0) {
348
- value = 0;
349
- }
350
- if (value > 100) {
351
- value = 100;
352
- }
353
- l = value / 100;
354
- break;
355
- default:
356
- break;
357
- }
358
- newColor.hue = h;
359
- newColor.saturation = s;
360
- newColor.lightness = l;
361
- this.currentColor = newColor;
362
- }
363
- };
364
- this.handleSaturationLightnessKeyDown = (e) => {
365
- let newColor = new ColorInfo();
366
- newColor.hue = this.currentColor.hue;
367
- newColor.saturation = this.currentColor.saturation;
368
- newColor.lightness = this.currentColor.lightness;
369
- let value = 0.01;
370
- if (e.shiftKey) {
371
- value = 0.1;
372
- }
373
- switch (e.key) {
374
- case "ArrowUp":
375
- newColor.lightness += value;
376
- break;
377
- case "ArrowDown":
378
- newColor.lightness -= value;
379
- break;
380
- case "ArrowLeft":
381
- newColor.saturation -= value;
382
- break;
383
- case "ArrowRight":
384
- newColor.saturation += value;
385
- default:
386
- break;
387
- }
388
- this.currentColor = newColor;
389
- };
390
- this.handleHueKeyDown = (e) => {
391
- let newColor = new ColorInfo();
392
- newColor.hue = this.currentColor.hue;
393
- newColor.saturation = this.currentColor.saturation;
394
- newColor.lightness = this.currentColor.lightness;
395
- let value = 1;
396
- if (e.shiftKey) {
397
- value = 10;
398
- }
399
- switch (e.key) {
400
- case "ArrowLeft":
401
- newColor.hue -= value;
402
- break;
403
- case "ArrowRight":
404
- newColor.hue += value;
405
- default:
406
- break;
407
- }
408
- this.currentColor = newColor;
409
- };
410
- }
411
- colorChangedHandler(color) {
412
- this.colorChanged.emit(color);
413
- }
414
- handeCurrentColorChanged(newValue) {
415
- this.colorChangedHandler(newValue);
416
- }
417
- componentWillLoad() {
418
- this.handleHexChange(this.color);
419
- }
420
- componentDidLoad() {
421
- this.el.style.setProperty("--color-box-height", this.colorBoxHeight.toString());
422
- }
423
- getHex() {
424
- return this.getDoublet(this.currentColor.red) + this.getDoublet(this.currentColor.green) + this.getDoublet(this.currentColor.blue);
425
- }
426
- getContrast() {
427
- return this.currentColor.contrastColor;
428
- }
429
- getDoublet(value) {
430
- const valueString = value.toString(16).toUpperCase();
431
- if (valueString.length === 1) {
432
- return '0' + valueString;
433
- }
434
- return valueString;
435
- }
436
- handleHexChange(value) {
437
- const newColor = new ColorInfo();
438
- if (value.match(/^(?:[\da-f]{3}|[\da-f]{6})$/i).length > 0) {
439
- if (value.length === 3) {
440
- let expanded = value[0] + value[0] + value[1] + value[1] + value[2] + value[2];
441
- value = expanded;
442
- }
443
- newColor.red = parseInt(value.substr(0, 2), 16);
444
- newColor.green = parseInt(value.substr(2, 2), 16);
445
- newColor.blue = parseInt(value.substr(4, 2), 16);
446
- }
447
- else {
448
- newColor.red = this.currentColor.red;
449
- newColor.green = this.currentColor.green;
450
- newColor.blue = this.currentColor.blue;
451
- }
452
- this.currentColor = newColor;
453
- }
454
- switchColorMode(e) {
455
- switch (e.target.id) {
456
- case "rgb-switch":
457
- this.rgbDisplay = "none";
458
- this.hslDisplay = "none";
459
- this.hexDisplay = "flex";
460
- break;
461
- case "hex-switch":
462
- this.rgbDisplay = "none";
463
- this.hslDisplay = "flex";
464
- this.hexDisplay = "none";
465
- break;
466
- case "hsl-switch":
467
- this.rgbDisplay = "flex";
468
- this.hslDisplay = "none";
469
- this.hexDisplay = "none";
470
- break;
471
- default:
472
- this.rgbDisplay = "flex";
473
- this.hslDisplay = "none";
474
- this.hexDisplay = "none";
475
- }
476
- }
477
- render() {
478
- const hue = this.currentColor.hue;
479
- const saturation = this.currentColor.saturation;
480
- const lightness = this.currentColor.lightness;
481
- const red = this.currentColor.red;
482
- const green = this.currentColor.green;
483
- const blue = this.currentColor.blue;
484
- return (h("div", { class: "dnn-color-picker" }, h("div", { class: "dnn-color-sliders" }, h("div", { class: "dnn-color-s-b", ref: (element) => this.saturationLightnessBox = element, style: { backgroundColor: `hsl(${hue},100%,50%)` }, onMouseDown: this.handleSaturationLightnessMouseDown.bind(this) }, h("button", { class: "dnn-s-b-picker", "aria-label": "Press up or down to adjust lightness, left or right to adjust saturation, hold shift to move by 10%", role: "slider", "aria-valuemin": "0", "aria-valuemax": "100", "aria-valuetext": `Saturation: ${Math.round(this.currentColor.saturation * 100)}%, Lightness: ${Math.round(this.currentColor.lightness * 100)}%`, style: {
485
- left: Math.round(saturation * 100) + "%",
486
- bottom: Math.round(lightness * 100) + "%"
487
- }, onKeyDown: (e) => this.handleSaturationLightnessKeyDown(e) })), h("div", { class: "dnn-color-bar" }, h("div", { class: "dnn-color-result", style: {
488
- backgroundColor: '#' + this.getHex(),
489
- boxShadow: "0 0 2px 1px " + "#" + this.getContrast()
490
- } }), h("div", { class: "dnn-color-hue", ref: (element) => this.hueRange = element, onMouseDown: this.handleHueMouseDown.bind(this) }, h("button", { class: "dnn-hue-picker", "aria-label": "Press left or right to adjust hue, hold shift to move by 10 degrees", role: "slider", "aria-valuemin": "0", "aria-valuemax": "359", "aria-valuenow": Math.round(hue), style: { left: (hue / 359 * 100).toString() + "%" }, onKeyDown: (e) => this.handleHueKeyDown(e) })))), h("div", { class: "dnn-color-fields" }, h("div", { class: "dnn-rgb-color-fields", style: { display: this.rgbDisplay } }, h("div", { class: "dnn-rgb-color-field" }, h("label", null, "R"), h("input", { type: "number", min: "0", max: "255", step: "1", class: "red", value: red, "aria-label": "red value", onChange: (e) => this.handleComponentValueChange(e, 'red') })), h("div", { class: "dnn-rgb-color-field" }, h("label", null, "G"), h("input", { type: "number", min: "0", max: "255", class: "green", value: green, "aria-label": "green value", onChange: (e) => this.handleComponentValueChange(e, 'green') })), h("div", { class: "dnn-rgb-color-field" }, h("label", null, "B"), h("input", { type: "number", min: "0", max: "255", class: "blue", value: blue, "aria-label": "blue value", onChange: (e) => this.handleComponentValueChange(e, 'blue') })), h("div", { class: "dnn-color-mode-switch" }, h("button", { id: "rgb-switch", onClick: this.switchColorMode.bind(this), "aria-label": "switch to hexadecimal value entry" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" }, h("path", { d: "M0 0h24v24H0z", fill: "none" }), h("path", { d: "M7 7h10v3l4-4-4-4v3H5v6h2V7zm10 10H7v-3l-4 4 4 4v-3h12v-6h-2v4z" }))))), h("div", { class: "dnn-hsl-color-fields", style: { display: this.hslDisplay } }, h("div", { class: "dnn-hsl-color-field" }, h("label", null, "H"), h("input", { type: "number", min: "0", max: "359", step: 1, value: Math.round(hue), "aria-label": "Hue", onChange: (e) => this.handleHSLChange(e, 'hue') })), h("div", { class: "dnn-hsl-color-field" }, h("label", null, "S"), h("input", { type: "number", min: "0", max: "100", step: 1, value: Math.round(saturation * 100), "aria-label": "Saturation", onChange: (e) => this.handleHSLChange(e, 'saturation') })), h("div", { class: "dnn-hsl-color-field" }, h("label", null, "L"), h("input", { type: "number", min: "0", max: "100", step: 1, value: Math.round(lightness * 100), "aria-label": "Lightness", onChange: (e) => this.handleHSLChange(e, 'lightness') })), h("div", { class: "dnn-color-mode-switch" }, h("button", { id: "hsl-switch", onClick: this.switchColorMode.bind(this), "aria-label": "Switch to red, green, blue entry mode" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" }, h("path", { d: "M0 0h24v24H0z", fill: "none" }), h("path", { d: "M7 7h10v3l4-4-4-4v3H5v6h2V7zm10 10H7v-3l-4 4 4 4v-3h12v-6h-2v4z" }))))), h("div", { class: "dnn-hex-color-fields", style: { display: this.hexDisplay } }, h("div", { class: "dnn-hex-color-field" }, h("label", null, "HEX"), h("div", { class: "hex-input" }, h("input", { type: "text", "aria-label": "Hexadecimal value", value: this.getHex(), onChange: e => this.handleHexChange(e.target.value) }), h("button", { class: "copy", "aria-label": "copy value" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" }, h("path", { d: "M0 0h24v24H0z", fill: "none" }), h("path", { d: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z" }))))), h("div", { class: "dnn-color-mode-switch" }, h("button", { id: "hex-switch", onClick: this.switchColorMode.bind(this), "aria-label": "Switch to hue saturation lightness values" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" }, h("path", { d: "M0 0h24v24H0z", fill: "none" }), h("path", { d: "M7 7h10v3l4-4-4-4v3H5v6h2V7zm10 10H7v-3l-4 4 4 4v-3h12v-6h-2v4z" }))))))));
491
- }
492
- get el() { return getElement(this); }
493
- static get watchers() { return {
494
- "currentColor": ["handeCurrentColorChanged"]
495
- }; }
496
- };
497
- __decorate([
498
- Debounce(100)
499
- ], DnnColorPicker.prototype, "colorChangedHandler", null);
197
+ /** Reusable DNN UI component to pick a color
198
+ * @copyright Copyright (c) .NET Foundation. All rights reserved.
199
+ * @license MIT
200
+ */
201
+ var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
202
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
203
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
204
+ r = Reflect.decorate(decorators, target, key, desc);
205
+ else
206
+ for (var i = decorators.length - 1; i >= 0; i--)
207
+ if (d = decorators[i])
208
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
209
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
210
+ };
211
+ const DnnColorPicker = class {
212
+ constructor(hostRef) {
213
+ registerInstance(this, hostRef);
214
+ this.colorChanged = createEvent(this, "colorChanged", 7);
215
+ /** Sets the initial color, must be a valid 8 character hexadecimal string without the # sign. */
216
+ this.color = "FFFFFF";
217
+ /** Sets the width-height ratio of the color picker saturation-lightness box.
218
+ * @example 100% renders a perfect square
219
+ */
220
+ this.colorBoxHeight = "50%";
221
+ this.rgbDisplay = "flex";
222
+ this.hslDisplay = "none";
223
+ this.hexDisplay = "none";
224
+ this.handleSaturationLightnessMouseDown = (e) => {
225
+ e.preventDefault();
226
+ this.handleDragLightnessSaturation(e);
227
+ window.addEventListener('mousemove', this.handleDragLightnessSaturation);
228
+ window.addEventListener('mouseup', this.handleSaturationLightnessMouseUp);
229
+ };
230
+ this.handleDragLightnessSaturation = (e) => {
231
+ const rect = this.saturationLightnessBox.getBoundingClientRect();
232
+ let x = e.clientX - rect.left;
233
+ if (x < 0) {
234
+ x = 0;
235
+ }
236
+ if (x > rect.width) {
237
+ x = rect.width;
238
+ }
239
+ x = x / rect.width;
240
+ let y = e.clientY - rect.top;
241
+ if (y < 0) {
242
+ y = 0;
243
+ }
244
+ if (y > rect.height) {
245
+ y = rect.height;
246
+ }
247
+ y = 1 - (y / rect.height);
248
+ const newColor = new ColorInfo();
249
+ newColor.hue = this.currentColor.hue;
250
+ newColor.saturation = x;
251
+ newColor.lightness = y;
252
+ this.currentColor = newColor;
253
+ };
254
+ this.handleSaturationLightnessMouseUp = () => {
255
+ window.removeEventListener('mousemove', this.handleDragLightnessSaturation);
256
+ window.removeEventListener('mouseup', this.handleSaturationLightnessMouseUp);
257
+ };
258
+ this.handleHueMouseDown = (e) => {
259
+ e.preventDefault();
260
+ this.handleDragHue(e);
261
+ window.addEventListener('mousemove', this.handleDragHue);
262
+ window.addEventListener('mouseup', this.handleHueMouseUp);
263
+ };
264
+ this.handleHueMouseUp = () => {
265
+ window.removeEventListener('mousemove', this.handleDragHue);
266
+ window.removeEventListener('mouseup', this.handleHueMouseUp);
267
+ };
268
+ this.handleDragHue = (e) => {
269
+ const rect = this.hueRange.getBoundingClientRect();
270
+ let x = e.clientX - rect.left;
271
+ if (x < 0) {
272
+ x = 0;
273
+ }
274
+ if (x > rect.width) {
275
+ x = rect.width;
276
+ }
277
+ x = x / rect.width * 360;
278
+ const newColor = new ColorInfo();
279
+ newColor.hue = x;
280
+ newColor.saturation = this.currentColor.saturation;
281
+ newColor.lightness = this.currentColor.lightness;
282
+ this.currentColor = newColor;
283
+ };
284
+ this.handleComponentValueChange = (e, channel) => {
285
+ let value = parseInt(e.target.value);
286
+ if (isNaN(value)) {
287
+ return;
288
+ }
289
+ const newColor = new ColorInfo();
290
+ if (value < 0) {
291
+ value = 0;
292
+ }
293
+ if (value > 255) {
294
+ value = 255;
295
+ }
296
+ let r = this.currentColor.red;
297
+ let g = this.currentColor.green;
298
+ let b = this.currentColor.blue;
299
+ switch (channel) {
300
+ case 'red':
301
+ r = value;
302
+ break;
303
+ case 'green':
304
+ g = value;
305
+ break;
306
+ case 'blue':
307
+ b = value;
308
+ break;
309
+ default:
310
+ break;
311
+ }
312
+ newColor.green = g;
313
+ newColor.red = r;
314
+ newColor.blue = b;
315
+ this.currentColor = newColor;
316
+ };
317
+ this.handleHSLChange = (e, component) => {
318
+ let value = parseInt(e.target.value);
319
+ if (isNaN(value)) {
320
+ return;
321
+ }
322
+ const newColor = new ColorInfo();
323
+ if (value != null) {
324
+ let h = this.currentColor.hue;
325
+ let s = this.currentColor.saturation;
326
+ let l = this.currentColor.lightness;
327
+ switch (component) {
328
+ case "hue":
329
+ if (value < 0) {
330
+ value = 0;
331
+ }
332
+ if (value > 359) {
333
+ value = 0;
334
+ }
335
+ h = value;
336
+ break;
337
+ case "saturation":
338
+ if (value < 0) {
339
+ value = 0;
340
+ }
341
+ if (value > 100) {
342
+ value = 100;
343
+ }
344
+ s = value / 100;
345
+ break;
346
+ case "lightness":
347
+ if (value < 0) {
348
+ value = 0;
349
+ }
350
+ if (value > 100) {
351
+ value = 100;
352
+ }
353
+ l = value / 100;
354
+ break;
355
+ default:
356
+ break;
357
+ }
358
+ newColor.hue = h;
359
+ newColor.saturation = s;
360
+ newColor.lightness = l;
361
+ this.currentColor = newColor;
362
+ }
363
+ };
364
+ this.handleSaturationLightnessKeyDown = (e) => {
365
+ let newColor = new ColorInfo();
366
+ newColor.hue = this.currentColor.hue;
367
+ newColor.saturation = this.currentColor.saturation;
368
+ newColor.lightness = this.currentColor.lightness;
369
+ let value = 0.01;
370
+ if (e.shiftKey) {
371
+ value = 0.1;
372
+ }
373
+ switch (e.key) {
374
+ case "ArrowUp":
375
+ newColor.lightness += value;
376
+ break;
377
+ case "ArrowDown":
378
+ newColor.lightness -= value;
379
+ break;
380
+ case "ArrowLeft":
381
+ newColor.saturation -= value;
382
+ break;
383
+ case "ArrowRight":
384
+ newColor.saturation += value;
385
+ default:
386
+ break;
387
+ }
388
+ this.currentColor = newColor;
389
+ };
390
+ this.handleHueKeyDown = (e) => {
391
+ let newColor = new ColorInfo();
392
+ newColor.hue = this.currentColor.hue;
393
+ newColor.saturation = this.currentColor.saturation;
394
+ newColor.lightness = this.currentColor.lightness;
395
+ let value = 1;
396
+ if (e.shiftKey) {
397
+ value = 10;
398
+ }
399
+ switch (e.key) {
400
+ case "ArrowLeft":
401
+ newColor.hue -= value;
402
+ break;
403
+ case "ArrowRight":
404
+ newColor.hue += value;
405
+ default:
406
+ break;
407
+ }
408
+ this.currentColor = newColor;
409
+ };
410
+ }
411
+ colorChangedHandler(color) {
412
+ this.colorChanged.emit(color);
413
+ }
414
+ handeCurrentColorChanged(newValue) {
415
+ this.colorChangedHandler(newValue);
416
+ }
417
+ componentWillLoad() {
418
+ this.handleHexChange(this.color);
419
+ }
420
+ componentDidLoad() {
421
+ this.el.style.setProperty("--color-box-height", this.colorBoxHeight.toString());
422
+ }
423
+ getHex() {
424
+ return this.getDoublet(this.currentColor.red) + this.getDoublet(this.currentColor.green) + this.getDoublet(this.currentColor.blue);
425
+ }
426
+ getContrast() {
427
+ return this.currentColor.contrastColor;
428
+ }
429
+ getDoublet(value) {
430
+ const valueString = value.toString(16).toUpperCase();
431
+ if (valueString.length === 1) {
432
+ return '0' + valueString;
433
+ }
434
+ return valueString;
435
+ }
436
+ handleHexChange(value) {
437
+ const newColor = new ColorInfo();
438
+ if (value.match(/^(?:[\da-f]{3}|[\da-f]{6})$/i).length > 0) {
439
+ if (value.length === 3) {
440
+ let expanded = value[0] + value[0] + value[1] + value[1] + value[2] + value[2];
441
+ value = expanded;
442
+ }
443
+ newColor.red = parseInt(value.substr(0, 2), 16);
444
+ newColor.green = parseInt(value.substr(2, 2), 16);
445
+ newColor.blue = parseInt(value.substr(4, 2), 16);
446
+ }
447
+ else {
448
+ newColor.red = this.currentColor.red;
449
+ newColor.green = this.currentColor.green;
450
+ newColor.blue = this.currentColor.blue;
451
+ }
452
+ this.currentColor = newColor;
453
+ }
454
+ switchColorMode(e) {
455
+ switch (e.target.id) {
456
+ case "rgb-switch":
457
+ this.rgbDisplay = "none";
458
+ this.hslDisplay = "none";
459
+ this.hexDisplay = "flex";
460
+ break;
461
+ case "hex-switch":
462
+ this.rgbDisplay = "none";
463
+ this.hslDisplay = "flex";
464
+ this.hexDisplay = "none";
465
+ break;
466
+ case "hsl-switch":
467
+ this.rgbDisplay = "flex";
468
+ this.hslDisplay = "none";
469
+ this.hexDisplay = "none";
470
+ break;
471
+ default:
472
+ this.rgbDisplay = "flex";
473
+ this.hslDisplay = "none";
474
+ this.hexDisplay = "none";
475
+ }
476
+ }
477
+ render() {
478
+ const hue = this.currentColor.hue;
479
+ const saturation = this.currentColor.saturation;
480
+ const lightness = this.currentColor.lightness;
481
+ const red = this.currentColor.red;
482
+ const green = this.currentColor.green;
483
+ const blue = this.currentColor.blue;
484
+ return (h("div", { class: "dnn-color-picker" }, h("div", { class: "dnn-color-sliders" }, h("div", { class: "dnn-color-s-b", ref: (element) => this.saturationLightnessBox = element, style: { backgroundColor: `hsl(${hue},100%,50%)` }, onMouseDown: this.handleSaturationLightnessMouseDown.bind(this) }, h("button", { class: "dnn-s-b-picker", "aria-label": "Press up or down to adjust lightness, left or right to adjust saturation, hold shift to move by 10%", role: "slider", "aria-valuemin": "0", "aria-valuemax": "100", "aria-valuetext": `Saturation: ${Math.round(this.currentColor.saturation * 100)}%, Lightness: ${Math.round(this.currentColor.lightness * 100)}%`, style: {
485
+ left: Math.round(saturation * 100) + "%",
486
+ bottom: Math.round(lightness * 100) + "%"
487
+ }, onKeyDown: (e) => this.handleSaturationLightnessKeyDown(e) })), h("div", { class: "dnn-color-bar" }, h("div", { class: "dnn-color-result", style: {
488
+ backgroundColor: '#' + this.getHex(),
489
+ boxShadow: "0 0 2px 1px " + "#" + this.getContrast()
490
+ } }), h("div", { class: "dnn-color-hue", ref: (element) => this.hueRange = element, onMouseDown: this.handleHueMouseDown.bind(this) }, h("button", { class: "dnn-hue-picker", "aria-label": "Press left or right to adjust hue, hold shift to move by 10 degrees", role: "slider", "aria-valuemin": "0", "aria-valuemax": "359", "aria-valuenow": Math.round(hue), style: { left: (hue / 359 * 100).toString() + "%" }, onKeyDown: (e) => this.handleHueKeyDown(e) })))), h("div", { class: "dnn-color-fields" }, h("div", { class: "dnn-rgb-color-fields", style: { display: this.rgbDisplay } }, h("div", { class: "dnn-rgb-color-field" }, h("label", null, "R"), h("input", { type: "number", min: "0", max: "255", step: "1", class: "red", value: red, "aria-label": "red value", onChange: (e) => this.handleComponentValueChange(e, 'red') })), h("div", { class: "dnn-rgb-color-field" }, h("label", null, "G"), h("input", { type: "number", min: "0", max: "255", class: "green", value: green, "aria-label": "green value", onChange: (e) => this.handleComponentValueChange(e, 'green') })), h("div", { class: "dnn-rgb-color-field" }, h("label", null, "B"), h("input", { type: "number", min: "0", max: "255", class: "blue", value: blue, "aria-label": "blue value", onChange: (e) => this.handleComponentValueChange(e, 'blue') })), h("div", { class: "dnn-color-mode-switch" }, h("button", { id: "rgb-switch", onClick: this.switchColorMode.bind(this), "aria-label": "switch to hexadecimal value entry" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" }, h("path", { d: "M0 0h24v24H0z", fill: "none" }), h("path", { d: "M7 7h10v3l4-4-4-4v3H5v6h2V7zm10 10H7v-3l-4 4 4 4v-3h12v-6h-2v4z" }))))), h("div", { class: "dnn-hsl-color-fields", style: { display: this.hslDisplay } }, h("div", { class: "dnn-hsl-color-field" }, h("label", null, "H"), h("input", { type: "number", min: "0", max: "359", step: 1, value: Math.round(hue), "aria-label": "Hue", onChange: (e) => this.handleHSLChange(e, 'hue') })), h("div", { class: "dnn-hsl-color-field" }, h("label", null, "S"), h("input", { type: "number", min: "0", max: "100", step: 1, value: Math.round(saturation * 100), "aria-label": "Saturation", onChange: (e) => this.handleHSLChange(e, 'saturation') })), h("div", { class: "dnn-hsl-color-field" }, h("label", null, "L"), h("input", { type: "number", min: "0", max: "100", step: 1, value: Math.round(lightness * 100), "aria-label": "Lightness", onChange: (e) => this.handleHSLChange(e, 'lightness') })), h("div", { class: "dnn-color-mode-switch" }, h("button", { id: "hsl-switch", onClick: this.switchColorMode.bind(this), "aria-label": "Switch to red, green, blue entry mode" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" }, h("path", { d: "M0 0h24v24H0z", fill: "none" }), h("path", { d: "M7 7h10v3l4-4-4-4v3H5v6h2V7zm10 10H7v-3l-4 4 4 4v-3h12v-6h-2v4z" }))))), h("div", { class: "dnn-hex-color-fields", style: { display: this.hexDisplay } }, h("div", { class: "dnn-hex-color-field" }, h("label", null, "HEX"), h("div", { class: "hex-input" }, h("input", { type: "text", "aria-label": "Hexadecimal value", value: this.getHex(), onChange: e => this.handleHexChange(e.target.value) }), h("button", { class: "copy", "aria-label": "copy value" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" }, h("path", { d: "M0 0h24v24H0z", fill: "none" }), h("path", { d: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z" }))))), h("div", { class: "dnn-color-mode-switch" }, h("button", { id: "hex-switch", onClick: this.switchColorMode.bind(this), "aria-label": "Switch to hue saturation lightness values" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" }, h("path", { d: "M0 0h24v24H0z", fill: "none" }), h("path", { d: "M7 7h10v3l4-4-4-4v3H5v6h2V7zm10 10H7v-3l-4 4 4 4v-3h12v-6h-2v4z" }))))))));
491
+ }
492
+ get el() { return getElement(this); }
493
+ static get watchers() { return {
494
+ "currentColor": ["handeCurrentColorChanged"]
495
+ }; }
496
+ };
497
+ __decorate([
498
+ Debounce(100)
499
+ ], DnnColorPicker.prototype, "colorChangedHandler", null);
500
500
  DnnColorPicker.style = dnnColorPickerCss;
501
501
 
502
502
  export { DnnColorPicker as dnn_color_picker };