@vonage/vivid 3.58.0 → 3.60.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/appearance-ui/index.cjs +1 -1
- package/appearance-ui/index.js +1 -1
- package/custom-elements.json +866 -68
- package/lib/appearance-ui/appearance-ui.d.ts +1 -1
- package/lib/audio-player/audio-player.d.ts +3 -0
- package/lib/button/button.d.ts +1 -1
- package/lib/combobox/combobox.d.ts +3 -0
- package/lib/combobox/definition.d.ts +1 -1
- package/lib/enums.d.ts +1 -0
- package/lib/number-field/number-field.d.ts +23 -8
- package/lib/number-field/number-field.form-associated.d.ts +10 -0
- package/lib/video-player/video-player.d.ts +1 -0
- package/listbox/index.cjs +1 -1
- package/listbox/index.js +1 -1
- package/package.json +1 -1
- package/shared/definition.cjs +1 -1
- package/shared/definition.js +1 -1
- package/shared/definition11.cjs +1 -1
- package/shared/definition11.js +1 -1
- package/shared/definition16.cjs +11 -2
- package/shared/definition16.js +11 -2
- package/shared/definition20.cjs +13 -13
- package/shared/definition20.js +13 -13
- package/shared/definition29.cjs +1 -0
- package/shared/definition29.js +1 -1
- package/shared/definition3.cjs +1 -1
- package/shared/definition3.js +1 -1
- package/shared/definition31.cjs +1 -1
- package/shared/definition31.js +1 -1
- package/shared/definition32.cjs +1 -1
- package/shared/definition32.js +1 -1
- package/shared/definition35.cjs +242 -331
- package/shared/definition35.js +243 -332
- package/shared/definition38.cjs +1 -1
- package/shared/definition38.js +1 -1
- package/shared/definition42.js +1 -1
- package/shared/definition43.cjs +9 -1
- package/shared/definition43.js +9 -1
- package/shared/definition47.cjs +1 -1
- package/shared/definition47.js +1 -1
- package/shared/definition5.cjs +100 -39
- package/shared/definition5.js +93 -32
- package/shared/definition50.cjs +1 -1
- package/shared/definition50.js +1 -1
- package/shared/definition51.cjs +1 -1
- package/shared/definition51.js +1 -1
- package/shared/definition54.cjs +1 -1
- package/shared/definition54.js +1 -1
- package/shared/definition59.cjs +1 -1
- package/shared/definition59.js +1 -1
- package/shared/definition61.cjs +2 -65859
- package/shared/definition61.js +2 -65859
- package/shared/definition8.cjs +1 -1
- package/shared/definition8.js +1 -1
- package/shared/enums.cjs +1 -0
- package/shared/enums.js +1 -0
- package/shared/key-codes2.js +1 -1
- package/shared/patterns/anchored.d.ts +4 -4
- package/shared/text-field.cjs +1 -1
- package/shared/text-field.js +1 -1
- package/shared/video-player.cjs +65864 -0
- package/shared/video-player.js +65861 -0
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +5 -5
- package/styles/tokens/theme-light.css +5 -5
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/vivid.api.json +89 -1
package/shared/definition35.js
CHANGED
|
@@ -1,318 +1,29 @@
|
|
|
1
|
-
import { F as FoundationElement,
|
|
1
|
+
import { F as FoundationElement, a as attr, D as DOM, n as nullableNumberConverter, o as observable, h as html, r as registerFactory } from './index.js';
|
|
2
2
|
import { B as Button, a as buttonRegistries } from './definition11.js';
|
|
3
3
|
import { D as Divider, a as dividerRegistries } from './definition22.js';
|
|
4
4
|
import { A as AffixIcon } from './affix.js';
|
|
5
5
|
import { e as errorText, f as formElements, F as FormElementSuccessText, a as FormElementHelperText, b as FormElementCharCount, g as getFeedbackTemplate } from './index2.js';
|
|
6
6
|
import { L as Localized } from './localized.js';
|
|
7
7
|
import { a as applyMixinsWithObservables } from './applyMixinsWithObservables.js';
|
|
8
|
-
import { S as StartEnd } from './start-end.js';
|
|
9
|
-
import { a as applyMixins } from './apply-mixins.js';
|
|
10
|
-
import { D as DelegatesARIATextbox } from './text-field2.js';
|
|
11
8
|
import { F as FormAssociated } from './form-associated.js';
|
|
12
|
-
import {
|
|
9
|
+
import { c as keyArrowDown, d as keyArrowUp } from './key-codes2.js';
|
|
10
|
+
import { D as DelegatesARIATextbox } from './text-field2.js';
|
|
13
11
|
import { S as Shape } from './enums.js';
|
|
14
12
|
import { w as when } from './when.js';
|
|
15
13
|
import { r as ref } from './ref.js';
|
|
16
14
|
import { c as classNames } from './class-names.js';
|
|
17
15
|
|
|
16
|
+
const styles = ":host{display:inline-block}.base{--_text-field-gutter-start: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))*.4) ;--_text-field-gutter-end: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))*.4) ;--_text-field-icon-size: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))/2) ;display:inline-grid;width:100%;gap:4px;grid-template-columns:min-content 1fr max-content}.base{--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-intermediate)}.base.appearance-ghost{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-fierce)}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)).appearance-ghost{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base:where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: var(--vvd-color-neutral-300)}.base:where(.disabled,:disabled).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.readonly):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: var(--vvd-color-neutral-400)}.base:where(.readonly):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-600);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.error):where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: var(--vvd-color-alert-500)}.base:where(.error):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: transparent}.base:where(.success):where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: var(--vvd-color-success-500)}.base:where(.success):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: transparent}.base{--_connotation-color-primary: var(--vvd-text-field-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-text-field-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-text-field-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-intermediate: var(--vvd-text-field-accent-intermediate, var(--vvd-color-neutral-500));--_connotation-color-firm: var(--vvd-text-field-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-fierce: var(--vvd-text-field-accent-fierce, var(--vvd-color-neutral-700));--_connotation-color-faint: var(--vvd-text-field-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-text-field-accent-soft, var(--vvd-color-neutral-100))}@supports (user-select: none){.base{user-select:none}}.base:not(.disabled){--_low-ink-color: var(--vvd-color-neutral-600)}.base.disabled{--_low-ink-color: var(--_appearance-color-text)}.label:not(slot),.label::slotted(label){box-sizing:initial!important;padding:initial!important;margin:initial!important;color:var(--vvd-color-canvas-text)!important;contain:inline-size!important;font:var(--vvd-typography-base);grid-column:1/4;grid-row:1}.char-count+.label:not(slot),.char-count+.label::slotted(label){grid-column:1/3}.char-count{color:var(--_low-ink-color);font:var(--vvd-typography-base);grid-column:3/4}.fieldset{position:relative;display:flex;align-items:center;background-color:var(--_appearance-color-fill);font:var(--vvd-typography-base);grid-column:1/4;padding-block:0;transition:color .2s,background-color .2s}.fieldset:after{position:absolute;display:block;border-radius:inherit;block-size:100%;box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);content:\"\";inline-size:100%;pointer-events:none;transition:box-shadow .2s}.fieldset:focus-visible{outline:none}.base>.fieldset{block-size:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2)))}.base:not(.shape-pill) .fieldset{border-radius:8px}.base.shape-pill .fieldset{border-radius:24px}.wrapper{border-radius:inherit;block-size:100%;inline-size:100%}.control{border-radius:inherit;text-align:start}.control:not(slot),.control::slotted(input){width:100%!important;box-sizing:border-box!important;border:0 none!important;border-radius:inherit!important;margin:initial!important;appearance:none!important;background-color:transparent!important;block-size:100%!important;color:inherit!important;font:inherit;outline:transparent;padding-block:0!important;padding-inline:var(--_text-field-gutter-start) var(--_text-field-gutter-end)!important;text-align:inherit}.control:not(slot):disabled,.control::slotted(input:disabled){cursor:not-allowed!important;opacity:1!important;-webkit-text-fill-color:var(--_appearance-color-text)!important}.control:not(slot)::placeholder{opacity:1!important;-webkit-text-fill-color:var(--_low-ink-color)!important}.control::slotted(input:-webkit-autofill),.control:not(slot):-webkit-autofill{-webkit-box-shadow:0 0 0 1000px var(--_appearance-color-fill) inset;-webkit-text-fill-color:var(--_appearance-color-text)!important}.has-icon .control:not(slot),.has-icon .control::slotted(input){padding-inline-start:calc(var(--_text-field-icon-size) + var(--_text-field-gutter-start) * 2)!important}.icon{position:absolute;z-index:1;color:var(--_low-ink-color);font-size:var(--_text-field-icon-size);inset-block-start:50%;inset-inline-start:calc(100% + var(--_text-field-gutter-start));line-height:1;transform:translateY(-50%)}.leading-items-wrapper{position:relative}.base.no-leading .leading-items-wrapper{display:none}.action-items-wrapper{margin-inline-end:4px}.base:not(.action-items) .action-items-wrapper{display:none}@supports selector(:has(*)){.fieldset:has(.wrapper .control:focus-within):after{--focus-stroke-gap-color: transparent;box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px))}}@supports not selector(:has(*)){.wrapper:focus-within:after{box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent;position:absolute;z-index:1;display:block;border-radius:inherit;content:\"\";inset:0;pointer-events:none}}:host([internal-part]) .fieldset{background-color:transparent;font:var(--vvd-typography-heading-4)}:host([internal-part]) .fieldset:not(:focus-within):after{block-size:1px;inset-block-end:0}@supports selector(:has(*)){:host([internal-part]) .fieldset:has(.action-items-wrapper:focus-within):after{block-size:1px;inset-block-end:0}}:host([internal-part]) .control{text-align:center}slot[name=_mirrored-helper-text]{display:none}.base{--_text-field-gutter-end: 70px}.control::-webkit-outer-spin-button,.control::-webkit-inner-spin-button{appearance:none}.control-buttons{position:absolute;z-index:1;right:3px;display:flex}.readonly .control-buttons,.disabled .control-buttons{pointer-events:none}.control-buttons .divider{margin-block:8px}.control-buttons>*{flex-shrink:0}";
|
|
17
|
+
|
|
18
18
|
class _NumberField extends FoundationElement {
|
|
19
19
|
}
|
|
20
|
-
/**
|
|
21
|
-
* A form-associated base class for the {@link @microsoft/fast-foundation#(NumberField:class)} component.
|
|
22
|
-
*
|
|
23
|
-
* @internal
|
|
24
|
-
*/
|
|
25
20
|
class FormAssociatedNumberField extends FormAssociated(_NumberField) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments);
|
|
23
|
+
this.proxy = document.createElement("input");
|
|
24
|
+
}
|
|
30
25
|
}
|
|
31
26
|
|
|
32
|
-
/**
|
|
33
|
-
* A Number Field Custom HTML Element.
|
|
34
|
-
* Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number | <input type="number" /> element }.
|
|
35
|
-
*
|
|
36
|
-
* @slot start - Content which can be provided before the number field input
|
|
37
|
-
* @slot end - Content which can be provided after the number field input
|
|
38
|
-
* @slot - The default slot for the label
|
|
39
|
-
* @slot step-up-glyph - The glyph for the step up control
|
|
40
|
-
* @slot step-down-glyph - The glyph for the step down control
|
|
41
|
-
* @csspart label - The label
|
|
42
|
-
* @csspart root - The element wrapping the control, including start and end slots
|
|
43
|
-
* @csspart control - The element representing the input
|
|
44
|
-
* @csspart controls - The step up and step down controls
|
|
45
|
-
* @csspart step-up - The step up control
|
|
46
|
-
* @csspart step-down - The step down control
|
|
47
|
-
* @fires input - Fires a custom 'input' event when the value has changed
|
|
48
|
-
* @fires change - Fires a custom 'change' event when the value has changed
|
|
49
|
-
*
|
|
50
|
-
* @public
|
|
51
|
-
*/
|
|
52
|
-
let NumberField$1 = class NumberField extends FormAssociatedNumberField {
|
|
53
|
-
constructor() {
|
|
54
|
-
super(...arguments);
|
|
55
|
-
/**
|
|
56
|
-
* When true, spin buttons will not be rendered
|
|
57
|
-
* @public
|
|
58
|
-
* @remarks
|
|
59
|
-
* HTML Attribute: autofocus
|
|
60
|
-
*/
|
|
61
|
-
this.hideStep = false;
|
|
62
|
-
/**
|
|
63
|
-
* Amount to increment or decrement the value by
|
|
64
|
-
* @public
|
|
65
|
-
* @remarks
|
|
66
|
-
* HTMLAttribute: step
|
|
67
|
-
*/
|
|
68
|
-
this.step = 1;
|
|
69
|
-
/**
|
|
70
|
-
* Flag to indicate that the value change is from the user input
|
|
71
|
-
* @internal
|
|
72
|
-
*/
|
|
73
|
-
this.isUserInput = false;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Ensures that the max is greater than the min and that the value
|
|
77
|
-
* is less than the max
|
|
78
|
-
* @param previous - the previous max value
|
|
79
|
-
* @param next - updated max value
|
|
80
|
-
*
|
|
81
|
-
* @internal
|
|
82
|
-
*/
|
|
83
|
-
maxChanged(previous, next) {
|
|
84
|
-
var _a;
|
|
85
|
-
this.max = Math.max(next, (_a = this.min) !== null && _a !== void 0 ? _a : next);
|
|
86
|
-
const min = Math.min(this.min, this.max);
|
|
87
|
-
if (this.min !== undefined && this.min !== min) {
|
|
88
|
-
this.min = min;
|
|
89
|
-
}
|
|
90
|
-
this.value = this.getValidValue(this.value);
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Ensures that the min is less than the max and that the value
|
|
94
|
-
* is greater than the min
|
|
95
|
-
* @param previous - previous min value
|
|
96
|
-
* @param next - updated min value
|
|
97
|
-
*
|
|
98
|
-
* @internal
|
|
99
|
-
*/
|
|
100
|
-
minChanged(previous, next) {
|
|
101
|
-
var _a;
|
|
102
|
-
this.min = Math.min(next, (_a = this.max) !== null && _a !== void 0 ? _a : next);
|
|
103
|
-
const max = Math.max(this.min, this.max);
|
|
104
|
-
if (this.max !== undefined && this.max !== max) {
|
|
105
|
-
this.max = max;
|
|
106
|
-
}
|
|
107
|
-
this.value = this.getValidValue(this.value);
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* The value property, typed as a number.
|
|
111
|
-
*
|
|
112
|
-
* @public
|
|
113
|
-
*/
|
|
114
|
-
get valueAsNumber() {
|
|
115
|
-
return parseFloat(super.value);
|
|
116
|
-
}
|
|
117
|
-
set valueAsNumber(next) {
|
|
118
|
-
this.value = next.toString();
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Validates that the value is a number between the min and max
|
|
122
|
-
* @param previous - previous stored value
|
|
123
|
-
* @param next - value being updated
|
|
124
|
-
* @param updateControl - should the text field be updated with value, defaults to true
|
|
125
|
-
* @internal
|
|
126
|
-
*/
|
|
127
|
-
valueChanged(previous, next) {
|
|
128
|
-
this.value = this.getValidValue(next);
|
|
129
|
-
if (next !== this.value) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
if (this.control && !this.isUserInput) {
|
|
133
|
-
this.control.value = this.value;
|
|
134
|
-
}
|
|
135
|
-
super.valueChanged(previous, this.value);
|
|
136
|
-
if (previous !== undefined && !this.isUserInput) {
|
|
137
|
-
this.$emit("input");
|
|
138
|
-
this.$emit("change");
|
|
139
|
-
}
|
|
140
|
-
this.isUserInput = false;
|
|
141
|
-
}
|
|
142
|
-
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
143
|
-
validate() {
|
|
144
|
-
super.validate(this.control);
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Sets the internal value to a valid number between the min and max properties
|
|
148
|
-
* @param value - user input
|
|
149
|
-
*
|
|
150
|
-
* @internal
|
|
151
|
-
*/
|
|
152
|
-
getValidValue(value) {
|
|
153
|
-
var _a, _b;
|
|
154
|
-
let validValue = parseFloat(parseFloat(value).toPrecision(12));
|
|
155
|
-
if (isNaN(validValue)) {
|
|
156
|
-
validValue = "";
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
validValue = Math.min(validValue, (_a = this.max) !== null && _a !== void 0 ? _a : validValue);
|
|
160
|
-
validValue = Math.max(validValue, (_b = this.min) !== null && _b !== void 0 ? _b : validValue).toString();
|
|
161
|
-
}
|
|
162
|
-
return validValue;
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Increments the value using the step value
|
|
166
|
-
*
|
|
167
|
-
* @public
|
|
168
|
-
*/
|
|
169
|
-
stepUp() {
|
|
170
|
-
const value = parseFloat(this.value);
|
|
171
|
-
const stepUpValue = !isNaN(value)
|
|
172
|
-
? value + this.step
|
|
173
|
-
: this.min > 0
|
|
174
|
-
? this.min
|
|
175
|
-
: this.max < 0
|
|
176
|
-
? this.max
|
|
177
|
-
: !this.min
|
|
178
|
-
? this.step
|
|
179
|
-
: 0;
|
|
180
|
-
this.value = stepUpValue.toString();
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Decrements the value using the step value
|
|
184
|
-
*
|
|
185
|
-
* @public
|
|
186
|
-
*/
|
|
187
|
-
stepDown() {
|
|
188
|
-
const value = parseFloat(this.value);
|
|
189
|
-
const stepDownValue = !isNaN(value)
|
|
190
|
-
? value - this.step
|
|
191
|
-
: this.min > 0
|
|
192
|
-
? this.min
|
|
193
|
-
: this.max < 0
|
|
194
|
-
? this.max
|
|
195
|
-
: !this.min
|
|
196
|
-
? 0 - this.step
|
|
197
|
-
: 0;
|
|
198
|
-
this.value = stepDownValue.toString();
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Sets up the initial state of the number field
|
|
202
|
-
* @internal
|
|
203
|
-
*/
|
|
204
|
-
connectedCallback() {
|
|
205
|
-
super.connectedCallback();
|
|
206
|
-
this.proxy.setAttribute("type", "number");
|
|
207
|
-
this.validate();
|
|
208
|
-
this.control.value = this.value;
|
|
209
|
-
if (this.autofocus) {
|
|
210
|
-
DOM.queueUpdate(() => {
|
|
211
|
-
this.focus();
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Selects all the text in the number field
|
|
217
|
-
*
|
|
218
|
-
* @public
|
|
219
|
-
*/
|
|
220
|
-
select() {
|
|
221
|
-
this.control.select();
|
|
222
|
-
/**
|
|
223
|
-
* The select event does not permeate the shadow DOM boundary.
|
|
224
|
-
* This fn effectively proxies the select event,
|
|
225
|
-
* emitting a `select` event whenever the internal
|
|
226
|
-
* control emits a `select` event
|
|
227
|
-
*/
|
|
228
|
-
this.$emit("select");
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Handles the internal control's `input` event
|
|
232
|
-
* @internal
|
|
233
|
-
*/
|
|
234
|
-
handleTextInput() {
|
|
235
|
-
this.control.value = this.control.value.replace(/[^0-9\-+e.]/g, "");
|
|
236
|
-
this.isUserInput = true;
|
|
237
|
-
this.value = this.control.value;
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Change event handler for inner control.
|
|
241
|
-
* @remarks
|
|
242
|
-
* "Change" events are not `composable` so they will not
|
|
243
|
-
* permeate the shadow DOM boundary. This fn effectively proxies
|
|
244
|
-
* the change event, emitting a `change` event whenever the internal
|
|
245
|
-
* control emits a `change` event
|
|
246
|
-
* @internal
|
|
247
|
-
*/
|
|
248
|
-
handleChange() {
|
|
249
|
-
this.$emit("change");
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Handles the internal control's `keydown` event
|
|
253
|
-
* @internal
|
|
254
|
-
*/
|
|
255
|
-
handleKeyDown(e) {
|
|
256
|
-
const key = e.key;
|
|
257
|
-
switch (key) {
|
|
258
|
-
case keyArrowUp:
|
|
259
|
-
this.stepUp();
|
|
260
|
-
return false;
|
|
261
|
-
case keyArrowDown:
|
|
262
|
-
this.stepDown();
|
|
263
|
-
return false;
|
|
264
|
-
}
|
|
265
|
-
return true;
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* Handles populating the input field with a validated value when
|
|
269
|
-
* leaving the input field.
|
|
270
|
-
* @internal
|
|
271
|
-
*/
|
|
272
|
-
handleBlur() {
|
|
273
|
-
this.control.value = this.value;
|
|
274
|
-
}
|
|
275
|
-
};
|
|
276
|
-
__decorate([
|
|
277
|
-
attr({ attribute: "readonly", mode: "boolean" })
|
|
278
|
-
], NumberField$1.prototype, "readOnly", void 0);
|
|
279
|
-
__decorate([
|
|
280
|
-
attr({ mode: "boolean" })
|
|
281
|
-
], NumberField$1.prototype, "autofocus", void 0);
|
|
282
|
-
__decorate([
|
|
283
|
-
attr({ attribute: "hide-step", mode: "boolean" })
|
|
284
|
-
], NumberField$1.prototype, "hideStep", void 0);
|
|
285
|
-
__decorate([
|
|
286
|
-
attr
|
|
287
|
-
], NumberField$1.prototype, "placeholder", void 0);
|
|
288
|
-
__decorate([
|
|
289
|
-
attr
|
|
290
|
-
], NumberField$1.prototype, "list", void 0);
|
|
291
|
-
__decorate([
|
|
292
|
-
attr({ converter: nullableNumberConverter })
|
|
293
|
-
], NumberField$1.prototype, "maxlength", void 0);
|
|
294
|
-
__decorate([
|
|
295
|
-
attr({ converter: nullableNumberConverter })
|
|
296
|
-
], NumberField$1.prototype, "minlength", void 0);
|
|
297
|
-
__decorate([
|
|
298
|
-
attr({ converter: nullableNumberConverter })
|
|
299
|
-
], NumberField$1.prototype, "size", void 0);
|
|
300
|
-
__decorate([
|
|
301
|
-
attr({ converter: nullableNumberConverter })
|
|
302
|
-
], NumberField$1.prototype, "step", void 0);
|
|
303
|
-
__decorate([
|
|
304
|
-
attr({ converter: nullableNumberConverter })
|
|
305
|
-
], NumberField$1.prototype, "max", void 0);
|
|
306
|
-
__decorate([
|
|
307
|
-
attr({ converter: nullableNumberConverter })
|
|
308
|
-
], NumberField$1.prototype, "min", void 0);
|
|
309
|
-
__decorate([
|
|
310
|
-
observable
|
|
311
|
-
], NumberField$1.prototype, "defaultSlottedNodes", void 0);
|
|
312
|
-
applyMixins(NumberField$1, StartEnd, DelegatesARIATextbox);
|
|
313
|
-
|
|
314
|
-
const styles = ":host{display:inline-block}.base{--_text-field-gutter-start: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))*.4) ;--_text-field-gutter-end: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))*.4) ;--_text-field-icon-size: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))/2) ;display:inline-grid;width:100%;gap:4px;grid-template-columns:min-content 1fr max-content}.base{--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-intermediate)}.base.appearance-ghost{--_appearance-color-text: var(--_connotation-color-primary);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-fierce)}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)).appearance-ghost{--_appearance-color-text: var(--_connotation-color-primary);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base:where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: var(--vvd-color-neutral-300)}.base:where(.disabled,:disabled).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.readonly):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: var(--vvd-color-neutral-400)}.base:where(.readonly):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-600);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.error):where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: var(--vvd-color-alert-500)}.base:where(.error):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: transparent}.base:where(.success):where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: var(--vvd-color-success-500)}.base:where(.success):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: transparent}.base{--_connotation-color-primary: var(--vvd-text-field-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-text-field-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-text-field-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-intermediate: var(--vvd-text-field-accent-intermediate, var(--vvd-color-neutral-500));--_connotation-color-firm: var(--vvd-text-field-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-fierce: var(--vvd-text-field-accent-fierce, var(--vvd-color-neutral-700));--_connotation-color-faint: var(--vvd-text-field-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-text-field-accent-soft, var(--vvd-color-neutral-100))}@supports (user-select: none){.base{user-select:none}}.base:not(.disabled){--_low-ink-color: var(--vvd-color-neutral-600)}.base.disabled{--_low-ink-color: var(--_appearance-color-text)}.label:not(slot),.label::slotted(label){box-sizing:initial!important;padding:initial!important;margin:initial!important;color:var(--vvd-color-canvas-text)!important;contain:inline-size!important;font:var(--vvd-typography-base);grid-column:1/4;grid-row:1}.char-count+.label:not(slot),.char-count+.label::slotted(label){grid-column:1/3}.char-count{color:var(--_low-ink-color);font:var(--vvd-typography-base);grid-column:3/4}.fieldset{position:relative;display:flex;align-items:center;background-color:var(--_appearance-color-fill);font:var(--vvd-typography-base);grid-column:1/4;padding-block:0;transition:color .2s,background-color .2s}.fieldset:after{position:absolute;display:block;border-radius:inherit;block-size:100%;box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);content:\"\";inline-size:100%;pointer-events:none;transition:box-shadow .2s}.fieldset:focus-visible{outline:none}.base>.fieldset{block-size:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2)))}.base:not(.shape-pill) .fieldset{border-radius:8px}.base.shape-pill .fieldset{border-radius:24px}.wrapper{border-radius:inherit;block-size:100%;inline-size:100%}.control{border-radius:inherit;text-align:start}.control:not(slot),.control::slotted(input){width:100%!important;box-sizing:border-box!important;border:0 none!important;border-radius:inherit!important;margin:initial!important;appearance:none!important;background-color:transparent!important;block-size:100%!important;color:inherit!important;font:inherit;outline:transparent;padding-block:0!important;padding-inline:var(--_text-field-gutter-start) var(--_text-field-gutter-end)!important;text-align:inherit}.control:not(slot):disabled,.control::slotted(input:disabled){cursor:not-allowed!important;opacity:1!important;-webkit-text-fill-color:var(--_appearance-color-text)!important}.control:not(slot)::placeholder{opacity:1!important;-webkit-text-fill-color:var(--_low-ink-color)!important}.control::slotted(input:-webkit-autofill),.control:not(slot):-webkit-autofill{-webkit-box-shadow:0 0 0 1000px var(--_appearance-color-fill) inset;-webkit-text-fill-color:var(--_appearance-color-text)!important}.has-icon .control:not(slot),.has-icon .control::slotted(input){padding-inline-start:calc(var(--_text-field-icon-size) + var(--_text-field-gutter-start) * 2)!important}.icon{position:absolute;z-index:1;color:var(--_low-ink-color);font-size:var(--_text-field-icon-size);inset-block-start:50%;inset-inline-start:calc(100% + var(--_text-field-gutter-start));line-height:1;transform:translateY(-50%)}.leading-items-wrapper{position:relative}.base.no-leading .leading-items-wrapper{display:none}.action-items-wrapper{margin-inline-end:4px}.base:not(.action-items) .action-items-wrapper{display:none}@supports selector(:has(*)){.fieldset:has(.wrapper .control:focus-within):after{--focus-stroke-gap-color: transparent;box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px))}}@supports not selector(:has(*)){.wrapper:focus-within:after{box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent;position:absolute;z-index:1;display:block;border-radius:inherit;content:\"\";inset:0;pointer-events:none}}:host([internal-part]) .fieldset{background-color:transparent;font:var(--vvd-typography-heading-4)}:host([internal-part]) .fieldset:not(:focus-within):after{block-size:1px;inset-block-end:0}@supports selector(:has(*)){:host([internal-part]) .fieldset:has(.action-items-wrapper:focus-within):after{block-size:1px;inset-block-end:0}}:host([internal-part]) .control{text-align:center}slot[name=_mirrored-helper-text]{display:none}.base{--_text-field-gutter-end: 70px}.control::-webkit-outer-spin-button,.control::-webkit-inner-spin-button{appearance:none}.control-buttons{position:absolute;z-index:1;right:3px;display:flex}.readonly .control-buttons,.disabled .control-buttons{pointer-events:none}.control-buttons .divider{margin-block:8px}.control-buttons>*{flex-shrink:0}";
|
|
315
|
-
|
|
316
27
|
var __defProp = Object.defineProperty;
|
|
317
28
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
318
29
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -324,6 +35,20 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
324
35
|
__defProp(target, key, result);
|
|
325
36
|
return result;
|
|
326
37
|
};
|
|
38
|
+
var __accessCheck = (obj, member, msg) => {
|
|
39
|
+
if (!member.has(obj))
|
|
40
|
+
throw TypeError("Cannot " + msg);
|
|
41
|
+
};
|
|
42
|
+
var __privateAdd = (obj, member, value) => {
|
|
43
|
+
if (member.has(obj))
|
|
44
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
45
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
46
|
+
};
|
|
47
|
+
var __privateMethod = (obj, member, method) => {
|
|
48
|
+
__accessCheck(obj, member, "access private method");
|
|
49
|
+
return method;
|
|
50
|
+
};
|
|
51
|
+
var _valueToPresentationValue, valueToPresentationValue_fn, _inputToPresentationValue, inputToPresentationValue_fn, _presentationValueToValue, presentationValueToValue_fn;
|
|
327
52
|
const STEP_DIRECTION = {
|
|
328
53
|
up: 1,
|
|
329
54
|
down: -1
|
|
@@ -337,31 +62,239 @@ function makeStep(element, direction) {
|
|
|
337
62
|
const stepUpValue = !isNaN(value) ? value + direction * element.step : element.min > 0 ? element.min : element.max < 0 ? element.max : !element.min ? direction * element.step : 0;
|
|
338
63
|
element.value = Number(stepUpValue.toFixed(12)).toString();
|
|
339
64
|
}
|
|
340
|
-
|
|
65
|
+
const buildNumberPatterns = (decimalSeparator) => {
|
|
66
|
+
const ds = decimalSeparator.source;
|
|
67
|
+
return {
|
|
68
|
+
invalidCharacters: new RegExp(`[^0-9\\-+e${ds}]`, "g"),
|
|
69
|
+
additionalDecimalSeparators: new RegExp(`(?<=${ds}.*)${ds}`, "g"),
|
|
70
|
+
trailingDecimalSeparator: new RegExp(`${ds}$`),
|
|
71
|
+
decimalSeparator
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
const numberPatternsWithPeriod = buildNumberPatterns(/\./);
|
|
75
|
+
const numberPatternsWithComma = buildNumberPatterns(/,/);
|
|
76
|
+
const validNumber = /^-?((\d*\.\d+)|(\d+))$/;
|
|
77
|
+
let NumberField = class extends FormAssociatedNumberField {
|
|
341
78
|
constructor() {
|
|
342
79
|
super(...arguments);
|
|
80
|
+
__privateAdd(this, _valueToPresentationValue);
|
|
81
|
+
__privateAdd(this, _inputToPresentationValue);
|
|
82
|
+
__privateAdd(this, _presentationValueToValue);
|
|
83
|
+
this.readOnly = false;
|
|
84
|
+
this.autofocus = false;
|
|
85
|
+
// eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
|
|
86
|
+
this.step = 1;
|
|
87
|
+
/**
|
|
88
|
+
* Flag to indicate that the value change is from the user input
|
|
89
|
+
* @internal
|
|
90
|
+
*/
|
|
91
|
+
this.isUserInput = false;
|
|
92
|
+
this._presentationValue = "";
|
|
343
93
|
this.incrementButtonAriaLabel = null;
|
|
344
94
|
this.decrementButtonAriaLabel = null;
|
|
345
95
|
}
|
|
346
|
-
stepChanged(
|
|
96
|
+
stepChanged(_, next) {
|
|
347
97
|
this.proxy.setAttribute(
|
|
348
98
|
"step",
|
|
349
99
|
Number.isFinite(next) ? next.toString() : ""
|
|
350
100
|
);
|
|
351
101
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
102
|
+
/**
|
|
103
|
+
* Ensures that the max is greater than the min and that the value
|
|
104
|
+
* is less than the max
|
|
105
|
+
*
|
|
106
|
+
* @internal
|
|
107
|
+
*/
|
|
108
|
+
maxChanged(_, next) {
|
|
109
|
+
this.max = Math.max(next, this.min ?? next);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Ensures that the min is less than the max and that the value
|
|
113
|
+
* is greater than the min
|
|
114
|
+
*
|
|
115
|
+
* @internal
|
|
116
|
+
*/
|
|
117
|
+
minChanged(_, next) {
|
|
118
|
+
this.min = Math.min(next, this.max ?? next);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* The value property, typed as a number.
|
|
122
|
+
*
|
|
123
|
+
* @public
|
|
124
|
+
*/
|
|
125
|
+
get valueAsNumber() {
|
|
126
|
+
return parseFloat(super.value);
|
|
127
|
+
}
|
|
128
|
+
set valueAsNumber(next) {
|
|
129
|
+
this.value = next.toString();
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* @internal
|
|
133
|
+
*/
|
|
134
|
+
valueChanged(previous, next) {
|
|
135
|
+
this.value = validNumber.test(next) ? next : "";
|
|
136
|
+
if (next !== this.value) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
if (this.control && !this.isUserInput) {
|
|
140
|
+
this._presentationValue = __privateMethod(this, _valueToPresentationValue, valueToPresentationValue_fn).call(this, this.value);
|
|
356
141
|
}
|
|
142
|
+
super.valueChanged(previous, this.value);
|
|
143
|
+
if (previous !== void 0 && !this.isUserInput) {
|
|
144
|
+
this.$emit("input");
|
|
145
|
+
this.$emit("change");
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* @internal
|
|
150
|
+
*/
|
|
151
|
+
get _numberPatterns() {
|
|
152
|
+
return this.locale.common.useCommaAsDecimalSeparator ? numberPatternsWithComma : numberPatternsWithPeriod;
|
|
153
|
+
}
|
|
154
|
+
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
155
|
+
validate() {
|
|
156
|
+
super.validate(this.control);
|
|
357
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* Increments the value using the step value
|
|
160
|
+
*
|
|
161
|
+
* @public
|
|
162
|
+
*/
|
|
358
163
|
stepUp() {
|
|
359
164
|
makeStep(this, STEP_DIRECTION.up);
|
|
360
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* Decrements the value using the step value
|
|
168
|
+
*
|
|
169
|
+
* @public
|
|
170
|
+
*/
|
|
361
171
|
stepDown() {
|
|
362
172
|
makeStep(this, STEP_DIRECTION.down);
|
|
363
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Sets up the initial state of the number field
|
|
176
|
+
* @internal
|
|
177
|
+
*/
|
|
178
|
+
connectedCallback() {
|
|
179
|
+
super.connectedCallback();
|
|
180
|
+
this.proxy.setAttribute("type", "number");
|
|
181
|
+
this.validate();
|
|
182
|
+
this._presentationValue = __privateMethod(this, _valueToPresentationValue, valueToPresentationValue_fn).call(this, this.value);
|
|
183
|
+
if (this.autofocus) {
|
|
184
|
+
DOM.queueUpdate(() => {
|
|
185
|
+
this.focus();
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Selects all the text in the number field
|
|
191
|
+
*
|
|
192
|
+
* @public
|
|
193
|
+
*/
|
|
194
|
+
select() {
|
|
195
|
+
this.control.select();
|
|
196
|
+
this.$emit("select");
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Handles the internal control's `input` event
|
|
200
|
+
* @internal
|
|
201
|
+
*/
|
|
202
|
+
handleTextInput() {
|
|
203
|
+
this._presentationValue = __privateMethod(this, _inputToPresentationValue, inputToPresentationValue_fn).call(this, this.control.value);
|
|
204
|
+
if (this.control.value !== this._presentationValue) {
|
|
205
|
+
this.control.value = this._presentationValue;
|
|
206
|
+
}
|
|
207
|
+
this.isUserInput = true;
|
|
208
|
+
this.value = __privateMethod(this, _presentationValueToValue, presentationValueToValue_fn).call(this, this._presentationValue);
|
|
209
|
+
this.isUserInput = false;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Change event handler for inner control.
|
|
213
|
+
* @remarks
|
|
214
|
+
* "Change" events are not `composable` so they will not
|
|
215
|
+
* permeate the shadow DOM boundary. This fn effectively proxies
|
|
216
|
+
* the change event, emitting a `change` event whenever the internal
|
|
217
|
+
* control emits a `change` event
|
|
218
|
+
* @internal
|
|
219
|
+
*/
|
|
220
|
+
handleChange() {
|
|
221
|
+
this.$emit("change");
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Handles the internal control's `keydown` event
|
|
225
|
+
* @internal
|
|
226
|
+
*/
|
|
227
|
+
handleKeyDown(e) {
|
|
228
|
+
const key = e.key;
|
|
229
|
+
switch (key) {
|
|
230
|
+
case keyArrowUp:
|
|
231
|
+
this.stepUp();
|
|
232
|
+
return false;
|
|
233
|
+
case keyArrowDown:
|
|
234
|
+
this.stepDown();
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
return true;
|
|
238
|
+
}
|
|
239
|
+
attributeChangedCallback(name, previous, next) {
|
|
240
|
+
super.attributeChangedCallback(name, previous, next);
|
|
241
|
+
if (PROXY_REFLECTED_ATTRIBUTES[name]) {
|
|
242
|
+
this.proxy.setAttribute(name, next);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
_valueToPresentationValue = new WeakSet();
|
|
247
|
+
valueToPresentationValue_fn = function(value) {
|
|
248
|
+
return value.replace(
|
|
249
|
+
".",
|
|
250
|
+
this.locale.common.useCommaAsDecimalSeparator ? "," : "."
|
|
251
|
+
);
|
|
364
252
|
};
|
|
253
|
+
_inputToPresentationValue = new WeakSet();
|
|
254
|
+
inputToPresentationValue_fn = function(input) {
|
|
255
|
+
return input.replace(this._numberPatterns.invalidCharacters, "").replace(this._numberPatterns.additionalDecimalSeparators, "");
|
|
256
|
+
};
|
|
257
|
+
_presentationValueToValue = new WeakSet();
|
|
258
|
+
presentationValueToValue_fn = function(presentationValue) {
|
|
259
|
+
const candidate = presentationValue.replace(this._numberPatterns.trailingDecimalSeparator, "").replace(this._numberPatterns.decimalSeparator, ".");
|
|
260
|
+
return validNumber.test(candidate) ? candidate : "";
|
|
261
|
+
};
|
|
262
|
+
__decorateClass([
|
|
263
|
+
attr({ attribute: "readonly", mode: "boolean" })
|
|
264
|
+
], NumberField.prototype, "readOnly", 2);
|
|
265
|
+
__decorateClass([
|
|
266
|
+
attr({ mode: "boolean" })
|
|
267
|
+
], NumberField.prototype, "autofocus", 2);
|
|
268
|
+
__decorateClass([
|
|
269
|
+
attr
|
|
270
|
+
], NumberField.prototype, "placeholder", 2);
|
|
271
|
+
__decorateClass([
|
|
272
|
+
attr
|
|
273
|
+
], NumberField.prototype, "list", 2);
|
|
274
|
+
__decorateClass([
|
|
275
|
+
attr({ converter: nullableNumberConverter })
|
|
276
|
+
], NumberField.prototype, "maxlength", 2);
|
|
277
|
+
__decorateClass([
|
|
278
|
+
attr({ converter: nullableNumberConverter })
|
|
279
|
+
], NumberField.prototype, "minlength", 2);
|
|
280
|
+
__decorateClass([
|
|
281
|
+
attr({ converter: nullableNumberConverter })
|
|
282
|
+
], NumberField.prototype, "size", 2);
|
|
283
|
+
__decorateClass([
|
|
284
|
+
attr({ converter: nullableNumberConverter })
|
|
285
|
+
], NumberField.prototype, "step", 2);
|
|
286
|
+
__decorateClass([
|
|
287
|
+
attr({ converter: nullableNumberConverter })
|
|
288
|
+
], NumberField.prototype, "max", 2);
|
|
289
|
+
__decorateClass([
|
|
290
|
+
attr({ converter: nullableNumberConverter })
|
|
291
|
+
], NumberField.prototype, "min", 2);
|
|
292
|
+
__decorateClass([
|
|
293
|
+
observable
|
|
294
|
+
], NumberField.prototype, "defaultSlottedNodes", 2);
|
|
295
|
+
__decorateClass([
|
|
296
|
+
observable
|
|
297
|
+
], NumberField.prototype, "_presentationValue", 2);
|
|
365
298
|
__decorateClass([
|
|
366
299
|
attr({ attribute: "increment-button-aria-label" })
|
|
367
300
|
], NumberField.prototype, "incrementButtonAriaLabel", 2);
|
|
@@ -381,36 +314,14 @@ NumberField = __decorateClass([
|
|
|
381
314
|
errorText,
|
|
382
315
|
formElements
|
|
383
316
|
], NumberField);
|
|
384
|
-
const numberInput = document.createElement("input");
|
|
385
|
-
numberInput.type = "number";
|
|
386
|
-
NumberField.prototype.getValidValue = function(value) {
|
|
387
|
-
if (!this.isUserInput) {
|
|
388
|
-
numberInput.value = value;
|
|
389
|
-
return numberInput.value;
|
|
390
|
-
}
|
|
391
|
-
if (value === "" || value === "-" || value === ".") {
|
|
392
|
-
return value;
|
|
393
|
-
}
|
|
394
|
-
const decimalSplit = value.split(".");
|
|
395
|
-
let valueSuffix = "";
|
|
396
|
-
if (decimalSplit.length === 2 && decimalSplit[1] === "") {
|
|
397
|
-
valueSuffix = ".";
|
|
398
|
-
numberInput.value = value.slice(0, -1);
|
|
399
|
-
} else {
|
|
400
|
-
numberInput.value = value;
|
|
401
|
-
}
|
|
402
|
-
if (numberInput.value === "") {
|
|
403
|
-
return this.currentValue;
|
|
404
|
-
}
|
|
405
|
-
return numberInput.value + valueSuffix;
|
|
406
|
-
};
|
|
407
317
|
applyMixinsWithObservables(
|
|
408
318
|
NumberField,
|
|
409
319
|
Localized,
|
|
410
320
|
AffixIcon,
|
|
411
321
|
FormElementCharCount,
|
|
412
322
|
FormElementHelperText,
|
|
413
|
-
FormElementSuccessText
|
|
323
|
+
FormElementSuccessText,
|
|
324
|
+
DelegatesARIATextbox
|
|
414
325
|
);
|
|
415
326
|
|
|
416
327
|
const getStateClasses = ({
|
|
@@ -452,6 +363,7 @@ function numberControlButtons(context) {
|
|
|
452
363
|
<div class="control-buttons"
|
|
453
364
|
?inert="${(x) => x.disabled || x.readOnly}">
|
|
454
365
|
<${buttonTag} id="subtract" icon="minus-line"
|
|
366
|
+
?disabled="${(x) => x.disabled || x.readOnly}"
|
|
455
367
|
aria-label=${(x) => x.decrementButtonAriaLabel || x.locale.numberField.decrementButtonLabel}
|
|
456
368
|
shape="${setControlButtonShape}"
|
|
457
369
|
type="button"
|
|
@@ -460,6 +372,7 @@ function numberControlButtons(context) {
|
|
|
460
372
|
@click="${(x) => x.stepDown()}"></${buttonTag}>
|
|
461
373
|
<${dividerTag} class="divider" orientation="vertical"></${dividerTag}>
|
|
462
374
|
<${buttonTag} id="add" icon="plus-line"
|
|
375
|
+
?disabled="${(x) => x.disabled || x.readOnly}"
|
|
463
376
|
aria-label=${(x) => x.incrementButtonAriaLabel || x.locale.numberField.incrementButtonLabel}
|
|
464
377
|
shape="${setControlButtonShape}"
|
|
465
378
|
type="button"
|
|
@@ -480,12 +393,10 @@ const NumberFieldTemplate = (context) => {
|
|
|
480
393
|
id="control"
|
|
481
394
|
@input="${(x) => x.handleTextInput()}"
|
|
482
395
|
@change="${(x) => x.handleChange()}"
|
|
396
|
+
@keydown="${(x, c) => x.handleKeyDown(c.event)}"
|
|
483
397
|
?autofocus="${(x) => x.autofocus}"
|
|
484
398
|
?disabled="${(x) => x.disabled}"
|
|
485
399
|
list="${(x) => x.list}"
|
|
486
|
-
step="${(x) => x.step ? x.step : null}"
|
|
487
|
-
max="${(x) => x.max}"
|
|
488
|
-
min="${(x) => x.min}"
|
|
489
400
|
maxlength="${(x) => x.maxlength}"
|
|
490
401
|
minlength="${(x) => x.minlength}"
|
|
491
402
|
placeholder="${(x) => x.placeholder}"
|
|
@@ -495,7 +406,7 @@ const NumberFieldTemplate = (context) => {
|
|
|
495
406
|
autocomplete="${(x) => x.autoComplete}"
|
|
496
407
|
name="${(x) => x.name}"
|
|
497
408
|
?spellcheck="${(x) => x.spellcheck}"
|
|
498
|
-
:value="${(x) => x.
|
|
409
|
+
:value="${(x) => x._presentationValue}"
|
|
499
410
|
type="text"
|
|
500
411
|
aria-atomic="${(x) => x.ariaAtomic}"
|
|
501
412
|
aria-busy="${(x) => x.ariaBusy}"
|