@momentum-design/components 0.139.8 → 0.140.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/dist/browser/index.js +483 -444
- package/dist/browser/index.js.map +4 -4
- package/dist/components/input/input.component.d.ts +30 -10
- package/dist/components/input/input.component.js +5 -0
- package/dist/components/input/input.constants.d.ts +12 -1
- package/dist/components/input/input.constants.js +12 -1
- package/dist/components/input/input.types.d.ts +3 -2
- package/dist/components/numberinput/index.d.ts +7 -0
- package/dist/components/numberinput/index.js +4 -0
- package/dist/components/numberinput/numberinput.component.d.ts +193 -0
- package/dist/components/numberinput/numberinput.component.js +330 -0
- package/dist/components/numberinput/numberinput.constants.d.ts +15 -0
- package/dist/components/numberinput/numberinput.constants.js +17 -0
- package/dist/components/numberinput/numberinput.styles.d.ts +2 -0
- package/dist/components/numberinput/numberinput.styles.js +27 -0
- package/dist/components/numberinput/numberinput.types.d.ts +17 -0
- package/dist/components/numberinput/numberinput.types.js +1 -0
- package/dist/components/popover/popover.component.js +11 -9
- package/dist/custom-elements.json +2189 -250
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +1 -0
- package/dist/react/input/index.d.ts +24 -8
- package/dist/react/numberinput/index.d.ts +90 -0
- package/dist/react/numberinput/index.js +65 -0
- package/dist/utils/dom.js +3 -0
- package/dist/utils/number.d.ts +1 -0
- package/dist/utils/number.js +10 -0
- package/package.json +1 -1
|
@@ -2,24 +2,40 @@ import { CSSResult, nothing, PropertyValueMap } from 'lit';
|
|
|
2
2
|
import FormfieldWrapper from '../formfieldwrapper';
|
|
3
3
|
import type { IconNames } from '../icon/icon.types';
|
|
4
4
|
import { AssociatedFormControl } from '../../utils/mixins/FormInternalsMixin';
|
|
5
|
-
import type { AutoCapitalizeType, AutoCompleteType, InputType } from './input.types';
|
|
5
|
+
import type { AutoCapitalizeType, AutoCompleteType, InputModeType, InputType } from './input.types';
|
|
6
6
|
declare const Input_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/CharacterLimitMixin").CharacterLimitMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/KeyToActionMixin").KeyToActionInterface> & import("../../utils/mixins/index.types").Constructor<import("../../models").Component & import("../../utils/mixins/AutoFocusOnMountMixin").AutoFocusOnMountMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/FormInternalsMixin").FormInternalsMixinInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/DataAriaLabelMixin").DataAriaLabelMixinInterface> & typeof FormfieldWrapper;
|
|
7
7
|
/**
|
|
8
|
-
* The input is a single-line text field with a label, optional helper or
|
|
8
|
+
* The input is a single-line text field with a label, optional helper or
|
|
9
|
+
* validation text, and an optional trailing clear button. It supports a leading
|
|
10
|
+
* icon, a static prefix text, character counting, and full HTML form integration
|
|
11
|
+
* (the host is form-associated and submits its `value` under `name`).
|
|
9
12
|
*
|
|
10
|
-
* The label, required indicator, and helper text rendering follow the standard
|
|
13
|
+
* The label, required indicator, and helper text rendering follow the standard
|
|
14
|
+
* form-field layout; an optional info-icon toggletip can be attached next to the
|
|
15
|
+
* label for additional context.
|
|
11
16
|
*
|
|
12
17
|
* **When to use**
|
|
13
18
|
*
|
|
14
|
-
* - Use `mdc-input` for any short, free-form text entry: names, search terms,
|
|
15
|
-
*
|
|
19
|
+
* - Use `mdc-input` for any short, free-form text entry: names, search terms,
|
|
20
|
+
* single-line addresses, codes, or any value that fits on one line.
|
|
21
|
+
* - Use `mdc-input` when the field needs a label, helper/validation text, and form
|
|
22
|
+
* integration without wiring it by hand.
|
|
16
23
|
*
|
|
17
24
|
* **When not to use**
|
|
18
25
|
*
|
|
19
|
-
* - Do not use `mdc-input` for
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
26
|
+
* - Do not use `mdc-input` for bounded numeric entry that benefits from stepwise
|
|
27
|
+
* adjustment, such as quantities, counts, or prices. Use `mdc-numberinput`
|
|
28
|
+
* instead. `mdc-input` remains the right choice for numeric-looking values that
|
|
29
|
+
* are really strings — phone numbers, PINs, or account codes — where formatting
|
|
30
|
+
* must be preserved and arithmetic stepping is meaningless.
|
|
31
|
+
* - Do not use `mdc-input` for multi-line entry such as messages or comments. Use
|
|
32
|
+
* `mdc-textarea` instead.
|
|
33
|
+
* - Do not use `mdc-input` for masked credentials that need a show/hide toggle.
|
|
34
|
+
* Use `mdc-password` instead.
|
|
35
|
+
* - Do not use `mdc-input` for search that filters page content. Use
|
|
36
|
+
* `mdc-searchfield` instead.
|
|
37
|
+
* - Do not use `mdc-input` when the value must be chosen from a fixed set. Use
|
|
38
|
+
* `mdc-select` or `mdc-combobox` instead.
|
|
23
39
|
*
|
|
24
40
|
* @tagname mdc-input
|
|
25
41
|
*
|
|
@@ -117,6 +133,10 @@ declare class Input extends Input_base implements AssociatedFormControl {
|
|
|
117
133
|
* @default 'off'
|
|
118
134
|
*/
|
|
119
135
|
autocomplete: AutoCompleteType;
|
|
136
|
+
/**
|
|
137
|
+
* Hints at the type of data that might be entered by the user and the corresponding virtual keyboard.
|
|
138
|
+
*/
|
|
139
|
+
inputmode?: InputModeType;
|
|
120
140
|
/**
|
|
121
141
|
* Specifies the name of the directionality of text for submission purposes (e.g., "rtl" for right-to-left).
|
|
122
142
|
*/
|
|
@@ -163,7 +183,7 @@ declare class Input extends Input_base implements AssociatedFormControl {
|
|
|
163
183
|
* @param value - new value
|
|
164
184
|
*/
|
|
165
185
|
attributeChangedCallback(name: string, old: string | null, value: string | null): void;
|
|
166
|
-
|
|
186
|
+
protected setInputValidity(): void;
|
|
167
187
|
protected updated(changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
|
168
188
|
/**
|
|
169
189
|
* Updates the value of the input field.
|
|
@@ -344,6 +344,7 @@ class Input extends CharacterLimitMixin(KeyToActionMixin(AutoFocusOnMountMixin(F
|
|
|
344
344
|
maxlength=${ifDefined(this.maxlength)}
|
|
345
345
|
autocapitalize=${this.autocapitalize}
|
|
346
346
|
autocomplete=${this.autocomplete}
|
|
347
|
+
inputmode=${ifDefined(this.inputmode)}
|
|
347
348
|
dirname=${ifDefined(this.dirname)}
|
|
348
349
|
pattern=${ifDefined(this.pattern)}
|
|
349
350
|
list=${ifDefined(this.list)}
|
|
@@ -414,6 +415,10 @@ __decorate([
|
|
|
414
415
|
property({ type: String }),
|
|
415
416
|
__metadata("design:type", String)
|
|
416
417
|
], Input.prototype, "autocomplete", void 0);
|
|
418
|
+
__decorate([
|
|
419
|
+
property({ type: String, reflect: true }),
|
|
420
|
+
__metadata("design:type", String)
|
|
421
|
+
], Input.prototype, "inputmode", void 0);
|
|
417
422
|
__decorate([
|
|
418
423
|
property({ type: String }),
|
|
419
424
|
__metadata("design:type", String)
|
|
@@ -12,10 +12,21 @@ declare const AUTO_COMPLETE: {
|
|
|
12
12
|
readonly OFF: "off";
|
|
13
13
|
readonly ON: "on";
|
|
14
14
|
};
|
|
15
|
+
declare const INPUT_MODE: {
|
|
16
|
+
readonly NONE: "none";
|
|
17
|
+
readonly TEXT: "text";
|
|
18
|
+
readonly DECIMAL: "decimal";
|
|
19
|
+
readonly NUMERIC: "numeric";
|
|
20
|
+
readonly TEL: "tel";
|
|
21
|
+
readonly SEARCH: "search";
|
|
22
|
+
readonly EMAIL: "email";
|
|
23
|
+
readonly URL: "url";
|
|
24
|
+
};
|
|
15
25
|
declare const INPUT_TYPE: {
|
|
16
26
|
readonly PASSWORD: "password";
|
|
17
27
|
readonly TEXT: "text";
|
|
18
28
|
readonly SEARCH: "search";
|
|
29
|
+
readonly NUMBER: "number";
|
|
19
30
|
};
|
|
20
31
|
declare const PREFIX_TEXT_OPTIONS: {
|
|
21
32
|
MAX_LENGTH: number;
|
|
@@ -34,4 +45,4 @@ declare const DEFAULTS: {
|
|
|
34
45
|
readonly AUTO_COMPLETE: "off";
|
|
35
46
|
readonly INPUT_TYPE: "text";
|
|
36
47
|
};
|
|
37
|
-
export { TAG_NAME, PREFIX_TEXT_OPTIONS, AUTO_CAPITALIZE, AUTO_COMPLETE, INPUT_TYPE, DEFAULTS };
|
|
48
|
+
export { TAG_NAME, PREFIX_TEXT_OPTIONS, AUTO_CAPITALIZE, AUTO_COMPLETE, INPUT_MODE, INPUT_TYPE, DEFAULTS };
|
|
@@ -15,10 +15,21 @@ const AUTO_COMPLETE = {
|
|
|
15
15
|
OFF: 'off',
|
|
16
16
|
ON: 'on',
|
|
17
17
|
};
|
|
18
|
+
const INPUT_MODE = {
|
|
19
|
+
NONE: 'none',
|
|
20
|
+
TEXT: 'text',
|
|
21
|
+
DECIMAL: 'decimal',
|
|
22
|
+
NUMERIC: 'numeric',
|
|
23
|
+
TEL: 'tel',
|
|
24
|
+
SEARCH: 'search',
|
|
25
|
+
EMAIL: 'email',
|
|
26
|
+
URL: 'url',
|
|
27
|
+
};
|
|
18
28
|
const INPUT_TYPE = {
|
|
19
29
|
PASSWORD: 'password',
|
|
20
30
|
TEXT: 'text',
|
|
21
31
|
SEARCH: 'search',
|
|
32
|
+
NUMBER: 'number',
|
|
22
33
|
};
|
|
23
34
|
const PREFIX_TEXT_OPTIONS = {
|
|
24
35
|
MAX_LENGTH: 10,
|
|
@@ -37,4 +48,4 @@ const DEFAULTS = {
|
|
|
37
48
|
AUTO_COMPLETE: AUTO_COMPLETE.OFF,
|
|
38
49
|
INPUT_TYPE: INPUT_TYPE.TEXT,
|
|
39
50
|
};
|
|
40
|
-
export { TAG_NAME, PREFIX_TEXT_OPTIONS, AUTO_CAPITALIZE, AUTO_COMPLETE, INPUT_TYPE, DEFAULTS };
|
|
51
|
+
export { TAG_NAME, PREFIX_TEXT_OPTIONS, AUTO_CAPITALIZE, AUTO_COMPLETE, INPUT_MODE, INPUT_TYPE, DEFAULTS };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { OverrideEventTarget, TypedCustomEvent, ValueOf } from '../../utils/types';
|
|
2
2
|
import type Input from './input.component';
|
|
3
|
-
import { AUTO_CAPITALIZE, AUTO_COMPLETE, INPUT_TYPE } from './input.constants';
|
|
3
|
+
import { AUTO_CAPITALIZE, AUTO_COMPLETE, INPUT_MODE, INPUT_TYPE } from './input.constants';
|
|
4
4
|
type AutoCapitalizeType = ValueOf<typeof AUTO_CAPITALIZE>;
|
|
5
5
|
type AutoCompleteType = ValueOf<typeof AUTO_COMPLETE>;
|
|
6
|
+
type InputModeType = ValueOf<typeof INPUT_MODE>;
|
|
6
7
|
type InputType = ValueOf<typeof INPUT_TYPE>;
|
|
7
8
|
type InputInputEvent = OverrideEventTarget<InputEvent, Input>;
|
|
8
9
|
type InputChangeEvent = TypedCustomEvent<Input>;
|
|
@@ -18,4 +19,4 @@ interface Events {
|
|
|
18
19
|
onClearEvent: InputClearEvent;
|
|
19
20
|
onLimitExceededEvent: InputLimitExceededEvent;
|
|
20
21
|
}
|
|
21
|
-
export type { AutoCapitalizeType, AutoCompleteType, InputType, InputInputEvent, InputChangeEvent, InputFocusEvent, InputBlurEvent, InputClearEvent, InputLimitExceededEvent, Events, };
|
|
22
|
+
export type { AutoCapitalizeType, AutoCompleteType, InputModeType, InputType, InputInputEvent, InputChangeEvent, InputFocusEvent, InputBlurEvent, InputClearEvent, InputLimitExceededEvent, Events, };
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { CSSResult, PropertyValueMap } from 'lit';
|
|
2
|
+
import Input from '../input/input.component';
|
|
3
|
+
import type { InputModeType, InputType } from '../input/input.types';
|
|
4
|
+
import type { ClampType } from './numberinput.types';
|
|
5
|
+
/**
|
|
6
|
+
* The `mdc-numberinput` lets users enter and adjust a single numeric value,
|
|
7
|
+
* pairing a numeric text field with increment and decrement spinner buttons and
|
|
8
|
+
* native range and step validation. It exists for bounded or precise numeric entry
|
|
9
|
+
* — quantities, prices, durations — where users benefit from both direct typing
|
|
10
|
+
* and small stepwise adjustments.
|
|
11
|
+
*
|
|
12
|
+
* **When to use**
|
|
13
|
+
*
|
|
14
|
+
* - Use `mdc-numberinput` to collect a single numeric value that users may want to
|
|
15
|
+
* fine-tune in small increments, such as a quantity, count, or price.
|
|
16
|
+
* - Use `mdc-numberinput` with `min` and `max` to constrain input to a valid
|
|
17
|
+
* range, and `step` to set the amount each spinner button click or arrow-key
|
|
18
|
+
* press changes the value.
|
|
19
|
+
* - Use `mdc-numberinput` `step="any"` to accept decimal values without
|
|
20
|
+
* step-mismatch validation. For values that must follow a fixed increment, such
|
|
21
|
+
* as currency, set a numeric step like `step="0.01"` instead.
|
|
22
|
+
* - Use `mdc-numberinput` `hide-spinner-buttons` when the field should behave as a
|
|
23
|
+
* plain numeric input without visible spinner controls.
|
|
24
|
+
*
|
|
25
|
+
* **When not to use**
|
|
26
|
+
*
|
|
27
|
+
* - Do not use `mdc-numberinput` for identifiers or formatted values such as phone
|
|
28
|
+
* numbers, PINs, or account codes. Use `mdc-input` — these values are strings
|
|
29
|
+
* rather than quantities, and number-field operations can alter their
|
|
30
|
+
* formatting.
|
|
31
|
+
* - Do not use `mdc-numberinput` to choose from a small fixed set of numeric
|
|
32
|
+
* options. Use `mdc-select` or a group of `mdc-radio` controls.
|
|
33
|
+
* - Do not use `mdc-numberinput` for coarse selection across a large range where
|
|
34
|
+
* an exact value is not important. Use `mdc-slider`.
|
|
35
|
+
* - Do not use `mdc-numberinput` for time entry. Use `mdc-timepicker`.
|
|
36
|
+
*
|
|
37
|
+
* @tagname mdc-numberinput
|
|
38
|
+
*
|
|
39
|
+
* @event input - (React: onInput) This event is dispatched when the value of the number field changes (every press).
|
|
40
|
+
* @event change - (React: onChange) This event is dispatched when the value of the number field changes (on blur).
|
|
41
|
+
* @event focus - (React: onFocus) This event is dispatched when the number field receives focus.
|
|
42
|
+
* @event blur - (React: onBlur) This event is dispatched when the number field loses focus.
|
|
43
|
+
* @event clear - (React: onClear) This event is dispatched when the number field is cleared.
|
|
44
|
+
*
|
|
45
|
+
* @dependency mdc-icon
|
|
46
|
+
* @dependency mdc-text
|
|
47
|
+
* @dependency mdc-button
|
|
48
|
+
* @dependency mdc-toggletip
|
|
49
|
+
*
|
|
50
|
+
* @slot label - Slot for the label element. If not provided, the `label` property will be used to render the label.
|
|
51
|
+
* @slot toggletip - Slot for the toggletip info icon button. If not provided, the `toggletip-text` property will be used to render the info icon button and toggletip.
|
|
52
|
+
* @slot help-icon - Slot for the helper/validation icon. If not provided, the icon will be rendered based on the `helpTextType` property.
|
|
53
|
+
* @slot help-text - Slot for the helper/validation text. If not provided, the `helpText` property will be used to render the helper/validation text.
|
|
54
|
+
* @slot input-leading-icon - Slot for the leading icon before the input field. If not provided, the `leadingIcon` property will be used to render the leading icon.
|
|
55
|
+
* @slot input-prefix-text - Slot for the prefix text before the input field. If not provided, the `prefixText` property will be used to render the prefix text.
|
|
56
|
+
* @slot trailing-button - Slot for the trailing content. If not provided, the increment/decrement spinner buttons are rendered by default; set `hideSpinnerButtons` to true to render the clear button instead (when `trailingButton` is set to true).
|
|
57
|
+
*
|
|
58
|
+
* @csspart input-container - The container that wraps the input field, leading icon, prefix text, and trailing content.
|
|
59
|
+
* @csspart input-section - The container that wraps the input field and prefix text.
|
|
60
|
+
* @csspart input-text - The input field element.
|
|
61
|
+
* @csspart spinner-buttons - The container that wraps the increment and decrement spinner buttons.
|
|
62
|
+
* @csspart spinner-button - Each of the increment/decrement spinner button elements.
|
|
63
|
+
* @csspart label - The label element.
|
|
64
|
+
* @csspart helper-text - The helper/validation text element.
|
|
65
|
+
* @csspart helper-icon - The helper/validation icon element.
|
|
66
|
+
*
|
|
67
|
+
* @cssproperty --mdc-label-font-size - Font size for the label text.
|
|
68
|
+
* @cssproperty --mdc-label-font-weight - Font weight for the label text.
|
|
69
|
+
* @cssproperty --mdc-label-line-height - Line height for the label text.
|
|
70
|
+
* @cssproperty --mdc-label-color - Color for the label text.
|
|
71
|
+
* @cssproperty --mdc-help-text-font-size - Font size for the help text.
|
|
72
|
+
* @cssproperty --mdc-help-text-font-weight - Font weight for the help text.
|
|
73
|
+
* @cssproperty --mdc-help-text-line-height - Line height for the help text.
|
|
74
|
+
* @cssproperty --mdc-help-text-color - Color for the help text.
|
|
75
|
+
* @cssproperty --mdc-required-indicator-color - Color for the required indicator text.
|
|
76
|
+
* @cssproperty --mdc-input-text-color - Text color for the input field
|
|
77
|
+
* @cssproperty --mdc-input-border-color - Border color for the input container
|
|
78
|
+
* @cssproperty --mdc-input-background-color - Background color for the input field
|
|
79
|
+
* @cssproperty --mdc-input-selection-text-color - Text color for the selected text
|
|
80
|
+
* @cssproperty --mdc-input-selection-background-color - Background color for the selected text
|
|
81
|
+
*/
|
|
82
|
+
declare class NumberInput extends Input {
|
|
83
|
+
/**
|
|
84
|
+
* Hints that a numeric virtual keyboard should be displayed.
|
|
85
|
+
* @default 'numeric'
|
|
86
|
+
*/
|
|
87
|
+
inputmode: InputModeType;
|
|
88
|
+
/**
|
|
89
|
+
* The minimum value that the number field will accept.
|
|
90
|
+
*/
|
|
91
|
+
min?: number;
|
|
92
|
+
/**
|
|
93
|
+
* The maximum value that the number field will accept.
|
|
94
|
+
*/
|
|
95
|
+
max?: number;
|
|
96
|
+
/**
|
|
97
|
+
* The amount that the value changes for each increment/decrement, whether from the
|
|
98
|
+
* spinner buttons or the up/down arrow keys. Set to `'any'` to allow any decimal value with no
|
|
99
|
+
* step-mismatch validation.
|
|
100
|
+
* @default 1
|
|
101
|
+
*/
|
|
102
|
+
step: number | 'any';
|
|
103
|
+
/**
|
|
104
|
+
* Increment and decrement spinner buttons are shown alongside the input field by default.
|
|
105
|
+
* Set this to true to hide them.
|
|
106
|
+
* @default false
|
|
107
|
+
*/
|
|
108
|
+
hideSpinnerButtons: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Aria label for the increment spinner button.
|
|
111
|
+
* @default ''
|
|
112
|
+
*/
|
|
113
|
+
incrementAriaLabel: string;
|
|
114
|
+
/**
|
|
115
|
+
* Aria label for the decrement spinner button.
|
|
116
|
+
* @default ''
|
|
117
|
+
*/
|
|
118
|
+
decrementAriaLabel: string;
|
|
119
|
+
/**
|
|
120
|
+
* Controls whether a value typed into the field is clamped to the min/max range. The spinner
|
|
121
|
+
* buttons and arrow keys always clamp; this only affects manual keyboard entry.
|
|
122
|
+
* - `none`: a typed value is left as entered and reported through range validity.
|
|
123
|
+
* - `auto`: a typed value is clamped to the min/max range when the field is committed (on change).
|
|
124
|
+
* @default 'none'
|
|
125
|
+
*/
|
|
126
|
+
clamp: ClampType;
|
|
127
|
+
protected firstUpdated(changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
|
128
|
+
/**
|
|
129
|
+
* Blocks insertion of non-numeric characters, including the `e`/`E`/`+` that native
|
|
130
|
+
* `type="number"` still accepts (and the arbitrary letters Firefox allows). Typed text arrives
|
|
131
|
+
* in `data`; pasted/dropped text arrives in `dataTransfer`. Deletions, caret navigation and IME
|
|
132
|
+
* composition carry neither, so they pass through. The sign (`-`) and decimal point (`.`) are
|
|
133
|
+
* numeric structural characters, so they are allowed and left to native range/step validation.
|
|
134
|
+
*/
|
|
135
|
+
private handleBeforeInput;
|
|
136
|
+
protected updated(changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
|
137
|
+
/**
|
|
138
|
+
* Applies the min/max/step constraints to the native input element.
|
|
139
|
+
* These are not part of the Input template, so they are synced imperatively.
|
|
140
|
+
*/
|
|
141
|
+
private syncNumberConstraints;
|
|
142
|
+
private handleIncrement;
|
|
143
|
+
private handleDecrement;
|
|
144
|
+
/**
|
|
145
|
+
* Native arrow-key stepping with step="any" is browser-inconsistent: Firefox rounds to a whole
|
|
146
|
+
* number (dropping the decimal part) while Chrome/Safari add or subtract 1. Route the arrow keys
|
|
147
|
+
* through the same stepBy() path as the spinner buttons so the decimal part is preserved in every
|
|
148
|
+
* browser. Numeric steps keep native handling, which is already consistent across browsers.
|
|
149
|
+
*/
|
|
150
|
+
protected handleKeyDown(event: KeyboardEvent): void;
|
|
151
|
+
/**
|
|
152
|
+
* With clamp="auto", a committed value typed outside the range is pulled back in before the base
|
|
153
|
+
* change handler syncs and re-dispatches it, so consumers and validity observe the clamped value.
|
|
154
|
+
* When the value is actually clamped an input event is emitted first, mirroring the native
|
|
155
|
+
* input-before-change order, so consumers that collect the value on input see the corrected value.
|
|
156
|
+
* Stepping already clamps, so this only covers manual keyboard entry.
|
|
157
|
+
*/
|
|
158
|
+
protected onChange(event: Event): void;
|
|
159
|
+
/**
|
|
160
|
+
* Clamps the native input's committed value into the min/max range in place, returning whether the
|
|
161
|
+
* value changed. An empty or non-numeric field is left untouched so a cleared input is not forced
|
|
162
|
+
* to min/max.
|
|
163
|
+
*/
|
|
164
|
+
private clampInputToRange;
|
|
165
|
+
/**
|
|
166
|
+
* stepUp()/stepDown() throw for step="any", so in that case the spinner buttons add/subtract 1 and
|
|
167
|
+
* clamp (matching native spin buttons); any value is already step-valid, so no alignment is
|
|
168
|
+
* needed. Otherwise the native step algorithm handles stepping and step-base alignment.
|
|
169
|
+
*/
|
|
170
|
+
private stepBy;
|
|
171
|
+
/**
|
|
172
|
+
* stepUp()/stepDown() and valueAsNumber update the input element's value without dispatching
|
|
173
|
+
* input/change events. Replaying them on the input replays the native flow so the base Input
|
|
174
|
+
* handlers sync the value, form value and validity, then re-dispatch to consumers.
|
|
175
|
+
*/
|
|
176
|
+
private syncValueFromInputElement;
|
|
177
|
+
/**
|
|
178
|
+
* Renders a single increment or decrement spinner button.
|
|
179
|
+
*
|
|
180
|
+
* The buttons are given `tabindex="-1"` so they are not in the tab order, matching native
|
|
181
|
+
* spin buttons: they are redundant pointer affordances for the `ArrowUp`/`ArrowDown` stepping
|
|
182
|
+
* already available from the focused input, so keyboard users reach the same behaviour without
|
|
183
|
+
* two extra tab stops per field.
|
|
184
|
+
*/
|
|
185
|
+
protected renderSpinnerButton(direction: 'increment' | 'decrement'): import("lit-html").TemplateResult<1>;
|
|
186
|
+
/**
|
|
187
|
+
* Renders the decrement/increment spinner buttons in place of the default trailing (clear) button
|
|
188
|
+
*/
|
|
189
|
+
protected renderTrailingButton(show?: boolean): import("lit-html").TemplateResult<1> | typeof import("lit-html").nothing;
|
|
190
|
+
protected renderInputElement(_: InputType, hidePlaceholder?: boolean): import("lit-html").TemplateResult<1>;
|
|
191
|
+
static styles: Array<CSSResult>;
|
|
192
|
+
}
|
|
193
|
+
export default NumberInput;
|