@vonage/vivid 4.11.0 → 4.12.1

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 (96) hide show
  1. package/custom-elements.json +899 -442
  2. package/lib/accordion/accordion.d.ts +21 -2
  3. package/lib/accordion-item/accordion-item.d.ts +6 -2
  4. package/lib/calendar/calendar.d.ts +1 -1
  5. package/lib/date-picker/date-picker.d.ts +1 -0
  6. package/lib/fab/fab.d.ts +2 -2
  7. package/lib/radio/radio.d.ts +12 -2
  8. package/lib/radio/radio.form-associated.d.ts +10 -0
  9. package/lib/radio-group/radio-group.d.ts +20 -2
  10. package/lib/tab/tab.d.ts +3 -2
  11. package/lib/tab-panel/tab-panel.d.ts +2 -2
  12. package/lib/tabs/tabs.d.ts +30 -9
  13. package/package.json +1 -1
  14. package/shared/date-picker/date-picker-base.d.ts +1 -0
  15. package/shared/definition.cjs +29 -72
  16. package/shared/definition.js +30 -73
  17. package/shared/definition16.cjs +1 -2
  18. package/shared/definition16.js +1 -2
  19. package/shared/definition17.cjs +2 -2
  20. package/shared/definition17.js +2 -2
  21. package/shared/definition18.cjs +6 -1
  22. package/shared/definition18.js +6 -1
  23. package/shared/definition19.cjs +17 -8
  24. package/shared/definition19.js +17 -8
  25. package/shared/definition2.cjs +154 -187
  26. package/shared/definition2.js +157 -190
  27. package/shared/definition20.cjs +1 -1
  28. package/shared/definition20.js +1 -1
  29. package/shared/definition24.cjs +11 -11
  30. package/shared/definition24.js +11 -11
  31. package/shared/definition29.cjs +2 -2
  32. package/shared/definition29.js +2 -2
  33. package/shared/definition35.cjs +1 -1
  34. package/shared/definition35.js +1 -1
  35. package/shared/definition40.cjs +226 -399
  36. package/shared/definition40.js +229 -402
  37. package/shared/definition42.cjs +3 -2
  38. package/shared/definition42.js +3 -2
  39. package/shared/definition43.cjs +1 -0
  40. package/shared/definition43.js +1 -0
  41. package/shared/definition44.cjs +1 -1
  42. package/shared/definition44.js +1 -1
  43. package/shared/definition47.cjs +3 -2
  44. package/shared/definition47.js +3 -2
  45. package/shared/definition49.cjs +1 -1
  46. package/shared/definition49.js +1 -1
  47. package/shared/definition5.cjs +1 -1
  48. package/shared/definition5.js +1 -1
  49. package/shared/definition50.cjs +1 -11
  50. package/shared/definition50.js +1 -11
  51. package/shared/definition51.cjs +4 -14
  52. package/shared/definition51.js +5 -15
  53. package/shared/definition52.cjs +269 -19
  54. package/shared/definition52.js +273 -23
  55. package/shared/definition57.cjs +26 -4
  56. package/shared/definition57.js +27 -5
  57. package/shared/definition58.cjs +1 -1
  58. package/shared/definition58.js +1 -1
  59. package/shared/definition59.cjs +1 -1
  60. package/shared/definition59.js +1 -1
  61. package/shared/definition61.cjs +1 -1
  62. package/shared/definition61.js +1 -1
  63. package/shared/definition62.cjs +17 -8
  64. package/shared/definition62.js +17 -8
  65. package/shared/definition64.cjs +55 -30
  66. package/shared/definition64.js +55 -30
  67. package/shared/form-associated.cjs +1 -1
  68. package/shared/form-associated.js +1 -1
  69. package/shared/foundation/button/button.d.ts +1 -1
  70. package/shared/foundation/button/button.template.d.ts +2 -2
  71. package/shared/icon.cjs +1 -1
  72. package/shared/icon.js +1 -1
  73. package/shared/index.cjs +1 -0
  74. package/shared/index.js +1 -1
  75. package/shared/key-codes.cjs +1 -94
  76. package/shared/key-codes.js +2 -89
  77. package/shared/key-codes2.cjs +87 -1
  78. package/shared/key-codes2.js +83 -2
  79. package/shared/listbox.cjs +6 -7
  80. package/shared/listbox.js +3 -4
  81. package/shared/numbers.cjs +0 -12
  82. package/shared/numbers.js +1 -12
  83. package/shared/presentationDate.cjs +14 -0
  84. package/shared/presentationDate.js +15 -1
  85. package/shared/radio.cjs +92 -117
  86. package/shared/radio.js +93 -118
  87. package/shared/slider.template.cjs +2 -15
  88. package/shared/slider.template.js +2 -14
  89. package/shared/strings.cjs +26 -0
  90. package/shared/strings.js +25 -1
  91. package/styles/core/all.css +1 -1
  92. package/styles/core/theme.css +1 -1
  93. package/styles/core/typography.css +1 -1
  94. package/styles/tokens/theme-dark.css +4 -4
  95. package/styles/tokens/theme-light.css +4 -4
  96. package/styles/tokens/vivid-2-compat.css +1 -1
