@moni-labs/moni-ui 0.2.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/LICENSE +34 -0
- package/README.md +264 -0
- package/custom-elements.json +12510 -0
- package/dist/actions/index.d.ts +2 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/index.js +1 -0
- package/dist/assets/arch.svg +1 -0
- package/dist/assets/arrow.svg +1 -0
- package/dist/assets/boom.svg +1 -0
- package/dist/assets/bun.svg +1 -0
- package/dist/assets/burst.svg +1 -0
- package/dist/assets/circle.svg +1 -0
- package/dist/assets/clamshell.svg +1 -0
- package/dist/assets/diamond.svg +1 -0
- package/dist/assets/fan.svg +1 -0
- package/dist/assets/flower.svg +1 -0
- package/dist/assets/gem.svg +1 -0
- package/dist/assets/ghost-ish.svg +1 -0
- package/dist/assets/heart.svg +1 -0
- package/dist/assets/leaf-clover4.svg +1 -0
- package/dist/assets/leaf-clover8.svg +1 -0
- package/dist/assets/loading-indicator.svg +1 -0
- package/dist/assets/material-symbols-rounded.woff2 +0 -0
- package/dist/assets/material-symbols-subset.woff2 +0 -0
- package/dist/assets/oval.svg +1 -0
- package/dist/assets/pentagon.svg +1 -0
- package/dist/assets/pill.svg +1 -0
- package/dist/assets/pixel-circle.svg +1 -0
- package/dist/assets/pixel-triangle.svg +1 -0
- package/dist/assets/puffy-diamond.svg +1 -0
- package/dist/assets/puffy.svg +1 -0
- package/dist/assets/semicircle.svg +1 -0
- package/dist/assets/shapes/arch.svg +1 -0
- package/dist/assets/shapes/arrow.svg +1 -0
- package/dist/assets/shapes/boom.svg +1 -0
- package/dist/assets/shapes/burst.svg +1 -0
- package/dist/assets/shapes/circle.svg +1 -0
- package/dist/assets/shapes/clamshell.svg +1 -0
- package/dist/assets/shapes/diamond.svg +1 -0
- package/dist/assets/shapes/fan.svg +1 -0
- package/dist/assets/shapes/flower.svg +1 -0
- package/dist/assets/shapes/gem.svg +1 -0
- package/dist/assets/shapes/ghost-ish.svg +1 -0
- package/dist/assets/shapes/heart.svg +1 -0
- package/dist/assets/shapes/leaf-clover4.svg +1 -0
- package/dist/assets/shapes/leaf-clover8.svg +1 -0
- package/dist/assets/shapes/loading-indicator.svg +1 -0
- package/dist/assets/shapes/oval.svg +1 -0
- package/dist/assets/shapes/pentagon.svg +1 -0
- package/dist/assets/shapes/pill.svg +1 -0
- package/dist/assets/shapes/pixel-circle.svg +1 -0
- package/dist/assets/shapes/pixel-triangle.svg +1 -0
- package/dist/assets/shapes/puffy-diamond.svg +1 -0
- package/dist/assets/shapes/puffy.svg +1 -0
- package/dist/assets/shapes/semicircle.svg +1 -0
- package/dist/assets/shapes/sided-cookie12.svg +1 -0
- package/dist/assets/shapes/sided-cookie4.svg +1 -0
- package/dist/assets/shapes/sided-cookie6.svg +1 -0
- package/dist/assets/shapes/sided-cookie7.svg +1 -0
- package/dist/assets/shapes/sided-cookie9.svg +1 -0
- package/dist/assets/shapes/slanted.svg +1 -0
- package/dist/assets/shapes/soft-boom.svg +1 -0
- package/dist/assets/shapes/soft-burst.svg +1 -0
- package/dist/assets/shapes/square.svg +1 -0
- package/dist/assets/shapes/sunny.svg +1 -0
- package/dist/assets/shapes/triangle.svg +1 -0
- package/dist/assets/shapes/very-sunny.svg +1 -0
- package/dist/assets/shapes/wavy-circle.svg +1 -0
- package/dist/assets/shapes/wavy.svg +1 -0
- package/dist/assets/sided-cookie12.svg +1 -0
- package/dist/assets/sided-cookie4.svg +1 -0
- package/dist/assets/sided-cookie6.svg +1 -0
- package/dist/assets/sided-cookie7.svg +1 -0
- package/dist/assets/sided-cookie9.svg +1 -0
- package/dist/assets/slanted.svg +1 -0
- package/dist/assets/soft-boom.svg +1 -0
- package/dist/assets/soft-burst.svg +1 -0
- package/dist/assets/square.svg +1 -0
- package/dist/assets/star.svg +1 -0
- package/dist/assets/sunny.svg +1 -0
- package/dist/assets/triangle.svg +1 -0
- package/dist/assets/very-sunny.svg +1 -0
- package/dist/assets/wavy-circle.svg +1 -0
- package/dist/assets/wavy.svg +1 -0
- package/dist/components/_base/field-styles.d.ts +24 -0
- package/dist/components/_base/field-styles.d.ts.map +1 -0
- package/dist/components/_base/field-styles.js +504 -0
- package/dist/components/_base/index.d.ts +4 -0
- package/dist/components/_base/index.d.ts.map +1 -0
- package/dist/components/_base/index.js +3 -0
- package/dist/components/_base/interaction-styles.d.ts +22 -0
- package/dist/components/_base/interaction-styles.d.ts.map +1 -0
- package/dist/components/_base/interaction-styles.js +123 -0
- package/dist/components/_base/moni-element.d.ts +18 -0
- package/dist/components/_base/moni-element.d.ts.map +1 -0
- package/dist/components/_base/moni-element.js +19 -0
- package/dist/components/_base/shared-styles.d.ts +22 -0
- package/dist/components/_base/shared-styles.d.ts.map +1 -0
- package/dist/components/_base/shared-styles.js +146 -0
- package/dist/components/index.d.ts +42 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +43 -0
- package/dist/components/loading-shapes.d.ts +10 -0
- package/dist/components/loading-shapes.d.ts.map +1 -0
- package/dist/components/loading-shapes.js +9 -0
- package/dist/components/moni-app-bar.d.ts +52 -0
- package/dist/components/moni-app-bar.d.ts.map +1 -0
- package/dist/components/moni-app-bar.js +207 -0
- package/dist/components/moni-badge.d.ts +37 -0
- package/dist/components/moni-badge.d.ts.map +1 -0
- package/dist/components/moni-badge.js +153 -0
- package/dist/components/moni-bottom-sheet.d.ts +52 -0
- package/dist/components/moni-bottom-sheet.d.ts.map +1 -0
- package/dist/components/moni-bottom-sheet.js +440 -0
- package/dist/components/moni-button-group.d.ts +55 -0
- package/dist/components/moni-button-group.d.ts.map +1 -0
- package/dist/components/moni-button-group.js +278 -0
- package/dist/components/moni-button-segment.d.ts +29 -0
- package/dist/components/moni-button-segment.d.ts.map +1 -0
- package/dist/components/moni-button-segment.js +300 -0
- package/dist/components/moni-button.d.ts +70 -0
- package/dist/components/moni-button.d.ts.map +1 -0
- package/dist/components/moni-button.js +727 -0
- package/dist/components/moni-card.d.ts +48 -0
- package/dist/components/moni-card.d.ts.map +1 -0
- package/dist/components/moni-card.js +216 -0
- package/dist/components/moni-carousel.d.ts +111 -0
- package/dist/components/moni-carousel.d.ts.map +1 -0
- package/dist/components/moni-carousel.js +1007 -0
- package/dist/components/moni-checkbox.d.ts +39 -0
- package/dist/components/moni-checkbox.d.ts.map +1 -0
- package/dist/components/moni-checkbox.js +212 -0
- package/dist/components/moni-chip.d.ts +57 -0
- package/dist/components/moni-chip.d.ts.map +1 -0
- package/dist/components/moni-chip.js +340 -0
- package/dist/components/moni-color-field.d.ts +33 -0
- package/dist/components/moni-color-field.d.ts.map +1 -0
- package/dist/components/moni-color-field.js +170 -0
- package/dist/components/moni-context-menu.d.ts +55 -0
- package/dist/components/moni-context-menu.d.ts.map +1 -0
- package/dist/components/moni-context-menu.js +184 -0
- package/dist/components/moni-dialog.d.ts +37 -0
- package/dist/components/moni-dialog.d.ts.map +1 -0
- package/dist/components/moni-dialog.js +257 -0
- package/dist/components/moni-divider.d.ts +33 -0
- package/dist/components/moni-divider.d.ts.map +1 -0
- package/dist/components/moni-divider.js +81 -0
- package/dist/components/moni-expansion.d.ts +25 -0
- package/dist/components/moni-expansion.d.ts.map +1 -0
- package/dist/components/moni-expansion.js +94 -0
- package/dist/components/moni-fab-menu.d.ts +58 -0
- package/dist/components/moni-fab-menu.d.ts.map +1 -0
- package/dist/components/moni-fab-menu.js +247 -0
- package/dist/components/moni-fab.d.ts +48 -0
- package/dist/components/moni-fab.d.ts.map +1 -0
- package/dist/components/moni-fab.js +284 -0
- package/dist/components/moni-file-field.d.ts +47 -0
- package/dist/components/moni-file-field.d.ts.map +1 -0
- package/dist/components/moni-file-field.js +189 -0
- package/dist/components/moni-icon.d.ts +30 -0
- package/dist/components/moni-icon.d.ts.map +1 -0
- package/dist/components/moni-icon.js +107 -0
- package/dist/components/moni-list-item.d.ts +51 -0
- package/dist/components/moni-list-item.d.ts.map +1 -0
- package/dist/components/moni-list-item.js +239 -0
- package/dist/components/moni-list.d.ts +32 -0
- package/dist/components/moni-list.d.ts.map +1 -0
- package/dist/components/moni-list.js +67 -0
- package/dist/components/moni-loading-indicator.d.ts +32 -0
- package/dist/components/moni-loading-indicator.d.ts.map +1 -0
- package/dist/components/moni-loading-indicator.js +189 -0
- package/dist/components/moni-menu-item.d.ts +27 -0
- package/dist/components/moni-menu-item.d.ts.map +1 -0
- package/dist/components/moni-menu-item.js +99 -0
- package/dist/components/moni-menu.d.ts +55 -0
- package/dist/components/moni-menu.d.ts.map +1 -0
- package/dist/components/moni-menu.js +295 -0
- package/dist/components/moni-morph-modal.d.ts +78 -0
- package/dist/components/moni-morph-modal.d.ts.map +1 -0
- package/dist/components/moni-morph-modal.js +1223 -0
- package/dist/components/moni-nav-item.d.ts +38 -0
- package/dist/components/moni-nav-item.d.ts.map +1 -0
- package/dist/components/moni-nav-item.js +262 -0
- package/dist/components/moni-nav.d.ts +46 -0
- package/dist/components/moni-nav.d.ts.map +1 -0
- package/dist/components/moni-nav.js +272 -0
- package/dist/components/moni-progress.d.ts +45 -0
- package/dist/components/moni-progress.d.ts.map +1 -0
- package/dist/components/moni-progress.js +333 -0
- package/dist/components/moni-radio.d.ts +38 -0
- package/dist/components/moni-radio.d.ts.map +1 -0
- package/dist/components/moni-radio.js +218 -0
- package/dist/components/moni-ripple.d.ts +35 -0
- package/dist/components/moni-ripple.d.ts.map +1 -0
- package/dist/components/moni-ripple.js +156 -0
- package/dist/components/moni-segmented-button.d.ts +52 -0
- package/dist/components/moni-segmented-button.d.ts.map +1 -0
- package/dist/components/moni-segmented-button.js +208 -0
- package/dist/components/moni-select-option.d.ts +27 -0
- package/dist/components/moni-select-option.d.ts.map +1 -0
- package/dist/components/moni-select-option.js +102 -0
- package/dist/components/moni-select.d.ts +76 -0
- package/dist/components/moni-select.d.ts.map +1 -0
- package/dist/components/moni-select.js +1136 -0
- package/dist/components/moni-shape.d.ts +30 -0
- package/dist/components/moni-shape.d.ts.map +1 -0
- package/dist/components/moni-shape.js +146 -0
- package/dist/components/moni-side-sheet.d.ts +62 -0
- package/dist/components/moni-side-sheet.d.ts.map +1 -0
- package/dist/components/moni-side-sheet.js +576 -0
- package/dist/components/moni-slider.d.ts +73 -0
- package/dist/components/moni-slider.d.ts.map +1 -0
- package/dist/components/moni-slider.js +422 -0
- package/dist/components/moni-snackbar.d.ts +40 -0
- package/dist/components/moni-snackbar.d.ts.map +1 -0
- package/dist/components/moni-snackbar.js +161 -0
- package/dist/components/moni-split-button.d.ts +33 -0
- package/dist/components/moni-split-button.d.ts.map +1 -0
- package/dist/components/moni-split-button.js +122 -0
- package/dist/components/moni-step.d.ts +30 -0
- package/dist/components/moni-step.d.ts.map +1 -0
- package/dist/components/moni-step.js +175 -0
- package/dist/components/moni-stepper.d.ts +35 -0
- package/dist/components/moni-stepper.d.ts.map +1 -0
- package/dist/components/moni-stepper.js +101 -0
- package/dist/components/moni-switch.d.ts +39 -0
- package/dist/components/moni-switch.d.ts.map +1 -0
- package/dist/components/moni-switch.js +258 -0
- package/dist/components/moni-tab.d.ts +27 -0
- package/dist/components/moni-tab.d.ts.map +1 -0
- package/dist/components/moni-tab.js +147 -0
- package/dist/components/moni-tabs.d.ts +31 -0
- package/dist/components/moni-tabs.d.ts.map +1 -0
- package/dist/components/moni-tabs.js +106 -0
- package/dist/components/moni-text-field.d.ts +46 -0
- package/dist/components/moni-text-field.d.ts.map +1 -0
- package/dist/components/moni-text-field.js +190 -0
- package/dist/components/moni-textarea.d.ts +57 -0
- package/dist/components/moni-textarea.d.ts.map +1 -0
- package/dist/components/moni-textarea.js +228 -0
- package/dist/components/moni-time-picker.d.ts +51 -0
- package/dist/components/moni-time-picker.d.ts.map +1 -0
- package/dist/components/moni-time-picker.js +823 -0
- package/dist/components/moni-toolbar.d.ts +35 -0
- package/dist/components/moni-toolbar.d.ts.map +1 -0
- package/dist/components/moni-toolbar.js +128 -0
- package/dist/components/moni-tooltip.d.ts +65 -0
- package/dist/components/moni-tooltip.d.ts.map +1 -0
- package/dist/components/moni-tooltip.js +320 -0
- package/dist/components/moni-typography.d.ts +42 -0
- package/dist/components/moni-typography.d.ts.map +1 -0
- package/dist/components/moni-typography.js +205 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/styles/animations.css +46 -0
- package/dist/styles/base.css +248 -0
- package/dist/styles/index.css +3 -0
- package/dist/styles/tokens.css +190 -0
- package/dist/utils/color.d.ts +51 -0
- package/dist/utils/color.d.ts.map +1 -0
- package/dist/utils/color.js +107 -0
- package/dist/utils/theme.svelte.d.ts +45 -0
- package/dist/utils/theme.svelte.d.ts.map +1 -0
- package/dist/utils/theme.svelte.js +168 -0
- package/dist/web-components.d.ts +3 -0
- package/dist/web-components.d.ts.map +1 -0
- package/dist/web-components.js +4 -0
- package/package.json +76 -0
- package/src/actions/index.ts +2 -0
- package/src/assets/arch.svg +1 -0
- package/src/assets/arrow.svg +1 -0
- package/src/assets/boom.svg +1 -0
- package/src/assets/bun.svg +1 -0
- package/src/assets/burst.svg +1 -0
- package/src/assets/circle.svg +1 -0
- package/src/assets/clamshell.svg +1 -0
- package/src/assets/diamond.svg +1 -0
- package/src/assets/fan.svg +1 -0
- package/src/assets/flower.svg +1 -0
- package/src/assets/gem.svg +1 -0
- package/src/assets/ghost-ish.svg +1 -0
- package/src/assets/heart.svg +1 -0
- package/src/assets/leaf-clover4.svg +1 -0
- package/src/assets/leaf-clover8.svg +1 -0
- package/src/assets/loading-indicator.svg +1 -0
- package/src/assets/material-symbols-rounded.woff2 +0 -0
- package/src/assets/material-symbols-subset.woff2 +0 -0
- package/src/assets/oval.svg +1 -0
- package/src/assets/pentagon.svg +1 -0
- package/src/assets/pill.svg +1 -0
- package/src/assets/pixel-circle.svg +1 -0
- package/src/assets/pixel-triangle.svg +1 -0
- package/src/assets/puffy-diamond.svg +1 -0
- package/src/assets/puffy.svg +1 -0
- package/src/assets/semicircle.svg +1 -0
- package/src/assets/shapes/arch.svg +1 -0
- package/src/assets/shapes/arrow.svg +1 -0
- package/src/assets/shapes/boom.svg +1 -0
- package/src/assets/shapes/burst.svg +1 -0
- package/src/assets/shapes/circle.svg +1 -0
- package/src/assets/shapes/clamshell.svg +1 -0
- package/src/assets/shapes/diamond.svg +1 -0
- package/src/assets/shapes/fan.svg +1 -0
- package/src/assets/shapes/flower.svg +1 -0
- package/src/assets/shapes/gem.svg +1 -0
- package/src/assets/shapes/ghost-ish.svg +1 -0
- package/src/assets/shapes/heart.svg +1 -0
- package/src/assets/shapes/leaf-clover4.svg +1 -0
- package/src/assets/shapes/leaf-clover8.svg +1 -0
- package/src/assets/shapes/loading-indicator.svg +1 -0
- package/src/assets/shapes/oval.svg +1 -0
- package/src/assets/shapes/pentagon.svg +1 -0
- package/src/assets/shapes/pill.svg +1 -0
- package/src/assets/shapes/pixel-circle.svg +1 -0
- package/src/assets/shapes/pixel-triangle.svg +1 -0
- package/src/assets/shapes/puffy-diamond.svg +1 -0
- package/src/assets/shapes/puffy.svg +1 -0
- package/src/assets/shapes/semicircle.svg +1 -0
- package/src/assets/shapes/sided-cookie12.svg +1 -0
- package/src/assets/shapes/sided-cookie4.svg +1 -0
- package/src/assets/shapes/sided-cookie6.svg +1 -0
- package/src/assets/shapes/sided-cookie7.svg +1 -0
- package/src/assets/shapes/sided-cookie9.svg +1 -0
- package/src/assets/shapes/slanted.svg +1 -0
- package/src/assets/shapes/soft-boom.svg +1 -0
- package/src/assets/shapes/soft-burst.svg +1 -0
- package/src/assets/shapes/square.svg +1 -0
- package/src/assets/shapes/sunny.svg +1 -0
- package/src/assets/shapes/triangle.svg +1 -0
- package/src/assets/shapes/very-sunny.svg +1 -0
- package/src/assets/shapes/wavy-circle.svg +1 -0
- package/src/assets/shapes/wavy.svg +1 -0
- package/src/assets/sided-cookie12.svg +1 -0
- package/src/assets/sided-cookie4.svg +1 -0
- package/src/assets/sided-cookie6.svg +1 -0
- package/src/assets/sided-cookie7.svg +1 -0
- package/src/assets/sided-cookie9.svg +1 -0
- package/src/assets/slanted.svg +1 -0
- package/src/assets/soft-boom.svg +1 -0
- package/src/assets/soft-burst.svg +1 -0
- package/src/assets/square.svg +1 -0
- package/src/assets/star.svg +1 -0
- package/src/assets/sunny.svg +1 -0
- package/src/assets/triangle.svg +1 -0
- package/src/assets/very-sunny.svg +1 -0
- package/src/assets/wavy-circle.svg +1 -0
- package/src/assets/wavy.svg +1 -0
- package/src/assets.d.ts +12 -0
- package/src/components/_base/field-styles.ts +507 -0
- package/src/components/_base/index.ts +3 -0
- package/src/components/_base/interaction-styles.ts +125 -0
- package/src/components/_base/moni-element.ts +21 -0
- package/src/components/_base/shared-styles.ts +148 -0
- package/src/components/index.ts +45 -0
- package/src/components/loading-shapes.ts +9 -0
- package/src/components/moni-app-bar.test.ts +86 -0
- package/src/components/moni-app-bar.ts +190 -0
- package/src/components/moni-badge.ts +138 -0
- package/src/components/moni-bottom-sheet.test.ts +420 -0
- package/src/components/moni-bottom-sheet.ts +425 -0
- package/src/components/moni-button-group.test.ts +148 -0
- package/src/components/moni-button-group.ts +277 -0
- package/src/components/moni-button-segment.ts +291 -0
- package/src/components/moni-button.test.ts +166 -0
- package/src/components/moni-button.ts +709 -0
- package/src/components/moni-card.test.ts +83 -0
- package/src/components/moni-card.ts +203 -0
- package/src/components/moni-carousel.test.ts +238 -0
- package/src/components/moni-carousel.ts +1027 -0
- package/src/components/moni-checkbox.test.ts +78 -0
- package/src/components/moni-checkbox.ts +192 -0
- package/src/components/moni-chip.test.ts +168 -0
- package/src/components/moni-chip.ts +335 -0
- package/src/components/moni-color-field.test.ts +56 -0
- package/src/components/moni-color-field.ts +135 -0
- package/src/components/moni-context-menu.test.ts +99 -0
- package/src/components/moni-context-menu.ts +166 -0
- package/src/components/moni-dialog.ts +240 -0
- package/src/components/moni-divider.test.ts +42 -0
- package/src/components/moni-divider.ts +77 -0
- package/src/components/moni-expansion.ts +86 -0
- package/src/components/moni-fab-menu.test.ts +118 -0
- package/src/components/moni-fab-menu.ts +237 -0
- package/src/components/moni-fab.test.ts +128 -0
- package/src/components/moni-fab.ts +262 -0
- package/src/components/moni-file-field.test.ts +81 -0
- package/src/components/moni-file-field.ts +149 -0
- package/src/components/moni-icon.test.ts +70 -0
- package/src/components/moni-icon.ts +97 -0
- package/src/components/moni-list-item.test.ts +114 -0
- package/src/components/moni-list-item.ts +222 -0
- package/src/components/moni-list.ts +59 -0
- package/src/components/moni-loading-indicator.test.ts +41 -0
- package/src/components/moni-loading-indicator.ts +188 -0
- package/src/components/moni-menu-item.ts +85 -0
- package/src/components/moni-menu.test.ts +87 -0
- package/src/components/moni-menu.ts +287 -0
- package/src/components/moni-morph-modal.test.ts +286 -0
- package/src/components/moni-morph-modal.ts +1312 -0
- package/src/components/moni-nav-item.ts +243 -0
- package/src/components/moni-nav.test.ts +139 -0
- package/src/components/moni-nav.ts +266 -0
- package/src/components/moni-progress.test.ts +90 -0
- package/src/components/moni-progress.ts +322 -0
- package/src/components/moni-radio.test.ts +86 -0
- package/src/components/moni-radio.ts +196 -0
- package/src/components/moni-ripple.ts +146 -0
- package/src/components/moni-segmented-button.test.ts +99 -0
- package/src/components/moni-segmented-button.ts +220 -0
- package/src/components/moni-select-option.ts +85 -0
- package/src/components/moni-select.test.ts +210 -0
- package/src/components/moni-select.ts +1107 -0
- package/src/components/moni-shape.ts +128 -0
- package/src/components/moni-side-sheet.test.ts +128 -0
- package/src/components/moni-side-sheet.ts +544 -0
- package/src/components/moni-slider.test.ts +82 -0
- package/src/components/moni-slider.ts +387 -0
- package/src/components/moni-snackbar.test.ts +82 -0
- package/src/components/moni-snackbar.ts +146 -0
- package/src/components/moni-split-button.ts +121 -0
- package/src/components/moni-step.test.ts +57 -0
- package/src/components/moni-step.ts +155 -0
- package/src/components/moni-stepper.test.ts +116 -0
- package/src/components/moni-stepper.ts +100 -0
- package/src/components/moni-switch.test.ts +117 -0
- package/src/components/moni-switch.ts +237 -0
- package/src/components/moni-tab.test.ts +54 -0
- package/src/components/moni-tab.ts +133 -0
- package/src/components/moni-tabs.ts +92 -0
- package/src/components/moni-text-field.test.ts +115 -0
- package/src/components/moni-text-field.ts +149 -0
- package/src/components/moni-textarea.test.ts +147 -0
- package/src/components/moni-textarea.ts +176 -0
- package/src/components/moni-time-picker.test.ts +61 -0
- package/src/components/moni-time-picker.ts +800 -0
- package/src/components/moni-toolbar.test.ts +93 -0
- package/src/components/moni-toolbar.ts +119 -0
- package/src/components/moni-tooltip.test.ts +122 -0
- package/src/components/moni-tooltip.ts +324 -0
- package/src/components/moni-typography.test.ts +119 -0
- package/src/components/moni-typography.ts +195 -0
- package/src/index.ts +65 -0
- package/src/styles/animations.css +46 -0
- package/src/styles/base.css +248 -0
- package/src/styles/index.css +3 -0
- package/src/styles/tokens.css +190 -0
- package/src/types/svelte-runes.d.ts +7 -0
- package/src/utils/color.ts +170 -0
- package/src/utils/theme.svelte.ts +206 -0
- package/src/web-components.ts +5 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import './moni-list-item.js';
|
|
3
|
+
import type { MoniListItem } from './moni-list-item.js';
|
|
4
|
+
|
|
5
|
+
describe('moni-list-item (P5.3 — recreated)', () => {
|
|
6
|
+
let el: MoniListItem;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
el = document.createElement('moni-list-item') as MoniListItem;
|
|
10
|
+
el.textContent = 'Item headline';
|
|
11
|
+
document.body.appendChild(el);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
afterEach(() => {
|
|
15
|
+
el.remove();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('defaults to lines=1', async () => {
|
|
19
|
+
await el.updateComplete;
|
|
20
|
+
expect(el.lines).toBe(1);
|
|
21
|
+
expect(el.getAttribute('lines')).toBe('1');
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('renders the headline slot', async () => {
|
|
25
|
+
await el.updateComplete;
|
|
26
|
+
const headline = el.shadowRoot?.querySelector('[part="headline"]');
|
|
27
|
+
expect(headline).toBeTruthy();
|
|
28
|
+
const slot = headline?.querySelector('slot') as HTMLSlotElement | null;
|
|
29
|
+
const assigned = slot?.assignedNodes({ flatten: true }) ?? [];
|
|
30
|
+
const text = assigned.map((n) => n.textContent ?? '').join('').trim();
|
|
31
|
+
expect(text).toBe('Item headline');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('does not render supporting/meta slots when lines=1', async () => {
|
|
35
|
+
await el.updateComplete;
|
|
36
|
+
const supporting = el.shadowRoot?.querySelector('[part="supporting"]');
|
|
37
|
+
const meta = el.shadowRoot?.querySelector('[part="meta"]');
|
|
38
|
+
expect(supporting).toBeFalsy();
|
|
39
|
+
expect(meta).toBeFalsy();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('renders supporting slot when lines=2', async () => {
|
|
43
|
+
el.lines = 2;
|
|
44
|
+
const sup = document.createElement('span');
|
|
45
|
+
sup.setAttribute('slot', 'supporting');
|
|
46
|
+
sup.textContent = 'Supporting text';
|
|
47
|
+
el.appendChild(sup);
|
|
48
|
+
await el.updateComplete;
|
|
49
|
+
const supporting = el.shadowRoot?.querySelector('[part="supporting"]');
|
|
50
|
+
expect(supporting).toBeTruthy();
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('renders meta slot when lines=3', async () => {
|
|
54
|
+
el.lines = 3;
|
|
55
|
+
const sup = document.createElement('span');
|
|
56
|
+
sup.setAttribute('slot', 'supporting');
|
|
57
|
+
sup.textContent = 'Line 2';
|
|
58
|
+
el.appendChild(sup);
|
|
59
|
+
const meta = document.createElement('span');
|
|
60
|
+
meta.setAttribute('slot', 'meta');
|
|
61
|
+
meta.textContent = 'Line 3';
|
|
62
|
+
el.appendChild(meta);
|
|
63
|
+
await el.updateComplete;
|
|
64
|
+
const supporting = el.shadowRoot?.querySelector('[part="supporting"]');
|
|
65
|
+
const metaEl = el.shadowRoot?.querySelector('[part="meta"]');
|
|
66
|
+
expect(supporting).toBeTruthy();
|
|
67
|
+
expect(metaEl).toBeTruthy();
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('reflects active and disabled attributes', async () => {
|
|
71
|
+
el.active = true;
|
|
72
|
+
await el.updateComplete;
|
|
73
|
+
expect(el.hasAttribute('active')).toBe(true);
|
|
74
|
+
|
|
75
|
+
el.disabled = true;
|
|
76
|
+
await el.updateComplete;
|
|
77
|
+
expect(el.hasAttribute('disabled')).toBe(true);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it('renders an avatar when the avatar attribute is set', async () => {
|
|
81
|
+
el.avatar = 'https://example.com/avatar.png';
|
|
82
|
+
await el.updateComplete;
|
|
83
|
+
const avatar = el.shadowRoot?.querySelector('[part="avatar"]');
|
|
84
|
+
expect(avatar).toBeTruthy();
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('renders a leading icon when the icon attribute is set', async () => {
|
|
88
|
+
el.icon = 'home';
|
|
89
|
+
await el.updateComplete;
|
|
90
|
+
const leading = el.shadowRoot?.querySelector('[part="leading"]');
|
|
91
|
+
expect(leading).toBeTruthy();
|
|
92
|
+
const moniIcon = leading?.querySelector('moni-icon');
|
|
93
|
+
expect(moniIcon?.getAttribute('name')).toBe('home');
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('renders a trailing icon when the trailing-icon attribute is set', async () => {
|
|
97
|
+
el.setAttribute('trailing-icon', 'more_vert');
|
|
98
|
+
await el.updateComplete;
|
|
99
|
+
const trailing = el.shadowRoot?.querySelector('[part="trailing"]');
|
|
100
|
+
expect(trailing).toBeTruthy();
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('renders an <a> wrapper when href is set, otherwise the row is inline', async () => {
|
|
104
|
+
await el.updateComplete;
|
|
105
|
+
let row = el.shadowRoot?.querySelector('a');
|
|
106
|
+
expect(row).toBeFalsy();
|
|
107
|
+
|
|
108
|
+
el.href = '/profile';
|
|
109
|
+
await el.updateComplete;
|
|
110
|
+
row = el.shadowRoot?.querySelector('a');
|
|
111
|
+
expect(row).toBeTruthy();
|
|
112
|
+
expect(row?.getAttribute('href')).toBe('/profile');
|
|
113
|
+
});
|
|
114
|
+
});
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { html, css, nothing } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
import { MoniElement, sharedStyles } from './_base/index.js';
|
|
4
|
+
import './moni-icon.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Material 3 List Item (`m3-docs/components/lists/specs.md`).
|
|
8
|
+
*
|
|
9
|
+
* One row in a `<moni-list>`. Supports up to 3 lines of text:
|
|
10
|
+
* - line 1: headline (required).
|
|
11
|
+
* - line 2: supporting text (optional).
|
|
12
|
+
* - line 3: trailing meta text (optional).
|
|
13
|
+
*
|
|
14
|
+
* Plus optional leading/trailing icons or avatars.
|
|
15
|
+
*
|
|
16
|
+
* M3 measurements:
|
|
17
|
+
* - Min height: 56dp (1-line), 72dp (2-line), 88dp (3-line).
|
|
18
|
+
* - Horizontal padding: 16dp.
|
|
19
|
+
* - Vertical padding: 8dp top/bottom (so 1-line is 56dp tall).
|
|
20
|
+
* - Leading icon/avatar size: 24dp.
|
|
21
|
+
*
|
|
22
|
+
* Attributes:
|
|
23
|
+
* - lines: 1 (default) | 2 | 3
|
|
24
|
+
* - icon: Material Symbols name (leading icon)
|
|
25
|
+
* - avatar: URL for a leading image
|
|
26
|
+
* - trailing-icon: Material Symbols name (trailing icon)
|
|
27
|
+
* - active: present → background uses secondary-container
|
|
28
|
+
* - disabled: present → opacity 38%, cursor not-allowed
|
|
29
|
+
* - href: present → renders as <a>; otherwise <button>
|
|
30
|
+
*
|
|
31
|
+
* Slots:
|
|
32
|
+
* - default: headline (line 1)
|
|
33
|
+
* - supporting:line 2 text
|
|
34
|
+
* - meta: line 3 text
|
|
35
|
+
* - trailing-meta: trailing small text (right side)
|
|
36
|
+
*/
|
|
37
|
+
@customElement('moni-list-item')
|
|
38
|
+
export class MoniListItem extends MoniElement {
|
|
39
|
+
@property({ reflect: true })
|
|
40
|
+
lines: 1 | 2 | 3 = 1;
|
|
41
|
+
@property({ reflect: true }) icon = '';
|
|
42
|
+
@property({ reflect: true }) avatar = '';
|
|
43
|
+
@property({ reflect: true, attribute: 'trailing-icon' })
|
|
44
|
+
trailingIcon = '';
|
|
45
|
+
@property({ type: Boolean, reflect: true }) active = false;
|
|
46
|
+
@property({ type: Boolean, reflect: true }) disabled = false;
|
|
47
|
+
@property({ reflect: true }) href = '';
|
|
48
|
+
|
|
49
|
+
static override styles = [
|
|
50
|
+
sharedStyles,
|
|
51
|
+
css`
|
|
52
|
+
:host {
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
gap: 1rem;
|
|
56
|
+
padding: 0.5rem 1rem;
|
|
57
|
+
min-block-size: 3.5rem;
|
|
58
|
+
color: var(--on-surface);
|
|
59
|
+
background-color: transparent;
|
|
60
|
+
text-decoration: none;
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
position: relative;
|
|
63
|
+
font-family: var(--font);
|
|
64
|
+
transition: background-color var(--speed2);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
:host([active]) {
|
|
68
|
+
background-color: var(--secondary-container);
|
|
69
|
+
color: var(--on-secondary-container);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:host([disabled]) {
|
|
73
|
+
opacity: 0.38;
|
|
74
|
+
pointer-events: none;
|
|
75
|
+
cursor: not-allowed;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
:host(:not(:last-child)) {
|
|
79
|
+
border-block-end: 0.0625rem solid var(--outline-variant);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
:host([lines='2']) {
|
|
83
|
+
min-block-size: 4.5rem;
|
|
84
|
+
}
|
|
85
|
+
:host([lines='3']) {
|
|
86
|
+
min-block-size: 5.5rem;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.leading,
|
|
90
|
+
.trailing {
|
|
91
|
+
display: inline-flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
justify-content: center;
|
|
94
|
+
flex: none;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.leading-icon {
|
|
98
|
+
font-size: 1.5rem;
|
|
99
|
+
color: var(--on-surface-variant);
|
|
100
|
+
}
|
|
101
|
+
:host([active]) .leading-icon {
|
|
102
|
+
color: var(--on-secondary-container);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.avatar {
|
|
106
|
+
inline-size: 2.5rem;
|
|
107
|
+
block-size: 2.5rem;
|
|
108
|
+
border-radius: 50%;
|
|
109
|
+
background-color: var(--surface-container);
|
|
110
|
+
background-size: cover;
|
|
111
|
+
background-position: center;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.text {
|
|
115
|
+
flex: auto;
|
|
116
|
+
min-inline-size: 0;
|
|
117
|
+
display: flex;
|
|
118
|
+
flex-direction: column;
|
|
119
|
+
gap: 0.125rem;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.headline {
|
|
123
|
+
font-size: 1rem;
|
|
124
|
+
line-height: 1.5rem;
|
|
125
|
+
font-weight: 500;
|
|
126
|
+
color: inherit;
|
|
127
|
+
margin: 0;
|
|
128
|
+
padding: 0;
|
|
129
|
+
overflow: hidden;
|
|
130
|
+
text-overflow: ellipsis;
|
|
131
|
+
white-space: nowrap;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.supporting,
|
|
135
|
+
.meta {
|
|
136
|
+
font-size: 0.875rem;
|
|
137
|
+
line-height: 1.25rem;
|
|
138
|
+
font-weight: 400;
|
|
139
|
+
color: var(--on-surface-variant);
|
|
140
|
+
margin: 0;
|
|
141
|
+
padding: 0;
|
|
142
|
+
overflow: hidden;
|
|
143
|
+
text-overflow: ellipsis;
|
|
144
|
+
white-space: nowrap;
|
|
145
|
+
}
|
|
146
|
+
:host([active]) .supporting,
|
|
147
|
+
:host([active]) .meta {
|
|
148
|
+
color: var(--on-secondary-container);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.trailing-meta {
|
|
152
|
+
font-size: 0.75rem;
|
|
153
|
+
color: var(--on-surface-variant);
|
|
154
|
+
white-space: nowrap;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.trailing-icon {
|
|
158
|
+
font-size: 1.5rem;
|
|
159
|
+
color: var(--on-surface-variant);
|
|
160
|
+
}
|
|
161
|
+
:host([active]) .trailing-icon {
|
|
162
|
+
color: var(--on-secondary-container);
|
|
163
|
+
}
|
|
164
|
+
`
|
|
165
|
+
];
|
|
166
|
+
|
|
167
|
+
override render() {
|
|
168
|
+
const leading = this.avatar
|
|
169
|
+
? html`<span
|
|
170
|
+
class="avatar"
|
|
171
|
+
part="avatar"
|
|
172
|
+
style="background-image: url('${this.avatar}');"
|
|
173
|
+
></span>`
|
|
174
|
+
: this.icon
|
|
175
|
+
? html`<span class="leading leading-icon" part="leading">
|
|
176
|
+
<moni-icon name="${this.icon}"></moni-icon>
|
|
177
|
+
</span>`
|
|
178
|
+
: html`<slot name="leading"></slot>`;
|
|
179
|
+
|
|
180
|
+
const trailing = this.trailingIcon
|
|
181
|
+
? html`<span class="trailing trailing-icon" part="trailing">
|
|
182
|
+
<moni-icon name="${this.trailingIcon}"></moni-icon>
|
|
183
|
+
</span>`
|
|
184
|
+
: html`<slot name="trailing"></slot>`;
|
|
185
|
+
|
|
186
|
+
const supporting = this.lines >= 2
|
|
187
|
+
? html`<span class="supporting" part="supporting"
|
|
188
|
+
><slot name="supporting"></slot
|
|
189
|
+
></span>`
|
|
190
|
+
: nothing;
|
|
191
|
+
const meta = this.lines >= 3
|
|
192
|
+
? html`<span class="meta" part="meta"><slot name="meta"></slot></span>`
|
|
193
|
+
: nothing;
|
|
194
|
+
|
|
195
|
+
const inner = html`
|
|
196
|
+
${leading}
|
|
197
|
+
<div class="text" part="text">
|
|
198
|
+
<span class="headline" part="headline"><slot></slot></span>
|
|
199
|
+
${supporting} ${meta}
|
|
200
|
+
</div>
|
|
201
|
+
${trailing}
|
|
202
|
+
<slot name="trailing-meta"></slot>
|
|
203
|
+
`;
|
|
204
|
+
|
|
205
|
+
return this.href
|
|
206
|
+
? html`<a
|
|
207
|
+
class="row"
|
|
208
|
+
part="row"
|
|
209
|
+
href=${this.href}
|
|
210
|
+
>${inner}</a
|
|
211
|
+
>`
|
|
212
|
+
: inner;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
declare global {
|
|
217
|
+
interface HTMLElementTagNameMap {
|
|
218
|
+
'moni-list-item': MoniListItem;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export default MoniListItem;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { html, css } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
import { MoniElement, sharedStyles } from './_base/index.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Material 3 List (`m3-docs/components/lists/specs.md`).
|
|
7
|
+
*
|
|
8
|
+
* A list is a continuous vertical index of text and images. The
|
|
9
|
+
* container itself is purely structural (no padding); spacing and
|
|
10
|
+
* dividers are controlled by `<moni-list-item>` children.
|
|
11
|
+
*
|
|
12
|
+
* Two visual variants:
|
|
13
|
+
* - **default**: 8dp top/bottom padding between items (handled by items).
|
|
14
|
+
* - **border**: dividers drawn between items.
|
|
15
|
+
*
|
|
16
|
+
* Attributes:
|
|
17
|
+
* - variant: '' (default) | border
|
|
18
|
+
* - rounded: when set, items use a 4dp corner radius.
|
|
19
|
+
*
|
|
20
|
+
* Slots:
|
|
21
|
+
* - default: <moni-list-item> children.
|
|
22
|
+
*/
|
|
23
|
+
@customElement('moni-list')
|
|
24
|
+
export class MoniList extends MoniElement {
|
|
25
|
+
@property({ reflect: true }) variant: '' | 'border' = '';
|
|
26
|
+
@property({ type: Boolean, reflect: true }) rounded = false;
|
|
27
|
+
|
|
28
|
+
static override styles = [
|
|
29
|
+
sharedStyles,
|
|
30
|
+
css`
|
|
31
|
+
:host {
|
|
32
|
+
display: block;
|
|
33
|
+
font-family: var(--font);
|
|
34
|
+
color: var(--on-surface);
|
|
35
|
+
padding: 0;
|
|
36
|
+
margin: 0;
|
|
37
|
+
}
|
|
38
|
+
:host([variant='border']) {
|
|
39
|
+
border-block-end: 0.0625rem solid var(--outline-variant);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
::slotted(moni-list-item) {
|
|
43
|
+
display: block;
|
|
44
|
+
}
|
|
45
|
+
`
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
override render() {
|
|
49
|
+
return html`<slot></slot>`;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
declare global {
|
|
54
|
+
interface HTMLElementTagNameMap {
|
|
55
|
+
'moni-list': MoniList;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export default MoniList;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import './moni-loading-indicator.js';
|
|
3
|
+
import type { MoniLoadingIndicator } from './moni-loading-indicator.js';
|
|
4
|
+
|
|
5
|
+
describe('moni-loading-indicator', () => {
|
|
6
|
+
let el: MoniLoadingIndicator;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
el = document.createElement('moni-loading-indicator') as MoniLoadingIndicator;
|
|
10
|
+
document.body.appendChild(el);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
afterEach(() => {
|
|
14
|
+
el.remove();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('renders a container with active indicator', async () => {
|
|
18
|
+
await el.updateComplete;
|
|
19
|
+
const container = el.shadowRoot?.querySelector('.container');
|
|
20
|
+
const activeIndicator = el.shadowRoot?.querySelector('.active-indicator');
|
|
21
|
+
expect(container).toBeTruthy();
|
|
22
|
+
expect(activeIndicator).toBeTruthy();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('reflects and respects the variant attribute', async () => {
|
|
26
|
+
expect(el.variant).toBe('uncontained');
|
|
27
|
+
el.variant = 'contained';
|
|
28
|
+
await el.updateComplete;
|
|
29
|
+
expect(el.getAttribute('variant')).toBe('contained');
|
|
30
|
+
|
|
31
|
+
el.variant = 'uncontained';
|
|
32
|
+
await el.updateComplete;
|
|
33
|
+
expect(el.getAttribute('variant')).toBe('uncontained');
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('has progressbar role and min/max values set', () => {
|
|
37
|
+
expect(el.getAttribute('role')).toBe('progressbar');
|
|
38
|
+
expect(el.ariaValueMin).toBe('0');
|
|
39
|
+
expect(el.ariaValueMax).toBe('100');
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { html, css, unsafeCSS } from 'lit';
|
|
2
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
3
|
+
import { MoniElement, sharedStyles } from './_base/index.js';
|
|
4
|
+
import { loadingIndicatorPolygons } from './loading-shapes.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Shape-shifting indeterminate loading indicator based on Material 3 Expressive spec.
|
|
8
|
+
*
|
|
9
|
+
* Attributes:
|
|
10
|
+
* - variant: 'uncontained' (default) | 'contained'
|
|
11
|
+
*
|
|
12
|
+
* CSS custom properties for customization:
|
|
13
|
+
* - --moni-loading-indicator-size: Size of the active indicator (default: 2.375rem)
|
|
14
|
+
* - --moni-loading-indicator-active-color: Active indicator color in uncontained mode (default: var(--primary))
|
|
15
|
+
* - --moni-loading-indicator-contained-active-color: Active indicator color in contained mode (default: var(--on-primary-container))
|
|
16
|
+
* - --moni-loading-indicator-contained-container-color: Background color of container in contained mode (default: var(--secondary-container))
|
|
17
|
+
* - --moni-loading-indicator-container-shape: Border radius of container in contained mode (default: 9999px)
|
|
18
|
+
* - --moni-loading-indicator-container-size: Container size (default: 3rem)
|
|
19
|
+
*/
|
|
20
|
+
@customElement('moni-loading-indicator')
|
|
21
|
+
export class MoniLoadingIndicator extends MoniElement {
|
|
22
|
+
@property({ reflect: true })
|
|
23
|
+
variant: 'uncontained' | 'contained' = 'uncontained';
|
|
24
|
+
|
|
25
|
+
@query('.container') private _container?: HTMLElement;
|
|
26
|
+
|
|
27
|
+
override connectedCallback() {
|
|
28
|
+
super.connectedCallback();
|
|
29
|
+
this.ariaValueMin = this.ariaValueMin || '0';
|
|
30
|
+
this.ariaValueMax = this.ariaValueMax || '100';
|
|
31
|
+
this.role = this.role || 'progressbar';
|
|
32
|
+
this._toggleAnimation(true);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
override disconnectedCallback() {
|
|
36
|
+
super.disconnectedCallback();
|
|
37
|
+
this._toggleAnimation(false);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
protected override firstUpdated() {
|
|
41
|
+
this._toggleAnimation(true);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
private _toggleAnimation(enable: boolean) {
|
|
45
|
+
if (this._container) {
|
|
46
|
+
this._container.classList.toggle('animate', enable);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static override styles = [
|
|
51
|
+
sharedStyles,
|
|
52
|
+
css`
|
|
53
|
+
:host {
|
|
54
|
+
display: inline-block;
|
|
55
|
+
aspect-ratio: 1 / 1;
|
|
56
|
+
contain: strict;
|
|
57
|
+
vertical-align: middle;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
:host([variant='uncontained']) {
|
|
61
|
+
width: var(--moni-loading-indicator-size, 2.375rem);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
:host([variant='contained']) {
|
|
65
|
+
width: var(--moni-loading-indicator-container-size, 3rem);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
:host([variant='uncontained']) .active-indicator {
|
|
69
|
+
background-color: var(--moni-loading-indicator-active-color, var(--primary));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:host([variant='contained']) .active-indicator {
|
|
73
|
+
background-color: var(--moni-loading-indicator-contained-active-color, var(--on-primary-container));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
:host([variant='contained']) .container {
|
|
77
|
+
background-color: var(--moni-loading-indicator-contained-container-color, var(--secondary-container));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.container {
|
|
81
|
+
width: 100%;
|
|
82
|
+
height: 100%;
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
border-radius: var(--moni-loading-indicator-container-shape, 9999px);
|
|
87
|
+
box-sizing: border-box;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.active-indicator {
|
|
91
|
+
margin: auto;
|
|
92
|
+
aspect-ratio: 1 / 1;
|
|
93
|
+
width: calc(var(--moni-loading-indicator-size, 2.375rem) * 0.842);
|
|
94
|
+
transform-origin: center;
|
|
95
|
+
transition: clip-path 500ms cubic-bezier(0.2, 0, 0, 1);
|
|
96
|
+
will-change: transform, clip-path;
|
|
97
|
+
--_polygon-soft-burst: polygon(${unsafeCSS(loadingIndicatorPolygons['soft-burst'])});
|
|
98
|
+
--_polygon-9-sided-cookie: polygon(${unsafeCSS(loadingIndicatorPolygons['9-sided-cookie'])});
|
|
99
|
+
--_polygon-pentagon: polygon(${unsafeCSS(loadingIndicatorPolygons['pentagon'])});
|
|
100
|
+
--_polygon-pill: polygon(${unsafeCSS(loadingIndicatorPolygons['pill'])});
|
|
101
|
+
--_polygon-sunny: polygon(${unsafeCSS(loadingIndicatorPolygons['sunny'])});
|
|
102
|
+
--_polygon-4-sided-cookie: polygon(${unsafeCSS(loadingIndicatorPolygons['4-sided-cookie'])});
|
|
103
|
+
--_polygon-oval: polygon(${unsafeCSS(loadingIndicatorPolygons['oval'])});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.container.animate .active-indicator-wrapper {
|
|
107
|
+
animation: rotate-outer 4666ms linear infinite;
|
|
108
|
+
transform-origin: center;
|
|
109
|
+
display: flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
justify-content: center;
|
|
112
|
+
will-change: transform;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@keyframes rotate-outer {
|
|
116
|
+
0% {
|
|
117
|
+
transform: rotate(0deg);
|
|
118
|
+
}
|
|
119
|
+
100% {
|
|
120
|
+
transform: rotate(360deg);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.container.animate .active-indicator {
|
|
125
|
+
animation: rotate-inner 4666ms cubic-bezier(0.34, 0.88, 0.34, 1) infinite;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@keyframes rotate-inner {
|
|
129
|
+
0% {
|
|
130
|
+
clip-path: var(--_polygon-soft-burst);
|
|
131
|
+
transform: rotate(0deg);
|
|
132
|
+
}
|
|
133
|
+
14% {
|
|
134
|
+
clip-path: var(--_polygon-9-sided-cookie);
|
|
135
|
+
transform: rotate(154deg) scale(1);
|
|
136
|
+
}
|
|
137
|
+
29% {
|
|
138
|
+
clip-path: var(--_polygon-pentagon);
|
|
139
|
+
transform: rotate(309deg) scale(1);
|
|
140
|
+
}
|
|
141
|
+
43% {
|
|
142
|
+
clip-path: var(--_polygon-pill);
|
|
143
|
+
transform: rotate(463deg) scale(1);
|
|
144
|
+
}
|
|
145
|
+
57% {
|
|
146
|
+
clip-path: var(--_polygon-sunny);
|
|
147
|
+
transform: rotate(617deg) scale(1);
|
|
148
|
+
}
|
|
149
|
+
71% {
|
|
150
|
+
clip-path: var(--_polygon-4-sided-cookie);
|
|
151
|
+
transform: rotate(771deg) scale(1);
|
|
152
|
+
}
|
|
153
|
+
83% {
|
|
154
|
+
clip-path: var(--_polygon-oval);
|
|
155
|
+
transform: rotate(926deg) scale(1);
|
|
156
|
+
}
|
|
157
|
+
100% {
|
|
158
|
+
clip-path: var(--_polygon-soft-burst);
|
|
159
|
+
transform: rotate(1080deg) scale(1);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
@media (forced-colors: active) {
|
|
164
|
+
.active-indicator {
|
|
165
|
+
background-color: CanvasText !important;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
`
|
|
169
|
+
];
|
|
170
|
+
|
|
171
|
+
override render() {
|
|
172
|
+
return html`
|
|
173
|
+
<div class="container animate" aria-hidden="true">
|
|
174
|
+
<div class="active-indicator-wrapper">
|
|
175
|
+
<div class="active-indicator"></div>
|
|
176
|
+
</div>
|
|
177
|
+
</div>
|
|
178
|
+
`;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
declare global {
|
|
183
|
+
interface HTMLElementTagNameMap {
|
|
184
|
+
'moni-loading-indicator': MoniLoadingIndicator;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export default MoniLoadingIndicator;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { html, css } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
import { MoniElement, sharedStyles } from './_base/index.js';
|
|
4
|
+
import './moni-icon.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Visual-only menu item. Renders an `<li>` styled with the BeerCSS
|
|
8
|
+
* `menu > li` rule.
|
|
9
|
+
*
|
|
10
|
+
* Attributes:
|
|
11
|
+
* - active: present → tertiary-container highlight
|
|
12
|
+
* - disabled: present
|
|
13
|
+
* - icon: Material Symbols name
|
|
14
|
+
* - label: item text
|
|
15
|
+
*/
|
|
16
|
+
@customElement('moni-menu-item')
|
|
17
|
+
export class MoniMenuItem extends MoniElement {
|
|
18
|
+
@property({ type: Boolean, reflect: true }) active = false;
|
|
19
|
+
@property({ type: Boolean, reflect: true }) disabled = false;
|
|
20
|
+
@property({ reflect: true }) icon = '';
|
|
21
|
+
@property({ reflect: true }) label = '';
|
|
22
|
+
|
|
23
|
+
static override styles = [
|
|
24
|
+
sharedStyles,
|
|
25
|
+
css`
|
|
26
|
+
:host {
|
|
27
|
+
display: block;
|
|
28
|
+
font-family: var(--font);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
li {
|
|
32
|
+
all: unset;
|
|
33
|
+
box-sizing: border-box;
|
|
34
|
+
position: relative;
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
text-align: start;
|
|
38
|
+
justify-content: flex-start;
|
|
39
|
+
white-space: nowrap;
|
|
40
|
+
gap: 1rem;
|
|
41
|
+
padding: 0.5rem 1rem;
|
|
42
|
+
min-block-size: 2.75rem;
|
|
43
|
+
flex: 1;
|
|
44
|
+
margin: 0 !important;
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
border-radius: 0.25rem;
|
|
47
|
+
color: var(--on-surface);
|
|
48
|
+
font-size: 0.875rem;
|
|
49
|
+
transition: border-radius var(--speed2);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
li:hover {
|
|
53
|
+
background-color: var(--active);
|
|
54
|
+
}
|
|
55
|
+
li.active {
|
|
56
|
+
background-color: var(--tertiary-container);
|
|
57
|
+
color: var(--on-tertiary-container);
|
|
58
|
+
}
|
|
59
|
+
li:is(.active, :active) {
|
|
60
|
+
border-radius: 0.75rem;
|
|
61
|
+
}
|
|
62
|
+
:host([disabled]) li {
|
|
63
|
+
opacity: 0.5;
|
|
64
|
+
pointer-events: none;
|
|
65
|
+
}
|
|
66
|
+
`
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
override render() {
|
|
70
|
+
return html`<li part="item">
|
|
71
|
+
${this.icon
|
|
72
|
+
? html`<moni-icon name="${this.icon}" part="icon"></moni-icon>`
|
|
73
|
+
: html`<slot name="icon"></slot>`}
|
|
74
|
+
<span part="label"><slot>${this.label}</slot></span>
|
|
75
|
+
</li>`;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
declare global {
|
|
80
|
+
interface HTMLElementTagNameMap {
|
|
81
|
+
'moni-menu-item': MoniMenuItem;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export default MoniMenuItem;
|