@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,335 @@
|
|
|
1
|
+
import { html, css, nothing } from 'lit';
|
|
2
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
3
|
+
import { MoniElement, sharedStyles } from './_base/index.js';
|
|
4
|
+
import './moni-icon.js';
|
|
5
|
+
import './moni-progress.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Visual-only chip. Renders a native `<button>` styled per Material 3 Expressive.
|
|
9
|
+
*
|
|
10
|
+
* M3 spec (`m3-docs/components/chips/specs.md`) defines **4 variants**:
|
|
11
|
+
* - **assist** — smart/automated actions; outlined; `outline` 1dp stroke.
|
|
12
|
+
* - **filter** — filters for a collection; outlined; leading check when selected.
|
|
13
|
+
* - **input** — discrete user input; outlined; trailing remove icon.
|
|
14
|
+
* - **suggestion** — product-generated suggestions; outlined; no icons.
|
|
15
|
+
*
|
|
16
|
+
* All variants share M3 measurements: 32dp height, 8dp corner, 18dp icon.
|
|
17
|
+
* Container height scales with `size` (`small` = 32dp = M3 default,
|
|
18
|
+
* `medium`/`large` are Moni extensions with larger touch targets).
|
|
19
|
+
*
|
|
20
|
+
* **A11y** — `assist` and `suggestion` use `var(--outline)` for the
|
|
21
|
+
* stroke to ensure 3:1 contrast (per `m3-docs/components/chips/accessibility.md`
|
|
22
|
+
* § *Showing chip interactivity*). `filter` and `input` use `outline-variant`
|
|
23
|
+
* for the resting state but show a clear `secondary-container` background
|
|
24
|
+
* when selected, passing contrast.
|
|
25
|
+
*
|
|
26
|
+
* Attributes:
|
|
27
|
+
* - variant: assist (default) | filter | input | suggestion
|
|
28
|
+
* | outlined (alias for assist) | fill (alias for filter)
|
|
29
|
+
* - size: small (default, 32dp = M3) | medium | large
|
|
30
|
+
* - shape: round (default) | square | circle | no-round
|
|
31
|
+
* | left-round | right-round | top-round | bottom-round
|
|
32
|
+
* - selected: present → background uses secondary-container (M3 filter/input)
|
|
33
|
+
* - removable: present → adds a trailing ✕ icon (M3 input chip, visual only)
|
|
34
|
+
* - disabled: present → native disabled
|
|
35
|
+
* - loading: present → shows indeterminate circular progress
|
|
36
|
+
* - icon: Material Symbols name (leading icon)
|
|
37
|
+
*/
|
|
38
|
+
@customElement('moni-chip')
|
|
39
|
+
export class MoniChip extends MoniElement {
|
|
40
|
+
@property({ reflect: true })
|
|
41
|
+
variant:
|
|
42
|
+
| 'assist'
|
|
43
|
+
| 'filter'
|
|
44
|
+
| 'input'
|
|
45
|
+
| 'suggestion'
|
|
46
|
+
| 'outlined'
|
|
47
|
+
| 'fill' = 'assist';
|
|
48
|
+
@property({ reflect: true })
|
|
49
|
+
size: 'small' | 'medium' | 'large' = 'small';
|
|
50
|
+
@property({ reflect: true })
|
|
51
|
+
shape:
|
|
52
|
+
| 'round'
|
|
53
|
+
| 'no-round'
|
|
54
|
+
| 'square'
|
|
55
|
+
| 'circle'
|
|
56
|
+
| 'left-round'
|
|
57
|
+
| 'right-round'
|
|
58
|
+
| 'top-round'
|
|
59
|
+
| 'bottom-round' = 'round';
|
|
60
|
+
@property({ type: Boolean, reflect: true }) selected = false;
|
|
61
|
+
@property({ type: Boolean, reflect: true }) removable = false;
|
|
62
|
+
@property({ type: Boolean, reflect: true }) disabled = false;
|
|
63
|
+
@property({ type: Boolean, reflect: true }) loading = false;
|
|
64
|
+
@property({ reflect: true }) icon = '';
|
|
65
|
+
|
|
66
|
+
@state()
|
|
67
|
+
private _hasSlottedIcon = false;
|
|
68
|
+
|
|
69
|
+
private _handleSlotChange(e: Event) {
|
|
70
|
+
const slot = e.target as HTMLSlotElement;
|
|
71
|
+
this._hasSlottedIcon = slot.assignedNodes({ flatten: true }).length > 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Normalize legacy variant names to M3 spec. */
|
|
75
|
+
private get _variant(): 'assist' | 'filter' | 'input' | 'suggestion' {
|
|
76
|
+
if (this.variant === 'outlined') return 'assist';
|
|
77
|
+
if (this.variant === 'fill') return 'filter';
|
|
78
|
+
return this.variant as 'assist' | 'filter' | 'input' | 'suggestion';
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
static override styles = [
|
|
82
|
+
sharedStyles,
|
|
83
|
+
css`
|
|
84
|
+
:host {
|
|
85
|
+
display: inline-flex;
|
|
86
|
+
vertical-align: middle;
|
|
87
|
+
font-family: var(--font);
|
|
88
|
+
position: relative;
|
|
89
|
+
user-select: none;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.chip {
|
|
93
|
+
--_padding: 1rem; /* 16dp when no leading icon (M3 spec) */
|
|
94
|
+
--_size: 2rem;
|
|
95
|
+
--_round: calc(var(--_size) / 2);
|
|
96
|
+
--_icon-size: 1.125rem;
|
|
97
|
+
box-sizing: border-box;
|
|
98
|
+
display: inline-flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
justify-content: center;
|
|
101
|
+
block-size: var(--_size);
|
|
102
|
+
min-inline-size: var(--_size);
|
|
103
|
+
font-size: 0.875rem;
|
|
104
|
+
font-weight: 500;
|
|
105
|
+
background-color: transparent;
|
|
106
|
+
border: 0.0625rem solid var(--outline);
|
|
107
|
+
color: var(--on-surface);
|
|
108
|
+
padding: 0 var(--_padding);
|
|
109
|
+
border-radius: 0.5rem;
|
|
110
|
+
transition:
|
|
111
|
+
transform var(--speed2),
|
|
112
|
+
background-color var(--speed2),
|
|
113
|
+
border-color var(--speed2),
|
|
114
|
+
border-radius var(--speed2),
|
|
115
|
+
padding var(--speed3);
|
|
116
|
+
user-select: none;
|
|
117
|
+
gap: 0.5rem;
|
|
118
|
+
line-height: normal;
|
|
119
|
+
letter-spacing: normal;
|
|
120
|
+
font-family: inherit;
|
|
121
|
+
cursor: pointer;
|
|
122
|
+
position: relative;
|
|
123
|
+
overflow: hidden;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.chip::after {
|
|
127
|
+
content: '';
|
|
128
|
+
position: absolute;
|
|
129
|
+
inset: 0;
|
|
130
|
+
background: currentColor;
|
|
131
|
+
opacity: 0;
|
|
132
|
+
transition: opacity var(--speed2);
|
|
133
|
+
border-radius: inherit;
|
|
134
|
+
pointer-events: none;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.chip.has-icon {
|
|
138
|
+
--_padding: 0.5rem; /* 8dp when a leading icon is present (M3 spec) */
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.chip.medium {
|
|
142
|
+
--_size: 2.5rem;
|
|
143
|
+
--_padding: 0.75rem;
|
|
144
|
+
--_icon-size: 1.25rem;
|
|
145
|
+
}
|
|
146
|
+
.chip.medium.has-icon {
|
|
147
|
+
--_padding: 0.75rem;
|
|
148
|
+
}
|
|
149
|
+
.chip.large {
|
|
150
|
+
--_padding: 1rem;
|
|
151
|
+
--_size: 3rem;
|
|
152
|
+
--_icon-size: 1.5rem;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.chip:hover:not(:disabled)::after {
|
|
156
|
+
opacity: 0.08;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.chip:active:not(:disabled) {
|
|
160
|
+
transform: scale(0.97);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/* ─── M3 variant colors ─── */
|
|
164
|
+
/* Filter and input chips use outline-variant + on-surface-variant
|
|
165
|
+
for the resting state (M3 spec). Assist and suggestion use
|
|
166
|
+
outline + on-surface for 3:1 contrast (a11y). */
|
|
167
|
+
.chip.filter,
|
|
168
|
+
.chip.input {
|
|
169
|
+
border-color: var(--outline-variant);
|
|
170
|
+
color: var(--on-surface-variant);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.chip.suggestion {
|
|
174
|
+
border-color: var(--outline);
|
|
175
|
+
color: var(--on-surface-variant);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/* Selected state — M3 filter/input show a leading check and
|
|
179
|
+
secondary-container background. */
|
|
180
|
+
.chip.selected {
|
|
181
|
+
background-color: var(--secondary-container);
|
|
182
|
+
color: var(--on-secondary-container);
|
|
183
|
+
border-color: transparent;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/* Filter without selection can have leading check on hover to
|
|
187
|
+
indicate the action. */
|
|
188
|
+
.chip.filter.selected::before,
|
|
189
|
+
.chip.input.selected::before {
|
|
190
|
+
content: '\\e5ca';
|
|
191
|
+
font-family: var(--font-icon);
|
|
192
|
+
font-size: var(--_icon-size);
|
|
193
|
+
font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
|
|
194
|
+
margin-inline-end: 0.25rem;
|
|
195
|
+
color: currentColor;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.chip.no-round {
|
|
199
|
+
border-radius: 0;
|
|
200
|
+
}
|
|
201
|
+
.chip.square {
|
|
202
|
+
border-radius: 0.25rem;
|
|
203
|
+
}
|
|
204
|
+
.chip.circle {
|
|
205
|
+
inline-size: var(--_size);
|
|
206
|
+
padding: 0;
|
|
207
|
+
aspect-ratio: 1;
|
|
208
|
+
border-radius: 50%;
|
|
209
|
+
}
|
|
210
|
+
.chip.left-round {
|
|
211
|
+
border-radius: var(--_round) 0 0 var(--_round) !important;
|
|
212
|
+
}
|
|
213
|
+
.chip.right-round {
|
|
214
|
+
border-radius: 0 var(--_round) var(--_round) 0 !important;
|
|
215
|
+
}
|
|
216
|
+
.chip.top-round {
|
|
217
|
+
border-radius: var(--_round) var(--_round) 0 0 !important;
|
|
218
|
+
}
|
|
219
|
+
.chip.bottom-round {
|
|
220
|
+
border-radius: 0 0 var(--_round) var(--_round) !important;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.chip:disabled {
|
|
224
|
+
opacity: 0.5;
|
|
225
|
+
cursor: not-allowed;
|
|
226
|
+
pointer-events: none;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.chip:focus-visible {
|
|
230
|
+
outline: 0.125rem solid var(--primary);
|
|
231
|
+
outline-offset: 0.125rem;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.icon,
|
|
235
|
+
::slotted([slot='icon']) {
|
|
236
|
+
display: inline-flex;
|
|
237
|
+
align-items: center;
|
|
238
|
+
justify-content: center;
|
|
239
|
+
font-size: var(--_icon-size);
|
|
240
|
+
flex: none;
|
|
241
|
+
color: inherit;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.remove {
|
|
245
|
+
display: inline-flex;
|
|
246
|
+
align-items: center;
|
|
247
|
+
justify-content: center;
|
|
248
|
+
font-size: var(--_icon-size);
|
|
249
|
+
opacity: 0.7;
|
|
250
|
+
margin-inline-start: 0.125rem;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.loading-spinner {
|
|
254
|
+
inline-size: var(--_icon-size);
|
|
255
|
+
block-size: var(--_icon-size);
|
|
256
|
+
color: currentColor;
|
|
257
|
+
}
|
|
258
|
+
.loading-spinner::part(progress) {
|
|
259
|
+
border-width: 0.1875rem;
|
|
260
|
+
}
|
|
261
|
+
`
|
|
262
|
+
];
|
|
263
|
+
|
|
264
|
+
override render() {
|
|
265
|
+
const variant = this._variant;
|
|
266
|
+
const hasIcon = Boolean(this.icon) || this._hasSlottedIcon;
|
|
267
|
+
const classes = [
|
|
268
|
+
'chip',
|
|
269
|
+
variant,
|
|
270
|
+
this.size,
|
|
271
|
+
this.shape,
|
|
272
|
+
this.selected ? 'selected' : '',
|
|
273
|
+
hasIcon ? 'has-icon' : ''
|
|
274
|
+
]
|
|
275
|
+
.filter(Boolean)
|
|
276
|
+
.join(' ');
|
|
277
|
+
|
|
278
|
+
if (this.loading) {
|
|
279
|
+
return html`<button
|
|
280
|
+
class=${classes}
|
|
281
|
+
part="chip"
|
|
282
|
+
type="button"
|
|
283
|
+
?disabled=${this.disabled}
|
|
284
|
+
aria-busy="true"
|
|
285
|
+
>
|
|
286
|
+
<moni-progress
|
|
287
|
+
class="loading-spinner"
|
|
288
|
+
part="loading"
|
|
289
|
+
variant="circular"
|
|
290
|
+
indeterminate
|
|
291
|
+
size="small"
|
|
292
|
+
></moni-progress>
|
|
293
|
+
</button>`;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// M3 input chips must always show a trailing remove icon.
|
|
297
|
+
const showRemove = this.removable || variant === 'input';
|
|
298
|
+
|
|
299
|
+
const iconEl = this.icon
|
|
300
|
+
? html`<span class="icon" part="icon"
|
|
301
|
+
><moni-icon name="${this.icon}"></moni-icon
|
|
302
|
+
></span>`
|
|
303
|
+
: html`<slot
|
|
304
|
+
name="icon"
|
|
305
|
+
part="icon"
|
|
306
|
+
class="icon"
|
|
307
|
+
@slotchange=${this._handleSlotChange}
|
|
308
|
+
></slot>`;
|
|
309
|
+
|
|
310
|
+
const removeEl = showRemove
|
|
311
|
+
? html`<span class="remove" part="remove" aria-hidden="true"
|
|
312
|
+
><moni-icon name="close"></moni-icon
|
|
313
|
+
></span>`
|
|
314
|
+
: nothing;
|
|
315
|
+
|
|
316
|
+
return html`<button
|
|
317
|
+
class=${classes}
|
|
318
|
+
part="chip"
|
|
319
|
+
type="button"
|
|
320
|
+
?disabled=${this.disabled}
|
|
321
|
+
>
|
|
322
|
+
${iconEl}
|
|
323
|
+
<span part="label"><slot></slot></span>
|
|
324
|
+
${removeEl}
|
|
325
|
+
</button>`;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
declare global {
|
|
330
|
+
interface HTMLElementTagNameMap {
|
|
331
|
+
'moni-chip': MoniChip;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
export default MoniChip;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import './moni-color-field.js';
|
|
3
|
+
import type { MoniColorField } from './moni-color-field.js';
|
|
4
|
+
|
|
5
|
+
describe('moni-color-field', () => {
|
|
6
|
+
let el: MoniColorField;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
el = document.createElement('moni-color-field') as MoniColorField;
|
|
10
|
+
document.body.appendChild(el);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
afterEach(() => {
|
|
14
|
+
el.remove();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('renders a swatch and a text input', async () => {
|
|
18
|
+
await el.updateComplete;
|
|
19
|
+
const swatch = el.shadowRoot?.querySelector('.swatch');
|
|
20
|
+
const text = el.shadowRoot?.querySelector('input[type="text"]');
|
|
21
|
+
expect(swatch).toBeTruthy();
|
|
22
|
+
expect(text).toBeTruthy();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('adds active class to the text input when value is set', async () => {
|
|
26
|
+
el.value = '#ff00aa';
|
|
27
|
+
await el.updateComplete;
|
|
28
|
+
const text = el.shadowRoot?.querySelector('input[type="text"]');
|
|
29
|
+
expect(text?.classList.contains('active')).toBe(true);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('forwards value to the text input', async () => {
|
|
33
|
+
el.value = '#123456';
|
|
34
|
+
await el.updateComplete;
|
|
35
|
+
const text = el.shadowRoot?.querySelector(
|
|
36
|
+
'input[type="text"]'
|
|
37
|
+
) as HTMLInputElement;
|
|
38
|
+
expect(text.value).toBe('#123456');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('keeps the text input readonly (so the label can be lifted via .active)', async () => {
|
|
42
|
+
await el.updateComplete;
|
|
43
|
+
const text = el.shadowRoot?.querySelector(
|
|
44
|
+
'input[type="text"]'
|
|
45
|
+
) as HTMLInputElement;
|
|
46
|
+
expect(text.hasAttribute('readonly')).toBe(true);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('renders label element adjacent to the text input for BeerCSS selector matching', async () => {
|
|
50
|
+
el.label = 'Pick a color';
|
|
51
|
+
await el.updateComplete;
|
|
52
|
+
const text = el.shadowRoot?.querySelector('input[type="text"]');
|
|
53
|
+
const label = el.shadowRoot?.querySelector('label');
|
|
54
|
+
expect(text?.nextElementSibling).toBe(label);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -0,0 +1,135 @@
|
|
|
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
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Visual-only color field. Renders a hidden `<input type="color">` plus a
|
|
9
|
+
* preview swatch and a read-only text display of the current value.
|
|
10
|
+
*
|
|
11
|
+
* Attributes:
|
|
12
|
+
* - name, label, value, variant, size, shape, disabled, helper, error,
|
|
13
|
+
* error-text, placeholder — see moni-text-field.
|
|
14
|
+
*/
|
|
15
|
+
@customElement('moni-color-field')
|
|
16
|
+
export class MoniColorField extends MoniElement {
|
|
17
|
+
@property({ reflect: true }) name = '';
|
|
18
|
+
@property({ reflect: true }) label = '';
|
|
19
|
+
@property({ reflect: true }) variant: 'filled' | 'outlined' = 'outlined';
|
|
20
|
+
@property({ reflect: true })
|
|
21
|
+
size: 'small' | 'medium' | 'large' | 'extra' = 'medium';
|
|
22
|
+
@property({ reflect: true })
|
|
23
|
+
shape: 'round' | 'square' | 'no-round' = 'no-round';
|
|
24
|
+
@property({ type: Boolean, reflect: true }) disabled = false;
|
|
25
|
+
@property({ reflect: true }) helper = '';
|
|
26
|
+
@property({ reflect: true, attribute: 'error-text' }) errorText = '';
|
|
27
|
+
@property({ type: Boolean, reflect: true }) error = false;
|
|
28
|
+
@property({ reflect: true }) value = '#6750a4';
|
|
29
|
+
|
|
30
|
+
@query('input[type="color"]') private _colorInput!: HTMLInputElement;
|
|
31
|
+
@query('input[type="text"]') private _textInput!: HTMLInputElement;
|
|
32
|
+
|
|
33
|
+
override updated(changed: Map<string, unknown>) {
|
|
34
|
+
if (changed.has('value')) {
|
|
35
|
+
if (this._colorInput) this._colorInput.value = this.value;
|
|
36
|
+
if (this._textInput) this._textInput.value = this.value;
|
|
37
|
+
}
|
|
38
|
+
if (changed.has('disabled')) {
|
|
39
|
+
if (this._colorInput) this._colorInput.disabled = this.disabled;
|
|
40
|
+
if (this._textInput) this._textInput.disabled = this.disabled;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
static override styles = [
|
|
45
|
+
sharedStyles,
|
|
46
|
+
fieldStyles,
|
|
47
|
+
css`
|
|
48
|
+
.swatch {
|
|
49
|
+
inline-size: 1.5rem;
|
|
50
|
+
block-size: 1.5rem;
|
|
51
|
+
border-radius: 50%;
|
|
52
|
+
border: 0.0625rem solid var(--outline);
|
|
53
|
+
background-color: var(--_swatch, currentColor);
|
|
54
|
+
position: absolute;
|
|
55
|
+
inset: calc(50% - 0.75rem) auto auto 0.75rem;
|
|
56
|
+
pointer-events: none;
|
|
57
|
+
z-index: 1;
|
|
58
|
+
}
|
|
59
|
+
input[type='text'] {
|
|
60
|
+
padding-inline-start: 2.5rem !important;
|
|
61
|
+
}
|
|
62
|
+
input[type='color'] {
|
|
63
|
+
position: absolute;
|
|
64
|
+
inset: 0;
|
|
65
|
+
opacity: 0;
|
|
66
|
+
z-index: 2;
|
|
67
|
+
cursor: pointer;
|
|
68
|
+
}
|
|
69
|
+
`
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
override render() {
|
|
73
|
+
const isActive = Boolean(this.value);
|
|
74
|
+
const fieldClasses = {
|
|
75
|
+
field: true,
|
|
76
|
+
label: Boolean(this.label),
|
|
77
|
+
fill: this.variant === 'filled',
|
|
78
|
+
border: this.variant === 'outlined',
|
|
79
|
+
small: this.size === 'small',
|
|
80
|
+
large: this.size === 'large',
|
|
81
|
+
extra: this.size === 'extra',
|
|
82
|
+
prefix: true,
|
|
83
|
+
invalid: this.error,
|
|
84
|
+
round: this.shape === 'round',
|
|
85
|
+
square: this.shape === 'no-round'
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
return html`<div class=${classMap(fieldClasses)} part="field">
|
|
89
|
+
<span
|
|
90
|
+
class="swatch"
|
|
91
|
+
style="--_swatch: ${this.value};"
|
|
92
|
+
aria-hidden="true"
|
|
93
|
+
></span>
|
|
94
|
+
<input
|
|
95
|
+
type="color"
|
|
96
|
+
part="color"
|
|
97
|
+
.value=${this.value}
|
|
98
|
+
?disabled=${this.disabled}
|
|
99
|
+
name=${ifDefined(this.name ? `${this.name}-color` : undefined)}
|
|
100
|
+
tabindex="-1"
|
|
101
|
+
/>
|
|
102
|
+
<input
|
|
103
|
+
type="text"
|
|
104
|
+
part="text"
|
|
105
|
+
readonly
|
|
106
|
+
.value=${this.value}
|
|
107
|
+
?disabled=${this.disabled}
|
|
108
|
+
name=${ifDefined(this.name || undefined)}
|
|
109
|
+
class=${isActive ? 'active' : ''}
|
|
110
|
+
/>
|
|
111
|
+
${this.label
|
|
112
|
+
? html`<label
|
|
113
|
+
part="label"
|
|
114
|
+
class=${classMap({ active: isActive })}
|
|
115
|
+
>${this.label}</label
|
|
116
|
+
>`
|
|
117
|
+
: nothing}
|
|
118
|
+
${this.error
|
|
119
|
+
? html`<output part="helper" class="invalid"
|
|
120
|
+
>${this.errorText || this.helper}</output
|
|
121
|
+
>`
|
|
122
|
+
: this.helper
|
|
123
|
+
? html`<output part="helper">${this.helper}</output>`
|
|
124
|
+
: nothing}
|
|
125
|
+
</div>`;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
declare global {
|
|
130
|
+
interface HTMLElementTagNameMap {
|
|
131
|
+
'moni-color-field': MoniColorField;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export default MoniColorField;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import './moni-context-menu.js';
|
|
3
|
+
import type { MoniContextMenu } from './moni-context-menu.js';
|
|
4
|
+
|
|
5
|
+
describe('moni-context-menu (P3.5 — flip)', () => {
|
|
6
|
+
let parent: HTMLElement;
|
|
7
|
+
let el: MoniContextMenu;
|
|
8
|
+
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
parent = document.createElement('div');
|
|
11
|
+
el = document.createElement('moni-context-menu') as MoniContextMenu;
|
|
12
|
+
parent.appendChild(el);
|
|
13
|
+
document.body.appendChild(parent);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
afterEach(() => {
|
|
17
|
+
parent.remove();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('renders a <moni-menu> in the shadow DOM', async () => {
|
|
21
|
+
await el.updateComplete;
|
|
22
|
+
const menu = el.shadowRoot?.querySelector('moni-menu');
|
|
23
|
+
expect(menu).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('reflects placement=bottom (default)', async () => {
|
|
27
|
+
await el.updateComplete;
|
|
28
|
+
expect(el.placement).toBe('bottom');
|
|
29
|
+
const menu = el.shadowRoot?.querySelector('moni-menu');
|
|
30
|
+
expect(menu?.getAttribute('placement')).toBe('bottom');
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('reflects placement changes on the inner menu', async () => {
|
|
34
|
+
el.placement = 'top';
|
|
35
|
+
await el.updateComplete;
|
|
36
|
+
const menu = el.shadowRoot?.querySelector('moni-menu');
|
|
37
|
+
expect(menu?.getAttribute('placement')).toBe('top');
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('reflects the flip attribute on the host', async () => {
|
|
41
|
+
el.flip = true;
|
|
42
|
+
await el.updateComplete;
|
|
43
|
+
expect(el.hasAttribute('flip')).toBe(true);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('opens the menu on right-click on the parent', async () => {
|
|
47
|
+
await el.updateComplete;
|
|
48
|
+
const menu = el.shadowRoot?.querySelector(
|
|
49
|
+
'moni-menu'
|
|
50
|
+
) as HTMLElement | null;
|
|
51
|
+
expect(menu?.hasAttribute('active')).toBe(false);
|
|
52
|
+
|
|
53
|
+
const evt = new MouseEvent('contextmenu', {
|
|
54
|
+
bubbles: true,
|
|
55
|
+
clientX: 50,
|
|
56
|
+
clientY: 75
|
|
57
|
+
});
|
|
58
|
+
parent.dispatchEvent(evt);
|
|
59
|
+
await el.updateComplete;
|
|
60
|
+
expect(menu?.hasAttribute('active')).toBe(true);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('closes the menu on document click', async () => {
|
|
64
|
+
await el.updateComplete;
|
|
65
|
+
const menu = el.shadowRoot?.querySelector(
|
|
66
|
+
'moni-menu'
|
|
67
|
+
) as HTMLElement | null;
|
|
68
|
+
parent.dispatchEvent(new MouseEvent('contextmenu', { bubbles: true, clientX: 10, clientY: 10 }));
|
|
69
|
+
await el.updateComplete;
|
|
70
|
+
expect(menu?.hasAttribute('active')).toBe(true);
|
|
71
|
+
|
|
72
|
+
document.body.dispatchEvent(new MouseEvent('click', { bubbles: true }));
|
|
73
|
+
await el.updateComplete;
|
|
74
|
+
expect(menu?.hasAttribute('active')).toBe(false);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('closes the menu on Escape', async () => {
|
|
78
|
+
await el.updateComplete;
|
|
79
|
+
const menu = el.shadowRoot?.querySelector(
|
|
80
|
+
'moni-menu'
|
|
81
|
+
) as HTMLElement | null;
|
|
82
|
+
parent.dispatchEvent(new MouseEvent('contextmenu', { bubbles: true, clientX: 10, clientY: 10 }));
|
|
83
|
+
await el.updateComplete;
|
|
84
|
+
expect(menu?.hasAttribute('active')).toBe(true);
|
|
85
|
+
|
|
86
|
+
document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' }));
|
|
87
|
+
await el.updateComplete;
|
|
88
|
+
expect(menu?.hasAttribute('active')).toBe(false);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it('does not call showPopover (visual-only; no Popover API)', async () => {
|
|
92
|
+
// Sanity: the component is visual-only. The moni-menu inside handles
|
|
93
|
+
// the active attribute via CSS visibility/opacity. No native popover
|
|
94
|
+
// toggling.
|
|
95
|
+
await el.updateComplete;
|
|
96
|
+
const menu = el.shadowRoot?.querySelector('moni-menu');
|
|
97
|
+
expect(menu?.hasAttribute('popover')).toBe(false);
|
|
98
|
+
});
|
|
99
|
+
});
|