@vonage/vivid 4.10.0 → 4.12.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 (94) hide show
  1. package/custom-elements.json +8630 -6433
  2. package/lib/badge/badge.d.ts +1 -1
  3. package/lib/breadcrumb-item/breadcrumb-item.d.ts +1 -1
  4. package/lib/button/button.d.ts +1 -1
  5. package/lib/checkbox/checkbox.d.ts +5 -3
  6. package/lib/checkbox/checkbox.form-associated.d.ts +10 -0
  7. package/lib/enums.d.ts +1 -0
  8. package/lib/fab/fab.d.ts +2 -2
  9. package/lib/file-picker/file-picker.d.ts +3 -0
  10. package/lib/slider/slider.d.ts +30 -6
  11. package/lib/slider/slider.form-associated.d.ts +10 -0
  12. package/lib/split-button/split-button.d.ts +1 -1
  13. package/lib/tabs/tabs.d.ts +1 -0
  14. package/package.json +1 -1
  15. package/shared/aria-global2.cjs +93 -0
  16. package/shared/aria-global2.js +91 -0
  17. package/shared/breadcrumb-item.cjs +2 -89
  18. package/shared/breadcrumb-item.js +1 -88
  19. package/shared/definition11.cjs +200 -4
  20. package/shared/definition11.js +198 -3
  21. package/shared/definition15.cjs +34 -91
  22. package/shared/definition15.js +35 -92
  23. package/shared/definition16.cjs +9 -7
  24. package/shared/definition16.js +9 -7
  25. package/shared/definition20.cjs +1 -1
  26. package/shared/definition20.js +1 -1
  27. package/shared/definition21.cjs +1 -1
  28. package/shared/definition21.js +1 -1
  29. package/shared/definition24.cjs +156 -2
  30. package/shared/definition24.js +157 -3
  31. package/shared/definition25.cjs +106 -56
  32. package/shared/definition25.js +106 -56
  33. package/shared/definition35.cjs +2 -2
  34. package/shared/definition35.js +2 -2
  35. package/shared/definition37.cjs +1 -1
  36. package/shared/definition37.js +1 -1
  37. package/shared/definition4.cjs +5 -6
  38. package/shared/definition4.js +1 -2
  39. package/shared/definition40.cjs +11 -4
  40. package/shared/definition40.js +8 -1
  41. package/shared/definition42.cjs +3 -22
  42. package/shared/definition42.js +2 -21
  43. package/shared/definition43.cjs +1 -2
  44. package/shared/definition43.js +1 -2
  45. package/shared/definition44.js +1 -1
  46. package/shared/definition47.cjs +369 -502
  47. package/shared/definition47.js +370 -503
  48. package/shared/definition5.cjs +4 -4
  49. package/shared/definition5.js +1 -1
  50. package/shared/definition51.cjs +1 -1
  51. package/shared/definition51.js +1 -1
  52. package/shared/definition52.cjs +63 -26
  53. package/shared/definition52.js +63 -26
  54. package/shared/definition56.cjs +41 -43
  55. package/shared/definition56.js +41 -43
  56. package/shared/definition57.cjs +1 -1
  57. package/shared/definition57.js +1 -1
  58. package/shared/definition58.cjs +1 -1
  59. package/shared/definition58.js +1 -1
  60. package/shared/definition59.cjs +1 -1
  61. package/shared/definition59.js +1 -1
  62. package/shared/definition64.cjs +278 -90
  63. package/shared/definition64.js +278 -90
  64. package/shared/definition7.cjs +1 -1
  65. package/shared/definition7.js +1 -1
  66. package/shared/definition8.cjs +1 -1
  67. package/shared/definition8.js +1 -1
  68. package/shared/enums.cjs +1 -0
  69. package/shared/enums.js +1 -0
  70. package/shared/form-associated.js +1 -1
  71. package/shared/{patterns → foundation/anchor}/anchor.d.ts +1 -1
  72. package/shared/foundation/button/button.d.ts +27 -0
  73. package/shared/foundation/button/button.template.d.ts +4 -0
  74. package/shared/foundation/button/index.d.ts +2 -0
  75. package/shared/foundation/patterns/index.d.ts +1 -0
  76. package/shared/index.cjs +22 -2
  77. package/shared/index.js +22 -2
  78. package/shared/key-codes2.js +1 -1
  79. package/shared/presentationDate.cjs +4328 -4042
  80. package/shared/presentationDate.js +4327 -4041
  81. package/shared/slider.template.cjs +23 -1
  82. package/shared/slider.template.js +21 -2
  83. package/styles/core/all.css +1 -1
  84. package/styles/core/theme.css +1 -1
  85. package/styles/core/typography.css +1 -1
  86. package/styles/tokens/theme-dark.css +4 -4
  87. package/styles/tokens/theme-light.css +4 -4
  88. package/styles/tokens/vivid-2-compat.css +1 -1
  89. package/vivid.api.json +52 -4
  90. package/shared/aria2.cjs +0 -11
  91. package/shared/aria2.js +0 -9
  92. package/shared/button.cjs +0 -202
  93. package/shared/button.js +0 -200
  94. /package/shared/{patterns → foundation/patterns}/aria-global.d.ts +0 -0
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  const definition = require('./definition64.cjs');
4
- const aria = require('./aria.cjs');
5
4
  const index = require('./index.cjs');
