@vonage/vivid 3.52.0 → 3.54.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/README.md +1 -1
- package/accordion/index.cjs +1 -1
- package/accordion/index.js +1 -1
- package/accordion-item/index.cjs +1 -1
- package/accordion-item/index.js +1 -1
- package/alert/index.cjs +3 -3
- package/alert/index.js +3 -3
- package/appearance-ui/index.cjs +1 -1
- package/appearance-ui/index.js +1 -1
- package/audio-player/index.cjs +3 -3
- package/audio-player/index.js +3 -3
- package/avatar/index.cjs +1 -1
- package/avatar/index.js +1 -1
- package/badge/index.cjs +1 -1
- package/badge/index.js +1 -1
- package/banner/index.cjs +2 -2
- package/banner/index.js +2 -2
- package/breadcrumb-item/index.cjs +1 -1
- package/breadcrumb-item/index.js +1 -1
- package/button/index.cjs +2 -2
- package/button/index.js +2 -2
- package/card/index.cjs +2 -2
- package/card/index.js +2 -2
- package/checkbox/index.cjs +3 -2
- package/checkbox/index.js +3 -2
- package/combobox/index.cjs +5 -5
- package/combobox/index.js +5 -5
- package/custom-elements.json +1162 -99
- package/data-grid/index.cjs +1 -1
- package/data-grid/index.js +1 -1
- package/date-picker/index.cjs +7 -6
- package/date-picker/index.js +7 -6
- package/date-range-picker/index.cjs +7 -6
- package/date-range-picker/index.js +7 -6
- package/dial-pad/index.cjs +33 -0
- package/dial-pad/index.js +31 -0
- package/dialog/index.cjs +4 -4
- package/dialog/index.js +4 -4
- package/divider/index.cjs +1 -1
- package/divider/index.js +1 -1
- package/elevation/index.cjs +1 -1
- package/elevation/index.js +1 -1
- package/empty-state/index.cjs +2 -2
- package/empty-state/index.js +2 -2
- package/fab/index.cjs +2 -2
- package/fab/index.js +2 -2
- package/file-picker/index.cjs +4 -3
- package/file-picker/index.js +4 -3
- package/header/index.cjs +2 -2
- package/header/index.js +2 -2
- package/icon/index.cjs +1 -1
- package/icon/index.js +1 -1
- package/index.cjs +132 -122
- package/index.js +46 -43
- package/layout/index.cjs +1 -1
- package/layout/index.js +1 -1
- package/lib/appearance-ui/appearance-ui.d.ts +1 -1
- package/lib/audio-player/audio-player.d.ts +4 -0
- package/lib/audio-player/locale.d.ts +2 -0
- package/lib/components.d.ts +2 -0
- package/lib/dial-pad/definition.d.ts +3 -0
- package/lib/dial-pad/dial-pad.d.ts +17 -0
- package/lib/dial-pad/dial-pad.template.d.ts +4 -0
- package/lib/dial-pad/locale.d.ts +18 -0
- package/lib/enums.d.ts +7 -0
- package/lib/menu/menu.d.ts +1 -0
- package/lib/nav-disclosure/nav-disclosure.d.ts +5 -0
- package/lib/text-anchor/definition.d.ts +1 -0
- package/lib/text-anchor/text-anchor.d.ts +5 -0
- package/lib/video-player/definition.d.ts +3 -0
- package/lib/video-player/locale.d.ts +1 -0
- package/lib/video-player/video-player.d.ts +17 -0
- package/lib/video-player/video-player.template.d.ts +4 -0
- package/lib/video-player/vivid-video-svg.d.ts +1 -0
- package/listbox/index.cjs +2 -2
- package/listbox/index.js +2 -2
- package/locales/en-GB.cjs +33 -1
- package/locales/en-GB.js +33 -1
- package/locales/en-US.cjs +201 -1
- package/locales/en-US.js +201 -1
- package/locales/ja-JP.cjs +200 -1
- package/locales/ja-JP.js +200 -1
- package/locales/zh-CN.cjs +202 -1
- package/locales/zh-CN.js +202 -1
- package/menu/index.cjs +6 -6
- package/menu/index.js +6 -6
- package/menu-item/index.cjs +2 -2
- package/menu-item/index.js +2 -2
- package/nav/index.cjs +1 -1
- package/nav/index.js +1 -1
- package/nav-disclosure/index.cjs +2 -2
- package/nav-disclosure/index.js +2 -2
- package/nav-item/index.cjs +2 -2
- package/nav-item/index.js +2 -2
- package/note/index.cjs +2 -2
- package/note/index.js +2 -2
- package/number-field/index.cjs +5 -4
- package/number-field/index.js +5 -4
- package/option/index.cjs +2 -2
- package/option/index.js +2 -2
- package/package.json +1 -1
- package/pagination/index.cjs +3 -3
- package/pagination/index.js +3 -3
- package/popup/index.cjs +4 -4
- package/popup/index.js +4 -4
- package/progress/index.cjs +1 -1
- package/progress/index.js +1 -1
- package/progress-ring/index.cjs +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/index.cjs +1 -1
- package/radio/index.js +1 -1
- package/radio-group/index.cjs +1 -1
- package/radio-group/index.js +1 -1
- package/range-slider/index.cjs +2 -2
- package/range-slider/index.js +2 -2
- package/select/index.cjs +7 -6
- package/select/index.js +7 -6
- package/selectable-box/index.cjs +5 -4
- package/selectable-box/index.js +5 -4
- package/shared/applyMixinsWithObservables.cjs +15 -0
- package/shared/applyMixinsWithObservables.js +13 -0
- package/shared/definition.cjs +1 -1
- package/shared/definition.js +1 -1
- package/shared/definition11.cjs +3 -3
- package/shared/definition11.js +3 -3
- package/shared/definition14.cjs +2 -2
- package/shared/definition14.js +2 -2
- package/shared/definition15.cjs +8 -9
- package/shared/definition15.js +8 -9
- package/shared/definition16.cjs +3 -3
- package/shared/definition16.js +3 -3
- package/shared/definition17.cjs +2 -2
- package/shared/definition17.js +3 -3
- package/shared/definition18.cjs +3 -3
- package/shared/definition18.js +3 -3
- package/shared/definition19.cjs +3 -3
- package/shared/definition19.js +3 -3
- package/shared/definition20.cjs +196 -224
- package/shared/definition20.js +191 -219
- package/shared/definition21.cjs +264 -67
- package/shared/definition21.js +263 -65
- package/shared/definition22.cjs +66 -57
- package/shared/definition22.js +64 -56
- package/shared/definition23.cjs +42 -76
- package/shared/definition23.js +41 -75
- package/shared/definition24.cjs +70 -2402
- package/shared/definition24.js +69 -2401
- package/shared/definition25.cjs +2402 -46
- package/shared/definition25.js +2401 -45
- package/shared/definition26.cjs +63 -30
- package/shared/definition26.js +62 -29
- package/shared/definition27.cjs +28 -56
- package/shared/definition27.js +27 -55
- package/shared/definition28.cjs +35 -881
- package/shared/definition28.js +34 -879
- package/shared/definition29.cjs +922 -60
- package/shared/definition29.js +922 -61
- package/shared/definition30.cjs +68 -86
- package/shared/definition30.js +67 -85
- package/shared/definition31.cjs +98 -21
- package/shared/definition31.js +98 -21
- package/shared/definition32.cjs +24 -12
- package/shared/definition32.js +23 -11
- package/shared/definition33.cjs +11 -50
- package/shared/definition33.js +10 -49
- package/shared/definition34.cjs +26 -515
- package/shared/definition34.js +26 -515
- package/shared/definition35.cjs +448 -194
- package/shared/definition35.js +448 -192
- package/shared/definition36.cjs +256 -202
- package/shared/definition36.js +253 -201
- package/shared/definition37.cjs +204 -65
- package/shared/definition37.js +203 -63
- package/shared/definition38.cjs +63 -57
- package/shared/definition38.js +60 -55
- package/shared/definition39.cjs +65 -432
- package/shared/definition39.js +64 -431
- package/shared/definition4.cjs +2 -2
- package/shared/definition4.js +2 -2
- package/shared/definition40.cjs +441 -34
- package/shared/definition40.js +438 -31
- package/shared/definition41.cjs +34 -576
- package/shared/definition41.js +33 -575
- package/shared/definition42.cjs +531 -654
- package/shared/definition42.js +531 -654
- package/shared/definition43.cjs +690 -114
- package/shared/definition43.js +689 -113
- package/shared/definition44.cjs +124 -79
- package/shared/definition44.js +122 -77
- package/shared/definition45.cjs +78 -520
- package/shared/definition45.js +77 -518
- package/shared/definition46.cjs +520 -119
- package/shared/definition46.js +518 -118
- package/shared/definition47.cjs +118 -135
- package/shared/definition47.js +117 -134
- package/shared/definition48.cjs +151 -19
- package/shared/definition48.js +150 -18
- package/shared/definition49.cjs +21 -84
- package/shared/definition49.js +20 -83
- package/shared/definition5.cjs +100 -19
- package/shared/definition5.js +100 -19
- package/shared/definition50.cjs +52 -505
- package/shared/definition50.js +51 -504
- package/shared/definition51.cjs +526 -28
- package/shared/definition51.js +525 -27
- package/shared/definition52.cjs +28 -123
- package/shared/definition52.js +26 -122
- package/shared/definition53.cjs +110 -309
- package/shared/definition53.js +110 -308
- package/shared/definition54.cjs +255 -271
- package/shared/definition54.js +255 -271
- package/shared/definition55.cjs +315 -776
- package/shared/definition55.js +314 -775
- package/shared/definition56.cjs +818 -107
- package/shared/definition56.js +817 -106
- package/shared/definition57.cjs +85 -55
- package/shared/definition57.js +84 -54
- package/shared/definition58.cjs +125 -72
- package/shared/definition58.js +124 -71
- package/shared/definition59.cjs +72 -285
- package/shared/definition59.js +73 -286
- package/shared/definition6.cjs +1 -1
- package/shared/definition6.js +1 -1
- package/shared/definition60.cjs +298 -39
- package/shared/definition60.js +297 -38
- package/shared/definition61.cjs +66044 -1687
- package/shared/definition61.js +66043 -1686
- package/shared/definition62.cjs +50 -0
- package/shared/definition62.js +46 -0
- package/shared/definition63.cjs +1828 -0
- package/shared/definition63.js +1824 -0
- package/shared/definition7.cjs +2 -2
- package/shared/definition7.js +2 -2
- package/shared/definition8.cjs +2 -2
- package/shared/definition8.js +2 -2
- package/shared/definition9.cjs +1 -1
- package/shared/definition9.js +1 -1
- package/shared/enums.cjs +9 -0
- package/shared/enums.js +9 -1
- package/shared/icon.cjs +20 -2
- package/shared/icon.js +21 -3
- package/shared/index2.cjs +73 -37
- package/shared/index2.js +73 -37
- package/shared/key-codes2.js +1 -1
- package/shared/listbox.cjs +1 -1
- package/shared/listbox.js +1 -1
- package/shared/localization/Locale.d.ts +4 -0
- package/shared/patterns/form-elements/form-elements.d.ts +2 -3
- package/shared/presentationDate.cjs +16 -5
- package/shared/presentationDate.js +16 -5
- package/shared/text-anchor.cjs +6 -0
- package/shared/text-anchor.js +6 -0
- package/shared/text-anchor.template.cjs +6 -1
- package/shared/text-anchor.template.js +6 -1
- package/shared/text-field.cjs +1 -1
- package/shared/text-field.js +1 -1
- package/shared/utils/applyMixinsWithObservables.d.ts +1 -0
- package/shared/utils/numberConverter.d.ts +2 -0
- package/side-drawer/index.cjs +1 -1
- package/side-drawer/index.js +1 -1
- package/slider/index.cjs +1 -1
- package/slider/index.js +1 -1
- package/split-button/index.cjs +2 -2
- package/split-button/index.js +2 -2
- 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 +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/switch/index.cjs +2 -2
- package/switch/index.js +2 -2
- package/tab/index.cjs +2 -2
- package/tab/index.js +2 -2
- package/tab-panel/index.cjs +1 -1
- package/tab-panel/index.js +1 -1
- package/tabs/index.cjs +4 -4
- package/tabs/index.js +4 -4
- package/tag/index.cjs +2 -2
- package/tag/index.js +2 -2
- package/tag-group/index.cjs +1 -1
- package/tag-group/index.js +1 -1
- package/text-area/index.cjs +4 -3
- package/text-area/index.js +4 -3
- package/text-field/index.cjs +4 -3
- package/text-field/index.js +4 -3
- package/time-picker/index.cjs +8 -7
- package/time-picker/index.js +8 -7
- package/toggletip/index.cjs +5 -5
- package/toggletip/index.js +5 -5
- package/tooltip/index.cjs +5 -5
- package/tooltip/index.js +5 -5
- package/tree-item/index.cjs +2 -2
- package/tree-item/index.js +2 -2
- package/tree-view/index.cjs +1 -1
- package/tree-view/index.js +1 -1
- package/video-player/index.cjs +17 -0
- package/video-player/index.js +15 -0
- package/vivid.api.json +332 -0
package/shared/definition35.cjs
CHANGED
|
@@ -1,208 +1,319 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const index = require('./index.cjs');
|
|
4
|
-
const definition = require('./
|
|
4
|
+
const definition = require('./definition11.cjs');
|
|
5
|
+
const definition$1 = require('./definition22.cjs');
|
|
5
6
|
const affix = require('./affix.cjs');
|
|
6
|
-
const
|
|
7
|
+
const index$1 = require('./index2.cjs');
|
|
8
|
+
const localized = require('./localized.cjs');
|
|
9
|
+
const applyMixinsWithObservables = require('./applyMixinsWithObservables.cjs');
|
|
7
10
|
const startEnd = require('./start-end.cjs');
|
|
8
11
|
const applyMixins = require('./apply-mixins.cjs');
|
|
9
|
-
const
|
|
12
|
+
const textField = require('./text-field2.cjs');
|
|
13
|
+
const formAssociated = require('./form-associated.cjs');
|
|
14
|
+
const keyCodes = require('./key-codes.cjs');
|
|
15
|
+
const enums = require('./enums.cjs');
|
|
10
16
|
const when = require('./when.cjs');
|
|
17
|
+
const ref = require('./ref.cjs');
|
|
11
18
|
const classNames = require('./class-names.cjs');
|
|
12
19
|
|
|
20
|
+
class _NumberField extends index.FoundationElement {
|
|
21
|
+
}
|
|
13
22
|
/**
|
|
14
|
-
*
|
|
23
|
+
* A form-associated base class for the {@link @microsoft/fast-foundation#(NumberField:class)} component.
|
|
15
24
|
*
|
|
16
|
-
* @
|
|
17
|
-
* @public
|
|
25
|
+
* @internal
|
|
18
26
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
(
|
|
22
|
-
|
|
27
|
+
class FormAssociatedNumberField extends formAssociated.FormAssociated(_NumberField) {
|
|
28
|
+
constructor() {
|
|
29
|
+
super(...arguments);
|
|
30
|
+
this.proxy = document.createElement("input");
|
|
31
|
+
}
|
|
23
32
|
}
|
|
33
|
+
|
|
24
34
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
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 }.
|
|
27
37
|
*
|
|
28
|
-
* @slot start - Content which can be provided before the
|
|
29
|
-
* @slot end - Content which can be provided after the
|
|
30
|
-
* @slot - The default slot for
|
|
31
|
-
* @
|
|
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
|
|
32
51
|
*
|
|
33
52
|
* @public
|
|
34
53
|
*/
|
|
35
|
-
let
|
|
36
|
-
constructor(
|
|
37
|
-
super();
|
|
54
|
+
let NumberField$1 = class NumberField extends FormAssociatedNumberField {
|
|
55
|
+
constructor() {
|
|
56
|
+
super(...arguments);
|
|
38
57
|
/**
|
|
39
|
-
*
|
|
58
|
+
* When true, spin buttons will not be rendered
|
|
40
59
|
* @public
|
|
60
|
+
* @remarks
|
|
61
|
+
* HTML Attribute: autofocus
|
|
41
62
|
*/
|
|
42
|
-
this.
|
|
43
|
-
/**
|
|
44
|
-
* Tracks whether the "selected" property has been changed.
|
|
45
|
-
* @internal
|
|
46
|
-
*/
|
|
47
|
-
this.dirtySelected = false;
|
|
63
|
+
this.hideStep = false;
|
|
48
64
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
65
|
+
* Amount to increment or decrement the value by
|
|
51
66
|
* @public
|
|
67
|
+
* @remarks
|
|
68
|
+
* HTMLAttribute: step
|
|
52
69
|
*/
|
|
53
|
-
this.
|
|
70
|
+
this.step = 1;
|
|
54
71
|
/**
|
|
55
|
-
*
|
|
72
|
+
* Flag to indicate that the value change is from the user input
|
|
73
|
+
* @internal
|
|
56
74
|
*/
|
|
57
|
-
this.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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;
|
|
69
91
|
}
|
|
70
|
-
this.
|
|
71
|
-
this.proxy.disabled = this.disabled;
|
|
92
|
+
this.value = this.getValidValue(this.value);
|
|
72
93
|
}
|
|
73
94
|
/**
|
|
74
|
-
*
|
|
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
|
|
75
99
|
*
|
|
76
|
-
* @
|
|
77
|
-
|
|
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.
|
|
78
113
|
*
|
|
79
114
|
* @public
|
|
80
115
|
*/
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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) {
|
|
84
132
|
return;
|
|
85
133
|
}
|
|
86
|
-
this.
|
|
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);
|
|
87
147
|
}
|
|
88
148
|
/**
|
|
89
|
-
*
|
|
90
|
-
* @param
|
|
91
|
-
* @param next - the current content value
|
|
149
|
+
* Sets the internal value to a valid number between the min and max properties
|
|
150
|
+
* @param value - user input
|
|
92
151
|
*
|
|
93
152
|
* @internal
|
|
94
153
|
*/
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
154
|
+
getValidValue(value) {
|
|
155
|
+
var _a, _b;
|
|
156
|
+
let validValue = parseFloat(parseFloat(value).toPrecision(12));
|
|
157
|
+
if (isNaN(validValue)) {
|
|
158
|
+
validValue = "";
|
|
98
159
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
if (!this.dirtySelected) {
|
|
103
|
-
this.selected = this.defaultSelected;
|
|
104
|
-
if (this.proxy instanceof HTMLOptionElement) {
|
|
105
|
-
this.proxy.selected = this.defaultSelected;
|
|
106
|
-
}
|
|
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();
|
|
107
163
|
}
|
|
164
|
+
return validValue;
|
|
108
165
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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();
|
|
114
183
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
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();
|
|
120
201
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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
|
+
});
|
|
128
215
|
}
|
|
129
216
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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");
|
|
137
231
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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;
|
|
141
240
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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");
|
|
145
252
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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;
|
|
152
266
|
}
|
|
153
|
-
|
|
267
|
+
return true;
|
|
154
268
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
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;
|
|
162
276
|
}
|
|
163
277
|
};
|
|
164
278
|
index.__decorate([
|
|
165
|
-
index.
|
|
166
|
-
],
|
|
279
|
+
index.attr({ attribute: "readonly", mode: "boolean" })
|
|
280
|
+
], NumberField$1.prototype, "readOnly", void 0);
|
|
167
281
|
index.__decorate([
|
|
168
|
-
index.
|
|
169
|
-
],
|
|
282
|
+
index.attr({ mode: "boolean" })
|
|
283
|
+
], NumberField$1.prototype, "autofocus", void 0);
|
|
170
284
|
index.__decorate([
|
|
171
|
-
index.
|
|
172
|
-
],
|
|
285
|
+
index.attr({ attribute: "hide-step", mode: "boolean" })
|
|
286
|
+
], NumberField$1.prototype, "hideStep", void 0);
|
|
173
287
|
index.__decorate([
|
|
174
|
-
index.attr
|
|
175
|
-
],
|
|
288
|
+
index.attr
|
|
289
|
+
], NumberField$1.prototype, "placeholder", void 0);
|
|
176
290
|
index.__decorate([
|
|
177
|
-
index.attr
|
|
178
|
-
],
|
|
291
|
+
index.attr
|
|
292
|
+
], NumberField$1.prototype, "list", void 0);
|
|
179
293
|
index.__decorate([
|
|
180
|
-
index.
|
|
181
|
-
],
|
|
294
|
+
index.attr({ converter: index.nullableNumberConverter })
|
|
295
|
+
], NumberField$1.prototype, "maxlength", void 0);
|
|
182
296
|
index.__decorate([
|
|
183
|
-
index.attr({
|
|
184
|
-
],
|
|
185
|
-
/**
|
|
186
|
-
* States and properties relating to the ARIA `option` role.
|
|
187
|
-
*
|
|
188
|
-
* @public
|
|
189
|
-
*/
|
|
190
|
-
class DelegatesARIAListboxOption {
|
|
191
|
-
}
|
|
297
|
+
index.attr({ converter: index.nullableNumberConverter })
|
|
298
|
+
], NumberField$1.prototype, "minlength", void 0);
|
|
192
299
|
index.__decorate([
|
|
193
|
-
index.
|
|
194
|
-
],
|
|
300
|
+
index.attr({ converter: index.nullableNumberConverter })
|
|
301
|
+
], NumberField$1.prototype, "size", void 0);
|
|
195
302
|
index.__decorate([
|
|
196
|
-
index.
|
|
197
|
-
],
|
|
303
|
+
index.attr({ converter: index.nullableNumberConverter })
|
|
304
|
+
], NumberField$1.prototype, "step", void 0);
|
|
198
305
|
index.__decorate([
|
|
199
|
-
index.
|
|
200
|
-
],
|
|
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);
|
|
201
311
|
index.__decorate([
|
|
202
312
|
index.observable
|
|
203
|
-
],
|
|
204
|
-
applyMixins.applyMixins(
|
|
205
|
-
|
|
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{font:var(--vvd-typography-heading-4)}:host([internal-part]) .fieldset:not(: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}\n";
|
|
206
317
|
|
|
207
318
|
var __defProp = Object.defineProperty;
|
|
208
319
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -215,75 +326,218 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
215
326
|
__defProp(target, key, result);
|
|
216
327
|
return result;
|
|
217
328
|
};
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
329
|
+
const STEP_DIRECTION = {
|
|
330
|
+
up: 1,
|
|
331
|
+
down: -1
|
|
332
|
+
};
|
|
333
|
+
const PROXY_REFLECTED_ATTRIBUTES = {
|
|
334
|
+
max: true,
|
|
335
|
+
min: true
|
|
336
|
+
};
|
|
337
|
+
function makeStep(element, direction) {
|
|
338
|
+
const value = parseFloat(element.value);
|
|
339
|
+
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
|
+
element.value = Number(stepUpValue.toFixed(12)).toString();
|
|
341
|
+
}
|
|
342
|
+
let NumberField = class extends NumberField$1 {
|
|
343
|
+
constructor() {
|
|
344
|
+
super(...arguments);
|
|
345
|
+
this.incrementButtonAriaLabel = null;
|
|
346
|
+
this.decrementButtonAriaLabel = null;
|
|
347
|
+
}
|
|
348
|
+
stepChanged(_previous, next) {
|
|
349
|
+
this.proxy.setAttribute(
|
|
350
|
+
"step",
|
|
351
|
+
Number.isFinite(next) ? next.toString() : ""
|
|
352
|
+
);
|
|
222
353
|
}
|
|
223
|
-
|
|
224
|
-
|
|
354
|
+
attributeChangedCallback(name, previous, next) {
|
|
355
|
+
super.attributeChangedCallback(name, previous, next);
|
|
356
|
+
if (PROXY_REFLECTED_ATTRIBUTES[name]) {
|
|
357
|
+
this.proxy.setAttribute(name, next);
|
|
358
|
+
}
|
|
225
359
|
}
|
|
226
|
-
|
|
227
|
-
|
|
360
|
+
stepUp() {
|
|
361
|
+
makeStep(this, STEP_DIRECTION.up);
|
|
228
362
|
}
|
|
229
|
-
|
|
230
|
-
this.
|
|
363
|
+
stepDown() {
|
|
364
|
+
makeStep(this, STEP_DIRECTION.down);
|
|
231
365
|
}
|
|
232
|
-
|
|
233
|
-
|
|
366
|
+
};
|
|
367
|
+
__decorateClass([
|
|
368
|
+
index.attr({ attribute: "increment-button-aria-label" })
|
|
369
|
+
], NumberField.prototype, "incrementButtonAriaLabel", 2);
|
|
234
370
|
__decorateClass([
|
|
235
|
-
index.attr({
|
|
236
|
-
|
|
237
|
-
})
|
|
238
|
-
], ListboxOption.prototype, "_text", 2);
|
|
371
|
+
index.attr({ attribute: "decrement-button-aria-label" })
|
|
372
|
+
], NumberField.prototype, "decrementButtonAriaLabel", 2);
|
|
239
373
|
__decorateClass([
|
|
240
|
-
index.attr
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
374
|
+
index.attr
|
|
375
|
+
], NumberField.prototype, "appearance", 2);
|
|
376
|
+
__decorateClass([
|
|
377
|
+
index.attr
|
|
378
|
+
], NumberField.prototype, "shape", 2);
|
|
379
|
+
__decorateClass([
|
|
380
|
+
index.attr
|
|
381
|
+
], NumberField.prototype, "autoComplete", 2);
|
|
382
|
+
NumberField = __decorateClass([
|
|
383
|
+
index$1.errorText,
|
|
384
|
+
index$1.formElements
|
|
385
|
+
], 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
|
+
applyMixinsWithObservables.applyMixinsWithObservables(
|
|
410
|
+
NumberField,
|
|
411
|
+
localized.Localized,
|
|
412
|
+
affix.AffixIcon,
|
|
413
|
+
index$1.FormElementCharCount,
|
|
414
|
+
index$1.FormElementHelperText,
|
|
415
|
+
index$1.FormElementSuccessText
|
|
416
|
+
);
|
|
245
417
|
|
|
246
|
-
const
|
|
247
|
-
|
|
418
|
+
const getStateClasses = ({
|
|
419
|
+
errorValidationMessage,
|
|
420
|
+
disabled,
|
|
421
|
+
value,
|
|
422
|
+
readOnly,
|
|
423
|
+
placeholder,
|
|
424
|
+
appearance,
|
|
425
|
+
shape,
|
|
426
|
+
label,
|
|
427
|
+
successText
|
|
428
|
+
}) => classNames.classNames(
|
|
429
|
+
["error", Boolean(errorValidationMessage)],
|
|
248
430
|
["disabled", disabled],
|
|
249
|
-
["
|
|
250
|
-
["
|
|
251
|
-
["
|
|
431
|
+
["has-value", Boolean(value)],
|
|
432
|
+
["readonly", readOnly],
|
|
433
|
+
["placeholder", Boolean(placeholder)],
|
|
434
|
+
[`appearance-${appearance}`, Boolean(appearance)],
|
|
435
|
+
[`shape-${shape}`, Boolean(shape)],
|
|
436
|
+
["no-label", !label],
|
|
437
|
+
["success", !!successText]
|
|
252
438
|
);
|
|
253
|
-
|
|
254
|
-
|
|
439
|
+
function renderLabel() {
|
|
440
|
+
return index.html` <label for="control" class="label">
|
|
441
|
+
${(x) => x.label}
|
|
442
|
+
</label>`;
|
|
443
|
+
}
|
|
444
|
+
function setControlButtonShape(numberField) {
|
|
445
|
+
return numberField.shape === enums.Shape.Pill ? enums.Shape.Pill : null;
|
|
446
|
+
}
|
|
447
|
+
function getTabIndex(numberField) {
|
|
448
|
+
return numberField.disabled || numberField.readOnly ? "-1" : null;
|
|
449
|
+
}
|
|
450
|
+
function numberControlButtons(context) {
|
|
451
|
+
const buttonTag = context.tagFor(definition.Button);
|
|
452
|
+
const dividerTag = context.tagFor(definition$1.Divider);
|
|
453
|
+
return index.html`
|
|
454
|
+
<div class="control-buttons"
|
|
455
|
+
?inert="${(x) => x.disabled || x.readOnly}">
|
|
456
|
+
<${buttonTag} id="subtract" icon="minus-line"
|
|
457
|
+
aria-label=${(x) => x.decrementButtonAriaLabel || x.locale.numberField.decrementButtonLabel}
|
|
458
|
+
shape="${setControlButtonShape}"
|
|
459
|
+
type="button"
|
|
460
|
+
size="condensed"
|
|
461
|
+
tabindex="${getTabIndex}"
|
|
462
|
+
@click="${(x) => x.stepDown()}"></${buttonTag}>
|
|
463
|
+
<${dividerTag} class="divider" orientation="vertical"></${dividerTag}>
|
|
464
|
+
<${buttonTag} id="add" icon="plus-line"
|
|
465
|
+
aria-label=${(x) => x.incrementButtonAriaLabel || x.locale.numberField.incrementButtonLabel}
|
|
466
|
+
shape="${setControlButtonShape}"
|
|
467
|
+
type="button"
|
|
468
|
+
size="condensed"
|
|
469
|
+
tabindex="${getTabIndex}"
|
|
470
|
+
@click="${(x) => x.stepUp()}"></${buttonTag}>
|
|
471
|
+
</div>
|
|
472
|
+
`;
|
|
473
|
+
}
|
|
474
|
+
const NumberFieldTemplate = (context) => {
|
|
255
475
|
return index.html`
|
|
256
|
-
<
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
476
|
+
<div class="base ${getStateClasses}">
|
|
477
|
+
${when.when((x) => x.label, renderLabel())}
|
|
478
|
+
<div class="fieldset">
|
|
479
|
+
<div class="wrapper">
|
|
480
|
+
<input
|
|
481
|
+
class="control"
|
|
482
|
+
id="control"
|
|
483
|
+
@input="${(x) => x.handleTextInput()}"
|
|
484
|
+
@change="${(x) => x.handleChange()}"
|
|
485
|
+
?autofocus="${(x) => x.autofocus}"
|
|
486
|
+
?disabled="${(x) => x.disabled}"
|
|
487
|
+
list="${(x) => x.list}"
|
|
488
|
+
step="${(x) => x.step ? x.step : null}"
|
|
489
|
+
max="${(x) => x.max}"
|
|
490
|
+
min="${(x) => x.min}"
|
|
491
|
+
maxlength="${(x) => x.maxlength}"
|
|
492
|
+
minlength="${(x) => x.minlength}"
|
|
493
|
+
placeholder="${(x) => x.placeholder}"
|
|
494
|
+
?readonly="${(x) => x.readOnly}"
|
|
495
|
+
?required="${(x) => x.required}"
|
|
496
|
+
size="${(x) => x.size}"
|
|
497
|
+
autocomplete="${(x) => x.autoComplete}"
|
|
498
|
+
name="${(x) => x.name}"
|
|
499
|
+
?spellcheck="${(x) => x.spellcheck}"
|
|
500
|
+
:value="${(x) => x.value}"
|
|
501
|
+
type="text"
|
|
502
|
+
aria-atomic="${(x) => x.ariaAtomic}"
|
|
503
|
+
aria-busy="${(x) => x.ariaBusy}"
|
|
504
|
+
aria-current="${(x) => x.ariaCurrent}"
|
|
505
|
+
aria-details="${(x) => x.ariaDetails}"
|
|
506
|
+
aria-disabled="${(x) => x.ariaDisabled}"
|
|
507
|
+
aria-errormessage="${(x) => x.ariaErrormessage}"
|
|
508
|
+
aria-haspopup="${(x) => x.ariaHaspopup}"
|
|
509
|
+
aria-hidden="${(x) => x.ariaHidden}"
|
|
510
|
+
aria-invalid="${(x) => x.ariaInvalid}"
|
|
511
|
+
aria-keyshortcuts="${(x) => x.ariaKeyshortcuts}"
|
|
512
|
+
aria-label="${(x) => x.ariaLabel}"
|
|
513
|
+
aria-live="${(x) => x.ariaLive}"
|
|
514
|
+
aria-relevant="${(x) => x.ariaRelevant}"
|
|
515
|
+
aria-roledescription="${(x) => x.ariaRoledescription}"
|
|
516
|
+
${ref.ref("control")}
|
|
517
|
+
/>
|
|
518
|
+
</div>
|
|
519
|
+
${() => numberControlButtons(context)}
|
|
267
520
|
</div>
|
|
268
|
-
|
|
521
|
+
${index$1.getFeedbackTemplate(context)}
|
|
522
|
+
</div>
|
|
269
523
|
`;
|
|
270
524
|
};
|
|
271
525
|
|
|
272
|
-
const
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
526
|
+
const numberFieldDefinition = NumberField.compose({
|
|
527
|
+
baseName: "number-field",
|
|
528
|
+
template: NumberFieldTemplate,
|
|
529
|
+
styles,
|
|
530
|
+
shadowOptions: {
|
|
531
|
+
delegatesFocus: true
|
|
532
|
+
}
|
|
278
533
|
});
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
...definition.
|
|
534
|
+
const numberFieldRegistries = [
|
|
535
|
+
numberFieldDefinition(),
|
|
536
|
+
...definition.buttonRegistries,
|
|
537
|
+
...definition$1.dividerRegistries
|
|
282
538
|
];
|
|
283
|
-
const
|
|
539
|
+
const registerNumberField = index.registerFactory(numberFieldRegistries);
|
|
284
540
|
|
|
285
|
-
exports.
|
|
286
|
-
exports.
|
|
287
|
-
exports.
|
|
288
|
-
exports.listboxOptionRegistries = listboxOptionRegistries;
|
|
289
|
-
exports.registerOption = registerOption;
|
|
541
|
+
exports.numberFieldDefinition = numberFieldDefinition;
|
|
542
|
+
exports.numberFieldRegistries = numberFieldRegistries;
|
|
543
|
+
exports.registerNumberField = registerNumberField;
|