@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.
- package/LICENSE +21 -21
- package/README.md +24 -24
- package/dist/.storybook/utilities.js +16 -0
- package/dist/.storybook/utilities.js.map +1 -0
- package/dist/cjs/{css-shim-3bfdba4f.js → css-shim-aaf4fec9.js} +3 -3
- package/dist/cjs/css-shim-aaf4fec9.js.map +1 -0
- package/dist/cjs/{debounce-1de79bc7.js → debounce-901e1f0c.js} +18 -18
- package/dist/cjs/{debounce-1de79bc7.js.map → debounce-901e1f0c.js.map} +1 -1
- package/dist/cjs/dnn-button.cjs.entry.js +80 -76
- package/dist/cjs/dnn-button.cjs.entry.js.map +1 -1
- package/dist/cjs/{dnn-button_16.cjs.entry.js → dnn-button_17.cjs.entry.js} +2024 -1710
- package/dist/cjs/dnn-button_17.cjs.entry.js.map +1 -0
- package/dist/cjs/dnn-checkbox.cjs.entry.js +47 -47
- package/dist/cjs/dnn-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/dnn-chevron.cjs.entry.js +22 -22
- package/dist/cjs/dnn-chevron.cjs.entry.js.map +1 -1
- package/dist/cjs/dnn-collapsible.cjs.entry.js +57 -54
- package/dist/cjs/dnn-collapsible.cjs.entry.js.map +1 -1
- package/dist/cjs/dnn-color-picker.cjs.entry.js +494 -494
- package/dist/cjs/dnn-color-picker.cjs.entry.js.map +1 -1
- package/dist/cjs/dnn-dropzone.cjs.entry.js +141 -141
- package/dist/cjs/dnn-dropzone.cjs.entry.js.map +1 -1
- package/dist/cjs/dnn-image-cropper.cjs.entry.js +394 -394
- package/dist/cjs/dnn-image-cropper.cjs.entry.js.map +1 -1
- package/dist/cjs/dnn-modal.cjs.entry.js +53 -50
- package/dist/cjs/dnn-modal.cjs.entry.js.map +1 -1
- package/dist/cjs/dnn-permissions-grid.cjs.entry.js +320 -0
- package/dist/cjs/dnn-permissions-grid.cjs.entry.js.map +1 -0
- package/dist/cjs/dnn-searchbox.cjs.entry.js +54 -54
- package/dist/cjs/dnn-searchbox.cjs.entry.js.map +1 -1
- package/dist/cjs/dnn-sort-icon.cjs.entry.js +32 -32
- package/dist/cjs/dnn-sort-icon.cjs.entry.js.map +1 -1
- package/dist/cjs/dnn-tab.cjs.entry.js +19 -19
- package/dist/cjs/dnn-tab.cjs.entry.js.map +1 -1
- package/dist/cjs/dnn-tabs.cjs.entry.js +40 -40
- package/dist/cjs/dnn-tabs.cjs.entry.js.map +1 -1
- package/dist/cjs/dnn-toggle.cjs.entry.js +26 -26
- package/dist/cjs/dnn-toggle.cjs.entry.js.map +1 -1
- package/dist/cjs/dnn-treeview-item.cjs.entry.js +56 -56
- package/dist/cjs/dnn-treeview-item.cjs.entry.js.map +1 -1
- package/dist/cjs/dnn-vertical-overflow-menu.cjs.entry.js +113 -111
- package/dist/cjs/dnn-vertical-overflow-menu.cjs.entry.js.map +1 -1
- package/dist/cjs/dnn-vertical-splitview.cjs.entry.js +121 -121
- package/dist/cjs/dnn-vertical-splitview.cjs.entry.js.map +1 -1
- package/dist/cjs/dnn.cjs.js +8 -4
- package/dist/cjs/dnn.cjs.js.map +1 -1
- package/dist/cjs/{dom-8ac1ad03.js → dom-14886762.js} +2 -2
- package/dist/cjs/{dom-8ac1ad03.js.map → dom-14886762.js.map} +1 -1
- package/dist/cjs/{index-7505bd72.js → index-514ef6dd.js} +32 -2
- package/dist/cjs/index-514ef6dd.js.map +1 -0
- package/dist/cjs/{index-aff4d89a.js → index-d53702a3.js} +30 -4
- package/dist/cjs/index-d53702a3.js.map +1 -0
- package/dist/cjs/index.cjs.js +41 -41
- package/dist/cjs/loader.cjs.js +4 -4
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/cjs/{mouseUtilities-75be531a.js → mouseUtilities-ecd5ecf7.js} +19 -19
- package/dist/cjs/{mouseUtilities-75be531a.js.map → mouseUtilities-ecd5ecf7.js.map} +1 -1
- package/dist/cjs/{shadow-css-41d9783d.js → shadow-css-c44ea13a.js} +2 -2
- package/dist/cjs/{shadow-css-41d9783d.js.map → shadow-css-c44ea13a.js.map} +1 -1
- package/dist/collection/collection-manifest.json +3 -2
- package/dist/collection/components/dnn-button/dnn-button.js +275 -271
- package/dist/collection/components/dnn-button/dnn-button.js.map +1 -1
- package/dist/collection/components/dnn-button/dnn-button.stories.js +72 -0
- package/dist/collection/components/dnn-button/dnn-button.stories.js.map +1 -0
- package/dist/collection/components/dnn-checkbox/dnn-checkbox.css +6 -0
- package/dist/collection/components/dnn-checkbox/dnn-checkbox.js +151 -139
- package/dist/collection/components/dnn-checkbox/dnn-checkbox.js.map +1 -1
- package/dist/collection/components/dnn-checkbox/dnn-checkbox.stories.js +39 -0
- package/dist/collection/components/dnn-checkbox/dnn-checkbox.stories.js.map +1 -0
- package/dist/collection/components/dnn-chevron/dnn-chevron.js +106 -106
- package/dist/collection/components/dnn-chevron/dnn-chevron.js.map +1 -1
- package/dist/collection/components/dnn-chevron/dnn-chevron.stories.js +38 -0
- package/dist/collection/components/dnn-chevron/dnn-chevron.stories.js.map +1 -0
- package/dist/collection/components/dnn-collapsible/dnn-collapsible.js +145 -142
- package/dist/collection/components/dnn-collapsible/dnn-collapsible.js.map +1 -1
- package/dist/collection/components/dnn-collapsible/dnn-collapsible.stories.js +39 -0
- package/dist/collection/components/dnn-collapsible/dnn-collapsible.stories.js.map +1 -0
- package/dist/collection/components/dnn-color-picker/dnn-color-picker.js +433 -433
- package/dist/collection/components/dnn-color-picker/dnn-color-picker.js.map +1 -1
- package/dist/collection/components/dnn-color-picker/dnn-color-picker.stories.js +33 -0
- package/dist/collection/components/dnn-color-picker/dnn-color-picker.stories.js.map +1 -0
- package/dist/collection/components/dnn-dropzone/dnn-dropzone.js +265 -265
- package/dist/collection/components/dnn-dropzone/dnn-dropzone.js.map +1 -1
- package/dist/collection/components/dnn-dropzone/dnn-dropzone.stories.js +48 -0
- package/dist/collection/components/dnn-dropzone/dnn-dropzone.stories.js.map +1 -0
- package/dist/collection/components/dnn-image-cropper/CornerType.js +8 -8
- package/dist/collection/components/dnn-image-cropper/CornerType.js.map +1 -1
- package/dist/collection/components/dnn-image-cropper/dnn-image-cropper.js +522 -522
- package/dist/collection/components/dnn-image-cropper/dnn-image-cropper.js.map +1 -1
- package/dist/collection/components/dnn-image-cropper/dnn-image-cropper.stories.js +60 -0
- package/dist/collection/components/dnn-image-cropper/dnn-image-cropper.stories.js.map +1 -0
- package/dist/collection/components/dnn-modal/dnn-modal.js +190 -172
- package/dist/collection/components/dnn-modal/dnn-modal.js.map +1 -1
- package/dist/collection/components/dnn-modal/dnn-modal.stories.js +47 -0
- package/dist/collection/components/dnn-modal/dnn-modal.stories.js.map +1 -0
- package/dist/collection/components/dnn-permissions-grid/dnn-permissions-grid.css +83 -0
- package/dist/collection/components/dnn-permissions-grid/dnn-permissions-grid.js +531 -0
- package/dist/collection/components/dnn-permissions-grid/dnn-permissions-grid.js.map +1 -0
- package/dist/collection/components/dnn-permissions-grid/dnn-permissions-grid.stories.js +273 -0
- package/dist/collection/components/dnn-permissions-grid/dnn-permissions-grid.stories.js.map +1 -0
- package/dist/collection/components/dnn-permissions-grid/localization-interface.js +3 -0
- package/dist/collection/components/dnn-permissions-grid/localization-interface.js.map +1 -0
- package/dist/collection/components/dnn-permissions-grid/permissions-interface.js +3 -0
- package/dist/collection/components/dnn-permissions-grid/permissions-interface.js.map +1 -0
- package/dist/collection/components/dnn-permissions-grid/role-group-interface.js +2 -0
- package/dist/collection/components/dnn-permissions-grid/role-group-interface.js.map +1 -0
- package/dist/collection/components/dnn-permissions-grid/role-interface.js +2 -0
- package/dist/collection/components/dnn-permissions-grid/role-interface.js.map +1 -0
- package/dist/collection/components/dnn-permissions-grid/searched-user-interface.js +2 -0
- package/dist/collection/components/dnn-permissions-grid/searched-user-interface.js.map +1 -0
- package/dist/collection/components/dnn-searchbox/dnn-searchbox.js +136 -136
- package/dist/collection/components/dnn-searchbox/dnn-searchbox.js.map +1 -1
- package/dist/collection/components/dnn-searchbox/dnn-searchbox.stories.js +26 -0
- package/dist/collection/components/dnn-searchbox/dnn-searchbox.stories.js.map +1 -0
- package/dist/collection/components/dnn-sort-icon/dnn-sort-icon.css +6 -3
- package/dist/collection/components/dnn-sort-icon/dnn-sort-icon.js +80 -80
- package/dist/collection/components/dnn-sort-icon/dnn-sort-icon.js.map +1 -1
- package/dist/collection/components/dnn-sort-icon/dnn-sort-icon.stories.js +58 -0
- package/dist/collection/components/dnn-sort-icon/dnn-sort-icon.stories.js.map +1 -0
- package/dist/collection/components/dnn-tab/dnn-tab.js +83 -83
- package/dist/collection/components/dnn-tab/dnn-tab.js.map +1 -1
- package/dist/collection/components/dnn-tab/dnn-tab.stories.js +25 -0
- package/dist/collection/components/dnn-tab/dnn-tab.stories.js.map +1 -0
- package/dist/collection/components/dnn-tabs/dnn-tabs.js +54 -54
- package/dist/collection/components/dnn-tabs/dnn-tabs.js.map +1 -1
- package/dist/collection/components/dnn-tabs/dnn-tabs.stories.js +48 -0
- package/dist/collection/components/dnn-tabs/dnn-tabs.stories.js.map +1 -0
- package/dist/collection/components/dnn-toggle/dnn-toggle.css +1 -1
- package/dist/collection/components/dnn-toggle/dnn-toggle.js +93 -93
- package/dist/collection/components/dnn-toggle/dnn-toggle.js.map +1 -1
- package/dist/collection/components/dnn-toggle/dnn-toggle.stories.js +53 -0
- package/dist/collection/components/dnn-toggle/dnn-toggle.stories.js.map +1 -0
- package/dist/collection/components/dnn-toggle/toggle-interface.js +1 -1
- package/dist/collection/components/dnn-toggle/toggle-interface.js.map +1 -1
- package/dist/collection/components/dnn-treeview-item/dnn-treeview-item.js +130 -126
- package/dist/collection/components/dnn-treeview-item/dnn-treeview-item.js.map +1 -1
- package/dist/collection/components/dnn-treeview-item/dnn-treeview-item.stories.js +36 -0
- package/dist/collection/components/dnn-treeview-item/dnn-treeview-item.stories.js.map +1 -0
- package/dist/collection/components/dnn-vertical-overflow-menu/dnn-vertical-overflow-menu.css +6 -7
- package/dist/collection/components/dnn-vertical-overflow-menu/dnn-vertical-overflow-menu.js +133 -131
- package/dist/collection/components/dnn-vertical-overflow-menu/dnn-vertical-overflow-menu.js.map +1 -1
- package/dist/collection/components/dnn-vertical-overflow-menu/dnn-vertical-overflow-menu.stories.js +60 -0
- package/dist/collection/components/dnn-vertical-overflow-menu/dnn-vertical-overflow-menu.stories.js.map +1 -0
- package/dist/collection/components/dnn-vertical-splitview/dnn-vertical-splitview.css +4 -2
- package/dist/collection/components/dnn-vertical-splitview/dnn-vertical-splitview.js +233 -233
- package/dist/collection/components/dnn-vertical-splitview/dnn-vertical-splitview.js.map +1 -1
- package/dist/collection/components/dnn-vertical-splitview/dnn-vertical-splitview.stories.js +75 -0
- package/dist/collection/components/dnn-vertical-splitview/dnn-vertical-splitview.stories.js.map +1 -0
- package/dist/collection/index.js +2 -2
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/utilities/colorInfo.js +190 -190
- package/dist/collection/utilities/colorInfo.js.map +1 -1
- package/dist/collection/utilities/debounce.js +18 -18
- package/dist/collection/utilities/debounce.js.map +1 -1
- package/dist/collection/utilities/dnnServicesFramework.js +41 -41
- package/dist/collection/utilities/dnnServicesFramework.js.map +1 -1
- package/dist/collection/utilities/mouseUtilities.js +19 -19
- package/dist/collection/utilities/mouseUtilities.js.map +1 -1
- package/dist/{esm/css-shim-20dbffa5.js → dnn/css-shim-091f949f.js} +3 -3
- package/dist/dnn/css-shim-091f949f.js.map +1 -0
- package/dist/dnn/{css-shim-856c55de.system.js → css-shim-c5bffe6b.system.js} +2 -2
- package/dist/dnn/css-shim-c5bffe6b.system.js.map +1 -0
- package/dist/{esm/debounce-06f55268.js → dnn/debounce-6be67abd.js} +18 -18
- package/dist/dnn/{debounce-06f55268.js.map → debounce-6be67abd.js.map} +1 -1
- package/dist/dnn/{debounce-eef81bf7.system.js → debounce-db438a09.system.js} +1 -1
- package/dist/dnn/{debounce-eef81bf7.system.js.map → debounce-db438a09.system.js.map} +0 -0
- package/dist/dnn/dnn-button.entry.js +80 -76
- package/dist/dnn/dnn-button.entry.js.map +1 -1
- package/dist/dnn/dnn-button.system.entry.js +1 -1
- package/dist/dnn/dnn-button.system.entry.js.map +1 -1
- package/dist/dnn/dnn-checkbox.entry.js +47 -47
- package/dist/dnn/dnn-checkbox.entry.js.map +1 -1
- package/dist/dnn/dnn-checkbox.system.entry.js +1 -1
- package/dist/dnn/dnn-checkbox.system.entry.js.map +1 -1
- package/dist/dnn/dnn-chevron.entry.js +22 -22
- package/dist/dnn/dnn-chevron.entry.js.map +1 -1
- package/dist/dnn/dnn-chevron.system.entry.js +1 -1
- package/dist/dnn/dnn-chevron.system.entry.js.map +1 -1
- package/dist/dnn/dnn-collapsible.entry.js +57 -54
- package/dist/dnn/dnn-collapsible.entry.js.map +1 -1
- package/dist/dnn/dnn-collapsible.system.entry.js +1 -1
- package/dist/dnn/dnn-collapsible.system.entry.js.map +1 -1
- package/dist/dnn/dnn-color-picker.entry.js +494 -494
- package/dist/dnn/dnn-color-picker.entry.js.map +1 -1
- package/dist/dnn/dnn-color-picker.system.entry.js +2 -2
- package/dist/dnn/dnn-color-picker.system.entry.js.map +1 -1
- package/dist/dnn/dnn-dropzone.entry.js +141 -141
- package/dist/dnn/dnn-dropzone.entry.js.map +1 -1
- package/dist/dnn/dnn-dropzone.system.entry.js +1 -1
- package/dist/dnn/dnn-dropzone.system.entry.js.map +1 -1
- package/dist/dnn/dnn-image-cropper.entry.js +394 -394
- package/dist/dnn/dnn-image-cropper.entry.js.map +1 -1
- package/dist/dnn/dnn-image-cropper.system.entry.js +1 -1
- package/dist/dnn/dnn-image-cropper.system.entry.js.map +1 -1
- package/dist/dnn/dnn-modal.entry.js +53 -50
- package/dist/dnn/dnn-modal.entry.js.map +1 -1
- package/dist/dnn/dnn-modal.system.entry.js +1 -1
- package/dist/dnn/dnn-modal.system.entry.js.map +1 -1
- package/dist/dnn/dnn-permissions-grid.entry.js +316 -0
- package/dist/dnn/dnn-permissions-grid.entry.js.map +1 -0
- package/dist/dnn/dnn-permissions-grid.system.entry.js +2 -0
- package/dist/dnn/dnn-permissions-grid.system.entry.js.map +1 -0
- package/dist/dnn/dnn-searchbox.entry.js +54 -54
- package/dist/dnn/dnn-searchbox.entry.js.map +1 -1
- package/dist/dnn/dnn-searchbox.system.entry.js +1 -1
- package/dist/dnn/dnn-searchbox.system.entry.js.map +1 -1
- package/dist/dnn/dnn-sort-icon.entry.js +32 -32
- package/dist/dnn/dnn-sort-icon.entry.js.map +1 -1
- package/dist/dnn/dnn-sort-icon.system.entry.js +1 -1
- package/dist/dnn/dnn-sort-icon.system.entry.js.map +1 -1
- package/dist/dnn/dnn-tab.entry.js +19 -19
- package/dist/dnn/dnn-tab.entry.js.map +1 -1
- package/dist/dnn/dnn-tab.system.entry.js +1 -1
- package/dist/dnn/dnn-tabs.entry.js +40 -40
- package/dist/dnn/dnn-tabs.entry.js.map +1 -1
- package/dist/dnn/dnn-tabs.system.entry.js +1 -1
- package/dist/dnn/dnn-tabs.system.entry.js.map +1 -1
- package/dist/dnn/dnn-toggle.entry.js +26 -26
- package/dist/dnn/dnn-toggle.entry.js.map +1 -1
- package/dist/dnn/dnn-toggle.system.entry.js +1 -1
- package/dist/dnn/dnn-toggle.system.entry.js.map +1 -1
- package/dist/dnn/dnn-treeview-item.entry.js +56 -56
- package/dist/dnn/dnn-treeview-item.entry.js.map +1 -1
- package/dist/dnn/dnn-treeview-item.system.entry.js +1 -1
- package/dist/dnn/dnn-treeview-item.system.entry.js.map +1 -1
- package/dist/dnn/dnn-vertical-overflow-menu.entry.js +113 -111
- package/dist/dnn/dnn-vertical-overflow-menu.entry.js.map +1 -1
- package/dist/dnn/dnn-vertical-overflow-menu.system.entry.js +1 -1
- package/dist/dnn/dnn-vertical-overflow-menu.system.entry.js.map +1 -1
- package/dist/dnn/dnn-vertical-splitview.entry.js +121 -121
- package/dist/dnn/dnn-vertical-splitview.entry.js.map +1 -1
- package/dist/dnn/dnn-vertical-splitview.system.entry.js +1 -1
- package/dist/dnn/dnn-vertical-splitview.system.entry.js.map +1 -1
- package/dist/dnn/dnn.esm.js +8 -4
- package/dist/dnn/dnn.esm.js.map +1 -1
- package/dist/dnn/dnn.system.js +1 -1
- package/dist/dnn/dnn.system.js.map +1 -1
- package/dist/dnn/{dom-938307ec.system.js → dom-99eb7b76.system.js} +1 -1
- package/dist/dnn/{dom-938307ec.system.js.map → dom-99eb7b76.system.js.map} +1 -1
- package/dist/dnn/{dom-c5ed0ba5.js → dom-a385e381.js} +2 -2
- package/dist/{esm/dom-c5ed0ba5.js.map → dnn/dom-a385e381.js.map} +1 -1
- package/dist/dnn/{index-b5a28c1d.js → index-20e42ad7.js} +30 -4
- package/dist/dnn/index-20e42ad7.js.map +1 -0
- package/dist/dnn/index-c3cc3b5b.system.js +2 -0
- package/dist/dnn/index-c3cc3b5b.system.js.map +1 -0
- package/dist/dnn/index.esm.js +41 -41
- package/dist/dnn/index.system.js +1 -1
- package/dist/dnn/{mouseUtilities-e7e4e78f.system.js → mouseUtilities-233ad7e3.system.js} +1 -1
- package/dist/dnn/{mouseUtilities-e7e4e78f.system.js.map → mouseUtilities-233ad7e3.system.js.map} +0 -0
- package/dist/{esm/mouseUtilities-817973b4.js → dnn/mouseUtilities-b261ca4f.js} +19 -19
- package/dist/dnn/{mouseUtilities-817973b4.js.map → mouseUtilities-b261ca4f.js.map} +1 -1
- package/dist/dnn/{p-646cfb1b.system.js → p-1e26a4e1.system.js} +1 -1
- package/dist/dnn/{p-646cfb1b.system.js.map → p-1e26a4e1.system.js.map} +0 -0
- package/dist/dnn/p-31dc68a7.system.entry.js +11 -0
- package/dist/dnn/p-31dc68a7.system.entry.js.map +1 -0
- package/dist/dnn/p-5bcf3629.system.js +2 -0
- package/dist/dnn/p-5bcf3629.system.js.map +1 -0
- package/dist/dnn/{p-fb637662.system.js → p-78561bb1.system.js} +2 -2
- package/dist/dnn/{p-fb637662.system.js.map → p-78561bb1.system.js.map} +0 -0
- package/dist/dnn/p-7ffdbed1.js +2 -0
- package/dist/dnn/p-7ffdbed1.js.map +1 -0
- package/dist/dnn/{p-0e94f5ee.js → p-9b8731a9.js} +1 -1
- package/dist/dnn/{p-0e94f5ee.js.map → p-9b8731a9.js.map} +0 -0
- package/dist/dnn/p-b8064287.system.js +2 -0
- package/dist/dnn/p-b8064287.system.js.map +1 -0
- package/dist/dnn/p-c222c8b7.entry.js +11 -0
- package/dist/dnn/p-c222c8b7.entry.js.map +1 -0
- package/dist/dnn/shadow-css-27708fdd.system.js +14 -0
- package/dist/dnn/shadow-css-27708fdd.system.js.map +1 -0
- package/dist/dnn/{shadow-css-8c625855.js → shadow-css-ef431969.js} +2 -2
- package/dist/{esm/shadow-css-8c625855.js.map → dnn/shadow-css-ef431969.js.map} +1 -1
- package/dist/{dnn/css-shim-20dbffa5.js → esm/css-shim-091f949f.js} +3 -3
- package/dist/esm/css-shim-091f949f.js.map +1 -0
- package/dist/{dnn/debounce-06f55268.js → esm/debounce-6be67abd.js} +18 -18
- package/dist/esm/{debounce-06f55268.js.map → debounce-6be67abd.js.map} +1 -1
- package/dist/esm/dnn-button.entry.js +80 -76
- package/dist/esm/dnn-button.entry.js.map +1 -1
- package/dist/esm/{dnn-button_16.entry.js → dnn-button_17.entry.js} +2024 -1711
- package/dist/esm/dnn-button_17.entry.js.map +1 -0
- package/dist/esm/dnn-checkbox.entry.js +47 -47
- package/dist/esm/dnn-checkbox.entry.js.map +1 -1
- package/dist/esm/dnn-chevron.entry.js +22 -22
- package/dist/esm/dnn-chevron.entry.js.map +1 -1
- package/dist/esm/dnn-collapsible.entry.js +57 -54
- package/dist/esm/dnn-collapsible.entry.js.map +1 -1
- package/dist/esm/dnn-color-picker.entry.js +494 -494
- package/dist/esm/dnn-color-picker.entry.js.map +1 -1
- package/dist/esm/dnn-dropzone.entry.js +141 -141
- package/dist/esm/dnn-dropzone.entry.js.map +1 -1
- package/dist/esm/dnn-image-cropper.entry.js +394 -394
- package/dist/esm/dnn-image-cropper.entry.js.map +1 -1
- package/dist/esm/dnn-modal.entry.js +53 -50
- package/dist/esm/dnn-modal.entry.js.map +1 -1
- package/dist/esm/dnn-permissions-grid.entry.js +316 -0
- package/dist/esm/dnn-permissions-grid.entry.js.map +1 -0
- package/dist/esm/dnn-searchbox.entry.js +54 -54
- package/dist/esm/dnn-searchbox.entry.js.map +1 -1
- package/dist/esm/dnn-sort-icon.entry.js +32 -32
- package/dist/esm/dnn-sort-icon.entry.js.map +1 -1
- package/dist/esm/dnn-tab.entry.js +19 -19
- package/dist/esm/dnn-tab.entry.js.map +1 -1
- package/dist/esm/dnn-tabs.entry.js +40 -40
- package/dist/esm/dnn-tabs.entry.js.map +1 -1
- package/dist/esm/dnn-toggle.entry.js +26 -26
- package/dist/esm/dnn-toggle.entry.js.map +1 -1
- package/dist/esm/dnn-treeview-item.entry.js +56 -56
- package/dist/esm/dnn-treeview-item.entry.js.map +1 -1
- package/dist/esm/dnn-vertical-overflow-menu.entry.js +113 -111
- package/dist/esm/dnn-vertical-overflow-menu.entry.js.map +1 -1
- package/dist/esm/dnn-vertical-splitview.entry.js +121 -121
- package/dist/esm/dnn-vertical-splitview.entry.js.map +1 -1
- package/dist/esm/dnn.js +8 -4
- package/dist/esm/dnn.js.map +1 -1
- package/dist/esm/{dom-c5ed0ba5.js → dom-a385e381.js} +2 -2
- package/dist/{dnn/dom-c5ed0ba5.js.map → esm/dom-a385e381.js.map} +1 -1
- package/dist/esm/{index-b5a28c1d.js → index-20e42ad7.js} +30 -4
- package/dist/esm/index-20e42ad7.js.map +1 -0
- package/dist/esm/{index-cdbad319.js → index-59e0950f.js} +32 -2
- package/dist/esm/index-59e0950f.js.map +1 -0
- package/dist/esm/index.js +41 -41
- package/dist/esm/loader.js +4 -4
- package/dist/esm/loader.js.map +1 -1
- package/dist/{dnn/mouseUtilities-817973b4.js → esm/mouseUtilities-b261ca4f.js} +19 -19
- package/dist/esm/{mouseUtilities-817973b4.js.map → mouseUtilities-b261ca4f.js.map} +1 -1
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/polyfills/dom.js +0 -0
- package/dist/esm/polyfills/es5-html-element.js +0 -0
- package/dist/esm/polyfills/index.js +0 -0
- package/dist/esm/polyfills/system.js +0 -0
- package/dist/esm/{shadow-css-8c625855.js → shadow-css-ef431969.js} +2 -2
- package/dist/{dnn/shadow-css-8c625855.js.map → esm/shadow-css-ef431969.js.map} +1 -1
- package/dist/esm-es5/{debounce-06f55268.js → debounce-6be67abd.js} +1 -1
- package/dist/esm-es5/{debounce-06f55268.js.map → debounce-6be67abd.js.map} +0 -0
- package/dist/esm-es5/dnn-button_17.entry.js +11 -0
- package/dist/esm-es5/dnn-button_17.entry.js.map +1 -0
- package/dist/esm-es5/dnn.js +1 -1
- package/dist/esm-es5/dnn.js.map +1 -1
- package/dist/esm-es5/index-59e0950f.js +2 -0
- package/dist/esm-es5/index-59e0950f.js.map +1 -0
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/loader.js.map +1 -1
- package/dist/types/components/dnn-button/dnn-button.d.ts +56 -55
- package/dist/types/components/dnn-button/dnn-button.stories.d.ts +4 -0
- package/dist/types/components/dnn-checkbox/dnn-checkbox.d.ts +20 -16
- package/dist/types/components/dnn-checkbox/dnn-checkbox.stories.d.ts +4 -0
- package/dist/types/components/dnn-chevron/dnn-chevron.d.ts +13 -13
- package/dist/types/components/dnn-chevron/dnn-chevron.stories.d.ts +4 -0
- package/dist/types/components/dnn-collapsible/dnn-collapsible.d.ts +19 -18
- package/dist/types/components/dnn-collapsible/dnn-collapsible.stories.d.ts +4 -0
- package/dist/types/components/dnn-color-picker/dnn-color-picker.d.ts +46 -46
- package/dist/types/components/dnn-color-picker/dnn-color-picker.stories.d.ts +4 -0
- package/dist/types/components/dnn-dropzone/dnn-dropzone.d.ts +45 -45
- package/dist/types/components/dnn-dropzone/dnn-dropzone.stories.d.ts +4 -0
- package/dist/types/components/dnn-image-cropper/CornerType.d.ts +6 -6
- package/dist/types/components/dnn-image-cropper/dnn-image-cropper.d.ts +61 -61
- package/dist/types/components/dnn-image-cropper/dnn-image-cropper.stories.d.ts +4 -0
- package/dist/types/components/dnn-modal/dnn-modal.d.ts +38 -35
- package/dist/types/components/dnn-modal/dnn-modal.stories.d.ts +4 -0
- package/dist/types/components/dnn-permissions-grid/dnn-permissions-grid.d.ts +47 -0
- package/dist/types/components/dnn-permissions-grid/dnn-permissions-grid.stories.d.ts +4 -0
- package/dist/types/components/dnn-permissions-grid/localization-interface.d.ts +11 -0
- package/dist/types/components/dnn-permissions-grid/permissions-interface.d.ts +26 -0
- package/dist/types/components/dnn-permissions-grid/role-group-interface.d.ts +6 -0
- package/dist/types/components/dnn-permissions-grid/role-interface.d.ts +6 -0
- package/dist/types/components/dnn-permissions-grid/searched-user-interface.d.ts +4 -0
- package/dist/types/components/dnn-searchbox/dnn-searchbox.d.ts +22 -22
- package/dist/types/components/dnn-searchbox/dnn-searchbox.stories.d.ts +4 -0
- package/dist/types/components/dnn-sort-icon/dnn-sort-icon.d.ts +9 -9
- package/dist/types/components/dnn-sort-icon/dnn-sort-icon.stories.d.ts +4 -0
- package/dist/types/components/dnn-tab/dnn-tab.d.ts +11 -11
- package/dist/types/components/dnn-tab/dnn-tab.stories.d.ts +4 -0
- package/dist/types/components/dnn-tabs/dnn-tabs.d.ts +11 -11
- package/dist/types/components/dnn-tabs/dnn-tabs.stories.d.ts +4 -0
- package/dist/types/components/dnn-toggle/dnn-toggle.d.ts +13 -13
- package/dist/types/components/dnn-toggle/dnn-toggle.stories.d.ts +4 -0
- package/dist/types/components/dnn-toggle/toggle-interface.d.ts +3 -3
- package/dist/types/components/dnn-treeview-item/dnn-treeview-item.d.ts +28 -24
- package/dist/types/components/dnn-treeview-item/dnn-treeview-item.stories.d.ts +4 -0
- package/dist/types/components/dnn-vertical-overflow-menu/dnn-vertical-overflow-menu.d.ts +16 -16
- package/dist/types/components/dnn-vertical-overflow-menu/dnn-vertical-overflow-menu.stories.d.ts +4 -0
- package/dist/types/components/dnn-vertical-splitview/dnn-vertical-splitview.d.ts +28 -28
- package/dist/types/components/dnn-vertical-splitview/dnn-vertical-splitview.stories.d.ts +4 -0
- package/dist/types/components.d.ts +108 -34
- package/dist/types/global.d.ts +1 -0
- package/dist/types/home/runner/work/dnn-elements/dnn-elements/.stencil/.storybook/utilities.d.ts +1 -0
- package/dist/types/index.d.ts +3 -3
- package/dist/types/utilities/colorInfo.d.ts +52 -52
- package/dist/types/utilities/debounce.d.ts +5 -5
- package/dist/types/utilities/dnnServicesFramework.d.ts +19 -19
- package/dist/types/utilities/mouseUtilities.d.ts +4 -4
- package/package.json +63 -48
- package/dist/cjs/css-shim-3bfdba4f.js.map +0 -1
- package/dist/cjs/dnn-button_16.cjs.entry.js.map +0 -1
- package/dist/cjs/index-7505bd72.js.map +0 -1
- package/dist/cjs/index-aff4d89a.js.map +0 -1
- package/dist/dnn/css-shim-20dbffa5.js.map +0 -1
- package/dist/dnn/css-shim-856c55de.system.js.map +0 -1
- package/dist/dnn/index-a3a55419.system.js +0 -2
- package/dist/dnn/index-a3a55419.system.js.map +0 -1
- package/dist/dnn/index-b5a28c1d.js.map +0 -1
- package/dist/dnn/p-058ba146.system.js +0 -2
- package/dist/dnn/p-058ba146.system.js.map +0 -1
- package/dist/dnn/p-45ce2139.js +0 -2
- package/dist/dnn/p-45ce2139.js.map +0 -1
- package/dist/dnn/p-755d047d.system.entry.js +0 -11
- package/dist/dnn/p-755d047d.system.entry.js.map +0 -1
- package/dist/dnn/p-8ec1f3a8.entry.js +0 -11
- package/dist/dnn/p-8ec1f3a8.entry.js.map +0 -1
- package/dist/dnn/p-f91193e2.system.js +0 -2
- package/dist/dnn/p-f91193e2.system.js.map +0 -1
- package/dist/dnn/shadow-css-d573707f.system.js +0 -14
- package/dist/dnn/shadow-css-d573707f.system.js.map +0 -1
- package/dist/esm/css-shim-20dbffa5.js.map +0 -1
- package/dist/esm/dnn-button_16.entry.js.map +0 -1
- package/dist/esm/index-b5a28c1d.js.map +0 -1
- package/dist/esm/index-cdbad319.js.map +0 -1
- package/dist/esm-es5/dnn-button_16.entry.js +0 -11
- package/dist/esm-es5/dnn-button_16.entry.js.map +0 -1
- package/dist/esm-es5/index-cdbad319.js +0 -2
- package/dist/esm-es5/index-cdbad319.js.map +0 -1
|
@@ -1,434 +1,434 @@
|
|
|
1
|
-
/** Reusable DNN UI component to pick a color
|
|
2
|
-
* @copyright Copyright (c) .NET Foundation. All rights reserved.
|
|
3
|
-
* @license MIT
|
|
4
|
-
*/
|
|
5
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
6
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
8
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
|
-
};
|
|
11
|
-
import { Component, h, State, Element, Prop, Event, Watch } from "@stencil/core";
|
|
12
|
-
import { ColorInfo } from '../../utilities/colorInfo';
|
|
13
|
-
import { Debounce } from "../../utilities/debounce";
|
|
14
|
-
/** Color Picker for Dnn */
|
|
15
|
-
export class DnnColorPicker {
|
|
16
|
-
constructor() {
|
|
17
|
-
/** Sets the initial color, must be a valid 8 character hexadecimal string without the # sign. */
|
|
18
|
-
this.color = "FFFFFF";
|
|
19
|
-
/** Sets the width-height ratio of the color picker saturation-lightness box.
|
|
20
|
-
* @example 100% renders a perfect square
|
|
21
|
-
*/
|
|
22
|
-
this.colorBoxHeight = "50%";
|
|
23
|
-
this.rgbDisplay = "flex";
|
|
24
|
-
this.hslDisplay = "none";
|
|
25
|
-
this.hexDisplay = "none";
|
|
26
|
-
this.handleSaturationLightnessMouseDown = (e) => {
|
|
27
|
-
e.preventDefault();
|
|
28
|
-
this.handleDragLightnessSaturation(e);
|
|
29
|
-
window.addEventListener('mousemove', this.handleDragLightnessSaturation);
|
|
30
|
-
window.addEventListener('mouseup', this.handleSaturationLightnessMouseUp);
|
|
31
|
-
};
|
|
32
|
-
this.handleDragLightnessSaturation = (e) => {
|
|
33
|
-
const rect = this.saturationLightnessBox.getBoundingClientRect();
|
|
34
|
-
let x = e.clientX - rect.left;
|
|
35
|
-
if (x < 0) {
|
|
36
|
-
x = 0;
|
|
37
|
-
}
|
|
38
|
-
if (x > rect.width) {
|
|
39
|
-
x = rect.width;
|
|
40
|
-
}
|
|
41
|
-
x = x / rect.width;
|
|
42
|
-
let y = e.clientY - rect.top;
|
|
43
|
-
if (y < 0) {
|
|
44
|
-
y = 0;
|
|
45
|
-
}
|
|
46
|
-
if (y > rect.height) {
|
|
47
|
-
y = rect.height;
|
|
48
|
-
}
|
|
49
|
-
y = 1 - (y / rect.height);
|
|
50
|
-
const newColor = new ColorInfo();
|
|
51
|
-
newColor.hue = this.currentColor.hue;
|
|
52
|
-
newColor.saturation = x;
|
|
53
|
-
newColor.lightness = y;
|
|
54
|
-
this.currentColor = newColor;
|
|
55
|
-
};
|
|
56
|
-
this.handleSaturationLightnessMouseUp = () => {
|
|
57
|
-
window.removeEventListener('mousemove', this.handleDragLightnessSaturation);
|
|
58
|
-
window.removeEventListener('mouseup', this.handleSaturationLightnessMouseUp);
|
|
59
|
-
};
|
|
60
|
-
this.handleHueMouseDown = (e) => {
|
|
61
|
-
e.preventDefault();
|
|
62
|
-
this.handleDragHue(e);
|
|
63
|
-
window.addEventListener('mousemove', this.handleDragHue);
|
|
64
|
-
window.addEventListener('mouseup', this.handleHueMouseUp);
|
|
65
|
-
};
|
|
66
|
-
this.handleHueMouseUp = () => {
|
|
67
|
-
window.removeEventListener('mousemove', this.handleDragHue);
|
|
68
|
-
window.removeEventListener('mouseup', this.handleHueMouseUp);
|
|
69
|
-
};
|
|
70
|
-
this.handleDragHue = (e) => {
|
|
71
|
-
const rect = this.hueRange.getBoundingClientRect();
|
|
72
|
-
let x = e.clientX - rect.left;
|
|
73
|
-
if (x < 0) {
|
|
74
|
-
x = 0;
|
|
75
|
-
}
|
|
76
|
-
if (x > rect.width) {
|
|
77
|
-
x = rect.width;
|
|
78
|
-
}
|
|
79
|
-
x = x / rect.width * 360;
|
|
80
|
-
const newColor = new ColorInfo();
|
|
81
|
-
newColor.hue = x;
|
|
82
|
-
newColor.saturation = this.currentColor.saturation;
|
|
83
|
-
newColor.lightness = this.currentColor.lightness;
|
|
84
|
-
this.currentColor = newColor;
|
|
85
|
-
};
|
|
86
|
-
this.handleComponentValueChange = (e, channel) => {
|
|
87
|
-
let value = parseInt(e.target.value);
|
|
88
|
-
if (isNaN(value)) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
const newColor = new ColorInfo();
|
|
92
|
-
if (value < 0) {
|
|
93
|
-
value = 0;
|
|
94
|
-
}
|
|
95
|
-
if (value > 255) {
|
|
96
|
-
value = 255;
|
|
97
|
-
}
|
|
98
|
-
let r = this.currentColor.red;
|
|
99
|
-
let g = this.currentColor.green;
|
|
100
|
-
let b = this.currentColor.blue;
|
|
101
|
-
switch (channel) {
|
|
102
|
-
case 'red':
|
|
103
|
-
r = value;
|
|
104
|
-
break;
|
|
105
|
-
case 'green':
|
|
106
|
-
g = value;
|
|
107
|
-
break;
|
|
108
|
-
case 'blue':
|
|
109
|
-
b = value;
|
|
110
|
-
break;
|
|
111
|
-
default:
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
114
|
-
newColor.green = g;
|
|
115
|
-
newColor.red = r;
|
|
116
|
-
newColor.blue = b;
|
|
117
|
-
this.currentColor = newColor;
|
|
118
|
-
};
|
|
119
|
-
this.handleHSLChange = (e, component) => {
|
|
120
|
-
let value = parseInt(e.target.value);
|
|
121
|
-
if (isNaN(value)) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
const newColor = new ColorInfo();
|
|
125
|
-
if (value != null) {
|
|
126
|
-
let h = this.currentColor.hue;
|
|
127
|
-
let s = this.currentColor.saturation;
|
|
128
|
-
let l = this.currentColor.lightness;
|
|
129
|
-
switch (component) {
|
|
130
|
-
case "hue":
|
|
131
|
-
if (value < 0) {
|
|
132
|
-
value = 0;
|
|
133
|
-
}
|
|
134
|
-
if (value > 359) {
|
|
135
|
-
value = 0;
|
|
136
|
-
}
|
|
137
|
-
h = value;
|
|
138
|
-
break;
|
|
139
|
-
case "saturation":
|
|
140
|
-
if (value < 0) {
|
|
141
|
-
value = 0;
|
|
142
|
-
}
|
|
143
|
-
if (value > 100) {
|
|
144
|
-
value = 100;
|
|
145
|
-
}
|
|
146
|
-
s = value / 100;
|
|
147
|
-
break;
|
|
148
|
-
case "lightness":
|
|
149
|
-
if (value < 0) {
|
|
150
|
-
value = 0;
|
|
151
|
-
}
|
|
152
|
-
if (value > 100) {
|
|
153
|
-
value = 100;
|
|
154
|
-
}
|
|
155
|
-
l = value / 100;
|
|
156
|
-
break;
|
|
157
|
-
default:
|
|
158
|
-
break;
|
|
159
|
-
}
|
|
160
|
-
newColor.hue = h;
|
|
161
|
-
newColor.saturation = s;
|
|
162
|
-
newColor.lightness = l;
|
|
163
|
-
this.currentColor = newColor;
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
this.handleSaturationLightnessKeyDown = (e) => {
|
|
167
|
-
let newColor = new ColorInfo();
|
|
168
|
-
newColor.hue = this.currentColor.hue;
|
|
169
|
-
newColor.saturation = this.currentColor.saturation;
|
|
170
|
-
newColor.lightness = this.currentColor.lightness;
|
|
171
|
-
let value = 0.01;
|
|
172
|
-
if (e.shiftKey) {
|
|
173
|
-
value = 0.1;
|
|
174
|
-
}
|
|
175
|
-
switch (e.key) {
|
|
176
|
-
case "ArrowUp":
|
|
177
|
-
newColor.lightness += value;
|
|
178
|
-
break;
|
|
179
|
-
case "ArrowDown":
|
|
180
|
-
newColor.lightness -= value;
|
|
181
|
-
break;
|
|
182
|
-
case "ArrowLeft":
|
|
183
|
-
newColor.saturation -= value;
|
|
184
|
-
break;
|
|
185
|
-
case "ArrowRight":
|
|
186
|
-
newColor.saturation += value;
|
|
187
|
-
default:
|
|
188
|
-
break;
|
|
189
|
-
}
|
|
190
|
-
this.currentColor = newColor;
|
|
191
|
-
};
|
|
192
|
-
this.handleHueKeyDown = (e) => {
|
|
193
|
-
let newColor = new ColorInfo();
|
|
194
|
-
newColor.hue = this.currentColor.hue;
|
|
195
|
-
newColor.saturation = this.currentColor.saturation;
|
|
196
|
-
newColor.lightness = this.currentColor.lightness;
|
|
197
|
-
let value = 1;
|
|
198
|
-
if (e.shiftKey) {
|
|
199
|
-
value = 10;
|
|
200
|
-
}
|
|
201
|
-
switch (e.key) {
|
|
202
|
-
case "ArrowLeft":
|
|
203
|
-
newColor.hue -= value;
|
|
204
|
-
break;
|
|
205
|
-
case "ArrowRight":
|
|
206
|
-
newColor.hue += value;
|
|
207
|
-
default:
|
|
208
|
-
break;
|
|
209
|
-
}
|
|
210
|
-
this.currentColor = newColor;
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
colorChangedHandler(color) {
|
|
214
|
-
this.colorChanged.emit(color);
|
|
215
|
-
}
|
|
216
|
-
handeCurrentColorChanged(newValue) {
|
|
217
|
-
this.colorChangedHandler(newValue);
|
|
218
|
-
}
|
|
219
|
-
componentWillLoad() {
|
|
220
|
-
this.handleHexChange(this.color);
|
|
221
|
-
}
|
|
222
|
-
componentDidLoad() {
|
|
223
|
-
this.el.style.setProperty("--color-box-height", this.colorBoxHeight.toString());
|
|
224
|
-
}
|
|
225
|
-
getHex() {
|
|
226
|
-
return this.getDoublet(this.currentColor.red) + this.getDoublet(this.currentColor.green) + this.getDoublet(this.currentColor.blue);
|
|
227
|
-
}
|
|
228
|
-
getContrast() {
|
|
229
|
-
return this.currentColor.contrastColor;
|
|
230
|
-
}
|
|
231
|
-
getDoublet(value) {
|
|
232
|
-
const valueString = value.toString(16).toUpperCase();
|
|
233
|
-
if (valueString.length === 1) {
|
|
234
|
-
return '0' + valueString;
|
|
235
|
-
}
|
|
236
|
-
return valueString;
|
|
237
|
-
}
|
|
238
|
-
handleHexChange(value) {
|
|
239
|
-
const newColor = new ColorInfo();
|
|
240
|
-
if (value.match(/^(?:[\da-f]{3}|[\da-f]{6})$/i).length > 0) {
|
|
241
|
-
if (value.length === 3) {
|
|
242
|
-
let expanded = value[0] + value[0] + value[1] + value[1] + value[2] + value[2];
|
|
243
|
-
value = expanded;
|
|
244
|
-
}
|
|
245
|
-
newColor.red = parseInt(value.substr(0, 2), 16);
|
|
246
|
-
newColor.green = parseInt(value.substr(2, 2), 16);
|
|
247
|
-
newColor.blue = parseInt(value.substr(4, 2), 16);
|
|
248
|
-
}
|
|
249
|
-
else {
|
|
250
|
-
newColor.red = this.currentColor.red;
|
|
251
|
-
newColor.green = this.currentColor.green;
|
|
252
|
-
newColor.blue = this.currentColor.blue;
|
|
253
|
-
}
|
|
254
|
-
this.currentColor = newColor;
|
|
255
|
-
}
|
|
256
|
-
switchColorMode(e) {
|
|
257
|
-
switch (e.target.id) {
|
|
258
|
-
case "rgb-switch":
|
|
259
|
-
this.rgbDisplay = "none";
|
|
260
|
-
this.hslDisplay = "none";
|
|
261
|
-
this.hexDisplay = "flex";
|
|
262
|
-
break;
|
|
263
|
-
case "hex-switch":
|
|
264
|
-
this.rgbDisplay = "none";
|
|
265
|
-
this.hslDisplay = "flex";
|
|
266
|
-
this.hexDisplay = "none";
|
|
267
|
-
break;
|
|
268
|
-
case "hsl-switch":
|
|
269
|
-
this.rgbDisplay = "flex";
|
|
270
|
-
this.hslDisplay = "none";
|
|
271
|
-
this.hexDisplay = "none";
|
|
272
|
-
break;
|
|
273
|
-
default:
|
|
274
|
-
this.rgbDisplay = "flex";
|
|
275
|
-
this.hslDisplay = "none";
|
|
276
|
-
this.hexDisplay = "none";
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
render() {
|
|
280
|
-
const hue = this.currentColor.hue;
|
|
281
|
-
const saturation = this.currentColor.saturation;
|
|
282
|
-
const lightness = this.currentColor.lightness;
|
|
283
|
-
const red = this.currentColor.red;
|
|
284
|
-
const green = this.currentColor.green;
|
|
285
|
-
const blue = this.currentColor.blue;
|
|
286
|
-
return (h("div", { class: "dnn-color-picker" },
|
|
287
|
-
h("div", { class: "dnn-color-sliders" },
|
|
288
|
-
h("div", { class: "dnn-color-s-b", ref: (element) => this.saturationLightnessBox = element, style: { backgroundColor: `hsl(${hue},100%,50%)` }, onMouseDown: this.handleSaturationLightnessMouseDown.bind(this) },
|
|
289
|
-
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: {
|
|
290
|
-
left: Math.round(saturation * 100) + "%",
|
|
291
|
-
bottom: Math.round(lightness * 100) + "%"
|
|
292
|
-
}, onKeyDown: (e) => this.handleSaturationLightnessKeyDown(e) })),
|
|
293
|
-
h("div", { class: "dnn-color-bar" },
|
|
294
|
-
h("div", { class: "dnn-color-result", style: {
|
|
295
|
-
backgroundColor: '#' + this.getHex(),
|
|
296
|
-
boxShadow: "0 0 2px 1px " + "#" + this.getContrast()
|
|
297
|
-
} }),
|
|
298
|
-
h("div", { class: "dnn-color-hue", ref: (element) => this.hueRange = element, onMouseDown: this.handleHueMouseDown.bind(this) },
|
|
299
|
-
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) })))),
|
|
300
|
-
h("div", { class: "dnn-color-fields" },
|
|
301
|
-
h("div", { class: "dnn-rgb-color-fields", style: { display: this.rgbDisplay } },
|
|
302
|
-
h("div", { class: "dnn-rgb-color-field" },
|
|
303
|
-
h("label", null, "R"),
|
|
304
|
-
h("input", { type: "number", min: "0", max: "255", step: "1", class: "red", value: red, "aria-label": "red value", onChange: (e) => this.handleComponentValueChange(e, 'red') })),
|
|
305
|
-
h("div", { class: "dnn-rgb-color-field" },
|
|
306
|
-
h("label", null, "G"),
|
|
307
|
-
h("input", { type: "number", min: "0", max: "255", class: "green", value: green, "aria-label": "green value", onChange: (e) => this.handleComponentValueChange(e, 'green') })),
|
|
308
|
-
h("div", { class: "dnn-rgb-color-field" },
|
|
309
|
-
h("label", null, "B"),
|
|
310
|
-
h("input", { type: "number", min: "0", max: "255", class: "blue", value: blue, "aria-label": "blue value", onChange: (e) => this.handleComponentValueChange(e, 'blue') })),
|
|
311
|
-
h("div", { class: "dnn-color-mode-switch" },
|
|
312
|
-
h("button", { id: "rgb-switch", onClick: this.switchColorMode.bind(this), "aria-label": "switch to hexadecimal value entry" },
|
|
313
|
-
h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" },
|
|
314
|
-
h("path", { d: "M0 0h24v24H0z", fill: "none" }),
|
|
315
|
-
h("path", { d: "M7 7h10v3l4-4-4-4v3H5v6h2V7zm10 10H7v-3l-4 4 4 4v-3h12v-6h-2v4z" }))))),
|
|
316
|
-
h("div", { class: "dnn-hsl-color-fields", style: { display: this.hslDisplay } },
|
|
317
|
-
h("div", { class: "dnn-hsl-color-field" },
|
|
318
|
-
h("label", null, "H"),
|
|
319
|
-
h("input", { type: "number", min: "0", max: "359", step: 1, value: Math.round(hue), "aria-label": "Hue", onChange: (e) => this.handleHSLChange(e, 'hue') })),
|
|
320
|
-
h("div", { class: "dnn-hsl-color-field" },
|
|
321
|
-
h("label", null, "S"),
|
|
322
|
-
h("input", { type: "number", min: "0", max: "100", step: 1, value: Math.round(saturation * 100), "aria-label": "Saturation", onChange: (e) => this.handleHSLChange(e, 'saturation') })),
|
|
323
|
-
h("div", { class: "dnn-hsl-color-field" },
|
|
324
|
-
h("label", null, "L"),
|
|
325
|
-
h("input", { type: "number", min: "0", max: "100", step: 1, value: Math.round(lightness * 100), "aria-label": "Lightness", onChange: (e) => this.handleHSLChange(e, 'lightness') })),
|
|
326
|
-
h("div", { class: "dnn-color-mode-switch" },
|
|
327
|
-
h("button", { id: "hsl-switch", onClick: this.switchColorMode.bind(this), "aria-label": "Switch to red, green, blue entry mode" },
|
|
328
|
-
h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" },
|
|
329
|
-
h("path", { d: "M0 0h24v24H0z", fill: "none" }),
|
|
330
|
-
h("path", { d: "M7 7h10v3l4-4-4-4v3H5v6h2V7zm10 10H7v-3l-4 4 4 4v-3h12v-6h-2v4z" }))))),
|
|
331
|
-
h("div", { class: "dnn-hex-color-fields", style: { display: this.hexDisplay } },
|
|
332
|
-
h("div", { class: "dnn-hex-color-field" },
|
|
333
|
-
h("label", null, "HEX"),
|
|
334
|
-
h("div", { class: "hex-input" },
|
|
335
|
-
h("input", { type: "text", "aria-label": "Hexadecimal value", value: this.getHex(), onChange: e => this.handleHexChange(e.target.value) }),
|
|
336
|
-
h("button", { class: "copy", "aria-label": "copy value" },
|
|
337
|
-
h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" },
|
|
338
|
-
h("path", { d: "M0 0h24v24H0z", fill: "none" }),
|
|
339
|
-
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" }))))),
|
|
340
|
-
h("div", { class: "dnn-color-mode-switch" },
|
|
341
|
-
h("button", { id: "hex-switch", onClick: this.switchColorMode.bind(this), "aria-label": "Switch to hue saturation lightness values" },
|
|
342
|
-
h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" },
|
|
343
|
-
h("path", { d: "M0 0h24v24H0z", fill: "none" }),
|
|
344
|
-
h("path", { d: "M7 7h10v3l4-4-4-4v3H5v6h2V7zm10 10H7v-3l-4 4 4 4v-3h12v-6h-2v4z" }))))))));
|
|
345
|
-
}
|
|
346
|
-
static get is() { return "dnn-color-picker"; }
|
|
347
|
-
static get encapsulation() { return "shadow"; }
|
|
348
|
-
static get originalStyleUrls() { return {
|
|
349
|
-
"$": ["dnn-color-picker.scss"]
|
|
350
|
-
}; }
|
|
351
|
-
static get styleUrls() { return {
|
|
352
|
-
"$": ["dnn-color-picker.css"]
|
|
353
|
-
}; }
|
|
354
|
-
static get properties() { return {
|
|
355
|
-
"color": {
|
|
356
|
-
"type": "string",
|
|
357
|
-
"mutable": false,
|
|
358
|
-
"complexType": {
|
|
359
|
-
"original": "string",
|
|
360
|
-
"resolved": "string",
|
|
361
|
-
"references": {}
|
|
362
|
-
},
|
|
363
|
-
"required": false,
|
|
364
|
-
"optional": false,
|
|
365
|
-
"docs": {
|
|
366
|
-
"tags": [],
|
|
367
|
-
"text": "Sets the initial color, must be a valid 8 character hexadecimal string without the # sign."
|
|
368
|
-
},
|
|
369
|
-
"attribute": "color",
|
|
370
|
-
"reflect": false,
|
|
371
|
-
"defaultValue": "\"FFFFFF\""
|
|
372
|
-
},
|
|
373
|
-
"colorBoxHeight": {
|
|
374
|
-
"type": "string",
|
|
375
|
-
"mutable": false,
|
|
376
|
-
"complexType": {
|
|
377
|
-
"original": "string",
|
|
378
|
-
"resolved": "string",
|
|
379
|
-
"references": {}
|
|
380
|
-
},
|
|
381
|
-
"required": false,
|
|
382
|
-
"optional": false,
|
|
383
|
-
"docs": {
|
|
384
|
-
"tags": [{
|
|
385
|
-
"name": "example",
|
|
386
|
-
"text": "100% renders a perfect square"
|
|
387
|
-
}],
|
|
388
|
-
"text": "Sets the width-height ratio of the color picker saturation-lightness box."
|
|
389
|
-
},
|
|
390
|
-
"attribute": "color-box-height",
|
|
391
|
-
"reflect": false,
|
|
392
|
-
"defaultValue": "\"50%\""
|
|
393
|
-
}
|
|
394
|
-
}; }
|
|
395
|
-
static get states() { return {
|
|
396
|
-
"currentColor": {},
|
|
397
|
-
"rgbDisplay": {},
|
|
398
|
-
"hslDisplay": {},
|
|
399
|
-
"hexDisplay": {}
|
|
400
|
-
}; }
|
|
401
|
-
static get events() { return [{
|
|
402
|
-
"method": "colorChanged",
|
|
403
|
-
"name": "colorChanged",
|
|
404
|
-
"bubbles": true,
|
|
405
|
-
"cancelable": true,
|
|
406
|
-
"composed": true,
|
|
407
|
-
"docs": {
|
|
408
|
-
"tags": [{
|
|
409
|
-
"name": "see",
|
|
410
|
-
"text": ".. /../utilities/colorInfo.ts"
|
|
411
|
-
}],
|
|
412
|
-
"text": "Fires up when the color is changed and emits a ColorInfo object"
|
|
413
|
-
},
|
|
414
|
-
"complexType": {
|
|
415
|
-
"original": "ColorInfo",
|
|
416
|
-
"resolved": "ColorInfo",
|
|
417
|
-
"references": {
|
|
418
|
-
"ColorInfo": {
|
|
419
|
-
"location": "import",
|
|
420
|
-
"path": "../../utilities/colorInfo"
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
}]; }
|
|
425
|
-
static get elementRef() { return "el"; }
|
|
426
|
-
static get watchers() { return [{
|
|
427
|
-
"propName": "currentColor",
|
|
428
|
-
"methodName": "handeCurrentColorChanged"
|
|
429
|
-
}]; }
|
|
430
|
-
}
|
|
431
|
-
__decorate([
|
|
432
|
-
Debounce(100)
|
|
433
|
-
], DnnColorPicker.prototype, "colorChangedHandler", null);
|
|
1
|
+
/** Reusable DNN UI component to pick a color
|
|
2
|
+
* @copyright Copyright (c) .NET Foundation. All rights reserved.
|
|
3
|
+
* @license MIT
|
|
4
|
+
*/
|
|
5
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
6
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
8
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
|
+
};
|
|
11
|
+
import { Component, h, State, Element, Prop, Event, Watch } from "@stencil/core";
|
|
12
|
+
import { ColorInfo } from '../../utilities/colorInfo';
|
|
13
|
+
import { Debounce } from "../../utilities/debounce";
|
|
14
|
+
/** Color Picker for Dnn */
|
|
15
|
+
export class DnnColorPicker {
|
|
16
|
+
constructor() {
|
|
17
|
+
/** Sets the initial color, must be a valid 8 character hexadecimal string without the # sign. */
|
|
18
|
+
this.color = "FFFFFF";
|
|
19
|
+
/** Sets the width-height ratio of the color picker saturation-lightness box.
|
|
20
|
+
* @example 100% renders a perfect square
|
|
21
|
+
*/
|
|
22
|
+
this.colorBoxHeight = "50%";
|
|
23
|
+
this.rgbDisplay = "flex";
|
|
24
|
+
this.hslDisplay = "none";
|
|
25
|
+
this.hexDisplay = "none";
|
|
26
|
+
this.handleSaturationLightnessMouseDown = (e) => {
|
|
27
|
+
e.preventDefault();
|
|
28
|
+
this.handleDragLightnessSaturation(e);
|
|
29
|
+
window.addEventListener('mousemove', this.handleDragLightnessSaturation);
|
|
30
|
+
window.addEventListener('mouseup', this.handleSaturationLightnessMouseUp);
|
|
31
|
+
};
|
|
32
|
+
this.handleDragLightnessSaturation = (e) => {
|
|
33
|
+
const rect = this.saturationLightnessBox.getBoundingClientRect();
|
|
34
|
+
let x = e.clientX - rect.left;
|
|
35
|
+
if (x < 0) {
|
|
36
|
+
x = 0;
|
|
37
|
+
}
|
|
38
|
+
if (x > rect.width) {
|
|
39
|
+
x = rect.width;
|
|
40
|
+
}
|
|
41
|
+
x = x / rect.width;
|
|
42
|
+
let y = e.clientY - rect.top;
|
|
43
|
+
if (y < 0) {
|
|
44
|
+
y = 0;
|
|
45
|
+
}
|
|
46
|
+
if (y > rect.height) {
|
|
47
|
+
y = rect.height;
|
|
48
|
+
}
|
|
49
|
+
y = 1 - (y / rect.height);
|
|
50
|
+
const newColor = new ColorInfo();
|
|
51
|
+
newColor.hue = this.currentColor.hue;
|
|
52
|
+
newColor.saturation = x;
|
|
53
|
+
newColor.lightness = y;
|
|
54
|
+
this.currentColor = newColor;
|
|
55
|
+
};
|
|
56
|
+
this.handleSaturationLightnessMouseUp = () => {
|
|
57
|
+
window.removeEventListener('mousemove', this.handleDragLightnessSaturation);
|
|
58
|
+
window.removeEventListener('mouseup', this.handleSaturationLightnessMouseUp);
|
|
59
|
+
};
|
|
60
|
+
this.handleHueMouseDown = (e) => {
|
|
61
|
+
e.preventDefault();
|
|
62
|
+
this.handleDragHue(e);
|
|
63
|
+
window.addEventListener('mousemove', this.handleDragHue);
|
|
64
|
+
window.addEventListener('mouseup', this.handleHueMouseUp);
|
|
65
|
+
};
|
|
66
|
+
this.handleHueMouseUp = () => {
|
|
67
|
+
window.removeEventListener('mousemove', this.handleDragHue);
|
|
68
|
+
window.removeEventListener('mouseup', this.handleHueMouseUp);
|
|
69
|
+
};
|
|
70
|
+
this.handleDragHue = (e) => {
|
|
71
|
+
const rect = this.hueRange.getBoundingClientRect();
|
|
72
|
+
let x = e.clientX - rect.left;
|
|
73
|
+
if (x < 0) {
|
|
74
|
+
x = 0;
|
|
75
|
+
}
|
|
76
|
+
if (x > rect.width) {
|
|
77
|
+
x = rect.width;
|
|
78
|
+
}
|
|
79
|
+
x = x / rect.width * 360;
|
|
80
|
+
const newColor = new ColorInfo();
|
|
81
|
+
newColor.hue = x;
|
|
82
|
+
newColor.saturation = this.currentColor.saturation;
|
|
83
|
+
newColor.lightness = this.currentColor.lightness;
|
|
84
|
+
this.currentColor = newColor;
|
|
85
|
+
};
|
|
86
|
+
this.handleComponentValueChange = (e, channel) => {
|
|
87
|
+
let value = parseInt(e.target.value);
|
|
88
|
+
if (isNaN(value)) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const newColor = new ColorInfo();
|
|
92
|
+
if (value < 0) {
|
|
93
|
+
value = 0;
|
|
94
|
+
}
|
|
95
|
+
if (value > 255) {
|
|
96
|
+
value = 255;
|
|
97
|
+
}
|
|
98
|
+
let r = this.currentColor.red;
|
|
99
|
+
let g = this.currentColor.green;
|
|
100
|
+
let b = this.currentColor.blue;
|
|
101
|
+
switch (channel) {
|
|
102
|
+
case 'red':
|
|
103
|
+
r = value;
|
|
104
|
+
break;
|
|
105
|
+
case 'green':
|
|
106
|
+
g = value;
|
|
107
|
+
break;
|
|
108
|
+
case 'blue':
|
|
109
|
+
b = value;
|
|
110
|
+
break;
|
|
111
|
+
default:
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
newColor.green = g;
|
|
115
|
+
newColor.red = r;
|
|
116
|
+
newColor.blue = b;
|
|
117
|
+
this.currentColor = newColor;
|
|
118
|
+
};
|
|
119
|
+
this.handleHSLChange = (e, component) => {
|
|
120
|
+
let value = parseInt(e.target.value);
|
|
121
|
+
if (isNaN(value)) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const newColor = new ColorInfo();
|
|
125
|
+
if (value != null) {
|
|
126
|
+
let h = this.currentColor.hue;
|
|
127
|
+
let s = this.currentColor.saturation;
|
|
128
|
+
let l = this.currentColor.lightness;
|
|
129
|
+
switch (component) {
|
|
130
|
+
case "hue":
|
|
131
|
+
if (value < 0) {
|
|
132
|
+
value = 0;
|
|
133
|
+
}
|
|
134
|
+
if (value > 359) {
|
|
135
|
+
value = 0;
|
|
136
|
+
}
|
|
137
|
+
h = value;
|
|
138
|
+
break;
|
|
139
|
+
case "saturation":
|
|
140
|
+
if (value < 0) {
|
|
141
|
+
value = 0;
|
|
142
|
+
}
|
|
143
|
+
if (value > 100) {
|
|
144
|
+
value = 100;
|
|
145
|
+
}
|
|
146
|
+
s = value / 100;
|
|
147
|
+
break;
|
|
148
|
+
case "lightness":
|
|
149
|
+
if (value < 0) {
|
|
150
|
+
value = 0;
|
|
151
|
+
}
|
|
152
|
+
if (value > 100) {
|
|
153
|
+
value = 100;
|
|
154
|
+
}
|
|
155
|
+
l = value / 100;
|
|
156
|
+
break;
|
|
157
|
+
default:
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
newColor.hue = h;
|
|
161
|
+
newColor.saturation = s;
|
|
162
|
+
newColor.lightness = l;
|
|
163
|
+
this.currentColor = newColor;
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
this.handleSaturationLightnessKeyDown = (e) => {
|
|
167
|
+
let newColor = new ColorInfo();
|
|
168
|
+
newColor.hue = this.currentColor.hue;
|
|
169
|
+
newColor.saturation = this.currentColor.saturation;
|
|
170
|
+
newColor.lightness = this.currentColor.lightness;
|
|
171
|
+
let value = 0.01;
|
|
172
|
+
if (e.shiftKey) {
|
|
173
|
+
value = 0.1;
|
|
174
|
+
}
|
|
175
|
+
switch (e.key) {
|
|
176
|
+
case "ArrowUp":
|
|
177
|
+
newColor.lightness += value;
|
|
178
|
+
break;
|
|
179
|
+
case "ArrowDown":
|
|
180
|
+
newColor.lightness -= value;
|
|
181
|
+
break;
|
|
182
|
+
case "ArrowLeft":
|
|
183
|
+
newColor.saturation -= value;
|
|
184
|
+
break;
|
|
185
|
+
case "ArrowRight":
|
|
186
|
+
newColor.saturation += value;
|
|
187
|
+
default:
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
this.currentColor = newColor;
|
|
191
|
+
};
|
|
192
|
+
this.handleHueKeyDown = (e) => {
|
|
193
|
+
let newColor = new ColorInfo();
|
|
194
|
+
newColor.hue = this.currentColor.hue;
|
|
195
|
+
newColor.saturation = this.currentColor.saturation;
|
|
196
|
+
newColor.lightness = this.currentColor.lightness;
|
|
197
|
+
let value = 1;
|
|
198
|
+
if (e.shiftKey) {
|
|
199
|
+
value = 10;
|
|
200
|
+
}
|
|
201
|
+
switch (e.key) {
|
|
202
|
+
case "ArrowLeft":
|
|
203
|
+
newColor.hue -= value;
|
|
204
|
+
break;
|
|
205
|
+
case "ArrowRight":
|
|
206
|
+
newColor.hue += value;
|
|
207
|
+
default:
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
this.currentColor = newColor;
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
colorChangedHandler(color) {
|
|
214
|
+
this.colorChanged.emit(color);
|
|
215
|
+
}
|
|
216
|
+
handeCurrentColorChanged(newValue) {
|
|
217
|
+
this.colorChangedHandler(newValue);
|
|
218
|
+
}
|
|
219
|
+
componentWillLoad() {
|
|
220
|
+
this.handleHexChange(this.color);
|
|
221
|
+
}
|
|
222
|
+
componentDidLoad() {
|
|
223
|
+
this.el.style.setProperty("--color-box-height", this.colorBoxHeight.toString());
|
|
224
|
+
}
|
|
225
|
+
getHex() {
|
|
226
|
+
return this.getDoublet(this.currentColor.red) + this.getDoublet(this.currentColor.green) + this.getDoublet(this.currentColor.blue);
|
|
227
|
+
}
|
|
228
|
+
getContrast() {
|
|
229
|
+
return this.currentColor.contrastColor;
|
|
230
|
+
}
|
|
231
|
+
getDoublet(value) {
|
|
232
|
+
const valueString = value.toString(16).toUpperCase();
|
|
233
|
+
if (valueString.length === 1) {
|
|
234
|
+
return '0' + valueString;
|
|
235
|
+
}
|
|
236
|
+
return valueString;
|
|
237
|
+
}
|
|
238
|
+
handleHexChange(value) {
|
|
239
|
+
const newColor = new ColorInfo();
|
|
240
|
+
if (value.match(/^(?:[\da-f]{3}|[\da-f]{6})$/i).length > 0) {
|
|
241
|
+
if (value.length === 3) {
|
|
242
|
+
let expanded = value[0] + value[0] + value[1] + value[1] + value[2] + value[2];
|
|
243
|
+
value = expanded;
|
|
244
|
+
}
|
|
245
|
+
newColor.red = parseInt(value.substr(0, 2), 16);
|
|
246
|
+
newColor.green = parseInt(value.substr(2, 2), 16);
|
|
247
|
+
newColor.blue = parseInt(value.substr(4, 2), 16);
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
newColor.red = this.currentColor.red;
|
|
251
|
+
newColor.green = this.currentColor.green;
|
|
252
|
+
newColor.blue = this.currentColor.blue;
|
|
253
|
+
}
|
|
254
|
+
this.currentColor = newColor;
|
|
255
|
+
}
|
|
256
|
+
switchColorMode(e) {
|
|
257
|
+
switch (e.target.id) {
|
|
258
|
+
case "rgb-switch":
|
|
259
|
+
this.rgbDisplay = "none";
|
|
260
|
+
this.hslDisplay = "none";
|
|
261
|
+
this.hexDisplay = "flex";
|
|
262
|
+
break;
|
|
263
|
+
case "hex-switch":
|
|
264
|
+
this.rgbDisplay = "none";
|
|
265
|
+
this.hslDisplay = "flex";
|
|
266
|
+
this.hexDisplay = "none";
|
|
267
|
+
break;
|
|
268
|
+
case "hsl-switch":
|
|
269
|
+
this.rgbDisplay = "flex";
|
|
270
|
+
this.hslDisplay = "none";
|
|
271
|
+
this.hexDisplay = "none";
|
|
272
|
+
break;
|
|
273
|
+
default:
|
|
274
|
+
this.rgbDisplay = "flex";
|
|
275
|
+
this.hslDisplay = "none";
|
|
276
|
+
this.hexDisplay = "none";
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
render() {
|
|
280
|
+
const hue = this.currentColor.hue;
|
|
281
|
+
const saturation = this.currentColor.saturation;
|
|
282
|
+
const lightness = this.currentColor.lightness;
|
|
283
|
+
const red = this.currentColor.red;
|
|
284
|
+
const green = this.currentColor.green;
|
|
285
|
+
const blue = this.currentColor.blue;
|
|
286
|
+
return (h("div", { class: "dnn-color-picker" },
|
|
287
|
+
h("div", { class: "dnn-color-sliders" },
|
|
288
|
+
h("div", { class: "dnn-color-s-b", ref: (element) => this.saturationLightnessBox = element, style: { backgroundColor: `hsl(${hue},100%,50%)` }, onMouseDown: this.handleSaturationLightnessMouseDown.bind(this) },
|
|
289
|
+
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: {
|
|
290
|
+
left: Math.round(saturation * 100) + "%",
|
|
291
|
+
bottom: Math.round(lightness * 100) + "%"
|
|
292
|
+
}, onKeyDown: (e) => this.handleSaturationLightnessKeyDown(e) })),
|
|
293
|
+
h("div", { class: "dnn-color-bar" },
|
|
294
|
+
h("div", { class: "dnn-color-result", style: {
|
|
295
|
+
backgroundColor: '#' + this.getHex(),
|
|
296
|
+
boxShadow: "0 0 2px 1px " + "#" + this.getContrast()
|
|
297
|
+
} }),
|
|
298
|
+
h("div", { class: "dnn-color-hue", ref: (element) => this.hueRange = element, onMouseDown: this.handleHueMouseDown.bind(this) },
|
|
299
|
+
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) })))),
|
|
300
|
+
h("div", { class: "dnn-color-fields" },
|
|
301
|
+
h("div", { class: "dnn-rgb-color-fields", style: { display: this.rgbDisplay } },
|
|
302
|
+
h("div", { class: "dnn-rgb-color-field" },
|
|
303
|
+
h("label", null, "R"),
|
|
304
|
+
h("input", { type: "number", min: "0", max: "255", step: "1", class: "red", value: red, "aria-label": "red value", onChange: (e) => this.handleComponentValueChange(e, 'red') })),
|
|
305
|
+
h("div", { class: "dnn-rgb-color-field" },
|
|
306
|
+
h("label", null, "G"),
|
|
307
|
+
h("input", { type: "number", min: "0", max: "255", class: "green", value: green, "aria-label": "green value", onChange: (e) => this.handleComponentValueChange(e, 'green') })),
|
|
308
|
+
h("div", { class: "dnn-rgb-color-field" },
|
|
309
|
+
h("label", null, "B"),
|
|
310
|
+
h("input", { type: "number", min: "0", max: "255", class: "blue", value: blue, "aria-label": "blue value", onChange: (e) => this.handleComponentValueChange(e, 'blue') })),
|
|
311
|
+
h("div", { class: "dnn-color-mode-switch" },
|
|
312
|
+
h("button", { id: "rgb-switch", onClick: this.switchColorMode.bind(this), "aria-label": "switch to hexadecimal value entry" },
|
|
313
|
+
h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" },
|
|
314
|
+
h("path", { d: "M0 0h24v24H0z", fill: "none" }),
|
|
315
|
+
h("path", { d: "M7 7h10v3l4-4-4-4v3H5v6h2V7zm10 10H7v-3l-4 4 4 4v-3h12v-6h-2v4z" }))))),
|
|
316
|
+
h("div", { class: "dnn-hsl-color-fields", style: { display: this.hslDisplay } },
|
|
317
|
+
h("div", { class: "dnn-hsl-color-field" },
|
|
318
|
+
h("label", null, "H"),
|
|
319
|
+
h("input", { type: "number", min: "0", max: "359", step: 1, value: Math.round(hue), "aria-label": "Hue", onChange: (e) => this.handleHSLChange(e, 'hue') })),
|
|
320
|
+
h("div", { class: "dnn-hsl-color-field" },
|
|
321
|
+
h("label", null, "S"),
|
|
322
|
+
h("input", { type: "number", min: "0", max: "100", step: 1, value: Math.round(saturation * 100), "aria-label": "Saturation", onChange: (e) => this.handleHSLChange(e, 'saturation') })),
|
|
323
|
+
h("div", { class: "dnn-hsl-color-field" },
|
|
324
|
+
h("label", null, "L"),
|
|
325
|
+
h("input", { type: "number", min: "0", max: "100", step: 1, value: Math.round(lightness * 100), "aria-label": "Lightness", onChange: (e) => this.handleHSLChange(e, 'lightness') })),
|
|
326
|
+
h("div", { class: "dnn-color-mode-switch" },
|
|
327
|
+
h("button", { id: "hsl-switch", onClick: this.switchColorMode.bind(this), "aria-label": "Switch to red, green, blue entry mode" },
|
|
328
|
+
h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" },
|
|
329
|
+
h("path", { d: "M0 0h24v24H0z", fill: "none" }),
|
|
330
|
+
h("path", { d: "M7 7h10v3l4-4-4-4v3H5v6h2V7zm10 10H7v-3l-4 4 4 4v-3h12v-6h-2v4z" }))))),
|
|
331
|
+
h("div", { class: "dnn-hex-color-fields", style: { display: this.hexDisplay } },
|
|
332
|
+
h("div", { class: "dnn-hex-color-field" },
|
|
333
|
+
h("label", null, "HEX"),
|
|
334
|
+
h("div", { class: "hex-input" },
|
|
335
|
+
h("input", { type: "text", "aria-label": "Hexadecimal value", value: this.getHex(), onChange: e => this.handleHexChange(e.target.value) }),
|
|
336
|
+
h("button", { class: "copy", "aria-label": "copy value" },
|
|
337
|
+
h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" },
|
|
338
|
+
h("path", { d: "M0 0h24v24H0z", fill: "none" }),
|
|
339
|
+
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" }))))),
|
|
340
|
+
h("div", { class: "dnn-color-mode-switch" },
|
|
341
|
+
h("button", { id: "hex-switch", onClick: this.switchColorMode.bind(this), "aria-label": "Switch to hue saturation lightness values" },
|
|
342
|
+
h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" },
|
|
343
|
+
h("path", { d: "M0 0h24v24H0z", fill: "none" }),
|
|
344
|
+
h("path", { d: "M7 7h10v3l4-4-4-4v3H5v6h2V7zm10 10H7v-3l-4 4 4 4v-3h12v-6h-2v4z" }))))))));
|
|
345
|
+
}
|
|
346
|
+
static get is() { return "dnn-color-picker"; }
|
|
347
|
+
static get encapsulation() { return "shadow"; }
|
|
348
|
+
static get originalStyleUrls() { return {
|
|
349
|
+
"$": ["dnn-color-picker.scss"]
|
|
350
|
+
}; }
|
|
351
|
+
static get styleUrls() { return {
|
|
352
|
+
"$": ["dnn-color-picker.css"]
|
|
353
|
+
}; }
|
|
354
|
+
static get properties() { return {
|
|
355
|
+
"color": {
|
|
356
|
+
"type": "string",
|
|
357
|
+
"mutable": false,
|
|
358
|
+
"complexType": {
|
|
359
|
+
"original": "string",
|
|
360
|
+
"resolved": "string",
|
|
361
|
+
"references": {}
|
|
362
|
+
},
|
|
363
|
+
"required": false,
|
|
364
|
+
"optional": false,
|
|
365
|
+
"docs": {
|
|
366
|
+
"tags": [],
|
|
367
|
+
"text": "Sets the initial color, must be a valid 8 character hexadecimal string without the # sign."
|
|
368
|
+
},
|
|
369
|
+
"attribute": "color",
|
|
370
|
+
"reflect": false,
|
|
371
|
+
"defaultValue": "\"FFFFFF\""
|
|
372
|
+
},
|
|
373
|
+
"colorBoxHeight": {
|
|
374
|
+
"type": "string",
|
|
375
|
+
"mutable": false,
|
|
376
|
+
"complexType": {
|
|
377
|
+
"original": "string",
|
|
378
|
+
"resolved": "string",
|
|
379
|
+
"references": {}
|
|
380
|
+
},
|
|
381
|
+
"required": false,
|
|
382
|
+
"optional": false,
|
|
383
|
+
"docs": {
|
|
384
|
+
"tags": [{
|
|
385
|
+
"name": "example",
|
|
386
|
+
"text": "100% renders a perfect square"
|
|
387
|
+
}],
|
|
388
|
+
"text": "Sets the width-height ratio of the color picker saturation-lightness box."
|
|
389
|
+
},
|
|
390
|
+
"attribute": "color-box-height",
|
|
391
|
+
"reflect": false,
|
|
392
|
+
"defaultValue": "\"50%\""
|
|
393
|
+
}
|
|
394
|
+
}; }
|
|
395
|
+
static get states() { return {
|
|
396
|
+
"currentColor": {},
|
|
397
|
+
"rgbDisplay": {},
|
|
398
|
+
"hslDisplay": {},
|
|
399
|
+
"hexDisplay": {}
|
|
400
|
+
}; }
|
|
401
|
+
static get events() { return [{
|
|
402
|
+
"method": "colorChanged",
|
|
403
|
+
"name": "colorChanged",
|
|
404
|
+
"bubbles": true,
|
|
405
|
+
"cancelable": true,
|
|
406
|
+
"composed": true,
|
|
407
|
+
"docs": {
|
|
408
|
+
"tags": [{
|
|
409
|
+
"name": "see",
|
|
410
|
+
"text": ".. /../utilities/colorInfo.ts"
|
|
411
|
+
}],
|
|
412
|
+
"text": "Fires up when the color is changed and emits a ColorInfo object"
|
|
413
|
+
},
|
|
414
|
+
"complexType": {
|
|
415
|
+
"original": "ColorInfo",
|
|
416
|
+
"resolved": "ColorInfo",
|
|
417
|
+
"references": {
|
|
418
|
+
"ColorInfo": {
|
|
419
|
+
"location": "import",
|
|
420
|
+
"path": "../../utilities/colorInfo"
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}]; }
|
|
425
|
+
static get elementRef() { return "el"; }
|
|
426
|
+
static get watchers() { return [{
|
|
427
|
+
"propName": "currentColor",
|
|
428
|
+
"methodName": "handeCurrentColorChanged"
|
|
429
|
+
}]; }
|
|
430
|
+
}
|
|
431
|
+
__decorate([
|
|
432
|
+
Debounce(100)
|
|
433
|
+
], DnnColorPicker.prototype, "colorChangedHandler", null);
|
|
434
434
|
//# sourceMappingURL=dnn-color-picker.js.map
|