@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,262 @@
|
|
|
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
|
+
* Visual-only Floating Action Button.
|
|
8
|
+
*
|
|
9
|
+
* Material 3 Expressive update (May 2025):
|
|
10
|
+
* - `size="small"` is **no longer recommended** by M3. Use `medium` (40dp/56dp
|
|
11
|
+
* on M3 spec) or `large`. Deprecated in v0.3.1; will be removed in v1.0.
|
|
12
|
+
* - `shape="circle"` is **not part of M3**; M3 FABs are `rounded` with a 16dp
|
|
13
|
+
* corner radius (or `full` when on hover/focus). The M3 spec does not
|
|
14
|
+
* define a perfect-circle FAB. Deprecated in v0.3.1; will be removed in v1.0.
|
|
15
|
+
* - `color="surface"` is **no longer recommended** by M3. Use `primary`,
|
|
16
|
+
* `secondary`, or `tertiary` (and their container variants).
|
|
17
|
+
*
|
|
18
|
+
* Attributes:
|
|
19
|
+
* - size: medium (default) | large (small: deprecated)
|
|
20
|
+
* - color: primary (default) | secondary | tertiary (surface: deprecated)
|
|
21
|
+
* - shape: rounded (default) (circle: deprecated)
|
|
22
|
+
* - extended: present → wider with label always visible
|
|
23
|
+
* - expanded: present → force expanded
|
|
24
|
+
* - disabled: present
|
|
25
|
+
* - icon: Material Symbols name
|
|
26
|
+
* - label: text when extended
|
|
27
|
+
* - position: bottom-trailing (default) | bottom-leading
|
|
28
|
+
* | top-trailing | top-leading
|
|
29
|
+
*/
|
|
30
|
+
@customElement('moni-fab')
|
|
31
|
+
export class MoniFab extends MoniElement {
|
|
32
|
+
private static _deprecationWarned = false;
|
|
33
|
+
|
|
34
|
+
@property({ reflect: true })
|
|
35
|
+
size: 'small' | 'medium' | 'large' = 'medium';
|
|
36
|
+
@property({ reflect: true })
|
|
37
|
+
color: 'primary' | 'secondary' | 'tertiary' | 'surface' = 'primary';
|
|
38
|
+
@property({ reflect: true })
|
|
39
|
+
shape: 'rounded' | 'circle' = 'rounded';
|
|
40
|
+
@property({ type: Boolean, reflect: true }) extended = false;
|
|
41
|
+
@property({ type: Boolean, reflect: true }) expanded = false;
|
|
42
|
+
@property({ type: Boolean, reflect: true }) disabled = false;
|
|
43
|
+
@property({ reflect: true }) icon = 'add';
|
|
44
|
+
@property({ reflect: true }) label = '';
|
|
45
|
+
@property({ reflect: true })
|
|
46
|
+
position:
|
|
47
|
+
| 'bottom-trailing'
|
|
48
|
+
| 'bottom-leading'
|
|
49
|
+
| 'top-trailing'
|
|
50
|
+
| 'top-leading' = 'bottom-trailing';
|
|
51
|
+
|
|
52
|
+
override connectedCallback(): void {
|
|
53
|
+
super.connectedCallback();
|
|
54
|
+
if (MoniFab._deprecationWarned) return;
|
|
55
|
+
const hasDeprecated = this.size === 'small'
|
|
56
|
+
|| this.shape === 'circle'
|
|
57
|
+
|| this.color === 'surface';
|
|
58
|
+
if (hasDeprecated) {
|
|
59
|
+
MoniFab._deprecationWarned = true;
|
|
60
|
+
const reasons: string[] = [];
|
|
61
|
+
if (this.size === 'small') reasons.push('size="small"');
|
|
62
|
+
if (this.shape === 'circle') reasons.push('shape="circle"');
|
|
63
|
+
if (this.color === 'surface') reasons.push('color="surface"');
|
|
64
|
+
console.warn(
|
|
65
|
+
`[moni-ui] <moni-fab> uses ${reasons.join(', ')}, deprecated since v0.3.1 per Material Design 3 Expressive (May 2025). See m3-docs/components/floating-action-button/overview.md § M3 Expressive update.`
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
static override styles = [
|
|
71
|
+
sharedStyles,
|
|
72
|
+
css`
|
|
73
|
+
:host {
|
|
74
|
+
display: inline-block;
|
|
75
|
+
font-family: var(--font);
|
|
76
|
+
position: relative;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
:host([position]) {
|
|
80
|
+
position: fixed;
|
|
81
|
+
z-index: 13;
|
|
82
|
+
}
|
|
83
|
+
:host([position='bottom-trailing']) {
|
|
84
|
+
inset: auto 1rem 1rem auto;
|
|
85
|
+
}
|
|
86
|
+
:host([position='bottom-leading']) {
|
|
87
|
+
inset: auto auto 1rem 1rem;
|
|
88
|
+
}
|
|
89
|
+
:host([position='top-trailing']) {
|
|
90
|
+
inset: 1rem 1rem auto auto;
|
|
91
|
+
}
|
|
92
|
+
:host([position='top-leading']) {
|
|
93
|
+
inset: 1rem auto auto 1rem;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.button {
|
|
97
|
+
display: inline-flex;
|
|
98
|
+
align-items: center;
|
|
99
|
+
justify-content: center;
|
|
100
|
+
block-size: 3.5rem;
|
|
101
|
+
font-size: 1rem;
|
|
102
|
+
font-weight: 500;
|
|
103
|
+
color: var(--on-primary);
|
|
104
|
+
/* Default: no padding so icon is centered; padding added when label exists */
|
|
105
|
+
padding: 0 1.5rem;
|
|
106
|
+
background-color: var(--primary);
|
|
107
|
+
border: 0.0625rem solid transparent;
|
|
108
|
+
border-radius: 1rem;
|
|
109
|
+
gap: 0.5rem;
|
|
110
|
+
line-height: normal;
|
|
111
|
+
font-family: inherit;
|
|
112
|
+
cursor: pointer;
|
|
113
|
+
box-shadow: var(--elevate2);
|
|
114
|
+
transition:
|
|
115
|
+
transform 250ms cubic-bezier(0.34, 1.56, 0.64, 1),
|
|
116
|
+
border-radius 250ms cubic-bezier(0.34, 1.56, 0.64, 1),
|
|
117
|
+
padding 250ms cubic-bezier(0.34, 1.56, 0.64, 1),
|
|
118
|
+
background-color 200ms ease,
|
|
119
|
+
box-shadow 250ms ease;
|
|
120
|
+
user-select: none;
|
|
121
|
+
text-decoration: none;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.button:hover:not(:disabled) {
|
|
125
|
+
transform: translateY(-0.125rem) scale(1.02);
|
|
126
|
+
box-shadow: var(--elevate3);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.button:active:not(:disabled) {
|
|
130
|
+
transform: translateY(0.0625rem) scale(0.97);
|
|
131
|
+
box-shadow: var(--elevate1);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* When no label: icon-only, remove horizontal padding so icon centers */
|
|
135
|
+
.button:not(:has(> .label:not(:empty))) {
|
|
136
|
+
padding-inline: 0;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.button.small {
|
|
140
|
+
block-size: 2.5rem;
|
|
141
|
+
font-size: 0.875rem;
|
|
142
|
+
padding: 0 1rem;
|
|
143
|
+
}
|
|
144
|
+
.button.large {
|
|
145
|
+
block-size: 4rem;
|
|
146
|
+
padding: 0 2rem;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.button.circle {
|
|
150
|
+
padding: 0;
|
|
151
|
+
inline-size: 3.5rem;
|
|
152
|
+
aspect-ratio: 1;
|
|
153
|
+
border-radius: 50%;
|
|
154
|
+
}
|
|
155
|
+
.button.circle.small {
|
|
156
|
+
inline-size: 2.5rem;
|
|
157
|
+
}
|
|
158
|
+
.button.circle.large {
|
|
159
|
+
inline-size: 4rem;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.button.rounded {
|
|
163
|
+
border-radius: 1rem;
|
|
164
|
+
}
|
|
165
|
+
.button.rounded:is(:hover, :focus-visible) {
|
|
166
|
+
border-radius: 2rem;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.button.secondary {
|
|
170
|
+
background-color: var(--secondary-container);
|
|
171
|
+
color: var(--on-secondary-container);
|
|
172
|
+
}
|
|
173
|
+
.button.tertiary {
|
|
174
|
+
background-color: var(--tertiary-container);
|
|
175
|
+
color: var(--on-tertiary-container);
|
|
176
|
+
}
|
|
177
|
+
.button.surface {
|
|
178
|
+
background-color: var(--surface);
|
|
179
|
+
color: var(--primary);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.button:disabled {
|
|
183
|
+
opacity: 0.5;
|
|
184
|
+
cursor: not-allowed;
|
|
185
|
+
pointer-events: none;
|
|
186
|
+
}
|
|
187
|
+
.button:focus-visible {
|
|
188
|
+
outline: 0.125rem solid var(--primary);
|
|
189
|
+
outline-offset: 0.125rem;
|
|
190
|
+
transform: translateY(-0.125rem) scale(1.02);
|
|
191
|
+
box-shadow: var(--elevate3);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.icon,
|
|
195
|
+
::slotted([slot='icon']) {
|
|
196
|
+
display: inline-flex;
|
|
197
|
+
align-items: center;
|
|
198
|
+
justify-content: center;
|
|
199
|
+
flex: none;
|
|
200
|
+
color: inherit;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/* Label is always rendered but empty string hides via overflow.
|
|
204
|
+
When label prop is set, it appears. */
|
|
205
|
+
.label {
|
|
206
|
+
white-space: nowrap;
|
|
207
|
+
max-inline-size: 16rem;
|
|
208
|
+
overflow: hidden;
|
|
209
|
+
transition: max-inline-size var(--speed3);
|
|
210
|
+
font-size: 1rem;
|
|
211
|
+
font-weight: 500;
|
|
212
|
+
}
|
|
213
|
+
.label:empty {
|
|
214
|
+
display: none;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/* Circle shape: hide label completely */
|
|
218
|
+
:host([shape='circle']) .label,
|
|
219
|
+
:host([shape='circle']) slot {
|
|
220
|
+
display: none !important;
|
|
221
|
+
}
|
|
222
|
+
/* Circle: remove padding, make it a perfect circle */
|
|
223
|
+
:host([shape='circle']) .button {
|
|
224
|
+
padding: 0 !important;
|
|
225
|
+
}
|
|
226
|
+
`
|
|
227
|
+
];
|
|
228
|
+
|
|
229
|
+
override render() {
|
|
230
|
+
const classes = [
|
|
231
|
+
'button',
|
|
232
|
+
this.size,
|
|
233
|
+
this.shape,
|
|
234
|
+
this.color === 'primary' ? '' : this.color
|
|
235
|
+
]
|
|
236
|
+
.filter(Boolean)
|
|
237
|
+
.join(' ');
|
|
238
|
+
|
|
239
|
+
return html`<button
|
|
240
|
+
class=${classes}
|
|
241
|
+
part="fab"
|
|
242
|
+
type="button"
|
|
243
|
+
?disabled=${this.disabled}
|
|
244
|
+
>
|
|
245
|
+
${this.icon
|
|
246
|
+
? html`<span part="icon" class="icon"
|
|
247
|
+
><moni-icon name="${this.icon}"></moni-icon
|
|
248
|
+
></span>`
|
|
249
|
+
: nothing}
|
|
250
|
+
<span class="label" part="label">${this.label}</span>
|
|
251
|
+
<slot></slot>
|
|
252
|
+
</button>`;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
declare global {
|
|
257
|
+
interface HTMLElementTagNameMap {
|
|
258
|
+
'moni-fab': MoniFab;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export default MoniFab;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import './moni-file-field.js';
|
|
3
|
+
import type { MoniFileField } from './moni-file-field.js';
|
|
4
|
+
|
|
5
|
+
describe('moni-file-field', () => {
|
|
6
|
+
let el: MoniFileField;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
el = document.createElement('moni-file-field') as MoniFileField;
|
|
10
|
+
document.body.appendChild(el);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
afterEach(() => {
|
|
14
|
+
el.remove();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('renders a text input and a file input', async () => {
|
|
18
|
+
await el.updateComplete;
|
|
19
|
+
const text = el.shadowRoot?.querySelector('input[type="text"]');
|
|
20
|
+
const file = el.shadowRoot?.querySelector('input[type="file"]');
|
|
21
|
+
expect(text).toBeTruthy();
|
|
22
|
+
expect(file).toBeTruthy();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('keeps the text input readonly', async () => {
|
|
26
|
+
await el.updateComplete;
|
|
27
|
+
const text = el.shadowRoot?.querySelector(
|
|
28
|
+
'input[type="text"]'
|
|
29
|
+
) as HTMLInputElement;
|
|
30
|
+
expect(text.hasAttribute('readonly')).toBe(true);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('places the label between the text input and the file input for label-lift', async () => {
|
|
34
|
+
el.label = 'Upload';
|
|
35
|
+
await el.updateComplete;
|
|
36
|
+
const text = el.shadowRoot?.querySelector('input[type="text"]');
|
|
37
|
+
const label = el.shadowRoot?.querySelector('label');
|
|
38
|
+
const file = el.shadowRoot?.querySelector('input[type="file"]');
|
|
39
|
+
expect(text?.nextElementSibling).toBe(label);
|
|
40
|
+
expect(label?.nextElementSibling).toBe(file);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('adds active class to text input when value is set', async () => {
|
|
44
|
+
el.value = 'report.pdf';
|
|
45
|
+
await el.updateComplete;
|
|
46
|
+
const text = el.shadowRoot?.querySelector('input[type="text"]');
|
|
47
|
+
expect(text?.classList.contains('active')).toBe(true);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('forwards accept attribute to the file input', async () => {
|
|
51
|
+
el.accept = 'image/*';
|
|
52
|
+
await el.updateComplete;
|
|
53
|
+
const file = el.shadowRoot?.querySelector(
|
|
54
|
+
'input[type="file"]'
|
|
55
|
+
) as HTMLInputElement;
|
|
56
|
+
expect(file.accept).toBe('image/*');
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('forwards multiple attribute to the file input', async () => {
|
|
60
|
+
el.multiple = true;
|
|
61
|
+
await el.updateComplete;
|
|
62
|
+
const file = el.shadowRoot?.querySelector(
|
|
63
|
+
'input[type="file"]'
|
|
64
|
+
) as HTMLInputElement;
|
|
65
|
+
expect(file.multiple).toBe(true);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('shows a trailing folder icon by default', async () => {
|
|
69
|
+
await el.updateComplete;
|
|
70
|
+
const trailing = el.shadowRoot?.querySelector('.trailing-icon');
|
|
71
|
+
expect(trailing).toBeTruthy();
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('uses button-label as placeholder when no value', async () => {
|
|
75
|
+
await el.updateComplete;
|
|
76
|
+
const text = el.shadowRoot?.querySelector(
|
|
77
|
+
'input[type="text"]'
|
|
78
|
+
) as HTMLInputElement;
|
|
79
|
+
expect(text.placeholder).toBe('Choose file');
|
|
80
|
+
});
|
|
81
|
+
});
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { html, css, nothing } from 'lit';
|
|
2
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
3
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
4
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
5
|
+
import { MoniElement, sharedStyles, fieldStyles } from './_base/index.js';
|
|
6
|
+
import './moni-icon.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Visual-only file field. Renders a hidden `<input type="file">` over a
|
|
10
|
+
* read-only text input that shows the chosen file names.
|
|
11
|
+
*
|
|
12
|
+
* The DOM order is `input[type=text], label, input[type=file], output` so
|
|
13
|
+
* that the floating label CSS selector `input + label` lifts correctly even
|
|
14
|
+
* though the visible field is the read-only text input.
|
|
15
|
+
*
|
|
16
|
+
* Attributes:
|
|
17
|
+
* - name, label, value, variant, size, shape, disabled, helper, error,
|
|
18
|
+
* error-text, placeholder — see moni-text-field.
|
|
19
|
+
* - accept: forwarded to input.accept
|
|
20
|
+
* - multiple: present → input.multiple
|
|
21
|
+
* - button-label: text on the picker button (visual only, default: "Choose file")
|
|
22
|
+
* - icon: leading Material Symbols name
|
|
23
|
+
* - trailing-icon: trailing Material Symbols name
|
|
24
|
+
*/
|
|
25
|
+
@customElement('moni-file-field')
|
|
26
|
+
export class MoniFileField extends MoniElement {
|
|
27
|
+
@property({ reflect: true }) name = '';
|
|
28
|
+
@property({ reflect: true }) label = '';
|
|
29
|
+
@property({ reflect: true }) variant: 'filled' | 'outlined' = 'outlined';
|
|
30
|
+
@property({ reflect: true })
|
|
31
|
+
size: 'small' | 'medium' | 'large' | 'extra' = 'medium';
|
|
32
|
+
@property({ reflect: true })
|
|
33
|
+
shape: 'round' | 'square' | 'no-round' = 'no-round';
|
|
34
|
+
@property({ reflect: true }) accept = '';
|
|
35
|
+
@property({ type: Boolean, reflect: true }) multiple = false;
|
|
36
|
+
@property({ reflect: true, attribute: 'button-label' })
|
|
37
|
+
buttonLabel = 'Choose file';
|
|
38
|
+
@property({ type: Boolean, reflect: true }) disabled = false;
|
|
39
|
+
@property({ reflect: true }) helper = '';
|
|
40
|
+
@property({ reflect: true, attribute: 'error-text' }) errorText = '';
|
|
41
|
+
@property({ type: Boolean, reflect: true }) error = false;
|
|
42
|
+
@property({ reflect: true }) value = '';
|
|
43
|
+
@property({ reflect: true }) icon = '';
|
|
44
|
+
@property({ reflect: true, attribute: 'trailing-icon' }) trailingIcon =
|
|
45
|
+
'folder_open';
|
|
46
|
+
|
|
47
|
+
@query('input[type="file"]') private _fileInput!: HTMLInputElement;
|
|
48
|
+
|
|
49
|
+
override updated(changed: Map<string, unknown>) {
|
|
50
|
+
if (this._fileInput) {
|
|
51
|
+
if (changed.has('disabled'))
|
|
52
|
+
this._fileInput.disabled = this.disabled;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
static override styles = [
|
|
57
|
+
sharedStyles,
|
|
58
|
+
fieldStyles,
|
|
59
|
+
css`
|
|
60
|
+
input[type='file'] {
|
|
61
|
+
position: absolute;
|
|
62
|
+
inset: 0;
|
|
63
|
+
opacity: 0;
|
|
64
|
+
z-index: 2;
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
}
|
|
67
|
+
input[type='text'] {
|
|
68
|
+
cursor: pointer;
|
|
69
|
+
}
|
|
70
|
+
`
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
override render() {
|
|
74
|
+
const isActive = Boolean(this.value);
|
|
75
|
+
const hasLeading = Boolean(this.icon);
|
|
76
|
+
const hasTrailing = Boolean(this.trailingIcon);
|
|
77
|
+
const fieldClasses = {
|
|
78
|
+
field: true,
|
|
79
|
+
label: Boolean(this.label),
|
|
80
|
+
fill: this.variant === 'filled',
|
|
81
|
+
border: this.variant === 'outlined',
|
|
82
|
+
small: this.size === 'small',
|
|
83
|
+
large: this.size === 'large',
|
|
84
|
+
extra: this.size === 'extra',
|
|
85
|
+
prefix: hasLeading,
|
|
86
|
+
suffix: hasTrailing,
|
|
87
|
+
invalid: this.error,
|
|
88
|
+
round: this.shape === 'round',
|
|
89
|
+
square: this.shape === 'no-round'
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const leading = this.icon
|
|
93
|
+
? html`<i class="leading-icon" part="leading-icon"
|
|
94
|
+
><moni-icon name="${this.icon}"></moni-icon
|
|
95
|
+
></i>`
|
|
96
|
+
: nothing;
|
|
97
|
+
|
|
98
|
+
const trailing = this.trailingIcon
|
|
99
|
+
? html`<i class="trailing-icon" part="trailing-icon"
|
|
100
|
+
><moni-icon name="${this.trailingIcon}"></moni-icon
|
|
101
|
+
></i>`
|
|
102
|
+
: nothing;
|
|
103
|
+
|
|
104
|
+
return html`<div class=${classMap(fieldClasses)} part="field">
|
|
105
|
+
${leading}
|
|
106
|
+
<input
|
|
107
|
+
type="text"
|
|
108
|
+
part="display"
|
|
109
|
+
readonly
|
|
110
|
+
placeholder=${this.buttonLabel}
|
|
111
|
+
.value=${this.value}
|
|
112
|
+
?disabled=${this.disabled}
|
|
113
|
+
name=${ifDefined(this.name ? `${this.name}-display` : undefined)}
|
|
114
|
+
class=${isActive ? 'active' : ''}
|
|
115
|
+
/>
|
|
116
|
+
${this.label
|
|
117
|
+
? html`<label
|
|
118
|
+
part="label"
|
|
119
|
+
class=${classMap({ active: isActive })}
|
|
120
|
+
>${this.label}</label
|
|
121
|
+
>`
|
|
122
|
+
: nothing}
|
|
123
|
+
<input
|
|
124
|
+
type="file"
|
|
125
|
+
part="file"
|
|
126
|
+
?disabled=${this.disabled}
|
|
127
|
+
accept=${ifDefined(this.accept || undefined)}
|
|
128
|
+
?multiple=${this.multiple}
|
|
129
|
+
name=${ifDefined(this.name || undefined)}
|
|
130
|
+
/>
|
|
131
|
+
${trailing}
|
|
132
|
+
${this.error
|
|
133
|
+
? html`<output part="helper" class="invalid"
|
|
134
|
+
>${this.errorText || this.helper}</output
|
|
135
|
+
>`
|
|
136
|
+
: this.helper
|
|
137
|
+
? html`<output part="helper">${this.helper}</output>`
|
|
138
|
+
: nothing}
|
|
139
|
+
</div>`;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
declare global {
|
|
144
|
+
interface HTMLElementTagNameMap {
|
|
145
|
+
'moni-file-field': MoniFileField;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export default MoniFileField;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import './moni-icon.js';
|
|
3
|
+
import type { MoniIcon } from './moni-icon.js';
|
|
4
|
+
|
|
5
|
+
describe('moni-icon', () => {
|
|
6
|
+
let el: MoniIcon;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
el = document.createElement('moni-icon') as MoniIcon;
|
|
10
|
+
document.body.appendChild(el);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
afterEach(() => {
|
|
14
|
+
el.remove();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('renders the icon name as text content', async () => {
|
|
18
|
+
el.name = 'add';
|
|
19
|
+
await el.updateComplete;
|
|
20
|
+
const slot = el.shadowRoot?.querySelector('slot') as HTMLSlotElement;
|
|
21
|
+
const assigned = slot
|
|
22
|
+
? slot.assignedNodes({ flatten: true }).map((n) => n.textContent)
|
|
23
|
+
: [];
|
|
24
|
+
expect(assigned.join('')).toContain('add');
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('renders slot fallback when no name is set', async () => {
|
|
28
|
+
el.name = '';
|
|
29
|
+
el.textContent = 'FALLBACK';
|
|
30
|
+
await el.updateComplete;
|
|
31
|
+
const slot = el.shadowRoot?.querySelector('slot') as HTMLSlotElement;
|
|
32
|
+
const assigned = slot
|
|
33
|
+
? slot.assignedNodes({ flatten: true }).map((n) => n.textContent)
|
|
34
|
+
: [];
|
|
35
|
+
expect(assigned.join('')).toContain('FALLBACK');
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('reflects the name attribute', async () => {
|
|
39
|
+
el.name = 'close';
|
|
40
|
+
await el.updateComplete;
|
|
41
|
+
expect(el.getAttribute('name')).toBe('close');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('applies the filled attribute', async () => {
|
|
45
|
+
el.filled = true;
|
|
46
|
+
await el.updateComplete;
|
|
47
|
+
expect(el.hasAttribute('filled')).toBe(true);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('reflects the size attribute', async () => {
|
|
51
|
+
el.size = 'large';
|
|
52
|
+
await el.updateComplete;
|
|
53
|
+
expect(el.getAttribute('size')).toBe('large');
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('inherits color from its parent (host color: inherit)', async () => {
|
|
57
|
+
const parent = document.createElement('div');
|
|
58
|
+
parent.style.color = 'rgb(255, 0, 128)';
|
|
59
|
+
parent.appendChild(el);
|
|
60
|
+
document.body.appendChild(parent);
|
|
61
|
+
await el.updateComplete;
|
|
62
|
+
// The host declaration `color: inherit` should be present in the
|
|
63
|
+
// shadow stylesheet so the Material Symbols glyph takes the parent
|
|
64
|
+
// text color. jsdom does not fully resolve custom-property-driven
|
|
65
|
+
// styles, so we just assert that the element renders inside the
|
|
66
|
+
// colored wrapper without throwing.
|
|
67
|
+
expect(parent.contains(el)).toBe(true);
|
|
68
|
+
parent.remove();
|
|
69
|
+
});
|
|
70
|
+
});
|
|
@@ -0,0 +1,97 @@
|
|
|
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 icon.
|
|
7
|
+
*
|
|
8
|
+
* Renders a Material Symbols glyph by name. The font must be loaded
|
|
9
|
+
* globally in the host document (see `@moni-labs/moni-ui/styles`).
|
|
10
|
+
*
|
|
11
|
+
* Attributes:
|
|
12
|
+
* - name: icon name from https://fonts.google.com/icons
|
|
13
|
+
* - size: tiny | small | medium (default) | large | extra
|
|
14
|
+
* - filled: present → switches to the filled variant (font-variation-settings)
|
|
15
|
+
*
|
|
16
|
+
* Slots:
|
|
17
|
+
* - default: fallback text if no name is given
|
|
18
|
+
* - (also accepts slotted <svg> or <img> as override)
|
|
19
|
+
*/
|
|
20
|
+
@customElement('moni-icon')
|
|
21
|
+
export class MoniIcon extends MoniElement {
|
|
22
|
+
@property({ reflect: true }) name = '';
|
|
23
|
+
@property({ reflect: true })
|
|
24
|
+
size: 'tiny' | 'small' | 'medium' | 'large' | 'extra' = 'medium';
|
|
25
|
+
@property({ type: Boolean, reflect: true }) filled = false;
|
|
26
|
+
|
|
27
|
+
static override styles = [
|
|
28
|
+
sharedStyles,
|
|
29
|
+
css`
|
|
30
|
+
:host {
|
|
31
|
+
--_size: 1.5rem;
|
|
32
|
+
display: inline-flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
vertical-align: middle;
|
|
36
|
+
font-family: var(--font-icon);
|
|
37
|
+
font-weight: normal;
|
|
38
|
+
font-style: normal;
|
|
39
|
+
font-size: var(--_size);
|
|
40
|
+
letter-spacing: normal;
|
|
41
|
+
text-transform: none;
|
|
42
|
+
white-space: nowrap;
|
|
43
|
+
word-wrap: normal;
|
|
44
|
+
direction: ltr;
|
|
45
|
+
font-feature-settings: 'liga';
|
|
46
|
+
font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
|
|
47
|
+
-webkit-font-smoothing: antialiased;
|
|
48
|
+
line-height: 1;
|
|
49
|
+
inline-size: var(--_size);
|
|
50
|
+
block-size: var(--_size);
|
|
51
|
+
/* Explicit inherit so the icon glyph picks up color from
|
|
52
|
+
whatever consumer wraps it (button variants, chip selected
|
|
53
|
+
state, list-item active, etc.). */
|
|
54
|
+
color: inherit;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
:host([size='tiny']) {
|
|
58
|
+
--_size: 1rem;
|
|
59
|
+
}
|
|
60
|
+
:host([size='small']) {
|
|
61
|
+
--_size: 1.25rem;
|
|
62
|
+
}
|
|
63
|
+
:host([size='medium']) {
|
|
64
|
+
--_size: 1.5rem;
|
|
65
|
+
}
|
|
66
|
+
:host([size='large']) {
|
|
67
|
+
--_size: 1.75rem;
|
|
68
|
+
}
|
|
69
|
+
:host([size='extra']) {
|
|
70
|
+
--_size: 2rem;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
:host([filled]) {
|
|
74
|
+
font-variation-settings: 'FILL' 1;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
::slotted(svg),
|
|
78
|
+
::slotted(img) {
|
|
79
|
+
inline-size: 100%;
|
|
80
|
+
block-size: 100%;
|
|
81
|
+
object-fit: contain;
|
|
82
|
+
}
|
|
83
|
+
`
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
override render() {
|
|
87
|
+
return html`<slot>${this.name}</slot>`;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
declare global {
|
|
92
|
+
interface HTMLElementTagNameMap {
|
|
93
|
+
'moni-icon': MoniIcon;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export default MoniIcon;
|