@moni-labs/moni-ui 0.2.0 → 0.3.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/README.md +52 -194
- package/custom-elements.json +1636 -350
- package/dist/actions/index.d.ts +6 -0
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/index.js +6 -0
- package/dist/components/_base/field-styles.d.ts +51 -16
- package/dist/components/_base/field-styles.d.ts.map +1 -1
- package/dist/components/_base/field-styles.js +164 -36
- package/dist/components/_base/index.d.ts +25 -0
- package/dist/components/_base/index.d.ts.map +1 -1
- package/dist/components/_base/index.js +25 -0
- package/dist/components/_base/interaction-styles.d.ts +39 -12
- package/dist/components/_base/interaction-styles.d.ts.map +1 -1
- package/dist/components/_base/interaction-styles.js +85 -33
- package/dist/components/_base/moni-element.d.ts +43 -8
- package/dist/components/_base/moni-element.d.ts.map +1 -1
- package/dist/components/_base/moni-element.js +43 -8
- package/dist/components/_base/shared-styles.d.ts +41 -17
- package/dist/components/_base/shared-styles.d.ts.map +1 -1
- package/dist/components/_base/shared-styles.js +113 -21
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +6 -0
- package/dist/components/loading-shapes.d.ts +6 -0
- package/dist/components/loading-shapes.d.ts.map +1 -1
- package/dist/components/loading-shapes.js +6 -0
- package/dist/components/moni-app-bar.d.ts +128 -33
- package/dist/components/moni-app-bar.d.ts.map +1 -1
- package/dist/components/moni-app-bar.js +121 -26
- package/dist/components/moni-badge.d.ts +122 -14
- package/dist/components/moni-badge.d.ts.map +1 -1
- package/dist/components/moni-badge.js +122 -14
- package/dist/components/moni-bottom-sheet.d.ts +120 -15
- package/dist/components/moni-bottom-sheet.d.ts.map +1 -1
- package/dist/components/moni-bottom-sheet.js +116 -12
- package/dist/components/moni-button-group.d.ts +53 -27
- package/dist/components/moni-button-group.d.ts.map +1 -1
- package/dist/components/moni-button-group.js +49 -23
- package/dist/components/moni-button-segment.d.ts +28 -8
- package/dist/components/moni-button-segment.d.ts.map +1 -1
- package/dist/components/moni-button-segment.js +27 -7
- package/dist/components/moni-button.d.ts +51 -32
- package/dist/components/moni-button.d.ts.map +1 -1
- package/dist/components/moni-button.js +50 -31
- package/dist/components/moni-card.d.ts +91 -31
- package/dist/components/moni-card.d.ts.map +1 -1
- package/dist/components/moni-card.js +86 -26
- package/dist/components/moni-carousel.d.ts +67 -17
- package/dist/components/moni-carousel.d.ts.map +1 -1
- package/dist/components/moni-carousel.js +59 -16
- package/dist/components/moni-checkbox.d.ts +122 -17
- package/dist/components/moni-checkbox.d.ts.map +1 -1
- package/dist/components/moni-checkbox.js +118 -14
- package/dist/components/moni-chip.d.ts +56 -30
- package/dist/components/moni-chip.d.ts.map +1 -1
- package/dist/components/moni-chip.js +51 -25
- package/dist/components/moni-color-field.d.ts +44 -6
- package/dist/components/moni-color-field.d.ts.map +1 -1
- package/dist/components/moni-color-field.js +43 -5
- package/dist/components/moni-context-menu.d.ts +44 -22
- package/dist/components/moni-context-menu.d.ts.map +1 -1
- package/dist/components/moni-context-menu.js +43 -21
- package/dist/components/moni-dialog.d.ts +107 -15
- package/dist/components/moni-dialog.d.ts.map +1 -1
- package/dist/components/moni-dialog.js +105 -14
- package/dist/components/moni-divider.d.ts +50 -15
- package/dist/components/moni-divider.d.ts.map +1 -1
- package/dist/components/moni-divider.js +49 -14
- package/dist/components/moni-expansion.d.ts +44 -8
- package/dist/components/moni-expansion.d.ts.map +1 -1
- package/dist/components/moni-expansion.js +43 -7
- package/dist/components/moni-fab-menu.d.ts +39 -20
- package/dist/components/moni-fab-menu.d.ts.map +1 -1
- package/dist/components/moni-fab-menu.js +38 -19
- package/dist/components/moni-fab.d.ts +49 -23
- package/dist/components/moni-fab.d.ts.map +1 -1
- package/dist/components/moni-fab.js +46 -20
- package/dist/components/moni-file-field.d.ts +54 -14
- package/dist/components/moni-file-field.d.ts.map +1 -1
- package/dist/components/moni-file-field.js +53 -13
- package/dist/components/moni-icon.d.ts +78 -11
- package/dist/components/moni-icon.d.ts.map +1 -1
- package/dist/components/moni-icon.js +77 -10
- package/dist/components/moni-list-item.d.ts +61 -30
- package/dist/components/moni-list-item.d.ts.map +1 -1
- package/dist/components/moni-list-item.js +55 -24
- package/dist/components/moni-list.d.ts +37 -13
- package/dist/components/moni-list.d.ts.map +1 -1
- package/dist/components/moni-list.js +36 -12
- package/dist/components/moni-loading-indicator.d.ts +38 -11
- package/dist/components/moni-loading-indicator.d.ts.map +1 -1
- package/dist/components/moni-loading-indicator.js +37 -10
- package/dist/components/moni-menu-item.d.ts +31 -8
- package/dist/components/moni-menu-item.d.ts.map +1 -1
- package/dist/components/moni-menu-item.js +30 -7
- package/dist/components/moni-menu.d.ts +58 -33
- package/dist/components/moni-menu.d.ts.map +1 -1
- package/dist/components/moni-menu.js +51 -26
- package/dist/components/moni-morph-modal.d.ts +7 -1
- package/dist/components/moni-morph-modal.d.ts.map +1 -1
- package/dist/components/moni-morph-modal.js +46 -24
- package/dist/components/moni-nav-item.d.ts +50 -10
- package/dist/components/moni-nav-item.d.ts.map +1 -1
- package/dist/components/moni-nav-item.js +48 -8
- package/dist/components/moni-nav.d.ts +57 -22
- package/dist/components/moni-nav.d.ts.map +1 -1
- package/dist/components/moni-nav.js +53 -18
- package/dist/components/moni-progress.d.ts +108 -20
- package/dist/components/moni-progress.d.ts.map +1 -1
- package/dist/components/moni-progress.js +104 -16
- package/dist/components/moni-radio.d.ts +106 -14
- package/dist/components/moni-radio.d.ts.map +1 -1
- package/dist/components/moni-radio.js +104 -13
- package/dist/components/moni-ripple.d.ts +121 -10
- package/dist/components/moni-ripple.d.ts.map +1 -1
- package/dist/components/moni-ripple.js +120 -9
- package/dist/components/moni-segmented-button.d.ts +31 -11
- package/dist/components/moni-segmented-button.d.ts.map +1 -1
- package/dist/components/moni-segmented-button.js +30 -10
- package/dist/components/moni-select-option.d.ts +43 -9
- package/dist/components/moni-select-option.d.ts.map +1 -1
- package/dist/components/moni-select-option.js +41 -7
- package/dist/components/moni-select.d.ts +59 -2
- package/dist/components/moni-select.d.ts.map +1 -1
- package/dist/components/moni-select.js +58 -1
- package/dist/components/moni-shape.d.ts +1 -1
- package/dist/components/moni-side-sheet.d.ts +56 -19
- package/dist/components/moni-side-sheet.d.ts.map +1 -1
- package/dist/components/moni-side-sheet.js +53 -16
- package/dist/components/moni-slider.d.ts +56 -25
- package/dist/components/moni-slider.d.ts.map +1 -1
- package/dist/components/moni-slider.js +55 -24
- package/dist/components/moni-snackbar.d.ts +86 -17
- package/dist/components/moni-snackbar.d.ts.map +1 -1
- package/dist/components/moni-snackbar.js +85 -16
- package/dist/components/moni-split-button.d.ts +38 -9
- package/dist/components/moni-split-button.d.ts.map +1 -1
- package/dist/components/moni-split-button.js +37 -8
- package/dist/components/moni-step.d.ts +42 -9
- package/dist/components/moni-step.d.ts.map +1 -1
- package/dist/components/moni-step.js +41 -8
- package/dist/components/moni-stepper.d.ts +43 -6
- package/dist/components/moni-stepper.d.ts.map +1 -1
- package/dist/components/moni-stepper.js +42 -5
- package/dist/components/moni-switch.d.ts +103 -16
- package/dist/components/moni-switch.d.ts.map +1 -1
- package/dist/components/moni-switch.js +99 -13
- package/dist/components/moni-tab.d.ts +35 -8
- package/dist/components/moni-tab.d.ts.map +1 -1
- package/dist/components/moni-tab.js +34 -7
- package/dist/components/moni-tabs.d.ts +51 -13
- package/dist/components/moni-tabs.d.ts.map +1 -1
- package/dist/components/moni-tabs.js +48 -10
- package/dist/components/moni-text-field.d.ts +55 -10
- package/dist/components/moni-text-field.d.ts.map +1 -1
- package/dist/components/moni-text-field.js +54 -9
- package/dist/components/moni-textarea.d.ts +51 -21
- package/dist/components/moni-textarea.d.ts.map +1 -1
- package/dist/components/moni-textarea.js +48 -18
- package/dist/components/moni-time-picker.d.ts +41 -11
- package/dist/components/moni-time-picker.d.ts.map +1 -1
- package/dist/components/moni-time-picker.js +40 -10
- package/dist/components/moni-toolbar.d.ts +43 -15
- package/dist/components/moni-toolbar.d.ts.map +1 -1
- package/dist/components/moni-toolbar.js +42 -14
- package/dist/components/moni-tooltip.d.ts +55 -25
- package/dist/components/moni-tooltip.d.ts.map +1 -1
- package/dist/components/moni-tooltip.js +54 -24
- package/dist/components/moni-typography.d.ts +43 -18
- package/dist/components/moni-typography.d.ts.map +1 -1
- package/dist/components/moni-typography.js +42 -17
- package/dist/index.d.ts +47 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +59 -2
- package/dist/styles/tailwind.css +67 -0
- package/dist/styles/tokens.css +111 -99
- package/dist/utils/color.d.ts +181 -2
- package/dist/utils/color.d.ts.map +1 -1
- package/dist/utils/color.js +182 -4
- package/dist/utils/theme.svelte.d.ts +305 -2
- package/dist/utils/theme.svelte.d.ts.map +1 -1
- package/dist/utils/theme.svelte.js +331 -2
- package/dist/web-components.d.ts +28 -0
- package/dist/web-components.d.ts.map +1 -1
- package/dist/web-components.js +29 -2
- package/package.json +1 -1
- package/src/actions/index.ts +7 -0
- package/src/components/_base/field-styles.ts +165 -37
- package/src/components/_base/index.ts +27 -0
- package/src/components/_base/interaction-styles.ts +86 -33
- package/src/components/_base/moni-element.ts +44 -8
- package/src/components/_base/shared-styles.ts +114 -21
- package/src/components/index.ts +7 -0
- package/src/components/loading-shapes.ts +7 -0
- package/src/components/moni-app-bar.ts +127 -26
- package/src/components/moni-badge.ts +128 -14
- package/src/components/moni-bottom-sheet.ts +125 -13
- package/src/components/moni-button-group.ts +50 -23
- package/src/components/moni-button-segment.ts +28 -7
- package/src/components/moni-button.ts +51 -31
- package/src/components/moni-card.ts +90 -26
- package/src/components/moni-carousel.ts +67 -16
- package/src/components/moni-checkbox.ts +125 -14
- package/src/components/moni-chip.ts +52 -25
- package/src/components/moni-color-field.ts +44 -5
- package/src/components/moni-context-menu.ts +44 -21
- package/src/components/moni-dialog.ts +111 -14
- package/src/components/moni-divider.ts +50 -14
- package/src/components/moni-expansion.ts +44 -7
- package/src/components/moni-fab-menu.ts +39 -19
- package/src/components/moni-fab.ts +47 -20
- package/src/components/moni-file-field.ts +54 -13
- package/src/components/moni-icon.ts +80 -10
- package/src/components/moni-list-item.ts +56 -24
- package/src/components/moni-list.ts +37 -12
- package/src/components/moni-loading-indicator.ts +38 -10
- package/src/components/moni-menu-item.ts +31 -7
- package/src/components/moni-menu.ts +52 -26
- package/src/components/moni-morph-modal.ts +58 -24
- package/src/components/moni-nav-item.ts +49 -8
- package/src/components/moni-nav.ts +54 -18
- package/src/components/moni-progress.ts +109 -16
- package/src/components/moni-radio.ts +111 -13
- package/src/components/moni-ripple.ts +126 -9
- package/src/components/moni-segmented-button.ts +31 -10
- package/src/components/moni-select-option.ts +42 -7
- package/src/components/moni-select.ts +79 -1
- package/src/components/moni-side-sheet.ts +54 -16
- package/src/components/moni-slider.ts +56 -24
- package/src/components/moni-snackbar.ts +90 -16
- package/src/components/moni-split-button.ts +38 -8
- package/src/components/moni-step.ts +42 -8
- package/src/components/moni-stepper.ts +43 -5
- package/src/components/moni-switch.ts +106 -13
- package/src/components/moni-tab.ts +35 -7
- package/src/components/moni-tabs.ts +49 -10
- package/src/components/moni-text-field.ts +55 -9
- package/src/components/moni-textarea.ts +49 -18
- package/src/components/moni-time-picker.ts +41 -10
- package/src/components/moni-toolbar.ts +43 -14
- package/src/components/moni-tooltip.ts +55 -24
- package/src/components/moni-typography.ts +43 -17
- package/src/index.ts +67 -3
- package/src/styles/tailwind.css +67 -0
- package/src/styles/tokens.css +111 -99
- package/src/types/svelte-runes.d.ts +64 -2
- package/src/utils/color.ts +286 -5
- package/src/utils/theme.svelte.ts +411 -2
- package/src/web-components.ts +31 -2
- package/dist/assets/shapes/arch.svg +0 -1
- package/dist/assets/shapes/arrow.svg +0 -1
- package/dist/assets/shapes/boom.svg +0 -1
- package/dist/assets/shapes/burst.svg +0 -1
- package/dist/assets/shapes/circle.svg +0 -1
- package/dist/assets/shapes/clamshell.svg +0 -1
- package/dist/assets/shapes/diamond.svg +0 -1
- package/dist/assets/shapes/fan.svg +0 -1
- package/dist/assets/shapes/flower.svg +0 -1
- package/dist/assets/shapes/gem.svg +0 -1
- package/dist/assets/shapes/ghost-ish.svg +0 -1
- package/dist/assets/shapes/heart.svg +0 -1
- package/dist/assets/shapes/leaf-clover4.svg +0 -1
- package/dist/assets/shapes/leaf-clover8.svg +0 -1
- package/dist/assets/shapes/loading-indicator.svg +0 -1
- package/dist/assets/shapes/oval.svg +0 -1
- package/dist/assets/shapes/pentagon.svg +0 -1
- package/dist/assets/shapes/pill.svg +0 -1
- package/dist/assets/shapes/pixel-circle.svg +0 -1
- package/dist/assets/shapes/pixel-triangle.svg +0 -1
- package/dist/assets/shapes/puffy-diamond.svg +0 -1
- package/dist/assets/shapes/puffy.svg +0 -1
- package/dist/assets/shapes/semicircle.svg +0 -1
- package/dist/assets/shapes/sided-cookie12.svg +0 -1
- package/dist/assets/shapes/sided-cookie4.svg +0 -1
- package/dist/assets/shapes/sided-cookie6.svg +0 -1
- package/dist/assets/shapes/sided-cookie7.svg +0 -1
- package/dist/assets/shapes/sided-cookie9.svg +0 -1
- package/dist/assets/shapes/slanted.svg +0 -1
- package/dist/assets/shapes/soft-boom.svg +0 -1
- package/dist/assets/shapes/soft-burst.svg +0 -1
- package/dist/assets/shapes/square.svg +0 -1
- package/dist/assets/shapes/sunny.svg +0 -1
- package/dist/assets/shapes/triangle.svg +0 -1
- package/dist/assets/shapes/very-sunny.svg +0 -1
- package/dist/assets/shapes/wavy-circle.svg +0 -1
- package/dist/assets/shapes/wavy.svg +0 -1
- package/src/assets/shapes/arch.svg +0 -1
- package/src/assets/shapes/arrow.svg +0 -1
- package/src/assets/shapes/boom.svg +0 -1
- package/src/assets/shapes/burst.svg +0 -1
- package/src/assets/shapes/circle.svg +0 -1
- package/src/assets/shapes/clamshell.svg +0 -1
- package/src/assets/shapes/diamond.svg +0 -1
- package/src/assets/shapes/fan.svg +0 -1
- package/src/assets/shapes/flower.svg +0 -1
- package/src/assets/shapes/gem.svg +0 -1
- package/src/assets/shapes/ghost-ish.svg +0 -1
- package/src/assets/shapes/heart.svg +0 -1
- package/src/assets/shapes/leaf-clover4.svg +0 -1
- package/src/assets/shapes/leaf-clover8.svg +0 -1
- package/src/assets/shapes/loading-indicator.svg +0 -1
- package/src/assets/shapes/oval.svg +0 -1
- package/src/assets/shapes/pentagon.svg +0 -1
- package/src/assets/shapes/pill.svg +0 -1
- package/src/assets/shapes/pixel-circle.svg +0 -1
- package/src/assets/shapes/pixel-triangle.svg +0 -1
- package/src/assets/shapes/puffy-diamond.svg +0 -1
- package/src/assets/shapes/puffy.svg +0 -1
- package/src/assets/shapes/semicircle.svg +0 -1
- package/src/assets/shapes/sided-cookie12.svg +0 -1
- package/src/assets/shapes/sided-cookie4.svg +0 -1
- package/src/assets/shapes/sided-cookie6.svg +0 -1
- package/src/assets/shapes/sided-cookie7.svg +0 -1
- package/src/assets/shapes/sided-cookie9.svg +0 -1
- package/src/assets/shapes/slanted.svg +0 -1
- package/src/assets/shapes/soft-boom.svg +0 -1
- package/src/assets/shapes/soft-burst.svg +0 -1
- package/src/assets/shapes/square.svg +0 -1
- package/src/assets/shapes/sunny.svg +0 -1
- package/src/assets/shapes/triangle.svg +0 -1
- package/src/assets/shapes/very-sunny.svg +0 -1
- package/src/assets/shapes/wavy-circle.svg +0 -1
- package/src/assets/shapes/wavy.svg +0 -1
|
@@ -1,35 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-snackbar.ts
|
|
3
|
+
* @package @moni-labs/moni-ui
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @contributors Moni Labs & Contributors
|
|
6
|
+
*/
|
|
1
7
|
import { MoniElement } from './_base/index.js';
|
|
2
8
|
import './moni-icon.js';
|
|
3
9
|
/**
|
|
4
|
-
*
|
|
10
|
+
* Material Design 3 Snackbar component.
|
|
11
|
+
*
|
|
12
|
+
* Snackbars provide brief messages about app processes at the bottom of the
|
|
13
|
+
* screen. They disappear automatically and do not require user action,
|
|
14
|
+
* but may contain a single optional action.
|
|
15
|
+
*
|
|
16
|
+
* **M3 spec reference:** `m3-docs/components/snackbar/specs.md`
|
|
17
|
+
*
|
|
18
|
+
* **Positioning model:**
|
|
19
|
+
* The snackbar uses `position: fixed` so it renders in the viewport
|
|
20
|
+
* regardless of which element it is placed in the DOM. The host element
|
|
21
|
+
* displays as `block` rather than `contents` to ensure `position: fixed`
|
|
22
|
+
* inside the shadow root anchors to the viewport (not to a stacking context
|
|
23
|
+
* created by a transformed ancestor).
|
|
24
|
+
*
|
|
25
|
+
* **Show/hide mechanism:**
|
|
26
|
+
* Visibility is controlled by `:host([active]) .snackbar` via CSS
|
|
27
|
+
* `opacity`, `visibility`, and `transform`. This mirrors BeerCSS's
|
|
28
|
+
* `.snackbar.active` pattern and allows CSS transition animations.
|
|
29
|
+
*
|
|
30
|
+
* **M3 text truncation:**
|
|
31
|
+
* The message text is clamped to `maxLines` lines with `-webkit-line-clamp`.
|
|
32
|
+
* The M3 spec requires a maximum of 2 lines; consumers can override this
|
|
33
|
+
* via the `max-lines` attribute.
|
|
5
34
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const snackbar = document.querySelector('moni-snackbar') as MoniSnackbar;
|
|
8
38
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
39
|
+
* // Show for 3 seconds
|
|
40
|
+
* snackbar.text = 'Item deleted';
|
|
41
|
+
* snackbar.action = 'Undo';
|
|
42
|
+
* snackbar.active = true;
|
|
43
|
+
* setTimeout(() => { snackbar.active = false; }, 3000);
|
|
44
|
+
* ```
|
|
12
45
|
*
|
|
13
|
-
*
|
|
14
|
-
* must truncate at **2 lines** with ellipsis when too long. The container
|
|
15
|
-
* width adapts to the screen size (full width on compact, 40% on expanded).
|
|
46
|
+
* @slot default - Additional content placed inside the snackbar container.
|
|
16
47
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* - placement: bottom (default) | top
|
|
21
|
-
* - active: present → visible
|
|
22
|
-
* - max-lines: 2 (default) | number — clamp text to N lines with ellipsis
|
|
48
|
+
* @csspart snackbar - The inner snackbar container element.
|
|
49
|
+
* @csspart text - The message text element.
|
|
50
|
+
* @csspart action - The action button element.
|
|
23
51
|
*/
|
|
24
52
|
export declare class MoniSnackbar extends MoniElement {
|
|
53
|
+
/**
|
|
54
|
+
* The main message text displayed in the snackbar.
|
|
55
|
+
*
|
|
56
|
+
* Clamped to `maxLines` lines. Long messages are truncated with `…`.
|
|
57
|
+
* Per M3 spec, keep messages short and informative (under 60 characters).
|
|
58
|
+
*
|
|
59
|
+
* @default ''
|
|
60
|
+
*/
|
|
25
61
|
text: string;
|
|
62
|
+
/**
|
|
63
|
+
* Label for the optional action button.
|
|
64
|
+
*
|
|
65
|
+
* When non-empty, renders a text button on the trailing edge of the snackbar.
|
|
66
|
+
* The component dispatches a `'action'` event when the action is clicked.
|
|
67
|
+
* This is a visual-only label — the consumer handles the action logic.
|
|
68
|
+
*
|
|
69
|
+
* @default ''
|
|
70
|
+
*/
|
|
26
71
|
action: string;
|
|
72
|
+
/**
|
|
73
|
+
* Vertical placement of the snackbar on the screen.
|
|
74
|
+
*
|
|
75
|
+
* - `'bottom'` (default) — Fixed 6rem from the bottom, centered horizontally.
|
|
76
|
+
* - `'top'` — Fixed 6rem from the top, centered horizontally.
|
|
77
|
+
*
|
|
78
|
+
* @default 'bottom'
|
|
79
|
+
*/
|
|
27
80
|
placement: 'bottom' | 'top';
|
|
81
|
+
/**
|
|
82
|
+
* When `true`, the snackbar is visible.
|
|
83
|
+
*
|
|
84
|
+
* Toggle this attribute to show/hide the snackbar. The CSS transition
|
|
85
|
+
* handles the fade-in/slide-up animation automatically.
|
|
86
|
+
* Consumers are responsible for implementing the auto-dismiss timer.
|
|
87
|
+
*
|
|
88
|
+
* @default false
|
|
89
|
+
*/
|
|
28
90
|
active: boolean;
|
|
29
|
-
/**
|
|
91
|
+
/**
|
|
92
|
+
* Maximum number of lines of message text before it is clamped.
|
|
93
|
+
*
|
|
94
|
+
* Uses `-webkit-line-clamp` with `display: -webkit-box` for cross-browser
|
|
95
|
+
* multi-line truncation. The M3 spec recommends a maximum of 2 lines.
|
|
96
|
+
*
|
|
97
|
+
* @default 2
|
|
98
|
+
*/
|
|
30
99
|
maxLines: number;
|
|
31
100
|
static styles: import("lit").CSSResult[];
|
|
32
|
-
render(): import("lit
|
|
101
|
+
render(): import("lit").TemplateResult<1>;
|
|
33
102
|
}
|
|
34
103
|
declare global {
|
|
35
104
|
interface HTMLElementTagNameMap {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moni-snackbar.d.ts","sourceRoot":"","sources":["../../src/components/moni-snackbar.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"moni-snackbar.d.ts","sourceRoot":"","sources":["../../src/components/moni-snackbar.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAC7D,OAAO,gBAAgB,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,qBACa,YAAa,SAAQ,WAAW;IAC5C;;;;;;;OAOG;IAC0B,IAAI,SAAM;IAEvC;;;;;;;;OAQG;IAC0B,MAAM,SAAM;IAEzC;;;;;;;OAOG;IAEH,SAAS,EAAE,QAAQ,GAAG,KAAK,CAAY;IAEvC;;;;;;;;OAQG;IACyC,MAAM,UAAS;IAE3D;;;;;;;OAOG;IAEH,QAAQ,SAAK;IAEb,OAAgB,MAAM,4BAmFpB;IAEO,MAAM;CAef;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,eAAe,EAAE,YAAY,CAAC;KAC9B;CACD;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-snackbar.ts
|
|
3
|
+
* @package @moni-labs/moni-ui
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @contributors Moni Labs & Contributors
|
|
6
|
+
*/
|
|
1
7
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
8
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
9
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -9,34 +15,97 @@ import { customElement, property } from 'lit/decorators.js';
|
|
|
9
15
|
import { MoniElement, sharedStyles } from './_base/index.js';
|
|
10
16
|
import './moni-icon.js';
|
|
11
17
|
/**
|
|
12
|
-
*
|
|
18
|
+
* Material Design 3 Snackbar component.
|
|
19
|
+
*
|
|
20
|
+
* Snackbars provide brief messages about app processes at the bottom of the
|
|
21
|
+
* screen. They disappear automatically and do not require user action,
|
|
22
|
+
* but may contain a single optional action.
|
|
23
|
+
*
|
|
24
|
+
* **M3 spec reference:** `m3-docs/components/snackbar/specs.md`
|
|
25
|
+
*
|
|
26
|
+
* **Positioning model:**
|
|
27
|
+
* The snackbar uses `position: fixed` so it renders in the viewport
|
|
28
|
+
* regardless of which element it is placed in the DOM. The host element
|
|
29
|
+
* displays as `block` rather than `contents` to ensure `position: fixed`
|
|
30
|
+
* inside the shadow root anchors to the viewport (not to a stacking context
|
|
31
|
+
* created by a transformed ancestor).
|
|
32
|
+
*
|
|
33
|
+
* **Show/hide mechanism:**
|
|
34
|
+
* Visibility is controlled by `:host([active]) .snackbar` via CSS
|
|
35
|
+
* `opacity`, `visibility`, and `transform`. This mirrors BeerCSS's
|
|
36
|
+
* `.snackbar.active` pattern and allows CSS transition animations.
|
|
37
|
+
*
|
|
38
|
+
* **M3 text truncation:**
|
|
39
|
+
* The message text is clamped to `maxLines` lines with `-webkit-line-clamp`.
|
|
40
|
+
* The M3 spec requires a maximum of 2 lines; consumers can override this
|
|
41
|
+
* via the `max-lines` attribute.
|
|
13
42
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* const snackbar = document.querySelector('moni-snackbar') as MoniSnackbar;
|
|
16
46
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
47
|
+
* // Show for 3 seconds
|
|
48
|
+
* snackbar.text = 'Item deleted';
|
|
49
|
+
* snackbar.action = 'Undo';
|
|
50
|
+
* snackbar.active = true;
|
|
51
|
+
* setTimeout(() => { snackbar.active = false; }, 3000);
|
|
52
|
+
* ```
|
|
20
53
|
*
|
|
21
|
-
*
|
|
22
|
-
* must truncate at **2 lines** with ellipsis when too long. The container
|
|
23
|
-
* width adapts to the screen size (full width on compact, 40% on expanded).
|
|
54
|
+
* @slot default - Additional content placed inside the snackbar container.
|
|
24
55
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* - placement: bottom (default) | top
|
|
29
|
-
* - active: present → visible
|
|
30
|
-
* - max-lines: 2 (default) | number — clamp text to N lines with ellipsis
|
|
56
|
+
* @csspart snackbar - The inner snackbar container element.
|
|
57
|
+
* @csspart text - The message text element.
|
|
58
|
+
* @csspart action - The action button element.
|
|
31
59
|
*/
|
|
32
60
|
let MoniSnackbar = class MoniSnackbar extends MoniElement {
|
|
33
61
|
constructor() {
|
|
34
62
|
super(...arguments);
|
|
63
|
+
/**
|
|
64
|
+
* The main message text displayed in the snackbar.
|
|
65
|
+
*
|
|
66
|
+
* Clamped to `maxLines` lines. Long messages are truncated with `…`.
|
|
67
|
+
* Per M3 spec, keep messages short and informative (under 60 characters).
|
|
68
|
+
*
|
|
69
|
+
* @default ''
|
|
70
|
+
*/
|
|
35
71
|
this.text = '';
|
|
72
|
+
/**
|
|
73
|
+
* Label for the optional action button.
|
|
74
|
+
*
|
|
75
|
+
* When non-empty, renders a text button on the trailing edge of the snackbar.
|
|
76
|
+
* The component dispatches a `'action'` event when the action is clicked.
|
|
77
|
+
* This is a visual-only label — the consumer handles the action logic.
|
|
78
|
+
*
|
|
79
|
+
* @default ''
|
|
80
|
+
*/
|
|
36
81
|
this.action = '';
|
|
82
|
+
/**
|
|
83
|
+
* Vertical placement of the snackbar on the screen.
|
|
84
|
+
*
|
|
85
|
+
* - `'bottom'` (default) — Fixed 6rem from the bottom, centered horizontally.
|
|
86
|
+
* - `'top'` — Fixed 6rem from the top, centered horizontally.
|
|
87
|
+
*
|
|
88
|
+
* @default 'bottom'
|
|
89
|
+
*/
|
|
37
90
|
this.placement = 'bottom';
|
|
91
|
+
/**
|
|
92
|
+
* When `true`, the snackbar is visible.
|
|
93
|
+
*
|
|
94
|
+
* Toggle this attribute to show/hide the snackbar. The CSS transition
|
|
95
|
+
* handles the fade-in/slide-up animation automatically.
|
|
96
|
+
* Consumers are responsible for implementing the auto-dismiss timer.
|
|
97
|
+
*
|
|
98
|
+
* @default false
|
|
99
|
+
*/
|
|
38
100
|
this.active = false;
|
|
39
|
-
/**
|
|
101
|
+
/**
|
|
102
|
+
* Maximum number of lines of message text before it is clamped.
|
|
103
|
+
*
|
|
104
|
+
* Uses `-webkit-line-clamp` with `display: -webkit-box` for cross-browser
|
|
105
|
+
* multi-line truncation. The M3 spec recommends a maximum of 2 lines.
|
|
106
|
+
*
|
|
107
|
+
* @default 2
|
|
108
|
+
*/
|
|
40
109
|
this.maxLines = 2;
|
|
41
110
|
}
|
|
42
111
|
static { this.styles = [
|
|
@@ -1,15 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-split-button.ts
|
|
3
|
+
* @package @moni-labs/moni-ui
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @contributors Moni Labs & Contributors
|
|
6
|
+
*/
|
|
1
7
|
import { MoniElement } from './_base/index.js';
|
|
2
8
|
/**
|
|
3
|
-
*
|
|
9
|
+
* Material Design 3 Split Button component.
|
|
10
|
+
*
|
|
11
|
+
* A split button combines a primary action button with a secondary dropdown
|
|
12
|
+
* button. The two buttons sit flush against each other, typically sharing
|
|
13
|
+
* a background color and elevation, but separated by a distinct border.
|
|
14
|
+
*
|
|
15
|
+
* **Visual architecture:**
|
|
16
|
+
* The component acts as a layout container (`display: inline-flex`) that
|
|
17
|
+
* groups two standard buttons. It overrides the margins of the trailing
|
|
18
|
+
* button to create the "connected" look (similar to connected button groups).
|
|
19
|
+
*
|
|
20
|
+
* **Usage:**
|
|
21
|
+
* Consumers must provide exactly two buttons via the named slots:
|
|
22
|
+
* - `slot="leading-button"` — The primary action (usually text or text+icon).
|
|
23
|
+
* - `slot="trailing-button"` — The secondary action (usually just a dropdown icon).
|
|
24
|
+
*
|
|
25
|
+
* Both buttons should be standard `<moni-button>` or `<moni-icon-button>`
|
|
26
|
+
* elements configured with matching variants for a cohesive appearance.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```html
|
|
30
|
+
* <moni-split-button variant="filled">
|
|
31
|
+
* <moni-button slot="leading-button" icon="send">Send</moni-button>
|
|
32
|
+
* <moni-button slot="trailing-button" icon="arrow_drop_down" id="schedule-trigger"></moni-button>
|
|
33
|
+
* </moni-split-button>
|
|
4
34
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
35
|
+
* <moni-menu id="schedule-menu" placement="bottom">
|
|
36
|
+
* <moni-menu-item>Schedule send...</moni-menu-item>
|
|
37
|
+
* </moni-menu>
|
|
38
|
+
* ```
|
|
9
39
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* - trailing-button: The menu dropdown button
|
|
40
|
+
* @slot leading-button - The primary action button on the left.
|
|
41
|
+
* @slot trailing-button - The secondary action (dropdown trigger) on the right.
|
|
13
42
|
*/
|
|
14
43
|
export declare class MoniSplitButton extends MoniElement {
|
|
15
44
|
variant: 'filled' | 'tonal' | 'outlined' | 'elevated';
|
|
@@ -22,7 +51,7 @@ export declare class MoniSplitButton extends MoniElement {
|
|
|
22
51
|
private handleSlotChange;
|
|
23
52
|
private getGapValue;
|
|
24
53
|
private updateChildren;
|
|
25
|
-
render(): import("lit
|
|
54
|
+
render(): import("lit").TemplateResult<1>;
|
|
26
55
|
}
|
|
27
56
|
declare global {
|
|
28
57
|
interface HTMLElementTagNameMap {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moni-split-button.d.ts","sourceRoot":"","sources":["../../src/components/moni-split-button.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"moni-split-button.d.ts","sourceRoot":"","sources":["../../src/components/moni-split-button.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,qBACa,eAAgB,SAAQ,WAAW;IAE/C,OAAO,EAAE,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,CAAY;IAGjE,IAAI,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAY;IAG9E,GAAG,SAAM;IAGT,OAAO,CAAC,eAAe,CAAiB;IAGxC,OAAO,CAAC,gBAAgB,CAAiB;IAEzC,OAAgB,MAAM,4BAoBpB;cAEiB,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC;IAOpF,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,cAAc;IAuBb,MAAM;CAYf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,mBAAmB,EAAE,eAAe,CAAC;KACrC;CACD;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-split-button.ts
|
|
3
|
+
* @package @moni-labs/moni-ui
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @contributors Moni Labs & Contributors
|
|
6
|
+
*/
|
|
1
7
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
8
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
9
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -8,16 +14,39 @@ import { html, css } from 'lit';
|
|
|
8
14
|
import { customElement, property, queryAssignedElements } from 'lit/decorators.js';
|
|
9
15
|
import { MoniElement, sharedStyles } from './_base/index.js';
|
|
10
16
|
/**
|
|
11
|
-
*
|
|
17
|
+
* Material Design 3 Split Button component.
|
|
18
|
+
*
|
|
19
|
+
* A split button combines a primary action button with a secondary dropdown
|
|
20
|
+
* button. The two buttons sit flush against each other, typically sharing
|
|
21
|
+
* a background color and elevation, but separated by a distinct border.
|
|
22
|
+
*
|
|
23
|
+
* **Visual architecture:**
|
|
24
|
+
* The component acts as a layout container (`display: inline-flex`) that
|
|
25
|
+
* groups two standard buttons. It overrides the margins of the trailing
|
|
26
|
+
* button to create the "connected" look (similar to connected button groups).
|
|
27
|
+
*
|
|
28
|
+
* **Usage:**
|
|
29
|
+
* Consumers must provide exactly two buttons via the named slots:
|
|
30
|
+
* - `slot="leading-button"` — The primary action (usually text or text+icon).
|
|
31
|
+
* - `slot="trailing-button"` — The secondary action (usually just a dropdown icon).
|
|
32
|
+
*
|
|
33
|
+
* Both buttons should be standard `<moni-button>` or `<moni-icon-button>`
|
|
34
|
+
* elements configured with matching variants for a cohesive appearance.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```html
|
|
38
|
+
* <moni-split-button variant="filled">
|
|
39
|
+
* <moni-button slot="leading-button" icon="send">Send</moni-button>
|
|
40
|
+
* <moni-button slot="trailing-button" icon="arrow_drop_down" id="schedule-trigger"></moni-button>
|
|
41
|
+
* </moni-split-button>
|
|
12
42
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
43
|
+
* <moni-menu id="schedule-menu" placement="bottom">
|
|
44
|
+
* <moni-menu-item>Schedule send...</moni-menu-item>
|
|
45
|
+
* </moni-menu>
|
|
46
|
+
* ```
|
|
17
47
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* - trailing-button: The menu dropdown button
|
|
48
|
+
* @slot leading-button - The primary action button on the left.
|
|
49
|
+
* @slot trailing-button - The secondary action (dropdown trigger) on the right.
|
|
21
50
|
*/
|
|
22
51
|
let MoniSplitButton = class MoniSplitButton extends MoniElement {
|
|
23
52
|
constructor() {
|
|
@@ -1,15 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-step.ts
|
|
3
|
+
* @package @moni-labs/moni-ui
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @contributors Moni Labs & Contributors
|
|
6
|
+
*/
|
|
1
7
|
import { MoniElement } from './_base/index.js';
|
|
2
8
|
import './moni-icon.js';
|
|
3
9
|
/**
|
|
4
|
-
*
|
|
10
|
+
* Material Design 3 Step component.
|
|
11
|
+
*
|
|
12
|
+
* An individual step within a `<moni-stepper>`. Steps display progress through
|
|
13
|
+
* a sequence of logical and numbered operations.
|
|
14
|
+
*
|
|
15
|
+
* **M3 spec reference:** `m3-docs/components/progress-indicators/specs.md` (Stepper pattern)
|
|
16
|
+
*
|
|
17
|
+
* **Anatomy & Visuals:**
|
|
18
|
+
* A step renders a circular indicator containing either its sequence number
|
|
19
|
+
* (automatically injected by the parent stepper) or a custom icon. Below or
|
|
20
|
+
* beside the indicator (depending on the parent's `orientation`), it renders
|
|
21
|
+
* the `title` and an optional `description`.
|
|
22
|
+
*
|
|
23
|
+
* **State management:**
|
|
24
|
+
* The parent `<moni-stepper>` automatically calculates and injects the `index`,
|
|
25
|
+
* `active`, and `completed` properties based on its current state.
|
|
26
|
+
* - **Active:** Highlighted with the primary color, indicating the current step.
|
|
27
|
+
* - **Completed:** Displayed with a solid primary background and a checkmark
|
|
28
|
+
* icon (`completed` state overrides the numeric index).
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```html
|
|
32
|
+
* <!-- Typically used inside a stepper -->
|
|
33
|
+
* <moni-stepper current="1">
|
|
34
|
+
* <moni-step title="Shipping" description="Enter address"></moni-step>
|
|
35
|
+
* <moni-step title="Payment" description="Credit card details"></moni-step>
|
|
36
|
+
* <moni-step title="Review" description="Confirm order"></moni-step>
|
|
37
|
+
* </moni-stepper>
|
|
38
|
+
*
|
|
39
|
+
* <!-- Overriding the icon -->
|
|
40
|
+
* <moni-step title="Done" icon="celebration"></moni-step>
|
|
41
|
+
* ```
|
|
5
42
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* - active: present → primary color highlight
|
|
10
|
-
* - completed: present → filled circle with check
|
|
11
|
-
* - icon: Material Symbols name (overrides the number)
|
|
12
|
-
* - index: numeric label (auto-set by parent stepper, optional)
|
|
43
|
+
* @csspart step-indicator - The circular badge containing the number/icon.
|
|
44
|
+
* @csspart title - The main title text.
|
|
45
|
+
* @csspart description - The secondary description text.
|
|
13
46
|
*/
|
|
14
47
|
export declare class MoniStep extends MoniElement {
|
|
15
48
|
title: string;
|
|
@@ -19,7 +52,7 @@ export declare class MoniStep extends MoniElement {
|
|
|
19
52
|
icon: string;
|
|
20
53
|
index: number;
|
|
21
54
|
static styles: import("lit").CSSResult[];
|
|
22
|
-
render(): import("lit
|
|
55
|
+
render(): import("lit").TemplateResult<1>;
|
|
23
56
|
}
|
|
24
57
|
declare global {
|
|
25
58
|
interface HTMLElementTagNameMap {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moni-step.d.ts","sourceRoot":"","sources":["../../src/components/moni-step.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"moni-step.d.ts","sourceRoot":"","sources":["../../src/components/moni-step.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAC7D,OAAO,gBAAgB,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,qBACa,QAAS,SAAQ,WAAW;IACX,KAAK,SAAM;IACX,WAAW,SAAM;IACF,MAAM,UAAS;IACf,SAAS,UAAS;IACjC,IAAI,SAAM;IACI,KAAK,SAAK;IAErD,OAAgB,MAAM,4BAqGpB;IAEO,MAAM;CAkBf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,WAAW,EAAE,QAAQ,CAAC;KACtB;CACD;AAED,eAAe,QAAQ,CAAC"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-step.ts
|
|
3
|
+
* @package @moni-labs/moni-ui
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @contributors Moni Labs & Contributors
|
|
6
|
+
*/
|
|
1
7
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
8
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
9
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -9,15 +15,42 @@ import { customElement, property } from 'lit/decorators.js';
|
|
|
9
15
|
import { MoniElement, sharedStyles } from './_base/index.js';
|
|
10
16
|
import './moni-icon.js';
|
|
11
17
|
/**
|
|
12
|
-
*
|
|
18
|
+
* Material Design 3 Step component.
|
|
19
|
+
*
|
|
20
|
+
* An individual step within a `<moni-stepper>`. Steps display progress through
|
|
21
|
+
* a sequence of logical and numbered operations.
|
|
22
|
+
*
|
|
23
|
+
* **M3 spec reference:** `m3-docs/components/progress-indicators/specs.md` (Stepper pattern)
|
|
24
|
+
*
|
|
25
|
+
* **Anatomy & Visuals:**
|
|
26
|
+
* A step renders a circular indicator containing either its sequence number
|
|
27
|
+
* (automatically injected by the parent stepper) or a custom icon. Below or
|
|
28
|
+
* beside the indicator (depending on the parent's `orientation`), it renders
|
|
29
|
+
* the `title` and an optional `description`.
|
|
30
|
+
*
|
|
31
|
+
* **State management:**
|
|
32
|
+
* The parent `<moni-stepper>` automatically calculates and injects the `index`,
|
|
33
|
+
* `active`, and `completed` properties based on its current state.
|
|
34
|
+
* - **Active:** Highlighted with the primary color, indicating the current step.
|
|
35
|
+
* - **Completed:** Displayed with a solid primary background and a checkmark
|
|
36
|
+
* icon (`completed` state overrides the numeric index).
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```html
|
|
40
|
+
* <!-- Typically used inside a stepper -->
|
|
41
|
+
* <moni-stepper current="1">
|
|
42
|
+
* <moni-step title="Shipping" description="Enter address"></moni-step>
|
|
43
|
+
* <moni-step title="Payment" description="Credit card details"></moni-step>
|
|
44
|
+
* <moni-step title="Review" description="Confirm order"></moni-step>
|
|
45
|
+
* </moni-stepper>
|
|
46
|
+
*
|
|
47
|
+
* <!-- Overriding the icon -->
|
|
48
|
+
* <moni-step title="Done" icon="celebration"></moni-step>
|
|
49
|
+
* ```
|
|
13
50
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* - active: present → primary color highlight
|
|
18
|
-
* - completed: present → filled circle with check
|
|
19
|
-
* - icon: Material Symbols name (overrides the number)
|
|
20
|
-
* - index: numeric label (auto-set by parent stepper, optional)
|
|
51
|
+
* @csspart step-indicator - The circular badge containing the number/icon.
|
|
52
|
+
* @csspart title - The main title text.
|
|
53
|
+
* @csspart description - The secondary description text.
|
|
21
54
|
*/
|
|
22
55
|
let MoniStep = class MoniStep extends MoniElement {
|
|
23
56
|
constructor() {
|
|
@@ -1,11 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-stepper.ts
|
|
3
|
+
* @package @moni-labs/moni-ui
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @contributors Moni Labs & Contributors
|
|
6
|
+
*/
|
|
1
7
|
import { MoniElement } from './_base/index.js';
|
|
2
8
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
9
|
+
* Material Design 3 Stepper component.
|
|
10
|
+
*
|
|
11
|
+
* A container for a linear progression of `<moni-step>` elements. Steppers
|
|
12
|
+
* convey progress through numbered steps and indicate the user's current
|
|
13
|
+
* position within a flow.
|
|
14
|
+
*
|
|
15
|
+
* **M3 spec reference:** `m3-docs/components/progress-indicators/specs.md`
|
|
16
|
+
*
|
|
17
|
+
* **Orchestration:**
|
|
18
|
+
* This component acts as the orchestrator for its slotted `<moni-step>` children.
|
|
19
|
+
* Whenever the `current` property changes, or children are added/removed, the
|
|
20
|
+
* stepper iterates over all child steps and injects their state:
|
|
21
|
+
* - Assigns the sequential `index` (0-based) to each step.
|
|
22
|
+
* - Sets `active=true` on the step matching the `current` index.
|
|
23
|
+
* - Sets `completed=true` on all steps prior to the `current` index.
|
|
24
|
+
*
|
|
25
|
+
* **Visual layout:**
|
|
26
|
+
* The stepper manages the layout (flex row or column based on `orientation`)
|
|
27
|
+
* and ensures the connector lines between steps are rendered correctly via
|
|
28
|
+
* CSS pseudo-elements defined in the child `<moni-step>` styling.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```html
|
|
32
|
+
* <moni-stepper current="1" orientation="horizontal">
|
|
33
|
+
* <moni-step title="Step 1"></moni-step>
|
|
34
|
+
* <moni-step title="Step 2"></moni-step>
|
|
35
|
+
* <moni-step title="Step 3"></moni-step>
|
|
36
|
+
* </moni-stepper>
|
|
37
|
+
*
|
|
38
|
+
* <script>
|
|
39
|
+
* const stepper = document.querySelector('moni-stepper');
|
|
40
|
+
* // Move to next step
|
|
41
|
+
* stepper.current = 2;
|
|
42
|
+
* </script>
|
|
43
|
+
* ```
|
|
5
44
|
*
|
|
6
|
-
*
|
|
7
|
-
* - orientation: horizontal (default) | vertical
|
|
8
|
-
* - current: zero-based index of the active step
|
|
45
|
+
* @slot default - `<moni-step>` elements.
|
|
9
46
|
*/
|
|
10
47
|
export declare class MoniStepper extends MoniElement {
|
|
11
48
|
orientation: 'horizontal' | 'vertical';
|
|
@@ -23,7 +60,7 @@ export declare class MoniStepper extends MoniElement {
|
|
|
23
60
|
*/
|
|
24
61
|
private _syncSteps;
|
|
25
62
|
static styles: import("lit").CSSResult[];
|
|
26
|
-
render(): import("lit
|
|
63
|
+
render(): import("lit").TemplateResult<1>;
|
|
27
64
|
private _onSlotChange;
|
|
28
65
|
}
|
|
29
66
|
declare global {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moni-stepper.d.ts","sourceRoot":"","sources":["../../src/components/moni-stepper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"moni-stepper.d.ts","sourceRoot":"","sources":["../../src/components/moni-stepper.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAG7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,qBACa,WAAY,SAAQ,WAAW;IAE3C,WAAW,EAAE,YAAY,GAAG,UAAU,CAAgB;IACX,OAAO,SAAK;IAGvD,OAAO,CAAC,MAAM,CAAc;IAEnB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAU9C;;;;;;;;OAQG;IACH,OAAO,CAAC,UAAU;IAclB,OAAgB,MAAM,4BAwBpB;IAEO,MAAM;IAMf,OAAO,CAAC,aAAa,CAGnB;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,cAAc,EAAE,WAAW,CAAC;KAC5B;CACD;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-stepper.ts
|
|
3
|
+
* @package @moni-labs/moni-ui
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @contributors Moni Labs & Contributors
|
|
6
|
+
*/
|
|
1
7
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
8
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
9
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -8,12 +14,43 @@ import { html, css } from 'lit';
|
|
|
8
14
|
import { customElement, property, queryAssignedElements } from 'lit/decorators.js';
|
|
9
15
|
import { MoniElement, sharedStyles } from './_base/index.js';
|
|
10
16
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
17
|
+
* Material Design 3 Stepper component.
|
|
18
|
+
*
|
|
19
|
+
* A container for a linear progression of `<moni-step>` elements. Steppers
|
|
20
|
+
* convey progress through numbered steps and indicate the user's current
|
|
21
|
+
* position within a flow.
|
|
22
|
+
*
|
|
23
|
+
* **M3 spec reference:** `m3-docs/components/progress-indicators/specs.md`
|
|
24
|
+
*
|
|
25
|
+
* **Orchestration:**
|
|
26
|
+
* This component acts as the orchestrator for its slotted `<moni-step>` children.
|
|
27
|
+
* Whenever the `current` property changes, or children are added/removed, the
|
|
28
|
+
* stepper iterates over all child steps and injects their state:
|
|
29
|
+
* - Assigns the sequential `index` (0-based) to each step.
|
|
30
|
+
* - Sets `active=true` on the step matching the `current` index.
|
|
31
|
+
* - Sets `completed=true` on all steps prior to the `current` index.
|
|
32
|
+
*
|
|
33
|
+
* **Visual layout:**
|
|
34
|
+
* The stepper manages the layout (flex row or column based on `orientation`)
|
|
35
|
+
* and ensures the connector lines between steps are rendered correctly via
|
|
36
|
+
* CSS pseudo-elements defined in the child `<moni-step>` styling.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```html
|
|
40
|
+
* <moni-stepper current="1" orientation="horizontal">
|
|
41
|
+
* <moni-step title="Step 1"></moni-step>
|
|
42
|
+
* <moni-step title="Step 2"></moni-step>
|
|
43
|
+
* <moni-step title="Step 3"></moni-step>
|
|
44
|
+
* </moni-stepper>
|
|
45
|
+
*
|
|
46
|
+
* <script>
|
|
47
|
+
* const stepper = document.querySelector('moni-stepper');
|
|
48
|
+
* // Move to next step
|
|
49
|
+
* stepper.current = 2;
|
|
50
|
+
* </script>
|
|
51
|
+
* ```
|
|
13
52
|
*
|
|
14
|
-
*
|
|
15
|
-
* - orientation: horizontal (default) | vertical
|
|
16
|
-
* - current: zero-based index of the active step
|
|
53
|
+
* @slot default - `<moni-step>` elements.
|
|
17
54
|
*/
|
|
18
55
|
let MoniStepper = class MoniStepper extends MoniElement {
|
|
19
56
|
constructor() {
|