@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,166 @@
|
|
|
1
|
+
import { html, css } from 'lit';
|
|
2
|
+
import { customElement, property, state, query } from 'lit/decorators.js';
|
|
3
|
+
import { MoniElement, sharedStyles } from './_base/index.js';
|
|
4
|
+
import './moni-menu.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Context menu triggered by right-click on the parent element.
|
|
8
|
+
*
|
|
9
|
+
* **Usage** (`m3-docs/components/menus/guidelines.md`): the menu opens at
|
|
10
|
+
* the cursor's coordinates and flips to the opposite side if there isn't
|
|
11
|
+
* enough space in the viewport.
|
|
12
|
+
*
|
|
13
|
+
* **Wiring example**:
|
|
14
|
+
* ```html
|
|
15
|
+
* <div style="position: relative;">
|
|
16
|
+
* <moni-context-menu flip>
|
|
17
|
+
* <moni-menu-item>Cut</moni-menu-item>
|
|
18
|
+
* <moni-menu-item>Copy</moni-menu-item>
|
|
19
|
+
* <moni-menu-item>Paste</moni-menu-item>
|
|
20
|
+
* </moni-context-menu>
|
|
21
|
+
* Right-click anywhere in this div
|
|
22
|
+
* </div>
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* Attributes:
|
|
26
|
+
* - placement: bottom (default) | top | left | right
|
|
27
|
+
* - flip: present → auto-flip to opposite side if menu would overflow
|
|
28
|
+
* the viewport (M3 spec)
|
|
29
|
+
*
|
|
30
|
+
* Slots:
|
|
31
|
+
* - default: menu items
|
|
32
|
+
*/
|
|
33
|
+
@customElement('moni-context-menu')
|
|
34
|
+
export class MoniContextMenu extends MoniElement {
|
|
35
|
+
@property({ reflect: true })
|
|
36
|
+
placement: 'bottom' | 'top' | 'left' | 'right' = 'bottom';
|
|
37
|
+
@property({ type: Boolean, reflect: true }) flip = false;
|
|
38
|
+
|
|
39
|
+
@state() private _x = 0;
|
|
40
|
+
@state() private _y = 0;
|
|
41
|
+
@state() private _open = false;
|
|
42
|
+
@state() private _resolvedPlacement: 'bottom' | 'top' | 'left' | 'right' = 'bottom';
|
|
43
|
+
|
|
44
|
+
@query('moni-menu') private _menuEl?: HTMLElement;
|
|
45
|
+
|
|
46
|
+
private _target: HTMLElement | null = null;
|
|
47
|
+
private _docKeydown = (e: KeyboardEvent) => this._onDocKeydown(e);
|
|
48
|
+
|
|
49
|
+
override connectedCallback() {
|
|
50
|
+
super.connectedCallback();
|
|
51
|
+
this._target = this.parentElement;
|
|
52
|
+
if (this._target) {
|
|
53
|
+
const computed = getComputedStyle(this._target);
|
|
54
|
+
if (computed.position === 'static') {
|
|
55
|
+
this._target.style.position = 'relative';
|
|
56
|
+
}
|
|
57
|
+
this._target.addEventListener('contextmenu', this._onContextMenu);
|
|
58
|
+
}
|
|
59
|
+
// Close on click outside
|
|
60
|
+
document.addEventListener('click', this._onDocumentClick);
|
|
61
|
+
document.addEventListener('keydown', this._docKeydown);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
override disconnectedCallback() {
|
|
65
|
+
if (this._target) {
|
|
66
|
+
this._target.removeEventListener('contextmenu', this._onContextMenu);
|
|
67
|
+
}
|
|
68
|
+
document.removeEventListener('click', this._onDocumentClick);
|
|
69
|
+
document.removeEventListener('keydown', this._docKeydown);
|
|
70
|
+
super.disconnectedCallback();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
private _onContextMenu = (e: MouseEvent) => {
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
if (this._target) {
|
|
76
|
+
const rect = this._target.getBoundingClientRect();
|
|
77
|
+
this._x = e.clientX - rect.left;
|
|
78
|
+
this._y = e.clientY - rect.top;
|
|
79
|
+
} else {
|
|
80
|
+
this._x = e.clientX;
|
|
81
|
+
this._y = e.clientY;
|
|
82
|
+
}
|
|
83
|
+
this._resolvedPlacement = this.placement;
|
|
84
|
+
this._open = true;
|
|
85
|
+
// After Lit renders the menu, check viewport fit and flip if needed.
|
|
86
|
+
this.updateComplete.then(() => this._maybeFlip());
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
private _maybeFlip() {
|
|
90
|
+
if (!this.flip) return;
|
|
91
|
+
const menu = this._menuEl?.shadowRoot?.querySelector('menu') as HTMLElement | null;
|
|
92
|
+
if (!menu) return;
|
|
93
|
+
const rect = menu.getBoundingClientRect();
|
|
94
|
+
const vw = window.innerWidth;
|
|
95
|
+
const vh = window.innerHeight;
|
|
96
|
+
const overflowsBottom = rect.bottom > vh;
|
|
97
|
+
const overflowsRight = rect.right > vw;
|
|
98
|
+
if (this.placement === 'bottom' && overflowsBottom) {
|
|
99
|
+
this._resolvedPlacement = 'top';
|
|
100
|
+
} else if (this.placement === 'top' && rect.top < 0) {
|
|
101
|
+
this._resolvedPlacement = 'bottom';
|
|
102
|
+
} else if (this.placement === 'right' && overflowsRight) {
|
|
103
|
+
this._resolvedPlacement = 'left';
|
|
104
|
+
} else if (this.placement === 'left' && rect.left < 0) {
|
|
105
|
+
this._resolvedPlacement = 'right';
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
private _onDocumentClick = () => {
|
|
110
|
+
if (this._open) {
|
|
111
|
+
this._open = false;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
private _onDocKeydown = (e: KeyboardEvent) => {
|
|
116
|
+
if (e.key === 'Escape' && this._open) {
|
|
117
|
+
this._open = false;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
static override styles = [
|
|
122
|
+
sharedStyles,
|
|
123
|
+
css`
|
|
124
|
+
:host {
|
|
125
|
+
display: contents;
|
|
126
|
+
font-family: var(--font);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.menu-host {
|
|
130
|
+
/* Absolute from parent which has position:relative */
|
|
131
|
+
position: absolute;
|
|
132
|
+
inset-inline-start: var(--_x, 0);
|
|
133
|
+
inset-block-start: var(--_y, 0);
|
|
134
|
+
z-index: 200;
|
|
135
|
+
}
|
|
136
|
+
`
|
|
137
|
+
];
|
|
138
|
+
|
|
139
|
+
override render() {
|
|
140
|
+
// When the menu is open, prefer the resolved (possibly flipped)
|
|
141
|
+
// placement; otherwise just use the host's requested placement so
|
|
142
|
+
// the inner element reflects the attribute synchronously.
|
|
143
|
+
const effectivePlacement = this._open
|
|
144
|
+
? this._resolvedPlacement
|
|
145
|
+
: this.placement;
|
|
146
|
+
return html`<div
|
|
147
|
+
class="menu-host"
|
|
148
|
+
style="--_x: ${this._x}px; --_y: ${this._y}px;"
|
|
149
|
+
>
|
|
150
|
+
<moni-menu
|
|
151
|
+
placement=${effectivePlacement}
|
|
152
|
+
?active=${this._open}
|
|
153
|
+
>
|
|
154
|
+
<slot></slot>
|
|
155
|
+
</moni-menu>
|
|
156
|
+
</div>`;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
declare global {
|
|
161
|
+
interface HTMLElementTagNameMap {
|
|
162
|
+
'moni-context-menu': MoniContextMenu;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export default MoniContextMenu;
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { html, css } from 'lit';
|
|
2
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
3
|
+
import { MoniElement, sharedStyles } from './_base/index.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Visual-only dialog. Renders a native `<dialog>` element. The consumer
|
|
7
|
+
* opens/closes by calling the native `show()` / `showModal()` /
|
|
8
|
+
* `close()` / `showPopover()` methods on the inner dialog via
|
|
9
|
+
* `this.querySelector('dialog')` from the light DOM.
|
|
10
|
+
*
|
|
11
|
+
* Attributes:
|
|
12
|
+
* - open: present → dialog[open]
|
|
13
|
+
* - side: center (default) | top | right | bottom | left | max
|
|
14
|
+
* - size: small | medium (default) | large
|
|
15
|
+
* - modal: present → adds the `modal` class (used by BeerCSS)
|
|
16
|
+
* - title: header text
|
|
17
|
+
*
|
|
18
|
+
* Slots:
|
|
19
|
+
* - default: body
|
|
20
|
+
* - header: title
|
|
21
|
+
* - footer: action buttons
|
|
22
|
+
*/
|
|
23
|
+
@customElement('moni-dialog')
|
|
24
|
+
export class MoniDialog extends MoniElement {
|
|
25
|
+
@property({ type: Boolean, reflect: true }) open = false;
|
|
26
|
+
@property({ type: Boolean, reflect: true }) modal = false;
|
|
27
|
+
@property({ reflect: true })
|
|
28
|
+
side: 'center' | 'top' | 'right' | 'bottom' | 'left' | 'max' = 'center';
|
|
29
|
+
@property({ reflect: true })
|
|
30
|
+
size: 'small' | 'medium' | 'large' = 'medium';
|
|
31
|
+
@property({ reflect: true }) title = '';
|
|
32
|
+
|
|
33
|
+
@query('dialog') private _dialog!: HTMLDialogElement;
|
|
34
|
+
|
|
35
|
+
override updated(changed: Map<string, unknown>) {
|
|
36
|
+
if (changed.has('open') && this._dialog) {
|
|
37
|
+
if (this.open) {
|
|
38
|
+
if (this.modal) {
|
|
39
|
+
if (!this._dialog.open) {
|
|
40
|
+
this._dialog.showModal();
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
if (!this._dialog.open) {
|
|
44
|
+
this._dialog.show();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
} else {
|
|
48
|
+
if (this._dialog.open) {
|
|
49
|
+
this._dialog.close();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
static override styles = [
|
|
56
|
+
sharedStyles,
|
|
57
|
+
css`
|
|
58
|
+
:host {
|
|
59
|
+
display: contents;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
dialog {
|
|
63
|
+
--_padding: 1.5rem;
|
|
64
|
+
--_top: calc(var(--_padding) + env(safe-area-inset-top, 0));
|
|
65
|
+
--_bottom: calc(var(--_padding) + env(safe-area-inset-bottom, 0));
|
|
66
|
+
display: block;
|
|
67
|
+
visibility: hidden;
|
|
68
|
+
border: none;
|
|
69
|
+
opacity: 0;
|
|
70
|
+
position: fixed;
|
|
71
|
+
box-shadow: var(--elevate2);
|
|
72
|
+
color: var(--on-surface);
|
|
73
|
+
background-color: var(--surface-container-high);
|
|
74
|
+
padding: var(--_padding);
|
|
75
|
+
z-index: 100;
|
|
76
|
+
inset: 10% auto auto 50%;
|
|
77
|
+
min-inline-size: 20rem;
|
|
78
|
+
max-inline-size: 100%;
|
|
79
|
+
max-block-size: 80%;
|
|
80
|
+
overflow-x: hidden;
|
|
81
|
+
overflow-y: auto;
|
|
82
|
+
transition: all var(--speed3), 0s background-color;
|
|
83
|
+
border-radius: 1.75rem;
|
|
84
|
+
transform: translate(-50%, -4rem);
|
|
85
|
+
outline: none;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
dialog[open] {
|
|
89
|
+
visibility: visible;
|
|
90
|
+
opacity: 1;
|
|
91
|
+
transform: translate(-50%, 0);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
dialog::backdrop {
|
|
95
|
+
display: block !important;
|
|
96
|
+
opacity: 0;
|
|
97
|
+
visibility: hidden;
|
|
98
|
+
position: fixed;
|
|
99
|
+
inset: 0;
|
|
100
|
+
color: var(--on-surface);
|
|
101
|
+
background-color: rgb(0 0 0 / 0.5);
|
|
102
|
+
z-index: 100;
|
|
103
|
+
transition: all var(--speed3), 0s background-color;
|
|
104
|
+
border-radius: 0;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
dialog[open]::backdrop {
|
|
108
|
+
opacity: 1;
|
|
109
|
+
visibility: visible;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
dialog:is(.top, .right, .bottom, .left, .max) {
|
|
113
|
+
--_padding: 1rem;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
dialog.top,
|
|
117
|
+
dialog.bottom {
|
|
118
|
+
opacity: 1;
|
|
119
|
+
block-size: auto;
|
|
120
|
+
inline-size: 100%;
|
|
121
|
+
min-inline-size: auto;
|
|
122
|
+
max-block-size: 100%;
|
|
123
|
+
}
|
|
124
|
+
dialog.top {
|
|
125
|
+
inset: 0 auto auto 0;
|
|
126
|
+
transform: translateY(-100%);
|
|
127
|
+
border-radius: 0 0 1rem 1rem;
|
|
128
|
+
padding-block-start: var(--_top);
|
|
129
|
+
}
|
|
130
|
+
dialog.bottom {
|
|
131
|
+
inset: auto auto 0 0;
|
|
132
|
+
transform: translateY(100%);
|
|
133
|
+
border-radius: 1rem 1rem 0 0;
|
|
134
|
+
padding-block-end: var(--_bottom);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
dialog:is(.left, .right) {
|
|
138
|
+
opacity: 1;
|
|
139
|
+
inset: 0 auto auto 0;
|
|
140
|
+
inline-size: auto;
|
|
141
|
+
block-size: 100%;
|
|
142
|
+
max-block-size: 100%;
|
|
143
|
+
background-color: var(--surface);
|
|
144
|
+
padding-block: var(--_top) var(--_bottom);
|
|
145
|
+
}
|
|
146
|
+
dialog.left {
|
|
147
|
+
inset: 0 auto auto 0;
|
|
148
|
+
border-radius: 0 1rem 1rem 0;
|
|
149
|
+
transform: translateX(-100%);
|
|
150
|
+
}
|
|
151
|
+
dialog.right {
|
|
152
|
+
inset: 0 0 auto auto;
|
|
153
|
+
border-radius: 1rem 0 0 1rem;
|
|
154
|
+
transform: translateX(100%);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
dialog.max {
|
|
158
|
+
inset: 0 auto auto 0;
|
|
159
|
+
inline-size: 100%;
|
|
160
|
+
block-size: 100%;
|
|
161
|
+
max-inline-size: 100%;
|
|
162
|
+
max-block-size: 100%;
|
|
163
|
+
transform: translateY(4rem);
|
|
164
|
+
background-color: var(--surface);
|
|
165
|
+
border-radius: 0;
|
|
166
|
+
padding-block: var(--_top) var(--_bottom);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
dialog[open]:is(.left, .right, .top, .bottom, .max) {
|
|
170
|
+
transform: translate(0, 0);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
dialog.small {
|
|
174
|
+
inline-size: 25%;
|
|
175
|
+
}
|
|
176
|
+
dialog.medium {
|
|
177
|
+
inline-size: 50%;
|
|
178
|
+
}
|
|
179
|
+
dialog.large {
|
|
180
|
+
inline-size: 75%;
|
|
181
|
+
}
|
|
182
|
+
dialog.small:is(.left, .right) {
|
|
183
|
+
inline-size: 20rem;
|
|
184
|
+
}
|
|
185
|
+
dialog.medium:is(.left, .right) {
|
|
186
|
+
inline-size: 32rem;
|
|
187
|
+
}
|
|
188
|
+
dialog.large:is(.left, .right) {
|
|
189
|
+
inline-size: 44rem;
|
|
190
|
+
}
|
|
191
|
+
dialog.small:is(.top, .bottom) {
|
|
192
|
+
block-size: 16rem;
|
|
193
|
+
}
|
|
194
|
+
dialog.medium:is(.top, .bottom) {
|
|
195
|
+
block-size: 24rem;
|
|
196
|
+
}
|
|
197
|
+
dialog.large:is(.top, .bottom) {
|
|
198
|
+
block-size: 32rem;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
header,
|
|
202
|
+
footer {
|
|
203
|
+
display: grid;
|
|
204
|
+
align-content: center;
|
|
205
|
+
border-radius: 0;
|
|
206
|
+
padding: 0;
|
|
207
|
+
}
|
|
208
|
+
header {
|
|
209
|
+
min-block-size: 3rem;
|
|
210
|
+
}
|
|
211
|
+
footer {
|
|
212
|
+
min-block-size: 3.5rem;
|
|
213
|
+
}
|
|
214
|
+
`
|
|
215
|
+
];
|
|
216
|
+
|
|
217
|
+
override render() {
|
|
218
|
+
const classes = [this.side, this.size, this.modal ? 'modal' : '']
|
|
219
|
+
.filter(Boolean)
|
|
220
|
+
.join(' ');
|
|
221
|
+
return html`<dialog
|
|
222
|
+
part="dialog"
|
|
223
|
+
class=${classes}
|
|
224
|
+
>
|
|
225
|
+
<header part="header">
|
|
226
|
+
<slot name="header">${this.title}</slot>
|
|
227
|
+
</header>
|
|
228
|
+
<div part="content"><slot></slot></div>
|
|
229
|
+
<footer part="footer"><slot name="footer"></slot></footer>
|
|
230
|
+
</dialog>`;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
declare global {
|
|
235
|
+
interface HTMLElementTagNameMap {
|
|
236
|
+
'moni-dialog': MoniDialog;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export default MoniDialog;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import './moni-divider.js';
|
|
3
|
+
import type { MoniDivider } from './moni-divider.js';
|
|
4
|
+
|
|
5
|
+
describe('moni-divider (P5.1 — recreated)', () => {
|
|
6
|
+
let el: MoniDivider;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
el = document.createElement('moni-divider') as MoniDivider;
|
|
10
|
+
document.body.appendChild(el);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
afterEach(() => {
|
|
14
|
+
el.remove();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('defaults to inset=leading', async () => {
|
|
18
|
+
await el.updateComplete;
|
|
19
|
+
expect(el.inset).toBe('leading');
|
|
20
|
+
expect(el.getAttribute('inset')).toBe('leading');
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('reflects all three M3 insets: leading / middle / none', async () => {
|
|
24
|
+
for (const inset of ['leading', 'middle', 'none'] as const) {
|
|
25
|
+
el.inset = inset;
|
|
26
|
+
await el.updateComplete;
|
|
27
|
+
expect(el.getAttribute('inset')).toBe(inset);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('renders an empty default slot for inline content', async () => {
|
|
32
|
+
await el.updateComplete;
|
|
33
|
+
const slot = el.shadowRoot?.querySelector('slot');
|
|
34
|
+
expect(slot).toBeTruthy();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('reflects the vertical attribute', async () => {
|
|
38
|
+
el.setAttribute('vertical', '');
|
|
39
|
+
await el.updateComplete;
|
|
40
|
+
expect(el.hasAttribute('vertical')).toBe(true);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { html, css } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
import { MoniElement, sharedStyles } from './_base/index.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Material 3 Divider (`m3-docs/components/divider/specs.md`).
|
|
7
|
+
*
|
|
8
|
+
* A thin line used to group content in lists, layouts, or cards. M3 spec
|
|
9
|
+
* defines three inset variants:
|
|
10
|
+
* - **full** (default): spans the full width of the parent.
|
|
11
|
+
* - **inset**: indented from the leading edge (16dp) so it lines up
|
|
12
|
+
* with text content below an icon.
|
|
13
|
+
* - **middle**: indented from both edges (16dp each).
|
|
14
|
+
*
|
|
15
|
+
* M3 measurements:
|
|
16
|
+
* - Thickness: 1dp (`0.0625rem`).
|
|
17
|
+
* - Color: `outline-variant` (subtle on a light background).
|
|
18
|
+
*
|
|
19
|
+
* Attributes:
|
|
20
|
+
* - inset: leading (default) | middle | none
|
|
21
|
+
*
|
|
22
|
+
* Slots:
|
|
23
|
+
* - default: optional content rendered inline with the divider line.
|
|
24
|
+
*/
|
|
25
|
+
@customElement('moni-divider')
|
|
26
|
+
export class MoniDivider extends MoniElement {
|
|
27
|
+
@property({ reflect: true })
|
|
28
|
+
inset: 'leading' | 'middle' | 'none' = 'leading';
|
|
29
|
+
|
|
30
|
+
static override styles = [
|
|
31
|
+
sharedStyles,
|
|
32
|
+
css`
|
|
33
|
+
:host {
|
|
34
|
+
display: block;
|
|
35
|
+
font-family: var(--font);
|
|
36
|
+
/* M3 spec: 1dp thick, on-surface-variant for subtle separation. */
|
|
37
|
+
block-size: 0.0625rem;
|
|
38
|
+
min-inline-size: 0;
|
|
39
|
+
background-color: var(--outline-variant);
|
|
40
|
+
border: 0;
|
|
41
|
+
margin: 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* Inset variants. M3 spec: 16dp from the leading edge. */
|
|
45
|
+
:host([inset='leading']) {
|
|
46
|
+
margin-inline-start: 1rem;
|
|
47
|
+
margin-inline-end: 0;
|
|
48
|
+
}
|
|
49
|
+
:host([inset='middle']) {
|
|
50
|
+
margin-inline: 1rem;
|
|
51
|
+
}
|
|
52
|
+
:host([inset='none']) {
|
|
53
|
+
margin-inline: 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* Vertical divider (M3 spec also defines vertical usage). */
|
|
57
|
+
:host([vertical]) {
|
|
58
|
+
inline-size: 0.0625rem;
|
|
59
|
+
block-size: auto;
|
|
60
|
+
min-block-size: 100%;
|
|
61
|
+
align-self: stretch;
|
|
62
|
+
}
|
|
63
|
+
`
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
override render() {
|
|
67
|
+
return html`<slot></slot>`;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
declare global {
|
|
72
|
+
interface HTMLElementTagNameMap {
|
|
73
|
+
'moni-divider': MoniDivider;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export default MoniDivider;
|
|
@@ -0,0 +1,86 @@
|
|
|
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 expansion panel. Renders a `<details>` element.
|
|
7
|
+
*
|
|
8
|
+
* Attributes:
|
|
9
|
+
* - open: present → panel expanded
|
|
10
|
+
* - title: heading text for the summary
|
|
11
|
+
*
|
|
12
|
+
* Slots:
|
|
13
|
+
* - default: panel body
|
|
14
|
+
* - summary: custom summary content (overrides title)
|
|
15
|
+
*/
|
|
16
|
+
@customElement('moni-expansion')
|
|
17
|
+
export class MoniExpansion extends MoniElement {
|
|
18
|
+
@property({ type: Boolean, reflect: true }) open = false;
|
|
19
|
+
@property({ reflect: true }) title = '';
|
|
20
|
+
|
|
21
|
+
static override styles = [
|
|
22
|
+
sharedStyles,
|
|
23
|
+
css`
|
|
24
|
+
:host {
|
|
25
|
+
display: block;
|
|
26
|
+
font-family: var(--font);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
details {
|
|
30
|
+
border-radius: 0.5rem;
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
summary {
|
|
35
|
+
list-style-type: none;
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
padding: 0.75rem 1rem;
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: space-between;
|
|
41
|
+
gap: 0.5rem;
|
|
42
|
+
font-weight: 500;
|
|
43
|
+
color: var(--on-surface);
|
|
44
|
+
background-color: var(--surface-container);
|
|
45
|
+
}
|
|
46
|
+
summary::-webkit-details-marker {
|
|
47
|
+
display: none;
|
|
48
|
+
}
|
|
49
|
+
summary::after {
|
|
50
|
+
content: 'expand_more';
|
|
51
|
+
font-family: var(--font-icon);
|
|
52
|
+
font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
|
|
53
|
+
font-size: 1.25rem;
|
|
54
|
+
transition: transform var(--speed2);
|
|
55
|
+
}
|
|
56
|
+
details[open] > summary::after {
|
|
57
|
+
transform: rotate(180deg);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.body {
|
|
61
|
+
padding: 1rem;
|
|
62
|
+
background-color: var(--surface-container-low);
|
|
63
|
+
color: var(--on-surface);
|
|
64
|
+
}
|
|
65
|
+
`
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
override render() {
|
|
69
|
+
return html`<details ?open=${this.open} part="expansion">
|
|
70
|
+
<summary part="summary">
|
|
71
|
+
<slot name="summary">${this.title}</slot>
|
|
72
|
+
</summary>
|
|
73
|
+
<div class="body" part="body">
|
|
74
|
+
<slot></slot>
|
|
75
|
+
</div>
|
|
76
|
+
</details>`;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
declare global {
|
|
81
|
+
interface HTMLElementTagNameMap {
|
|
82
|
+
'moni-expansion': MoniExpansion;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export default MoniExpansion;
|