package/shared/radio.js CHANGED
@@ -1,126 +1,16 @@
1
- import { F as FoundationElement, _ as __decorate, a as attr, o as observable } from './index.js';
2
1
  import { C as CheckableFormAssociated } from './form-associated.js';
3
- import { a as keySpace } from './key-codes.js';
2
+ import { F as FoundationElement, a as attr, o as observable } from './index.js';
3
+ import { k as keySpace } from './key-codes.js';
4
4
 
5
5
  class _Radio extends FoundationElement {
6
6
  }
7
- /**
8
- * A form-associated base class for the {@link @microsoft/fast-foundation#(Radio:class)} component.
9
- *
10
- * @internal
11
- */
12
7
  class FormAssociatedRadio extends CheckableFormAssociated(_Radio) {
13
- constructor() {
14
- super(...arguments);
15
- this.proxy = document.createElement("input");
16
- }
8
+ constructor() {
9
+ super(...arguments);
10
+ this.proxy = document.createElement("input");
11
+ }
17
12
  }
18
13
 
19
- /**
20
- * A Radio Custom HTML Element.
21
- * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#radio | ARIA radio }.
22
- *
23
- * @slot checked-indicator - The checked indicator
24
- * @slot - The default slot for the label
25
- * @csspart control - The element representing the visual radio control
26
- * @csspart label - The label
27
- * @fires change - Emits a custom change event when the checked state changes
28
- *
29
- * @public
30
- */
31
- let Radio$1 = class Radio extends FormAssociatedRadio {
32
- constructor() {
33
- super();
34
- /**
35
- * The element's value to be included in form submission when checked.
36
- * Default to "on" to reach parity with input[type="radio"]
37
- *
38
- * @internal
39
- */
40
- this.initialValue = "on";
41
- /**
42
- * @internal
43
- */
44
- this.keypressHandler = (e) => {
45
- switch (e.key) {
46
- case keySpace:
47
- if (!this.checked && !this.readOnly) {
48
- this.checked = true;
49
- }
50
- return;
51
- }
52
- return true;
53
- };
54
- this.proxy.setAttribute("type", "radio");
55
- }
56
- readOnlyChanged() {
57
- if (this.proxy instanceof HTMLInputElement) {
58
- this.proxy.readOnly = this.readOnly;
59
- }
60
- }
61
- /**
62
- * @internal
63
- */
64
- defaultCheckedChanged() {
65
- var _a;
66
- if (this.$fastController.isConnected && !this.dirtyChecked) {
67
- // Setting this.checked will cause us to enter a dirty state,
68
- // but if we are clean when defaultChecked is changed, we want to stay
69
- // in a clean state, so reset this.dirtyChecked
70
- if (!this.isInsideRadioGroup()) {
71
- this.checked = (_a = this.defaultChecked) !== null && _a !== void 0 ? _a : false;
72
- this.dirtyChecked = false;
73
- }
74
- }
75
- }
76
- /**
77
- * @internal
78
- */
79
- connectedCallback() {
80
- var _a, _b;
81
- super.connectedCallback();
82
- this.validate();
83
- if (((_a = this.parentElement) === null || _a === void 0 ? void 0 : _a.getAttribute("role")) !== "radiogroup" &&
84
- this.getAttribute("tabindex") === null) {
85
- if (!this.disabled) {
86
- this.setAttribute("tabindex", "0");
87
- }
88
- }
89
- if (this.checkedAttribute) {
90
- if (!this.dirtyChecked) {
91
- // Setting this.checked will cause us to enter a dirty state,
92
- // but if we are clean when defaultChecked is changed, we want to stay
93
- // in a clean state, so reset this.dirtyChecked
94
- if (!this.isInsideRadioGroup()) {
95
- this.checked = (_b = this.defaultChecked) !== null && _b !== void 0 ? _b : false;
96
- this.dirtyChecked = false;
97
- }
98
- }
99
- }
100
- }
101
- isInsideRadioGroup() {
102
- const parent = this.closest("[role=radiogroup]");
103
- return parent !== null;
104
- }
105
- /**
106
- * @internal
107
- */
108
- clickHandler(e) {
109
- if (!this.disabled && !this.readOnly && !this.checked) {
110
- this.checked = true;
111
- }
112
- }
113
- };
114
- __decorate([
115
- attr({ attribute: "readonly", mode: "boolean" })
116
- ], Radio$1.prototype, "readOnly", void 0);
117
- __decorate([
118
- observable
119
- ], Radio$1.prototype, "name", void 0);
120
- __decorate([
121
- observable
122
- ], Radio$1.prototype, "defaultSlottedNodes", void 0);
123
-
124
14
  var __defProp = Object.defineProperty;
