@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-radio.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,33 +17,105 @@ import { ifDefined } from 'lit/directives/if-defined.js';
|
|
|
11
17
|
import { live } from 'lit/directives/live.js';
|
|
12
18
|
import { MoniElement, sharedStyles } from './_base/index.js';
|
|
13
19
|
/**
|
|
14
|
-
*
|
|
20
|
+
* Material Design 3 Radio Button component.
|
|
21
|
+
*
|
|
22
|
+
* Radio buttons allow users to select exactly one item from a set of mutually
|
|
23
|
+
* exclusive options. They share the same visual architecture as
|
|
24
|
+
* `<moni-checkbox>` but use `type="radio"` and implement group deselection.
|
|
25
|
+
*
|
|
26
|
+
* **M3 spec reference:** `m3-docs/components/radio/specs.md`
|
|
27
|
+
*
|
|
28
|
+
* **Visual architecture (BeerCSS pattern):**
|
|
29
|
+
* Identical to the checkbox pattern: the native `<input type="radio">` occupies
|
|
30
|
+
* real layout space at `--_size` × `--_size` but is hidden via `opacity: 0`.
|
|
31
|
+
* A sibling `<span>` renders:
|
|
32
|
+
* - `::before` — the radio icon (`radio_button_unchecked` / `radio_button_checked`).
|
|
33
|
+
* - `::after` — the hover/focus ripple ring.
|
|
34
|
+
*
|
|
35
|
+
* **Group deselection:**
|
|
36
|
+
* When a radio is checked, `_onChange` queries the component's `getRootNode()`
|
|
37
|
+
* for all `moni-radio` elements sharing the same `name` attribute and sets
|
|
38
|
+
* their `checked` property to `false`. This mirrors native browser behavior
|
|
39
|
+
* for radio groups across shadow DOM boundaries where `name` grouping does
|
|
40
|
+
* not work natively.
|
|
41
|
+
*
|
|
42
|
+
* @fires change - Bubbles and is composed. Fired when this radio is selected.
|
|
43
|
+
* Read `element.checked` for the new state.
|
|
15
44
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```html
|
|
47
|
+
* <moni-radio name="color" value="red" label="Red"></moni-radio>
|
|
48
|
+
* <moni-radio name="color" value="green" label="Green"></moni-radio>
|
|
49
|
+
* <moni-radio name="color" value="blue" label="Blue" checked></moni-radio>
|
|
50
|
+
* ```
|
|
21
51
|
*
|
|
22
|
-
*
|
|
23
|
-
* - label: text label
|
|
24
|
-
* - checked: present
|
|
25
|
-
* - disabled: present
|
|
26
|
-
* - size: small | medium (default) | large | extra
|
|
27
|
-
* - name: forwarded to input.name (group radios by name)
|
|
28
|
-
* - value: forwarded to input.value
|
|
52
|
+
* @csspart radio - The outer `<label>` element.
|
|
29
53
|
*/
|
|
30
54
|
let MoniRadio = class MoniRadio extends MoniElement {
|
|
31
55
|
constructor() {
|
|
32
56
|
super(...arguments);
|
|
57
|
+
/**
|
|
58
|
+
* Text label displayed to the right of the radio icon.
|
|
59
|
+
*
|
|
60
|
+
* When non-empty, renders as a text node. When empty, the default slot
|
|
61
|
+
* is rendered, allowing slotted HTML content as the label.
|
|
62
|
+
*
|
|
63
|
+
* @default ''
|
|
64
|
+
*/
|
|
33
65
|
this.label = '';
|
|
66
|
+
/**
|
|
67
|
+
* Whether this radio button is currently selected.
|
|
68
|
+
*
|
|
69
|
+
* Reflected as an attribute so CSS selectors can target it. Synced to
|
|
70
|
+
* the native input via `updated()`.
|
|
71
|
+
*
|
|
72
|
+
* @default false
|
|
73
|
+
*/
|
|
34
74
|
this.checked = false;
|
|
75
|
+
/**
|
|
76
|
+
* When `true`, the radio is non-interactive and renders at 50% opacity.
|
|
77
|
+
*
|
|
78
|
+
* @default false
|
|
79
|
+
*/
|
|
35
80
|
this.disabled = false;
|
|
81
|
+
/**
|
|
82
|
+
* Visual size of the radio icon and its invisible hit area.
|
|
83
|
+
*
|
|
84
|
+
* | Value | `--_size` |
|
|
85
|
+
* |------------|-----------|
|
|
86
|
+
* | `'small'` | 1rem |
|
|
87
|
+
* | `'medium'` | 1.5rem |
|
|
88
|
+
* | `'large'` | 2rem |
|
|
89
|
+
* | `'extra'` | 2.5rem |
|
|
90
|
+
*
|
|
91
|
+
* @default 'medium'
|
|
92
|
+
*/
|
|
36
93
|
this.size = 'medium';
|
|
94
|
+
/**
|
|
95
|
+
* Radio group name. Radios with the same `name` in the same root node
|
|
96
|
+
* are treated as a mutual-exclusion group by `_onChange`.
|
|
97
|
+
*
|
|
98
|
+
* Note: Native `<input type="radio">` groups only work within the same
|
|
99
|
+
* document root. Since `moni-radio` uses shadow DOM, the deselection
|
|
100
|
+
* of siblings is handled imperatively in `_onChange`.
|
|
101
|
+
*
|
|
102
|
+
* @default ''
|
|
103
|
+
*/
|
|
37
104
|
this.name = '';
|
|
105
|
+
/**
|
|
106
|
+
* Forwarded to the native `<input value>` attribute.
|
|
107
|
+
* The value submitted in a form when this radio is selected.
|
|
108
|
+
*
|
|
109
|
+
* @default ''
|
|
110
|
+
*/
|
|
38
111
|
this.value = '';
|
|
39
112
|
}
|
|
40
113
|
static { MoniRadio_1 = this; }
|
|
114
|
+
/**
|
|
115
|
+
* Syncs `checked` and `disabled` to the native input after each render cycle.
|
|
116
|
+
*
|
|
117
|
+
* @param changed - Map of changed property names to their previous values.
|
|
118
|
+
*/
|
|
41
119
|
updated(changed) {
|
|
42
120
|
if (this._input) {
|
|
43
121
|
if (changed.has('checked'))
|
|
@@ -157,6 +235,19 @@ let MoniRadio = class MoniRadio extends MoniElement {
|
|
|
157
235
|
}
|
|
158
236
|
`
|
|
159
237
|
]; }
|
|
238
|
+
/**
|
|
239
|
+
* Handles the native input `change` event.
|
|
240
|
+
*
|
|
241
|
+
* On selection, deselects all sibling `moni-radio` elements with the same
|
|
242
|
+
* `name` in the same root node (document or shadow root). This is necessary
|
|
243
|
+
* because native radio group exclusion only works within the same document
|
|
244
|
+
* root and does not cross shadow DOM boundaries.
|
|
245
|
+
*
|
|
246
|
+
* After deselection, dispatches a composed `'change'` event so it is
|
|
247
|
+
* audible to parent elements in the light DOM.
|
|
248
|
+
*
|
|
249
|
+
* @param e - The native `change` event from the hidden `<input>`.
|
|
250
|
+
*/
|
|
160
251
|
_onChange(e) {
|
|
161
252
|
this.checked = e.target.checked;
|
|
162
253
|
if (this.checked && this.name) {
|
|
@@ -1,30 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-ripple.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
|
-
* Visual-only ripple decoration.
|
|
9
|
+
* Visual-only ripple decoration component.
|
|
10
|
+
*
|
|
11
|
+
* Provides a pointer-origin ripple animation — the expanding circle starts
|
|
12
|
+
* at the exact pointer-down coordinates rather than the element's center.
|
|
13
|
+
* This is the full-fidelity M3 ripple; for a simpler CSS-only center-ripple,
|
|
14
|
+
* use the `interactionStyles` `.interactive::after` pseudo-element instead.
|
|
15
|
+
*
|
|
16
|
+
* **Usage:**
|
|
17
|
+
* Drop `<moni-ripple>` as a **child** of any interactive element. The component
|
|
18
|
+
* automatically attaches a `pointerdown` listener to its `parentElement` and
|
|
19
|
+
* calculates the ripple origin in percentage coordinates relative to the parent.
|
|
20
|
+
*
|
|
21
|
+
* The parent element must NOT have `position: static` (the ripple applies
|
|
22
|
+
* `position: relative` automatically in `connectedCallback`).
|
|
23
|
+
*
|
|
24
|
+
* **Timing model:**
|
|
25
|
+
* On `pointerdown`:
|
|
26
|
+
* 1. `active = false` is set (cancels any in-progress ripple).
|
|
27
|
+
* 2. A `requestAnimationFrame` tick ensures the browser has processed the reset.
|
|
28
|
+
* 3. `active = true` triggers the CSS scale animation.
|
|
29
|
+
* 4. A `setTimeout` of `duration` ms (based on `speed`) resets `active = false`.
|
|
30
|
+
*
|
|
31
|
+
* The duration matches the CSS transition duration so the opacity fade-out
|
|
32
|
+
* completes before `active` is cleared.
|
|
33
|
+
*
|
|
34
|
+
* **Cleanup:**
|
|
35
|
+
* `disconnectedCallback` removes the `pointerdown` listener and clears any
|
|
36
|
+
* pending timeout. Always call `super.disconnectedCallback()` if subclassing.
|
|
4
37
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```html
|
|
40
|
+
* <!-- Ripple on a custom element -->
|
|
41
|
+
* <div class="my-button" style="position: relative; overflow: hidden;">
|
|
42
|
+
* Click me
|
|
43
|
+
* <moni-ripple color="primary"></moni-ripple>
|
|
44
|
+
* </div>
|
|
45
|
+
* ```
|
|
8
46
|
*
|
|
9
|
-
*
|
|
10
|
-
* - x, y: origin in px (0..100, %)
|
|
11
|
-
* - active: present → visible
|
|
12
|
-
* - speed: fast | normal (default) | slow
|
|
13
|
-
* - color: primary (default) | secondary | surface
|
|
47
|
+
* @csspart ripple - The inner `<span>` that performs the scale animation.
|
|
14
48
|
*/
|
|
15
49
|
export declare class MoniRipple extends MoniElement {
|
|
50
|
+
/**
|
|
51
|
+
* Horizontal origin of the ripple as a percentage of the parent's width.
|
|
52
|
+
*
|
|
53
|
+
* Set automatically by `_onPointerDown` based on the pointer coordinates.
|
|
54
|
+
* Can be set manually to trigger a ripple at a specific location.
|
|
55
|
+
*
|
|
56
|
+
* @default 50
|
|
57
|
+
*/
|
|
16
58
|
x: number;
|
|
59
|
+
/**
|
|
60
|
+
* Vertical origin of the ripple as a percentage of the parent's height.
|
|
61
|
+
*
|
|
62
|
+
* Set automatically by `_onPointerDown` based on the pointer coordinates.
|
|
63
|
+
*
|
|
64
|
+
* @default 50
|
|
65
|
+
*/
|
|
17
66
|
y: number;
|
|
67
|
+
/**
|
|
68
|
+
* When `true`, the ripple is visible and animating.
|
|
69
|
+
*
|
|
70
|
+
* Toggled automatically by `_onPointerDown`. Can be set manually for
|
|
71
|
+
* programmatically-triggered ripple effects.
|
|
72
|
+
*
|
|
73
|
+
* @default false
|
|
74
|
+
*/
|
|
18
75
|
active: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Animation speed of the ripple expand-and-fade sequence.
|
|
78
|
+
*
|
|
79
|
+
* Maps to the `--_dur` CSS custom property:
|
|
80
|
+
* - `'fast'` — 300ms
|
|
81
|
+
* - `'normal'` — 600ms (default)
|
|
82
|
+
* - `'slow'` — 1200ms
|
|
83
|
+
*
|
|
84
|
+
* @default 'normal'
|
|
85
|
+
*/
|
|
19
86
|
speed: 'fast' | 'normal' | 'slow';
|
|
87
|
+
/**
|
|
88
|
+
* Color token for the ripple overlay.
|
|
89
|
+
*
|
|
90
|
+
* Sets the `color` CSS property on `:host`, which the `.ripple` span
|
|
91
|
+
* inherits via `background-color: currentColor`.
|
|
92
|
+
*
|
|
93
|
+
* - `'primary'` — `--primary` (default)
|
|
94
|
+
* - `'secondary'` — `--secondary`
|
|
95
|
+
* - `'surface'` — `--surface-variant` (subtle, for surface containers)
|
|
96
|
+
*
|
|
97
|
+
* @default 'primary'
|
|
98
|
+
*/
|
|
20
99
|
color: 'primary' | 'secondary' | 'surface';
|
|
100
|
+
/**
|
|
101
|
+
* Reference to the parent element that the ripple is anchored to.
|
|
102
|
+
* Populated in `connectedCallback`, cleared in `disconnectedCallback`.
|
|
103
|
+
*/
|
|
21
104
|
private _target;
|
|
105
|
+
/**
|
|
106
|
+
* ID of the pending `setTimeout` that clears `active` after the animation.
|
|
107
|
+
* Stored so it can be cancelled if a second pointer event fires before the
|
|
108
|
+
* first ripple finishes (rapid double-tap prevention).
|
|
109
|
+
*/
|
|
22
110
|
private _timeoutId;
|
|
111
|
+
/**
|
|
112
|
+
* Attaches the ripple to its parent element.
|
|
113
|
+
*
|
|
114
|
+
* - Stores a reference to `parentElement` for pointer event listening.
|
|
115
|
+
* - Ensures the parent has `position: relative` so the ripple's `position: absolute`
|
|
116
|
+
* stays within bounds.
|
|
117
|
+
* - Registers the `_onPointerDown` event listener.
|
|
118
|
+
*/
|
|
23
119
|
connectedCallback(): void;
|
|
120
|
+
/**
|
|
121
|
+
* Detaches the ripple from its parent element.
|
|
122
|
+
*
|
|
123
|
+
* Removes the `pointerdown` listener and clears any pending timeout to
|
|
124
|
+
* prevent the `active` flag from being set after the element is removed.
|
|
125
|
+
*/
|
|
24
126
|
disconnectedCallback(): void;
|
|
127
|
+
/**
|
|
128
|
+
* Handles pointer-down events on the parent element.
|
|
129
|
+
*
|
|
130
|
+
* Computes the ripple origin as a percentage of the parent's bounding rect,
|
|
131
|
+
* cancels any in-progress ripple, then triggers a new one after one
|
|
132
|
+
* animation frame to guarantee the CSS transition fires from the new position.
|
|
133
|
+
*
|
|
134
|
+
* @param e - The `PointerEvent` from the parent's `pointerdown` listener.
|
|
135
|
+
*/
|
|
25
136
|
private _onPointerDown;
|
|
26
137
|
static styles: import("lit").CSSResult[];
|
|
27
|
-
render(): import("lit
|
|
138
|
+
render(): import("lit").TemplateResult<1>;
|
|
28
139
|
}
|
|
29
140
|
declare global {
|
|
30
141
|
interface HTMLElementTagNameMap {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moni-ripple.d.ts","sourceRoot":"","sources":["../../src/components/moni-ripple.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"moni-ripple.d.ts","sourceRoot":"","sources":["../../src/components/moni-ripple.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,qBACa,UAAW,SAAQ,WAAW;IAC1C;;;;;;;OAOG;IACwC,CAAC,SAAM;IAElD;;;;;;OAMG;IACwC,CAAC,SAAM;IAElD;;;;;;;OAOG;IACyC,MAAM,UAAS;IAE3D;;;;;;;;;OASG;IAEH,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAY;IAE7C;;;;;;;;;;;OAWG;IAEH,KAAK,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,CAAa;IAEvD;;;OAGG;IACH,OAAO,CAAC,OAAO,CAA4B;IAE3C;;;;OAIG;IACH,OAAO,CAAC,UAAU,CAAa;IAE/B;;;;;;;OAOG;IACM,iBAAiB;IAY1B;;;;;OAKG;IACM,oBAAoB;IAU7B;;;;;;;;OAQG;IACH,OAAO,CAAC,cAAc,CAqBpB;IAEF,OAAgB,MAAM,4BAqDpB;IAEO,MAAM;CAOf;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-ripple.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,119 @@ 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
|
-
* Visual-only ripple decoration.
|
|
17
|
+
* Visual-only ripple decoration component.
|
|
18
|
+
*
|
|
19
|
+
* Provides a pointer-origin ripple animation — the expanding circle starts
|
|
20
|
+
* at the exact pointer-down coordinates rather than the element's center.
|
|
21
|
+
* This is the full-fidelity M3 ripple; for a simpler CSS-only center-ripple,
|
|
22
|
+
* use the `interactionStyles` `.interactive::after` pseudo-element instead.
|
|
23
|
+
*
|
|
24
|
+
* **Usage:**
|
|
25
|
+
* Drop `<moni-ripple>` as a **child** of any interactive element. The component
|
|
26
|
+
* automatically attaches a `pointerdown` listener to its `parentElement` and
|
|
27
|
+
* calculates the ripple origin in percentage coordinates relative to the parent.
|
|
28
|
+
*
|
|
29
|
+
* The parent element must NOT have `position: static` (the ripple applies
|
|
30
|
+
* `position: relative` automatically in `connectedCallback`).
|
|
31
|
+
*
|
|
32
|
+
* **Timing model:**
|
|
33
|
+
* On `pointerdown`:
|
|
34
|
+
* 1. `active = false` is set (cancels any in-progress ripple).
|
|
35
|
+
* 2. A `requestAnimationFrame` tick ensures the browser has processed the reset.
|
|
36
|
+
* 3. `active = true` triggers the CSS scale animation.
|
|
37
|
+
* 4. A `setTimeout` of `duration` ms (based on `speed`) resets `active = false`.
|
|
38
|
+
*
|
|
39
|
+
* The duration matches the CSS transition duration so the opacity fade-out
|
|
40
|
+
* completes before `active` is cleared.
|
|
41
|
+
*
|
|
42
|
+
* **Cleanup:**
|
|
43
|
+
* `disconnectedCallback` removes the `pointerdown` listener and clears any
|
|
44
|
+
* pending timeout. Always call `super.disconnectedCallback()` if subclassing.
|
|
12
45
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```html
|
|
48
|
+
* <!-- Ripple on a custom element -->
|
|
49
|
+
* <div class="my-button" style="position: relative; overflow: hidden;">
|
|
50
|
+
* Click me
|
|
51
|
+
* <moni-ripple color="primary"></moni-ripple>
|
|
52
|
+
* </div>
|
|
53
|
+
* ```
|
|
16
54
|
*
|
|
17
|
-
*
|
|
18
|
-
* - x, y: origin in px (0..100, %)
|
|
19
|
-
* - active: present → visible
|
|
20
|
-
* - speed: fast | normal (default) | slow
|
|
21
|
-
* - color: primary (default) | secondary | surface
|
|
55
|
+
* @csspart ripple - The inner `<span>` that performs the scale animation.
|
|
22
56
|
*/
|
|
23
57
|
let MoniRipple = class MoniRipple extends MoniElement {
|
|
24
58
|
constructor() {
|
|
25
59
|
super(...arguments);
|
|
60
|
+
/**
|
|
61
|
+
* Horizontal origin of the ripple as a percentage of the parent's width.
|
|
62
|
+
*
|
|
63
|
+
* Set automatically by `_onPointerDown` based on the pointer coordinates.
|
|
64
|
+
* Can be set manually to trigger a ripple at a specific location.
|
|
65
|
+
*
|
|
66
|
+
* @default 50
|
|
67
|
+
*/
|
|
26
68
|
this.x = 50;
|
|
69
|
+
/**
|
|
70
|
+
* Vertical origin of the ripple as a percentage of the parent's height.
|
|
71
|
+
*
|
|
72
|
+
* Set automatically by `_onPointerDown` based on the pointer coordinates.
|
|
73
|
+
*
|
|
74
|
+
* @default 50
|
|
75
|
+
*/
|
|
27
76
|
this.y = 50;
|
|
77
|
+
/**
|
|
78
|
+
* When `true`, the ripple is visible and animating.
|
|
79
|
+
*
|
|
80
|
+
* Toggled automatically by `_onPointerDown`. Can be set manually for
|
|
81
|
+
* programmatically-triggered ripple effects.
|
|
82
|
+
*
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
28
85
|
this.active = false;
|
|
86
|
+
/**
|
|
87
|
+
* Animation speed of the ripple expand-and-fade sequence.
|
|
88
|
+
*
|
|
89
|
+
* Maps to the `--_dur` CSS custom property:
|
|
90
|
+
* - `'fast'` — 300ms
|
|
91
|
+
* - `'normal'` — 600ms (default)
|
|
92
|
+
* - `'slow'` — 1200ms
|
|
93
|
+
*
|
|
94
|
+
* @default 'normal'
|
|
95
|
+
*/
|
|
29
96
|
this.speed = 'normal';
|
|
97
|
+
/**
|
|
98
|
+
* Color token for the ripple overlay.
|
|
99
|
+
*
|
|
100
|
+
* Sets the `color` CSS property on `:host`, which the `.ripple` span
|
|
101
|
+
* inherits via `background-color: currentColor`.
|
|
102
|
+
*
|
|
103
|
+
* - `'primary'` — `--primary` (default)
|
|
104
|
+
* - `'secondary'` — `--secondary`
|
|
105
|
+
* - `'surface'` — `--surface-variant` (subtle, for surface containers)
|
|
106
|
+
*
|
|
107
|
+
* @default 'primary'
|
|
108
|
+
*/
|
|
30
109
|
this.color = 'primary';
|
|
110
|
+
/**
|
|
111
|
+
* Reference to the parent element that the ripple is anchored to.
|
|
112
|
+
* Populated in `connectedCallback`, cleared in `disconnectedCallback`.
|
|
113
|
+
*/
|
|
31
114
|
this._target = null;
|
|
115
|
+
/**
|
|
116
|
+
* ID of the pending `setTimeout` that clears `active` after the animation.
|
|
117
|
+
* Stored so it can be cancelled if a second pointer event fires before the
|
|
118
|
+
* first ripple finishes (rapid double-tap prevention).
|
|
119
|
+
*/
|
|
32
120
|
this._timeoutId = null;
|
|
121
|
+
/**
|
|
122
|
+
* Handles pointer-down events on the parent element.
|
|
123
|
+
*
|
|
124
|
+
* Computes the ripple origin as a percentage of the parent's bounding rect,
|
|
125
|
+
* cancels any in-progress ripple, then triggers a new one after one
|
|
126
|
+
* animation frame to guarantee the CSS transition fires from the new position.
|
|
127
|
+
*
|
|
128
|
+
* @param e - The `PointerEvent` from the parent's `pointerdown` listener.
|
|
129
|
+
*/
|
|
33
130
|
this._onPointerDown = (e) => {
|
|
34
131
|
if (!this._target)
|
|
35
132
|
return;
|
|
@@ -52,6 +149,14 @@ let MoniRipple = class MoniRipple extends MoniElement {
|
|
|
52
149
|
});
|
|
53
150
|
};
|
|
54
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* Attaches the ripple to its parent element.
|
|
154
|
+
*
|
|
155
|
+
* - Stores a reference to `parentElement` for pointer event listening.
|
|
156
|
+
* - Ensures the parent has `position: relative` so the ripple's `position: absolute`
|
|
157
|
+
* stays within bounds.
|
|
158
|
+
* - Registers the `_onPointerDown` event listener.
|
|
159
|
+
*/
|
|
55
160
|
connectedCallback() {
|
|
56
161
|
super.connectedCallback();
|
|
57
162
|
this._target = this.parentElement;
|
|
@@ -63,6 +168,12 @@ let MoniRipple = class MoniRipple extends MoniElement {
|
|
|
63
168
|
this._target.addEventListener('pointerdown', this._onPointerDown);
|
|
64
169
|
}
|
|
65
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Detaches the ripple from its parent element.
|
|
173
|
+
*
|
|
174
|
+
* Removes the `pointerdown` listener and clears any pending timeout to
|
|
175
|
+
* prevent the `active` flag from being set after the element is removed.
|
|
176
|
+
*/
|
|
66
177
|
disconnectedCallback() {
|
|
67
178
|
if (this._target) {
|
|
68
179
|
this._target.removeEventListener('pointerdown', this._onPointerDown);
|
|
@@ -1,22 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-segmented-button.ts
|
|
3
|
+
* @package @moni-labs/moni-ui
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @contributors Moni Labs & Contributors
|
|
6
|
+
*/
|
|
1
7
|
import { MoniElement } from './_base/index.js';
|
|
2
8
|
/**
|
|
9
|
+
* Material Design 3 Segmented Button component (Legacy).
|
|
10
|
+
*
|
|
3
11
|
* A form-associated group of selectable segmented buttons.
|
|
4
12
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* `m3-docs/components/segmented-buttons/overview.md` § M3 Expressive update.
|
|
13
|
+
* **Deprecation Notice:** The M3 spec (`m3-docs/components/segmented-buttons/overview.md`)
|
|
14
|
+
* has updated the segmented button pattern. The bespoke segments have been
|
|
15
|
+
* replaced with standard `<moni-button>` elements grouped inside a
|
|
16
|
+
* `<moni-button-group variant="connected">`.
|
|
10
17
|
*
|
|
11
18
|
* This component continues to work for backward compatibility but will be
|
|
12
19
|
* removed in v1.0. A deprecation warning is logged to the console when the
|
|
13
20
|
* element is connected to the DOM.
|
|
14
21
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
22
|
+
* @deprecated Use `<moni-button-group variant="connected">` instead.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```html
|
|
26
|
+
* <!-- Legacy usage (not recommended) -->
|
|
27
|
+
* <moni-segmented-button name="view" multi>
|
|
28
|
+
* <moni-button-segment value="day">Day</moni-button-segment>
|
|
29
|
+
* <moni-button-segment value="week">Week</moni-button-segment>
|
|
30
|
+
* </moni-segmented-button>
|
|
31
|
+
*
|
|
32
|
+
* <!-- Modern M3 equivalent -->
|
|
33
|
+
* <moni-button-group variant="connected">
|
|
34
|
+
* <moni-button>Day</moni-button>
|
|
35
|
+
* <moni-button>Week</moni-button>
|
|
36
|
+
* </moni-button-group>
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @slot default - `<moni-button-segment>` elements.
|
|
20
40
|
*/
|
|
21
41
|
export declare class MoniSegmentedButton extends MoniElement {
|
|
22
42
|
static formAssociated: boolean;
|
|
@@ -41,7 +61,7 @@ export declare class MoniSegmentedButton extends MoniElement {
|
|
|
41
61
|
private updateChildren;
|
|
42
62
|
private updateFormValue;
|
|
43
63
|
private handleClick;
|
|
44
|
-
render(): import("lit
|
|
64
|
+
render(): import("lit").TemplateResult<1>;
|
|
45
65
|
}
|
|
46
66
|
declare global {
|
|
47
67
|
interface HTMLElementTagNameMap {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moni-segmented-button.d.ts","sourceRoot":"","sources":["../../src/components/moni-segmented-button.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"moni-segmented-button.d.ts","sourceRoot":"","sources":["../../src/components/moni-segmented-button.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAG7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,qBACa,mBAAoB,SAAQ,WAAW;IACnD,MAAM,CAAC,cAAc,UAAQ;IAE7B,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAS;IAG1C,IAAI,SAAM;IAGV,KAAK,UAAS;IAGd,IAAI,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAY;IAG9E,SAAS,UAAS;IAGlB,GAAG,SAAM;IAGT,OAAO,CAAC,eAAe,CAAiB;IAExC,OAAO,CAAC,SAAS,CAAmB;;IAO3B,iBAAiB,IAAI,IAAI;IAelC,IAAI,IAAI,2BAEP;IAED,IAAI,IAAI,WAEP;IAED,IAAI,KAAK,IAAI,MAAM,CAKlB;IAED,OAAO,KAAK,QAAQ,GAInB;IAED,OAAgB,MAAM,4BAoBpB;cAEiB,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC;IAQpF,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,cAAc;IAoBtB,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,WAAW;IAqCV,MAAM;CAWf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,uBAAuB,EAAE,mBAAmB,CAAC;KAC7C;CACD;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-segmented-button.ts
|
|
3
|
+
* @package @moni-labs/moni-ui
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @contributors Moni Labs & Contributors
|
|
6
|
+
*/
|
|
1
7
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
8
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
9
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -9,23 +15,37 @@ import { html, css } from 'lit';
|
|
|
9
15
|
import { customElement, property, queryAssignedElements } from 'lit/decorators.js';
|
|
10
16
|
import { MoniElement, sharedStyles } from './_base/index.js';
|
|
11
17
|
/**
|
|
18
|
+
* Material Design 3 Segmented Button component (Legacy).
|
|
19
|
+
*
|
|
12
20
|
* A form-associated group of selectable segmented buttons.
|
|
13
21
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* `m3-docs/components/segmented-buttons/overview.md` § M3 Expressive update.
|
|
22
|
+
* **Deprecation Notice:** The M3 spec (`m3-docs/components/segmented-buttons/overview.md`)
|
|
23
|
+
* has updated the segmented button pattern. The bespoke segments have been
|
|
24
|
+
* replaced with standard `<moni-button>` elements grouped inside a
|
|
25
|
+
* `<moni-button-group variant="connected">`.
|
|
19
26
|
*
|
|
20
27
|
* This component continues to work for backward compatibility but will be
|
|
21
28
|
* removed in v1.0. A deprecation warning is logged to the console when the
|
|
22
29
|
* element is connected to the DOM.
|
|
23
30
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
31
|
+
* @deprecated Use `<moni-button-group variant="connected">` instead.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```html
|
|
35
|
+
* <!-- Legacy usage (not recommended) -->
|
|
36
|
+
* <moni-segmented-button name="view" multi>
|
|
37
|
+
* <moni-button-segment value="day">Day</moni-button-segment>
|
|
38
|
+
* <moni-button-segment value="week">Week</moni-button-segment>
|
|
39
|
+
* </moni-segmented-button>
|
|
40
|
+
*
|
|
41
|
+
* <!-- Modern M3 equivalent -->
|
|
42
|
+
* <moni-button-group variant="connected">
|
|
43
|
+
* <moni-button>Day</moni-button>
|
|
44
|
+
* <moni-button>Week</moni-button>
|
|
45
|
+
* </moni-button-group>
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @slot default - `<moni-button-segment>` elements.
|
|
29
49
|
*/
|
|
30
50
|
let MoniSegmentedButton = class MoniSegmentedButton extends MoniElement {
|
|
31
51
|
static { MoniSegmentedButton_1 = this; }
|
|
@@ -1,13 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/moni-select-option.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
|
-
*
|
|
9
|
+
* Material Design 3 Select Option component.
|
|
10
|
+
*
|
|
11
|
+
* An individual selectable item designed to be placed inside a
|
|
12
|
+
* `<moni-select>` dropdown.
|
|
13
|
+
*
|
|
14
|
+
* **Interaction and layout:**
|
|
15
|
+
* Options are rendered as accessible `<li>` elements styled identically to
|
|
16
|
+
* `<moni-menu-item>`. When slotted into a `<moni-select>`, the parent
|
|
17
|
+
* component extracts their `value`, `label`, and `group` attributes to build
|
|
18
|
+
* its internal data model and handles the actual selection logic, keyboard
|
|
19
|
+
* navigation, and rendering within the dropdown popup.
|
|
20
|
+
*
|
|
21
|
+
* **Grouping:**
|
|
22
|
+
* Options can be categorized into subcategories by providing a `group`
|
|
23
|
+
* attribute. The parent `<moni-select>` uses this to automatically generate
|
|
24
|
+
* group headers (`<moni-select-group>`) in the dropdown list.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```html
|
|
28
|
+
* <moni-select label="Favorite framework">
|
|
29
|
+
* <!-- Standard option -->
|
|
30
|
+
* <moni-select-option value="lit">Lit Element</moni-select-option>
|
|
31
|
+
*
|
|
32
|
+
* <!-- Disabled option -->
|
|
33
|
+
* <moni-select-option value="react" disabled>React (not allowed)</moni-select-option>
|
|
34
|
+
*
|
|
35
|
+
* <!-- Grouped option -->
|
|
36
|
+
* <moni-select-option value="vue" group="Other">Vue.js</moni-select-option>
|
|
37
|
+
* </moni-select>
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @slot default - The text label for the option. If the `label` attribute is
|
|
41
|
+
* omitted, the parent `<moni-select>` will read this slot's
|
|
42
|
+
* `textContent`.
|
|
43
|
+
*
|
|
44
|
+
* @csspart item - The outer `<li>` element.
|
|
11
45
|
*/
|
|
12
46
|
export declare class MoniSelectOption extends MoniElement {
|
|
13
47
|
value: string;
|
|
@@ -16,7 +50,7 @@ export declare class MoniSelectOption extends MoniElement {
|
|
|
16
50
|
selected: boolean;
|
|
17
51
|
disabled: boolean;
|
|
18
52
|
static styles: import("lit").CSSResult[];
|
|
19
|
-
render(): import("lit
|
|
53
|
+
render(): import("lit").TemplateResult<1>;
|
|
20
54
|
}
|
|
21
55
|
declare global {
|
|
22
56
|
interface HTMLElementTagNameMap {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moni-select-option.d.ts","sourceRoot":"","sources":["../../src/components/moni-select-option.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"moni-select-option.d.ts","sourceRoot":"","sources":["../../src/components/moni-select-option.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,qBACa,gBAAiB,SAAQ,WAAW;IACnB,KAAK,SAAM;IACX,KAAK,SAAM;IACX,KAAK,SAAM;IACI,QAAQ,UAAS;IACjB,QAAQ,UAAS;IAE7D,OAAgB,MAAM,4BA4CpB;IAEO,MAAM;CAQf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,oBAAoB,EAAE,gBAAgB,CAAC;KACvC;CACD;AAED,eAAe,gBAAgB,CAAC"}
|