6
5
  const ref = require('./ref.cjs');
6
+ const aria = require('./aria.cjs');
7
7
  const when = require('./when.cjs');
8
8
  const classNames = require('./class-names.cjs');
9
9
 
@@ -20,6 +20,25 @@ function limit(min, max, value) {
20
20
  return Math.min(Math.max(value, min), max);
21
21
  }
22
22
 
23
+ const getDecimalPlaces = (num) => {
24
+ const match = num.toString().match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
25
+ return Math.max(
26
+ 0,
27
+ // Number of digits right of decimal point.
28
+ (match[1] ? match[1].length : 0) - // Adjust for scientific notation.
29
+ (match[2] ? +match[2] : 0)
30
+ );
31
+ };
32
+ const roundToStepValue = (value, step) => {
33
+ const decimalPlaces = getDecimalPlaces(step);
34
+ const factor = Math.pow(10, decimalPlaces);
35
+ const roundedValue = Math.round(value / step) * step;
36
+ return Math.round(roundedValue * factor) / factor;
37
+ };
38
+
39
+ const lerp = (a, b, value) => a + (b - a) * value;
40
+ const inverseLerp = (a, b, value) => limit(0, 1, (value - a) / (b - a));
41
+
23
42
  const getClasses = ({ disabled, connotation }) => classNames.classNames(
24
43
  "control",
25
44
  ["disabled", Boolean(disabled)],
@@ -91,4 +110,7 @@ const SliderTemplate = (context) => {
91
110
 
92
111
  exports.SliderTemplate = SliderTemplate;
93
112
  exports.getMarkersTemplate = getMarkersTemplate;
113
+ exports.inverseLerp = inverseLerp;
114
+ exports.lerp = lerp;
94
115
  exports.limit = limit;
116
+ exports.roundToStepValue = roundToStepValue;
@@ -1,7 +1,7 @@
1
1
  import { P as Popup, a as PlacementStrategy } from './definition64.js';
2
- import { O as Orientation } from './aria.js';
3
2
  import { h as html } from './index.js';
4
3
  import { r as ref } from './ref.js';
4
+ import { O as Orientation } from './aria.js';
5
5
  import { w as when } from './when.js';
6
6
  import { c as classNames } from './class-names.js';
7
7
 
@@ -18,6 +18,25 @@ function limit(min, max, value) {
18
18
  return Math.min(Math.max(value, min), max);
19
19
  }
20
20
 
21
+ const getDecimalPlaces = (num) => {
22
+ const match = num.toString().match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
23
+ return Math.max(
24
+ 0,
25
+ // Number of digits right of decimal point.
26
+ (match[1] ? match[1].length : 0) - // Adjust for scientific notation.
27
+ (match[2] ? +match[2] : 0)
28
+ );
29
+ };
30
+ const roundToStepValue = (value, step) => {
31
+ const decimalPlaces = getDecimalPlaces(step);
32
+ const factor = Math.pow(10, decimalPlaces);
33
+ const roundedValue = Math.round(value / step) * step;
34
+ return Math.round(roundedValue * factor) / factor;
35
+ };
36
+
37
+ const lerp = (a, b, value) => a + (b - a) * value;
38
+ const inverseLerp = (a, b, value) => limit(0, 1, (value - a) / (b - a));
39
+
21
40
  const getClasses = ({ disabled, connotation }) => classNames(
22
41
  "control",
23
42
  ["disabled", Boolean(disabled)],
@@ -87,4 +106,4 @@ const SliderTemplate = (context) => {
87
106
  >`;
88
107
  };
89
108
 
90
- export { SliderTemplate as S, getMarkersTemplate as g, limit as l };
109
+ export { SliderTemplate as S, limit as a, getMarkersTemplate as g, inverseLerp as i, lerp as l, roundToStepValue as r };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Wed, 23 Oct 2024 11:35:04 GMT
3
+ * Generated on Thu, 14 Nov 2024 10:14:25 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, 23 Oct 2024 11:35:04 GMT
3
+ * Generated on Thu, 14 Nov 2024 10:14:25 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, 23 Oct 2024 11:35:04 GMT
3
+ * Generated on Thu, 14 Nov 2024 10:14:25 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, 23 Oct 2024 11:35:04 GMT
3
+ * Generated on Thu, 14 Nov 2024 10:14:25 GMT
4
4
  */
5
5
  /**
6
6
  * Do not edit directly
7
- * Generated on Wed, 23 Oct 2024 11:35:04 GMT
7
+ * Generated on Thu, 14 Nov 2024 10:14:25 GMT
8
8
  */
9
9
  /**
10
10
  * Do not edit directly
11
- * Generated on Wed, 23 Oct 2024 11:35:04 GMT
11
+ * Generated on Thu, 14 Nov 2024 10:14:25 GMT
12
12
  */
13
13
  /**
14
14
  * Do not edit directly
15
- * Generated on Wed, 23 Oct 2024 11:35:04 GMT
15
+ * Generated on Thu, 14 Nov 2024 10:14:25 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, 23 Oct 2024 11:35:04 GMT
3
+ * Generated on Thu, 14 Nov 2024 10:14:25 GMT
4
4
  */
5
5
  /**
6
6
  * Do not edit directly
7
- * Generated on Wed, 23 Oct 2024 11:35:04 GMT
7
+ * Generated on Thu, 14 Nov 2024 10:14:25 GMT
8
8
  */
9
9
  /**
10
10
  * Do not edit directly
11
- * Generated on Wed, 23 Oct 2024 11:35:04 GMT
11
+ * Generated on Thu, 14 Nov 2024 10:14:25 GMT
12
12
  */
13
13
  /**
14
14
  * Do not edit directly
15
- * Generated on Wed, 23 Oct 2024 11:35:04 GMT
15
+ * Generated on Thu, 14 Nov 2024 10:14:25 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, 23 Oct 2024 11:35:04 GMT
3
+ * Generated on Thu, 14 Nov 2024 10:14:25 GMT
4
4
  */
5
5
  .vvd-root, ::part(vvd-root),
6
6
  .vvd-theme-alternate, ::part(vvd-theme-alternate) {
package/vivid.api.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "metadata": {
3
3
  "toolPackage": "@microsoft/api-extractor",
4
- "toolVersion": "7.47.7",
4
+ "toolVersion": "7.47.11",
5
5
  "schemaVersion": 1011,
6
6
  "oldestForwardsCompatibleVersion": 1001,
7
7
  "tsdocConfig": {
@@ -607,6 +607,27 @@
607
607
  },
608
608
  "releaseTag": "Public",
609
609
  "name": "Subtle"
610
+ },
611
+ {
612
+ "kind": "EnumMember",
613
+ "canonicalReference": "@vonage/vivid!Appearance.SubtleLight:member",
614
+ "docComment": "",
615
+ "excerptTokens": [
616
+ {
617
+ "kind": "Content",
618
+ "text": "SubtleLight = "
619
+ },
620
+ {
621
+ "kind": "Content",
622
+ "text": "\"subtle-light\""
623
+ }
624
+ ],
625
+ "initializerTokenRange": {
626
+ "startIndex": 1,
627
+ "endIndex": 2
628
+ },
629
+ "releaseTag": "Public",
630
+ "name": "SubtleLight"
610
631
  }
611
632
  ]
612
633
  },
@@ -1190,6 +1211,15 @@
1190
1211
  "text": "Appearance.Subtle",
1191
1212
  "canonicalReference": "@vonage/vivid!Appearance.Subtle:member"
1192
1213
  },
1214
+ {
1215
+ "kind": "Content",
1216
+ "text": " | "
1217
+ },
1218
+ {
1219
+ "kind": "Reference",
1220
+ "text": "Appearance.SubtleLight",
1221
+ "canonicalReference": "@vonage/vivid!Appearance.SubtleLight:member"
1222
+ },
1193
1223
  {
1194
1224
  "kind": "Content",
1195
1225
  "text": ">"
@@ -1204,7 +1234,7 @@
1204
1234
  "name": "BadgeAppearance",
1205
1235
  "typeTokenRange": {
1206
1236
  "startIndex": 1,
1207
- "endIndex": 11
1237
+ "endIndex": 13
1208
1238
  }
1209
1239
  },
1210
1240
  {
@@ -1638,6 +1668,15 @@
1638
1668
  "kind": "Content",
1639
1669
  "text": " | "
1640
1670
  },
1671
+ {
1672
+ "kind": "Reference",
1673
+ "text": "Connotation.Announcement",
1674
+ "canonicalReference": "@vonage/vivid!Connotation.Announcement:member"
1675
+ },
1676
+ {
1677
+ "kind": "Content",
1678
+ "text": " | "
1679
+ },
1641
1680
  {
1642
1681
  "kind": "Reference",
1643
1682
  "text": "Connotation.CTA",
@@ -1675,7 +1714,7 @@
1675
1714
  "name": "ButtonConnotation",
1676
1715
  "typeTokenRange": {
1677
1716
  "startIndex": 1,
1678
- "endIndex": 13
1717
+ "endIndex": 15
1679
1718
  }
1680
1719
  },
1681
1720
  {
@@ -10551,6 +10590,15 @@
10551
10590
  "kind": "Content",
10552
10591
  "text": " | "
10553
10592
  },
10593
+ {
10594
+ "kind": "Reference",
10595
+ "text": "Connotation.Announcement",
10596
+ "canonicalReference": "@vonage/vivid!Connotation.Announcement:member"
10597
+ },
10598
+ {
10599
+ "kind": "Content",
10600
+ "text": " | "
10601
+ },
10554
10602
  {
10555
10603
  "kind": "Reference",
10556
10604
  "text": "Connotation.CTA",
@@ -10588,7 +10636,7 @@
10588
10636
  "name": "SplitButtonConnotation",
10589
10637
  "typeTokenRange": {
10590
10638
  "startIndex": 1,
10591
- "endIndex": 13
10639
+ "endIndex": 15
10592
10640
  }
10593
10641
  },
10594
10642
  {
package/shared/aria2.cjs DELETED
@@ -1,11 +0,0 @@
1
- 'use strict';
2
-
3
- /**
4
- * Standard orientation values
5
- */
6
- const Orientation = {
7
- horizontal: "horizontal",
8
- vertical: "vertical",
9
- };
10
-
11
- exports.Orientation = Orientation;
package/shared/aria2.js DELETED
@@ -1,9 +0,0 @@
1
- /**
2
- * Standard orientation values
3
- */
4
- const Orientation = {
5
- horizontal: "horizontal",
6
- vertical: "vertical",
7
- };
8
-
9
- export { Orientation as O };
package/shared/button.cjs DELETED
@@ -1,202 +0,0 @@
1
- 'use strict';
2
-
3
- const index = require('./index.cjs');
4
- const applyMixins = require('./apply-mixins.cjs');
5
- const formAssociated = require('./form-associated.cjs');
6
- const ariaGlobal = require('./aria-global.cjs');
7
- const startEnd = require('./start-end.cjs');
8
-
9
- class _Button extends index.FoundationElement {
10
- }
11
- /**
12
- * A form-associated base class for the {@link @microsoft/fast-foundation#(Button:class)} component.
13
- *
14
- * @internal
15
- */
16
- class FormAssociatedButton extends formAssociated.FormAssociated(_Button) {
17
- constructor() {
18
- super(...arguments);
19
- this.proxy = document.createElement("input");
20
- }
21
- }
22
-
23
- /**
24
- * A Button Custom HTML Element.
25
- * Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button | <button> element }.
26
- *
27
- * @slot start - Content which can be provided before the button content
28
- * @slot end - Content which can be provided after the button content
29
- * @slot - The default slot for button content
30
- * @csspart control - The button element
31
- * @csspart content - The element wrapping button content
32
- *
33
- * @public
34
- */
35
- let Button$1 = class Button extends FormAssociatedButton {
36
- constructor() {
37
- super(...arguments);
38
- /**
39
- * Prevent events to propagate if disabled and has no slotted content wrapped in HTML elements
40
- * @internal
41
- */
42
- this.handleClick = (e) => {
43
- var _a;
44
- if (this.disabled && ((_a = this.defaultSlottedContent) === null || _a === void 0 ? void 0 : _a.length) <= 1) {
45
- e.stopPropagation();
46
- }
47
- };
48
- /**
49
- * Submits the parent form
50
- */
51
- this.handleSubmission = () => {
52
- if (!this.form) {
53
- return;
54
- }
55
- const attached = this.proxy.isConnected;
56
- if (!attached) {
57
- this.attachProxy();
58
- }
59
- // Browser support for requestSubmit is not comprehensive
60
- // so click the proxy if it isn't supported
61
- typeof this.form.requestSubmit === "function"
62
- ? this.form.requestSubmit(this.proxy)
63
- : this.proxy.click();
64
- if (!attached) {
65
- this.detachProxy();
66
- }
67
- };
68
- /**
69
- * Resets the parent form
70
- */
71
- this.handleFormReset = () => {
72
- var _a;
73
- (_a = this.form) === null || _a === void 0 ? void 0 : _a.reset();
74
- };
75
- /**
76
- * Overrides the focus call for where delegatesFocus is unsupported.
77
- * This check works for Chrome, Edge Chromium, FireFox, and Safari
78
- * Relevant PR on the Firefox browser: https://phabricator.services.mozilla.com/D123858
79
- */
80
- this.handleUnsupportedDelegatesFocus = () => {
81
- var _a;
82
- // Check to see if delegatesFocus is supported
83
- if (window.ShadowRoot &&
84
- !window.ShadowRoot.prototype.hasOwnProperty("delegatesFocus") &&
85
- ((_a = this.$fastController.definition.shadowOptions) === null || _a === void 0 ? void 0 : _a.delegatesFocus)) {
86
- this.focus = () => {
87
- this.control.focus();
88
- };
89
- }
90
- };
91
- }
92
- formactionChanged() {
93
- if (this.proxy instanceof HTMLInputElement) {
94
- this.proxy.formAction = this.formaction;
95
- }
96
- }
97
- formenctypeChanged() {
98
- if (this.proxy instanceof HTMLInputElement) {
99
- this.proxy.formEnctype = this.formenctype;
100
- }
101
- }
102
- formmethodChanged() {
103
- if (this.proxy instanceof HTMLInputElement) {
104
- this.proxy.formMethod = this.formmethod;
105
- }
106
- }
107
- formnovalidateChanged() {
108
- if (this.proxy instanceof HTMLInputElement) {
109
- this.proxy.formNoValidate = this.formnovalidate;
110
- }
111
- }
112
- formtargetChanged() {
113
- if (this.proxy instanceof HTMLInputElement) {
114
- this.proxy.formTarget = this.formtarget;
115
- }
116
- }
117
- typeChanged(previous, next) {
118
- if (this.proxy instanceof HTMLInputElement) {
119
- this.proxy.type = this.type;
120
- }
121
- next === "submit" && this.addEventListener("click", this.handleSubmission);
122
- previous === "submit" && this.removeEventListener("click", this.handleSubmission);
123
- next === "reset" && this.addEventListener("click", this.handleFormReset);
124
- previous === "reset" && this.removeEventListener("click", this.handleFormReset);
125
- }
126
- /** {@inheritDoc (FormAssociated:interface).validate} */
127
- validate() {
128
- super.validate(this.control);
129
- }
130
- /**
131
- * @internal
132
- */
133
- connectedCallback() {
134
- var _a;
135
- super.connectedCallback();
136
- this.proxy.setAttribute("type", this.type);
137
- this.handleUnsupportedDelegatesFocus();
138
- const elements = Array.from((_a = this.control) === null || _a === void 0 ? void 0 : _a.children);
139
- if (elements) {
140
- elements.forEach((span) => {
141
- span.addEventListener("click", this.handleClick);
142
- });
143
- }
144
- }
145
- /**
146
- * @internal
147
- */
148
- disconnectedCallback() {
149
- var _a;
150
- super.disconnectedCallback();
151
- const elements = Array.from((_a = this.control) === null || _a === void 0 ? void 0 : _a.children);
152
- if (elements) {
153
- elements.forEach((span) => {
154
- span.removeEventListener("click", this.handleClick);
155
- });
156
- }
157
- }
158
- };
159
- index.__decorate([
160
- index.attr({ mode: "boolean" })
161
- ], Button$1.prototype, "autofocus", void 0);
162
- index.__decorate([
163
- index.attr({ attribute: "form" })
164
- ], Button$1.prototype, "formId", void 0);
165
- index.__decorate([
166
- index.attr
167
- ], Button$1.prototype, "formaction", void 0);
168
- index.__decorate([
169
- index.attr
170
- ], Button$1.prototype, "formenctype", void 0);
171
- index.__decorate([
172
- index.attr
173
- ], Button$1.prototype, "formmethod", void 0);
174
- index.__decorate([
175
- index.attr({ mode: "boolean" })
176
- ], Button$1.prototype, "formnovalidate", void 0);
177
- index.__decorate([
178
- index.attr
179
- ], Button$1.prototype, "formtarget", void 0);
180
- index.__decorate([
181
- index.attr
182
- ], Button$1.prototype, "type", void 0);
183
- index.__decorate([
184
- index.observable
185
- ], Button$1.prototype, "defaultSlottedContent", void 0);
186
- /**
187
- * Includes ARIA states and properties relating to the ARIA button role
188
- *
189
- * @public
190
- */
191
- class DelegatesARIAButton {
192
- }
193
- index.__decorate([
194
- index.attr({ attribute: "aria-expanded" })
195
- ], DelegatesARIAButton.prototype, "ariaExpanded", void 0);
196
- index.__decorate([
197
- index.attr({ attribute: "aria-pressed" })
198
- ], DelegatesARIAButton.prototype, "ariaPressed", void 0);
199
- applyMixins.applyMixins(DelegatesARIAButton, ariaGlobal.ARIAGlobalStatesAndProperties);
200
- applyMixins.applyMixins(Button$1, startEnd.StartEnd, DelegatesARIAButton);
201
-
202
- exports.Button = Button$1;