@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,31 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-button-group.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
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
9
|
+
* Material Design 3 Button Group component.
|
|
10
|
+
*
|
|
11
|
+
* Organizes multiple `<moni-button>` or `<moni-icon-button>` components
|
|
12
|
+
* into a single row.
|
|
13
|
+
*
|
|
14
|
+
* **Variants:**
|
|
15
|
+
* - `standard` (default) — A simple flex row with a gap between buttons.
|
|
16
|
+
* - `connected` — The M3 Expressive replacement for segmented buttons. In this
|
|
17
|
+
* mode, buttons share borders and form a single continuous pill shape. The
|
|
18
|
+
* group manages the single/multi-select toggle state of its children.
|
|
19
|
+
*
|
|
20
|
+
* **`connected` variant details:**
|
|
21
|
+
* - **Shape propagation:** The group automatically propagates M3 shape classes
|
|
22
|
+
* (`left-round-flat`, `no-round`, `right-round-flat`) to its children so
|
|
23
|
+
* they interlock seamlessly.
|
|
24
|
+
* - **Toggle management:** The group listens to child clicks and toggles their
|
|
25
|
+
* `active` attributes. When `multi=false` (default), only one button can be
|
|
26
|
+
* active at a time (radio button behavior). When `multi=true`, multiple buttons
|
|
27
|
+
* can be active (checkbox behavior).
|
|
28
|
+
* - **Event propagation:** Fires a `'change'` event when the selection changes.
|
|
29
|
+
*
|
|
30
|
+
* **Accessibility:**
|
|
31
|
+
* - Renders with `role="group"` (can be overridden to `toolbar` or `radiogroup`).
|
|
32
|
+
* - Consumers should provide an `aria-label` or `aria-labelledby` attribute
|
|
33
|
+
* to identify the group's purpose to assistive technologies.
|
|
34
|
+
*
|
|
35
|
+
* @fires change - Fired when a button is clicked in `connected` mode and the
|
|
36
|
+
* selection state updates.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```html
|
|
40
|
+
* <!-- Connected single-select group -->
|
|
41
|
+
* <moni-button-group variant="connected" label="Alignment">
|
|
42
|
+
* <moni-button icon="format_align_left" active></moni-button>
|
|
43
|
+
* <moni-button icon="format_align_center"></moni-button>
|
|
44
|
+
* <moni-button icon="format_align_right"></moni-button>
|
|
45
|
+
* </moni-button-group>
|
|
46
|
+
*
|
|
47
|
+
* <!-- Standard button row -->
|
|
48
|
+
* <moni-button-group gap="1rem">
|
|
49
|
+
* <moni-button variant="text">Cancel</moni-button>
|
|
50
|
+
* <moni-button>Save</moni-button>
|
|
51
|
+
* </moni-button-group>
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @slot default - The `<moni-button>` elements that make up the group.
|
|
29
55
|
*/
|
|
30
56
|
export declare class MoniButtonGroup extends MoniElement {
|
|
31
57
|
variant: 'standard' | 'connected';
|
|
@@ -44,7 +70,7 @@ export declare class MoniButtonGroup extends MoniElement {
|
|
|
44
70
|
private handlePointerDown;
|
|
45
71
|
private handlePointerUp;
|
|
46
72
|
private handleClick;
|
|
47
|
-
render(): import("lit
|
|
73
|
+
render(): import("lit").TemplateResult<1>;
|
|
48
74
|
}
|
|
49
75
|
declare global {
|
|
50
76
|
interface HTMLElementTagNameMap {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moni-button-group.d.ts","sourceRoot":"","sources":["../../src/components/moni-button-group.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"moni-button-group.d.ts","sourceRoot":"","sources":["../../src/components/moni-button-group.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,qBACa,eAAgB,SAAQ,WAAW;IAE/C,OAAO,EAAE,UAAU,GAAG,WAAW,CAAc;IAG/C,IAAI,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAY;IAG9E,KAAK,UAAS;IAGd,GAAG,SAAM;IAGT,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,YAAY,CAAW;IAGnD,KAAK,SAAM;IAGX,UAAU,SAAM;IAGhB,OAAO,CAAC,cAAc,CAAiB;IAEvC,OAAgB,MAAM,4BAuCpB;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;IA0CtB,OAAO,CAAC,iBAAiB;IA2BzB,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,WAAW;IA2CV,MAAM;CAyBf;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-button-group.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,32 +14,52 @@ import { html, css, nothing } 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 Button Group component.
|
|
18
|
+
*
|
|
19
|
+
* Organizes multiple `<moni-button>` or `<moni-icon-button>` components
|
|
20
|
+
* into a single row.
|
|
21
|
+
*
|
|
22
|
+
* **Variants:**
|
|
23
|
+
* - `standard` (default) — A simple flex row with a gap between buttons.
|
|
24
|
+
* - `connected` — The M3 Expressive replacement for segmented buttons. In this
|
|
25
|
+
* mode, buttons share borders and form a single continuous pill shape. The
|
|
26
|
+
* group manages the single/multi-select toggle state of its children.
|
|
27
|
+
*
|
|
28
|
+
* **`connected` variant details:**
|
|
29
|
+
* - **Shape propagation:** The group automatically propagates M3 shape classes
|
|
30
|
+
* (`left-round-flat`, `no-round`, `right-round-flat`) to its children so
|
|
31
|
+
* they interlock seamlessly.
|
|
32
|
+
* - **Toggle management:** The group listens to child clicks and toggles their
|
|
33
|
+
* `active` attributes. When `multi=false` (default), only one button can be
|
|
34
|
+
* active at a time (radio button behavior). When `multi=true`, multiple buttons
|
|
35
|
+
* can be active (checkbox behavior).
|
|
36
|
+
* - **Event propagation:** Fires a `'change'` event when the selection changes.
|
|
37
|
+
*
|
|
38
|
+
* **Accessibility:**
|
|
39
|
+
* - Renders with `role="group"` (can be overridden to `toolbar` or `radiogroup`).
|
|
40
|
+
* - Consumers should provide an `aria-label` or `aria-labelledby` attribute
|
|
41
|
+
* to identify the group's purpose to assistive technologies.
|
|
42
|
+
*
|
|
43
|
+
* @fires change - Fired when a button is clicked in `connected` mode and the
|
|
44
|
+
* selection state updates.
|
|
13
45
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```html
|
|
48
|
+
* <!-- Connected single-select group -->
|
|
49
|
+
* <moni-button-group variant="connected" label="Alignment">
|
|
50
|
+
* <moni-button icon="format_align_left" active></moni-button>
|
|
51
|
+
* <moni-button icon="format_align_center"></moni-button>
|
|
52
|
+
* <moni-button icon="format_align_right"></moni-button>
|
|
53
|
+
* </moni-button-group>
|
|
22
54
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
55
|
+
* <!-- Standard button row -->
|
|
56
|
+
* <moni-button-group gap="1rem">
|
|
57
|
+
* <moni-button variant="text">Cancel</moni-button>
|
|
58
|
+
* <moni-button>Save</moni-button>
|
|
59
|
+
* </moni-button-group>
|
|
60
|
+
* ```
|
|
27
61
|
*
|
|
28
|
-
*
|
|
29
|
-
* - variant: standard (default) | connected
|
|
30
|
-
* - size: small | medium (default) | large | extra
|
|
31
|
-
* - multi: boolean (default false) — multiple toggles allowed
|
|
32
|
-
* - gap: custom gap space (e.g. "8px" or "1rem"); in `connected`
|
|
33
|
-
* variant the default is 0.125rem (2dp) per M3 spec
|
|
34
|
-
* - role: ARIA role override (default "group")
|
|
35
|
-
* - label: aria-label for the group
|
|
36
|
-
* - labelled-by: aria-labelledby reference
|
|
62
|
+
* @slot default - The `<moni-button>` elements that make up the group.
|
|
37
63
|
*/
|
|
38
64
|
let MoniButtonGroup = class MoniButtonGroup extends MoniElement {
|
|
39
65
|
constructor() {
|
|
@@ -1,14 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-button-segment.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 Segmented Button component (Legacy).
|
|
11
|
+
*
|
|
12
|
+
* **Deprecation Notice:** The M3 spec (`m3-docs/components/segmented-buttons/overview.md`)
|
|
13
|
+
* has replaced the bespoke segmented button component with standard buttons arranged
|
|
14
|
+
* in a "connected" group. Please use `<moni-button-group variant="connected">`
|
|
15
|
+
* containing standard `<moni-button>` elements instead of this component.
|
|
16
|
+
*
|
|
17
|
+
* This component remains for backwards compatibility but will be removed in a
|
|
18
|
+
* future major release. It renders a single segment within a `<moni-segmented-button>`.
|
|
19
|
+
*
|
|
20
|
+
* @deprecated Use `<moni-button-group variant="connected">` instead.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```html
|
|
24
|
+
* <!-- Legacy usage (not recommended) -->
|
|
25
|
+
* <moni-segmented-button>
|
|
26
|
+
* <moni-button-segment value="day" checked>Day</moni-button-segment>
|
|
27
|
+
* <moni-button-segment value="week">Week</moni-button-segment>
|
|
28
|
+
* </moni-segmented-button>
|
|
29
|
+
* ```
|
|
5
30
|
*
|
|
6
|
-
*
|
|
7
|
-
* - value: The value of the segment (default "on")
|
|
8
|
-
* - checked: Whether the segment is checked/selected
|
|
9
|
-
* - disabled: Whether the segment is disabled
|
|
10
|
-
* - position: Automatically set by the parent (first | middle | last | solo)
|
|
11
|
-
* - hide-check: Hides the checkmark when selected
|
|
31
|
+
* @slot default - The segment label text.
|
|
12
32
|
*/
|
|
13
33
|
export declare class MoniButtonSegment extends MoniElement {
|
|
14
34
|
value: string;
|
|
@@ -18,7 +38,7 @@ export declare class MoniButtonSegment extends MoniElement {
|
|
|
18
38
|
position: 'first' | 'middle' | 'last' | 'solo';
|
|
19
39
|
hideCheck: boolean;
|
|
20
40
|
static styles: import("lit").CSSResult[];
|
|
21
|
-
render(): import("lit
|
|
41
|
+
render(): import("lit").TemplateResult<1>;
|
|
22
42
|
}
|
|
23
43
|
declare global {
|
|
24
44
|
interface HTMLElementTagNameMap {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moni-button-segment.d.ts","sourceRoot":"","sources":["../../src/components/moni-button-segment.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"moni-button-segment.d.ts","sourceRoot":"","sources":["../../src/components/moni-button-segment.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAC7D,OAAO,gBAAgB,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBACa,iBAAkB,SAAQ,WAAW;IAEjD,KAAK,SAAQ;IAGb,OAAO,UAAS;IAGhB,IAAI,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAY;IAG9E,QAAQ,UAAS;IAGjB,QAAQ,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAU;IAGxD,SAAS,UAAS;IAElB,OAAgB,MAAM,4BA0OpB;IAEO,MAAM;CAWf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,qBAAqB,EAAE,iBAAiB,CAAC;KACzC;CACD;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-button-segment.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,14 +15,28 @@ 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 Segmented Button component (Legacy).
|
|
19
|
+
*
|
|
20
|
+
* **Deprecation Notice:** The M3 spec (`m3-docs/components/segmented-buttons/overview.md`)
|
|
21
|
+
* has replaced the bespoke segmented button component with standard buttons arranged
|
|
22
|
+
* in a "connected" group. Please use `<moni-button-group variant="connected">`
|
|
23
|
+
* containing standard `<moni-button>` elements instead of this component.
|
|
24
|
+
*
|
|
25
|
+
* This component remains for backwards compatibility but will be removed in a
|
|
26
|
+
* future major release. It renders a single segment within a `<moni-segmented-button>`.
|
|
27
|
+
*
|
|
28
|
+
* @deprecated Use `<moni-button-group variant="connected">` instead.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```html
|
|
32
|
+
* <!-- Legacy usage (not recommended) -->
|
|
33
|
+
* <moni-segmented-button>
|
|
34
|
+
* <moni-button-segment value="day" checked>Day</moni-button-segment>
|
|
35
|
+
* <moni-button-segment value="week">Week</moni-button-segment>
|
|
36
|
+
* </moni-segmented-button>
|
|
37
|
+
* ```
|
|
13
38
|
*
|
|
14
|
-
*
|
|
15
|
-
* - value: The value of the segment (default "on")
|
|
16
|
-
* - checked: Whether the segment is checked/selected
|
|
17
|
-
* - disabled: Whether the segment is disabled
|
|
18
|
-
* - position: Automatically set by the parent (first | middle | last | solo)
|
|
19
|
-
* - hide-check: Hides the checkmark when selected
|
|
39
|
+
* @slot default - The segment label text.
|
|
20
40
|
*/
|
|
21
41
|
let MoniButtonSegment = class MoniButtonSegment extends MoniElement {
|
|
22
42
|
constructor() {
|
|
@@ -1,42 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-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
|
import './moni-icon.js';
|
|
3
9
|
import './moni-progress.js';
|
|
4
10
|
/**
|
|
5
|
-
*
|
|
11
|
+
* Material Design 3 Button component.
|
|
12
|
+
*
|
|
13
|
+
* Buttons allow users to take actions and make choices with a single tap.
|
|
14
|
+
* This component provides all M3 button variants, sizes, and shape morphing
|
|
15
|
+
* capabilities (e.g. morphing to a pill shape on press or toggle).
|
|
16
|
+
*
|
|
17
|
+
* **M3 spec reference:** `m3-docs/components/buttons/specs.md`
|
|
18
|
+
*
|
|
19
|
+
* **Variants:**
|
|
20
|
+
* - `filled` (default) — High emphasis. Use for primary actions.
|
|
21
|
+
* - `tonal` — Medium emphasis. Secondary actions that still need to stand out.
|
|
22
|
+
* - `elevated` — Medium emphasis with shadow. Used when sitting on patterned backgrounds.
|
|
23
|
+
* - `outlined` — Medium emphasis, no fill. Secondary or tertiary actions.
|
|
24
|
+
* - `text` — Low emphasis. Tertiary actions (e.g. dialog cancel button).
|
|
25
|
+
*
|
|
26
|
+
* **Shape morphing (M3 Expressive feature):**
|
|
27
|
+
* - On press (active state): Round and square buttons morph to a slightly squarer
|
|
28
|
+
* "pressed" shape with specific M3 corner radii (e.g. XS/S 8dp, M 12dp).
|
|
29
|
+
* - On toggle (`active` attribute): The resting shape flips (e.g. round ↔ square).
|
|
30
|
+
*
|
|
31
|
+
* **Rendering as a link:**
|
|
32
|
+
* When the `href` attribute is provided, the component internally renders as
|
|
33
|
+
* an `<a>` element instead of a `<button>`, allowing native routing and
|
|
34
|
+
* middle-click (open in new tab) behaviors while maintaining button visuals.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```html
|
|
38
|
+
* <!-- Primary filled button -->
|
|
39
|
+
* <moni-button icon="add">Create new</moni-button>
|
|
40
|
+
*
|
|
41
|
+
* <!-- Outlined button -->
|
|
42
|
+
* <moni-button variant="outlined">Cancel</moni-button>
|
|
6
43
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* corner radii: XS 8dp, S 8dp, M 12dp, L 16dp, XL 16dp. The per-size rules
|
|
10
|
-
* `.button.{xsmall,small,large,xlarge,extra}:active` override the default
|
|
11
|
-
* `:active` rule by specificity (0,4,0 vs 0,3,0).
|
|
44
|
+
* <!-- Toggle button (toggles active state on click) -->
|
|
45
|
+
* <moni-button icon="favorite" active>Like</moni-button>
|
|
12
46
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
47
|
+
* <!-- Link button -->
|
|
48
|
+
* <moni-button href="/settings" icon="settings">Settings</moni-button>
|
|
49
|
+
* ```
|
|
15
50
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* (legacy `extra` alias for `xlarge`, deprecated in v0.3.0)
|
|
20
|
-
* - shape: round (default) | square | circle | no-round
|
|
21
|
-
* | left-round | right-round | top-round | bottom-round
|
|
22
|
-
* | left-round-flat | right-round-flat | top-round-flat
|
|
23
|
-
* | bottom-round-flat | inner-round
|
|
24
|
-
* (the `-flat` and `inner-round` shapes are Moni brand
|
|
25
|
-
* extensions; not part of M3 — see WEB_COMPONENT_GUIDELINES.md)
|
|
26
|
-
* - disabled: present → native disabled
|
|
27
|
-
* - loading: present → shows an indeterminate circular progress
|
|
28
|
-
* - active: present → toggle (selection) state; applies shape morph
|
|
29
|
-
* (round↔square) and variant-specific color swap
|
|
30
|
-
* - icon: Material Symbols name to prepend
|
|
31
|
-
* - icon-trailing: Material Symbols name to append
|
|
32
|
-
* - type: button (default) | submit | reset
|
|
33
|
-
* - href: present → renders as `<a>` instead of `<button>`
|
|
34
|
-
* - target: for `<a>` rendering
|
|
51
|
+
* @slot default - The button label text.
|
|
52
|
+
* @slot icon - Optional override for the leading icon.
|
|
53
|
+
* @slot icon-trailing - Optional override for the trailing icon.
|
|
35
54
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
55
|
+
* @csspart button - The inner `<button>` or `<a>` element.
|
|
56
|
+
* @csspart icon - The leading icon container.
|
|
57
|
+
* @csspart label - The label container.
|
|
58
|
+
* @csspart trailing-icon - The trailing icon container.
|
|
40
59
|
*/
|
|
41
60
|
export declare class MoniButton extends MoniElement {
|
|
42
61
|
private static _deprecationWarned;
|
|
@@ -59,7 +78,7 @@ export declare class MoniButton extends MoniElement {
|
|
|
59
78
|
connectedCallback(): void;
|
|
60
79
|
static styles: import("lit").CSSResult[];
|
|
61
80
|
private handleLinkClick;
|
|
62
|
-
render(): import("lit
|
|
81
|
+
render(): import("lit").TemplateResult<1>;
|
|
63
82
|
}
|
|
64
83
|
declare global {
|
|
65
84
|
interface HTMLElementTagNameMap {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moni-button.d.ts","sourceRoot":"","sources":["../../src/components/moni-button.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"moni-button.d.ts","sourceRoot":"","sources":["../../src/components/moni-button.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAC7D,OAAO,gBAAgB,CAAC;AACxB,OAAO,oBAAoB,CAAC;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,qBACa,UAAW,SAAQ,WAAW;IAC1C,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAS;IAG1C,OAAO,EACJ,QAAQ,GACR,OAAO,GACP,UAAU,GACV,MAAM,GACN,MAAM,GACN,UAAU,CAAY;IACzB;;;;OAIG;IAEH,IAAI,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAY;IAE9E,KAAK,EACF,OAAO,GACP,UAAU,GACV,QAAQ,GACR,QAAQ,GACR,YAAY,GACZ,aAAa,GACb,WAAW,GACX,cAAc,GACd,iBAAiB,GACjB,kBAAkB,GAClB,gBAAgB,GAChB,mBAAmB,GACnB,aAAa,CAAW;IACiB,QAAQ,UAAS;IACjB,OAAO,UAAS;IAChB,MAAM,UAAS;IAC9B,IAAI,SAAM;IACkB,YAAY,SAAM;IAE3E,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAY;IAClB,IAAI,SAAM;IACV,MAAM,SAAM;IAEhC,iBAAiB,IAAI,IAAI;IAalC,OAAgB,MAAM,4BA6fpB;IAEF,OAAO,CAAC,eAAe;IAOd,MAAM;CAiFf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,aAAa,EAAE,UAAU,CAAC;KAC1B;CACD;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-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);
|
|
@@ -12,41 +18,54 @@ import { MoniElement, sharedStyles } from './_base/index.js';
|
|
|
12
18
|
import './moni-icon.js';
|
|
13
19
|
import './moni-progress.js';
|
|
14
20
|
/**
|
|
15
|
-
*
|
|
21
|
+
* Material Design 3 Button component.
|
|
22
|
+
*
|
|
23
|
+
* Buttons allow users to take actions and make choices with a single tap.
|
|
24
|
+
* This component provides all M3 button variants, sizes, and shape morphing
|
|
25
|
+
* capabilities (e.g. morphing to a pill shape on press or toggle).
|
|
26
|
+
*
|
|
27
|
+
* **M3 spec reference:** `m3-docs/components/buttons/specs.md`
|
|
28
|
+
*
|
|
29
|
+
* **Variants:**
|
|
30
|
+
* - `filled` (default) — High emphasis. Use for primary actions.
|
|
31
|
+
* - `tonal` — Medium emphasis. Secondary actions that still need to stand out.
|
|
32
|
+
* - `elevated` — Medium emphasis with shadow. Used when sitting on patterned backgrounds.
|
|
33
|
+
* - `outlined` — Medium emphasis, no fill. Secondary or tertiary actions.
|
|
34
|
+
* - `text` — Low emphasis. Tertiary actions (e.g. dialog cancel button).
|
|
35
|
+
*
|
|
36
|
+
* **Shape morphing (M3 Expressive feature):**
|
|
37
|
+
* - On press (active state): Round and square buttons morph to a slightly squarer
|
|
38
|
+
* "pressed" shape with specific M3 corner radii (e.g. XS/S 8dp, M 12dp).
|
|
39
|
+
* - On toggle (`active` attribute): The resting shape flips (e.g. round ↔ square).
|
|
40
|
+
*
|
|
41
|
+
* **Rendering as a link:**
|
|
42
|
+
* When the `href` attribute is provided, the component internally renders as
|
|
43
|
+
* an `<a>` element instead of a `<button>`, allowing native routing and
|
|
44
|
+
* middle-click (open in new tab) behaviors while maintaining button visuals.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```html
|
|
48
|
+
* <!-- Primary filled button -->
|
|
49
|
+
* <moni-button icon="add">Create new</moni-button>
|
|
50
|
+
*
|
|
51
|
+
* <!-- Outlined button -->
|
|
52
|
+
* <moni-button variant="outlined">Cancel</moni-button>
|
|
16
53
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* corner radii: XS 8dp, S 8dp, M 12dp, L 16dp, XL 16dp. The per-size rules
|
|
20
|
-
* `.button.{xsmall,small,large,xlarge,extra}:active` override the default
|
|
21
|
-
* `:active` rule by specificity (0,4,0 vs 0,3,0).
|
|
54
|
+
* <!-- Toggle button (toggles active state on click) -->
|
|
55
|
+
* <moni-button icon="favorite" active>Like</moni-button>
|
|
22
56
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
57
|
+
* <!-- Link button -->
|
|
58
|
+
* <moni-button href="/settings" icon="settings">Settings</moni-button>
|
|
59
|
+
* ```
|
|
25
60
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* (legacy `extra` alias for `xlarge`, deprecated in v0.3.0)
|
|
30
|
-
* - shape: round (default) | square | circle | no-round
|
|
31
|
-
* | left-round | right-round | top-round | bottom-round
|
|
32
|
-
* | left-round-flat | right-round-flat | top-round-flat
|
|
33
|
-
* | bottom-round-flat | inner-round
|
|
34
|
-
* (the `-flat` and `inner-round` shapes are Moni brand
|
|
35
|
-
* extensions; not part of M3 — see WEB_COMPONENT_GUIDELINES.md)
|
|
36
|
-
* - disabled: present → native disabled
|
|
37
|
-
* - loading: present → shows an indeterminate circular progress
|
|
38
|
-
* - active: present → toggle (selection) state; applies shape morph
|
|
39
|
-
* (round↔square) and variant-specific color swap
|
|
40
|
-
* - icon: Material Symbols name to prepend
|
|
41
|
-
* - icon-trailing: Material Symbols name to append
|
|
42
|
-
* - type: button (default) | submit | reset
|
|
43
|
-
* - href: present → renders as `<a>` instead of `<button>`
|
|
44
|
-
* - target: for `<a>` rendering
|
|
61
|
+
* @slot default - The button label text.
|
|
62
|
+
* @slot icon - Optional override for the leading icon.
|
|
63
|
+
* @slot icon-trailing - Optional override for the trailing icon.
|
|
45
64
|
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
65
|
+
* @csspart button - The inner `<button>` or `<a>` element.
|
|
66
|
+
* @csspart icon - The leading icon container.
|
|
67
|
+
* @csspart label - The label container.
|
|
68
|
+
* @csspart trailing-icon - The trailing icon container.
|
|
50
69
|
*/
|
|
51
70
|
let MoniButton = class MoniButton extends MoniElement {
|
|
52
71
|
constructor() {
|
|
@@ -1,43 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-card.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
|
-
* Material 3 Card
|
|
4
|
-
*
|
|
5
|
-
* Cards display content and actions
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
9
|
+
* Material Design 3 Card component.
|
|
10
|
+
*
|
|
11
|
+
* Cards display content and actions about a single subject. They are
|
|
12
|
+
* container surfaces that group related information together, making it
|
|
13
|
+
* easy for users to scan and interact with collections of related data.
|
|
14
|
+
*
|
|
15
|
+
* **M3 spec reference:** `m3-docs/components/cards/specs.md`
|
|
16
|
+
*
|
|
17
|
+
* **Variants:**
|
|
18
|
+
* - `elevated` (default) — `surface-container-low` background + `--elevate1` shadow.
|
|
19
|
+
* Best for collections where the card needs visual separation from a
|
|
20
|
+
* patterned or colored background. Gains shadow on hover/drag.
|
|
21
|
+
* - `filled` — `surface-container-highest` background, no shadow.
|
|
22
|
+
* Lowest emphasis; use when cards sit directly on the main background surface.
|
|
23
|
+
* - `outlined` — `surface` background + 1dp `outline-variant` stroke.
|
|
24
|
+
* Highest structural emphasis without casting a shadow. Best on solid backgrounds.
|
|
25
|
+
*
|
|
26
|
+
* **M3 measurements:**
|
|
27
|
+
* - Container corner radius: 12dp.
|
|
28
|
+
* - Horizontal content padding: 16dp.
|
|
29
|
+
* - Gap between cards in a collection: max 8dp.
|
|
30
|
+
* - Headline text alignment: start.
|
|
31
|
+
*
|
|
32
|
+
* **Interactive cards:**
|
|
33
|
+
* When `clickable=true`, the card renders M3 state layer overlays on hover,
|
|
34
|
+
* focus, and press via the `::before` pseudo-element. The consumer must handle
|
|
35
|
+
* the `click` event to implement navigation or selection logic.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```html
|
|
39
|
+
* <moni-card variant="outlined" clickable>
|
|
40
|
+
* <img slot="media" src="photo.jpg" alt="Card image" />
|
|
41
|
+
* <h3 slot="headline">Card Title</h3>
|
|
42
|
+
* <p slot="supporting">Supporting text that describes the card topic.</p>
|
|
43
|
+
* <div slot="actions">
|
|
44
|
+
* <moni-button variant="text">Cancel</moni-button>
|
|
45
|
+
* <moni-button>Confirm</moni-button>
|
|
46
|
+
* </div>
|
|
47
|
+
* </moni-card>
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @slot media - An image, video, or icon at the top of the card.
|
|
51
|
+
* @slot default - Primary body content (replaces all named slots if used).
|
|
52
|
+
* @slot headline - H3-equivalent title text.
|
|
53
|
+
* @slot subhead - Secondary title below the headline.
|
|
54
|
+
* @slot supporting - Descriptive supporting body text.
|
|
55
|
+
* @slot actions - Action buttons row at the bottom of the card.
|
|
56
|
+
*
|
|
57
|
+
* @csspart card - The outer card container.
|
|
58
|
+
* @csspart media - The media area wrapper.
|
|
59
|
+
* @csspart content - The content wrapper.
|
|
60
|
+
* @csspart actions - The actions row wrapper.
|
|
33
61
|
*/
|
|
34
62
|
export declare class MoniCard extends MoniElement {
|
|
63
|
+
/**
|
|
64
|
+
* Visual variant of the card.
|
|
65
|
+
*
|
|
66
|
+
* - `'elevated'` (default) — Surface-low background + elevation shadow.
|
|
67
|
+
* - `'filled'` — Surface-highest background, no shadow.
|
|
68
|
+
* - `'outlined'` — Surface background + outline-variant stroke.
|
|
69
|
+
*
|
|
70
|
+
* @default 'elevated'
|
|
71
|
+
*/
|
|
35
72
|
variant: 'elevated' | 'filled' | 'outlined';
|
|
73
|
+
/**
|
|
74
|
+
* When `true`, applies M3 state layer overlays (hover, focus, pressed)
|
|
75
|
+
* to communicate interactivity. The card background shifts slightly on hover.
|
|
76
|
+
*
|
|
77
|
+
* Use when the card itself is a clickable navigation or selection target.
|
|
78
|
+
*
|
|
79
|
+
* @default false
|
|
80
|
+
*/
|
|
36
81
|
clickable: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* When `true`, applies `--elevate3` box-shadow to simulate the M3 "dragged"
|
|
84
|
+
* state as specified in the M3 card interaction spec.
|
|
85
|
+
*
|
|
86
|
+
* Consumers should toggle this attribute based on the drag state of the card
|
|
87
|
+
* (e.g. via a drag-and-drop library callback).
|
|
88
|
+
*
|
|
89
|
+
* @default false
|
|
90
|
+
*/
|
|
37
91
|
draggable: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* When `true`, the card renders at 50% opacity with `cursor: not-allowed`,
|
|
94
|
+
* signaling that the card and its actions are unavailable.
|
|
95
|
+
*
|
|
96
|
+
* @default false
|
|
97
|
+
*/
|
|
38
98
|
disabled: boolean;
|
|
39
99
|
static styles: import("lit").CSSResult[];
|
|
40
|
-
render(): import("lit
|
|
100
|
+
render(): import("lit").TemplateResult<1>;
|
|
41
101
|
}
|
|
42
102
|
declare global {
|
|
43
103
|
interface HTMLElementTagNameMap {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moni-card.d.ts","sourceRoot":"","sources":["../../src/components/moni-card.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"moni-card.d.ts","sourceRoot":"","sources":["../../src/components/moni-card.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,qBACa,QAAS,SAAQ,WAAW;IACxC;;;;;;;;OAQG;IAEH,OAAO,EAAE,UAAU,GAAG,QAAQ,GAAG,UAAU,CAAc;IAEzD;;;;;;;OAOG;IACyC,SAAS,UAAS;IAE9D;;;;;;;;OAQG;IACyC,SAAS,UAAS;IAE9D;;;;;OAKG;IACyC,QAAQ,UAAS;IAE7D,OAAgB,MAAM,4BAmIpB;IAEO,MAAM;CAiBf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,WAAW,EAAE,QAAQ,CAAC;KACtB;CACD;AAED,eAAe,QAAQ,CAAC"}
|