@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,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-context-menu.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,31 +15,47 @@ import { customElement, property, state, query } from 'lit/decorators.js';
|
|
|
9
15
|
import { MoniElement, sharedStyles } from './_base/index.js';
|
|
10
16
|
import './moni-menu.js';
|
|
11
17
|
/**
|
|
12
|
-
*
|
|
18
|
+
* Material Design 3 Context Menu component.
|
|
19
|
+
*
|
|
20
|
+
* A specialized menu that opens at the exact coordinates of a pointer event,
|
|
21
|
+
* typically triggered by a right-click (`contextmenu` event). It provides
|
|
22
|
+
* contextual actions related to the specific item clicked.
|
|
23
|
+
*
|
|
24
|
+
* **M3 spec reference:** `m3-docs/components/menus/specs.md` (Contextual menus)
|
|
25
|
+
*
|
|
26
|
+
* **Triggering mechanism:**
|
|
27
|
+
* The component does not require programmatic triggering via an `open` property.
|
|
28
|
+
* Instead, it attaches a `contextmenu` event listener to its parent element
|
|
29
|
+
* during `connectedCallback`. When the parent is right-clicked, the menu
|
|
30
|
+
* captures the `clientX`/`clientY` coordinates, prevents the default browser
|
|
31
|
+
* context menu, and opens itself at the cursor position using `position: fixed`.
|
|
13
32
|
*
|
|
14
|
-
* **
|
|
15
|
-
* the
|
|
16
|
-
*
|
|
33
|
+
* **Auto-flip behavior (`flip` attribute):**
|
|
34
|
+
* Per the M3 guidelines, menus should flip to the opposite side of the cursor
|
|
35
|
+
* if opening in the requested `placement` would cause them to overflow the
|
|
36
|
+
* viewport. When `flip=true`, the component dynamically calculates viewport
|
|
37
|
+
* bounds before opening and overrides `placement` if necessary (e.g., flipping
|
|
38
|
+
* from `bottom` to `top` if clicked near the bottom of the screen).
|
|
17
39
|
*
|
|
18
|
-
* **
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* <moni-context-menu flip>
|
|
22
|
-
* <moni-menu-item>Cut</moni-menu-item>
|
|
23
|
-
* <moni-menu-item>Copy</moni-menu-item>
|
|
24
|
-
* <moni-menu-item>Paste</moni-menu-item>
|
|
25
|
-
* </moni-context-menu>
|
|
26
|
-
* Right-click anywhere in this div
|
|
27
|
-
* </div>
|
|
28
|
-
* ```
|
|
40
|
+
* **Auto-dismiss:**
|
|
41
|
+
* Closes automatically when clicking anywhere outside the menu, or when
|
|
42
|
+
* pressing the `Escape` key.
|
|
29
43
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```html
|
|
46
|
+
* <!-- Wrap the trigger area and the menu in a container -->
|
|
47
|
+
* <div>
|
|
48
|
+
* <p>Right-click me for options</p>
|
|
49
|
+
* <moni-context-menu flip>
|
|
50
|
+
* <moni-menu-item>Copy</moni-menu-item>
|
|
51
|
+
* <moni-menu-item>Paste</moni-menu-item>
|
|
52
|
+
* <moni-divider></moni-divider>
|
|
53
|
+
* <moni-menu-item>Delete</moni-menu-item>
|
|
54
|
+
* </moni-context-menu>
|
|
55
|
+
* </div>
|
|
56
|
+
* ```
|
|
34
57
|
*
|
|
35
|
-
*
|
|
36
|
-
* - default: menu items
|
|
58
|
+
* @slot default - The `<moni-menu-item>` elements that make up the menu.
|
|
37
59
|
*/
|
|
38
60
|
let MoniContextMenu = class MoniContextMenu extends MoniElement {
|
|
39
61
|
constructor() {
|
|
@@ -1,32 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-dialog.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
|
-
*
|
|
9
|
+
* Material Design 3 Dialog component.
|
|
10
|
+
*
|
|
11
|
+
* Dialogs inform users about a task and can contain critical information,
|
|
12
|
+
* require decisions, or involve multiple tasks. They interrupt the user's
|
|
13
|
+
* workflow and should be used sparingly.
|
|
14
|
+
*
|
|
15
|
+
* **M3 spec reference:** `m3-docs/components/dialogs/specs.md`
|
|
16
|
+
*
|
|
17
|
+
* **Implementation note — native `<dialog>` element:**
|
|
18
|
+
* This component wraps the native `<dialog>` HTML element. Opening and closing
|
|
19
|
+
* are controlled via the `open` attribute (and its JS property). The component
|
|
20
|
+
* syncs `open` changes to the native `<dialog>` in `updated()`:
|
|
21
|
+
* - `modal=true` → calls `dialog.showModal()` (blocks focus, adds backdrop).
|
|
22
|
+
* - `modal=false` → calls `dialog.show()` (non-blocking, no backdrop).
|
|
23
|
+
* - `open=false` → calls `dialog.close()`.
|
|
24
|
+
*
|
|
25
|
+
* **Placement (`side` attribute):**
|
|
26
|
+
* - `center` (default) — Centered in the viewport. Standard M3 dialog.
|
|
27
|
+
* - `top`, `right`, `bottom`, `left` — Edge-anchored panels (side sheet pattern).
|
|
28
|
+
* - `max` — Full-screen dialog for complex flows.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```html
|
|
32
|
+
* <!-- Basic modal dialog -->
|
|
33
|
+
* <moni-dialog open modal title="Delete item?" size="small">
|
|
34
|
+
* <p>This action cannot be undone.</p>
|
|
35
|
+
* <div slot="footer">
|
|
36
|
+
* <moni-button variant="text">Cancel</moni-button>
|
|
37
|
+
* <moni-button>Delete</moni-button>
|
|
38
|
+
* </div>
|
|
39
|
+
* </moni-dialog>
|
|
40
|
+
* ```
|
|
7
41
|
*
|
|
8
|
-
*
|
|
9
|
-
* -
|
|
10
|
-
* -
|
|
11
|
-
* - size: small | medium (default) | large
|
|
12
|
-
* - modal: present → adds the `modal` class (used by BeerCSS)
|
|
13
|
-
* - title: header text
|
|
42
|
+
* @slot default - The dialog body content.
|
|
43
|
+
* @slot header - Custom header content (overrides `title` attribute).
|
|
44
|
+
* @slot footer - Action buttons row at the bottom of the dialog.
|
|
14
45
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
46
|
+
* @csspart dialog - The native `<dialog>` element.
|
|
47
|
+
* @csspart header - The header container.
|
|
48
|
+
* @csspart body - The body content wrapper.
|
|
49
|
+
* @csspart footer - The footer actions wrapper.
|
|
19
50
|
*/
|
|
20
51
|
export declare class MoniDialog extends MoniElement {
|
|
52
|
+
/**
|
|
53
|
+
* Controls the open/closed state of the dialog.
|
|
54
|
+
*
|
|
55
|
+
* When set to `true`, the component calls `dialog.showModal()` (if `modal`)
|
|
56
|
+
* or `dialog.show()`. When set to `false`, calls `dialog.close()`.
|
|
57
|
+
* Reflected as an HTML attribute for CSS and external state readers.
|
|
58
|
+
*
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
21
61
|
open: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* When `true`, opens the dialog as a modal using `<dialog>.showModal()`.
|
|
64
|
+
*
|
|
65
|
+
* Modal dialogs:
|
|
66
|
+
* - Block keyboard focus from leaving the dialog.
|
|
67
|
+
* - Render a `::backdrop` scrim over the rest of the page.
|
|
68
|
+
* - Can be closed by pressing `Escape` (native browser behavior).
|
|
69
|
+
*
|
|
70
|
+
* When `false`, uses `<dialog>.show()` which is non-blocking (no focus trap
|
|
71
|
+
* and no backdrop).
|
|
72
|
+
*
|
|
73
|
+
* @default false
|
|
74
|
+
*/
|
|
22
75
|
modal: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Placement of the dialog within the viewport.
|
|
78
|
+
*
|
|
79
|
+
* - `'center'` (default) — Centered. Standard M3 dialog placement.
|
|
80
|
+
* - `'top'` — Anchored to the top edge (drawer from top).
|
|
81
|
+
* - `'right'` — Anchored to the right edge (side sheet pattern).
|
|
82
|
+
* - `'bottom'` — Anchored to the bottom edge (bottom sheet alternative).
|
|
83
|
+
* - `'left'` — Anchored to the left edge (navigation drawer pattern).
|
|
84
|
+
* - `'max'` — Full-screen (covers the entire viewport).
|
|
85
|
+
*
|
|
86
|
+
* @default 'center'
|
|
87
|
+
*/
|
|
23
88
|
side: 'center' | 'top' | 'right' | 'bottom' | 'left' | 'max';
|
|
89
|
+
/**
|
|
90
|
+
* Size of the dialog container.
|
|
91
|
+
*
|
|
92
|
+
* - `'small'` — Narrow dialog; ideal for simple confirmations.
|
|
93
|
+
* - `'medium'` — Standard dialog width (default).
|
|
94
|
+
* - `'large'` — Wide dialog; for forms or complex content.
|
|
95
|
+
*
|
|
96
|
+
* @default 'medium'
|
|
97
|
+
*/
|
|
24
98
|
size: 'small' | 'medium' | 'large';
|
|
99
|
+
/**
|
|
100
|
+
* Text displayed in the dialog header area.
|
|
101
|
+
*
|
|
102
|
+
* When non-empty, renders as a styled heading inside the header container.
|
|
103
|
+
* The `header` slot takes precedence over this attribute when both are present.
|
|
104
|
+
*
|
|
105
|
+
* @default ''
|
|
106
|
+
*/
|
|
25
107
|
title: string;
|
|
108
|
+
/** Direct reference to the native `<dialog>` element for programmatic access. */
|
|
26
109
|
private _dialog;
|
|
110
|
+
/**
|
|
111
|
+
* Syncs the `open` and `modal` state to the native `<dialog>` element.
|
|
112
|
+
*
|
|
113
|
+
* Called by Lit after every render cycle where tracked properties change.
|
|
114
|
+
* Avoids calling `showModal()` or `show()` if the dialog is already open
|
|
115
|
+
* (prevents the `InvalidStateError` DOMException).
|
|
116
|
+
*
|
|
117
|
+
* @param changed - Map of changed property names to their previous values.
|
|
118
|
+
*/
|
|
27
119
|
updated(changed: Map<string, unknown>): void;
|
|
28
120
|
static styles: import("lit").CSSResult[];
|
|
29
|
-
render(): import("lit
|
|
121
|
+
render(): import("lit").TemplateResult<1>;
|
|
30
122
|
}
|
|
31
123
|
declare global {
|
|
32
124
|
interface HTMLElementTagNameMap {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moni-dialog.d.ts","sourceRoot":"","sources":["../../src/components/moni-dialog.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"moni-dialog.d.ts","sourceRoot":"","sources":["../../src/components/moni-dialog.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,qBACa,UAAW,SAAQ,WAAW;IAC1C;;;;;;;;OAQG;IACyC,IAAI,UAAS;IAEzD;;;;;;;;;;;;OAYG;IACyC,KAAK,UAAS;IAE1D;;;;;;;;;;;OAWG;IAEH,IAAI,EAAE,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,CAAY;IAExE;;;;;;;;OAQG;IAEH,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAY;IAE9C;;;;;;;OAOG;IAC0B,KAAK,SAAM;IAExC,iFAAiF;IAChE,OAAO,CAAC,OAAO,CAAqB;IAErD;;;;;;;;OAQG;IACM,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAoB9C,OAAgB,MAAM,4BAgKpB;IAEO,MAAM;CAef;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-dialog.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,117 @@ import { html, css } from 'lit';
|
|
|
8
14
|
import { customElement, property, query } from 'lit/decorators.js';
|
|
9
15
|
import { MoniElement, sharedStyles } from './_base/index.js';
|
|
10
16
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
17
|
+
* Material Design 3 Dialog component.
|
|
18
|
+
*
|
|
19
|
+
* Dialogs inform users about a task and can contain critical information,
|
|
20
|
+
* require decisions, or involve multiple tasks. They interrupt the user's
|
|
21
|
+
* workflow and should be used sparingly.
|
|
22
|
+
*
|
|
23
|
+
* **M3 spec reference:** `m3-docs/components/dialogs/specs.md`
|
|
24
|
+
*
|
|
25
|
+
* **Implementation note — native `<dialog>` element:**
|
|
26
|
+
* This component wraps the native `<dialog>` HTML element. Opening and closing
|
|
27
|
+
* are controlled via the `open` attribute (and its JS property). The component
|
|
28
|
+
* syncs `open` changes to the native `<dialog>` in `updated()`:
|
|
29
|
+
* - `modal=true` → calls `dialog.showModal()` (blocks focus, adds backdrop).
|
|
30
|
+
* - `modal=false` → calls `dialog.show()` (non-blocking, no backdrop).
|
|
31
|
+
* - `open=false` → calls `dialog.close()`.
|
|
32
|
+
*
|
|
33
|
+
* **Placement (`side` attribute):**
|
|
34
|
+
* - `center` (default) — Centered in the viewport. Standard M3 dialog.
|
|
35
|
+
* - `top`, `right`, `bottom`, `left` — Edge-anchored panels (side sheet pattern).
|
|
36
|
+
* - `max` — Full-screen dialog for complex flows.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```html
|
|
40
|
+
* <!-- Basic modal dialog -->
|
|
41
|
+
* <moni-dialog open modal title="Delete item?" size="small">
|
|
42
|
+
* <p>This action cannot be undone.</p>
|
|
43
|
+
* <div slot="footer">
|
|
44
|
+
* <moni-button variant="text">Cancel</moni-button>
|
|
45
|
+
* <moni-button>Delete</moni-button>
|
|
46
|
+
* </div>
|
|
47
|
+
* </moni-dialog>
|
|
48
|
+
* ```
|
|
15
49
|
*
|
|
16
|
-
*
|
|
17
|
-
* -
|
|
18
|
-
* -
|
|
19
|
-
* - size: small | medium (default) | large
|
|
20
|
-
* - modal: present → adds the `modal` class (used by BeerCSS)
|
|
21
|
-
* - title: header text
|
|
50
|
+
* @slot default - The dialog body content.
|
|
51
|
+
* @slot header - Custom header content (overrides `title` attribute).
|
|
52
|
+
* @slot footer - Action buttons row at the bottom of the dialog.
|
|
22
53
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
54
|
+
* @csspart dialog - The native `<dialog>` element.
|
|
55
|
+
* @csspart header - The header container.
|
|
56
|
+
* @csspart body - The body content wrapper.
|
|
57
|
+
* @csspart footer - The footer actions wrapper.
|
|
27
58
|
*/
|
|
28
59
|
let MoniDialog = class MoniDialog extends MoniElement {
|
|
29
60
|
constructor() {
|
|
30
61
|
super(...arguments);
|
|
62
|
+
/**
|
|
63
|
+
* Controls the open/closed state of the dialog.
|
|
64
|
+
*
|
|
65
|
+
* When set to `true`, the component calls `dialog.showModal()` (if `modal`)
|
|
66
|
+
* or `dialog.show()`. When set to `false`, calls `dialog.close()`.
|
|
67
|
+
* Reflected as an HTML attribute for CSS and external state readers.
|
|
68
|
+
*
|
|
69
|
+
* @default false
|
|
70
|
+
*/
|
|
31
71
|
this.open = false;
|
|
72
|
+
/**
|
|
73
|
+
* When `true`, opens the dialog as a modal using `<dialog>.showModal()`.
|
|
74
|
+
*
|
|
75
|
+
* Modal dialogs:
|
|
76
|
+
* - Block keyboard focus from leaving the dialog.
|
|
77
|
+
* - Render a `::backdrop` scrim over the rest of the page.
|
|
78
|
+
* - Can be closed by pressing `Escape` (native browser behavior).
|
|
79
|
+
*
|
|
80
|
+
* When `false`, uses `<dialog>.show()` which is non-blocking (no focus trap
|
|
81
|
+
* and no backdrop).
|
|
82
|
+
*
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
32
85
|
this.modal = false;
|
|
86
|
+
/**
|
|
87
|
+
* Placement of the dialog within the viewport.
|
|
88
|
+
*
|
|
89
|
+
* - `'center'` (default) — Centered. Standard M3 dialog placement.
|
|
90
|
+
* - `'top'` — Anchored to the top edge (drawer from top).
|
|
91
|
+
* - `'right'` — Anchored to the right edge (side sheet pattern).
|
|
92
|
+
* - `'bottom'` — Anchored to the bottom edge (bottom sheet alternative).
|
|
93
|
+
* - `'left'` — Anchored to the left edge (navigation drawer pattern).
|
|
94
|
+
* - `'max'` — Full-screen (covers the entire viewport).
|
|
95
|
+
*
|
|
96
|
+
* @default 'center'
|
|
97
|
+
*/
|
|
33
98
|
this.side = 'center';
|
|
99
|
+
/**
|
|
100
|
+
* Size of the dialog container.
|
|
101
|
+
*
|
|
102
|
+
* - `'small'` — Narrow dialog; ideal for simple confirmations.
|
|
103
|
+
* - `'medium'` — Standard dialog width (default).
|
|
104
|
+
* - `'large'` — Wide dialog; for forms or complex content.
|
|
105
|
+
*
|
|
106
|
+
* @default 'medium'
|
|
107
|
+
*/
|
|
34
108
|
this.size = 'medium';
|
|
109
|
+
/**
|
|
110
|
+
* Text displayed in the dialog header area.
|
|
111
|
+
*
|
|
112
|
+
* When non-empty, renders as a styled heading inside the header container.
|
|
113
|
+
* The `header` slot takes precedence over this attribute when both are present.
|
|
114
|
+
*
|
|
115
|
+
* @default ''
|
|
116
|
+
*/
|
|
35
117
|
this.title = '';
|
|
36
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Syncs the `open` and `modal` state to the native `<dialog>` element.
|
|
121
|
+
*
|
|
122
|
+
* Called by Lit after every render cycle where tracked properties change.
|
|
123
|
+
* Avoids calling `showModal()` or `show()` if the dialog is already open
|
|
124
|
+
* (prevents the `InvalidStateError` DOMException).
|
|
125
|
+
*
|
|
126
|
+
* @param changed - Map of changed property names to their previous values.
|
|
127
|
+
*/
|
|
37
128
|
updated(changed) {
|
|
38
129
|
if (changed.has('open') && this._dialog) {
|
|
39
130
|
if (this.open) {
|
|
@@ -1,28 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-divider.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 Divider
|
|
9
|
+
* Material Design 3 Divider component.
|
|
10
|
+
*
|
|
11
|
+
* A thin horizontal (or vertical) rule used to visually separate content
|
|
12
|
+
* sections within lists, layouts, and cards.
|
|
13
|
+
*
|
|
14
|
+
* **M3 spec reference:** `m3-docs/components/divider/specs.md`
|
|
15
|
+
*
|
|
16
|
+
* **M3 measurements:**
|
|
17
|
+
* - Thickness: 1dp (`0.0625rem`).
|
|
18
|
+
* - Color: `outline-variant` — subtle on all surface backgrounds.
|
|
19
|
+
* - Inset variants align the line with list content:
|
|
20
|
+
* - `leading` — 16dp margin from the leading edge (aligns with icon text).
|
|
21
|
+
* - `middle` — 16dp margin on both edges.
|
|
22
|
+
* - `none` — full-bleed (no margin).
|
|
4
23
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* with text content below an icon.
|
|
10
|
-
* - **middle**: indented from both edges (16dp each).
|
|
24
|
+
* **Vertical usage:**
|
|
25
|
+
* While not yet exposed as an attribute, the `[vertical]` CSS attribute selector
|
|
26
|
+
* is supported. Set `vertical` as an HTML attribute to render a 1dp-wide
|
|
27
|
+
* vertical divider that stretches to match its flex container's cross-axis.
|
|
11
28
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```html
|
|
31
|
+
* <!-- Full-bleed divider between sections -->
|
|
32
|
+
* <moni-divider inset="none"></moni-divider>
|
|
15
33
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
34
|
+
* <!-- Leading-inset divider in a list (aligns with list item text) -->
|
|
35
|
+
* <moni-divider></moni-divider>
|
|
18
36
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
37
|
+
* <!-- Vertical divider inside a flex container -->
|
|
38
|
+
* <div style="display:flex; height: 3rem; align-items:center; gap: 1rem;">
|
|
39
|
+
* <span>Section A</span>
|
|
40
|
+
* <moni-divider vertical></moni-divider>
|
|
41
|
+
* <span>Section B</span>
|
|
42
|
+
* </div>
|
|
43
|
+
* ```
|
|
21
44
|
*/
|
|
22
45
|
export declare class MoniDivider extends MoniElement {
|
|
46
|
+
/**
|
|
47
|
+
* Controls the horizontal margin on the divider line.
|
|
48
|
+
*
|
|
49
|
+
* - `'leading'` (default) — 16dp margin from the leading (start) edge only.
|
|
50
|
+
* Use in lists to align the divider with the primary text of list items.
|
|
51
|
+
* - `'middle'` — 16dp margin on both the leading and trailing edges.
|
|
52
|
+
* Use to separate sections where full-bleed would be too visually heavy.
|
|
53
|
+
* - `'none'` — No margin; the line spans the full parent width.
|
|
54
|
+
* Use as a section separator or between cards.
|
|
55
|
+
*
|
|
56
|
+
* @default 'leading'
|
|
57
|
+
*/
|
|
23
58
|
inset: 'leading' | 'middle' | 'none';
|
|
24
59
|
static styles: import("lit").CSSResult[];
|
|
25
|
-
render(): import("lit
|
|
60
|
+
render(): import("lit").TemplateResult<1>;
|
|
26
61
|
}
|
|
27
62
|
declare global {
|
|
28
63
|
interface HTMLElementTagNameMap {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moni-divider.d.ts","sourceRoot":"","sources":["../../src/components/moni-divider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"moni-divider.d.ts","sourceRoot":"","sources":["../../src/components/moni-divider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,qBACa,WAAY,SAAQ,WAAW;IAC3C;;;;;;;;;;;OAWG;IAEH,KAAK,EAAE,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAa;IAEjD,OAAgB,MAAM,4BAkCpB;IAEO,MAAM;CAGf;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-divider.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,28 +14,57 @@ import { html, css } from 'lit';
|
|
|
8
14
|
import { customElement, property } from 'lit/decorators.js';
|
|
9
15
|
import { MoniElement, sharedStyles } from './_base/index.js';
|
|
10
16
|
/**
|
|
11
|
-
* Material 3 Divider
|
|
17
|
+
* Material Design 3 Divider component.
|
|
18
|
+
*
|
|
19
|
+
* A thin horizontal (or vertical) rule used to visually separate content
|
|
20
|
+
* sections within lists, layouts, and cards.
|
|
21
|
+
*
|
|
22
|
+
* **M3 spec reference:** `m3-docs/components/divider/specs.md`
|
|
23
|
+
*
|
|
24
|
+
* **M3 measurements:**
|
|
25
|
+
* - Thickness: 1dp (`0.0625rem`).
|
|
26
|
+
* - Color: `outline-variant` — subtle on all surface backgrounds.
|
|
27
|
+
* - Inset variants align the line with list content:
|
|
28
|
+
* - `leading` — 16dp margin from the leading edge (aligns with icon text).
|
|
29
|
+
* - `middle` — 16dp margin on both edges.
|
|
30
|
+
* - `none` — full-bleed (no margin).
|
|
12
31
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* with text content below an icon.
|
|
18
|
-
* - **middle**: indented from both edges (16dp each).
|
|
32
|
+
* **Vertical usage:**
|
|
33
|
+
* While not yet exposed as an attribute, the `[vertical]` CSS attribute selector
|
|
34
|
+
* is supported. Set `vertical` as an HTML attribute to render a 1dp-wide
|
|
35
|
+
* vertical divider that stretches to match its flex container's cross-axis.
|
|
19
36
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```html
|
|
39
|
+
* <!-- Full-bleed divider between sections -->
|
|
40
|
+
* <moni-divider inset="none"></moni-divider>
|
|
23
41
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
42
|
+
* <!-- Leading-inset divider in a list (aligns with list item text) -->
|
|
43
|
+
* <moni-divider></moni-divider>
|
|
26
44
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
45
|
+
* <!-- Vertical divider inside a flex container -->
|
|
46
|
+
* <div style="display:flex; height: 3rem; align-items:center; gap: 1rem;">
|
|
47
|
+
* <span>Section A</span>
|
|
48
|
+
* <moni-divider vertical></moni-divider>
|
|
49
|
+
* <span>Section B</span>
|
|
50
|
+
* </div>
|
|
51
|
+
* ```
|
|
29
52
|
*/
|
|
30
53
|
let MoniDivider = class MoniDivider extends MoniElement {
|
|
31
54
|
constructor() {
|
|
32
55
|
super(...arguments);
|
|
56
|
+
/**
|
|
57
|
+
* Controls the horizontal margin on the divider line.
|
|
58
|
+
*
|
|
59
|
+
* - `'leading'` (default) — 16dp margin from the leading (start) edge only.
|
|
60
|
+
* Use in lists to align the divider with the primary text of list items.
|
|
61
|
+
* - `'middle'` — 16dp margin on both the leading and trailing edges.
|
|
62
|
+
* Use to separate sections where full-bleed would be too visually heavy.
|
|
63
|
+
* - `'none'` — No margin; the line spans the full parent width.
|
|
64
|
+
* Use as a section separator or between cards.
|
|
65
|
+
*
|
|
66
|
+
* @default 'leading'
|
|
67
|
+
*/
|
|
33
68
|
this.inset = 'leading';
|
|
34
69
|
}
|
|
35
70
|
static { this.styles = [
|
|
@@ -1,20 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-expansion.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 Expansion panel component.
|
|
10
|
+
*
|
|
11
|
+
* A lightweight wrapper around the native HTML `<details>` and `<summary>`
|
|
12
|
+
* elements, styled according to M3 surface and elevation guidelines.
|
|
13
|
+
* Expansion panels contain creation flows and allow lightweight editing of an element.
|
|
14
|
+
*
|
|
15
|
+
* **Visual architecture:**
|
|
16
|
+
* The component renders a `<details>` element with a `<summary>` that acts
|
|
17
|
+
* as the expandable header. The default slot content is placed inside the
|
|
18
|
+
* `<details>` tag (but outside the `<summary>`), naturally hiding and showing
|
|
19
|
+
* based on the native behavior. An M3 `expand_more` icon is added via a CSS
|
|
20
|
+
* `::after` pseudo-element and rotates when the panel is open.
|
|
21
|
+
*
|
|
22
|
+
* **Usage:**
|
|
23
|
+
* Set the `title` attribute for a simple text header, or use the `summary`
|
|
24
|
+
* slot to project custom rich content (like icons or secondary text) into the
|
|
25
|
+
* header area.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```html
|
|
29
|
+
* <!-- Simple text title -->
|
|
30
|
+
* <moni-expansion title="Advanced Settings">
|
|
31
|
+
* <p>Enable developer mode features here.</p>
|
|
32
|
+
* </moni-expansion>
|
|
4
33
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
34
|
+
* <!-- Rich summary content via slot -->
|
|
35
|
+
* <moni-expansion open>
|
|
36
|
+
* <div slot="summary" style="display: flex; gap: 8px;">
|
|
37
|
+
* <moni-icon>person</moni-icon>
|
|
38
|
+
* <span>Personal Information</span>
|
|
39
|
+
* </div>
|
|
40
|
+
* <form>
|
|
41
|
+
* <moni-text-field label="Name"></moni-text-field>
|
|
42
|
+
* </form>
|
|
43
|
+
* </moni-expansion>
|
|
44
|
+
* ```
|
|
8
45
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* - summary: custom summary content (overrides title)
|
|
46
|
+
* @slot default - The content of the expansion panel body.
|
|
47
|
+
* @slot summary - Custom header content (overrides the `title` attribute).
|
|
12
48
|
*/
|
|
13
49
|
export declare class MoniExpansion extends MoniElement {
|
|
14
50
|
open: boolean;
|
|
15
51
|
title: string;
|
|
16
52
|
static styles: import("lit").CSSResult[];
|
|
17
|
-
render(): import("lit
|
|
53
|
+
render(): import("lit").TemplateResult<1>;
|
|
18
54
|
}
|
|
19
55
|
declare global {
|
|
20
56
|
interface HTMLElementTagNameMap {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moni-expansion.d.ts","sourceRoot":"","sources":["../../src/components/moni-expansion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"moni-expansion.d.ts","sourceRoot":"","sources":["../../src/components/moni-expansion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,qBACa,aAAc,SAAQ,WAAW;IACD,IAAI,UAAS;IAC5B,KAAK,SAAM;IAExC,OAAgB,MAAM,4BA6CpB;IAEO,MAAM;CAUf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,gBAAgB,EAAE,aAAa,CAAC;KAChC;CACD;AAED,eAAe,aAAa,CAAC"}
|