@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,34 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-switch.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
|
-
*
|
|
10
|
+
* Material Design 3 Switch component.
|
|
11
|
+
*
|
|
12
|
+
* Switches toggle the state of a single setting on or off. They are the
|
|
13
|
+
* binary on/off equivalent of a checkbox, but optimized for toggling a
|
|
14
|
+
* single state rather than selecting from a list.
|
|
15
|
+
*
|
|
16
|
+
* **M3 spec reference:** `m3-docs/components/switch/specs.md`
|
|
17
|
+
*
|
|
18
|
+
* **M3 measurements:**
|
|
19
|
+
* - Track: 52dp × 32dp, 2dp border, full-radius pill shape.
|
|
20
|
+
* - Handle (thumb): 16dp unselected → 24dp selected → 28dp pressed.
|
|
21
|
+
* - State layer: 40dp circular ripple on hover/focus/pressed states.
|
|
22
|
+
* - Icon (optional): 16dp icon rendered inside the thumb when `icon` is set.
|
|
23
|
+
*
|
|
24
|
+
* **Visual architecture:**
|
|
25
|
+
* Like `<moni-checkbox>`, the native `<input type="checkbox" role="switch">`
|
|
26
|
+
* occupies real layout space but is visually hidden via `opacity: 0`. Two
|
|
27
|
+
* `<span>` pseudo-elements render the track (`::after`) and thumb (`::before`).
|
|
28
|
+
* When `icon=true`, `<i>` elements render `close` and `check` glyphs inside
|
|
29
|
+
* the thumb, with visibility toggled via CSS based on the checked state.
|
|
30
|
+
*
|
|
31
|
+
* @fires change - Bubbles and is composed. Fired when the switch is toggled.
|
|
32
|
+
* Read `element.checked` for the new state.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```html
|
|
36
|
+
* <moni-switch label="Dark mode" name="dark-mode"></moni-switch>
|
|
37
|
+
* <moni-switch icon checked label="Notifications"></moni-switch>
|
|
38
|
+
*
|
|
39
|
+
* <script>
|
|
40
|
+
* document.querySelector('moni-switch').addEventListener('change', (e) => {
|
|
41
|
+
* console.log('enabled:', e.target.checked);
|
|
42
|
+
* });
|
|
43
|
+
* </script>
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @csspart switch - The outer `<label>` element containing the switch.
|
|
19
47
|
*/
|
|
20
48
|
export declare class MoniSwitch extends MoniElement {
|
|
49
|
+
/**
|
|
50
|
+
* Text label displayed to the right of the switch.
|
|
51
|
+
*
|
|
52
|
+
* When non-empty, renders as a padded text span after the track.
|
|
53
|
+
* When empty, the default slot is rendered, allowing custom HTML labels.
|
|
54
|
+
*
|
|
55
|
+
* @default ''
|
|
56
|
+
*/
|
|
21
57
|
label: string;
|
|
58
|
+
/**
|
|
59
|
+
* Whether the switch is in the "on" (checked) state.
|
|
60
|
+
*
|
|
61
|
+
* When `true`:
|
|
62
|
+
* - Track fills with `--primary` color.
|
|
63
|
+
* - Thumb grows from 16dp to 24dp and slides to the trailing edge.
|
|
64
|
+
* - Thumb color changes to `--on-primary`.
|
|
65
|
+
*
|
|
66
|
+
* @default false
|
|
67
|
+
*/
|
|
22
68
|
checked: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* When `true`, the switch is non-interactive and renders at 50% opacity.
|
|
71
|
+
*
|
|
72
|
+
* @default false
|
|
73
|
+
*/
|
|
23
74
|
disabled: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* When `true`, renders icon glyphs inside the thumb.
|
|
77
|
+
*
|
|
78
|
+
* Uses Material Symbols ligatures:
|
|
79
|
+
* - Unchecked state: `close` icon.
|
|
80
|
+
* - Checked state: `check` icon.
|
|
81
|
+
*
|
|
82
|
+
* The icon size (16dp) is set via the `--_thumb` CSS custom property.
|
|
83
|
+
*
|
|
84
|
+
* @default false
|
|
85
|
+
*/
|
|
24
86
|
icon: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Forwarded to the native `<input name>` attribute for form participation.
|
|
89
|
+
*
|
|
90
|
+
* @default ''
|
|
91
|
+
*/
|
|
25
92
|
name: string;
|
|
93
|
+
/**
|
|
94
|
+
* Forwarded to the native `<input value>` attribute.
|
|
95
|
+
* The value submitted in a form when this switch is checked.
|
|
96
|
+
*
|
|
97
|
+
* @default ''
|
|
98
|
+
*/
|
|
26
99
|
value: string;
|
|
100
|
+
/** Direct reference to the native input element for programmatic access. */
|
|
27
101
|
private _input;
|
|
102
|
+
/**
|
|
103
|
+
* Syncs `checked` and `disabled` imperatively to the native input after render.
|
|
104
|
+
*
|
|
105
|
+
* @param changed - Map of changed property names to their previous values.
|
|
106
|
+
*/
|
|
28
107
|
updated(changed: Map<string, unknown>): void;
|
|
108
|
+
/**
|
|
109
|
+
* Handles the native input `change` event.
|
|
110
|
+
*
|
|
111
|
+
* Updates `this.checked` and re-dispatches a composed `'change'` event
|
|
112
|
+
* so it bubbles across shadow DOM boundaries.
|
|
113
|
+
*
|
|
114
|
+
* @param e - The native `change` event from the hidden `<input>`.
|
|
115
|
+
*/
|
|
29
116
|
private _onChange;
|
|
30
117
|
static styles: import("lit").CSSResult[];
|
|
31
|
-
render(): import("lit
|
|
118
|
+
render(): import("lit").TemplateResult<1>;
|
|
32
119
|
}
|
|
33
120
|
declare global {
|
|
34
121
|
interface HTMLElementTagNameMap {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moni-switch.d.ts","sourceRoot":"","sources":["../../src/components/moni-switch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"moni-switch.d.ts","sourceRoot":"","sources":["../../src/components/moni-switch.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAC7D,OAAO,gBAAgB,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,qBACa,UAAW,SAAQ,WAAW;IAC1C;;;;;;;OAOG;IAC0B,KAAK,SAAM;IAExC;;;;;;;;;OASG;IACyC,OAAO,UAAS;IAE5D;;;;OAIG;IACyC,QAAQ,UAAS;IAE7D;;;;;;;;;;OAUG;IACyC,IAAI,UAAS;IAEzD;;;;OAIG;IAC0B,IAAI,SAAM;IAEvC;;;;;OAKG;IAC0B,KAAK,SAAM;IAExC,4EAA4E;IAC5D,OAAO,CAAC,MAAM,CAAoB;IAElD;;;;OAIG;IACM,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAO9C;;;;;;;OAOG;IACH,OAAO,CAAC,SAAS;IAKjB,OAAgB,MAAM,4BAiKpB;IAEO,MAAM;CAmBf;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-switch.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,32 +16,104 @@ import { ifDefined } from 'lit/directives/if-defined.js';
|
|
|
10
16
|
import { MoniElement, sharedStyles } from './_base/index.js';
|
|
11
17
|
import './moni-icon.js';
|
|
12
18
|
/**
|
|
13
|
-
*
|
|
19
|
+
* Material Design 3 Switch component.
|
|
20
|
+
*
|
|
21
|
+
* Switches toggle the state of a single setting on or off. They are the
|
|
22
|
+
* binary on/off equivalent of a checkbox, but optimized for toggling a
|
|
23
|
+
* single state rather than selecting from a list.
|
|
24
|
+
*
|
|
25
|
+
* **M3 spec reference:** `m3-docs/components/switch/specs.md`
|
|
26
|
+
*
|
|
27
|
+
* **M3 measurements:**
|
|
28
|
+
* - Track: 52dp × 32dp, 2dp border, full-radius pill shape.
|
|
29
|
+
* - Handle (thumb): 16dp unselected → 24dp selected → 28dp pressed.
|
|
30
|
+
* - State layer: 40dp circular ripple on hover/focus/pressed states.
|
|
31
|
+
* - Icon (optional): 16dp icon rendered inside the thumb when `icon` is set.
|
|
32
|
+
*
|
|
33
|
+
* **Visual architecture:**
|
|
34
|
+
* Like `<moni-checkbox>`, the native `<input type="checkbox" role="switch">`
|
|
35
|
+
* occupies real layout space but is visually hidden via `opacity: 0`. Two
|
|
36
|
+
* `<span>` pseudo-elements render the track (`::after`) and thumb (`::before`).
|
|
37
|
+
* When `icon=true`, `<i>` elements render `close` and `check` glyphs inside
|
|
38
|
+
* the thumb, with visibility toggled via CSS based on the checked state.
|
|
39
|
+
*
|
|
40
|
+
* @fires change - Bubbles and is composed. Fired when the switch is toggled.
|
|
41
|
+
* Read `element.checked` for the new state.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```html
|
|
45
|
+
* <moni-switch label="Dark mode" name="dark-mode"></moni-switch>
|
|
46
|
+
* <moni-switch icon checked label="Notifications"></moni-switch>
|
|
14
47
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
48
|
+
* <script>
|
|
49
|
+
* document.querySelector('moni-switch').addEventListener('change', (e) => {
|
|
50
|
+
* console.log('enabled:', e.target.checked);
|
|
51
|
+
* });
|
|
52
|
+
* </script>
|
|
53
|
+
* ```
|
|
20
54
|
*
|
|
21
|
-
*
|
|
22
|
-
* - label: text label (displayed to the right of the switch)
|
|
23
|
-
* - checked: present
|
|
24
|
-
* - disabled: present
|
|
25
|
-
* - icon: present → renders check/close icons inside the thumb
|
|
26
|
-
* - name: forwarded to input.name
|
|
27
|
-
* - value: forwarded to input.value
|
|
55
|
+
* @csspart switch - The outer `<label>` element containing the switch.
|
|
28
56
|
*/
|
|
29
57
|
let MoniSwitch = class MoniSwitch extends MoniElement {
|
|
30
58
|
constructor() {
|
|
31
59
|
super(...arguments);
|
|
60
|
+
/**
|
|
61
|
+
* Text label displayed to the right of the switch.
|
|
62
|
+
*
|
|
63
|
+
* When non-empty, renders as a padded text span after the track.
|
|
64
|
+
* When empty, the default slot is rendered, allowing custom HTML labels.
|
|
65
|
+
*
|
|
66
|
+
* @default ''
|
|
67
|
+
*/
|
|
32
68
|
this.label = '';
|
|
69
|
+
/**
|
|
70
|
+
* Whether the switch is in the "on" (checked) state.
|
|
71
|
+
*
|
|
72
|
+
* When `true`:
|
|
73
|
+
* - Track fills with `--primary` color.
|
|
74
|
+
* - Thumb grows from 16dp to 24dp and slides to the trailing edge.
|
|
75
|
+
* - Thumb color changes to `--on-primary`.
|
|
76
|
+
*
|
|
77
|
+
* @default false
|
|
78
|
+
*/
|
|
33
79
|
this.checked = false;
|
|
80
|
+
/**
|
|
81
|
+
* When `true`, the switch is non-interactive and renders at 50% opacity.
|
|
82
|
+
*
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
34
85
|
this.disabled = false;
|
|
86
|
+
/**
|
|
87
|
+
* When `true`, renders icon glyphs inside the thumb.
|
|
88
|
+
*
|
|
89
|
+
* Uses Material Symbols ligatures:
|
|
90
|
+
* - Unchecked state: `close` icon.
|
|
91
|
+
* - Checked state: `check` icon.
|
|
92
|
+
*
|
|
93
|
+
* The icon size (16dp) is set via the `--_thumb` CSS custom property.
|
|
94
|
+
*
|
|
95
|
+
* @default false
|
|
96
|
+
*/
|
|
35
97
|
this.icon = false;
|
|
98
|
+
/**
|
|
99
|
+
* Forwarded to the native `<input name>` attribute for form participation.
|
|
100
|
+
*
|
|
101
|
+
* @default ''
|
|
102
|
+
*/
|
|
36
103
|
this.name = '';
|
|
104
|
+
/**
|
|
105
|
+
* Forwarded to the native `<input value>` attribute.
|
|
106
|
+
* The value submitted in a form when this switch is checked.
|
|
107
|
+
*
|
|
108
|
+
* @default ''
|
|
109
|
+
*/
|
|
37
110
|
this.value = '';
|
|
38
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Syncs `checked` and `disabled` imperatively to the native input after render.
|
|
114
|
+
*
|
|
115
|
+
* @param changed - Map of changed property names to their previous values.
|
|
116
|
+
*/
|
|
39
117
|
updated(changed) {
|
|
40
118
|
if (this._input) {
|
|
41
119
|
if (changed.has('checked'))
|
|
@@ -44,6 +122,14 @@ let MoniSwitch = class MoniSwitch extends MoniElement {
|
|
|
44
122
|
this._input.disabled = this.disabled;
|
|
45
123
|
}
|
|
46
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* Handles the native input `change` event.
|
|
127
|
+
*
|
|
128
|
+
* Updates `this.checked` and re-dispatches a composed `'change'` event
|
|
129
|
+
* so it bubbles across shadow DOM boundaries.
|
|
130
|
+
*
|
|
131
|
+
* @param e - The native `change` event from the hidden `<input>`.
|
|
132
|
+
*/
|
|
47
133
|
_onChange(e) {
|
|
48
134
|
this.checked = e.target.checked;
|
|
49
135
|
this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
|
|
@@ -1,14 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-tab.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 Tab component.
|
|
11
|
+
*
|
|
12
|
+
* An individual interactive tab element designed to be placed inside a
|
|
13
|
+
* `<moni-tabs>` container. Tabs organize content across different screens,
|
|
14
|
+
* data sets, and other interactions.
|
|
15
|
+
*
|
|
16
|
+
* **M3 spec reference:** `m3-docs/components/tabs/specs.md`
|
|
17
|
+
*
|
|
18
|
+
* **Visual layout & interaction:**
|
|
19
|
+
* Internally renders as an `<a>` element to support native link behavior when
|
|
20
|
+
* an `href` is provided, but behaves visually as a tab button. It displays a
|
|
21
|
+
* text label and an optional Material icon. If the parent `<moni-tabs>` has the
|
|
22
|
+
* `vertical` attribute set, the layout automatically adjusts to stack the icon
|
|
23
|
+
* above the text.
|
|
24
|
+
*
|
|
25
|
+
* **State:**
|
|
26
|
+
* The `active` attribute highlights the tab, applying the primary color to the
|
|
27
|
+
* text and rendering the active indicator line (handled via CSS in the parent
|
|
28
|
+
* container or pseudo-elements).
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```html
|
|
32
|
+
* <moni-tabs>
|
|
33
|
+
* <moni-tab active icon="home" label="Home"></moni-tab>
|
|
34
|
+
* <moni-tab icon="settings" label="Settings" href="/settings"></moni-tab>
|
|
35
|
+
* </moni-tabs>
|
|
36
|
+
* ```
|
|
6
37
|
*
|
|
7
|
-
*
|
|
8
|
-
* - active: present → active style
|
|
9
|
-
* - icon: Material Symbols name
|
|
10
|
-
* - label: tab text
|
|
11
|
-
* - href: link target
|
|
38
|
+
* @csspart tab - The inner `<a>` element acting as the tab button.
|
|
12
39
|
*/
|
|
13
40
|
export declare class MoniTab extends MoniElement {
|
|
14
41
|
active: boolean;
|
|
@@ -16,7 +43,7 @@ export declare class MoniTab extends MoniElement {
|
|
|
16
43
|
label: string;
|
|
17
44
|
href: string;
|
|
18
45
|
static styles: import("lit").CSSResult[];
|
|
19
|
-
render(): import("lit
|
|
46
|
+
render(): import("lit").TemplateResult<1>;
|
|
20
47
|
}
|
|
21
48
|
declare global {
|
|
22
49
|
interface HTMLElementTagNameMap {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moni-tab.d.ts","sourceRoot":"","sources":["../../src/components/moni-tab.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"moni-tab.d.ts","sourceRoot":"","sources":["../../src/components/moni-tab.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAC7D,OAAO,gBAAgB,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBACa,OAAQ,SAAQ,WAAW;IACK,MAAM,UAAS;IAC9B,IAAI,SAAM;IACV,KAAK,SAAM;IACX,IAAI,SAAO;IAExC,OAAgB,MAAM,4BAuFpB;IAEO,MAAM;CAaf;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-tab.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,35 @@ 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
|
-
*
|
|
13
|
-
*
|
|
18
|
+
* Material Design 3 Tab component.
|
|
19
|
+
*
|
|
20
|
+
* An individual interactive tab element designed to be placed inside a
|
|
21
|
+
* `<moni-tabs>` container. Tabs organize content across different screens,
|
|
22
|
+
* data sets, and other interactions.
|
|
23
|
+
*
|
|
24
|
+
* **M3 spec reference:** `m3-docs/components/tabs/specs.md`
|
|
25
|
+
*
|
|
26
|
+
* **Visual layout & interaction:**
|
|
27
|
+
* Internally renders as an `<a>` element to support native link behavior when
|
|
28
|
+
* an `href` is provided, but behaves visually as a tab button. It displays a
|
|
29
|
+
* text label and an optional Material icon. If the parent `<moni-tabs>` has the
|
|
30
|
+
* `vertical` attribute set, the layout automatically adjusts to stack the icon
|
|
31
|
+
* above the text.
|
|
32
|
+
*
|
|
33
|
+
* **State:**
|
|
34
|
+
* The `active` attribute highlights the tab, applying the primary color to the
|
|
35
|
+
* text and rendering the active indicator line (handled via CSS in the parent
|
|
36
|
+
* container or pseudo-elements).
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```html
|
|
40
|
+
* <moni-tabs>
|
|
41
|
+
* <moni-tab active icon="home" label="Home"></moni-tab>
|
|
42
|
+
* <moni-tab icon="settings" label="Settings" href="/settings"></moni-tab>
|
|
43
|
+
* </moni-tabs>
|
|
44
|
+
* ```
|
|
14
45
|
*
|
|
15
|
-
*
|
|
16
|
-
* - active: present → active style
|
|
17
|
-
* - icon: Material Symbols name
|
|
18
|
-
* - label: tab text
|
|
19
|
-
* - href: link target
|
|
46
|
+
* @csspart tab - The inner `<a>` element acting as the tab button.
|
|
20
47
|
*/
|
|
21
48
|
let MoniTab = class MoniTab extends MoniElement {
|
|
22
49
|
constructor() {
|
|
@@ -1,17 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-tabs.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
|
-
*
|
|
9
|
+
* Material Design 3 Tabs container component.
|
|
10
|
+
*
|
|
11
|
+
* A navigational container that groups multiple `<moni-tab>` elements. Tabs
|
|
12
|
+
* organize content into high-level categories and allow the user to switch
|
|
13
|
+
* between them.
|
|
14
|
+
*
|
|
15
|
+
* **M3 spec reference:** `m3-docs/components/tabs/specs.md`
|
|
16
|
+
*
|
|
17
|
+
* **Modes (Primary vs Secondary):**
|
|
18
|
+
* - `primary` (default): Used for top-level navigation at the highest hierarchy,
|
|
19
|
+
* often placed directly below a top app bar. They span the full width and
|
|
20
|
+
* feature a prominent active indicator.
|
|
21
|
+
* - `secondary`: Used for deeper content hierarchies within a specific area
|
|
22
|
+
* or page. They are typically more subtle.
|
|
23
|
+
*
|
|
24
|
+
* **Layout & Alignment:**
|
|
25
|
+
* - `scrollable`: If the number of tabs exceeds the container width, this
|
|
26
|
+
* enables horizontal scrolling (`overflow-x: auto`) rather than squishing.
|
|
27
|
+
* - `align`: Controls how the tabs are distributed (`default` space-around,
|
|
28
|
+
* `left`, `center`, or `right`).
|
|
29
|
+
* - `vertical`: Stacks the icon above the text label inside the child tabs.
|
|
30
|
+
*
|
|
31
|
+
* **Active Indicator:**
|
|
32
|
+
* The `indicator-size` attribute allows customizing the width of the active
|
|
33
|
+
* underline indicator (`default` fits the tab content, `min` is narrow, `max`
|
|
34
|
+
* fills the full tab width).
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```html
|
|
38
|
+
* <!-- Primary, scrollable tabs -->
|
|
39
|
+
* <moni-tabs scrollable>
|
|
40
|
+
* <moni-tab active label="Flights"></moni-tab>
|
|
41
|
+
* <moni-tab label="Trips"></moni-tab>
|
|
42
|
+
* <moni-tab label="Explore"></moni-tab>
|
|
43
|
+
* </moni-tabs>
|
|
44
|
+
*
|
|
45
|
+
* <!-- Secondary, centered tabs with vertical layout -->
|
|
46
|
+
* <moni-tabs mode="secondary" align="center" vertical>
|
|
47
|
+
* <moni-tab active icon="video_camera_front" label="Video"></moni-tab>
|
|
48
|
+
* <moni-tab icon="photo_camera" label="Photo"></moni-tab>
|
|
49
|
+
* </moni-tabs>
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @slot default - `<moni-tab>` child elements.
|
|
15
53
|
*/
|
|
16
54
|
export declare class MoniTabs extends MoniElement {
|
|
17
55
|
mode: 'primary' | 'secondary';
|
|
@@ -20,7 +58,7 @@ export declare class MoniTabs extends MoniElement {
|
|
|
20
58
|
align: 'default' | 'left' | 'center' | 'right';
|
|
21
59
|
indicatorSize: 'default' | 'min' | 'max';
|
|
22
60
|
static styles: import("lit").CSSResult[];
|
|
23
|
-
render(): import("lit
|
|
61
|
+
render(): import("lit").TemplateResult<1>;
|
|
24
62
|
}
|
|
25
63
|
declare global {
|
|
26
64
|
interface HTMLElementTagNameMap {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moni-tabs.d.ts","sourceRoot":"","sources":["../../src/components/moni-tabs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"moni-tabs.d.ts","sourceRoot":"","sources":["../../src/components/moni-tabs.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,qBACa,QAAS,SAAQ,WAAW;IAExC,IAAI,EAAE,SAAS,GAAG,WAAW,CAAa;IACE,UAAU,UAAS;IACnB,QAAQ,UAAS;IAE7D,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAa;IAE3D,aAAa,EAAE,SAAS,GAAG,KAAK,GAAG,KAAK,CAAa;IAErD,OAAgB,MAAM,4BAsCpB;IAEO,MAAM;CAcf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,WAAW,EAAE,QAAQ,CAAC;KACtB;CACD;AAED,eAAe,QAAQ,CAAC"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-tabs.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,18 +14,50 @@ 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
|
-
*
|
|
12
|
-
*
|
|
17
|
+
* Material Design 3 Tabs container component.
|
|
18
|
+
*
|
|
19
|
+
* A navigational container that groups multiple `<moni-tab>` elements. Tabs
|
|
20
|
+
* organize content into high-level categories and allow the user to switch
|
|
21
|
+
* between them.
|
|
22
|
+
*
|
|
23
|
+
* **M3 spec reference:** `m3-docs/components/tabs/specs.md`
|
|
24
|
+
*
|
|
25
|
+
* **Modes (Primary vs Secondary):**
|
|
26
|
+
* - `primary` (default): Used for top-level navigation at the highest hierarchy,
|
|
27
|
+
* often placed directly below a top app bar. They span the full width and
|
|
28
|
+
* feature a prominent active indicator.
|
|
29
|
+
* - `secondary`: Used for deeper content hierarchies within a specific area
|
|
30
|
+
* or page. They are typically more subtle.
|
|
31
|
+
*
|
|
32
|
+
* **Layout & Alignment:**
|
|
33
|
+
* - `scrollable`: If the number of tabs exceeds the container width, this
|
|
34
|
+
* enables horizontal scrolling (`overflow-x: auto`) rather than squishing.
|
|
35
|
+
* - `align`: Controls how the tabs are distributed (`default` space-around,
|
|
36
|
+
* `left`, `center`, or `right`).
|
|
37
|
+
* - `vertical`: Stacks the icon above the text label inside the child tabs.
|
|
38
|
+
*
|
|
39
|
+
* **Active Indicator:**
|
|
40
|
+
* The `indicator-size` attribute allows customizing the width of the active
|
|
41
|
+
* underline indicator (`default` fits the tab content, `min` is narrow, `max`
|
|
42
|
+
* fills the full tab width).
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```html
|
|
46
|
+
* <!-- Primary, scrollable tabs -->
|
|
47
|
+
* <moni-tabs scrollable>
|
|
48
|
+
* <moni-tab active label="Flights"></moni-tab>
|
|
49
|
+
* <moni-tab label="Trips"></moni-tab>
|
|
50
|
+
* <moni-tab label="Explore"></moni-tab>
|
|
51
|
+
* </moni-tabs>
|
|
13
52
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
53
|
+
* <!-- Secondary, centered tabs with vertical layout -->
|
|
54
|
+
* <moni-tabs mode="secondary" align="center" vertical>
|
|
55
|
+
* <moni-tab active icon="video_camera_front" label="Video"></moni-tab>
|
|
56
|
+
* <moni-tab icon="photo_camera" label="Photo"></moni-tab>
|
|
57
|
+
* </moni-tabs>
|
|
58
|
+
* ```
|
|
20
59
|
*
|
|
21
|
-
*
|
|
22
|
-
* - default: <moni-tab> children
|
|
60
|
+
* @slot default - `<moni-tab>` child elements.
|
|
23
61
|
*/
|
|
24
62
|
let MoniTabs = class MoniTabs extends MoniElement {
|
|
25
63
|
constructor() {
|
|
@@ -1,18 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-text-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
|
import './moni-progress.js';
|
|
4
10
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
11
|
+
* Material Design 3 Text Field component.
|
|
12
|
+
*
|
|
13
|
+
* A full-featured input field that wraps a native `<input>` inside the M3
|
|
14
|
+
* field shell (`.field` class from `fieldStyles`). Supports floating labels,
|
|
15
|
+
* filled and outlined variants, leading/trailing icons, helper text, and
|
|
16
|
+
* error states.
|
|
17
|
+
*
|
|
18
|
+
* **M3 spec reference:** `m3-docs/components/text-fields/specs.md`
|
|
19
|
+
*
|
|
20
|
+
* **Visual architecture:**
|
|
21
|
+
* Uses `fieldStyles` for the complete CSS field shell. The field container
|
|
22
|
+
* is a `<div class="field [modifiers]">` wrapping:
|
|
23
|
+
* 1. Optional leading icon.
|
|
24
|
+
* 2. Native `<input>` element.
|
|
25
|
+
* 3. Floating `<label>` (when `label` is set).
|
|
26
|
+
* 4. Optional trailing icon or loading spinner.
|
|
27
|
+
* 5. `<output>` for helper/error text.
|
|
28
|
+
*
|
|
29
|
+
* **Visual-only contract:**
|
|
30
|
+
* This component does **not** listen to `@input` events to sync the `value`
|
|
31
|
+
* attribute back from the underlying `<input>`. Consumers must either:
|
|
32
|
+
* - Submit the native form (the `<input name>` participates in form submission).
|
|
33
|
+
* - Listen to `change` or `input` events via standard DOM event handling.
|
|
34
|
+
* - Use a framework binding (e.g. `bind:value` in Svelte, `v-model` in Vue).
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```html
|
|
38
|
+
* <moni-text-field
|
|
39
|
+
* label="Email address"
|
|
40
|
+
* type="email"
|
|
41
|
+
* name="email"
|
|
42
|
+
* icon="mail"
|
|
43
|
+
* variant="outlined"
|
|
44
|
+
* helper="We'll never share your email."
|
|
45
|
+
* ></moni-text-field>
|
|
7
46
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
47
|
+
* <moni-text-field
|
|
48
|
+
* label="Amount"
|
|
49
|
+
* type="number"
|
|
50
|
+
* prefix="$"
|
|
51
|
+
* error
|
|
52
|
+
* error-text="Value must be positive"
|
|
53
|
+
* ></moni-text-field>
|
|
54
|
+
* ```
|
|
11
55
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
56
|
+
* @csspart field - The outer `.field` div container.
|
|
57
|
+
* @csspart input - The native `<input>` element.
|
|
58
|
+
* @csspart label - The floating `<label>` element.
|
|
59
|
+
* @csspart helper - The helper `<output>` element.
|
|
60
|
+
* @csspart error-output - The error `<output>` element.
|
|
16
61
|
*/
|
|
17
62
|
export declare class MoniTextField extends MoniElement {
|
|
18
63
|
name: string;
|
|
@@ -35,7 +80,7 @@ export declare class MoniTextField extends MoniElement {
|
|
|
35
80
|
private _input;
|
|
36
81
|
updated(changed: Map<string, unknown>): void;
|
|
37
82
|
static styles: import("lit").CSSResult[];
|
|
38
|
-
render(): import("lit
|
|
83
|
+
render(): import("lit").TemplateResult<1>;
|
|
39
84
|
}
|
|
40
85
|
declare global {
|
|
41
86
|
interface HTMLElementTagNameMap {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moni-text-field.d.ts","sourceRoot":"","sources":["../../src/components/moni-text-field.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"moni-text-field.d.ts","sourceRoot":"","sources":["../../src/components/moni-text-field.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EAAE,WAAW,EAA6B,MAAM,kBAAkB,CAAC;AAC1E,OAAO,gBAAgB,CAAC;AACxB,OAAO,oBAAoB,CAAC;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,qBACa,aAAc,SAAQ,WAAW;IAChB,IAAI,SAAM;IACV,KAAK,SAAM;IACX,OAAO,EAAE,QAAQ,GAAG,UAAU,CAAY;IAEvE,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAY;IAExD,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAc;IAEpD,IAAI,EACD,MAAM,GACN,UAAU,GACV,OAAO,GACP,QAAQ,GACR,KAAK,GACL,KAAK,GACL,QAAQ,CAAU;IACQ,IAAI,SAAM;IACkB,YAAY,SAAM;IAC9C,MAAM,SAAM;IACZ,MAAM,SAAM;IACZ,MAAM,SAAM;IACa,SAAS,SAAM;IACzB,KAAK,UAAS;IACd,OAAO,UAAS;IAChB,QAAQ,UAAS;IAChC,KAAK,SAAM;IACX,WAAW,SAAM;IAE9B,OAAO,CAAC,MAAM,CAAoB;IAEzC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAO9C,OAAgB,MAAM,4BAA+B;IAE5C,MAAM;CA8Ef;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,iBAAiB,EAAE,aAAa,CAAC;KACjC;CACD;AAED,eAAe,aAAa,CAAC"}
|