@m3e/form-field 1.0.0-rc.2 → 1.0.0-rc.4

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.
@@ -0,0 +1,143 @@
1
+ /**
2
+ * Adapted from Angular Material Form Field
3
+ * Source: https://github.com/angular/components/blob/main/src/material/form-field/form-field.ts
4
+ *
5
+ * @license MIT
6
+ * Copyright (c) 2025 Google LLC
7
+ * See LICENSE file in the project root for full license text.
8
+ */
9
+ import { CSSResultGroup, LitElement, PropertyValues } from "lit";
10
+ import { FormFieldControl } from "./FormFieldControl";
11
+ import { FormFieldVariant } from "./FormFieldVariant";
12
+ import { HideSubscriptType } from "./HideSubscriptType";
13
+ import { FloatLabelType } from "./FloatLabelType";
14
+ declare const M3eFormFieldElement_base: import("node_modules/@m3e/core/dist/src/shared/mixins/Constructor").Constructor<import("@m3e/core").AttachInternalsMixin> & typeof LitElement;
15
+ /**
16
+ * A container for form controls that applies Material Design styling and behavior.
17
+ *
18
+ * @description
19
+ * The `m3e-form-field` component is a semantic, expressive container for form controls that anchors
20
+ * label behavior, subscript messaging, and variant-specific layout. Designed according to Material Design 3
21
+ * guidelines, it supports two visual variants—`outlined` and `filled`—each with dynamic elevation,
22
+ * shape transitions, and adaptive color theming. The component responds to control state changes
23
+ * (focus, hover, press, disabled, invalid) with smooth motion and semantic clarity, ensuring
24
+ * visual hierarchy and emotional resonance.
25
+
26
+ * The component is accessible by default, with ARIA annotations, contrast-safe color tokens,
27
+ * and dynamic descriptions for hint and error messaging. It supports prefix and suffix content,
28
+ * floating labels, and adaptive subscript visibility. When hosting a control with validation,
29
+ * error messages are surfaced with `aria-invalid` and described for assistive technology.
30
+
31
+ * Native form controls may not expose full state or messaging on their own. `m3e-form-field` bridges
32
+ * these gaps by coordinating label floating, container styling, and subscript feedback.
33
+ *
34
+ * @example
35
+ * The following example illustrates a basic usage of the `m3e-form-field`.
36
+ * ```html
37
+ * <m3e-form-field>
38
+ * <label slot="label" for="field">Text field</label>
39
+ * <input id="field" />
40
+ * </m3e-form-field>
41
+ * ```
42
+ *
43
+ * @tag m3e-form-field
44
+ *
45
+ * @slot - Renders the control of the field.
46
+ * @slot prefix - Renders content before the fields's control.
47
+ * @slot prefix-text - Renders text before the fields's control.
48
+ * @slot suffix - Renders content after the fields's control.
49
+ * @slot suffix-text - Renders text after the fields's control.
50
+ * @slot hint - Renders hint text in the fields's subscript, when the control is valid.
51
+ * @slot error - Renders error text in the fields's subscript, when the control is invalid.
52
+ *
53
+ * @attr float-label - Specifies whether the label should float always or only when necessary.
54
+ * @attr hide-required-marker - Whether the required marker should be hidden.
55
+ * @attr hide-subscript - Whether subscript content is hidden.
56
+ * @attr variant - The appearance variant of the field.
57
+ *
58
+ * @cssprop --m3e-form-field-font-size - Font size for the form field container text.
59
+ * @cssprop --m3e-form-field-font-weight - Font weight for the form field container text.
60
+ * @cssprop --m3e-form-field-line-height - Line height for the form field container text.
61
+ * @cssprop --m3e-form-field-tracking - Letter spacing for the form field container text.
62
+ * @cssprop --m3e-form-field-label-font-size - Font size for the floating label.
63
+ * @cssprop --m3e-form-field-label-font-weight - Font weight for the floating label.
64
+ * @cssprop --m3e-form-field-label-line-height - Line height for the floating label.
65
+ * @cssprop --m3e-form-field-label-tracking - Letter spacing for the floating label.
66
+ * @cssprop --m3e-form-field-subscript-font-size - Font size for hint and error text.
67
+ * @cssprop --m3e-form-field-subscript-font-weight - Font weight for hint and error text.
68
+ * @cssprop --m3e-form-field-subscript-line-height - Line height for hint and error text.
69
+ * @cssprop --m3e-form-field-subscript-tracking - Letter spacing for hint and error text.
70
+ * @cssprop --m3e-form-field-color - Text color for the form field container.
71
+ * @cssprop --m3e-form-field-subscript-color - Color for hint and error text.
72
+ * @cssprop --m3e-form-field-invalid-color - Color used when the control is invalid.
73
+ * @cssprop --m3e-form-field-focused-outline-color - Outline color when focused.
74
+ * @cssprop --m3e-form-field-focused-color - Label color when focused.
75
+ * @cssprop --m3e-form-field-outline-color - Outline color in outlined variant.
76
+ * @cssprop --m3e-form-field-container-color - Background color in filled variant.
77
+ * @cssprop --m3e-form-field-hover-container-color - Hover background color in filled variant.
78
+ * @cssprop --m3e-form-field-width - Width of the form field container.
79
+ * @cssprop --m3e-form-field-icon-size - Size of prefix and suffix icons.
80
+ * @cssprop --m3e-outlined-form-field-container-shape - Corner radius for outlined container.
81
+ * @cssprop --m3e-form-field-container-shape - Corner radius for filled container.
82
+ * @cssprop --m3e-form-field-hover-container-opacity - Opacity for hover background in filled variant.
83
+ * @cssprop --m3e-form-field-disabled-opacity - Opacity for disabled text.
84
+ * @cssprop --m3e-form-field-disabled-container-opacity - Opacity for disabled container background.
85
+ */
86
+ export declare class M3eFormFieldElement extends M3eFormFieldElement_base {
87
+ #private;
88
+ /** The styles of the element. */
89
+ static styles: CSSResultGroup;
90
+ /** @private */ private readonly _base;
91
+ /** @private */ private readonly _prefix;
92
+ /** @private */ private readonly _error;
93
+ /** @private */ private readonly _hint;
94
+ /** @private */ private _pseudoLabel;
95
+ /** @private */ private _required;
96
+ /** @private */ private _invalid;
97
+ /** @private */ private _validationMessage;
98
+ constructor();
99
+ /** A reference to the hosted form field control. */
100
+ get control(): FormFieldControl | null;
101
+ /**
102
+ * The appearance variant of the field.
103
+ * @default "outlined"
104
+ */
105
+ variant: FormFieldVariant;
106
+ /**
107
+ * Whether the required marker should be hidden.
108
+ * @default false
109
+ */
110
+ hideRequiredMarker: boolean;
111
+ /**
112
+ * Whether subscript content is hidden.
113
+ * @default "auto"
114
+ */
115
+ hideSubscript: HideSubscriptType;
116
+ /**
117
+ * Specifies whether the label should float always or only when necessary.
118
+ * @default "auto"
119
+ */
120
+ floatLabel: FloatLabelType;
121
+ /**
122
+ * Notifies the form field that the state of the hosted `control` has changed.
123
+ * @param {boolean} [checkValidity=false] Whether to check validity.
124
+ */
125
+ notifyControlStateChange(checkValidity?: boolean): void;
126
+ /** @inheritdoc */
127
+ connectedCallback(): void;
128
+ /** @inheritdoc */
129
+ disconnectedCallback(): void;
130
+ /** @private */
131
+ protected firstUpdated(_changedProperties: PropertyValues): void;
132
+ /** @inheritdoc */
133
+ protected update(changedProperties: PropertyValues): void;
134
+ /** @inheritdoc */
135
+ protected render(): unknown;
136
+ }
137
+ declare global {
138
+ interface HTMLElementTagNameMap {
139
+ "m3e-form-field": M3eFormFieldElement;
140
+ }
141
+ }
142
+ export {};
143
+ //# sourceMappingURL=FormFieldElement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormFieldElement.d.ts","sourceRoot":"","sources":["../../src/FormFieldElement.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAO,cAAc,EAAQ,UAAU,EAAW,cAAc,EAAa,MAAM,KAAK,CAAC;AAkBhG,OAAO,EAAwB,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AACH,qBACa,mBAAoB,SAAQ,wBAA2B;;IA2BlE,iCAAiC;IACjC,OAAgB,MAAM,EAAE,cAAc,CAiZpC;IAmCF,eAAe,CAAiB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAe;IACrE,eAAe,CAAmB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;IACzE,eAAe,CAAkB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;IACvE,eAAe,CAAiB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAe;IAiBrE,eAAe,CAAU,OAAO,CAAC,YAAY,CAAM;IACnD,eAAe,CAAU,OAAO,CAAC,SAAS,CAAS;IACnD,eAAe,CAAU,OAAO,CAAC,QAAQ,CAAS;IAClD,eAAe,CAAU,OAAO,CAAC,kBAAkB,CAAM;;IAoBzD,oDAAoD;IACpD,IAAI,OAAO,4BAEV;IAED;;;OAGG;IAC0B,OAAO,EAAE,gBAAgB,CAAc;IAEpE;;;OAGG;IAC4E,kBAAkB,UAAS;IAE1G;;;OAGG;IACuD,aAAa,EAAE,iBAAiB,CAAU;IAEpG;;;OAGG;IACoD,UAAU,EAAE,cAAc,CAAU;IAE3F;;;OAGG;IACH,wBAAwB,CAAC,aAAa,GAAE,OAAe,GAAG,IAAI;IAqB9D,kBAAkB;IACT,iBAAiB,IAAI,IAAI;IAMlC,kBAAkB;IACT,oBAAoB,IAAI,IAAI;IAKrC,eAAe;cACI,YAAY,CAAC,kBAAkB,EAAE,cAAc,GAAG,IAAI;IAYzE,kBAAkB;cACC,MAAM,CAAC,iBAAiB,EAAE,cAAc,GAAG,IAAI;IAgBlE,kBAAkB;cACC,MAAM,IAAI,OAAO;CAqKrC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,mBAAmB,CAAC;KACvC;CACF"}
@@ -0,0 +1,3 @@
1
+ /** Specifies the possible appearance variants of a form field. */
2
+ export type FormFieldVariant = "filled" | "outlined";
3
+ //# sourceMappingURL=FormFieldVariant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormFieldVariant.d.ts","sourceRoot":"","sources":["../../src/FormFieldVariant.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,UAAU,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Specifies the possible behavior modes used to hide subscript content in a form field. */
2
+ export type HideSubscriptType = "always" | "auto" | "never";
3
+ //# sourceMappingURL=HideSubscriptType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HideSubscriptType.d.ts","sourceRoot":"","sources":["../../src/HideSubscriptType.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from "./FloatLabelType";
2
+ export * from "./FormFieldControl";
3
+ export * from "./FormFieldElement";
4
+ export * from "./FormFieldVariant";
5
+ export * from "./HideSubscriptType";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m3e/form-field",
3
- "version": "1.0.0-rc.2",
3
+ "version": "1.0.0-rc.4",
4
4
  "description": "Form Field 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.2",
30
+ "@m3e/core": "1.0.0-rc.4",
31
31
  "lit": "^3.3.0"
32
32
  },
33
33
  "devDependencies": {