@kubex/zinc 0.0.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +18 -0
- package/.eslintignore +8 -0
- package/.eslintrc.cjs +208 -0
- package/.github/workflows/eleventy_build.yml +42 -0
- package/.github/workflows/js_build_and_deploy.yaml +62 -0
- package/custom-elements-manifest.config.js +230 -0
- package/custom-elements.json +24227 -0
- package/docs/_includes/component.njk +340 -0
- package/docs/_includes/default.njk +137 -0
- package/docs/_includes/sidebar.njk +24 -0
- package/docs/_utilities/active-links.cjs +41 -0
- package/docs/_utilities/anchor-headings.cjs +74 -0
- package/docs/_utilities/cem.cjs +89 -0
- package/docs/_utilities/code-previews.cjs +98 -0
- package/docs/_utilities/copy-code-buttons.cjs +26 -0
- package/docs/_utilities/external-links.cjs +53 -0
- package/docs/_utilities/highlight-code.cjs +74 -0
- package/docs/_utilities/markdown.cjs +74 -0
- package/docs/_utilities/prettier.cjs +26 -0
- package/docs/_utilities/replacer.cjs +24 -0
- package/docs/_utilities/scrolling-tables.cjs +23 -0
- package/docs/_utilities/strings.cjs +16 -0
- package/docs/_utilities/table-of-contents.cjs +48 -0
- package/docs/_utilities/typography.cjs +24 -0
- package/docs/assets/icons.json +57989 -0
- package/docs/assets/images/chrome.png +0 -0
- package/docs/assets/images/edge.png +0 -0
- package/docs/assets/images/firefox.png +0 -0
- package/docs/assets/images/opera.png +0 -0
- package/docs/assets/images/safari.png +0 -0
- package/docs/assets/images/watermark.svg +1 -0
- package/docs/assets/rip.js +78 -0
- package/docs/assets/scripts/code-previews.js +250 -0
- package/docs/assets/scripts/docs.js +374 -0
- package/docs/assets/scripts/search.js +441 -0
- package/docs/assets/scripts/turbo.js +29 -0
- package/docs/assets/styles/code-previews.css +169 -0
- package/docs/assets/styles/docs.css +1168 -0
- package/docs/assets/styles/search.css +347 -0
- package/docs/eleventy.config.cjs +262 -0
- package/docs/pages/components/absolute-container.md +35 -0
- package/docs/pages/components/action-bar.md +58 -0
- package/docs/pages/components/alert.md +45 -0
- package/docs/pages/components/bulk-actions.md +26 -0
- package/docs/pages/components/button-group.md +78 -0
- package/docs/pages/components/button-menu.md +127 -0
- package/docs/pages/components/button.md +80 -0
- package/docs/pages/components/chart.md +27 -0
- package/docs/pages/components/checkbox-group.md +196 -0
- package/docs/pages/components/checkbox.md +157 -0
- package/docs/pages/components/chip.md +61 -0
- package/docs/pages/components/collapsible.md +52 -0
- package/docs/pages/components/cols.md +66 -0
- package/docs/pages/components/confirm.md +52 -0
- package/docs/pages/components/content-block.md +108 -0
- package/docs/pages/components/copy-button.md +22 -0
- package/docs/pages/components/data-select.md +54 -0
- package/docs/pages/components/data-table-filter.md +23 -0
- package/docs/pages/components/data-table-sort.md +20 -0
- package/docs/pages/components/data-table.md +74 -0
- package/docs/pages/components/datepicker.md +25 -0
- package/docs/pages/components/defined-label.md +26 -0
- package/docs/pages/components/dialog.md +145 -0
- package/docs/pages/components/dropdown.md +22 -0
- package/docs/pages/components/editor.md +26 -0
- package/docs/pages/components/empty-state.md +51 -0
- package/docs/pages/components/expanding-action.md +55 -0
- package/docs/pages/components/file.md +45 -0
- package/docs/pages/components/form-group.md +22 -0
- package/docs/pages/components/header.md +103 -0
- package/docs/pages/components/icon.md +322 -0
- package/docs/pages/components/inline-edit.md +41 -0
- package/docs/pages/components/input.md +261 -0
- package/docs/pages/components/item.md +78 -0
- package/docs/pages/components/linked-select.md +41 -0
- package/docs/pages/components/menu-item.md +22 -0
- package/docs/pages/components/menu.md +36 -0
- package/docs/pages/components/navbar.md +57 -0
- package/docs/pages/components/note.md +55 -0
- package/docs/pages/components/option.md +22 -0
- package/docs/pages/components/order-table.md +22 -0
- package/docs/pages/components/page-nav.md +23 -0
- package/docs/pages/components/pagination.md +22 -0
- package/docs/pages/components/pane.md +22 -0
- package/docs/pages/components/panel.md +124 -0
- package/docs/pages/components/popup.md +22 -0
- package/docs/pages/components/progress-bar.md +22 -0
- package/docs/pages/components/progress-tile.md +22 -0
- package/docs/pages/components/query-builder.md +148 -0
- package/docs/pages/components/radio-group.md +129 -0
- package/docs/pages/components/radio.md +20 -0
- package/docs/pages/components/rating.md +28 -0
- package/docs/pages/components/scroll-container.md +22 -0
- package/docs/pages/components/select.md +452 -0
- package/docs/pages/components/sidebar.md +28 -0
- package/docs/pages/components/simple-chart.md +23 -0
- package/docs/pages/components/skeleton.md +70 -0
- package/docs/pages/components/slideout.md +23 -0
- package/docs/pages/components/sp.md +87 -0
- package/docs/pages/components/split-button.md +32 -0
- package/docs/pages/components/split-pane.md +22 -0
- package/docs/pages/components/stat.md +24 -0
- package/docs/pages/components/status-indicator.md +13 -0
- package/docs/pages/components/stepper.md +20 -0
- package/docs/pages/components/style.md +106 -0
- package/docs/pages/components/table.md +22 -0
- package/docs/pages/components/tabs.md +57 -0
- package/docs/pages/components/textarea.md +120 -0
- package/docs/pages/components/tile-property.md +29 -0
- package/docs/pages/components/tile.md +51 -0
- package/docs/pages/components/timer.md +22 -0
- package/docs/pages/components/toggle.md +22 -0
- package/docs/pages/components/tooltip.md +242 -0
- package/docs/pages/components/vertical-stepper.md +22 -0
- package/docs/pages/components/well.md +13 -0
- package/docs/pages/getting-started/example-layout.md +143 -0
- package/docs/pages/getting-started/example-page.md +83 -0
- package/docs/pages/getting-started/form-controls.md +552 -0
- package/docs/pages/getting-started/form-examples.md +122 -0
- package/docs/pages/getting-started/table-examples.md +43 -0
- package/docs/pages/index.md +32 -0
- package/index.html +22 -0
- package/package.json +111 -11
- package/scripts/build.js +381 -0
- package/scripts/generator/generator.js +102 -0
- package/scripts/generator/index.js +17 -0
- package/scripts/generator/preprocess.js +20 -0
- package/scripts/generator/resolver.js +86 -0
- package/scripts/generator/tailwind.config.js +14 -0
- package/scripts/make-metadata.js +10 -0
- package/scripts/make-themes.js +27 -0
- package/scripts/plop/plopfile.js +63 -0
- package/scripts/plop/templates/component.hbs +43 -0
- package/scripts/plop/templates/define.hbs +12 -0
- package/scripts/plop/templates/docs.hbs +20 -0
- package/scripts/plop/templates/style.hbs +5 -0
- package/scripts/plop/templates/test.hbs +10 -0
- package/scss/_global-components.scss +4 -0
- package/scss/_global-spacing.scss +96 -0
- package/scss/_root.scss +202 -0
- package/scss/boot.scss +29 -0
- package/scss/mixins/_helper-mixins.scss +24 -0
- package/scss/mixins/_spacing-mixins.scss +84 -0
- package/scss/mixins/index.scss +2 -0
- package/scss/shared/_base.scss +138 -0
- package/scss/shared/_button.scss +27 -0
- package/scss/shared/_form-elements.scss +162 -0
- package/scss/shared/_opacity.scss +27 -0
- package/scss/shared/_reset.scss +288 -0
- package/scss/shared/_table.scss +73 -0
- package/scss/shared/divide.scss +41 -0
- package/scss/shared/index.scss +12 -0
- package/scss/shared/layout.scss +290 -0
- package/scss/shared/nav.scss +71 -0
- package/scss/themes/_dark.scss +277 -0
- package/scss/themes/_index.scss +3 -0
- package/scss/themes/_light.scss +540 -0
- package/scss/themes/_utility.scss +44 -0
- package/scss/variables/_spacing.scss +35 -0
- package/scss/variables/index.scss +1 -0
- package/src/components/absolute-container/absolute-container.component.ts +62 -0
- package/src/components/absolute-container/absolute-container.test.ts +10 -0
- package/src/components/absolute-container/index.ts +12 -0
- package/src/components/action-bar/action-bar.component.ts +41 -0
- package/src/components/action-bar/action-bar.scss +33 -0
- package/src/components/action-bar/action-bar.test.ts +10 -0
- package/src/components/action-bar/index.ts +12 -0
- package/src/components/alert/alert.component.ts +71 -0
- package/src/components/alert/alert.scss +170 -0
- package/src/components/alert/alert.test.ts +10 -0
- package/src/components/alert/index.ts +12 -0
- package/src/components/bulk-actions/bulk-actions.component.ts +229 -0
- package/src/components/bulk-actions/bulk-actions.scss +56 -0
- package/src/components/bulk-actions/bulk-actions.test.ts +10 -0
- package/src/components/bulk-actions/index.ts +12 -0
- package/src/components/button/button.component.ts +242 -0
- package/src/components/button/button.scss +346 -0
- package/src/components/button/button.test.ts +32 -0
- package/src/components/button/index.ts +12 -0
- package/src/components/button-group/button-group.component.ts +74 -0
- package/src/components/button-group/button-group.scss +39 -0
- package/src/components/button-group/button-group.test.ts +10 -0
- package/src/components/button-group/index.ts +12 -0
- package/src/components/button-menu/button-menu.component.ts +353 -0
- package/src/components/button-menu/button-menu.scss +41 -0
- package/src/components/button-menu/button-menu.test.ts +10 -0
- package/src/components/button-menu/index.ts +12 -0
- package/src/components/chart/chart.component.ts +206 -0
- package/src/components/chart/chart.scss +11 -0
- package/src/components/chart/chart.test.ts +10 -0
- package/src/components/chart/index.ts +12 -0
- package/src/components/checkbox/checkbox.component.ts +326 -0
- package/src/components/checkbox/checkbox.scss +202 -0
- package/src/components/checkbox/checkbox.test.ts +10 -0
- package/src/components/checkbox/index.ts +12 -0
- package/src/components/checkbox-group/checkbox-group.component.ts +351 -0
- package/src/components/checkbox-group/checkbox-group.scss +60 -0
- package/src/components/checkbox-group/checkbox-group.test.ts +10 -0
- package/src/components/checkbox-group/index.ts +12 -0
- package/src/components/chip/chip.component.ts +70 -0
- package/src/components/chip/chip.scss +101 -0
- package/src/components/chip/chip.test.ts +10 -0
- package/src/components/chip/index.ts +12 -0
- package/src/components/collapsible/collapsible.component.ts +86 -0
- package/src/components/collapsible/collapsible.scss +100 -0
- package/src/components/collapsible/collapsible.test.ts +10 -0
- package/src/components/collapsible/index.ts +12 -0
- package/src/components/cols/cols.component.ts +76 -0
- package/src/components/cols/cols.scss +99 -0
- package/src/components/cols/cols.test.ts +10 -0
- package/src/components/cols/index.ts +12 -0
- package/src/components/confirm/confirm.component.ts +181 -0
- package/src/components/confirm/confirm.scss +44 -0
- package/src/components/confirm/confirm.test.ts +10 -0
- package/src/components/confirm/index.ts +12 -0
- package/src/components/content-block/content-block.component.ts +225 -0
- package/src/components/content-block/content-block.scss +64 -0
- package/src/components/content-block/content-block.test.ts +10 -0
- package/src/components/content-block/index.ts +12 -0
- package/src/components/copy-button/copy-button.component.ts +163 -0
- package/src/components/copy-button/copy-button.scss +47 -0
- package/src/components/copy-button/copy-button.test.ts +10 -0
- package/src/components/copy-button/index.ts +12 -0
- package/src/components/data-select/data-select.component.ts +219 -0
- package/src/components/data-select/data-select.scss +43 -0
- package/src/components/data-select/data-select.test.ts +10 -0
- package/src/components/data-select/index.ts +12 -0
- package/src/components/data-select/providers/color-data-provider.ts +16 -0
- package/src/components/data-select/providers/country-code-data-provider.ts +517 -0
- package/src/components/data-select/providers/country-data-provider.ts +527 -0
- package/src/components/data-select/providers/currency-data-provider.ts +328 -0
- package/src/components/data-select/providers/provider.ts +32 -0
- package/src/components/data-table/data-table.component.ts +1093 -0
- package/src/components/data-table/data-table.scss +330 -0
- package/src/components/data-table/data-table.test.ts +10 -0
- package/src/components/data-table/index.ts +12 -0
- package/src/components/data-table-filter/data-table-filter.component.ts +126 -0
- package/src/components/data-table-filter/data-table-filter.scss +22 -0
- package/src/components/data-table-filter/data-table-filter.test.ts +10 -0
- package/src/components/data-table-filter/index.ts +12 -0
- package/src/components/data-table-sort/data-table-sort.component.ts +56 -0
- package/src/components/data-table-sort/data-table-sort.scss +37 -0
- package/src/components/data-table-sort/data-table-sort.test.ts +10 -0
- package/src/components/data-table-sort/index.ts +12 -0
- package/src/components/datepicker/datepicker.component.ts +315 -0
- package/src/components/datepicker/datepicker.scss +237 -0
- package/src/components/datepicker/datepicker.test.ts +10 -0
- package/src/components/datepicker/index.ts +12 -0
- package/src/components/defined-label/defined-label.component.ts +241 -0
- package/src/components/defined-label/defined-label.scss +43 -0
- package/src/components/defined-label/defined-label.test.ts +10 -0
- package/src/components/defined-label/index.ts +12 -0
- package/src/components/dialog/dialog.component.ts +237 -0
- package/src/components/dialog/dialog.scss +197 -0
- package/src/components/dialog/dialog.test.ts +10 -0
- package/src/components/dialog/index.ts +12 -0
- package/src/components/dropdown/dropdown.component.ts +380 -0
- package/src/components/dropdown/dropdown.scss +9 -0
- package/src/components/dropdown/dropdown.test.ts +10 -0
- package/src/components/dropdown/index.ts +12 -0
- package/src/components/editor/editor.component.ts +423 -0
- package/src/components/editor/editor.scss +131 -0
- package/src/components/editor/editor.test.ts +10 -0
- package/src/components/editor/index.ts +12 -0
- package/src/components/editor/modules/attachment-module.ts +195 -0
- package/src/components/editor/modules/dialog-module/dialog-module.component.ts +289 -0
- package/src/components/editor/modules/dialog-module/dialog-module.scss +115 -0
- package/src/components/editor/modules/dialog-module/dialog-module.ts +99 -0
- package/src/components/editor/modules/drag-drop-module.ts +125 -0
- package/src/components/editor/modules/events/zn-command-select.ts +7 -0
- package/src/components/editor/modules/events/zn-editor-update.ts +7 -0
- package/src/components/editor/modules/events/zn-show-canned-response-dialog.ts +15 -0
- package/src/components/editor/modules/image-resize-module/image-resize-module.ts +157 -0
- package/src/components/editor/modules/menu-module/menu-module.component.ts +149 -0
- package/src/components/editor/modules/menu-module/menu-module.scss +17 -0
- package/src/components/editor/modules/menu-module/menu-module.ts +203 -0
- package/src/components/editor/modules/time-tracking-module.ts +35 -0
- package/src/components/empty-state/empty-state.component.ts +63 -0
- package/src/components/empty-state/empty-state.scss +91 -0
- package/src/components/empty-state/empty-state.test.ts +10 -0
- package/src/components/empty-state/index.ts +12 -0
- package/src/components/expanding-action/expanding-action.component.ts +312 -0
- package/src/components/expanding-action/expanding-action.scss +87 -0
- package/src/components/expanding-action/expanding-action.test.ts +10 -0
- package/src/components/expanding-action/index.ts +12 -0
- package/src/components/file/file.component.ts +619 -0
- package/src/components/file/file.scss +200 -0
- package/src/components/file/file.test.ts +10 -0
- package/src/components/file/index.ts +12 -0
- package/src/components/form-group/form-group.component.ts +93 -0
- package/src/components/form-group/form-group.scss +84 -0
- package/src/components/form-group/form-group.test.ts +10 -0
- package/src/components/form-group/index.ts +12 -0
- package/src/components/header/header.component.ts +186 -0
- package/src/components/header/header.scss +244 -0
- package/src/components/header/header.test.ts +10 -0
- package/src/components/header/index.ts +12 -0
- package/src/components/hover-container/hover-container.component.ts +214 -0
- package/src/components/hover-container/hover-container.scss +59 -0
- package/src/components/hover-container/hover-container.ts +10 -0
- package/src/components/hover-container/index.ts +12 -0
- package/src/components/icon/icon.component.ts +251 -0
- package/src/components/icon/icon.scss +186 -0
- package/src/components/icon/icon.test.ts +10 -0
- package/src/components/icon/index.ts +13 -0
- package/src/components/icon/lni.scss +2492 -0
- package/src/components/inline-edit/index.ts +12 -0
- package/src/components/inline-edit/inline-edit.component.ts +289 -0
- package/src/components/inline-edit/inline-edit.scss +139 -0
- package/src/components/inline-edit/inline-edit.test.ts +10 -0
- package/src/components/input/index.ts +12 -0
- package/src/components/input/input.component.ts +614 -0
- package/src/components/input/input.scss +355 -0
- package/src/components/input/input.test.ts +10 -0
- package/src/components/item/index.ts +12 -0
- package/src/components/item/item.component.ts +102 -0
- package/src/components/item/item.scss +161 -0
- package/src/components/item/item.test.ts +10 -0
- package/src/components/linked-select/index.ts +12 -0
- package/src/components/linked-select/linked-select.component.ts +156 -0
- package/src/components/linked-select/linked-select.scss +9 -0
- package/src/components/linked-select/linked-select.test.ts +17 -0
- package/src/components/menu/index.ts +12 -0
- package/src/components/menu/menu.component.ts +243 -0
- package/src/components/menu/menu.scss +14 -0
- package/src/components/menu/menu.test.ts +10 -0
- package/src/components/menu-item/index.ts +12 -0
- package/src/components/menu-item/menu-item.component.ts +220 -0
- package/src/components/menu-item/menu-item.scss +157 -0
- package/src/components/menu-item/menu-item.test.ts +10 -0
- package/src/components/menu-item/submenu-controller.ts +291 -0
- package/src/components/navbar/index.ts +12 -0
- package/src/components/navbar/navbar.component.ts +240 -0
- package/src/components/navbar/navbar.scss +411 -0
- package/src/components/navbar/navbar.test.ts +10 -0
- package/src/components/note/index.ts +12 -0
- package/src/components/note/note.component.ts +60 -0
- package/src/components/note/note.scss +69 -0
- package/src/components/note/note.test.ts +10 -0
- package/src/components/option/index.ts +12 -0
- package/src/components/option/option.component.ts +152 -0
- package/src/components/option/option.scss +88 -0
- package/src/components/option/option.test.ts +10 -0
- package/src/components/order-table/index.ts +12 -0
- package/src/components/order-table/order-table.component.ts +323 -0
- package/src/components/order-table/order-table.scss +154 -0
- package/src/components/order-table/order-table.test.ts +10 -0
- package/src/components/page-nav/index.ts +12 -0
- package/src/components/page-nav/page-nav.component.ts +117 -0
- package/src/components/page-nav/page-nav.scss +155 -0
- package/src/components/page-nav/page-nav.test.ts +10 -0
- package/src/components/pagination/index.ts +12 -0
- package/src/components/pagination/pagination.component.ts +91 -0
- package/src/components/pagination/pagination.scss +76 -0
- package/src/components/pagination/pagination.test.ts +10 -0
- package/src/components/pane/index.ts +12 -0
- package/src/components/pane/pane.component.ts +52 -0
- package/src/components/pane/pane.scss +45 -0
- package/src/components/pane/pane.test.ts +10 -0
- package/src/components/panel/index.ts +12 -0
- package/src/components/panel/panel.component.ts +100 -0
- package/src/components/panel/panel.scss +129 -0
- package/src/components/panel/panel.test.ts +10 -0
- package/src/components/popup/index.ts +12 -0
- package/src/components/popup/popup.component.ts +543 -0
- package/src/components/popup/popup.scss +59 -0
- package/src/components/popup/popup.test.ts +10 -0
- package/src/components/progress-bar/index.ts +12 -0
- package/src/components/progress-bar/progress-bar.component.ts +80 -0
- package/src/components/progress-bar/progress-bar.scss +46 -0
- package/src/components/progress-bar/progress-bar.test.ts +10 -0
- package/src/components/progress-tile/index.ts +12 -0
- package/src/components/progress-tile/progress-tile.component.ts +127 -0
- package/src/components/progress-tile/progress-tile.scss +116 -0
- package/src/components/progress-tile/progress-tile.test.ts +10 -0
- package/src/components/query-builder/index.ts +12 -0
- package/src/components/query-builder/query-builder.component.ts +544 -0
- package/src/components/query-builder/query-builder.scss +53 -0
- package/src/components/query-builder/query-builder.test.ts +10 -0
- package/src/components/radio/index.ts +12 -0
- package/src/components/radio/radio.component.ts +305 -0
- package/src/components/radio/radio.scss +197 -0
- package/src/components/radio/radio.test.ts +10 -0
- package/src/components/radio-group/index.ts +12 -0
- package/src/components/radio-group/radio-group.component.ts +362 -0
- package/src/components/radio-group/radio-group.scss +60 -0
- package/src/components/radio-group/radio-group.test.ts +10 -0
- package/src/components/rating/index.ts +12 -0
- package/src/components/rating/rating.component.ts +235 -0
- package/src/components/rating/rating.scss +82 -0
- package/src/components/rating/rating.test.ts +10 -0
- package/src/components/scroll-container/index.ts +12 -0
- package/src/components/scroll-container/scroll-container.component.ts +41 -0
- package/src/components/scroll-container/scroll-container.scss +17 -0
- package/src/components/scroll-container/scroll-container.test.ts +10 -0
- package/src/components/select/index.ts +12 -0
- package/src/components/select/select.component.ts +984 -0
- package/src/components/select/select.scss +325 -0
- package/src/components/select/select.test.ts +10 -0
- package/src/components/sidebar/index.ts +12 -0
- package/src/components/sidebar/sidebar.component.ts +98 -0
- package/src/components/sidebar/sidebar.scss +294 -0
- package/src/components/sidebar/sidebar.test.ts +10 -0
- package/src/components/simple-chart/index.ts +12 -0
- package/src/components/simple-chart/simple-chart.component.ts +204 -0
- package/src/components/simple-chart/simple-chart.scss +9 -0
- package/src/components/simple-chart/simple-chart.test.ts +10 -0
- package/src/components/skeleton/index.ts +12 -0
- package/src/components/skeleton/skeleton.component.ts +34 -0
- package/src/components/skeleton/skeleton.scss +39 -0
- package/src/components/skeleton/skeleton.test.ts +10 -0
- package/src/components/slideout/index.ts +12 -0
- package/src/components/slideout/slideout.component.ts +223 -0
- package/src/components/slideout/slideout.scss +96 -0
- package/src/components/slideout/slideout.test.ts +10 -0
- package/src/components/sp/index.ts +12 -0
- package/src/components/sp/sp.component.ts +86 -0
- package/src/components/sp/sp.scss +88 -0
- package/src/components/sp/sp.test.ts +10 -0
- package/src/components/split-button/index.ts +12 -0
- package/src/components/split-button/split-button.component.ts +154 -0
- package/src/components/split-button/split-button.scss +9 -0
- package/src/components/split-button/split-button.test.ts +10 -0
- package/src/components/split-pane/index.ts +12 -0
- package/src/components/split-pane/split-pane.component.ts +195 -0
- package/src/components/split-pane/split-pane.scss +303 -0
- package/src/components/split-pane/split-pane.test.ts +10 -0
- package/src/components/stat/index.ts +12 -0
- package/src/components/stat/stat.component.ts +117 -0
- package/src/components/stat/stat.scss +92 -0
- package/src/components/stat/stat.test.ts +10 -0
- package/src/components/status-indicator/index.ts +12 -0
- package/src/components/status-indicator/status-indicator.component.ts +31 -0
- package/src/components/status-indicator/status-indicator.scss +32 -0
- package/src/components/status-indicator/status-indicator.test.ts +10 -0
- package/src/components/stepper/index.ts +12 -0
- package/src/components/stepper/stepper.component.ts +80 -0
- package/src/components/stepper/stepper.scss +88 -0
- package/src/components/stepper/stepper.test.ts +10 -0
- package/src/components/style/index.ts +12 -0
- package/src/components/style/style.component.ts +150 -0
- package/src/components/style/style.scss +1 -0
- package/src/components/style/style.test.ts +10 -0
- package/src/components/table/index.ts +12 -0
- package/src/components/table/table.component.ts +297 -0
- package/src/components/table/table.scss +209 -0
- package/src/components/table/table.test.ts +10 -0
- package/src/components/tabs/index.ts +12 -0
- package/src/components/tabs/tabs.component.ts +496 -0
- package/src/components/tabs/tabs.scss +147 -0
- package/src/components/tabs/tabs.test.ts +10 -0
- package/src/components/textarea/index.ts +12 -0
- package/src/components/textarea/textarea.component.ts +417 -0
- package/src/components/textarea/textarea.scss +152 -0
- package/src/components/textarea/textarea.test.ts +10 -0
- package/src/components/tile/index.ts +12 -0
- package/src/components/tile/tile.component.ts +105 -0
- package/src/components/tile/tile.scss +144 -0
- package/src/components/tile/tile.test.ts +10 -0
- package/src/components/tile-property/index.ts +12 -0
- package/src/components/tile-property/tile-property.component.ts +43 -0
- package/src/components/tile-property/tile-property.scss +43 -0
- package/src/components/tile-property/tile-property.test.ts +10 -0
- package/src/components/timer/index.ts +12 -0
- package/src/components/timer/timer.component.ts +88 -0
- package/src/components/timer/timer.scss +40 -0
- package/src/components/timer/timer.test.ts +10 -0
- package/src/components/toggle/index.ts +12 -0
- package/src/components/toggle/toggle.component.ts +203 -0
- package/src/components/toggle/toggle.scss +93 -0
- package/src/components/toggle/toggle.test.ts +10 -0
- package/src/components/tooltip/index.ts +12 -0
- package/src/components/tooltip/tooltip.component.ts +215 -0
- package/src/components/tooltip/tooltip.scss +43 -0
- package/src/components/tooltip/tooltip.test.ts +10 -0
- package/src/components/vertical-stepper/index.ts +12 -0
- package/src/components/vertical-stepper/vertical-stepper.component.ts +53 -0
- package/src/components/vertical-stepper/vertical-stepper.scss +84 -0
- package/src/components/vertical-stepper/vertical-stepper.test.ts +10 -0
- package/src/components/well/index.ts +12 -0
- package/src/components/well/well.component.ts +43 -0
- package/src/components/well/well.scss +19 -0
- package/src/components/well/well.test.ts +10 -0
- package/src/declaration.d.ts +39 -0
- package/src/events/events.ts +7 -0
- package/src/events/zn-after-collapse.ts +7 -0
- package/src/events/zn-after-expand.ts +7 -0
- package/src/events/zn-after-hide.ts +7 -0
- package/src/events/zn-after-show.ts +7 -0
- package/src/events/zn-blur.ts +7 -0
- package/src/events/zn-cancel.ts +7 -0
- package/src/events/zn-change.ts +7 -0
- package/src/events/zn-clear.ts +7 -0
- package/src/events/zn-close.ts +7 -0
- package/src/events/zn-collapse.ts +7 -0
- package/src/events/zn-copy.ts +7 -0
- package/src/events/zn-element-added.ts +7 -0
- package/src/events/zn-error.ts +7 -0
- package/src/events/zn-expand.ts +7 -0
- package/src/events/zn-filter-change.ts +7 -0
- package/src/events/zn-finish.ts +7 -0
- package/src/events/zn-focus.ts +7 -0
- package/src/events/zn-hide.ts +7 -0
- package/src/events/zn-hover.ts +10 -0
- package/src/events/zn-initial-focus.ts +7 -0
- package/src/events/zn-input.ts +7 -0
- package/src/events/zn-invalid.ts +7 -0
- package/src/events/zn-load.ts +7 -0
- package/src/events/zn-menu-ready.ts +9 -0
- package/src/events/zn-menu-select.ts +9 -0
- package/src/events/zn-open.ts +7 -0
- package/src/events/zn-remove.ts +7 -0
- package/src/events/zn-request-close.ts +7 -0
- package/src/events/zn-select.ts +9 -0
- package/src/events/zn-show.ts +7 -0
- package/src/events/zn-sort-change.ts +7 -0
- package/src/events/zn-submit.ts +7 -0
- package/src/form-control.scss +123 -0
- package/src/internal/animate.ts +64 -0
- package/src/internal/default-value.ts +49 -0
- package/src/internal/event.ts +75 -0
- package/src/internal/form.ts +527 -0
- package/src/internal/offset.ts +13 -0
- package/src/internal/scroll.ts +69 -0
- package/src/internal/slot.ts +110 -0
- package/src/internal/storage.ts +70 -0
- package/src/internal/tabbable.ts +198 -0
- package/src/internal/theme.ts +54 -0
- package/src/internal/watch.ts +63 -0
- package/src/internal/zinc-element.ts +113 -0
- package/src/translations/en.ts +30 -0
- package/src/utilities/animation-registry.ts +74 -0
- package/src/utilities/base-path.ts +46 -0
- package/src/utilities/lit-to-html.ts +7 -0
- package/src/utilities/localize.ts +37 -0
- package/src/utilities/md5.ts +216 -0
- package/src/utilities/on.ts +29 -0
- package/src/utilities/query.ts +36 -0
- package/src/wc.scss +33 -0
- package/src/zinc-autoloader.ts +58 -0
- package/src/zinc.ts +83 -0
- package/tsconfig.json +41 -0
- package/tsconfig.prod.json +12 -0
- package/vscode.html-custom-data.json +2804 -0
- package/web-test-runner.config.js +50 -0
- package/web-types.json +6420 -0
- package/zn.d.ts +6318 -0
- package/zn.min.css +1 -0
- package/zn.min.js +3701 -0
- package/.idea/.name +0 -1
- package/.idea/fusion.iml +0 -9
- package/.idea/modules.xml +0 -8
- package/.idea/php.xml +0 -4
- package/.idea/vcs.xml +0 -6
- package/.idea/watcherTasks.xml +0 -25
- package/components/Blank/demo/demo.html +0 -11
- package/components/Blank/dist/zn-blank.js +0 -39
- package/components/Blank/go/component.go +0 -18
- package/components/Blank/go/go.mod +0 -3
- package/components/Blank/package.json +0 -33
- package/components/Blank/php/composer.json +0 -25
- package/components/Blank/php/src/Blank.php +0 -15
- package/components/Blank/rollup.config.js +0 -32
- package/components/Blank/scss/Styles.scss +0 -6
- package/components/Blank/ts/Component.ts +0 -15
- package/components/Blank/tsconfig.json +0 -7
- package/components/Icon/demo/demo.html +0 -90
- package/components/Icon/dist/zn-icon.js +0 -55
- package/components/Icon/go/component.go +0 -56
- package/components/Icon/go/go.mod +0 -3
- package/components/Icon/package.json +0 -33
- package/components/Icon/php/composer.json +0 -26
- package/components/Icon/php/src/Icon.php +0 -38
- package/components/Icon/php/src/Library.php +0 -17
- package/components/Icon/php/src/Size.php +0 -42
- package/components/Icon/roadmap.md +0 -7
- package/components/Icon/rollup.config.js +0 -32
- package/components/Icon/scss/Styles.scss +0 -65
- package/components/Icon/ts/Component.ts +0 -108
- package/components/Icon/ts/md5.ts +0 -215
- package/components/Icon/tsconfig.json +0 -7
- package/components/MaxWidth/demo/demo.html +0 -11
- package/components/MaxWidth/dist/zn-max-width.js +0 -51
- package/components/MaxWidth/go/component.go +0 -24
- package/components/MaxWidth/go/go.mod +0 -3
- package/components/MaxWidth/package.json +0 -33
- package/components/MaxWidth/php/composer.json +0 -25
- package/components/MaxWidth/php/src/MaxWidth.php +0 -32
- package/components/MaxWidth/rollup.config.js +0 -32
- package/components/MaxWidth/scss/Styles.scss +0 -13
- package/components/MaxWidth/ts/Component.ts +0 -27
- package/components/MaxWidth/tsconfig.json +0 -7
- package/components/roadmap.md +0 -4
- package/layout/components/Columns/demo/demo.html +0 -16
- package/layout/components/Columns/ts/Component.ts +0 -59
- package/layout/demo/index.html +0 -24
- package/layout/dist/zn-layout.js +0 -87
- package/layout/package.json +0 -38
- package/layout/rollup.config.js +0 -38
- package/layout/scss/layout.scss +0 -24
- package/layout/tailwind.config.js +0 -42
- package/layout/ts/import.ts +0 -2
- package/layout/tsconfig.json +0 -7
- /package/{layout/components/Columns/scss/Styles.scss → src/internal/zinc-element.test.ts} +0 -0
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
import {type CSSResultGroup, html, type PropertyValues, unsafeCSS} from 'lit';
|
|
2
|
+
import {FormControlController} from '../../internal/form';
|
|
3
|
+
import {property, query} from 'lit/decorators.js';
|
|
4
|
+
import AttachmentModule from "./modules/attachment-module";
|
|
5
|
+
import DialogModule from "./modules/dialog-module/dialog-module";
|
|
6
|
+
import DragAndDropModule from "./modules/drag-drop-module";
|
|
7
|
+
import ImageResizeModule from "./modules/image-resize-module/image-resize-module";
|
|
8
|
+
import MenuModule from "./modules/menu-module/menu-module";
|
|
9
|
+
import Quill, {Range} from "quill";
|
|
10
|
+
import TimeTrackingModule from "./modules/time-tracking-module";
|
|
11
|
+
import ZincElement from '../../internal/zinc-element';
|
|
12
|
+
import type {ZincFormControl} from '../../internal/zinc-element';
|
|
13
|
+
import type {ZnShowCannedResponseDialogEvent} from "./modules/events/zn-show-canned-response-dialog";
|
|
14
|
+
import type DialogModuleComponent from "./modules/dialog-module/dialog-module.component";
|
|
15
|
+
import type MenuModuleComponent from "./modules/menu-module/menu-module.component";
|
|
16
|
+
|
|
17
|
+
import styles from './editor.scss';
|
|
18
|
+
|
|
19
|
+
export interface CannedResponse {
|
|
20
|
+
title: string;
|
|
21
|
+
content: string;
|
|
22
|
+
command: string;
|
|
23
|
+
labels?: string[];
|
|
24
|
+
count: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @summary Short summary of the component's intended use.
|
|
29
|
+
* @documentation https://zinc.style/components/editor
|
|
30
|
+
* @status experimental
|
|
31
|
+
* @since 1.0
|
|
32
|
+
*
|
|
33
|
+
* @dependency zn-example
|
|
34
|
+
*
|
|
35
|
+
* @event zn-event-name - Emitted as an example.
|
|
36
|
+
*
|
|
37
|
+
* @slot - The default slot.
|
|
38
|
+
* @slot example - An example slot.
|
|
39
|
+
*
|
|
40
|
+
* @csspart base - The component's base wrapper.
|
|
41
|
+
*
|
|
42
|
+
* @cssproperty --example - An example CSS custom property.
|
|
43
|
+
*/
|
|
44
|
+
export default class ZnEditor extends ZincElement implements ZincFormControl {
|
|
45
|
+
static styles: CSSResultGroup = unsafeCSS(styles);
|
|
46
|
+
|
|
47
|
+
private formControlController = new FormControlController(this, {});
|
|
48
|
+
|
|
49
|
+
@query('#editor')
|
|
50
|
+
private editor: HTMLElement;
|
|
51
|
+
|
|
52
|
+
@query('#editorHtml')
|
|
53
|
+
private editorHtml: HTMLTextAreaElement;
|
|
54
|
+
|
|
55
|
+
@property() name: string;
|
|
56
|
+
@property() value: string;
|
|
57
|
+
|
|
58
|
+
@property({attribute: 'interaction-type', type: String})
|
|
59
|
+
interactionType: 'ticket' | 'chat' = 'chat';
|
|
60
|
+
|
|
61
|
+
@property({attribute: 'canned-responses', type: Array})
|
|
62
|
+
cannedResponses: any[];
|
|
63
|
+
|
|
64
|
+
@property({attribute: 'canned-responses-url'}) cannedResponsesUri: string;
|
|
65
|
+
|
|
66
|
+
@property({attribute: 'attachment-url', type: String})
|
|
67
|
+
uploadAttachmentUrl: string;
|
|
68
|
+
|
|
69
|
+
private quillElement: Quill;
|
|
70
|
+
|
|
71
|
+
get validity(): ValidityState {
|
|
72
|
+
return this.editorHtml.validity;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
get validationMessage(): string {
|
|
76
|
+
return this.editorHtml.validationMessage;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
checkValidity(): boolean {
|
|
80
|
+
return this.editorHtml.checkValidity();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
getForm(): HTMLFormElement | null {
|
|
84
|
+
return this.formControlController.getForm();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
reportValidity(): boolean {
|
|
88
|
+
return this.editorHtml.reportValidity();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
setCustomValidity(message: string): void {
|
|
92
|
+
this.editorHtml.setCustomValidity(message);
|
|
93
|
+
this.formControlController.updateValidity();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
protected firstUpdated(_changedProperties: PropertyValues) {
|
|
97
|
+
this.formControlController.updateValidity();
|
|
98
|
+
|
|
99
|
+
const bindings = this._getQuillKeyboardBindings();
|
|
100
|
+
|
|
101
|
+
Quill.register('modules/dialogModule', DialogModule as any);
|
|
102
|
+
Quill.register('modules/menuModule', MenuModule as any);
|
|
103
|
+
Quill.register('modules/attachmentModule', AttachmentModule as any);
|
|
104
|
+
Quill.register('modules/timeTrackingModule', TimeTrackingModule as any);
|
|
105
|
+
Quill.register('modules/dragAndDropModule', DragAndDropModule as any);
|
|
106
|
+
Quill.register('modules/imageResizeModule', ImageResizeModule as any);
|
|
107
|
+
|
|
108
|
+
this._updateIcons();
|
|
109
|
+
const attachmentInput = this.getForm()?.querySelector('input[name="attachments"]');
|
|
110
|
+
const startTimeInput = this.getForm()?.querySelector('input[name="startTime"]');
|
|
111
|
+
const openTimeInput = this.getForm()?.querySelector('input[name="openTime"]');
|
|
112
|
+
|
|
113
|
+
const container = [
|
|
114
|
+
['bold', 'italic', 'underline', 'strike'],
|
|
115
|
+
['undo', 'redo'],
|
|
116
|
+
[{'list': 'ordered'}, {'list': 'bullet'}],
|
|
117
|
+
];
|
|
118
|
+
container.push(this.interactionType === 'ticket' ? ['link', 'image', 'attachment'] : ['link', 'image', 'video']);
|
|
119
|
+
container.push(['remove-formatting']);
|
|
120
|
+
|
|
121
|
+
const quill = new Quill(this.editor, {
|
|
122
|
+
modules: {
|
|
123
|
+
toolbar: {
|
|
124
|
+
container,
|
|
125
|
+
handlers: {
|
|
126
|
+
'attachment': () => null,
|
|
127
|
+
'placeholder': function (value: string) {
|
|
128
|
+
if (value) {
|
|
129
|
+
const editor: Quill | null = this.quill;
|
|
130
|
+
if (editor) {
|
|
131
|
+
const cursorPosition = editor.getSelection()?.index;
|
|
132
|
+
if (cursorPosition) {
|
|
133
|
+
editor.insertText(cursorPosition, value);
|
|
134
|
+
editor.setSelection(new Range(cursorPosition, value.length));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
'redo': () => this.quillElement.history.redo(),
|
|
140
|
+
'undo': () => this.quillElement.history.undo(),
|
|
141
|
+
'remove-formatting': () => {
|
|
142
|
+
const range = this.quillElement.getSelection();
|
|
143
|
+
if (range) {
|
|
144
|
+
this.quillElement.formatText(range.index, range.length, 'bold', false);
|
|
145
|
+
this.quillElement.formatText(range.index, range.length, 'italic', false);
|
|
146
|
+
this.quillElement.formatText(range.index, range.length, 'underline', false);
|
|
147
|
+
this.quillElement.formatText(range.index, range.length, 'strike', false);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
keyboard: {
|
|
154
|
+
bindings: bindings
|
|
155
|
+
},
|
|
156
|
+
dialogModule: {},
|
|
157
|
+
menuModule: {
|
|
158
|
+
cannedResponses: this.cannedResponses,
|
|
159
|
+
cannedResponsesUri: this.cannedResponsesUri
|
|
160
|
+
},
|
|
161
|
+
timeTrackingModule: {
|
|
162
|
+
startTimeInput: startTimeInput as HTMLInputElement,
|
|
163
|
+
openTimeInput: openTimeInput as HTMLInputElement
|
|
164
|
+
},
|
|
165
|
+
attachmentModule: {
|
|
166
|
+
attachmentInput: attachmentInput,
|
|
167
|
+
onFileUploaded: () => {
|
|
168
|
+
window.onbeforeunload = () => null;
|
|
169
|
+
},
|
|
170
|
+
upload: (file: File) => {
|
|
171
|
+
window.onbeforeunload = () => 'You have unsaved changes. Are you sure you want to leave?';
|
|
172
|
+
return new Promise((resolve, _) => {
|
|
173
|
+
const fd = new FormData();
|
|
174
|
+
fd.append('filename', file.name);
|
|
175
|
+
fd.append('size', file.size.toString());
|
|
176
|
+
fd.append('mimeType', file.type);
|
|
177
|
+
|
|
178
|
+
const xhr = new XMLHttpRequest();
|
|
179
|
+
xhr.open('POST', this.uploadAttachmentUrl, true);
|
|
180
|
+
xhr.onload = () => {
|
|
181
|
+
if (xhr.status === 200) {
|
|
182
|
+
const response = JSON.parse(xhr.responseText);
|
|
183
|
+
resolve({path: response.uploadPath, url: response.uploadUrl, filename: response.originalFilename});
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
xhr.send(fd);
|
|
187
|
+
});
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
imageResizeModule: {}
|
|
191
|
+
},
|
|
192
|
+
placeholder: 'Compose your reply...',
|
|
193
|
+
theme: 'snow',
|
|
194
|
+
bounds: this.editor,
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
this.quillElement = quill;
|
|
198
|
+
|
|
199
|
+
this._supplyPlaceholderDialog();
|
|
200
|
+
|
|
201
|
+
// @ts-expect-error getSelection is available it lies.
|
|
202
|
+
const hasShadowRootSelection = !!(document.createElement('div').attachShadow({mode: 'open'}).getSelection);
|
|
203
|
+
// Each browser engine has a different implementation for retrieving the Range
|
|
204
|
+
const getNativeRange = (rootNode: any): any => {
|
|
205
|
+
try {
|
|
206
|
+
if (hasShadowRootSelection) {
|
|
207
|
+
// In Chromium, the shadow root has a getSelection function which returns the range
|
|
208
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
|
209
|
+
return rootNode?.getSelection()?.getRangeAt(0);
|
|
210
|
+
} else {
|
|
211
|
+
const selection = window.getSelection();
|
|
212
|
+
// @ts-expect-error getComposedRanges is available it lies.
|
|
213
|
+
if (selection.getComposedRanges) {
|
|
214
|
+
// Webkit range retrieval is done with getComposedRanges (see: https://bugs.webkit.org/show_bug.cgi?id=163921)
|
|
215
|
+
// @ts-ignore
|
|
216
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
217
|
+
return selection?.getComposedRanges(rootNode)[0];
|
|
218
|
+
} else {
|
|
219
|
+
// Gecko implements the range API properly in Native Shadow: https://developer.mozilla.org/en-US/docs/Web/API/Selection/getRangeAt
|
|
220
|
+
// @ts-ignore
|
|
221
|
+
return selection.getRangeAt(0);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
} catch {
|
|
225
|
+
return null;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Original implementation uses document.active element which does not work in Native Shadow.
|
|
231
|
+
* Replace document.activeElement with shadowRoot.activeElement
|
|
232
|
+
**/
|
|
233
|
+
quill.selection.hasFocus = function () {
|
|
234
|
+
const rootNode = quill.root.getRootNode() as Document | ShadowRoot;
|
|
235
|
+
return rootNode.activeElement === quill.root;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Original implementation uses document.getSelection which does not work in Native Shadow.
|
|
240
|
+
* Replace document.getSelection with shadow dom equivalent (different for each browser)
|
|
241
|
+
**/
|
|
242
|
+
quill.selection.getNativeRange = function () {
|
|
243
|
+
const rootNode = quill.root.getRootNode();
|
|
244
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
245
|
+
const nativeRange = getNativeRange(rootNode);
|
|
246
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
247
|
+
return nativeRange ? quill.selection.normalizeNative(nativeRange) : null;
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Original implementation relies on Selection.addRange to programmatically set the range, which does not work
|
|
252
|
+
* in Webkit with Native Shadow. Selection.addRange works fine in Chromium and Gecko.
|
|
253
|
+
**/
|
|
254
|
+
quill.selection.setNativeRange = function (startNode: Element, startOffset: any) {
|
|
255
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,prefer-rest-params
|
|
256
|
+
let endNode: any = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : startNode;
|
|
257
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,prefer-rest-params
|
|
258
|
+
let endOffset: any = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : startOffset;
|
|
259
|
+
// eslint-disable-next-line prefer-rest-params,@typescript-eslint/no-unsafe-assignment
|
|
260
|
+
const force: any = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
261
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
262
|
+
if (startNode !== null && (quill.selection.root.parentNode === null || startNode.parentNode === null || endNode.parentNode === null)) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const selection = document.getSelection();
|
|
266
|
+
if (selection === null) return;
|
|
267
|
+
if (startNode !== null) {
|
|
268
|
+
if (!quill.selection.hasFocus()) quill.selection.root.focus();
|
|
269
|
+
const native = (quill.selection.getNativeRange() || {}).native;
|
|
270
|
+
// @ts-ignore
|
|
271
|
+
if (native === null || force || startNode !== native?.startContainer || startOffset !== native.startOffset || endNode !== native.endContainer || endOffset !== native.endOffset) {
|
|
272
|
+
if (startNode.tagName === "BR") {
|
|
273
|
+
// @ts-ignore
|
|
274
|
+
startOffset = [].indexOf.call(startNode.parentNode.childNodes, startNode);
|
|
275
|
+
startNode = startNode.parentNode as Element;
|
|
276
|
+
}
|
|
277
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
278
|
+
if (endNode.tagName === "BR") {
|
|
279
|
+
// @ts-ignore
|
|
280
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-argument
|
|
281
|
+
endOffset = [].indexOf.call(endNode.parentNode.childNodes, endNode);
|
|
282
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
|
|
283
|
+
endNode = endNode.parentNode;
|
|
284
|
+
}
|
|
285
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
286
|
+
selection.setBaseAndExtent(startNode, startOffset, endNode, endOffset);
|
|
287
|
+
}
|
|
288
|
+
} else {
|
|
289
|
+
selection.removeAllRanges();
|
|
290
|
+
quill.selection.root.blur();
|
|
291
|
+
document.body.focus();
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// Listen for 'View All' click from menu module
|
|
296
|
+
document.addEventListener('zn-show-canned-response-dialog', (e: ZnShowCannedResponseDialogEvent) => {
|
|
297
|
+
const dialog: DialogModuleComponent | null = document.querySelector('zn-dialog-module');
|
|
298
|
+
const dialogModule = this.quillElement.getModule('dialogModule') as DialogModule;
|
|
299
|
+
if (dialog && dialogModule && e.detail.commands) {
|
|
300
|
+
dialogModule.setCommands(e.detail.commands);
|
|
301
|
+
dialog.allCommands = e.detail.commands; // Need a ref of original list when searching
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Subscribe to selection change separately, because emitter in Quill doesn't catch this event in Shadow DOM
|
|
307
|
+
**/
|
|
308
|
+
document.addEventListener('selectionchange', () => this.quillElement.selection.update());
|
|
309
|
+
|
|
310
|
+
document.addEventListener('zn-editor-update', this._handleTextChange.bind(this));
|
|
311
|
+
quill.on('text-change', this._handleTextChange.bind(this));
|
|
312
|
+
|
|
313
|
+
this._setupTitleAttributes(quill);
|
|
314
|
+
|
|
315
|
+
const delta = quill.clipboard.convert({html: this.value});
|
|
316
|
+
quill.setContents(delta, Quill.sources.SILENT);
|
|
317
|
+
|
|
318
|
+
this.emit('zn-element-added', {detail: {element: this.editor}});
|
|
319
|
+
super.firstUpdated(_changedProperties);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
private _handleTextChange() {
|
|
323
|
+
this.value = this.quillElement.root.innerHTML;
|
|
324
|
+
this.editorHtml.value = this.value;
|
|
325
|
+
this.emit('zn-change');
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
private _updateIcons() {
|
|
329
|
+
// @ts-expect-error icons has no type
|
|
330
|
+
const icons: { [key: string]: string } = Quill.import("ui/icons");
|
|
331
|
+
if (icons) {
|
|
332
|
+
icons["undo"] = `<zn-icon src="undo" size="20"></zn-icon>`;
|
|
333
|
+
icons["redo"] = `<zn-icon src="redo" size="20"></zn-icon>`;
|
|
334
|
+
icons["remove-formatting"] = `<zn-icon src="format_clear" size="20"></zn-icon>`;
|
|
335
|
+
|
|
336
|
+
if (this.interactionType === 'ticket') {
|
|
337
|
+
icons["attachment"] = `<zn-icon src="attachment" size="20"></zn-icon>`;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
private _getQuillKeyboardBindings() {
|
|
343
|
+
const bindings = {
|
|
344
|
+
'remove-formatting': {
|
|
345
|
+
key: 'V',
|
|
346
|
+
shiftKey: true,
|
|
347
|
+
handler: (_range: any, context: any) => {
|
|
348
|
+
const clipboard = context.event.clipboardData;
|
|
349
|
+
const text = clipboard.getData('text/plain');
|
|
350
|
+
const html = clipboard.getData('text/html');
|
|
351
|
+
const delta = this.quillElement.clipboard.convert({html: html, text: text});
|
|
352
|
+
this.quillElement.setContents(delta, 'silent');
|
|
353
|
+
this.quillElement.setSelection(delta.length(), Quill.sources.SILENT);
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
const empty = (value: string) => {
|
|
359
|
+
const match = value.match(/[^<pbr\s>/]/);
|
|
360
|
+
return match === null;
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
if (this.interactionType === 'chat') {
|
|
364
|
+
// @ts-expect-error bindings has no type
|
|
365
|
+
bindings['enter'] = {
|
|
366
|
+
key: 'Enter',
|
|
367
|
+
shiftKey: false,
|
|
368
|
+
handler: () => {
|
|
369
|
+
const dialog = document.querySelector('zn-dialog-module') as DialogModuleComponent | null;
|
|
370
|
+
const isDialogOpen = dialog?.open ?? false;
|
|
371
|
+
const menu = document.querySelector('zn-menu-module') as MenuModuleComponent | null;
|
|
372
|
+
const isMenuOpen = menu?.open ?? false;
|
|
373
|
+
if (!isMenuOpen && !isDialogOpen) {
|
|
374
|
+
const form = this.closest('form');
|
|
375
|
+
if (form && this.value && this.value.trim().length > 0 && !empty(this.value)) {
|
|
376
|
+
this.emit('zn-submit', {detail: {value: this.value, element: this}});
|
|
377
|
+
form.requestSubmit();
|
|
378
|
+
this.quillElement.setText('');
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
return bindings;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
private _supplyPlaceholderDialog() {
|
|
389
|
+
const placeholderItems: HTMLElement[] = Array.prototype.slice.call(this.shadowRoot?.querySelectorAll('.ql-placeholder .ql-picker-item'));
|
|
390
|
+
placeholderItems.forEach((item) => {
|
|
391
|
+
item.textContent = item.dataset.value ?? ''
|
|
392
|
+
});
|
|
393
|
+
placeholderItems.forEach((item) => item.classList.remove('ql-selected'));
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
private _setupTitleAttributes(quill: Quill) {
|
|
397
|
+
const toolbar = quill.container.previousSibling as HTMLElement;
|
|
398
|
+
if (toolbar) {
|
|
399
|
+
toolbar.querySelector('button.ql-bold')?.setAttribute('title', 'Bold');
|
|
400
|
+
toolbar.querySelector('button.ql-italic')?.setAttribute('title', 'Italic');
|
|
401
|
+
toolbar.querySelector('button.ql-underline')?.setAttribute('title', 'Underline');
|
|
402
|
+
toolbar.querySelector('button.ql-strike')?.setAttribute('title', 'Strikethrough');
|
|
403
|
+
toolbar.querySelector('button.ql-undo')?.setAttribute('title', 'Undo');
|
|
404
|
+
toolbar.querySelector('button.ql-redo')?.setAttribute('title', 'Redo');
|
|
405
|
+
toolbar.querySelector('button.ql-redo')?.setAttribute('title', 'Redo');
|
|
406
|
+
toolbar.querySelector('button.ql-list[value="ordered"]')?.setAttribute('title', 'Ordered List');
|
|
407
|
+
toolbar.querySelector('button.ql-list[value="bullet"]')?.setAttribute('title', 'Bullet List');
|
|
408
|
+
toolbar.querySelector('button.ql-link')?.setAttribute('title', 'Link');
|
|
409
|
+
toolbar.querySelector('button.ql-image')?.setAttribute('title', 'Image');
|
|
410
|
+
toolbar.querySelector('button.ql-remove-formatting')?.setAttribute('title', 'Remove Formatting');
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
render() {
|
|
415
|
+
return html`
|
|
416
|
+
<div id="editor"></div>
|
|
417
|
+
<input type="text" id="editorHtml" name="${this.name}" value="${this.value}" style="display: none;">
|
|
418
|
+
<div id="action-container" class="ql-toolbar ql-snow">
|
|
419
|
+
<slot name="actions"></slot>
|
|
420
|
+
</div>
|
|
421
|
+
`;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
@use "sass:map";
|
|
2
|
+
@use "../../../node_modules/quill/dist/quill.core.css";
|
|
3
|
+
@use "../../../node_modules/quill/dist/quill.snow.css" as snow;
|
|
4
|
+
@use "../../wc";
|
|
5
|
+
|
|
6
|
+
:host, zn-editor {
|
|
7
|
+
width: 100%;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
:host {
|
|
11
|
+
@include wc.scrollbars;
|
|
12
|
+
text-rendering: optimizeLegibility;
|
|
13
|
+
-webkit-font-smoothing: antialiased;
|
|
14
|
+
-moz-osx-font-smoothing: grayscale;
|
|
15
|
+
min-height: 170px;
|
|
16
|
+
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
background-color: rgb(var(--zn-body));
|
|
20
|
+
margin: 0;
|
|
21
|
+
padding: 0;
|
|
22
|
+
max-height: 100%;
|
|
23
|
+
flex: 1;
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
|
|
26
|
+
.ql-container {
|
|
27
|
+
border: none;
|
|
28
|
+
appearance: none;
|
|
29
|
+
background-color: transparent;
|
|
30
|
+
resize: none;
|
|
31
|
+
padding: 20px 20px 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.ql-toolbar {
|
|
35
|
+
border: 0 solid rgb(var(--zn-border-color));
|
|
36
|
+
border-bottom-width: 1px;
|
|
37
|
+
color: rgb(var(--zn-text-heading));
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-wrap: wrap;
|
|
40
|
+
gap: 5px;
|
|
41
|
+
|
|
42
|
+
> span.ql-formats {
|
|
43
|
+
margin: 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
> span {
|
|
47
|
+
padding-top: 2px;
|
|
48
|
+
padding-bottom: 2px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&:after {
|
|
52
|
+
display: none;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.ql-editor {
|
|
57
|
+
position: relative;
|
|
58
|
+
width: 100%;
|
|
59
|
+
height: 100%;
|
|
60
|
+
max-height: 100%;
|
|
61
|
+
overflow-y: auto;
|
|
62
|
+
flex-grow: 1;
|
|
63
|
+
color: rgb(var(--zn-text));
|
|
64
|
+
background-color: rgba(var(--zn-panel), var(--zn-panel-opacity));
|
|
65
|
+
font-size: 15px;
|
|
66
|
+
padding: var(--zn-spacing-medium);
|
|
67
|
+
|
|
68
|
+
img {
|
|
69
|
+
max-width: 40%;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.ql-editor.ql-blank:before {
|
|
74
|
+
right: var(--zn-spacing-medium);
|
|
75
|
+
left: var(--zn-spacing-medium);
|
|
76
|
+
color: rgb(var(--zn-text));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
#editor {
|
|
80
|
+
flex: 1;
|
|
81
|
+
height: 0;
|
|
82
|
+
padding: 0;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
#toolbar-container, #action-container {
|
|
86
|
+
justify-content: space-between;
|
|
87
|
+
align-items: center;
|
|
88
|
+
|
|
89
|
+
.wrap {
|
|
90
|
+
flex-grow: 1;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
#action-container.ql-toolbar {
|
|
95
|
+
border-top-width: 1px;
|
|
96
|
+
border-bottom-width: 0;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.ql-stroke {
|
|
100
|
+
stroke: rgb(var(--zn-text-heading));
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.ql-fill {
|
|
104
|
+
fill: rgb(var(--zn-text-heading));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.ql-picker-label:before {
|
|
108
|
+
color: rgb(var(--zn-text-heading));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.ql-image svg {
|
|
112
|
+
fill: currentColor;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.ql-placeholder {
|
|
117
|
+
width: 110px;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.ql-placeholder .ql-picker-label::before {
|
|
121
|
+
content: 'Placeholder';
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.ql-code-block-container .ql-ui {
|
|
125
|
+
color: rgb(var(--zn-text))
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
.ql-code-block {
|
|
130
|
+
font-size: 90%;
|
|
131
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import '../../../dist/zn.min.js';
|
|
2
|
+
import { expect, fixture, html } from '@open-wc/testing';
|
|
3
|
+
|
|
4
|
+
describe('<zn-editor>', () => {
|
|
5
|
+
it('should render a component', async () => {
|
|
6
|
+
const el = await fixture(html` <zn-editor></zn-editor> `);
|
|
7
|
+
|
|
8
|
+
expect(el).to.exist;
|
|
9
|
+
});
|
|
10
|
+
});
|