@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-expansion.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,15 +14,45 @@ 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
|
-
*
|
|
17
|
+
* Material Design 3 Expansion panel component.
|
|
18
|
+
*
|
|
19
|
+
* A lightweight wrapper around the native HTML `<details>` and `<summary>`
|
|
20
|
+
* elements, styled according to M3 surface and elevation guidelines.
|
|
21
|
+
* Expansion panels contain creation flows and allow lightweight editing of an element.
|
|
22
|
+
*
|
|
23
|
+
* **Visual architecture:**
|
|
24
|
+
* The component renders a `<details>` element with a `<summary>` that acts
|
|
25
|
+
* as the expandable header. The default slot content is placed inside the
|
|
26
|
+
* `<details>` tag (but outside the `<summary>`), naturally hiding and showing
|
|
27
|
+
* based on the native behavior. An M3 `expand_more` icon is added via a CSS
|
|
28
|
+
* `::after` pseudo-element and rotates when the panel is open.
|
|
29
|
+
*
|
|
30
|
+
* **Usage:**
|
|
31
|
+
* Set the `title` attribute for a simple text header, or use the `summary`
|
|
32
|
+
* slot to project custom rich content (like icons or secondary text) into the
|
|
33
|
+
* header area.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```html
|
|
37
|
+
* <!-- Simple text title -->
|
|
38
|
+
* <moni-expansion title="Advanced Settings">
|
|
39
|
+
* <p>Enable developer mode features here.</p>
|
|
40
|
+
* </moni-expansion>
|
|
12
41
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
42
|
+
* <!-- Rich summary content via slot -->
|
|
43
|
+
* <moni-expansion open>
|
|
44
|
+
* <div slot="summary" style="display: flex; gap: 8px;">
|
|
45
|
+
* <moni-icon>person</moni-icon>
|
|
46
|
+
* <span>Personal Information</span>
|
|
47
|
+
* </div>
|
|
48
|
+
* <form>
|
|
49
|
+
* <moni-text-field label="Name"></moni-text-field>
|
|
50
|
+
* </form>
|
|
51
|
+
* </moni-expansion>
|
|
52
|
+
* ```
|
|
16
53
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* - summary: custom summary content (overrides title)
|
|
54
|
+
* @slot default - The content of the expansion panel body.
|
|
55
|
+
* @slot summary - Custom header content (overrides the `title` attribute).
|
|
20
56
|
*/
|
|
21
57
|
let MoniExpansion = class MoniExpansion extends MoniElement {
|
|
22
58
|
constructor() {
|
|
@@ -1,29 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-fab-menu.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-fab.js';
|
|
3
9
|
import './moni-icon.js';
|
|
4
10
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
11
|
+
* Material Design 3 FAB Menu component.
|
|
12
|
+
*
|
|
13
|
+
* A specialized container that combines a main `<moni-fab>` trigger with a
|
|
14
|
+
* `<menu>` of secondary FABs. It allows multiple actions to be tucked away
|
|
15
|
+
* behind a single primary Floating Action Button, reducing screen clutter.
|
|
16
|
+
*
|
|
17
|
+
* **M3 spec reference:** `m3-docs/components/floating-action-buttons/specs.md` (FAB menus)
|
|
18
|
+
*
|
|
19
|
+
* **Trigger and animation:**
|
|
20
|
+
* The component wires the primary trigger FAB's `click` event to toggle its
|
|
21
|
+
* internal `open` state. When `open=true`, the nested secondary FABs scale up
|
|
22
|
+
* and fade in via CSS transitions. Consumers can also control the `open` state
|
|
23
|
+
* programmatically by setting the attribute.
|
|
24
|
+
*
|
|
25
|
+
* **Focus management (Accessibility):**
|
|
26
|
+
* - When the menu opens, focus automatically moves to the first focusable
|
|
27
|
+
* secondary item (or remains on the trigger if empty).
|
|
28
|
+
* - While open, the `Tab` key cycles focus strictly within the menu items to
|
|
29
|
+
* prevent keyboard focus from escaping (focus trap).
|
|
30
|
+
* - Pressing `Escape` or clicking anywhere outside the menu closes it and
|
|
31
|
+
* returns focus to the primary trigger FAB.
|
|
7
32
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```html
|
|
35
|
+
* <!-- Bottom-trailing FAB menu opening upwards -->
|
|
36
|
+
* <moni-fab-menu icon="add" color="tertiary" direction="up">
|
|
37
|
+
* <moni-fab size="small" icon="edit" label="Draft"></moni-fab>
|
|
38
|
+
* <moni-fab size="small" icon="photo_camera" label="Camera"></moni-fab>
|
|
39
|
+
* </moni-fab-menu>
|
|
40
|
+
* ```
|
|
11
41
|
*
|
|
12
|
-
*
|
|
13
|
-
* - When `open` becomes true, focus moves to the first focusable item in
|
|
14
|
-
* the menu (or stays on the trigger if the menu is empty).
|
|
15
|
-
* - When `open` becomes false, focus returns to the trigger.
|
|
16
|
-
* - `Tab` cycles within the menu while open; `Escape` closes the menu.
|
|
17
|
-
* - Click outside the menu closes it.
|
|
42
|
+
* @slot default - The secondary `<moni-fab>` elements that appear when open.
|
|
18
43
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* - icon: Material Symbols name for the trigger
|
|
22
|
-
* - size: small | medium (default) | large
|
|
23
|
-
* - color: primary (default) | secondary | tertiary | surface
|
|
24
|
-
* - shape: rounded (default) | circle
|
|
25
|
-
* - direction: up (default) | down | left | right
|
|
26
|
-
* - position: same as moni-fab
|
|
44
|
+
* @csspart trigger - The primary `<moni-fab>` trigger element.
|
|
45
|
+
* @csspart menu - The `<menu>` container holding the secondary items.
|
|
27
46
|
*/
|
|
28
47
|
export declare class MoniFabMenu extends MoniElement {
|
|
29
48
|
open: boolean;
|
|
@@ -47,7 +66,7 @@ export declare class MoniFabMenu extends MoniElement {
|
|
|
47
66
|
private _handleDocKeydown;
|
|
48
67
|
private _firstFocusableMenuItem;
|
|
49
68
|
static styles: import("lit").CSSResult[];
|
|
50
|
-
render(): import("lit
|
|
69
|
+
render(): import("lit").TemplateResult<1>;
|
|
51
70
|
}
|
|
52
71
|
declare global {
|
|
53
72
|
interface HTMLElementTagNameMap {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moni-fab-menu.d.ts","sourceRoot":"","sources":["../../src/components/moni-fab-menu.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"moni-fab-menu.d.ts","sourceRoot":"","sources":["../../src/components/moni-fab-menu.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAC7D,OAAO,eAAe,CAAC;AACvB,OAAO,gBAAgB,CAAC;AAGxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,qBACa,WAAY,SAAQ,WAAW;IACC,IAAI,UAAS;IAC5B,IAAI,SAAS;IAE1C,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAY;IAE9C,KAAK,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,CAAa;IAEpE,KAAK,EAAE,SAAS,GAAG,QAAQ,CAAa;IAExC,SAAS,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAQ;IAEnD,QAAQ,EACL,iBAAiB,GACjB,gBAAgB,GAChB,cAAc,GACd,aAAa,CAAqB;IAElB,OAAO,CAAC,QAAQ,CAAW;IAC1B,OAAO,CAAC,KAAK,CAAe;IAEhD,OAAO,CAAC,kBAAkB,CAA4B;IACtD,OAAO,CAAC,WAAW,CAA8C;IACjE,OAAO,CAAC,aAAa,CAAmD;IAEzD,YAAY;IAQlB,oBAAoB;IAOpB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAOrD,OAAO,CAAC,eAAe,CAErB;IAEF,OAAO,CAAC,cAAc;IA0BtB,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,uBAAuB;IAQ/B,OAAgB,MAAM,4BA8EpB;IAEO,MAAM;CAef;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,eAAe,EAAE,WAAW,CAAC;KAC7B;CACD;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-fab-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);
|
|
@@ -10,28 +16,41 @@ import { MoniElement, sharedStyles } from './_base/index.js';
|
|
|
10
16
|
import './moni-fab.js';
|
|
11
17
|
import './moni-icon.js';
|
|
12
18
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
19
|
+
* Material Design 3 FAB Menu component.
|
|
20
|
+
*
|
|
21
|
+
* A specialized container that combines a main `<moni-fab>` trigger with a
|
|
22
|
+
* `<menu>` of secondary FABs. It allows multiple actions to be tucked away
|
|
23
|
+
* behind a single primary Floating Action Button, reducing screen clutter.
|
|
24
|
+
*
|
|
25
|
+
* **M3 spec reference:** `m3-docs/components/floating-action-buttons/specs.md` (FAB menus)
|
|
26
|
+
*
|
|
27
|
+
* **Trigger and animation:**
|
|
28
|
+
* The component wires the primary trigger FAB's `click` event to toggle its
|
|
29
|
+
* internal `open` state. When `open=true`, the nested secondary FABs scale up
|
|
30
|
+
* and fade in via CSS transitions. Consumers can also control the `open` state
|
|
31
|
+
* programmatically by setting the attribute.
|
|
32
|
+
*
|
|
33
|
+
* **Focus management (Accessibility):**
|
|
34
|
+
* - When the menu opens, focus automatically moves to the first focusable
|
|
35
|
+
* secondary item (or remains on the trigger if empty).
|
|
36
|
+
* - While open, the `Tab` key cycles focus strictly within the menu items to
|
|
37
|
+
* prevent keyboard focus from escaping (focus trap).
|
|
38
|
+
* - Pressing `Escape` or clicking anywhere outside the menu closes it and
|
|
39
|
+
* returns focus to the primary trigger FAB.
|
|
15
40
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```html
|
|
43
|
+
* <!-- Bottom-trailing FAB menu opening upwards -->
|
|
44
|
+
* <moni-fab-menu icon="add" color="tertiary" direction="up">
|
|
45
|
+
* <moni-fab size="small" icon="edit" label="Draft"></moni-fab>
|
|
46
|
+
* <moni-fab size="small" icon="photo_camera" label="Camera"></moni-fab>
|
|
47
|
+
* </moni-fab-menu>
|
|
48
|
+
* ```
|
|
19
49
|
*
|
|
20
|
-
*
|
|
21
|
-
* - When `open` becomes true, focus moves to the first focusable item in
|
|
22
|
-
* the menu (or stays on the trigger if the menu is empty).
|
|
23
|
-
* - When `open` becomes false, focus returns to the trigger.
|
|
24
|
-
* - `Tab` cycles within the menu while open; `Escape` closes the menu.
|
|
25
|
-
* - Click outside the menu closes it.
|
|
50
|
+
* @slot default - The secondary `<moni-fab>` elements that appear when open.
|
|
26
51
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* - icon: Material Symbols name for the trigger
|
|
30
|
-
* - size: small | medium (default) | large
|
|
31
|
-
* - color: primary (default) | secondary | tertiary | surface
|
|
32
|
-
* - shape: rounded (default) | circle
|
|
33
|
-
* - direction: up (default) | down | left | right
|
|
34
|
-
* - position: same as moni-fab
|
|
52
|
+
* @csspart trigger - The primary `<moni-fab>` trigger element.
|
|
53
|
+
* @csspart menu - The `<menu>` container holding the secondary items.
|
|
35
54
|
*/
|
|
36
55
|
let MoniFabMenu = class MoniFabMenu extends MoniElement {
|
|
37
56
|
constructor() {
|
|
@@ -1,28 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-fab.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
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
10
|
+
* Material Design 3 Floating Action Button (FAB) component.
|
|
11
|
+
*
|
|
12
|
+
* FABs represent the primary, or most common, action on a screen. They appear
|
|
13
|
+
* in front of all screen content, typically as a circular shape with an icon in
|
|
14
|
+
* its center.
|
|
15
|
+
*
|
|
16
|
+
* **M3 spec reference:** `m3-docs/components/floating-action-buttons/specs.md`
|
|
17
|
+
*
|
|
18
|
+
* **M3 Expressive Updates & Deprecations (May 2025):**
|
|
19
|
+
* - `size="small"` is **no longer recommended** by M3. Use `medium` (40dp or 56dp)
|
|
20
|
+
* or `large` (96dp). Deprecated in v0.3.1; will be removed in v1.0.
|
|
21
|
+
* - `shape="circle"` is **not part of M3**. M3 FABs use a `rounded` shape with a
|
|
22
|
+
* 16dp corner radius (which morphs to a `full` radius on hover/focus).
|
|
23
|
+
* Deprecated in v0.3.1; will be removed in v1.0.
|
|
24
|
+
* - `color="surface"` is **no longer recommended**. Use `primary`, `secondary`,
|
|
25
|
+
* or `tertiary` to ensure proper color mapping to the M3 theme.
|
|
26
|
+
*
|
|
27
|
+
* **Extended FABs:**
|
|
28
|
+
* When `extended` is true, the FAB displays a text label next to the icon.
|
|
29
|
+
* Extended FABs are wider and are typically used when the action needs explicit
|
|
30
|
+
* text to be clear. The `expanded` attribute forces the FAB to its full extended
|
|
31
|
+
* width, useful for animating between standard and extended states on scroll.
|
|
32
|
+
*
|
|
33
|
+
* **Positioning:**
|
|
34
|
+
* The `position` attribute applies predefined absolute/fixed positioning
|
|
35
|
+
* (e.g. `bottom-trailing`), snapping the FAB to standard screen corners.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```html
|
|
39
|
+
* <!-- Standard primary FAB -->
|
|
40
|
+
* <moni-fab icon="edit"></moni-fab>
|
|
41
|
+
*
|
|
42
|
+
* <!-- Extended tertiary FAB -->
|
|
43
|
+
* <moni-fab color="tertiary" extended icon="add" label="New task"></moni-fab>
|
|
44
|
+
*
|
|
45
|
+
* <!-- Positioned FAB -->
|
|
46
|
+
* <moni-fab position="bottom-trailing" icon="navigation"></moni-fab>
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @csspart button - The internal `<button>` element.
|
|
50
|
+
* @csspart icon - The container for the icon.
|
|
51
|
+
* @csspart label - The text label (only visible when extended).
|
|
26
52
|
*/
|
|
27
53
|
export declare class MoniFab extends MoniElement {
|
|
28
54
|
private static _deprecationWarned;
|
|
@@ -37,7 +63,7 @@ export declare class MoniFab extends MoniElement {
|
|
|
37
63
|
position: 'bottom-trailing' | 'bottom-leading' | 'top-trailing' | 'top-leading';
|
|
38
64
|
connectedCallback(): void;
|
|
39
65
|
static styles: import("lit").CSSResult[];
|
|
40
|
-
render(): import("lit
|
|
66
|
+
render(): import("lit").TemplateResult<1>;
|
|
41
67
|
}
|
|
42
68
|
declare global {
|
|
43
69
|
interface HTMLElementTagNameMap {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moni-fab.d.ts","sourceRoot":"","sources":["../../src/components/moni-fab.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"moni-fab.d.ts","sourceRoot":"","sources":["../../src/components/moni-fab.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAC7D,OAAO,gBAAgB,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,qBACa,OAAQ,SAAQ,WAAW;IACvC,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAS;IAG1C,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAY;IAE9C,KAAK,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,CAAa;IAEpE,KAAK,EAAE,SAAS,GAAG,QAAQ,CAAa;IACI,QAAQ,UAAS;IACjB,QAAQ,UAAS;IACjB,QAAQ,UAAS;IAChC,IAAI,SAAS;IACb,KAAK,SAAM;IAExC,QAAQ,EACL,iBAAiB,GACjB,gBAAgB,GAChB,cAAc,GACd,aAAa,CAAqB;IAE5B,iBAAiB,IAAI,IAAI;IAkBlC,OAAgB,MAAM,4BA6JpB;IAEO,MAAM;CAyBf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,UAAU,EAAE,OAAO,CAAC;KACpB;CACD;AAED,eAAe,OAAO,CAAC"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-fab.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);
|
|
@@ -10,28 +16,48 @@ import { customElement, property } from 'lit/decorators.js';
|
|
|
10
16
|
import { MoniElement, sharedStyles } from './_base/index.js';
|
|
11
17
|
import './moni-icon.js';
|
|
12
18
|
/**
|
|
13
|
-
*
|
|
19
|
+
* Material Design 3 Floating Action Button (FAB) component.
|
|
20
|
+
*
|
|
21
|
+
* FABs represent the primary, or most common, action on a screen. They appear
|
|
22
|
+
* in front of all screen content, typically as a circular shape with an icon in
|
|
23
|
+
* its center.
|
|
24
|
+
*
|
|
25
|
+
* **M3 spec reference:** `m3-docs/components/floating-action-buttons/specs.md`
|
|
26
|
+
*
|
|
27
|
+
* **M3 Expressive Updates & Deprecations (May 2025):**
|
|
28
|
+
* - `size="small"` is **no longer recommended** by M3. Use `medium` (40dp or 56dp)
|
|
29
|
+
* or `large` (96dp). Deprecated in v0.3.1; will be removed in v1.0.
|
|
30
|
+
* - `shape="circle"` is **not part of M3**. M3 FABs use a `rounded` shape with a
|
|
31
|
+
* 16dp corner radius (which morphs to a `full` radius on hover/focus).
|
|
32
|
+
* Deprecated in v0.3.1; will be removed in v1.0.
|
|
33
|
+
* - `color="surface"` is **no longer recommended**. Use `primary`, `secondary`,
|
|
34
|
+
* or `tertiary` to ensure proper color mapping to the M3 theme.
|
|
35
|
+
*
|
|
36
|
+
* **Extended FABs:**
|
|
37
|
+
* When `extended` is true, the FAB displays a text label next to the icon.
|
|
38
|
+
* Extended FABs are wider and are typically used when the action needs explicit
|
|
39
|
+
* text to be clear. The `expanded` attribute forces the FAB to its full extended
|
|
40
|
+
* width, useful for animating between standard and extended states on scroll.
|
|
41
|
+
*
|
|
42
|
+
* **Positioning:**
|
|
43
|
+
* The `position` attribute applies predefined absolute/fixed positioning
|
|
44
|
+
* (e.g. `bottom-trailing`), snapping the FAB to standard screen corners.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```html
|
|
48
|
+
* <!-- Standard primary FAB -->
|
|
49
|
+
* <moni-fab icon="edit"></moni-fab>
|
|
50
|
+
*
|
|
51
|
+
* <!-- Extended tertiary FAB -->
|
|
52
|
+
* <moni-fab color="tertiary" extended icon="add" label="New task"></moni-fab>
|
|
14
53
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* - `shape="circle"` is **not part of M3**; M3 FABs are `rounded` with a 16dp
|
|
19
|
-
* corner radius (or `full` when on hover/focus). The M3 spec does not
|
|
20
|
-
* define a perfect-circle FAB. Deprecated in v0.3.1; will be removed in v1.0.
|
|
21
|
-
* - `color="surface"` is **no longer recommended** by M3. Use `primary`,
|
|
22
|
-
* `secondary`, or `tertiary` (and their container variants).
|
|
54
|
+
* <!-- Positioned FAB -->
|
|
55
|
+
* <moni-fab position="bottom-trailing" icon="navigation"></moni-fab>
|
|
56
|
+
* ```
|
|
23
57
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* -
|
|
27
|
-
* - shape: rounded (default) (circle: deprecated)
|
|
28
|
-
* - extended: present → wider with label always visible
|
|
29
|
-
* - expanded: present → force expanded
|
|
30
|
-
* - disabled: present
|
|
31
|
-
* - icon: Material Symbols name
|
|
32
|
-
* - label: text when extended
|
|
33
|
-
* - position: bottom-trailing (default) | bottom-leading
|
|
34
|
-
* | top-trailing | top-leading
|
|
58
|
+
* @csspart button - The internal `<button>` element.
|
|
59
|
+
* @csspart icon - The container for the icon.
|
|
60
|
+
* @csspart label - The text label (only visible when extended).
|
|
35
61
|
*/
|
|
36
62
|
let MoniFab = class MoniFab extends MoniElement {
|
|
37
63
|
constructor() {
|
|
@@ -1,21 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-file-field.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
|
-
*
|
|
5
|
-
*
|
|
10
|
+
* Material Design 3 File Field component.
|
|
11
|
+
*
|
|
12
|
+
* A specialized field component that provides a styled, accessible alternative
|
|
13
|
+
* to the native `<input type="file">`. It wraps a native file input inside
|
|
14
|
+
* the M3 `.field` shell and presents a read-only text input showing the
|
|
15
|
+
* selected file name(s) alongside a stylized "Choose file" action button.
|
|
16
|
+
*
|
|
17
|
+
* **Visual architecture:**
|
|
18
|
+
* The component leverages the `fieldStyles` CSS patterns. The internal DOM
|
|
19
|
+
* structure is specifically ordered as:
|
|
20
|
+
* `[text input] -> [label] -> [file input] -> [output]`
|
|
21
|
+
* This specific ordering ensures that the CSS adjacent sibling selector
|
|
22
|
+
* (`input + label`) can correctly float the label when the field is populated,
|
|
23
|
+
* even though the visible field is actually the read-only text input.
|
|
24
|
+
*
|
|
25
|
+
* **State management:**
|
|
26
|
+
* When the user selects files via the hidden file input, the component listens
|
|
27
|
+
* for the native `change` event, reads `input.files`, and updates the read-only
|
|
28
|
+
* text input with a comma-separated list of file names. The `value` property
|
|
29
|
+
* is kept in sync, and a composed `'change'` event is re-dispatched.
|
|
30
|
+
*
|
|
31
|
+
* @fires change - Bubbles and is composed. Fired when files are selected or
|
|
32
|
+
* cleared. The consumer can read the internal input's `files`
|
|
33
|
+
* list by querying the component.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```html
|
|
37
|
+
* <!-- Single file upload -->
|
|
38
|
+
* <moni-file-field
|
|
39
|
+
* label="Profile picture"
|
|
40
|
+
* name="avatar"
|
|
41
|
+
* accept="image/png, image/jpeg"
|
|
42
|
+
* button-label="Browse..."
|
|
43
|
+
* ></moni-file-field>
|
|
6
44
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
45
|
+
* <!-- Multiple file upload with error state -->
|
|
46
|
+
* <moni-file-field
|
|
47
|
+
* label="Documents"
|
|
48
|
+
* multiple
|
|
49
|
+
* error
|
|
50
|
+
* error-text="Files exceed maximum size limit"
|
|
51
|
+
* ></moni-file-field>
|
|
52
|
+
* ```
|
|
10
53
|
*
|
|
11
|
-
*
|
|
12
|
-
* -
|
|
13
|
-
*
|
|
14
|
-
* -
|
|
15
|
-
*
|
|
16
|
-
* - button-label: text on the picker button (visual only, default: "Choose file")
|
|
17
|
-
* - icon: leading Material Symbols name
|
|
18
|
-
* - trailing-icon: trailing Material Symbols name
|
|
54
|
+
* @csspart field - The outer `.field` div container.
|
|
55
|
+
* @csspart input-text - The visible read-only `<input type="text">`.
|
|
56
|
+
* @csspart label - The floating `<label>` element.
|
|
57
|
+
* @csspart input-file - The hidden native `<input type="file">`.
|
|
58
|
+
* @csspart button - The button element (styled via CSS `::file-selector-button`).
|
|
19
59
|
*/
|
|
20
60
|
export declare class MoniFileField extends MoniElement {
|
|
21
61
|
name: string;
|
|
@@ -36,7 +76,7 @@ export declare class MoniFileField extends MoniElement {
|
|
|
36
76
|
private _fileInput;
|
|
37
77
|
updated(changed: Map<string, unknown>): void;
|
|
38
78
|
static styles: import("lit").CSSResult[];
|
|
39
|
-
render(): import("lit
|
|
79
|
+
render(): import("lit").TemplateResult<1>;
|
|
40
80
|
}
|
|
41
81
|
declare global {
|
|
42
82
|
interface HTMLElementTagNameMap {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moni-file-field.d.ts","sourceRoot":"","sources":["../../src/components/moni-file-field.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"moni-file-field.d.ts","sourceRoot":"","sources":["../../src/components/moni-file-field.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EAAE,WAAW,EAA6B,MAAM,kBAAkB,CAAC;AAC1E,OAAO,gBAAgB,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,qBACa,aAAc,SAAQ,WAAW;IAChB,IAAI,SAAM;IACV,KAAK,SAAM;IACX,OAAO,EAAE,QAAQ,GAAG,UAAU,CAAc;IAEzE,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAY;IAExD,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAc;IACvB,MAAM,SAAM;IACG,QAAQ,UAAS;IAE7D,WAAW,SAAiB;IACgB,QAAQ,UAAS;IAChC,MAAM,SAAM;IACa,SAAS,SAAM;IACzB,KAAK,UAAS;IAC7B,KAAK,SAAM;IACX,IAAI,SAAM;IACkB,YAAY,SACtD;IAEc,OAAO,CAAC,UAAU,CAAoB;IAE1D,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAO9C,OAAgB,MAAM,4BAepB;IAEO,MAAM;CAoEf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,iBAAiB,EAAE,aAAa,CAAC;KACjC;CACD;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-file-field.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);
|
|
@@ -11,21 +17,55 @@ import { classMap } from 'lit/directives/class-map.js';
|
|
|
11
17
|
import { MoniElement, sharedStyles, fieldStyles } from './_base/index.js';
|
|
12
18
|
import './moni-icon.js';
|
|
13
19
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
20
|
+
* Material Design 3 File Field component.
|
|
21
|
+
*
|
|
22
|
+
* A specialized field component that provides a styled, accessible alternative
|
|
23
|
+
* to the native `<input type="file">`. It wraps a native file input inside
|
|
24
|
+
* the M3 `.field` shell and presents a read-only text input showing the
|
|
25
|
+
* selected file name(s) alongside a stylized "Choose file" action button.
|
|
26
|
+
*
|
|
27
|
+
* **Visual architecture:**
|
|
28
|
+
* The component leverages the `fieldStyles` CSS patterns. The internal DOM
|
|
29
|
+
* structure is specifically ordered as:
|
|
30
|
+
* `[text input] -> [label] -> [file input] -> [output]`
|
|
31
|
+
* This specific ordering ensures that the CSS adjacent sibling selector
|
|
32
|
+
* (`input + label`) can correctly float the label when the field is populated,
|
|
33
|
+
* even though the visible field is actually the read-only text input.
|
|
34
|
+
*
|
|
35
|
+
* **State management:**
|
|
36
|
+
* When the user selects files via the hidden file input, the component listens
|
|
37
|
+
* for the native `change` event, reads `input.files`, and updates the read-only
|
|
38
|
+
* text input with a comma-separated list of file names. The `value` property
|
|
39
|
+
* is kept in sync, and a composed `'change'` event is re-dispatched.
|
|
40
|
+
*
|
|
41
|
+
* @fires change - Bubbles and is composed. Fired when files are selected or
|
|
42
|
+
* cleared. The consumer can read the internal input's `files`
|
|
43
|
+
* list by querying the component.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```html
|
|
47
|
+
* <!-- Single file upload -->
|
|
48
|
+
* <moni-file-field
|
|
49
|
+
* label="Profile picture"
|
|
50
|
+
* name="avatar"
|
|
51
|
+
* accept="image/png, image/jpeg"
|
|
52
|
+
* button-label="Browse..."
|
|
53
|
+
* ></moni-file-field>
|
|
16
54
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
55
|
+
* <!-- Multiple file upload with error state -->
|
|
56
|
+
* <moni-file-field
|
|
57
|
+
* label="Documents"
|
|
58
|
+
* multiple
|
|
59
|
+
* error
|
|
60
|
+
* error-text="Files exceed maximum size limit"
|
|
61
|
+
* ></moni-file-field>
|
|
62
|
+
* ```
|
|
20
63
|
*
|
|
21
|
-
*
|
|
22
|
-
* -
|
|
23
|
-
*
|
|
24
|
-
* -
|
|
25
|
-
*
|
|
26
|
-
* - button-label: text on the picker button (visual only, default: "Choose file")
|
|
27
|
-
* - icon: leading Material Symbols name
|
|
28
|
-
* - trailing-icon: trailing Material Symbols name
|
|
64
|
+
* @csspart field - The outer `.field` div container.
|
|
65
|
+
* @csspart input-text - The visible read-only `<input type="text">`.
|
|
66
|
+
* @csspart label - The floating `<label>` element.
|
|
67
|
+
* @csspart input-file - The hidden native `<input type="file">`.
|
|
68
|
+
* @csspart button - The button element (styled via CSS `::file-selector-button`).
|
|
29
69
|
*/
|
|
30
70
|
let MoniFileField = class MoniFileField extends MoniElement {
|
|
31
71
|
constructor() {
|