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