@m3e/segmented-button 1.0.0-rc.2 → 1.0.0-rc.3
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/dist/custom-elements.json +11 -19
- package/dist/src/ButtonSegmentElement.d.ts +105 -0
- package/dist/src/ButtonSegmentElement.d.ts.map +1 -0
- package/dist/src/SegmentedButtonElement.d.ts +88 -0
- package/dist/src/SegmentedButtonElement.d.ts.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -1885,25 +1885,6 @@
|
|
|
1885
1885
|
"kind": "mixin",
|
|
1886
1886
|
"description": "Mixin that adds support for custom event attributes.",
|
|
1887
1887
|
"name": "EventAttribute",
|
|
1888
|
-
"members": [
|
|
1889
|
-
{
|
|
1890
|
-
"kind": "method",
|
|
1891
|
-
"name": "dispatchEvent",
|
|
1892
|
-
"return": {
|
|
1893
|
-
"type": {
|
|
1894
|
-
"text": "boolean"
|
|
1895
|
-
}
|
|
1896
|
-
},
|
|
1897
|
-
"parameters": [
|
|
1898
|
-
{
|
|
1899
|
-
"name": "event",
|
|
1900
|
-
"type": {
|
|
1901
|
-
"text": "Event"
|
|
1902
|
-
}
|
|
1903
|
-
}
|
|
1904
|
-
]
|
|
1905
|
-
}
|
|
1906
|
-
],
|
|
1907
1888
|
"parameters": [
|
|
1908
1889
|
{
|
|
1909
1890
|
"name": "base",
|
|
@@ -2201,6 +2182,17 @@
|
|
|
2201
2182
|
"description": "Mixin to augment an element with behavior used to submit a form.",
|
|
2202
2183
|
"name": "FormSubmitter",
|
|
2203
2184
|
"members": [
|
|
2185
|
+
{
|
|
2186
|
+
"kind": "field",
|
|
2187
|
+
"name": "formAssociated",
|
|
2188
|
+
"type": {
|
|
2189
|
+
"text": "boolean"
|
|
2190
|
+
},
|
|
2191
|
+
"static": true,
|
|
2192
|
+
"readonly": true,
|
|
2193
|
+
"default": "true",
|
|
2194
|
+
"description": "Indicates that this custom element participates in form submission, validation, and form state restoration."
|
|
2195
|
+
},
|
|
2204
2196
|
{
|
|
2205
2197
|
"kind": "field",
|
|
2206
2198
|
"name": "name",
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { CSSResultGroup, LitElement, PropertyValues } from "lit";
|
|
2
|
+
declare const M3eButtonSegmentElement_base: import("node_modules/@m3e/core/dist/src/shared/mixins/Constructor").Constructor<import("@m3e/core").DirtyMixin> & import("node_modules/@m3e/core/dist/src/shared/mixins/Constructor").Constructor<import("@m3e/core").TouchedMixin> & import("node_modules/@m3e/core/dist/src/shared/mixins/Constructor").Constructor<import("@m3e/core").CheckedMixin> & import("node_modules/@m3e/core/dist/src/shared/mixins/Constructor").Constructor<import("@m3e/core").DisabledMixin> & import("node_modules/@m3e/core/dist/src/shared/mixins/Constructor").Constructor<import("@m3e/core").AttachInternalsMixin> & import("node_modules/@m3e/core/dist/src/shared/mixins/Constructor").Constructor & typeof LitElement;
|
|
3
|
+
/**
|
|
4
|
+
* A option that can be selected within a segmented button.
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
* The `m3e-button-segment` component represents a single selectable option within a segmented button group.
|
|
8
|
+
* It behaves like a toggle-able button, supporting icon and label content, selection state, and accessibility
|
|
9
|
+
* roles. Segments are visually unified but independently interactive, adapting shape, color, and ripple feedback
|
|
10
|
+
* based on their position and state.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* The following example illustrates a single-select segmented button with four segments.
|
|
14
|
+
* ```html
|
|
15
|
+
* <m3e-segmented-button>
|
|
16
|
+
* <m3e-button-segment checked>8 oz</m3e-button-segment>
|
|
17
|
+
* <m3e-button-segment>12 oz</m3e-button-segment>
|
|
18
|
+
* <m3e-button-segment>16 oz</m3e-button-segment>
|
|
19
|
+
* <m3e-button-segment>20 oz</m3e-button-segment>
|
|
20
|
+
* </m3e-segmented-button>
|
|
21
|
+
* ```
|
|
22
|
+
* @example
|
|
23
|
+
* The next example illustrates a multiselect segmented button designated using the `multi` attribute.
|
|
24
|
+
* ```html
|
|
25
|
+
* <m3e-segmented-button multi>
|
|
26
|
+
* <m3e-button-segment checked>$</m3e-button-segment>
|
|
27
|
+
* <m3e-button-segment checked>$$</m3e-button-segment>
|
|
28
|
+
* <m3e-button-segment>$$$</m3e-button-segment>
|
|
29
|
+
* <m3e-button-segment>$$$$</m3e-button-segment>
|
|
30
|
+
* </m3e-segmented-button>
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @tag m3e-button-segment
|
|
34
|
+
*
|
|
35
|
+
* @slot - Renders the label of the option.
|
|
36
|
+
* @slot icon - Renders an icon before the option's label.
|
|
37
|
+
*
|
|
38
|
+
* @attr checked - Whether the element is checked.
|
|
39
|
+
* @attr disabled - Whether the element is disabled.
|
|
40
|
+
* @attr value - A string representing the value of the segment.
|
|
41
|
+
*
|
|
42
|
+
* @fires input - Emitted when the checked state changes.
|
|
43
|
+
* @fires change - Emitted when the checked state changes.
|
|
44
|
+
* @fires click - Emitted when the element is clicked.
|
|
45
|
+
*
|
|
46
|
+
* @cssprop --m3e-segmented-button-height - Total height of the segmented button.
|
|
47
|
+
* @cssprop --m3e-segmented-button-outline-thickness - Thickness of the button’s border.
|
|
48
|
+
* @cssprop --m3e-segmented-button-outline-color - Color of the button’s border.
|
|
49
|
+
* @cssprop --m3e-segmented-button-padding-start - Padding on the leading edge of the button content.
|
|
50
|
+
* @cssprop --m3e-segmented-button-padding-end - Padding on the trailing edge of the button content.
|
|
51
|
+
* @cssprop --m3e-segmented-button-spacing - Horizontal gap between icon and label.
|
|
52
|
+
* @cssprop --m3e-segmented-button-font-size - Font size of the label text.
|
|
53
|
+
* @cssprop --m3e-segmented-button-font-weight - Font weight of the label text.
|
|
54
|
+
* @cssprop --m3e-segmented-button-line-height - Line height of the label text.
|
|
55
|
+
* @cssprop --m3e-segmented-button-tracking - Letter spacing of the label text.
|
|
56
|
+
* @cssprop --m3e-segmented-button-with-icon-padding-start - Leading padding when an icon is present.
|
|
57
|
+
* @cssprop --m3e-segmented-button-selected-container-color - Background color of a selected segment.
|
|
58
|
+
* @cssprop --m3e-segmented-button-selected-container-hover-color - Hover state-layer color for selected segments.
|
|
59
|
+
* @cssprop --m3e-segmented-button-selected-container-focus-color - Focus state-layer color for selected segments.
|
|
60
|
+
* @cssprop --m3e-segmented-button-selected-ripple-color - Ripple color for selected segments.
|
|
61
|
+
* @cssprop --m3e-segmented-button-selected-label-text-color - Label text color for selected segments.
|
|
62
|
+
* @cssprop --m3e-segmented-button-selected-icon-color - Icon color for selected segments.
|
|
63
|
+
* @cssprop --m3e-segmented-button-unselected-container-hover-color - Hover state-layer color for unselected segments.
|
|
64
|
+
* @cssprop --m3e-segmented-button-unselected-container-focus-color - Focus state-layer color for unselected segments.
|
|
65
|
+
* @cssprop --m3e-segmented-button-unselected-ripple-color - Ripple color for unselected segments.
|
|
66
|
+
* @cssprop --m3e-segmented-button-unselected-label-text-color - Label text color for unselected segments.
|
|
67
|
+
* @cssprop --m3e-segmented-button-unselected-icon-color - Icon color for unselected segments.
|
|
68
|
+
* @cssprop --m3e-segmented-button-icon-size - Font size of the icon.
|
|
69
|
+
* @cssprop --m3e-segmented-button-disabled-outline-color - Base color for disabled segment borders.
|
|
70
|
+
* @cssprop --m3e-segmented-button-disabled-outline-opacity - Opacity applied to disabled segment borders.
|
|
71
|
+
* @cssprop --m3e-segmented-button-disabled-label-text-color - Base color for disabled label text.
|
|
72
|
+
* @cssprop --m3e-segmented-button-disabled-label-text-opacity - Opacity applied to disabled label text.
|
|
73
|
+
* @cssprop --m3e-segmented-button-disabled-icon-color - Base color for disabled icons.
|
|
74
|
+
* @cssprop --m3e-segmented-button-disabled-icon-opacity - Opacity applied to disabled icons.
|
|
75
|
+
*/
|
|
76
|
+
export declare class M3eButtonSegmentElement extends M3eButtonSegmentElement_base {
|
|
77
|
+
#private;
|
|
78
|
+
/** The styles of the element. */
|
|
79
|
+
static styles: CSSResultGroup;
|
|
80
|
+
/** @private */ private readonly _focusRing?;
|
|
81
|
+
/** @private */ private readonly _stateLayer?;
|
|
82
|
+
/** @private */ private readonly _ripple?;
|
|
83
|
+
/**
|
|
84
|
+
* A string representing the value of the segment.
|
|
85
|
+
* @default "on"
|
|
86
|
+
*/
|
|
87
|
+
value: string;
|
|
88
|
+
/** @inheritdoc */
|
|
89
|
+
connectedCallback(): void;
|
|
90
|
+
/** @inheritdoc */
|
|
91
|
+
disconnectedCallback(): void;
|
|
92
|
+
/** @inheritdoc */
|
|
93
|
+
protected firstUpdated(_changedProperties: PropertyValues<this>): void;
|
|
94
|
+
/** @inheritdoc */
|
|
95
|
+
protected update(changedProperties: PropertyValues<this>): void;
|
|
96
|
+
/** @inheritdoc */
|
|
97
|
+
render(): unknown;
|
|
98
|
+
}
|
|
99
|
+
declare global {
|
|
100
|
+
interface HTMLElementTagNameMap {
|
|
101
|
+
"m3e-button-segment": M3eButtonSegmentElement;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
export {};
|
|
105
|
+
//# sourceMappingURL=ButtonSegmentElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonSegmentElement.d.ts","sourceRoot":"","sources":["../../src/ButtonSegmentElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,cAAc,EAAQ,UAAU,EAAE,cAAc,EAAa,MAAM,KAAK,CAAC;;AAmBvF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AACH,qBACa,uBAAwB,SAAQ,4BAE5C;;IACC,iCAAiC;IACjC,OAAgB,MAAM,EAAE,cAAc,CA4LpC;IAEF,eAAe,CAAuB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAsB;IACxF,eAAe,CAAwB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAuB;IAC3F,eAAe,CAAmB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAmB;IAG9E;;;OAGG;IACS,KAAK,SAAQ;IAEzB,kBAAkB;IACT,iBAAiB,IAAI,IAAI;IAKlC,kBAAkB;IACT,oBAAoB,IAAI,IAAI;IAKrC,kBAAkB;cACC,YAAY,CAAC,kBAAkB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;IAK/E,kBAAkB;cACC,MAAM,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;IAwCxE,kBAAkB;IACT,MAAM,IAAI,OAAO;CA0C3B;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,oBAAoB,EAAE,uBAAuB,CAAC;KAC/C;CACF"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { CSSResultGroup, LitElement, PropertyValues } from "lit";
|
|
2
|
+
import { formValue } from "@m3e/core";
|
|
3
|
+
import { SelectionManager, selectionManager } from "@m3e/core/a11y";
|
|
4
|
+
import { M3eButtonSegmentElement } from "./ButtonSegmentElement";
|
|
5
|
+
declare const M3eSegmentedButtonElement_base: import("node_modules/@m3e/core/dist/src/shared/mixins/Constructor").Constructor<import("@m3e/core").LabelledMixin> & import("node_modules/@m3e/core/dist/src/shared/mixins/Constructor").Constructor<import("@m3e/core").DirtyMixin> & import("node_modules/@m3e/core/dist/src/shared/mixins/Constructor").Constructor<import("@m3e/core").TouchedMixin> & import("node_modules/@m3e/core/dist/src/shared/mixins/Constructor").Constructor<import("@m3e/core").FormAssociatedMixin> & import("node_modules/@m3e/core/dist/src/shared/mixins/Constructor").Constructor<import("@m3e/core").DisabledMixin> & import("node_modules/@m3e/core/dist/src/shared/mixins/Constructor").Constructor<import("@m3e/core").AttachInternalsMixin> & import("node_modules/@m3e/core/dist/src/shared/mixins/Constructor").Constructor & typeof LitElement;
|
|
6
|
+
/**
|
|
7
|
+
* A button that allows a user to select from a limited set of options.
|
|
8
|
+
*
|
|
9
|
+
* @description
|
|
10
|
+
* The `m3e-segmented-button` component allows users to select one or more options from a horizontal group.
|
|
11
|
+
* Each segment behaves like a toggle-able button, supporting icon and label content, selection state, and
|
|
12
|
+
* accessibility roles. Built with Material Design 3 principles, it adapts shape, color, and ripple feedback
|
|
13
|
+
* based on interaction state and input modality. Segments are visually unified but independently interactive.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* The following example illustrates a single-select segmented button with four segments.
|
|
17
|
+
* ```html
|
|
18
|
+
* <m3e-segmented-button>
|
|
19
|
+
* <m3e-button-segment checked>8 oz</m3e-button-segment>
|
|
20
|
+
* <m3e-button-segment>12 oz</m3e-button-segment>
|
|
21
|
+
* <m3e-button-segment>16 oz</m3e-button-segment>
|
|
22
|
+
* <m3e-button-segment>20 oz</m3e-button-segment>
|
|
23
|
+
* </m3e-segmented-button>
|
|
24
|
+
* ```
|
|
25
|
+
* @example
|
|
26
|
+
* The next example illustrates a multiselect segmented button designated using the `multi` attribute.
|
|
27
|
+
* ```html
|
|
28
|
+
* <m3e-segmented-button multi>
|
|
29
|
+
* <m3e-button-segment checked>$</m3e-button-segment>
|
|
30
|
+
* <m3e-button-segment checked>$$</m3e-button-segment>
|
|
31
|
+
* <m3e-button-segment>$$$</m3e-button-segment>
|
|
32
|
+
* <m3e-button-segment>$$$$</m3e-button-segment>
|
|
33
|
+
* </m3e-segmented-button>
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @tag m3e-segmented-button
|
|
37
|
+
*
|
|
38
|
+
* @slot - Renders the segments of the button.
|
|
39
|
+
*
|
|
40
|
+
* @attr disabled - Whether the element is disabled.
|
|
41
|
+
* @attr hide-selection-indicator - Whether to hide the selection indicator.
|
|
42
|
+
* @attr multi - Whether multiple options can be selected.
|
|
43
|
+
* @attr name - The name that identifies the element when submitting the associated form.
|
|
44
|
+
*
|
|
45
|
+
* @fires input - Emitted when the checked state of a segment changes.
|
|
46
|
+
* @fires change - Emitted when the checked state of a segment changes.
|
|
47
|
+
*
|
|
48
|
+
* @cssprop --m3e-segmented-button-start-shape - Border radius for the first segment in a segmented button.
|
|
49
|
+
* @cssprop --m3e-segmented-button-end-shape - Border radius for the last segment in a segmented button.
|
|
50
|
+
*/
|
|
51
|
+
export declare class M3eSegmentedButtonElement extends M3eSegmentedButtonElement_base {
|
|
52
|
+
#private;
|
|
53
|
+
/** The styles of the element. */
|
|
54
|
+
static styles: CSSResultGroup;
|
|
55
|
+
/** @internal */
|
|
56
|
+
readonly [selectionManager]: SelectionManager<M3eButtonSegmentElement>;
|
|
57
|
+
/**
|
|
58
|
+
* Whether multiple options can be selected.
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
61
|
+
multi: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Whether to hide the selection indicator.
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
hideSelectionIndicator: boolean;
|
|
67
|
+
/** The segments of the button. */
|
|
68
|
+
get segments(): readonly M3eButtonSegmentElement[];
|
|
69
|
+
/** The selected segment(s) of the button. */
|
|
70
|
+
get selected(): readonly M3eButtonSegmentElement[];
|
|
71
|
+
/** The selected value(s) of the button. */
|
|
72
|
+
get value(): string | readonly string[] | null;
|
|
73
|
+
/** @inheritdoc @internal */
|
|
74
|
+
get [formValue](): string | FormData | null;
|
|
75
|
+
/** @inheritdoc */
|
|
76
|
+
connectedCallback(): void;
|
|
77
|
+
/** @inheritdoc */
|
|
78
|
+
protected update(changedProperties: PropertyValues<this>): void;
|
|
79
|
+
/** @inheritdoc */
|
|
80
|
+
protected render(): unknown;
|
|
81
|
+
}
|
|
82
|
+
declare global {
|
|
83
|
+
interface HTMLElementTagNameMap {
|
|
84
|
+
"m3e-segmented-button": M3eSegmentedButtonElement;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
export {};
|
|
88
|
+
//# sourceMappingURL=SegmentedButtonElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentedButtonElement.d.ts","sourceRoot":"","sources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,CAAC;AACvC,cAAc,0BAA0B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m3e/segmented-button",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.3",
|
|
4
4
|
"description": "Segmented Button for M3E",
|
|
5
5
|
"author": "matraic <matraic@yahoo.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"clean": "rimraf dist"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@m3e/core": "1.0.0-rc.
|
|
30
|
+
"@m3e/core": "1.0.0-rc.3",
|
|
31
31
|
"lit": "^3.3.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|