@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,237 @@
|
|
|
1
|
+
import { html, css } from 'lit';
|
|
2
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
3
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
4
|
+
import { MoniElement, sharedStyles } from './_base/index.js';
|
|
5
|
+
import './moni-icon.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Switch styled per Material Design 3 specs.
|
|
9
|
+
*
|
|
10
|
+
* M3 measurements (`m3-docs/components/switch/specs.md`):
|
|
11
|
+
* - Track: 52dp × 32dp, 2dp outline, full corner radius
|
|
12
|
+
* - Handle (thumb): 16dp unselected, 24dp selected, 28dp pressed
|
|
13
|
+
* - State layer: 40dp circular ripple on hover/focus/pressed
|
|
14
|
+
* - Icon (optional): 16dp on selected and/or unselected handle
|
|
15
|
+
*
|
|
16
|
+
* Attributes:
|
|
17
|
+
* - label: text label (displayed to the right of the switch)
|
|
18
|
+
* - checked: present
|
|
19
|
+
* - disabled: present
|
|
20
|
+
* - icon: present → renders check/close icons inside the thumb
|
|
21
|
+
* - name: forwarded to input.name
|
|
22
|
+
* - value: forwarded to input.value
|
|
23
|
+
*/
|
|
24
|
+
@customElement('moni-switch')
|
|
25
|
+
export class MoniSwitch extends MoniElement {
|
|
26
|
+
@property({ reflect: true }) label = '';
|
|
27
|
+
@property({ type: Boolean, reflect: true }) checked = false;
|
|
28
|
+
@property({ type: Boolean, reflect: true }) disabled = false;
|
|
29
|
+
@property({ type: Boolean, reflect: true }) icon = false;
|
|
30
|
+
@property({ reflect: true }) name = '';
|
|
31
|
+
@property({ reflect: true }) value = '';
|
|
32
|
+
|
|
33
|
+
@query('input') private _input!: HTMLInputElement;
|
|
34
|
+
|
|
35
|
+
override updated(changed: Map<string, unknown>) {
|
|
36
|
+
if (this._input) {
|
|
37
|
+
if (changed.has('checked')) this._input.checked = this.checked;
|
|
38
|
+
if (changed.has('disabled')) this._input.disabled = this.disabled;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private _onChange(e: Event) {
|
|
43
|
+
this.checked = (e.target as HTMLInputElement).checked;
|
|
44
|
+
this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static override styles = [
|
|
48
|
+
sharedStyles,
|
|
49
|
+
css`
|
|
50
|
+
:host {
|
|
51
|
+
display: inline-flex;
|
|
52
|
+
font-family: var(--font);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.switch {
|
|
56
|
+
--_thumb: 1rem; /* 16dp unselected (M3) */
|
|
57
|
+
--_track-w: 3.25rem; /* 52dp */
|
|
58
|
+
--_track-h: 2rem; /* 32dp */
|
|
59
|
+
inline-size: auto;
|
|
60
|
+
block-size: auto;
|
|
61
|
+
line-height: normal;
|
|
62
|
+
white-space: nowrap;
|
|
63
|
+
cursor: pointer;
|
|
64
|
+
display: inline-flex;
|
|
65
|
+
align-items: center;
|
|
66
|
+
direction: ltr;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* Input hit area: 52dp × 32dp track */
|
|
70
|
+
.switch > input {
|
|
71
|
+
inline-size: var(--_track-w);
|
|
72
|
+
block-size: var(--_track-h);
|
|
73
|
+
opacity: 0;
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
flex: none;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* Text label span */
|
|
79
|
+
.switch > span {
|
|
80
|
+
display: inline-flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
color: var(--on-surface);
|
|
83
|
+
font-size: 0.875rem;
|
|
84
|
+
position: relative;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* Track */
|
|
88
|
+
.switch > span::after {
|
|
89
|
+
content: "";
|
|
90
|
+
position: absolute;
|
|
91
|
+
inset: 50% auto auto 0;
|
|
92
|
+
background-color: var(--surface-container-highest);
|
|
93
|
+
border: 0.125rem solid var(--outline);
|
|
94
|
+
box-sizing: border-box;
|
|
95
|
+
inline-size: var(--_track-w);
|
|
96
|
+
block-size: var(--_track-h);
|
|
97
|
+
border-radius: var(--_track-h);
|
|
98
|
+
/* Shift the track to sit behind the input (input is to the left) */
|
|
99
|
+
transform: translate(calc(-1 * var(--_track-w)), -50%);
|
|
100
|
+
pointer-events: none;
|
|
101
|
+
transition: background-color var(--speed2), border-color var(--speed2);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* Thumb (handle) */
|
|
105
|
+
.switch > span::before,
|
|
106
|
+
.switch.icon > span > i {
|
|
107
|
+
position: absolute;
|
|
108
|
+
inset: 50% auto auto 0;
|
|
109
|
+
display: inline-flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
justify-content: center;
|
|
112
|
+
border-radius: 50%;
|
|
113
|
+
transition: all var(--speed2);
|
|
114
|
+
font-size: calc(var(--_thumb) - 0.25rem);
|
|
115
|
+
user-select: none;
|
|
116
|
+
min-inline-size: var(--_thumb);
|
|
117
|
+
min-block-size: var(--_thumb);
|
|
118
|
+
content: "";
|
|
119
|
+
color: var(--on-surface-variant);
|
|
120
|
+
background-color: var(--outline);
|
|
121
|
+
/* Unchecked: 16dp thumb sits 2dp from track start */
|
|
122
|
+
transform: translate(calc(-1 * var(--_track-w) + 0.25rem), -50%);
|
|
123
|
+
z-index: 2;
|
|
124
|
+
pointer-events: none;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* Icon mode uses a 24dp thumb at rest */
|
|
128
|
+
.switch.icon > span > i {
|
|
129
|
+
--_thumb: 1.5rem;
|
|
130
|
+
transform: translate(calc(-1 * var(--_track-w) + 0.25rem), -50%);
|
|
131
|
+
font-family: var(--font-icon);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* 40dp circular state layer behind the thumb on hover/focus */
|
|
135
|
+
.switch > span::before,
|
|
136
|
+
.switch.icon > span > i {
|
|
137
|
+
box-shadow: 0 0 0 0 transparent;
|
|
138
|
+
}
|
|
139
|
+
.switch > input:not(:disabled):is(:focus, :hover) + span::before,
|
|
140
|
+
.switch.icon > input:not(:disabled):is(:focus, :hover) + span > i {
|
|
141
|
+
box-shadow: 0 0 0 0.5rem color-mix(in srgb, var(--on-surface) 8%, transparent);
|
|
142
|
+
}
|
|
143
|
+
.switch > input:not(:disabled):is(:focus, :hover):checked + span::before,
|
|
144
|
+
.switch.icon > input:not(:disabled):is(:focus, :hover):checked + span > i {
|
|
145
|
+
box-shadow: 0 0 0 0.5rem color-mix(in srgb, var(--primary) 12%, transparent);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/* Checked: track fills with primary */
|
|
149
|
+
.switch > input:checked + span::after {
|
|
150
|
+
border: none;
|
|
151
|
+
background-color: var(--primary);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/* Checked: thumb grows to 24dp and slides right */
|
|
155
|
+
.switch > input:checked + span::before {
|
|
156
|
+
--_thumb: 1.5rem;
|
|
157
|
+
content: "";
|
|
158
|
+
color: var(--primary);
|
|
159
|
+
background-color: var(--on-primary);
|
|
160
|
+
transform: translate(calc(-1.75rem), -50%);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/* Checked icon mode: show check icon */
|
|
164
|
+
.switch.icon > input:checked + span > i {
|
|
165
|
+
content: "check";
|
|
166
|
+
color: var(--primary);
|
|
167
|
+
background-color: var(--on-primary);
|
|
168
|
+
transform: translate(-1.75rem, -50%);
|
|
169
|
+
font-family: var(--font-icon);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/* Active (pressed) states: 28dp thumb */
|
|
173
|
+
.switch > input:active:not(:disabled) + span::before,
|
|
174
|
+
.switch.icon > input:active:not(:disabled) + span > i {
|
|
175
|
+
--_thumb: 1.75rem;
|
|
176
|
+
transform: translate(calc(-1 * var(--_track-w) + 0.25rem), -50%);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.switch > input:active:checked:not(:disabled) + span::before,
|
|
180
|
+
.switch.icon > input:active:checked:not(:disabled) + span > i {
|
|
181
|
+
--_thumb: 1.75rem;
|
|
182
|
+
transform: translate(-1.625rem, -50%);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/* Icon mode: toggle visibility of close/check icons */
|
|
186
|
+
.icon > input:checked + span > i:first-child,
|
|
187
|
+
.icon > span > i:last-child {
|
|
188
|
+
opacity: 0;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.icon > input:checked + span > i:last-child,
|
|
192
|
+
.icon > span > i:first-child {
|
|
193
|
+
opacity: 1;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/* Disabled */
|
|
197
|
+
.switch > input:disabled + span {
|
|
198
|
+
opacity: 0.5;
|
|
199
|
+
cursor: not-allowed;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/* Focus outline on the track */
|
|
203
|
+
.switch > :focus-visible + span::after {
|
|
204
|
+
outline: 0.125rem solid var(--primary);
|
|
205
|
+
outline-offset: 0.25rem;
|
|
206
|
+
}
|
|
207
|
+
`
|
|
208
|
+
];
|
|
209
|
+
|
|
210
|
+
override render() {
|
|
211
|
+
return html`<label class=${this.icon ? 'switch icon' : 'switch'} part="switch">
|
|
212
|
+
<input
|
|
213
|
+
type="checkbox"
|
|
214
|
+
role="switch"
|
|
215
|
+
.checked=${this.checked}
|
|
216
|
+
?disabled=${this.disabled}
|
|
217
|
+
name=${ifDefined(this.name || undefined)}
|
|
218
|
+
value=${ifDefined(this.value || undefined)}
|
|
219
|
+
@change=${this._onChange}
|
|
220
|
+
/>
|
|
221
|
+
<span>
|
|
222
|
+
${this.icon ? html`<i>close</i><i>check</i>` : ''}
|
|
223
|
+
${this.label
|
|
224
|
+
? html`<span class="label" part="label"> ${this.label}</span>`
|
|
225
|
+
: html`<slot></slot>`}
|
|
226
|
+
</span>
|
|
227
|
+
</label>`;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
declare global {
|
|
232
|
+
interface HTMLElementTagNameMap {
|
|
233
|
+
'moni-switch': MoniSwitch;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export default MoniSwitch;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import './moni-tabs.js';
|
|
3
|
+
import './moni-tab.js';
|
|
4
|
+
import type { MoniTabs } from './moni-tabs.js';
|
|
5
|
+
import type { MoniTab } from './moni-tab.js';
|
|
6
|
+
|
|
7
|
+
describe('moni-tab indicator-size', () => {
|
|
8
|
+
let tabs: MoniTabs;
|
|
9
|
+
let tab: MoniTab;
|
|
10
|
+
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
tabs = document.createElement('moni-tabs') as MoniTabs;
|
|
13
|
+
tab = document.createElement('moni-tab') as MoniTab;
|
|
14
|
+
tab.label = 'Home';
|
|
15
|
+
tab.active = true;
|
|
16
|
+
tabs.appendChild(tab);
|
|
17
|
+
document.body.appendChild(tabs);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
afterEach(() => {
|
|
21
|
+
tabs.remove();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('reflects indicatorSize on the host', async () => {
|
|
25
|
+
tabs.indicatorSize = 'min';
|
|
26
|
+
await tabs.updateComplete;
|
|
27
|
+
expect(tabs.getAttribute('indicator-size')).toBe('min');
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('reflects indicatorSize="max" on the host', async () => {
|
|
31
|
+
tabs.indicatorSize = 'max';
|
|
32
|
+
await tabs.updateComplete;
|
|
33
|
+
expect(tabs.getAttribute('indicator-size')).toBe('max');
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('reflects indicatorSize="default" on the host', async () => {
|
|
37
|
+
tabs.indicatorSize = 'default';
|
|
38
|
+
await tabs.updateComplete;
|
|
39
|
+
expect(tabs.getAttribute('indicator-size')).toBe('default');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('vertical orientation is reflected on the tabs host', async () => {
|
|
43
|
+
tabs.vertical = true;
|
|
44
|
+
await tabs.updateComplete;
|
|
45
|
+
expect(tabs.hasAttribute('vertical')).toBe(true);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('tab active state reflects aria-selected=true', async () => {
|
|
49
|
+
tab.active = true;
|
|
50
|
+
await tab.updateComplete;
|
|
51
|
+
const a = tab.shadowRoot?.querySelector('a');
|
|
52
|
+
expect(a?.getAttribute('aria-selected')).toBe('true');
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -0,0 +1,133 @@
|
|
|
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 tab. Renders an `<a>` styled with the BeerCSS `.tabs > a`
|
|
8
|
+
* helper.
|
|
9
|
+
*
|
|
10
|
+
* Attributes:
|
|
11
|
+
* - active: present → active style
|
|
12
|
+
* - icon: Material Symbols name
|
|
13
|
+
* - label: tab text
|
|
14
|
+
* - href: link target
|
|
15
|
+
*/
|
|
16
|
+
@customElement('moni-tab')
|
|
17
|
+
export class MoniTab extends MoniElement {
|
|
18
|
+
@property({ type: Boolean, reflect: true }) active = false;
|
|
19
|
+
@property({ reflect: true }) icon = '';
|
|
20
|
+
@property({ reflect: true }) label = '';
|
|
21
|
+
@property({ reflect: true }) href = '#';
|
|
22
|
+
|
|
23
|
+
static override styles = [
|
|
24
|
+
sharedStyles,
|
|
25
|
+
css`
|
|
26
|
+
:host {
|
|
27
|
+
display: inline-flex;
|
|
28
|
+
font-family: var(--font);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
:host-context(moni-tabs[vertical]) {
|
|
32
|
+
display: flex;
|
|
33
|
+
inline-size: 100%;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
a {
|
|
37
|
+
position: relative;
|
|
38
|
+
display: flex;
|
|
39
|
+
font-size: 0.875rem;
|
|
40
|
+
font-weight: 500;
|
|
41
|
+
color: var(--on-surface-variant);
|
|
42
|
+
padding: 0.5rem 1rem;
|
|
43
|
+
text-align: center;
|
|
44
|
+
min-block-size: 3rem;
|
|
45
|
+
inline-size: 100%;
|
|
46
|
+
gap: 0.25rem;
|
|
47
|
+
text-decoration: none;
|
|
48
|
+
align-items: center;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
transition: color var(--speed2);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
:host-context(moni-tabs[vertical]) a {
|
|
55
|
+
flex-direction: column;
|
|
56
|
+
gap: 0.25rem;
|
|
57
|
+
min-block-size: 4.5rem;
|
|
58
|
+
border-inline-end: 0.125rem solid transparent;
|
|
59
|
+
border-block-end: none;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
a:hover {
|
|
63
|
+
color: var(--primary);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
a.active,
|
|
67
|
+
a.active > * {
|
|
68
|
+
color: var(--primary);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
a.active::before {
|
|
72
|
+
content: '';
|
|
73
|
+
position: absolute;
|
|
74
|
+
inset: auto 0 0 0;
|
|
75
|
+
/* M3 Expressive: indicator thickness 3dp. */
|
|
76
|
+
block-size: 0.1875rem;
|
|
77
|
+
/* M3 Expressive default: full tab width. */
|
|
78
|
+
border-radius: 0.75rem;
|
|
79
|
+
background-color: var(--primary);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
:host-context(moni-tabs[vertical]) a.active::before {
|
|
83
|
+
inset: 0 0 0 auto;
|
|
84
|
+
inline-size: 0.1875rem;
|
|
85
|
+
block-size: auto;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* M3 indicator-size='min': 24dp tall (centered on tab) with
|
|
89
|
+
8dp top/bottom radius — matches M3 spec § Indicator anatomy. */
|
|
90
|
+
:host-context(moni-tabs[indicator-size='min']) a.active::before {
|
|
91
|
+
margin: 0 auto;
|
|
92
|
+
max-inline-size: min(100%, 4rem);
|
|
93
|
+
block-size: 1.5rem;
|
|
94
|
+
border-radius: 0.5rem;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
:host-context(moni-tabs[vertical][indicator-size='min'])
|
|
98
|
+
a.active::before {
|
|
99
|
+
margin: auto 0;
|
|
100
|
+
max-block-size: 4rem;
|
|
101
|
+
max-inline-size: 0.1875rem;
|
|
102
|
+
border-radius: 0.5rem;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* M3 indicator-size='max': full tab height, no rounding. */
|
|
106
|
+
:host-context(moni-tabs[indicator-size='max']) a.active::before {
|
|
107
|
+
border-radius: 0;
|
|
108
|
+
}
|
|
109
|
+
`
|
|
110
|
+
];
|
|
111
|
+
|
|
112
|
+
override render() {
|
|
113
|
+
return html`<a
|
|
114
|
+
href=${this.href || '#'}
|
|
115
|
+
class=${this.active ? 'active' : ''}
|
|
116
|
+
part="tab"
|
|
117
|
+
aria-selected=${this.active}
|
|
118
|
+
>
|
|
119
|
+
${this.icon
|
|
120
|
+
? html`<moni-icon name="${this.icon}" part="icon"></moni-icon>`
|
|
121
|
+
: html`<slot name="icon"></slot>`}
|
|
122
|
+
<span part="label"><slot>${this.label}</slot></span>
|
|
123
|
+
</a>`;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
declare global {
|
|
128
|
+
interface HTMLElementTagNameMap {
|
|
129
|
+
'moni-tab': MoniTab;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export default MoniTab;
|
|
@@ -0,0 +1,92 @@
|
|
|
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
|
+
* Visual-only tab bar. Renders a `<nav>` styled with the BeerCSS `.tabs`
|
|
7
|
+
* helper.
|
|
8
|
+
*
|
|
9
|
+
* Attributes:
|
|
10
|
+
* - mode: primary (default) | secondary
|
|
11
|
+
* - scrollable: present → overflow-x: auto
|
|
12
|
+
* - align: default (space-around) | left | center | right
|
|
13
|
+
* - indicator: default (full) | min | max
|
|
14
|
+
* - vertical: present → icon above label
|
|
15
|
+
*
|
|
16
|
+
* Slots:
|
|
17
|
+
* - default: <moni-tab> children
|
|
18
|
+
*/
|
|
19
|
+
@customElement('moni-tabs')
|
|
20
|
+
export class MoniTabs extends MoniElement {
|
|
21
|
+
@property({ reflect: true })
|
|
22
|
+
mode: 'primary' | 'secondary' = 'primary';
|
|
23
|
+
@property({ type: Boolean, reflect: true }) scrollable = false;
|
|
24
|
+
@property({ type: Boolean, reflect: true }) vertical = false;
|
|
25
|
+
@property({ reflect: true })
|
|
26
|
+
align: 'default' | 'left' | 'center' | 'right' = 'default';
|
|
27
|
+
@property({ reflect: true, attribute: 'indicator-size' })
|
|
28
|
+
indicatorSize: 'default' | 'min' | 'max' = 'default';
|
|
29
|
+
|
|
30
|
+
static override styles = [
|
|
31
|
+
sharedStyles,
|
|
32
|
+
css`
|
|
33
|
+
:host {
|
|
34
|
+
display: block;
|
|
35
|
+
font-family: var(--font);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
nav {
|
|
39
|
+
display: flex;
|
|
40
|
+
white-space: nowrap;
|
|
41
|
+
border-block-end: 0.0625rem solid var(--surface-variant);
|
|
42
|
+
border-radius: 0;
|
|
43
|
+
overflow-x: auto;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
nav.left-align {
|
|
47
|
+
justify-content: flex-start;
|
|
48
|
+
}
|
|
49
|
+
nav.center-align {
|
|
50
|
+
justify-content: center;
|
|
51
|
+
}
|
|
52
|
+
nav.right-align {
|
|
53
|
+
justify-content: flex-end;
|
|
54
|
+
}
|
|
55
|
+
:host(:not([align])) nav,
|
|
56
|
+
nav:not(.left-align):not(.center-align):not(.right-align) {
|
|
57
|
+
justify-content: space-around;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
:host([vertical]) nav {
|
|
61
|
+
flex-direction: column;
|
|
62
|
+
border-block-end: none;
|
|
63
|
+
border-inline-end: 0.0625rem solid var(--surface-variant);
|
|
64
|
+
overflow-x: visible;
|
|
65
|
+
overflow-y: auto;
|
|
66
|
+
}
|
|
67
|
+
`
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
override render() {
|
|
71
|
+
const classes = [
|
|
72
|
+
'tabs',
|
|
73
|
+
this.align === 'default' ? '' : `${this.align}-align`,
|
|
74
|
+
this.indicatorSize === 'default' ? '' : this.indicatorSize,
|
|
75
|
+
this.mode,
|
|
76
|
+
this.vertical ? 'vertical' : ''
|
|
77
|
+
]
|
|
78
|
+
.filter(Boolean)
|
|
79
|
+
.join(' ');
|
|
80
|
+
return html`<nav class=${classes} part="tabs">
|
|
81
|
+
<slot></slot>
|
|
82
|
+
</nav>`;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
declare global {
|
|
87
|
+
interface HTMLElementTagNameMap {
|
|
88
|
+
'moni-tabs': MoniTabs;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export default MoniTabs;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import './moni-text-field.js';
|
|
3
|
+
import type { MoniTextField } from './moni-text-field.js';
|
|
4
|
+
|
|
5
|
+
describe('moni-text-field', () => {
|
|
6
|
+
let el: MoniTextField;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
el = document.createElement('moni-text-field') as MoniTextField;
|
|
10
|
+
document.body.appendChild(el);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
afterEach(() => {
|
|
14
|
+
el.remove();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('renders a field wrapper and an input', async () => {
|
|
18
|
+
await el.updateComplete;
|
|
19
|
+
const field = el.shadowRoot?.querySelector('.field');
|
|
20
|
+
const input = el.shadowRoot?.querySelector('input');
|
|
21
|
+
expect(field).toBeTruthy();
|
|
22
|
+
expect(input).toBeTruthy();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('renders a leading icon when icon attribute is set', async () => {
|
|
26
|
+
el.icon = 'search';
|
|
27
|
+
await el.updateComplete;
|
|
28
|
+
const leading = el.shadowRoot?.querySelector('.leading-icon');
|
|
29
|
+
expect(leading).toBeTruthy();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('renders a trailing icon when trailing-icon attribute is set', async () => {
|
|
33
|
+
el.setAttribute('trailing-icon', 'close');
|
|
34
|
+
await el.updateComplete;
|
|
35
|
+
const trailing = el.shadowRoot?.querySelector('.trailing-icon');
|
|
36
|
+
expect(trailing).toBeTruthy();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('renders prefix text when prefix attribute is set', async () => {
|
|
40
|
+
el.prefix = 'https://';
|
|
41
|
+
await el.updateComplete;
|
|
42
|
+
const leading = el.shadowRoot?.querySelector('.leading-icon');
|
|
43
|
+
expect(leading?.textContent?.trim()).toBe('https://');
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('renders suffix text when suffix attribute is set', async () => {
|
|
47
|
+
el.suffix = '.com';
|
|
48
|
+
await el.updateComplete;
|
|
49
|
+
const trailing = el.shadowRoot?.querySelector('.trailing-icon');
|
|
50
|
+
expect(trailing?.textContent?.trim()).toBe('.com');
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('applies square class on the field wrapper for shape=no-round', async () => {
|
|
54
|
+
el.shape = 'no-round';
|
|
55
|
+
await el.updateComplete;
|
|
56
|
+
const field = el.shadowRoot?.querySelector('.field');
|
|
57
|
+
expect(field?.classList.contains('square')).toBe(true);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('applies round class on the field wrapper for shape=round', async () => {
|
|
61
|
+
el.shape = 'round';
|
|
62
|
+
await el.updateComplete;
|
|
63
|
+
const field = el.shadowRoot?.querySelector('.field');
|
|
64
|
+
expect(field?.classList.contains('round')).toBe(true);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('does not apply shape class on the field wrapper for shape=square', async () => {
|
|
68
|
+
el.shape = 'square';
|
|
69
|
+
await el.updateComplete;
|
|
70
|
+
const field = el.shadowRoot?.querySelector('.field');
|
|
71
|
+
expect(field?.classList.contains('square')).toBe(false);
|
|
72
|
+
expect(field?.classList.contains('round')).toBe(false);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('shows the loading spinner when loading is true', async () => {
|
|
76
|
+
el.loading = true;
|
|
77
|
+
await el.updateComplete;
|
|
78
|
+
const trailing = el.shadowRoot?.querySelector('.trailing-icon');
|
|
79
|
+
const progress = trailing?.querySelector('moni-progress');
|
|
80
|
+
expect(progress).toBeTruthy();
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('does not render a leading icon by default', async () => {
|
|
84
|
+
await el.updateComplete;
|
|
85
|
+
const leading = el.shadowRoot?.querySelector('.leading-icon');
|
|
86
|
+
expect(leading).toBeFalsy();
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('forwards value to the input', async () => {
|
|
90
|
+
el.value = 'hello world';
|
|
91
|
+
await el.updateComplete;
|
|
92
|
+
const input = el.shadowRoot?.querySelector(
|
|
93
|
+
'input'
|
|
94
|
+
) as HTMLInputElement;
|
|
95
|
+
expect(input.value).toBe('hello world');
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('adds active class to input when value is set', async () => {
|
|
99
|
+
el.value = 'something';
|
|
100
|
+
await el.updateComplete;
|
|
101
|
+
const input = el.shadowRoot?.querySelector('input');
|
|
102
|
+
expect(input?.classList.contains('active')).toBe(true);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('renders label and toggles active class based on value', async () => {
|
|
106
|
+
el.label = 'Email';
|
|
107
|
+
await el.updateComplete;
|
|
108
|
+
const label = el.shadowRoot?.querySelector('label');
|
|
109
|
+
expect(label?.textContent?.trim()).toBe('Email');
|
|
110
|
+
|
|
111
|
+
el.value = 'a@b.com';
|
|
112
|
+
await el.updateComplete;
|
|
113
|
+
expect(label?.classList.contains('active')).toBe(true);
|
|
114
|
+
});
|
|
115
|
+
});
|