125
15
  var __decorateClass = (decorators, target, key, kind) => {
126
16
  var result = void 0 ;
@@ -130,10 +20,86 @@ var __decorateClass = (decorators, target, key, kind) => {
130
20
  if (result) __defProp(target, key, result);
131
21
  return result;
132
22
  };
133
- class Radio extends Radio$1 {
23
+ class Radio extends FormAssociatedRadio {
134
24
  constructor() {
135
- super(...arguments);
25
+ super();
136
26
  this.ariaLabel = null;
27
+ /**
28
+ * The element's value to be included in form submission when checked.
29
+ * Default to "on" to reach parity with input[type="radio"]
30
+ *
31
+ * @internal
32
+ */
33
+ this.initialValue = "on";
34
+ this.defaultSlottedNodes = [];
35
+ /**
36
+ * @internal
37
+ */
38
+ this.keypressHandler = (e) => {
39
+ switch (e.key) {
40
+ case keySpace:
41
+ if (!this.checked && !this.readOnly) {
42
+ this.checked = true;
43
+ }
44
+ return;
45
+ }
46
+ return true;
47
+ };
48
+ this.proxy.setAttribute("type", "radio");
49
+ }
50
+ // Map to proxy element
51
+ /**
52
+ * @internal
53
+ */
54
+ readOnlyChanged() {
55
+ if (this.proxy instanceof HTMLInputElement) {
56
+ this.proxy.readOnly = this.readOnly;
57
+ }
58
+ }
59
+ /**
60
+ * @internal
61
+ */
62
+ defaultCheckedChanged() {
63
+ if (this.$fastController.isConnected && !this.dirtyChecked) {
64
+ if (!this.isInsideRadioGroup()) {
65
+ this.checked = this.defaultChecked;
66
+ this.dirtyChecked = false;
67
+ }
68
+ }
69
+ }
70
+ /**
71
+ * @internal
72
+ */
73
+ connectedCallback() {
74
+ super.connectedCallback();
75
+ this.validate();
76
+ if (this.parentElement.getAttribute("role") !== "radiogroup" && this.getAttribute("tabindex") === null) {
77
+ if (!this.disabled) {
78
+ this.setAttribute("tabindex", "0");
79
+ }
80
+ }
81
+ if (this.checkedAttribute) {
82
+ if (!this.dirtyChecked) {
83
+ if (!this.isInsideRadioGroup()) {
84
+ this.checked = this.defaultChecked;
85
+ this.dirtyChecked = false;
86
+ }
87
+ }
88
+ }
89
+ }
90
+ isInsideRadioGroup() {
91
+ const parent = this.closest(
92
+ "[role=radiogroup]"
93
+ );
94
+ return parent !== null;
95
+ }
96
+ /**
97
+ * @internal
98
+ */
99
+ clickHandler(_) {
100
+ if (!this.disabled && !this.readOnly && !this.checked) {
101
+ this.checked = true;
102
+ }
137
103
  }
138
104
  }
139
105
  __decorateClass([
@@ -145,5 +111,14 @@ __decorateClass([
145
111
  __decorateClass([
146
112
  attr
147
113
  ], Radio.prototype, "connotation");
114
+ __decorateClass([
115
+ attr({ attribute: "readonly", mode: "boolean" })
116
+ ], Radio.prototype, "readOnly");
117
+ __decorateClass([
118
+ observable
119
+ ], Radio.prototype, "name");
120
+ __decorateClass([
121
+ observable
122
+ ], Radio.prototype, "defaultSlottedNodes");
148
123
 
149
124
  export { Radio as R };
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ const numbers = require('./numbers.cjs');
3
4
  const definition = require('./definition64.cjs');
4
5
  const index = require('./index.cjs');
5
6
  const ref = require('./ref.cjs');
@@ -7,19 +8,6 @@ const aria = require('./aria.cjs');
7
8
  const when = require('./when.cjs');
8
9
  const classNames = require('./class-names.cjs');
9
10
 
10
- /**
11
- * This method keeps a given value within the bounds of a min and max value. If the value
12
- * is larger than the max, the minimum value will be returned. If the value is smaller than the minimum,
13
- * the maximum will be returned. Otherwise, the value is returned un-changed.
14
- */
15
- /**
16
- * Ensures that a value is between a min and max value. If value is lower than min, min will be returned.
17
- * If value is greater than max, max will be returned.
18
- */
19
- function limit(min, max, value) {
20
- return Math.min(Math.max(value, min), max);
21
- }
22
-
23
11
  const getDecimalPlaces = (num) => {
24
12
  const match = num.toString().match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
25
13
  return Math.max(
@@ -37,7 +25,7 @@ const roundToStepValue = (value, step) => {
37
25
  };
38
26
 
39
27
  const lerp = (a, b, value) => a + (b - a) * value;
40
- const inverseLerp = (a, b, value) => limit(0, 1, (value - a) / (b - a));
28
+ const inverseLerp = (a, b, value) => numbers.limit(0, 1, (value - a) / (b - a));
41
29
 
42
30
  const getClasses = ({ disabled, connotation }) => classNames.classNames(
43
31
  "control",
@@ -112,5 +100,4 @@ exports.SliderTemplate = SliderTemplate;
112
100
  exports.getMarkersTemplate = getMarkersTemplate;
113
101
  exports.inverseLerp = inverseLerp;
114
102
  exports.lerp = lerp;
115
- exports.limit = limit;
116
103
  exports.roundToStepValue = roundToStepValue;
@@ -1,3 +1,4 @@
1
+ import { l as limit } from './numbers.js';
1
2
  import { P as Popup, a as PlacementStrategy } from './definition64.js';
2
3
  import { h as html } from './index.js';
3
4
  import { r as ref } from './ref.js';
@@ -5,19 +6,6 @@ import { O as Orientation } from './aria.js';
5
6
  import { w as when } from './when.js';
6
7
  import { c as classNames } from './class-names.js';
7
8
 
8
- /**
9
- * This method keeps a given value within the bounds of a min and max value. If the value
10
- * is larger than the max, the minimum value will be returned. If the value is smaller than the minimum,
11
- * the maximum will be returned. Otherwise, the value is returned un-changed.
12
- */
13
- /**
14
- * Ensures that a value is between a min and max value. If value is lower than min, min will be returned.
15
- * If value is greater than max, max will be returned.
16
- */
17
- function limit(min, max, value) {
18
- return Math.min(Math.max(value, min), max);
19
- }
20
-
21
9
  const getDecimalPlaces = (num) => {
22
10
  const match = num.toString().match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
23
11
  return Math.max(
@@ -106,4 +94,4 @@ const SliderTemplate = (context) => {
106
94
  >`;
107
95
  };
108
96
 
109
- export { SliderTemplate as S, limit as a, getMarkersTemplate as g, inverseLerp as i, lerp as l, roundToStepValue as r };
97
+ export { SliderTemplate as S, getMarkersTemplate as g, inverseLerp as i, lerp as l, roundToStepValue as r };
@@ -1,5 +1,29 @@
1
1
  'use strict';
2
2
 
3
+ /**
4
+ * This method keeps a given value within the bounds of a min and max value. If the value
5
+ * is larger than the max, the minimum value will be returned. If the value is smaller than the minimum,
6
+ * the maximum will be returned. Otherwise, the value is returned un-changed.
7
+ */
8
+ /**
9
+ * Ensures that a value is between a min and max value. If value is lower than min, min will be returned.
10
+ * If value is greater than max, max will be returned.
11
+ */
12
+ function limit(min, max, value) {
13
+ return Math.min(Math.max(value, min), max);
14
+ }
15
+ /**
16
+ * Determines if a number value is within a specified range.
17
+ *
18
+ * @param value - the value to check
19
+ * @param min - the range start
20
+ * @param max - the range end
21
+ */
22
+ function inRange(value, min, max = 0) {
23
+ [min, max] = [min, max].sort((a, b) => a - b);
24
+ return min <= value && value < max;
25
+ }
26
+
3
27
  let uniqueIdCounter = 0;
4
28
  /**
5
29
  * Generates a unique ID based on incrementing a counter.
@@ -8,4 +32,6 @@ function uniqueId(prefix = "") {
8
32
  return `${prefix}${uniqueIdCounter++}`;
9
33
  }
10
34
 
35
+ exports.inRange = inRange;
36
+ exports.limit = limit;
11
37
  exports.uniqueId = uniqueId;
package/shared/strings.js CHANGED
@@ -1,3 +1,27 @@
1
+ /**
2
+ * This method keeps a given value within the bounds of a min and max value. If the value
3
+ * is larger than the max, the minimum value will be returned. If the value is smaller than the minimum,
4
+ * the maximum will be returned. Otherwise, the value is returned un-changed.
5
+ */
6
+ /**
7
+ * Ensures that a value is between a min and max value. If value is lower than min, min will be returned.
8
+ * If value is greater than max, max will be returned.
9
+ */
10
+ function limit(min, max, value) {
11
+ return Math.min(Math.max(value, min), max);
12
+ }
13
+ /**
14
+ * Determines if a number value is within a specified range.
15
+ *
16
+ * @param value - the value to check
17
+ * @param min - the range start
18
+ * @param max - the range end
19
+ */
20
+ function inRange(value, min, max = 0) {
21
+ [min, max] = [min, max].sort((a, b) => a - b);
22
+ return min <= value && value < max;
23
+ }
24
+
1
25
  let uniqueIdCounter = 0;
2
26
  /**
3
27
  * Generates a unique ID based on incrementing a counter.
@@ -6,4 +30,4 @@ function uniqueId(prefix = "") {
6
30
  return `${prefix}${uniqueIdCounter++}`;
7
31
  }
8
32
 
9
- export { uniqueId as u };
33
+ export { inRange as i, limit as l, uniqueId as u };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Wed, 13 Nov 2024 14:14:30 GMT
3
+ * Generated on Wed, 20 Nov 2024 13:40:01 GMT
4
4
  */
5
5
  .vvd-root {
6
6
  color-scheme: var(--vvd-color-scheme);
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Wed, 13 Nov 2024 14:14:30 GMT
3
+ * Generated on Wed, 20 Nov 2024 13:40:01 GMT
4
4
  */
5
5
  .vvd-root {
6
6
  color-scheme: var(--vvd-color-scheme);
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Wed, 13 Nov 2024 14:14:30 GMT
3
+ * Generated on Wed, 20 Nov 2024 13:40:01 GMT
4
4
  */
5
5
  .vvd-root:root {
6
6
  --vvd-size-font-scale-base: 1rem;
@@ -1,18 +1,18 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Wed, 13 Nov 2024 14:14:30 GMT
3
+ * Generated on Wed, 20 Nov 2024 13:40:01 GMT
4
4
  */
5
5
  /**
6
6
  * Do not edit directly
7
- * Generated on Wed, 13 Nov 2024 14:14:30 GMT
7
+ * Generated on Wed, 20 Nov 2024 13:40:01 GMT
8
8
  */
9
9
  /**
10
10
  * Do not edit directly
11
- * Generated on Wed, 13 Nov 2024 14:14:30 GMT
11
+ * Generated on Wed, 20 Nov 2024 13:40:01 GMT
12
12
  */
13
13
  /**
14
14
  * Do not edit directly
15
- * Generated on Wed, 13 Nov 2024 14:14:30 GMT
15
+ * Generated on Wed, 20 Nov 2024 13:40:01 GMT
16
16
  */
17
17
  @property --vvd-size-density {
18
18
  syntax: "<integer>";
@@ -1,18 +1,18 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Wed, 13 Nov 2024 14:14:30 GMT
3
+ * Generated on Wed, 20 Nov 2024 13:40:01 GMT
4
4
  */
5
5
  /**
6
6
  * Do not edit directly
7
- * Generated on Wed, 13 Nov 2024 14:14:30 GMT
7
+ * Generated on Wed, 20 Nov 2024 13:40:01 GMT
8
8
  */
9
9
  /**
10
10
  * Do not edit directly
11
- * Generated on Wed, 13 Nov 2024 14:14:30 GMT
11
+ * Generated on Wed, 20 Nov 2024 13:40:01 GMT
12
12
  */
13
13
  /**
14
14
  * Do not edit directly
15
- * Generated on Wed, 13 Nov 2024 14:14:30 GMT
15
+ * Generated on Wed, 20 Nov 2024 13:40:01 GMT
16
16
  */
17
17
  @property --vvd-size-density {
18
18
  syntax: "<integer>";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Wed, 13 Nov 2024 14:14:30 GMT
3
+ * Generated on Wed, 20 Nov 2024 13:40:01 GMT
4
4
  */
5
5
  .vvd-root, ::part(vvd-root),
6
6
  .vvd-theme-alternate, ::part(vvd-theme-alternate) {