@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,242 @@
|
|
|
1
|
+
import {classMap} from 'lit/directives/class-map.js';
|
|
2
|
+
import {type CSSResultGroup, unsafeCSS} from 'lit';
|
|
3
|
+
import {FormControlController, validValidityState} from "../../internal/form";
|
|
4
|
+
import {HasSlotController} from '../../internal/slot';
|
|
5
|
+
import {html, literal} from 'lit/static-html.js';
|
|
6
|
+
import {ifDefined} from 'lit/directives/if-defined.js';
|
|
7
|
+
import {property, query} from 'lit/decorators.js';
|
|
8
|
+
import ZincElement from '../../internal/zinc-element';
|
|
9
|
+
import ZnDropdown from "../dropdown";
|
|
10
|
+
import ZnIcon from "../icon";
|
|
11
|
+
import ZnTooltip from "../tooltip";
|
|
12
|
+
import type {IconColor} from "../icon";
|
|
13
|
+
import type {ZincFormControl} from '../../internal/zinc-element';
|
|
14
|
+
|
|
15
|
+
import styles from './button.scss';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @summary Buttons represent actions that are available to the user.
|
|
19
|
+
* @documentation https://inc.style/components/button
|
|
20
|
+
* @status stable
|
|
21
|
+
* @since 2.0
|
|
22
|
+
*
|
|
23
|
+
* @dependency zn-icon
|
|
24
|
+
* @dependency zn-tooltip
|
|
25
|
+
*
|
|
26
|
+
* @event zn-blur - Emitted when the button loses focus.
|
|
27
|
+
* @event zn-focus - Emitted when the button gains focus.
|
|
28
|
+
* @event zn-invalid - Emitted when the form control has been checked for validity and its constraints aren't satisfied.
|
|
29
|
+
*
|
|
30
|
+
* @slot - The button's label.
|
|
31
|
+
* @slot prefix - A presentational prefix icon or similar element.
|
|
32
|
+
* @slot suffix - A presentational suffix icon or similar element.
|
|
33
|
+
*
|
|
34
|
+
* @csspart base - The component's base wrapper.
|
|
35
|
+
* @csspart prefix - The container that wraps the prefix.
|
|
36
|
+
* @csspart label - The button's label.
|
|
37
|
+
* @csspart suffix - The container that wraps the suffix.
|
|
38
|
+
* @csspart caret - The button's caret icon, an `<zn-icon>` element.
|
|
39
|
+
* @csspart spinner - The spinner that shows when the button is in the loading state.
|
|
40
|
+
*/
|
|
41
|
+
export default class ZnButton extends ZincElement implements ZincFormControl {
|
|
42
|
+
static styles: CSSResultGroup = unsafeCSS(styles);
|
|
43
|
+
static dependencies = {
|
|
44
|
+
'zn-tooltip': ZnTooltip,
|
|
45
|
+
'zn-icon': ZnIcon
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
private readonly formControlController = new FormControlController(this);
|
|
49
|
+
private readonly hasSlotController = new HasSlotController(this, '[default]');
|
|
50
|
+
|
|
51
|
+
@query('.button') button: HTMLButtonElement;
|
|
52
|
+
|
|
53
|
+
@property({}) color: 'default' | 'secondary' | 'error' | 'info' | 'success' | 'warning' |
|
|
54
|
+
'transparent' | 'star' = 'default';
|
|
55
|
+
@property({}) size: 'content' | 'x-small' | 'small' | 'medium' | 'large' = 'medium';
|
|
56
|
+
@property({type: Boolean}) text = false;
|
|
57
|
+
@property({type: Boolean}) outline = false;
|
|
58
|
+
@property({type: Boolean}) disabled = false;
|
|
59
|
+
@property({type: Boolean}) grow = false;
|
|
60
|
+
@property({type: Boolean}) square = false;
|
|
61
|
+
|
|
62
|
+
@property({attribute: 'dropdown-closer', type: Boolean}) dropdownCloser = false;
|
|
63
|
+
|
|
64
|
+
@property({type: Number}) notification: number;
|
|
65
|
+
|
|
66
|
+
@property() verticalAlign: 'start' | 'center' | 'end';
|
|
67
|
+
|
|
68
|
+
@property() content = '';
|
|
69
|
+
@property() icon: string = '';
|
|
70
|
+
@property() gaid: string = '';
|
|
71
|
+
@property({attribute: "icon-position"}) iconPosition: 'left' | 'right' = 'left';
|
|
72
|
+
@property({attribute: "icon-size"}) iconSize: string;
|
|
73
|
+
@property({attribute: "icon-color"}) iconColor: IconColor;
|
|
74
|
+
@property() type: 'button' | 'submit' | 'reset';
|
|
75
|
+
|
|
76
|
+
@property() name: string;
|
|
77
|
+
@property() value: string;
|
|
78
|
+
|
|
79
|
+
@property() form: string;
|
|
80
|
+
@property({attribute: 'formaction'}) formAction: string;
|
|
81
|
+
@property({attribute: 'formenctype'}) formEnctype: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain';
|
|
82
|
+
@property({attribute: 'formmethod'}) formMethod: 'post' | 'get';
|
|
83
|
+
@property({attribute: 'formnovalidate', type: Boolean}) formNoValidate: boolean;
|
|
84
|
+
@property({attribute: 'formtarget'}) formTarget: '_self' | '_blank' | '_parent' | '_top' | string;
|
|
85
|
+
|
|
86
|
+
// Link Specific
|
|
87
|
+
@property() href: string;
|
|
88
|
+
@property() target: '_self' | '_blank' | '_parent' | '_top' | string;
|
|
89
|
+
@property({attribute: 'data-target'}) dataTarget: 'modal' | 'slide' | string;
|
|
90
|
+
@property() rel: string = 'noreferrer noopener';
|
|
91
|
+
|
|
92
|
+
// Tooltip Specific
|
|
93
|
+
@property() tooltip: string;
|
|
94
|
+
|
|
95
|
+
get validity() {
|
|
96
|
+
if (this._isButton() && this.button) {
|
|
97
|
+
return (this.button as HTMLButtonElement).validity;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return validValidityState;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
get validationMessage() {
|
|
105
|
+
if (this._isButton() && this.button) {
|
|
106
|
+
return (this.button as HTMLButtonElement).validationMessage;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return '';
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
firstUpdated() {
|
|
113
|
+
if (this._isButton()) {
|
|
114
|
+
this.formControlController.updateValidity();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
checkValidity() {
|
|
119
|
+
if (this._isButton() && this.button) {
|
|
120
|
+
return (this.button as HTMLButtonElement).checkValidity();
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
getForm(): HTMLFormElement | null {
|
|
127
|
+
return this.formControlController.getForm();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
reportValidity() {
|
|
131
|
+
if (this._isButton() && this.button) {
|
|
132
|
+
return (this.button as HTMLButtonElement).reportValidity();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
setCustomValidity(message: string) {
|
|
139
|
+
if (this._isButton()) {
|
|
140
|
+
(this.button as HTMLButtonElement).setCustomValidity(message);
|
|
141
|
+
this.formControlController.updateValidity();
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
handleClick = () => {
|
|
146
|
+
if (this.disabled) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (this.dropdownCloser) {
|
|
151
|
+
let dropdown: ZnDropdown | null = null;
|
|
152
|
+
let parent: HTMLElement | null = this as HTMLElement | null;
|
|
153
|
+
let count = 0;
|
|
154
|
+
const max = 30; // Break the loop if too deep in the DOM tree
|
|
155
|
+
|
|
156
|
+
while (parent && count < max) {
|
|
157
|
+
if (parent instanceof ZnDropdown) {
|
|
158
|
+
dropdown = parent;
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
parent = parent.parentElement || (parent.getRootNode() instanceof ShadowRoot ? (parent.getRootNode() as ShadowRoot).host as HTMLElement : null);
|
|
162
|
+
count++;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
dropdown?.hide();
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (this.type === 'submit') {
|
|
169
|
+
this.formControlController.submit();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
private _isLink() {
|
|
174
|
+
return this.href !== undefined;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
private _isButton() {
|
|
178
|
+
return !this._isLink();
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
protected render(): unknown {
|
|
182
|
+
const isLink = this._isLink();
|
|
183
|
+
|
|
184
|
+
const icon = this.icon ? html`
|
|
185
|
+
<zn-icon src="${this.icon}" id="xy2" size="${this.iconSize ? this.iconSize : 16}"
|
|
186
|
+
color="${this.iconColor ? this.iconColor : null}"></zn-icon>` : '';
|
|
187
|
+
|
|
188
|
+
const tag = isLink ? literal`a` : literal`button`;
|
|
189
|
+
|
|
190
|
+
let content = html`
|
|
191
|
+
<${tag}
|
|
192
|
+
part="base"
|
|
193
|
+
class="${classMap({
|
|
194
|
+
'button': true,
|
|
195
|
+
'button--default': this.color === 'default',
|
|
196
|
+
'button--secondary': this.color === 'secondary',
|
|
197
|
+
'button--error': this.color === 'error',
|
|
198
|
+
'button--info': this.color === 'info',
|
|
199
|
+
'button--success': this.color === 'success',
|
|
200
|
+
'button--warning': this.color === 'warning',
|
|
201
|
+
'button--transparent': this.color === 'transparent',
|
|
202
|
+
'button--star': this.color === 'star',
|
|
203
|
+
'button--content': this.size === 'content',
|
|
204
|
+
'button--x-small': this.size === 'x-small',
|
|
205
|
+
'button--small': this.size === 'small',
|
|
206
|
+
'button--medium': this.size === 'medium',
|
|
207
|
+
'button--large': this.size === 'large',
|
|
208
|
+
'button--outline': this.outline,
|
|
209
|
+
'button--text': (this.text && !this.outline),
|
|
210
|
+
'button--grow': this.grow,
|
|
211
|
+
'button--standard': !this.outline && !this.text,
|
|
212
|
+
'button--disabled': this.disabled,
|
|
213
|
+
'button--with-icon': this.icon,
|
|
214
|
+
'button--icon-left': this.iconPosition === 'left',
|
|
215
|
+
'button--icon-right': this.iconPosition === 'right',
|
|
216
|
+
'button--with-content': this.hasSlotController.test('[default]') || this.content,
|
|
217
|
+
'button--square': this.square,
|
|
218
|
+
'button--has-notification': this.notification !== undefined && this.notification > 0,
|
|
219
|
+
})}"
|
|
220
|
+
type="${ifDefined(this.type)}"
|
|
221
|
+
href="${ifDefined(this.href)}"
|
|
222
|
+
target="${ifDefined(isLink ? this.target : undefined)}"
|
|
223
|
+
data-target="${ifDefined(isLink ? this.dataTarget : undefined)}"
|
|
224
|
+
rel="${ifDefined(isLink ? this.rel : undefined)}"
|
|
225
|
+
gaid="${ifDefined(this.gaid)}"
|
|
226
|
+
data-notification="${ifDefined(this.notification)}"
|
|
227
|
+
@click="${this.handleClick}">
|
|
228
|
+
${this.iconPosition === 'left' ? icon : ''}
|
|
229
|
+
<slot part="label" class="button__label">${this.content}</slot>
|
|
230
|
+
${this.iconPosition === 'right' ? icon : ''}
|
|
231
|
+
</${tag}>`;
|
|
232
|
+
|
|
233
|
+
if (this.tooltip !== undefined) {
|
|
234
|
+
content = html`
|
|
235
|
+
<zn-tooltip placement="top" content="${this.tooltip}">
|
|
236
|
+
${content}
|
|
237
|
+
</zn-tooltip>`;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
return content;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
@use "../../../scss/shared";
|
|
2
|
+
@use "../../wc";
|
|
3
|
+
|
|
4
|
+
:host {
|
|
5
|
+
display: inline-block;
|
|
6
|
+
position: relative;
|
|
7
|
+
width: auto;
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
user-select: none;
|
|
10
|
+
|
|
11
|
+
button, a {
|
|
12
|
+
width: 100%;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.button {
|
|
17
|
+
@include shared.button;
|
|
18
|
+
|
|
19
|
+
--btn-color: var(--zn-primary);
|
|
20
|
+
|
|
21
|
+
border-width: 1px;
|
|
22
|
+
border-color: transparent;
|
|
23
|
+
height: 100%;
|
|
24
|
+
display: inline-flex;
|
|
25
|
+
|
|
26
|
+
&.button--info {
|
|
27
|
+
--btn-color: var(--zn-color-info);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&.button--error {
|
|
31
|
+
--btn-color: var(--zn-color-error);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&.button--warning {
|
|
35
|
+
--btn-color: var(--zn-color-warning);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&.button--success {
|
|
39
|
+
--btn-color: var(--zn-color-success);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.button--has-notification {
|
|
44
|
+
position: relative;
|
|
45
|
+
|
|
46
|
+
&::after {
|
|
47
|
+
content: attr(data-notification);
|
|
48
|
+
position: absolute;
|
|
49
|
+
display: flex;
|
|
50
|
+
justify-content: center;
|
|
51
|
+
align-items: center;
|
|
52
|
+
top: 0;
|
|
53
|
+
inset-inline-end: 0;
|
|
54
|
+
width: 15px;
|
|
55
|
+
height: 15px;
|
|
56
|
+
border-radius: 50%;
|
|
57
|
+
font-size: 10px;
|
|
58
|
+
color: white;
|
|
59
|
+
background-color: rgb(var(--zn-color-error));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.button::-moz-focus-inner {
|
|
64
|
+
border: 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.button:focus {
|
|
68
|
+
outline: none;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.button:focus-visible {
|
|
72
|
+
outline: 2px solid rgb(var(--btn-color));
|
|
73
|
+
outline-offset: 2px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.button--disabled {
|
|
77
|
+
cursor: not-allowed;
|
|
78
|
+
opacity: 0.5;
|
|
79
|
+
|
|
80
|
+
* {
|
|
81
|
+
pointer-events: none;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.button--standard {
|
|
86
|
+
&.button--secondary {
|
|
87
|
+
background-color: var(--zn-color-neutral-50);
|
|
88
|
+
border-color: var(--zn-color-neutral-50);
|
|
89
|
+
color: rgb(var(--zn-primary));
|
|
90
|
+
|
|
91
|
+
&:hover:not(.button--disabled) {
|
|
92
|
+
background-color: var(--zn-color-neutral-100)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&:active:not(.button--disabled) {
|
|
96
|
+
background-color: var(--zn-color-neutral-100)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
background-color: rgba(var(--btn-color), .85);
|
|
102
|
+
border-color: rgb(var(--btn-color));
|
|
103
|
+
color: rgba(255, 255, 255, 0.9);
|
|
104
|
+
|
|
105
|
+
&:hover:not(.button--disabled) {
|
|
106
|
+
background-color: rgba(var(--btn-color), 0.8);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&:active:not(.button--disabled) {
|
|
110
|
+
background-color: rgba(var(--btn-color));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.button--outline {
|
|
115
|
+
background: none;
|
|
116
|
+
border-width: 1px;
|
|
117
|
+
border-color: rgb(var(--btn-color));
|
|
118
|
+
color: rgb(var(--btn-color));
|
|
119
|
+
|
|
120
|
+
&:hover:not(.button--disabled), &:active:not(.button--disabled) {
|
|
121
|
+
background-color: rgb(var(--btn-color));
|
|
122
|
+
color: white;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
&.button--secondary {
|
|
126
|
+
border-color: #F3EFFF;
|
|
127
|
+
|
|
128
|
+
&:hover:not(.button--disabled), &:active:not(.button--disabled) {
|
|
129
|
+
background-color: rgb(221, 218, 236);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
.button--text {
|
|
136
|
+
background: none;
|
|
137
|
+
color: rgb(var(--btn-color));
|
|
138
|
+
|
|
139
|
+
&:hover:not(.button--disabled), &:active:not(.button--disabled) {
|
|
140
|
+
background-color: rgba(var(--btn-color), 0.1);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
&.button--secondary {
|
|
144
|
+
font-weight: normal;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.button--x-small {
|
|
149
|
+
padding: 2px 10px;
|
|
150
|
+
font-size: 12px;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.button--content {
|
|
154
|
+
padding: 0 0;
|
|
155
|
+
font-size: 12px;
|
|
156
|
+
|
|
157
|
+
zn-icon {
|
|
158
|
+
line-height: 0;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.button--grow {
|
|
163
|
+
width: 100%;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.button--small {
|
|
167
|
+
padding: 4px 14px;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.button--large {
|
|
171
|
+
padding: 10px 20px;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.button--with-icon:not(.button--with-content) {
|
|
175
|
+
&.button--x-small,
|
|
176
|
+
&.button--small {
|
|
177
|
+
padding: 4px;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
&.button--medium {
|
|
181
|
+
padding: 7px;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
&.button--large {
|
|
185
|
+
padding: 10px;
|
|
186
|
+
font-size: 16px;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.button--with-icon.button--with-content {
|
|
191
|
+
&.button--x-small,
|
|
192
|
+
&.button--small {
|
|
193
|
+
padding-left: 10px;
|
|
194
|
+
|
|
195
|
+
&.button--icon-left {
|
|
196
|
+
padding-left: 10px;
|
|
197
|
+
|
|
198
|
+
zn-icon {
|
|
199
|
+
margin-right: 4px;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
&.button--icon-right {
|
|
204
|
+
padding-right: 10px;
|
|
205
|
+
|
|
206
|
+
zn-icon {
|
|
207
|
+
margin-left: 4px;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
&.button--medium {
|
|
213
|
+
&.button--icon-left {
|
|
214
|
+
padding-left: 10px;
|
|
215
|
+
|
|
216
|
+
zn-icon {
|
|
217
|
+
margin-right: 6px;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
&.button--icon-right {
|
|
222
|
+
padding-right: 10px;
|
|
223
|
+
|
|
224
|
+
zn-icon {
|
|
225
|
+
margin-left: 6px;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
&.button--large {
|
|
231
|
+
&.button--icon-left {
|
|
232
|
+
padding-left: 14px;
|
|
233
|
+
|
|
234
|
+
zn-icon {
|
|
235
|
+
margin-right: 8px;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
&.button--icon-right {
|
|
240
|
+
padding-right: 14px;
|
|
241
|
+
|
|
242
|
+
zn-icon {
|
|
243
|
+
margin-left: 8px;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.button--square {
|
|
250
|
+
border-radius: 0;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.button--transparent {
|
|
254
|
+
background-color: transparent;
|
|
255
|
+
border-color: transparent !important;
|
|
256
|
+
color: inherit;
|
|
257
|
+
|
|
258
|
+
&:hover:not(.button--disabled) {
|
|
259
|
+
background-color: rgba(var(--zn-primary), 0.1);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
&:active:not(.button--disabled) {
|
|
263
|
+
background-color: rgba(var(--zn-primary), 0.2);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.button--star {
|
|
268
|
+
--btn-color: var(--zn-orange);
|
|
269
|
+
background-color: rgb(var(--btn-color));
|
|
270
|
+
border-color: rgb(var(--btn-color));
|
|
271
|
+
color: white;
|
|
272
|
+
opacity: 1 !important;
|
|
273
|
+
|
|
274
|
+
&:hover {
|
|
275
|
+
background-color: rgb(var(--btn-color));
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
&:active {
|
|
279
|
+
background-color: rgb(var(--btn-color));
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
&.button--outline {
|
|
283
|
+
background-color: transparent;
|
|
284
|
+
border-color: rgb(var(--btn-color));
|
|
285
|
+
color: rgb(var(--btn-color));
|
|
286
|
+
|
|
287
|
+
&:hover, &:active {
|
|
288
|
+
background-color: rgba(var(--btn-color));
|
|
289
|
+
color: white;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
:host([vertical-align="center"]) {
|
|
295
|
+
align-self: center;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
:host([vertical-align="end"]) {
|
|
299
|
+
align-self: end;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
:host([vertical-align="start"]) {
|
|
303
|
+
align-self: start;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
:host([grow]) {
|
|
307
|
+
width: 100%;
|
|
308
|
+
|
|
309
|
+
button {
|
|
310
|
+
width: 100%;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
:host([data-zn-button-group__button--grow]) {
|
|
315
|
+
flex-grow: 1;
|
|
316
|
+
flex-basis: 0;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
:host([data-zn-button-group__button--inner]) .button {
|
|
320
|
+
border-radius: 0 !important;
|
|
321
|
+
border-left: 0 !important;
|
|
322
|
+
border-right: 0 !important;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
:host([data-zn-button-group__button]:not([data-zn-button-group__button--first]):not(:hover)) {
|
|
326
|
+
.button:after {
|
|
327
|
+
content: '';
|
|
328
|
+
position: absolute;
|
|
329
|
+
top: 0;
|
|
330
|
+
inset-inline-start: 0;
|
|
331
|
+
bottom: 0;
|
|
332
|
+
border-left: solid 1px;
|
|
333
|
+
mix-blend-mode: multiply;
|
|
334
|
+
color: rgb(var(--zn-border-color));
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
:host([data-zn-button-group__button--first]:not([data-zn-button-group__button--last])) .button {
|
|
339
|
+
border-radius: 5px 0 0 5px !important;
|
|
340
|
+
border-right: 0 !important;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
:host([data-zn-button-group__button--last]:not([data-zn-button-group__button--first])) .button {
|
|
344
|
+
border-radius: 0 5px 5px 0 !important;
|
|
345
|
+
border-left: 0 !important;
|
|
346
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import '../../../dist/zn.min.js';
|
|
2
|
+
import { expect, fixture, html } from '@open-wc/testing';
|
|
3
|
+
import type ZnButton from "./button.component";
|
|
4
|
+
|
|
5
|
+
const variants = ['default', 'primary', 'secondary', 'success', 'neutral', 'warning', 'danger', 'text']
|
|
6
|
+
|
|
7
|
+
describe('<zn-button>', () => {
|
|
8
|
+
|
|
9
|
+
describe('accessibility tests', () => {
|
|
10
|
+
variants.forEach(variant => {
|
|
11
|
+
it(`should be accessible when variant is "${variant}"`, async () => {
|
|
12
|
+
const el = await fixture<ZnButton>(html`<zn-button variant="${variant}">Button Label</zn-button>`)
|
|
13
|
+
await expect(el).to.be.accessible();
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
describe('when provided no parameters', () => {
|
|
19
|
+
it('passes accessibility test', async () => {
|
|
20
|
+
const el = await fixture<ZnButton>(html`<zn-button>Button Label</zn-button>`);
|
|
21
|
+
await expect(el).to.be.accessible();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('default values are set correctly', async () => {
|
|
26
|
+
const el = await fixture<ZnButton>(html`<zn-button>Button Label</zn-button>`);
|
|
27
|
+
|
|
28
|
+
expect(el.title).to.equal('');
|
|
29
|
+
expect(el.color).to.equal('default');
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import {classMap} from "lit/directives/class-map.js";
|
|
2
|
+
import {type CSSResultGroup, html, unsafeCSS} from 'lit';
|
|
3
|
+
import {property, query} from 'lit/decorators.js';
|
|
4
|
+
import ZincElement from '../../internal/zinc-element';
|
|
5
|
+
|
|
6
|
+
import styles from './button-group.scss';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @summary Short summary of the component's intended use.
|
|
10
|
+
* @documentation https://zinc.style/components/button-group
|
|
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
|
+
*
|
|
20
|
+
* @csspart base - The component's base wrapper.
|
|
21
|
+
*
|
|
22
|
+
* @cssproperty --grow - Use flex-grow to fill available space.
|
|
23
|
+
* @cssproperty --start - Justify content at the start of the flex space.
|
|
24
|
+
*/
|
|
25
|
+
export default class ZnButtonGroup extends ZincElement {
|
|
26
|
+
static styles: CSSResultGroup = unsafeCSS(styles);
|
|
27
|
+
|
|
28
|
+
@property({}) direction: 'horizontal' | 'vertical' = 'horizontal';
|
|
29
|
+
@property({type: Boolean}) grow = false;
|
|
30
|
+
@property({type: Boolean}) wrap = false;
|
|
31
|
+
@property({type: Boolean}) start = false;
|
|
32
|
+
@property({type: Boolean}) gap = false;
|
|
33
|
+
|
|
34
|
+
@query('slot') defaultSlot: HTMLSlotElement;
|
|
35
|
+
|
|
36
|
+
private handleSlotChange() {
|
|
37
|
+
if (this.direction === 'vertical') {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
let slottedElements = [...this.defaultSlot.assignedElements({flatten: true})] as HTMLElement[];
|
|
42
|
+
|
|
43
|
+
slottedElements = slottedElements.filter(el => el.tagName === 'ZN-BUTTON');
|
|
44
|
+
slottedElements.forEach(el => {
|
|
45
|
+
const index = slottedElements.indexOf(el);
|
|
46
|
+
const button = el.closest('zn-button') ?? el.querySelector('zn-button');
|
|
47
|
+
|
|
48
|
+
if (button) {
|
|
49
|
+
button.toggleAttribute('data-zn-button-group__button--grow', this.grow);
|
|
50
|
+
|
|
51
|
+
if (!this.gap) {
|
|
52
|
+
button.toggleAttribute('data-zn-button-group__button', true);
|
|
53
|
+
button.toggleAttribute('data-zn-button-group__button--first', index === 0);
|
|
54
|
+
button.toggleAttribute('data-zn-button-group__button--inner', index > 0 && index < slottedElements.length - 1);
|
|
55
|
+
button.toggleAttribute('data-zn-button-group__button--last', index === slottedElements.length - 1);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
render() {
|
|
62
|
+
return html`
|
|
63
|
+
<div part="base"
|
|
64
|
+
class="${classMap({
|
|
65
|
+
'button-group': true,
|
|
66
|
+
'button-group--grow': this.grow,
|
|
67
|
+
'button-group--start': this.start,
|
|
68
|
+
'button-group--gap': this.gap,
|
|
69
|
+
})}"
|
|
70
|
+
role="group">
|
|
71
|
+
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
72
|
+
</div>`;
|
|
73
|
+
}
|
|
74
|
+
}
|