@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,823 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, css } from 'lit';
|
|
8
|
+
import { customElement, property, state, query } from 'lit/decorators.js';
|
|
9
|
+
import { MoniElement, sharedStyles } from './_base/index.js';
|
|
10
|
+
import './moni-icon.js';
|
|
11
|
+
import './moni-button.js';
|
|
12
|
+
/**
|
|
13
|
+
* Material Design 3 Time Picker Component.
|
|
14
|
+
* Supports interactive clock face (dial) and manual keyboard input.
|
|
15
|
+
*
|
|
16
|
+
* Attributes:
|
|
17
|
+
* - value: Time value in "HH:MM" 24h format (default "00:00")
|
|
18
|
+
* - use24Hour: If true, uses 24-hour mode without AM/PM toggle (default false)
|
|
19
|
+
* - mode: "dial" | "input" (default "dial")
|
|
20
|
+
*
|
|
21
|
+
* Events:
|
|
22
|
+
* - change: Fired when value changes (detail: { value })
|
|
23
|
+
* - cancel: Fired when cancel button is clicked
|
|
24
|
+
* - ok: Fired when OK button is clicked (detail: { value })
|
|
25
|
+
*/
|
|
26
|
+
let MoniTimePicker = class MoniTimePicker extends MoniElement {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
this.value = '00:00';
|
|
30
|
+
this.use24Hour = false;
|
|
31
|
+
this.mode = 'dial';
|
|
32
|
+
this.orientation = 'auto';
|
|
33
|
+
this.activeSelection = 'hour';
|
|
34
|
+
this.period = 'AM';
|
|
35
|
+
this.currentHour = 0; // 0-23
|
|
36
|
+
this.currentMinute = 0; // 0-59
|
|
37
|
+
this.isDragging = false;
|
|
38
|
+
}
|
|
39
|
+
willUpdate(changedProperties) {
|
|
40
|
+
if (changedProperties.has('value') || changedProperties.has('use24Hour')) {
|
|
41
|
+
this.parseValue();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
parseValue() {
|
|
45
|
+
const parts = this.value.split(':');
|
|
46
|
+
let h = parseInt(parts[0], 10);
|
|
47
|
+
let m = parseInt(parts[1], 10);
|
|
48
|
+
if (isNaN(h) || h < 0 || h > 23)
|
|
49
|
+
h = 0;
|
|
50
|
+
if (isNaN(m) || m < 0 || m > 59)
|
|
51
|
+
m = 0;
|
|
52
|
+
this.currentHour = h;
|
|
53
|
+
this.currentMinute = m;
|
|
54
|
+
if (!this.use24Hour) {
|
|
55
|
+
if (h >= 12) {
|
|
56
|
+
this.period = 'PM';
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
this.period = 'AM';
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
updateValue() {
|
|
64
|
+
let h = this.currentHour;
|
|
65
|
+
const m = this.currentMinute;
|
|
66
|
+
if (!this.use24Hour) {
|
|
67
|
+
if (this.period === 'PM') {
|
|
68
|
+
if (h < 12)
|
|
69
|
+
h += 12;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
if (h === 12)
|
|
73
|
+
h = 0;
|
|
74
|
+
else if (h > 12)
|
|
75
|
+
h -= 12; // Adjust if out of bounds
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const formattedHour = String(h).padStart(2, '0');
|
|
79
|
+
const formattedMinute = String(m).padStart(2, '0');
|
|
80
|
+
this.value = `${formattedHour}:${formattedMinute}`;
|
|
81
|
+
this.dispatchEvent(new CustomEvent('change', {
|
|
82
|
+
detail: { value: this.value },
|
|
83
|
+
bubbles: true,
|
|
84
|
+
composed: true
|
|
85
|
+
}));
|
|
86
|
+
}
|
|
87
|
+
toggleMode() {
|
|
88
|
+
this.mode = this.mode === 'dial' ? 'input' : 'dial';
|
|
89
|
+
}
|
|
90
|
+
setSelection(type) {
|
|
91
|
+
this.activeSelection = type;
|
|
92
|
+
}
|
|
93
|
+
setPeriod(p) {
|
|
94
|
+
this.period = p;
|
|
95
|
+
this.updateValue();
|
|
96
|
+
}
|
|
97
|
+
// Clock Math and Interaction
|
|
98
|
+
handleClockPointerDown(e) {
|
|
99
|
+
if (!this.clockFaceEl)
|
|
100
|
+
return;
|
|
101
|
+
this.isDragging = true;
|
|
102
|
+
this.clockFaceEl.classList.add('dragging');
|
|
103
|
+
this.clockFaceEl.setPointerCapture(e.pointerId);
|
|
104
|
+
this.handleClockPointerMove(e);
|
|
105
|
+
}
|
|
106
|
+
handleClockPointerMove(e) {
|
|
107
|
+
if (!this.isDragging || !this.clockFaceEl)
|
|
108
|
+
return;
|
|
109
|
+
const rect = this.clockFaceEl.getBoundingClientRect();
|
|
110
|
+
const centerX = rect.left + rect.width / 2;
|
|
111
|
+
const centerY = rect.top + rect.height / 2;
|
|
112
|
+
const dx = e.clientX - centerX;
|
|
113
|
+
const dy = e.clientY - centerY;
|
|
114
|
+
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
115
|
+
// Calculate angle in degrees from 12 o'clock position (clockwise)
|
|
116
|
+
let angle = Math.atan2(dy, dx) * (180 / Math.PI) + 90;
|
|
117
|
+
if (angle < 0)
|
|
118
|
+
angle += 360;
|
|
119
|
+
if (this.activeSelection === 'hour') {
|
|
120
|
+
if (this.use24Hour) {
|
|
121
|
+
// Outer circle for 13-00, inner circle for 1-12
|
|
122
|
+
const isInner = distance < rect.width * 0.32;
|
|
123
|
+
let hour = Math.round(angle / 30) % 12;
|
|
124
|
+
if (hour === 0)
|
|
125
|
+
hour = 12;
|
|
126
|
+
if (isInner) {
|
|
127
|
+
// Inner circle: 1 to 12
|
|
128
|
+
this.currentHour = hour;
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
// Outer circle: 13 to 00/24
|
|
132
|
+
this.currentHour = hour === 12 ? 0 : hour + 12;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
// 12-hour face: 1 to 12
|
|
137
|
+
let hour = Math.round(angle / 30) % 12;
|
|
138
|
+
if (hour === 0)
|
|
139
|
+
hour = 12;
|
|
140
|
+
this.currentHour = hour;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
// Minutes: 0 to 59
|
|
145
|
+
const minute = Math.round(angle / 6) % 60;
|
|
146
|
+
this.currentMinute = minute;
|
|
147
|
+
}
|
|
148
|
+
this.updateValue();
|
|
149
|
+
}
|
|
150
|
+
handleClockPointerUp() {
|
|
151
|
+
if (this.isDragging) {
|
|
152
|
+
this.isDragging = false;
|
|
153
|
+
this.clockFaceEl?.classList.remove('dragging');
|
|
154
|
+
if (this.activeSelection === 'hour') {
|
|
155
|
+
// Automatically switch to minute selection after choosing hour
|
|
156
|
+
setTimeout(() => {
|
|
157
|
+
this.activeSelection = 'minute';
|
|
158
|
+
}, 300);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
handleHourInputChange(e) {
|
|
163
|
+
const target = e.target;
|
|
164
|
+
let val = parseInt(target.value, 10);
|
|
165
|
+
if (isNaN(val))
|
|
166
|
+
val = 0;
|
|
167
|
+
if (this.use24Hour) {
|
|
168
|
+
if (val < 0)
|
|
169
|
+
val = 0;
|
|
170
|
+
if (val > 23)
|
|
171
|
+
val = 23;
|
|
172
|
+
this.currentHour = val;
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
if (val < 1)
|
|
176
|
+
val = 1;
|
|
177
|
+
if (val > 12)
|
|
178
|
+
val = 12;
|
|
179
|
+
this.currentHour = val;
|
|
180
|
+
}
|
|
181
|
+
this.updateValue();
|
|
182
|
+
}
|
|
183
|
+
handleMinuteInputChange(e) {
|
|
184
|
+
const target = e.target;
|
|
185
|
+
let val = parseInt(target.value, 10);
|
|
186
|
+
if (isNaN(val))
|
|
187
|
+
val = 0;
|
|
188
|
+
if (val < 0)
|
|
189
|
+
val = 0;
|
|
190
|
+
if (val > 59)
|
|
191
|
+
val = 59;
|
|
192
|
+
this.currentMinute = val;
|
|
193
|
+
this.updateValue();
|
|
194
|
+
}
|
|
195
|
+
static { this.styles = [
|
|
196
|
+
sharedStyles,
|
|
197
|
+
css `
|
|
198
|
+
:host {
|
|
199
|
+
display: inline-flex;
|
|
200
|
+
flex-direction: column;
|
|
201
|
+
background-color: transparent;
|
|
202
|
+
inline-size: 20.5rem;
|
|
203
|
+
color: var(--on-surface);
|
|
204
|
+
font-family: var(--font);
|
|
205
|
+
user-select: none;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/* Forced orientations */
|
|
209
|
+
:host([orientation="vertical"]) {
|
|
210
|
+
inline-size: 20.5rem;
|
|
211
|
+
}
|
|
212
|
+
:host([orientation="vertical"]) .main-content {
|
|
213
|
+
flex-direction: column;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
:host([orientation="horizontal"]) {
|
|
217
|
+
inline-size: auto;
|
|
218
|
+
}
|
|
219
|
+
:host([orientation="horizontal"]) .main-content {
|
|
220
|
+
flex-direction: row;
|
|
221
|
+
align-items: center;
|
|
222
|
+
gap: 2rem;
|
|
223
|
+
}
|
|
224
|
+
:host([orientation="horizontal"]) .left-pane {
|
|
225
|
+
display: flex;
|
|
226
|
+
flex-direction: column;
|
|
227
|
+
justify-content: center;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/* Main Content (Default vertical) */
|
|
231
|
+
.main-content {
|
|
232
|
+
display: flex;
|
|
233
|
+
flex-direction: column;
|
|
234
|
+
gap: 1rem;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/* Auto Responsive Layout */
|
|
238
|
+
@media (min-width: 32rem) {
|
|
239
|
+
:host([orientation="auto"]) .main-content,
|
|
240
|
+
:host(:not([orientation])) .main-content {
|
|
241
|
+
flex-direction: row;
|
|
242
|
+
align-items: center;
|
|
243
|
+
gap: 2rem;
|
|
244
|
+
}
|
|
245
|
+
:host([orientation="auto"]),
|
|
246
|
+
:host(:not([orientation])) {
|
|
247
|
+
inline-size: auto;
|
|
248
|
+
}
|
|
249
|
+
:host([orientation="auto"]) .left-pane,
|
|
250
|
+
:host(:not([orientation])) .left-pane {
|
|
251
|
+
display: flex;
|
|
252
|
+
flex-direction: column;
|
|
253
|
+
justify-content: center;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
@keyframes fadeInScale {
|
|
258
|
+
from {
|
|
259
|
+
opacity: 0;
|
|
260
|
+
transform: scale(0.92);
|
|
261
|
+
}
|
|
262
|
+
to {
|
|
263
|
+
opacity: 1;
|
|
264
|
+
transform: scale(1);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.clock-container,
|
|
269
|
+
.time-display-container,
|
|
270
|
+
.input-labels,
|
|
271
|
+
.display-box {
|
|
272
|
+
animation: fadeInScale var(--speed3) var(--ease-standard) forwards;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.picker-header {
|
|
276
|
+
font-size: 0.75rem;
|
|
277
|
+
font-weight: 500;
|
|
278
|
+
margin-bottom: 1.25rem;
|
|
279
|
+
color: var(--on-surface-variant);
|
|
280
|
+
text-transform: uppercase;
|
|
281
|
+
letter-spacing: 0.1em;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/* Display Panel (Time box inputs/views) */
|
|
285
|
+
.time-display-container {
|
|
286
|
+
display: flex;
|
|
287
|
+
align-items: center;
|
|
288
|
+
justify-content: space-between;
|
|
289
|
+
margin-bottom: 1.5rem;
|
|
290
|
+
gap: 0.75rem;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.time-display {
|
|
294
|
+
display: flex;
|
|
295
|
+
align-items: center;
|
|
296
|
+
flex: 1;
|
|
297
|
+
background-color: transparent;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.display-box {
|
|
301
|
+
display: flex;
|
|
302
|
+
align-items: center;
|
|
303
|
+
justify-content: center;
|
|
304
|
+
width: 6rem;
|
|
305
|
+
height: 5rem;
|
|
306
|
+
border-radius: 0.5rem;
|
|
307
|
+
background-color: var(--surface-container-highest);
|
|
308
|
+
font-size: 3.5rem;
|
|
309
|
+
font-weight: 400;
|
|
310
|
+
color: var(--on-surface);
|
|
311
|
+
cursor: pointer;
|
|
312
|
+
transition: background-color var(--speed2);
|
|
313
|
+
border: 0.125rem solid transparent;
|
|
314
|
+
text-align: center;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
:host([use-24-hour]) .display-box {
|
|
318
|
+
width: 7.125rem;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.display-box:hover:not(.active) {
|
|
322
|
+
background-color: var(--active);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.display-box.active {
|
|
326
|
+
background-color: var(--primary-container);
|
|
327
|
+
color: var(--on-primary-container);
|
|
328
|
+
border-color: var(--primary);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.display-box input {
|
|
332
|
+
width: 100%;
|
|
333
|
+
height: 100%;
|
|
334
|
+
border: none;
|
|
335
|
+
background: transparent;
|
|
336
|
+
text-align: center;
|
|
337
|
+
font-size: inherit;
|
|
338
|
+
font-family: inherit;
|
|
339
|
+
color: inherit;
|
|
340
|
+
outline: none;
|
|
341
|
+
padding: 0;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/* Remove input spinners */
|
|
345
|
+
.display-box input::-webkit-outer-spin-button,
|
|
346
|
+
.display-box input::-webkit-inner-spin-button {
|
|
347
|
+
-webkit-appearance: none;
|
|
348
|
+
margin: 0;
|
|
349
|
+
}
|
|
350
|
+
.display-box input[type=number] {
|
|
351
|
+
-moz-appearance: textfield;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.separator {
|
|
355
|
+
font-size: 3rem;
|
|
356
|
+
font-weight: 400;
|
|
357
|
+
color: var(--on-surface);
|
|
358
|
+
width: 1.5rem;
|
|
359
|
+
text-align: center;
|
|
360
|
+
line-height: 5rem;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/* AM/PM Toggle */
|
|
364
|
+
.ampm-toggle {
|
|
365
|
+
display: flex;
|
|
366
|
+
flex-direction: column;
|
|
367
|
+
border: 0.0625rem solid var(--outline);
|
|
368
|
+
border-radius: 0.5rem;
|
|
369
|
+
overflow: hidden;
|
|
370
|
+
height: 5rem;
|
|
371
|
+
width: 3.25rem;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.ampm-btn {
|
|
375
|
+
flex: 1;
|
|
376
|
+
background-color: transparent;
|
|
377
|
+
border: none;
|
|
378
|
+
font-size: 0.875rem;
|
|
379
|
+
font-weight: 500;
|
|
380
|
+
color: var(--on-surface-variant);
|
|
381
|
+
cursor: pointer;
|
|
382
|
+
transition: background-color var(--speed1), color var(--speed1);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
.ampm-btn.active {
|
|
386
|
+
background-color: var(--tertiary-container);
|
|
387
|
+
color: var(--on-tertiary-container);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
.ampm-btn:first-child {
|
|
391
|
+
border-bottom: 0.0625rem solid var(--outline);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/* Clock Face */
|
|
395
|
+
.clock-container {
|
|
396
|
+
display: flex;
|
|
397
|
+
justify-content: center;
|
|
398
|
+
align-items: center;
|
|
399
|
+
margin-block: 0.5rem 1.5rem;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.clock-face {
|
|
403
|
+
position: relative;
|
|
404
|
+
width: 16rem;
|
|
405
|
+
height: 16rem;
|
|
406
|
+
border-radius: 50%;
|
|
407
|
+
background-color: var(--surface-container-highest);
|
|
408
|
+
touch-action: none;
|
|
409
|
+
cursor: pointer;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/* Center dot */
|
|
413
|
+
.clock-center {
|
|
414
|
+
position: absolute;
|
|
415
|
+
left: calc(50% - 0.25rem);
|
|
416
|
+
top: calc(50% - 0.25rem);
|
|
417
|
+
width: 0.5rem;
|
|
418
|
+
height: 0.5rem;
|
|
419
|
+
border-radius: 50%;
|
|
420
|
+
background-color: var(--primary);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/* Clock hand line */
|
|
424
|
+
.clock-hand {
|
|
425
|
+
position: absolute;
|
|
426
|
+
left: calc(50% - 0.0625rem);
|
|
427
|
+
bottom: 50%;
|
|
428
|
+
width: 0.125rem;
|
|
429
|
+
background-color: var(--primary);
|
|
430
|
+
transform-origin: bottom center;
|
|
431
|
+
z-index: 1;
|
|
432
|
+
pointer-events: none;
|
|
433
|
+
transition: transform var(--speed3) var(--ease-standard), height var(--speed3) var(--ease-standard);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/* Hand tip circle selection inside the hand */
|
|
437
|
+
.clock-hand-selector {
|
|
438
|
+
position: absolute;
|
|
439
|
+
top: 0;
|
|
440
|
+
left: 50%;
|
|
441
|
+
width: 3rem;
|
|
442
|
+
height: 3rem;
|
|
443
|
+
border-radius: 50%;
|
|
444
|
+
background-color: var(--primary);
|
|
445
|
+
opacity: 0.3;
|
|
446
|
+
transform: translate(-50%, -50%) scale(1);
|
|
447
|
+
z-index: 1;
|
|
448
|
+
pointer-events: none;
|
|
449
|
+
transition: transform var(--speed2) var(--ease-standard);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/* Disable transition during active drag but keep scale transform animation */
|
|
453
|
+
.clock-face.dragging .clock-hand,
|
|
454
|
+
.clock-face:active .clock-hand {
|
|
455
|
+
transition: none !important;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
/* Selector handle expands/grows when pressed or dragging */
|
|
459
|
+
.clock-face.dragging .clock-hand-selector,
|
|
460
|
+
.clock-face:active .clock-hand-selector {
|
|
461
|
+
transform: translate(-50%, -50%) scale(1.2);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.clock-hand-dot {
|
|
465
|
+
position: absolute;
|
|
466
|
+
left: calc(50% - 0.25rem);
|
|
467
|
+
top: -2rem;
|
|
468
|
+
width: 0.5rem;
|
|
469
|
+
height: 0.5rem;
|
|
470
|
+
border-radius: 50%;
|
|
471
|
+
background-color: var(--on-primary);
|
|
472
|
+
z-index: 2;
|
|
473
|
+
pointer-events: none;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
@keyframes numberEntrance {
|
|
477
|
+
from {
|
|
478
|
+
opacity: 0;
|
|
479
|
+
transform: translate(-50%, -50%) scale(0.85);
|
|
480
|
+
}
|
|
481
|
+
to {
|
|
482
|
+
opacity: 1;
|
|
483
|
+
transform: translate(-50%, -50%) scale(1);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/* Clock dial numbers */
|
|
488
|
+
.clock-number {
|
|
489
|
+
position: absolute;
|
|
490
|
+
width: 2.25rem;
|
|
491
|
+
height: 2.25rem;
|
|
492
|
+
display: flex;
|
|
493
|
+
align-items: center;
|
|
494
|
+
justify-content: center;
|
|
495
|
+
font-size: 0.875rem;
|
|
496
|
+
font-weight: 500;
|
|
497
|
+
color: var(--on-surface);
|
|
498
|
+
border-radius: 50%;
|
|
499
|
+
transform: translate(-50%, -50%);
|
|
500
|
+
transition: background-color var(--speed2), color var(--speed2);
|
|
501
|
+
z-index: 2;
|
|
502
|
+
pointer-events: auto;
|
|
503
|
+
cursor: pointer;
|
|
504
|
+
animation: numberEntrance var(--speed3) var(--ease-standard) forwards;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
.clock-number:hover {
|
|
508
|
+
background-color: var(--active);
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
.clock-number.selected {
|
|
512
|
+
background-color: var(--primary);
|
|
513
|
+
color: var(--on-primary);
|
|
514
|
+
font-weight: bold;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
.clock-number.selected:hover {
|
|
518
|
+
background-color: var(--primary);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
/* Manual Input Mode specific styling */
|
|
522
|
+
.input-labels {
|
|
523
|
+
display: flex;
|
|
524
|
+
justify-content: space-between;
|
|
525
|
+
gap: 0.75rem;
|
|
526
|
+
margin-top: -1rem;
|
|
527
|
+
margin-bottom: 1.5rem;
|
|
528
|
+
color: var(--on-surface-variant);
|
|
529
|
+
font-size: 0.75rem;
|
|
530
|
+
font-weight: 400;
|
|
531
|
+
padding-inline-end: 4rem; /* Leave room for AM/PM offset */
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
.input-labels > span {
|
|
535
|
+
flex: 1;
|
|
536
|
+
text-align: center;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
/* Bottom bar */
|
|
540
|
+
.bottom-actions {
|
|
541
|
+
display: flex;
|
|
542
|
+
justify-content: space-between;
|
|
543
|
+
align-items: center;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
.mode-toggle-btn {
|
|
547
|
+
background: none;
|
|
548
|
+
border: none;
|
|
549
|
+
color: var(--primary);
|
|
550
|
+
cursor: pointer;
|
|
551
|
+
padding: 0.5rem;
|
|
552
|
+
display: flex;
|
|
553
|
+
align-items: center;
|
|
554
|
+
justify-content: center;
|
|
555
|
+
border-radius: 50%;
|
|
556
|
+
transition: background-color var(--speed1);
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
.mode-toggle-btn:hover {
|
|
560
|
+
background-color: var(--active);
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
.action-buttons {
|
|
564
|
+
display: flex;
|
|
565
|
+
gap: 0.5rem;
|
|
566
|
+
}
|
|
567
|
+
`
|
|
568
|
+
]; }
|
|
569
|
+
renderDialClockFace() {
|
|
570
|
+
const isHour = this.activeSelection === 'hour';
|
|
571
|
+
let degrees = 0;
|
|
572
|
+
let handLength = '6.25rem';
|
|
573
|
+
if (isHour) {
|
|
574
|
+
let h = this.currentHour;
|
|
575
|
+
if (!this.use24Hour) {
|
|
576
|
+
if (h > 12)
|
|
577
|
+
h -= 12;
|
|
578
|
+
if (h === 0)
|
|
579
|
+
h = 12;
|
|
580
|
+
degrees = h * 30;
|
|
581
|
+
}
|
|
582
|
+
else {
|
|
583
|
+
// 24 hour mode
|
|
584
|
+
if (h > 12 || h === 0) {
|
|
585
|
+
// Outer circle: 13-00
|
|
586
|
+
const outerHour = h === 0 ? 12 : h > 12 ? h - 12 : h;
|
|
587
|
+
degrees = outerHour * 30;
|
|
588
|
+
handLength = '6.5rem';
|
|
589
|
+
}
|
|
590
|
+
else {
|
|
591
|
+
// Inner circle: 1-12
|
|
592
|
+
degrees = h * 30;
|
|
593
|
+
handLength = '4.5rem';
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
else {
|
|
598
|
+
degrees = this.currentMinute * 6;
|
|
599
|
+
}
|
|
600
|
+
// Calculate numbers placement
|
|
601
|
+
const numbers = [];
|
|
602
|
+
const r = 16 * 16; // 16rem = 256px
|
|
603
|
+
const center = r / 2;
|
|
604
|
+
if (isHour) {
|
|
605
|
+
if (this.use24Hour) {
|
|
606
|
+
// Outer circle: 13-00
|
|
607
|
+
const outerRadius = center - 24;
|
|
608
|
+
for (let i = 1; i <= 12; i++) {
|
|
609
|
+
const hVal = i === 12 ? 0 : i + 12;
|
|
610
|
+
const angle = (i * 30 - 90) * (Math.PI / 180);
|
|
611
|
+
const x = center + outerRadius * Math.cos(angle);
|
|
612
|
+
const y = center + outerRadius * Math.sin(angle);
|
|
613
|
+
numbers.push({
|
|
614
|
+
val: hVal,
|
|
615
|
+
label: String(hVal === 0 ? '00' : hVal),
|
|
616
|
+
x: `${x / 16}rem`,
|
|
617
|
+
y: `${y / 16}rem`,
|
|
618
|
+
selected: this.currentHour === hVal
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
// Inner circle: 1-12
|
|
622
|
+
const innerRadius = center - 56;
|
|
623
|
+
for (let i = 1; i <= 12; i++) {
|
|
624
|
+
const angle = (i * 30 - 90) * (Math.PI / 180);
|
|
625
|
+
const x = center + innerRadius * Math.cos(angle);
|
|
626
|
+
const y = center + innerRadius * Math.sin(angle);
|
|
627
|
+
numbers.push({
|
|
628
|
+
val: i,
|
|
629
|
+
label: String(i),
|
|
630
|
+
x: `${x / 16}rem`,
|
|
631
|
+
y: `${y / 16}rem`,
|
|
632
|
+
selected: this.currentHour === i
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
else {
|
|
637
|
+
// 12-hour: 1-12
|
|
638
|
+
const radius = center - 28;
|
|
639
|
+
for (let i = 1; i <= 12; i++) {
|
|
640
|
+
const angle = (i * 30 - 90) * (Math.PI / 180);
|
|
641
|
+
const x = center + radius * Math.cos(angle);
|
|
642
|
+
const y = center + radius * Math.sin(angle);
|
|
643
|
+
let hVal = this.currentHour;
|
|
644
|
+
if (hVal > 12)
|
|
645
|
+
hVal -= 12;
|
|
646
|
+
if (hVal === 0)
|
|
647
|
+
hVal = 12;
|
|
648
|
+
numbers.push({
|
|
649
|
+
val: i,
|
|
650
|
+
label: String(i),
|
|
651
|
+
x: `${x / 16}rem`,
|
|
652
|
+
y: `${y / 16}rem`,
|
|
653
|
+
selected: hVal === i
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
else {
|
|
659
|
+
// Minutes: 0, 5, 10... 55
|
|
660
|
+
const radius = center - 28;
|
|
661
|
+
for (let i = 0; i < 12; i++) {
|
|
662
|
+
const mVal = i * 5;
|
|
663
|
+
const angle = (i * 30 - 90) * (Math.PI / 180);
|
|
664
|
+
const x = center + radius * Math.cos(angle);
|
|
665
|
+
const y = center + radius * Math.sin(angle);
|
|
666
|
+
numbers.push({
|
|
667
|
+
val: mVal,
|
|
668
|
+
label: String(mVal).padStart(2, '0'),
|
|
669
|
+
x: `${x / 16}rem`,
|
|
670
|
+
y: `${y / 16}rem`,
|
|
671
|
+
selected: this.currentMinute === mVal
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
return html `
|
|
676
|
+
<div class="clock-container">
|
|
677
|
+
<div
|
|
678
|
+
class="clock-face"
|
|
679
|
+
@pointerdown=${this.handleClockPointerDown}
|
|
680
|
+
@pointermove=${this.handleClockPointerMove}
|
|
681
|
+
@pointerup=${this.handleClockPointerUp}
|
|
682
|
+
@pointercancel=${this.handleClockPointerUp}
|
|
683
|
+
>
|
|
684
|
+
<div class="clock-center"></div>
|
|
685
|
+
<div
|
|
686
|
+
class="clock-hand"
|
|
687
|
+
style="transform: rotate(${degrees}deg); height: ${handLength};"
|
|
688
|
+
>
|
|
689
|
+
<div class="clock-hand-selector"></div>
|
|
690
|
+
${isHour && this.use24Hour && this.currentHour <= 12 && this.currentHour > 0
|
|
691
|
+
? html `<div class="clock-hand-dot"></div>`
|
|
692
|
+
: ''}
|
|
693
|
+
</div>
|
|
694
|
+
${numbers.map((n) => html `
|
|
695
|
+
<div
|
|
696
|
+
class="clock-number ${n.selected ? 'selected' : ''}"
|
|
697
|
+
style="left: ${n.x}; top: ${n.y};"
|
|
698
|
+
>
|
|
699
|
+
${n.label}
|
|
700
|
+
</div>
|
|
701
|
+
`)}
|
|
702
|
+
</div>
|
|
703
|
+
</div>
|
|
704
|
+
`;
|
|
705
|
+
}
|
|
706
|
+
render() {
|
|
707
|
+
const hourVal = !this.use24Hour
|
|
708
|
+
? String(this.currentHour > 12 ? this.currentHour - 12 : this.currentHour === 0 ? 12 : this.currentHour).padStart(2, '0')
|
|
709
|
+
: String(this.currentHour).padStart(2, '0');
|
|
710
|
+
const minuteVal = String(this.currentMinute).padStart(2, '0');
|
|
711
|
+
return html `
|
|
712
|
+
<div class="main-content">
|
|
713
|
+
<div class="left-pane">
|
|
714
|
+
<div class="picker-header">
|
|
715
|
+
${this.mode === 'dial' ? 'Select time' : 'Enter time'}
|
|
716
|
+
</div>
|
|
717
|
+
|
|
718
|
+
<div class="time-display-container">
|
|
719
|
+
<div class="time-display">
|
|
720
|
+
<div
|
|
721
|
+
class="display-box ${this.activeSelection === 'hour' ? 'active' : ''}"
|
|
722
|
+
@click=${() => this.setSelection('hour')}
|
|
723
|
+
>
|
|
724
|
+
${this.mode === 'input'
|
|
725
|
+
? html `<input
|
|
726
|
+
type="number"
|
|
727
|
+
.value=${hourVal}
|
|
728
|
+
@change=${this.handleHourInputChange}
|
|
729
|
+
min=${this.use24Hour ? 0 : 1}
|
|
730
|
+
max=${this.use24Hour ? 23 : 12}
|
|
731
|
+
/>`
|
|
732
|
+
: hourVal}
|
|
733
|
+
</div>
|
|
734
|
+
<div class="separator">:</div>
|
|
735
|
+
<div
|
|
736
|
+
class="display-box ${this.activeSelection === 'minute' ? 'active' : ''}"
|
|
737
|
+
@click=${() => this.setSelection('minute')}
|
|
738
|
+
>
|
|
739
|
+
${this.mode === 'input'
|
|
740
|
+
? html `<input
|
|
741
|
+
type="number"
|
|
742
|
+
.value=${minuteVal}
|
|
743
|
+
@change=${this.handleMinuteInputChange}
|
|
744
|
+
min="0"
|
|
745
|
+
max="59"
|
|
746
|
+
/>`
|
|
747
|
+
: minuteVal}
|
|
748
|
+
</div>
|
|
749
|
+
</div>
|
|
750
|
+
|
|
751
|
+
${!this.use24Hour
|
|
752
|
+
? html `
|
|
753
|
+
<div class="ampm-toggle">
|
|
754
|
+
<button
|
|
755
|
+
class="ampm-btn ${this.period === 'AM' ? 'active' : ''}"
|
|
756
|
+
@click=${() => this.setPeriod('AM')}
|
|
757
|
+
>
|
|
758
|
+
AM
|
|
759
|
+
</button>
|
|
760
|
+
<button
|
|
761
|
+
class="ampm-btn ${this.period === 'PM' ? 'active' : ''}"
|
|
762
|
+
@click=${() => this.setPeriod('PM')}
|
|
763
|
+
>
|
|
764
|
+
PM
|
|
765
|
+
</button>
|
|
766
|
+
</div>
|
|
767
|
+
`
|
|
768
|
+
: ''}
|
|
769
|
+
</div>
|
|
770
|
+
|
|
771
|
+
${this.mode === 'input'
|
|
772
|
+
? html `
|
|
773
|
+
<div class="input-labels">
|
|
774
|
+
<span>Hour</span>
|
|
775
|
+
<span>Minute</span>
|
|
776
|
+
</div>
|
|
777
|
+
`
|
|
778
|
+
: ''}
|
|
779
|
+
</div>
|
|
780
|
+
|
|
781
|
+
${this.mode === 'dial' ? this.renderDialClockFace() : ''}
|
|
782
|
+
</div>
|
|
783
|
+
|
|
784
|
+
<div class="bottom-actions">
|
|
785
|
+
<button class="mode-toggle-btn" @click=${this.toggleMode} aria-label="Toggle input mode">
|
|
786
|
+
<moni-icon name=${this.mode === 'dial' ? 'keyboard' : 'schedule'}></moni-icon>
|
|
787
|
+
</button>
|
|
788
|
+
</div>
|
|
789
|
+
`;
|
|
790
|
+
}
|
|
791
|
+
};
|
|
792
|
+
__decorate([
|
|
793
|
+
property({ reflect: true })
|
|
794
|
+
], MoniTimePicker.prototype, "value", void 0);
|
|
795
|
+
__decorate([
|
|
796
|
+
property({ type: Boolean, reflect: true, attribute: 'use-24-hour' })
|
|
797
|
+
], MoniTimePicker.prototype, "use24Hour", void 0);
|
|
798
|
+
__decorate([
|
|
799
|
+
property({ reflect: true })
|
|
800
|
+
], MoniTimePicker.prototype, "mode", void 0);
|
|
801
|
+
__decorate([
|
|
802
|
+
property({ reflect: true })
|
|
803
|
+
], MoniTimePicker.prototype, "orientation", void 0);
|
|
804
|
+
__decorate([
|
|
805
|
+
state()
|
|
806
|
+
], MoniTimePicker.prototype, "activeSelection", void 0);
|
|
807
|
+
__decorate([
|
|
808
|
+
state()
|
|
809
|
+
], MoniTimePicker.prototype, "period", void 0);
|
|
810
|
+
__decorate([
|
|
811
|
+
state()
|
|
812
|
+
], MoniTimePicker.prototype, "currentHour", void 0);
|
|
813
|
+
__decorate([
|
|
814
|
+
state()
|
|
815
|
+
], MoniTimePicker.prototype, "currentMinute", void 0);
|
|
816
|
+
__decorate([
|
|
817
|
+
query('.clock-face')
|
|
818
|
+
], MoniTimePicker.prototype, "clockFaceEl", void 0);
|
|
819
|
+
MoniTimePicker = __decorate([
|
|
820
|
+
customElement('moni-time-picker')
|
|
821
|
+
], MoniTimePicker);
|
|
822
|
+
export { MoniTimePicker };
|
|
823
|
+
export default MoniTimePicker;
|