@m3e/radio-group 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/RadioElement.d.ts +79 -0
- package/dist/src/RadioElement.d.ts.map +1 -0
- package/dist/src/RadioGroupElement.d.ts +71 -0
- package/dist/src/RadioGroupElement.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
|
@@ -2064,25 +2064,6 @@
|
|
|
2064
2064
|
"kind": "mixin",
|
|
2065
2065
|
"description": "Mixin that adds support for custom event attributes.",
|
|
2066
2066
|
"name": "EventAttribute",
|
|
2067
|
-
"members": [
|
|
2068
|
-
{
|
|
2069
|
-
"kind": "method",
|
|
2070
|
-
"name": "dispatchEvent",
|
|
2071
|
-
"return": {
|
|
2072
|
-
"type": {
|
|
2073
|
-
"text": "boolean"
|
|
2074
|
-
}
|
|
2075
|
-
},
|
|
2076
|
-
"parameters": [
|
|
2077
|
-
{
|
|
2078
|
-
"name": "event",
|
|
2079
|
-
"type": {
|
|
2080
|
-
"text": "Event"
|
|
2081
|
-
}
|
|
2082
|
-
}
|
|
2083
|
-
]
|
|
2084
|
-
}
|
|
2085
|
-
],
|
|
2086
2067
|
"parameters": [
|
|
2087
2068
|
{
|
|
2088
2069
|
"name": "base",
|
|
@@ -2380,6 +2361,17 @@
|
|
|
2380
2361
|
"description": "Mixin to augment an element with behavior used to submit a form.",
|
|
2381
2362
|
"name": "FormSubmitter",
|
|
2382
2363
|
"members": [
|
|
2364
|
+
{
|
|
2365
|
+
"kind": "field",
|
|
2366
|
+
"name": "formAssociated",
|
|
2367
|
+
"type": {
|
|
2368
|
+
"text": "boolean"
|
|
2369
|
+
},
|
|
2370
|
+
"static": true,
|
|
2371
|
+
"readonly": true,
|
|
2372
|
+
"default": "true",
|
|
2373
|
+
"description": "Indicates that this custom element participates in form submission, validation, and form state restoration."
|
|
2374
|
+
},
|
|
2383
2375
|
{
|
|
2384
2376
|
"kind": "field",
|
|
2385
2377
|
"name": "name",
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { CSSResultGroup, LitElement, PropertyValues } from "lit";
|
|
2
|
+
declare const M3eRadioElement_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").LabelledMixin> & import("node_modules/@m3e/core/dist/src/shared/mixins/Constructor").Constructor & 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> & typeof LitElement;
|
|
3
|
+
/**
|
|
4
|
+
* A radio button that allows a user to select one option from a set of options.
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
* The `m3e-radio` component represents a radio button that enables users to select an options from a set.
|
|
8
|
+
* It supports selection from mutually exclusive options, emitting `input` and `change` events when its state updates.
|
|
9
|
+
* The component reflects its state through customizable CSS properties for hover, focus, ripple, and icon styling—
|
|
10
|
+
* adapting dynamically based on whether it is selected, unselected, or disabled.
|
|
11
|
+
*
|
|
12
|
+
* Attributes like `checked`, `disabled`, and `value` control its behavior and accessibility, while its visual
|
|
13
|
+
* presentation can be tuned via design tokens such as `--m3e-radio-container-size` and `--m3e-radio-icon-size`.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* The following example illustrates using `m3e-radio-group` and `m3e-radio` to present a group of options.
|
|
17
|
+
* ```html
|
|
18
|
+
* <label for="rdg1">Radio group</label>
|
|
19
|
+
* <br />
|
|
20
|
+
* <m3e-radio-group id="rdg1">
|
|
21
|
+
* <label><m3e-radio value="1"></m3e-radio> Value 1</label>
|
|
22
|
+
* <label><m3e-radio value="2"></m3e-radio> Value 2</label>
|
|
23
|
+
* <label><m3e-radio value="3"></m3e-radio> Value 3</label>
|
|
24
|
+
* <label><m3e-radio value="4"></m3e-radio> Value 4</label>
|
|
25
|
+
* </m3e-radio-group>
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @tag m3e-radio
|
|
29
|
+
*
|
|
30
|
+
* @attr checked - Whether the element is checked.
|
|
31
|
+
* @attr disabled - Whether the element is disabled.
|
|
32
|
+
* @attr value - A string representing the value of the radio.
|
|
33
|
+
*
|
|
34
|
+
* @fires input - Emitted when the checked state changes.
|
|
35
|
+
* @fires change - Emitted when the checked state changes.
|
|
36
|
+
* @fires click - Emitted when the element is clicked.
|
|
37
|
+
*
|
|
38
|
+
* @cssprop --m3e-radio-container-size - Base size of the radio button container.
|
|
39
|
+
* @cssprop --m3e-radio-icon-size - Size of the radio icon inside the wrapper.
|
|
40
|
+
* @cssprop --m3e-radio-unselected-hover-color - Hover state layer color when radio is not selected.
|
|
41
|
+
* @cssprop --m3e-radio-unselected-focus-color - Focus state layer color when radio is not selected.
|
|
42
|
+
* @cssprop --m3e-radio-unselected-ripple-color - Ripple color when radio is not selected.
|
|
43
|
+
* @cssprop --m3e-radio-unselected-icon-color - Icon color when radio is not selected.
|
|
44
|
+
* @cssprop --m3e-radio-selected-hover-color - Hover state layer color when radio is selected.
|
|
45
|
+
* @cssprop --m3e-radio-selected-focus-color - Focus state layer color when radio is selected.
|
|
46
|
+
* @cssprop --m3e-radio-selected-ripple-color - Ripple color when radio is selected.
|
|
47
|
+
* @cssprop --m3e-radio-selected-icon-color - Icon color when radio is selected.
|
|
48
|
+
* @cssprop --m3e-radio-disabled-icon-color - Icon color when radio is disabled.
|
|
49
|
+
*/
|
|
50
|
+
export declare class M3eRadioElement extends M3eRadioElement_base {
|
|
51
|
+
#private;
|
|
52
|
+
/** The styles of the element. */
|
|
53
|
+
static styles: CSSResultGroup;
|
|
54
|
+
/** @private */ private readonly _focusRing?;
|
|
55
|
+
/** @private */ private readonly _stateLayer?;
|
|
56
|
+
/** @private */ private readonly _ripple?;
|
|
57
|
+
/**
|
|
58
|
+
* A string representing the value of the radio.
|
|
59
|
+
* @default "on"
|
|
60
|
+
*/
|
|
61
|
+
value: string;
|
|
62
|
+
/** @inheritdoc */
|
|
63
|
+
connectedCallback(): void;
|
|
64
|
+
/** @inheritdoc */
|
|
65
|
+
disconnectedCallback(): void;
|
|
66
|
+
/** @inheritdoc */
|
|
67
|
+
protected update(changedProperties: PropertyValues<this>): void;
|
|
68
|
+
/** @inheritdoc */
|
|
69
|
+
protected firstUpdated(_changedProperties: PropertyValues<this>): void;
|
|
70
|
+
/** @inheritdoc */
|
|
71
|
+
protected render(): unknown;
|
|
72
|
+
}
|
|
73
|
+
declare global {
|
|
74
|
+
interface HTMLElementTagNameMap {
|
|
75
|
+
"m3e-radio": M3eRadioElement;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
export {};
|
|
79
|
+
//# sourceMappingURL=RadioElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioElement.d.ts","sourceRoot":"","sources":["../../src/RadioElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,cAAc,EAAQ,UAAU,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;;AAuB5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,qBACa,eAAgB,SAAQ,oBAEpC;;IACC,iCAAiC;IACjC,OAAgB,MAAM,EAAE,cAAc,CAmEpC;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;IA4B9E;;;OAGG;IACS,KAAK,SAAQ;IAEzB,kBAAkB;IACT,iBAAiB,IAAI,IAAI;IAUlC,kBAAkB;IACT,oBAAoB,IAAI,IAAI;IAUrC,kBAAkB;cACC,MAAM,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;IAQxE,kBAAkB;cACC,YAAY,CAAC,kBAAkB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;IAK/E,kBAAkB;cACC,MAAM,IAAI,OAAO;CAiCrC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,eAAe,CAAC;KAC9B;CACF"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { CSSResultGroup, LitElement, PropertyValues } from "lit";
|
|
2
|
+
import { formValue } from "@m3e/core";
|
|
3
|
+
import { SelectionManager, selectionManager } from "@m3e/core/a11y";
|
|
4
|
+
import { M3eRadioElement } from "./RadioElement";
|
|
5
|
+
declare const M3eRadioGroupElement_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").RequiredConstraintValidationMixin> & 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").RequiredMixin> & import("node_modules/@m3e/core/dist/src/shared/mixins/Constructor").Constructor<import("@m3e/core").ConstraintValidationMixin> & 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 container for a set of radio buttons that enforces single selection.
|
|
8
|
+
*
|
|
9
|
+
* @description
|
|
10
|
+
* The `m3e-radio-group` component orchestrates a collection of `m3e-radio` components, ensuring that
|
|
11
|
+
* only one option is selected at a time. It manages selection state, propagates value changes, and
|
|
12
|
+
* supports form integration through `name` and `value` attributes.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* The following example illustrates using `m3e-radio-group` and `m3e-radio` to present a group of options.
|
|
16
|
+
* ```html
|
|
17
|
+
* <label for="rdg1">Radio group</label>
|
|
18
|
+
* <br />
|
|
19
|
+
* <m3e-radio-group id="rdg1">
|
|
20
|
+
* <label><m3e-radio value="1"></m3e-radio> Value 1</label>
|
|
21
|
+
* <label><m3e-radio value="2"></m3e-radio> Value 2</label>
|
|
22
|
+
* <label><m3e-radio value="3"></m3e-radio> Value 3</label>
|
|
23
|
+
* <label><m3e-radio value="4"></m3e-radio> Value 4</label>
|
|
24
|
+
* </m3e-radio-group>
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @tag m3e-radio-group
|
|
28
|
+
*
|
|
29
|
+
* @slot - Renders the radio buttons of the group.
|
|
30
|
+
*
|
|
31
|
+
* @attr disabled - Whether the element is disabled.
|
|
32
|
+
* @attr name - The name that identifies the element when submitting the associated form.
|
|
33
|
+
* @attr required - Whether the element is required.
|
|
34
|
+
*
|
|
35
|
+
* @fires change - Emitted when the checked state of a radio button changes.
|
|
36
|
+
*
|
|
37
|
+
* @cssprop --m3e-radio-error-hover-color - Fallback hover color used when the radio is invalid and touched.
|
|
38
|
+
* @cssprop --m3e-radio-error-focus-color - Fallback focus color used when the radio is invalid and touched.
|
|
39
|
+
* @cssprop --m3e-radio-error-ripple-color - Fallback ripple color used when the radio is invalid and touched.
|
|
40
|
+
* @cssprop --m3e-radio-error-icon-color - Fallback icon color used when the radio is invalid and touched.
|
|
41
|
+
*/
|
|
42
|
+
export declare class M3eRadioGroupElement extends M3eRadioGroupElement_base {
|
|
43
|
+
#private;
|
|
44
|
+
/** The styles of the element. */
|
|
45
|
+
static styles: CSSResultGroup;
|
|
46
|
+
/** @internal */
|
|
47
|
+
readonly [selectionManager]: SelectionManager<M3eRadioElement>;
|
|
48
|
+
/** The radio buttons in the group. */
|
|
49
|
+
get radios(): readonly M3eRadioElement[];
|
|
50
|
+
/** The selected radio. */
|
|
51
|
+
get selected(): M3eRadioElement | null;
|
|
52
|
+
/** The selected value of the radio group. */
|
|
53
|
+
get value(): string | null;
|
|
54
|
+
/** @inheritdoc @internal */
|
|
55
|
+
get [formValue](): string | File | FormData | null;
|
|
56
|
+
/** @inheritdoc */
|
|
57
|
+
connectedCallback(): void;
|
|
58
|
+
/** @inheritdoc */
|
|
59
|
+
disconnectedCallback(): void;
|
|
60
|
+
/** @inheritdoc */
|
|
61
|
+
protected update(changedProperties: PropertyValues<this>): void;
|
|
62
|
+
/** @inheritdoc */
|
|
63
|
+
protected render(): unknown;
|
|
64
|
+
}
|
|
65
|
+
declare global {
|
|
66
|
+
interface HTMLElementTagNameMap {
|
|
67
|
+
"m3e-radio-group": M3eRadioGroupElement;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export {};
|
|
71
|
+
//# sourceMappingURL=RadioGroupElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioGroupElement.d.ts","sourceRoot":"","sources":["../../src/RadioGroupElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,cAAc,EAAQ,UAAU,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAG5E,OAAO,EAQL,SAAS,EAKV,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,qBACa,oBAAqB,SAAQ,yBAMzC;;IACC,iCAAiC;IACjC,OAAgB,MAAM,EAAE,cAAc,CAiBpC;IAIF,gBAAgB;IAChB,QAAQ,CAAC,CAAC,gBAAgB,CAAC,oCAExB;IAEH,sCAAsC;IACtC,IAAI,MAAM,IAAI,SAAS,eAAe,EAAE,CAEvC;IAED,0BAA0B;IAC1B,IAAI,QAAQ,IAAI,eAAe,GAAG,IAAI,CAErC;IAED,6CAA6C;IAC7C,IAAI,KAAK,IAAI,MAAM,GAAG,IAAI,CAEzB;IAED,4BAA4B;IAC5B,IAAa,CAAC,SAAS,CAAC,IAAI,MAAM,GAAG,IAAI,GAAG,QAAQ,GAAG,IAAI,CAE1D;IAED,kBAAkB;IACT,iBAAiB,IAAI,IAAI;IAKlC,kBAAkB;IACT,oBAAoB,IAAI,IAAI;IAKrC,kBAAkB;cACC,MAAM,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;IAQxE,kBAAkB;cACC,MAAM,IAAI,OAAO;CA2BrC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,iBAAiB,EAAE,oBAAoB,CAAC;KACzC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m3e/radio-group",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.3",
|
|
4
4
|
"description": "Radio Group for M3E",
|
|
5
5
|
"author": "matraic <matraic@yahoo.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"clean": "rimraf dist"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@m3e/core": "1.0.0-rc.
|
|
31
|
+
"@m3e/core": "1.0.0-rc.3",
|
|
32
32
|
"lit": "^3.3.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|