@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,39 @@
|
|
|
1
|
+
@use "../../wc";
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
display: contents;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.button-group {
|
|
8
|
+
display: flex;
|
|
9
|
+
justify-content: flex-end;
|
|
10
|
+
flex-wrap: wrap;
|
|
11
|
+
|
|
12
|
+
&--start {
|
|
13
|
+
justify-content: flex-start;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&--grow {
|
|
17
|
+
width: 100%;
|
|
18
|
+
gap: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&--gap {
|
|
22
|
+
gap: var(--zn-spacing-x-small);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
:host([direction="vertical"]),
|
|
27
|
+
zn-button-group[direction="vertical"] {
|
|
28
|
+
width: 100%;
|
|
29
|
+
|
|
30
|
+
.button-group {
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
justify-content: flex-start;
|
|
33
|
+
gap: 10px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
::slotted(*) {
|
|
37
|
+
width: 100%;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import '../../../dist/zn.min.js';
|
|
2
|
+
import { expect, fixture, html } from '@open-wc/testing';
|
|
3
|
+
|
|
4
|
+
describe('<zn-button-group>', () => {
|
|
5
|
+
it('should render a component', async () => {
|
|
6
|
+
const el = await fixture(html` <zn-button-group></zn-button-group> `);
|
|
7
|
+
|
|
8
|
+
expect(el).to.exist;
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import ZnButtonGroup from './button-group.component';
|
|
2
|
+
|
|
3
|
+
export * from './button-group.component';
|
|
4
|
+
export default ZnButtonGroup;
|
|
5
|
+
|
|
6
|
+
ZnButtonGroup.define('zn-button-group');
|
|
7
|
+
|
|
8
|
+
declare global {
|
|
9
|
+
interface HTMLElementTagNameMap {
|
|
10
|
+
'zn-button-group': ZnButtonGroup;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import {classMap} from "lit/directives/class-map.js";
|
|
2
|
+
import {type CSSResultGroup, html, type PropertyValues, unsafeCSS} from 'lit';
|
|
3
|
+
import {property} from 'lit/decorators.js';
|
|
4
|
+
import {watch} from "../../internal/watch";
|
|
5
|
+
import ZincElement from '../../internal/zinc-element';
|
|
6
|
+
import type ZnButton from "../button";
|
|
7
|
+
import type ZnConfirm from "../confirm";
|
|
8
|
+
import type ZnMenuItem from "../menu-item";
|
|
9
|
+
|
|
10
|
+
import styles from './button-menu.scss';
|
|
11
|
+
|
|
12
|
+
interface CustomButtonWidths {
|
|
13
|
+
button: ZnButton;
|
|
14
|
+
width: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @summary Automatically hides buttons in a menu when the screen is too small.
|
|
19
|
+
* @documentation https://zinc.style/components/button-menu
|
|
20
|
+
* @status experimental
|
|
21
|
+
* @since 1.0
|
|
22
|
+
*
|
|
23
|
+
* @slot - The default slot.
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
export default class ZnButtonMenu extends ZincElement {
|
|
27
|
+
static styles: CSSResultGroup = unsafeCSS(styles);
|
|
28
|
+
|
|
29
|
+
@property({type: Number, attribute: 'max-width'})
|
|
30
|
+
public maxWidth: number;
|
|
31
|
+
|
|
32
|
+
@property({type: Number})
|
|
33
|
+
public containerWidth: number;
|
|
34
|
+
|
|
35
|
+
@property({type: Number, attribute: 'limit'})
|
|
36
|
+
public limit: number = -1;
|
|
37
|
+
|
|
38
|
+
@property({type: Number, attribute: 'max-level'})
|
|
39
|
+
public maxLevel: number = 2; // primary = 1, secondary = 2, transparent = 3
|
|
40
|
+
|
|
41
|
+
@property({}) size: 'content' | 'x-small' | 'small' | 'medium' | 'large' = 'medium';
|
|
42
|
+
|
|
43
|
+
@property({type: Boolean, attribute: 'no-gap'}) public noGap: boolean;
|
|
44
|
+
|
|
45
|
+
@property({type: Boolean, attribute: 'no-padding'}) public noPadding: boolean;
|
|
46
|
+
|
|
47
|
+
private _buttons: CustomButtonWidths[] = [];
|
|
48
|
+
|
|
49
|
+
private _originalButtons: CustomButtonWidths[] = [];
|
|
50
|
+
|
|
51
|
+
private resizeObserver: ResizeObserver | null = null;
|
|
52
|
+
|
|
53
|
+
protected async firstUpdated(_changedProperties: PropertyValues) {
|
|
54
|
+
super.firstUpdated(_changedProperties);
|
|
55
|
+
|
|
56
|
+
const buttons = this.querySelectorAll<ZnButton>('zn-button');
|
|
57
|
+
|
|
58
|
+
for (const button of buttons) {
|
|
59
|
+
// wait for the buttons to finish rendering
|
|
60
|
+
await button.updateComplete;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
this._originalButtons = Array.from(buttons).map((button: ZnButton) => {
|
|
64
|
+
return {
|
|
65
|
+
button: button,
|
|
66
|
+
width: Math.max(button.offsetWidth, 150)
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// remove buttons
|
|
71
|
+
this.querySelectorAll('zn-button').forEach((button: ZnButton) => {
|
|
72
|
+
button.remove();
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
this.containerWidth = this.parentNode ? (this.parentNode as HTMLElement).offsetWidth : 0;
|
|
76
|
+
if (this.maxWidth) {
|
|
77
|
+
this.containerWidth = Math.min(this.containerWidth, this.maxWidth);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@watch('containerWidth', {waitUntilFirstUpdate: true})
|
|
82
|
+
watchContainerMaxWidth() {
|
|
83
|
+
if (this.maxWidth) {
|
|
84
|
+
this.containerWidth = Math.min(this.containerWidth, this.maxWidth);
|
|
85
|
+
}
|
|
86
|
+
this.calculateVisibleButtons();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
connectedCallback() {
|
|
90
|
+
super.connectedCallback();
|
|
91
|
+
this.containerWidth = this.offsetWidth;
|
|
92
|
+
|
|
93
|
+
this.resizeObserver = new ResizeObserver(this.handleResize.bind(this));
|
|
94
|
+
this.resizeObserver.observe(this.parentNode as HTMLElement); // Observe the parent node
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
disconnectedCallback() {
|
|
98
|
+
super.disconnectedCallback();
|
|
99
|
+
|
|
100
|
+
if (this.resizeObserver) {
|
|
101
|
+
this.resizeObserver.disconnect();
|
|
102
|
+
this.resizeObserver = null;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
handleResize = () => {
|
|
107
|
+
this.containerWidth = this.offsetWidth;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
calculateVisibleButtons() {
|
|
111
|
+
const containerWidth = this.containerWidth;
|
|
112
|
+
|
|
113
|
+
let primaryButtons = 0;
|
|
114
|
+
let secondaryButtons = 0;
|
|
115
|
+
|
|
116
|
+
let visibleButtons = 0;
|
|
117
|
+
let totalButtons = 0;
|
|
118
|
+
let remainingWidth = containerWidth;
|
|
119
|
+
this._buttons = [...this._originalButtons];
|
|
120
|
+
remainingWidth -= 50; // Allow for more-vert button
|
|
121
|
+
|
|
122
|
+
// Sort the buttons
|
|
123
|
+
this._buttons.sort((a, b) => {
|
|
124
|
+
const aWidth = a.button.hasAttribute('primary') ? 1 : a.button.hasAttribute('secondary') ? 2 : 3;
|
|
125
|
+
const bWidth = b.button.hasAttribute('primary') ? 1 : b.button.hasAttribute('secondary') ? 2 : 3;
|
|
126
|
+
|
|
127
|
+
return aWidth - bWidth;
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
// Calculate the number of visible buttons
|
|
131
|
+
this._buttons.forEach((button: CustomButtonWidths) => {
|
|
132
|
+
totalButtons++;
|
|
133
|
+
if (button.button.hasAttribute('primary')) {
|
|
134
|
+
primaryButtons++;
|
|
135
|
+
} else if (button.button.hasAttribute('secondary')) {
|
|
136
|
+
secondaryButtons++;
|
|
137
|
+
}
|
|
138
|
+
// remove button width and some default padding and spacing
|
|
139
|
+
if ((remainingWidth - button.width) > 0) {
|
|
140
|
+
remainingWidth -= button.width;
|
|
141
|
+
visibleButtons++;
|
|
142
|
+
} else {
|
|
143
|
+
remainingWidth = 0
|
|
144
|
+
}
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
if (this.maxLevel < 2) {
|
|
148
|
+
this.limit = this.limit > 0 ? Math.min(this.limit, primaryButtons) : primaryButtons;
|
|
149
|
+
} else if (this.maxLevel < 3) {
|
|
150
|
+
this.limit = this.limit > 0 ? Math.min(this.limit, primaryButtons + secondaryButtons) : primaryButtons + secondaryButtons;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (this.limit > -1) {
|
|
154
|
+
// Limit the number of buttons to show
|
|
155
|
+
visibleButtons = Math.min(visibleButtons, this.limit);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Remove all buttons from the ui and menu
|
|
159
|
+
const container = this.shadowRoot?.querySelector('.button-menu__container');
|
|
160
|
+
if (container) {
|
|
161
|
+
container.innerHTML = '';
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const menu = this.shadowRoot?.querySelector('zn-menu');
|
|
165
|
+
if (menu) {
|
|
166
|
+
menu.innerHTML = '';
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Add colors to the buttons depending on type and set button size
|
|
170
|
+
this._buttons.forEach((button: CustomButtonWidths, index: number) => {
|
|
171
|
+
if (index < visibleButtons) {
|
|
172
|
+
this.shadowRoot?.querySelector('.button-menu__container')?.appendChild(button.button);
|
|
173
|
+
|
|
174
|
+
if (!button.button.hasAttribute('color')) {
|
|
175
|
+
button.button.setAttribute('color', button.button.hasAttribute('primary') ? 'primary' : button.button.hasAttribute('secondary') ? 'secondary' : 'transparent');
|
|
176
|
+
}
|
|
177
|
+
button.button.setAttribute('size', this.size);
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
this.calculateMenuButtons(totalButtons, visibleButtons, this._buttons);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
calculateMenuButtons(totalButtons: number, visibleButtons: number, buttons: CustomButtonWidths[]) {
|
|
185
|
+
const menu = this.shadowRoot?.querySelector('zn-menu');
|
|
186
|
+
const dropdown = this.shadowRoot?.querySelector('zn-dropdown');
|
|
187
|
+
|
|
188
|
+
if (menu && dropdown) {
|
|
189
|
+
const categories = new Set<string>();
|
|
190
|
+
// list of menu items ID by category
|
|
191
|
+
const menuItems: { [key: string]: Element[] } = {};
|
|
192
|
+
|
|
193
|
+
dropdown.toggleAttribute('hidden', buttons.length === 0 || buttons.length <= visibleButtons)
|
|
194
|
+
|
|
195
|
+
// if there's any buttons to add to the menu
|
|
196
|
+
if (visibleButtons !== buttons.length && totalButtons > 0) {
|
|
197
|
+
buttons.forEach((button: CustomButtonWidths, index: number) => {
|
|
198
|
+
if (index >= visibleButtons) {
|
|
199
|
+
const menuItem = document.createElement('zn-menu-item');
|
|
200
|
+
menuItem.innerText = button.button.innerText;
|
|
201
|
+
menuItem.setAttribute('id', button.button.id || `zn-button-menu-item-${index}`);
|
|
202
|
+
menuItem.setAttribute('role', 'menuitem');
|
|
203
|
+
const attr = button.button.attributes;
|
|
204
|
+
// Copy all attributes from the button to the menu item
|
|
205
|
+
for (let i = 0; i < attr.length; i++) {
|
|
206
|
+
const attribute = attr[i];
|
|
207
|
+
if (attribute.name !== 'icon' && attribute.name !== 'category') {
|
|
208
|
+
menuItem.setAttribute(attribute.name, attribute.value);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const icon = button.button.getAttribute('icon');
|
|
213
|
+
if (icon) {
|
|
214
|
+
const iconElement = document.createElement('zn-icon');
|
|
215
|
+
iconElement.setAttribute('src', icon);
|
|
216
|
+
iconElement.setAttribute('size', '18');
|
|
217
|
+
iconElement.setAttribute('slot', 'prefix');
|
|
218
|
+
menuItem.appendChild(iconElement);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const category: string = button.button.getAttribute('category') || 'default'
|
|
222
|
+
categories.add(category);
|
|
223
|
+
|
|
224
|
+
if (!menuItems[category]) {
|
|
225
|
+
menuItems[category] = [];
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
menuItems[category].push(menuItem);
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
categories.forEach((category: string) => {
|
|
233
|
+
if (category === 'default') {
|
|
234
|
+
menuItems[category].forEach((item: Element) => {
|
|
235
|
+
menu.appendChild(item);
|
|
236
|
+
});
|
|
237
|
+
// if only 1 catefory item
|
|
238
|
+
} else if (menuItems[category].length === 1) {
|
|
239
|
+
const menuItem = menuItems[category][0] as ZnMenuItem;
|
|
240
|
+
menu.appendChild(menuItem);
|
|
241
|
+
} else {
|
|
242
|
+
const menuItem = document.createElement('zn-menu-item');
|
|
243
|
+
// uppercase the first letter of the category
|
|
244
|
+
menuItem.innerText = category.charAt(0).toUpperCase() + category.slice(1);
|
|
245
|
+
const submenu = document.createElement('zn-menu');
|
|
246
|
+
submenu.setAttribute('slot', 'submenu');
|
|
247
|
+
|
|
248
|
+
menuItems[category].forEach((item: Element) => {
|
|
249
|
+
submenu.appendChild(item);
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
menuItem.appendChild(submenu);
|
|
253
|
+
menu.appendChild(menuItem);
|
|
254
|
+
}
|
|
255
|
+
})
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// check if there are an zn-confirms attached
|
|
260
|
+
const confirms: NodeListOf<ZnConfirm> = this.querySelectorAll('zn-confirm');
|
|
261
|
+
confirms.forEach(confirm => {
|
|
262
|
+
confirm.updateTriggers(); // update the triggers for the confirm dialog
|
|
263
|
+
})
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
render() {
|
|
267
|
+
return html`
|
|
268
|
+
<div class=${classMap({
|
|
269
|
+
'button-menu': true,
|
|
270
|
+
'button-menu--no-padding': this.noPadding,
|
|
271
|
+
'button-menu--no-gap': this.noGap,
|
|
272
|
+
})}>
|
|
273
|
+
<div class="button-menu__container"></div>
|
|
274
|
+
<zn-dropdown placement="bottom-end">
|
|
275
|
+
<zn-button slot="trigger" icon="more_vert" icon-size="24" color="transparent" size="${this.size}"></zn-button>
|
|
276
|
+
<zn-menu></zn-menu>
|
|
277
|
+
</zn-dropdown>
|
|
278
|
+
<slot></slot>
|
|
279
|
+
</div>`;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
public addButton(button: ZnButton) {
|
|
283
|
+
if (!button) {
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// add class to button to show it was added via api
|
|
288
|
+
button.classList.add('zn-button-menu__added');
|
|
289
|
+
|
|
290
|
+
// Add the button to the original buttons list
|
|
291
|
+
this._originalButtons.push({
|
|
292
|
+
button: button,
|
|
293
|
+
width: Math.max(button.offsetWidth, 150)
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
// Recalculate the visible buttons
|
|
297
|
+
this.calculateVisibleButtons();
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
public setDynamicButtons(btns: NodeListOf<ZnButton>) {
|
|
301
|
+
// remove all buttons that have the zn-button-menu__added class
|
|
302
|
+
this.removeAllButtons();
|
|
303
|
+
|
|
304
|
+
// add the new buttons
|
|
305
|
+
btns.forEach((button: ZnButton) => {
|
|
306
|
+
this.addButton(button);
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
public removeButton(id: string) {
|
|
311
|
+
const button = this.querySelector(`zn-button.${id}`);
|
|
312
|
+
if (button) {
|
|
313
|
+
// remove the button from the original buttons list
|
|
314
|
+
this._originalButtons = this._originalButtons.filter(b => b.button !== button);
|
|
315
|
+
// remove the button from the UI
|
|
316
|
+
button.remove();
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// check if its a menu-item
|
|
320
|
+
const menuItem = this.querySelector(`zn-menu-item#${id}`);
|
|
321
|
+
if (menuItem) {
|
|
322
|
+
// remove the menu item from the menu
|
|
323
|
+
const menu = this.shadowRoot?.querySelector('zn-menu');
|
|
324
|
+
if (menu) {
|
|
325
|
+
menuItem.remove();
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// Recalculate the visible buttons
|
|
330
|
+
this.calculateVisibleButtons();
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
public removeAllButtons() {
|
|
334
|
+
// remove all buttons that have the zn-button-menu__added class
|
|
335
|
+
const buttons = this.querySelectorAll('.zn-button-menu__added');
|
|
336
|
+
buttons.forEach((button: ZnButton) => {
|
|
337
|
+
button.remove();
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
// remove all zn-menu-item elements
|
|
341
|
+
const menuItems = this.shadowRoot?.querySelectorAll('zn-menu-item');
|
|
342
|
+
menuItems?.forEach((menuItem: ZnMenuItem) => {
|
|
343
|
+
menuItem.remove();
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
// reset the original buttons list
|
|
347
|
+
this._originalButtons = [];
|
|
348
|
+
this._buttons = [];
|
|
349
|
+
|
|
350
|
+
// Recalculate the visible buttons
|
|
351
|
+
this.calculateVisibleButtons();
|
|
352
|
+
}
|
|
353
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
@use "../../wc";
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
max-width: 100%;
|
|
6
|
+
--menu-gap: var(--zn-spacing-x-small);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.button-menu--no-gap {
|
|
10
|
+
--menu-gap: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.button-menu {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: row;
|
|
16
|
+
justify-content: flex-end;
|
|
17
|
+
padding: var(--zn-spacing-small) 0;
|
|
18
|
+
margin: 0;
|
|
19
|
+
|
|
20
|
+
min-width: 35px;
|
|
21
|
+
max-width: var(--zn-max-width);
|
|
22
|
+
|
|
23
|
+
gap: var(--menu-gap);
|
|
24
|
+
|
|
25
|
+
&--no-padding {
|
|
26
|
+
padding: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&__container {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: row;
|
|
32
|
+
gap: var(--menu-gap);
|
|
33
|
+
margin: 0;
|
|
34
|
+
max-width: calc(100% - 35px);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
zn-button {
|
|
38
|
+
min-width: 35px;
|
|
39
|
+
flex-shrink: 0;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import '../../../dist/zn.min.js';
|
|
2
|
+
import { expect, fixture, html } from '@open-wc/testing';
|
|
3
|
+
|
|
4
|
+
describe('<zn-button-menu>', () => {
|
|
5
|
+
it('should render a component', async () => {
|
|
6
|
+
const el = await fixture(html` <zn-button-menu></zn-button-menu> `);
|
|
7
|
+
|
|
8
|
+
expect(el).to.exist;
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import ZnButtonMenu from './button-menu.component';
|
|
2
|
+
|
|
3
|
+
export * from './button-menu.component';
|
|
4
|
+
export default ZnButtonMenu;
|
|
5
|
+
|
|
6
|
+
ZnButtonMenu.define('zn-button-menu');
|
|
7
|
+
|
|
8
|
+
declare global {
|
|
9
|
+
interface HTMLElementTagNameMap {
|
|
10
|
+
'zn-button-menu': ZnButtonMenu;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { type CSSResultGroup, html, type PropertyValues, unsafeCSS } from 'lit';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
|
+
import ApexCharts from "apexcharts";
|
|
4
|
+
import ZincElement from '../../internal/zinc-element';
|
|
5
|
+
|
|
6
|
+
import styles from './chart.scss';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @summary Short summary of the component's intended use.
|
|
10
|
+
* @documentation https://zinc.style/components/data-chart
|
|
11
|
+
* @status experimental
|
|
12
|
+
* @since 1.0
|
|
13
|
+
*
|
|
14
|
+
* @dependency zn-example
|
|
15
|
+
*
|
|
16
|
+
* @event zn-event-name - Emitted as an example.
|
|
17
|
+
*
|
|
18
|
+
* @slot - The default slot.
|
|
19
|
+
* @slot example - An example slot.
|
|
20
|
+
*
|
|
21
|
+
* @csspart base - The component's base wrapper.
|
|
22
|
+
*
|
|
23
|
+
* @cssproperty --example - An example CSS custom property.
|
|
24
|
+
*/
|
|
25
|
+
export default class ZnChart extends ZincElement {
|
|
26
|
+
static styles: CSSResultGroup = unsafeCSS(styles);
|
|
27
|
+
|
|
28
|
+
@property() type: 'area' | 'bar' | 'line' = 'bar';
|
|
29
|
+
@property({ type: Array }) data: any[] = [];
|
|
30
|
+
@property({ type: Array }) categories: string | string[] = '';
|
|
31
|
+
|
|
32
|
+
@property() xAxis: string;
|
|
33
|
+
@property({ type: Number, attribute: 'd-size' }) datapointSize: number = 1;
|
|
34
|
+
|
|
35
|
+
// Live
|
|
36
|
+
@property({ type: Boolean }) live = false;
|
|
37
|
+
@property({ attribute: 'data-url' }) dataUrl = '';
|
|
38
|
+
@property({ attribute: 'live-interval', type: Number }) liveInterval = 1000;
|
|
39
|
+
@property({ type: Number, reflect: true }) height = 300;
|
|
40
|
+
|
|
41
|
+
@property({ attribute: 'enable-animations', type: Boolean }) enableAnimations = false;
|
|
42
|
+
|
|
43
|
+
@property({ attribute: 'y-axis-append' }) yAxisAppend: string;
|
|
44
|
+
|
|
45
|
+
private chart: ApexCharts;
|
|
46
|
+
|
|
47
|
+
// private lightColors = ["#8967ef", "#6483F2", "#29bab5", "#3F51B5", "#9C27B0", "#ff6c9c", "#6836F5", "#47D6D6"];
|
|
48
|
+
// private darkColors = ["#703cff", "#3b65fb", "#07e3db", "#5c75ff", "#e12cff", "#ff125f", "#ae90ff", "#a6ff9c"];
|
|
49
|
+
|
|
50
|
+
protected firstUpdated(_changedProperties: PropertyValues) {
|
|
51
|
+
const theme = this.getAttribute('t') || 'light';
|
|
52
|
+
// Setup Chart and render it
|
|
53
|
+
const options = {
|
|
54
|
+
animations: this.enableAnimations,
|
|
55
|
+
chart: {
|
|
56
|
+
type: this.type,
|
|
57
|
+
toolbar: { show: false },
|
|
58
|
+
foreColor: theme == 'dark' ? "rgb(149, 163, 184)" : "rgb(123, 112, 151)",
|
|
59
|
+
height: this.height + 'px',
|
|
60
|
+
fontFamily: '"Inter", sans',
|
|
61
|
+
zoom: {
|
|
62
|
+
enabled: false
|
|
63
|
+
},
|
|
64
|
+
animations: {
|
|
65
|
+
enabled: false,
|
|
66
|
+
},
|
|
67
|
+
events: {}
|
|
68
|
+
},
|
|
69
|
+
dataLabels: {
|
|
70
|
+
enabled: false,
|
|
71
|
+
},
|
|
72
|
+
markers: {
|
|
73
|
+
size: this.datapointSize,
|
|
74
|
+
strokeWidth: 0,
|
|
75
|
+
hover: {
|
|
76
|
+
sizeOffset: 2
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
yaxis: {
|
|
80
|
+
labels: {
|
|
81
|
+
formatter: (value: number) => {
|
|
82
|
+
if (this.yAxisAppend) {
|
|
83
|
+
return value + this.yAxisAppend;
|
|
84
|
+
}
|
|
85
|
+
return value;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
tooltip: {
|
|
90
|
+
theme: theme,
|
|
91
|
+
y: {
|
|
92
|
+
formatter: (value: number,) => {
|
|
93
|
+
if (this.yAxisAppend) {
|
|
94
|
+
return value + this.yAxisAppend;
|
|
95
|
+
}
|
|
96
|
+
return value;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
grid: {
|
|
101
|
+
borderColor: theme === 'dark' ? "rgb(50, 50, 60)" : 'rgb(224, 221, 233)',
|
|
102
|
+
},
|
|
103
|
+
//colors: theme === 'dark' ? this.darkColors : this.lightColors,
|
|
104
|
+
legend: {
|
|
105
|
+
position: 'top',
|
|
106
|
+
horizontalAlign: 'right',
|
|
107
|
+
fontSize: '12px',
|
|
108
|
+
fontFamily: '"Inter", sans',
|
|
109
|
+
fontWeight: 400,
|
|
110
|
+
labels: {
|
|
111
|
+
colors: theme == 'dark' ? "rgb(149, 163, 184)" : "rgb(123, 112, 151)",
|
|
112
|
+
},
|
|
113
|
+
markers: {
|
|
114
|
+
shape: 'circle',
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
stroke: {
|
|
118
|
+
width: 1.5
|
|
119
|
+
},
|
|
120
|
+
fill: {
|
|
121
|
+
type: 'solid',
|
|
122
|
+
opacity: this.type === 'area' ? 0.1 : 0.8
|
|
123
|
+
},
|
|
124
|
+
series: this.data,
|
|
125
|
+
xaxis: {},
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
if (this.xAxis) {
|
|
129
|
+
options.xaxis = {
|
|
130
|
+
type: this.xAxis,
|
|
131
|
+
};
|
|
132
|
+
} else {
|
|
133
|
+
options.xaxis = {
|
|
134
|
+
categories: this.categories,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (this.live) {
|
|
139
|
+
options.chart.animations = {
|
|
140
|
+
enabled: true,
|
|
141
|
+
// @ts-expect-error this is available. it lies.
|
|
142
|
+
easing: 'linear',
|
|
143
|
+
dynamicAnimation: {
|
|
144
|
+
speed: 400
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
options.chart.events = {
|
|
149
|
+
animationEnd: function (chartCtx: any, opts: any) {
|
|
150
|
+
const newData1 = chartCtx.w.config.series[0].data.slice();
|
|
151
|
+
newData1.shift();
|
|
152
|
+
const newData2 = chartCtx.w.config.series[1].data.slice();
|
|
153
|
+
newData2.shift();
|
|
154
|
+
|
|
155
|
+
// check animation end event for just 1 series to avoid multiple updates
|
|
156
|
+
if (opts.el.node.getAttribute('index') === '0') {
|
|
157
|
+
window.setTimeout(function () {
|
|
158
|
+
chartCtx.updateOptions({
|
|
159
|
+
series: [{
|
|
160
|
+
data: newData1
|
|
161
|
+
}, {
|
|
162
|
+
data: newData2
|
|
163
|
+
}],
|
|
164
|
+
}, false, false);
|
|
165
|
+
}, 300);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (!this.chart) {
|
|
173
|
+
this.chart = new ApexCharts(this.shadowRoot?.getElementById('chart'), options);
|
|
174
|
+
this.chart.render();
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
super.firstUpdated(_changedProperties);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
attributeChangedCallback(name: string, _old: string | null, value: string | null) {
|
|
182
|
+
if (this.chart && name === 't') {
|
|
183
|
+
this.chart.updateOptions({
|
|
184
|
+
// colors: value === 'dark' ? this.darkColors : this.lightColors
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (this.chart && name === 'height') {
|
|
189
|
+
this.chart.updateOptions({
|
|
190
|
+
chart: {
|
|
191
|
+
height: value + 'px'
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
super.attributeChangedCallback(name, _old, value);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
protected render(): unknown {
|
|
200
|
+
return html`
|
|
201
|
+
<div class="chart">
|
|
202
|
+
<div id="chart"></div>
|
|
203
|
+
</div>
|
|
204
|
+
`;
|
|
205
|
+
}
|
|
206
|
+
}
|